How to customize the labels in chart axis?
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">
</TextBlock>
</Border> </DataTemplate>
The LabelTemplate property of the ChartAxis can be used to set the template for the labels in the ChartAxis.
<syncfusion:ChartArea>
<syncfusion:ChartArea.PrimaryAxis>
<syncfusion:ChartAxis RangePadding="None" LabelTemplate="{StaticResource LabelsTemplate}" syncfusion:ChartArea.ShowGridLines="True">
<syncfusion:ChartAxis.Header>
<TextBlock Text="X - Axis" FontFamily="Arial" FontSize="11" Foreground="Black" FontWeight="Bold"/>
</syncfusion:ChartAxis.Header>
</syncfusion:ChartAxis>
</syncfusion:ChartArea.PrimaryAxis> </syncfusion:ChartArea>