|
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
// To disable the track line.
lineWidth: 0,
// To disable the trackball tooltip.
tooltipSettings: InteractiveTooltip(
enable: false
)
), |
|
// String label value with default value
String label = "High: " + "\n" "Low: " + "\n" "Open: " + "\n" "Close: ";
// Key for accessing the custom widget state
GlobalKey<CustomWidgetState> key = GlobalKey<CustomWidgetState>(); |
|
// Creates the custom widget which returns the container which going to acts as static tooltip
class CustomWidget extends StatefulWidget {
CustomWidget({this.key});
Key key;
@override
CustomWidgetState createState() => CustomWidgetState();
}
// Method to refresh the custom widget state
void refresh() {
if (mounted) {
setState(() {});
}
} |
|
onTrackballPositionChanging: (TrackballArgs args) {
//Assigning the trackball label value to the label
label = args.chartPointInfo.label;
// Refreshing the custom widget state.
key.currentState.refresh();
}, |
|
Positioned(
top: 20,
left: 50,
// Placed the custom widget.
child: CustomWidget(
key: key,
)
) |
Hi, I need the same thing with a crosshair, there is a way to get the index or any other value from CrosshairRendererArgs?
Hi Iyar,
We are validating your query at our end and we will update further details in one business day on 14 March 2023. We appreciate your patience until then.
Regards,
Yuvaraj.
Hi Iyar,
Currently, in the onCrosshairPositionChanging event, you can only able to customize the tooltip value of crosshair only and not able to get the tooltip values. However, you can achieve your requirement with the help of onChartTouchInteractionMove callback, it will give you the offset value of the chart touch using this position you can find the respective x and y point values with the help of the pixelToPoint method and display them in the static position. We have created the sample and shared it below for your reference.
Screenshot:
Regards,
Yuvaraj.