Custom Trackball Text Function

Hi,

In my project, I am using a trackball on a chart to display text during mouseover. What I need to be able to do is display a the result of a function where the inputs are the x and y coordinates of the nearest point to the mouse. For example, in a histogram, I would want to display the percentile in the mouse over, so if a user hovers over a point, I'd want the caption to display something like:

Percentile: 35%

I know this can be done from a custom tooltip triggered by the ChartRegionMouseHover event, which I have implemented, but I prefer the smoothness of the trackball. Is there any way to do this? I couldn't find an appropriate event to create a handler for.


3 Replies

GM Gayathri Manickam Syncfusion Team November 18, 2021 12:53 PM UTC

Hi Keshav, 
 
Greetings from Syncfusion. 
 
We analyzed your query “Need to add custom text in trackball” and you can achieve this requirement with the help of TrackballTooltipRendering event as shown in the below code snippet. 
 
this.chartControl1.Trackball.Visible = true; 
this.chartControl1.Trackball.TrackballTooltipRendering += Trackball_TrackballTooltipRendering; //event to modify label  
 
private void Trackball_TrackballTooltipRendering(object sender, TrackballTooltipEventArgs args) 
   var index = args.pointIndex; 
   args.Text = ""
   foreach (ChartSeries series in chartControl1.Series) 
  
      var point = series.Points[index]; 
      args.Text = "Percentile: " + point.X.ToString() + "% "
  
 
 
Thanks, 
Gayathri M. 



KA KA November 21, 2021 03:54 AM UTC

Thank you. That really helped. As a quick follow up, would I be able to use this event to also fix the trackball tooltip location? For example, if I want the trackball tooltip to stay fixed at the top right of the chart area?



GM Gayathri Manickam Syncfusion Team November 22, 2021 12:22 PM UTC

Hi Keshav,  
 
We analyzed your query but currently we don’t have support to show the trackball at fixed position in the load time. 
 
Please let us know if you need further assistance. 
 
Thanks,  
Gayathri M. 


Loader.
Up arrow icon