Class ChartDataLabelSettings
Represents a base class for the CartesianDataLabelSettings, and CircularDataLabelSettings classes.
Inheritance
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.dll
Syntax
public abstract class ChartDataLabelSettings : BindableObject
Remarks
Data labels can be added to a chart series by enabling the ShowDataLabels option.
ChartDataLabelSettings is used to customize the appearance of the data label that appears on a series.
Constructors
ChartDataLabelSettings()
Initializes a new instance of the ChartDataLabelSettings class.
Declaration
public ChartDataLabelSettings()
Fields
LabelPlacementProperty
Identifies the LabelPlacement bindable property.
Declaration
public static readonly BindableProperty LabelPlacementProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
UseSeriesPaletteProperty
Identifies the UseSeriesPalette bindable property.
Declaration
public static readonly BindableProperty UseSeriesPaletteProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
LabelPlacement
Gets or sets a value that determines whether to place the data label on series.
Declaration
public DataLabelPlacement LabelPlacement { get; set; }
Property Value
Type | Description |
---|---|
DataLabelPlacement | It accepts DataLabelPlacement values and its default value is Auto. |
Remarks
Applies to Cartesian, Funnel, and Pyramid charts.
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
<chart:LineSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings LabelPlacement ="Center"/>
</chart:LineSeries.DataLabelSettings>
</chart:LineSeries>
</chart:SfCartesianChart>
LabelStyle
Gets or sets a value for customizing the data labels.
Declaration
public ChartDataLabelStyle LabelStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartDataLabelStyle | It accepts ChartDataLabelStyle and its default value is null. |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
<chart:LineSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings>
<chart:CartesianDataLabelSettings.LabelStyle>
<chart:ChartDataLabelStyle Background = "Red" FontSize="14" TextColor="Black" />
</chart:CartesianDataLabelSettings.LabelStyle>
</chart:CartesianDataLabelSettings>
</chart:LineSeries.DataLabelSettings>
</chart:LineSeries>
</chart:SfCartesianChart>
UseSeriesPalette
Gets or sets a value indicating whether the background of the data label should be filled with the series color or not.
Declaration
public bool UseSeriesPalette { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts the bool value and its default value is |
Examples
<chart:SfCartesianChart>
<!-- ... Eliminated for simplicity-->
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
<chart:LineSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings UseSeriesPalette="False" />
</chart:LineSeries.DataLabelSettings>
</chart:LineSeries>
</chart:SfCartesianChart>
Methods
OnBindingContextChanged()
Declaration
protected override void OnBindingContextChanged()