We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the trackball appearance in WPF Chart?


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.

Customized trackball content in WPF Chart

 

 

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile