Class ChartDataLabelSettings
Represents a base class for the CartesianDataLabelSettings, CircularDataLabelSettings , PyramidDataLabelSettings , FunnelDataLabelSettings and PolarDataLabelSettings classes.
Inheritance
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public abstract class ChartDataLabelSettings : BindableObject
Remarks
Data labels can be added to a chart or 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 |
Remarks
The identifier for the LabelPlacement bindable property determines the placement of the data labels.
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the LabelStyle bindable property determines the style of the data labels.
UseSeriesPaletteProperty
Identifies the UseSeriesPalette bindable property.
Declaration
public static readonly BindableProperty UseSeriesPaletteProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the UseSeriesPalette bindable property determines whether the data labels use the series palette colors.
Properties
LabelPlacement
Determines the placement of data labels relative to the data points in a chart, such as inside, outside, or at the center of the data point.
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 |
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>