Show x-axis value for trackball

We are developing an application where the trackball is used to highlight the values of drug concentrations in the blood at specific times. However, we need to be able to see the exact time / x-axis position at which the trackball is located to be able to correlate that with the values at that position.

It would be great to have an option to also show a tooltip for the time / x-axis position just like we see with the crosshair. Is this possible or can this be a new feature?


Thanks in advance!


1 Reply

YG Yuvaraj Gajaraj Syncfusion Team February 23, 2022 12:11 PM UTC

Hi Luca, 
 
Greetings from Syncfusion. We have created a sample to show a tooltip at x axis where the trackball gets activated. In this sample, we have used the crosshair showByIndex public method and onTrackballPositionChanging callback, then pass the point index value where the trackball currently activated.  
We hope this will help you to achieve your requirement and we have attached the code snippet and sample below for your reference. 
 
Code snippet: 
late CrosshairBehavior _crosshairBehavior; 
 
  @override 
  void initState() { 
    _crosshairBehavior = CrosshairBehavior( 
      enable: true, 
      activationMode: ActivationMode.none, 
      lineWidth: 0, 
      lineType: CrosshairLineType.vertical, 
    ); 
    super.initState(); 
  } 
 
  @override 
  Widget build(BuildContext context) { 
    return SfCartesianChart( 
       primaryYAxis: NumericAxis( 
         interactiveTooltip: 
             const InteractiveTooltip(enable: false)), 
       onTrackballPositionChanging: (trackballArgs) { 
         _crosshairBehavior.showByIndex( 
             trackballArgs.chartPointInfo.dataPointIndex!); 
       } , 
       trackballBehavior: TrackballBehavior(enable: true), 
       crosshairBehavior: _crosshairBehavior, 
       //Other required properties    
    ); 
  } 
 
  
Regards, 
Yuvaraj. 


Loader.
Up arrow icon