Class ChartLegendLabelStyle
The ChartLegendLabelStyle class provides customizable styling options for the labels in a chart's legend, allowing you to define properties such as font size, font family, text color, margin, and font attributes to enhance the visual appearance of the legend labels.
Inheritance
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class ChartLegendLabelStyle : Element
Remarks
It provides more options to customize the chart legend label
FontAttributes - To customize the font attribute, refer to this FontAttributes property.
TextColor - To customize the text color, refer to this TextColor property.
Margin - To customize the label margin, refer to this Margin property.
FontSize - To customize the font size, refer to this FontSize property.
FontFamily - To customize the font family, refer to this FontFamily property.
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.Legend>
<chart:ChartLegend>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle TextColor = "Red" FontSize="25"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfCircularChart.Legend>
</chart:SfCircularChart>
Constructors
ChartLegendLabelStyle()
Initializes a new instance of the ChartLegendLabelStyle class.
Declaration
public ChartLegendLabelStyle()
Fields
FontAttributesProperty
Identifies the FontAttributes bindable property.
Declaration
public static readonly BindableProperty FontAttributesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the FontAttributes bindable property determines the font attributes of the chart legend label.
FontFamilyProperty
Identifies the FontFamily bindable property.
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the FontFamily bindable property determines the font family of the chart legend label.
FontSizeProperty
Identifies the FontSize bindable property.
Declaration
public static readonly BindableProperty FontSizeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the FontSize bindable property determines the font size of the chart legend label.
MarginProperty
Identifies the Margin bindable property.
Declaration
public static readonly BindableProperty MarginProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the Margin bindable property determines the margin around the chart legend label.
TextColorProperty
Identifies the TextColor bindable property.
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the TextColor bindable property determines the text color of the chart legend label.
Properties
FontAttributes
Gets or sets a value that indicates the font attributes of the label.
Declaration
public FontAttributes FontAttributes { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.FontAttributes | It accepts System.String values. |
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.Legend>
<chart:ChartLegend>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle FontAttributes="Bold" />
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfCircularChart.Legend>
</chart:SfCircularChart>
FontFamily
Gets or sets a value that indicates the font family of the label.
Declaration
public string FontFamily { get; set; }
Property Value
Type | Description |
---|---|
System.String | It accepts System.String values. |
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.Legend>
<chart:ChartLegend>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle FontFamily="PlaywriteAR-Regular"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfCircularChart.Legend>
</chart:SfCircularChart>
FontSize
Gets or sets a value that indicates the label's size.
Declaration
public double FontSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts System.Double values. |
Remarks
The value must be greater than zero and both System.Double.MinValue and System.Double.MaxValue are not valid.
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.Legend>
<chart:ChartLegend>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle FontSize="25"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfCircularChart.Legend>
</chart:SfCircularChart>
Margin
Gets or sets a value that indicates the margin of the label.
Declaration
public Thickness Margin { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Thickness | It accepts Microsoft.Maui.Thickness values. |
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.Legend>
<chart:ChartLegend>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle Margin="10"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfCircularChart.Legend>
</chart:SfCircularChart>
TextColor
Gets or sets a value to customize the appearance of the label's text color.
Declaration
public Color TextColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | It accepts the Microsoft.Maui.Graphics.Color value. |
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.Legend>
<chart:ChartLegend>
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle TextColor = "Red"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfCircularChart.Legend>
</chart:SfCircularChart>