Category / Section
How to customize the trackball appearance in WPF Chart?
1 min read
This article explains how to change the Trackball's default appearance. It has been shown by default with the corresponding Y- axis value. But here you are going to learn a way to display the trackball content with its corresponding X- axis value. This can be achieved with the help of the TrackBallLabelTemplate in the WPF Chart Series as shown in the following code snippet
<syncfusion:SfChart>
<syncfusion:SfChart.Resources>
<DataTemplate x:Key="labelTemplate">
<Border CornerRadius="2" Background="Violet">
<TextBlock Foreground="White" Margin="5" Text="{Binding Item.Name}"/>
</Border>
</DataTemplate>
</syncfusion:SfChart.Resources>
..
<syncfusion:ColumnSeries
ItemsSource="{Binding Data}"
XBindingPath="Name"
ShowTrackballInfo="True"
TrackBallLabelTemplate="{StaticResource labelTemplate}"
YBindingPath="Height" >
</syncfusion:ColumnSeries>
<syncfusion:SfChart.Behaviors>
<syncfusion:ChartTrackBallBehavior />
</syncfusion:SfChart.Behaviors>
</syncfusion:SfChart>
Screenshot:
The following screenshot displays a chart with customized trackball content.
Did not find the solution
Contact Support