Add labels for track ball

27 Oct 20201 minute to read

We can add labels for track ball to show the corresponding values. In order to add labels for the trackball, you need to subscribe the event OnSparklineMouseMove and you can get the following data’s from event argument.




<Syncfusion:SfLineSparkline ShowTrackBall="True" OnSparklineMouseMove="SfLineSparkline_OnSparklineMouseMove" x:Name="sparkline" ItemsSource="{Binding UsersList}" YBindingPath="NoOfUsers" >

ContentPresenter info;

        private void SfLineSparkline_OnSparklineMouseMove(object src, SparklineMouseMoveEventArgs args)


            if (!args.RootPanel.Children.Contains(info))


                info=new ContentPresenter();


                TextBlock.SetForeground(info, new SolidColorBrush(Colors.Red)); 
                TextBlock.SetFontSize(info, 25); 

            info.Content = args.Value.Y;

            info.Arrange(new Rect(args.Coordinate.X,args.Coordinate.Y,info.ActualWidth,info.ActualHeight));


Following is the snapshot for track ball labels,

custom label in Sparkline track ball