Class CartesianDataLabelSettings
The CartesianDataLabelSettings class is used to customize the appearance of cartesian series data labels.
Inherited Members
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.dll
Syntax
public class CartesianDataLabelSettings : ChartDataLabelSettings
Remarks
To customize data labels, create an instance of CartesianDataLabelSettings class, and set it to the DataLabelSettings property of a cartesian series.
ShowDataLabels
Data labels can be added to a chart series by enabling the ShowDataLabels option.
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:LineSeries ItemsSource ="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue"
ShowDataLabels="True"/>
</chart:SfCartesianChart>
Customization
To change the appearance of data labels, it offers LabelStyle options.
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:LineSeries ItemsSource ="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue"
ShowDataLabels="True">
<chart:LineSeries.CartesianDataLabelSettings>
<chart:CartesianDataLabelSettings>
<chart:CartesianDataLabelSettings.LabelStyle>
<chart:ChartDataLabelStyle Background = "Red" FontSize="14" TextColor="Black" />
</chart:CartesianDataLabelSettings.LabelStyle>
</chart:CartesianDataLabelSettings>
</chart:LineSeries.CartesianDataLabelSettings>
<chart:LineSeries />
</chart:SfCartesianChart>
Constructors
CartesianDataLabelSettings()
Initializes a new instance of the CartesianDataLabelSettings.
Declaration
public CartesianDataLabelSettings()
Fields
BarAlignmentProperty
Identifies the BarAlignment bindable property.
Declaration
public static readonly BindableProperty BarAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
BarAlignment
Gets or sets the value for a bar chart data label's alignment.
Declaration
public DataLabelAlignment BarAlignment { get; set; }
Property Value
Type | Description |
---|---|
DataLabelAlignment | It accepts DataLabelAlignment values and has a default value of Top. |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:ColumnSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
<chart:ColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings BarAlignment="Middle" />
</chart:ColumnSeries.DataLabelSettings>
</chart:ColumnSeries>
</chart:SfCartesianChart>