Some changes in graph for crosshair

I need some guidance in graph I want similar feature like crosshair but just like in crosshair if I tap on any  graph it will show graph value but I want that if I tap on any point it should give value of nearest point in that graph 


1 Reply

YG Yuvaraj Gajaraj Syncfusion Team July 11, 2022 01:33 PM UTC

Hi Risheeta,


Greetings from Syncfusion. We suggest you the onTrackballPositionChanging callback using this you can get the data point information that is closest to your tap position. We have attached the code snippet below to achieve your requirement.


Code snippet:

SfCartesianChart(

  onTrackballPositionChanging: (args) {

    print(args.chartPointInfo.chartDataPoint!.x);

    print(args.chartPointInfo.chartDataPoint!.y);

  },

  trackballBehavior: TrackballBehavior(

      enable: true,

      activationMode: ActivationMode.singleTap,

      lineColor: Colors.transparent,

      // If you want to hide the tooltip use the below property

      tooltipSettings: const InteractiveTooltip(enable: false)),

  //Other required properties

)


UG: https://help.syncfusion.com/flutter/cartesian-charts/trackball-crosshair#label-display-mode


Sample: https://flutter.syncfusion.com/#/cartesian-charts/user-interactions/trackball/chart-with-trackball


If you have any further queries, please get back to us.


Regards,

Yuvaraj.


Loader.
Up arrow icon