Category / Section
How to wrap the axis labels in WPF Chart (SfChart)?
1 min read
You can wrap the axis labels by customizing the LabelTemplate property of WPF Chart (SfChart) axis.
XAML
<Grid> <Grid.Resources> <DataTemplate x:Key="labelTemplate"> <Grid Height="70" Width="40"> <TextBlock TextWrapping="Wrap" Text="{Binding LabelContent}" FontSize="12"/> </Grid> </DataTemplate> </Grid.Resources> <chart:SfChart> <chart:SfChart.PrimaryAxis> <chart:CategoryAxis LabelTemplate="{StaticResource labelTemplate}"/> </chart:SfChart.PrimaryAxis> </chart:SfChart> </Grid>
The following screenshot illustrates the axis labels wrapping.