Category / Section
How to customize the data label's font?
1 min read
Our Chart provides support to add data markers to adorn the data points with shapes and labels. Data label is enabled by setting the ShowLabel property to true. You can change the font family, font size etc., of the data label using the LabelStyle, which is a sub-property of the DataMarker property.
The following code illustrates how to customize the data label’s font.
XAML
<chart:BubbleSeries x:Name="bubbleSeries" ItemsSource="{Binding BubbleData}" XBindingPath="XValue" YBindingPath="YValue" Size="Size" > <chart:BubbleSeries.DataMarker> <chart:ChartDataMarker> <chart:ChartDataMarker.LabelStyle> <chart:DataMarkerLabelStyle FontFamily="Arial" FontSize="20" FontAttributes="None" /> </chart:ChartDataMarker.LabelStyle> </chart:ChartDataMarker> </chart:BubbleSeries.DataMarker> </chart:BubbleSeries>
C#
bubbleSeries.DataMarker = new ChartDataMarker (); bubbleSeries.DataMarker.LabelStyle = new DataMarkerLabelStyle (); bubbleSeries.DataMarker.LabelStyle.FontSize = 20; bubbleSeries.DataMarker.LabelStyle.FontFamily = "Arial"; bubbleSeries.DataMarker.LabelStyle.FontAttributes= "None";