How to get data(VALUE) of current point from trackball in SfChart?

Please help and say me how can I get data of current point in trackball.I want to get point and write it in Label.But I need to get value of current point.How to get this 20 value on image?



Attachment: Screenshot_2_43743503.rar

1 Reply

YP Yuvaraj Palanisamy Syncfusion Team July 8, 2021 07:17 AM UTC

Hi Maria, 
 
Greetings from Syncfusion. 
 
We would like to let you know that you can get the trackball label text by using TrackballCreated event in SfChart as per the below code example. 
 
CodeSnippet: 
<chart:SfChart TrackballCreated="SfChart_TrackballCreated" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"> 
 
. . . 
 
</chart:SfChart> 
 
private void SfChart_TrackballCreated(object sender, ChartTrackballCreatedEventArgs e) 
{ 
    foreach(var trackballInfo in e.ChartPointsInfo) 
    { 
        // Get or set the trackball label text 
        var trackballLabelText = trackballInfo.Label; 
        trackballInfo.Label += "%"; 
 
    } 
 
    rectangleAnnotation.X1 = (e.ChartPointsInfo[0] as ChartPointInfo).XPosition;       
    if (!rectangleAnnotation.IsVisible) 
    { 
        rectangleAnnotation.IsVisible = true; 
        var seriesBounds = (sender as SfChart).SeriesBounds; 
        rectangleAnnotation.Y1 = seriesBounds.Top; 
        rectangleAnnotation.Y2 = seriesBounds.Bottom; 
        rectangleAnnotation.X2 = seriesBounds.Right; 
    } 
} 
 
Also, we have attached the sample for your reference. Please find the sample from the below link. 
 
 
For more details, please refer the below link 
 
Regards, 
Yuvaraj. 


Loader.
Up arrow icon