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 labels in chart axis?

Platform: WPF |
Control: Chart


A label's border, font family, font size, foreground, font weight etc., in a chart axis can be customized to add good look and feel to the chart.

Chart axis labels can be easily customized by applying data templates to the labels in the chart axis.

The following code is the data template for labels.

<DataTemplate x:Key="LabelsTemplate">
<Border BorderBrush="#C6C6C6" BorderThickness="0.75" Padding="3">
<TextBlock Name="TB1" Text="{Binding Content}" Foreground="Black" Background="White">
</Border> </DataTemplate>

The LabelTemplate property of the ChartAxis can be used to set the template for the labels in the ChartAxis.

<syncfusion:ChartAxis RangePadding="None" LabelTemplate="{StaticResource LabelsTemplate}" syncfusion:ChartArea.ShowGridLines="True">
<TextBlock Text="X - Axis" FontFamily="Arial" FontSize="11" Foreground="Black" FontWeight="Bold"/>
</syncfusion:ChartArea.PrimaryAxis> </syncfusion:ChartArea>

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
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