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.Charts
Assembly: Syncfusion.Maui.Charts.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.
<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>
SfCircularChart chart = new SfCircularChart();
chart.Legend = new ChartLegend();
ChartLegendLabelStyle labelStyle = new ChartLegendLabelStyle()
{
TextColor = Colors.Red,
FontSize = 25,
};
chart.Legend=labelStyle;
Constructors
ChartLegendLabelStyle()
Declaration
public ChartLegendLabelStyle()
Fields
FontAttributesProperty
Identifies the FontAttributes bindable property.
Declaration
public static readonly BindableProperty FontAttributesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
FontFamilyProperty
Identifies the FontFamily bindable property.
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
FontSizeProperty
Identifies the FontSize bindable property.
Declaration
public static readonly BindableProperty FontSizeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MarginProperty
Identifies the Margin bindable property.
Declaration
public static readonly BindableProperty MarginProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TextColorProperty
Identifies the TextColor bindable property.
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
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>