Articles in this section
Category / Section

How to customize the labels in chart axis?

1 min read


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>

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment