menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ChartLegendLabelStyle - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    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
    System.Object
    ChartLegendLabelStyle
    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.

    # [MainPage.xaml](#tab/tabid-1)
    <chart:SfCircularChart>
    
    &lt;chart:SfCircularChart.Legend>
        &lt;chart:ChartLegend>
           &lt;chart:ChartLegend.LabelStyle>
               &lt;chart:ChartLegendLabelStyle TextColor = &quot;Red&quot; FontSize=&quot;25&quot;/>
           &lt;/chart:ChartLegend.LabelStyle>
       &lt;/chart:ChartLegend>
    &lt;/chart:SfCircularChart.Legend>
    

    </chart:SfCircularChart>

    • MainPage.xaml.cs
    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCircularChart>
    
        <chart:SfCircularChart.Legend>
            <chart:ChartLegend>
               <chart:ChartLegend.LabelStyle>
                   <chart:ChartLegendLabelStyle FontAttributes="Bold" />
               </chart:ChartLegend.LabelStyle>
           </chart:ChartLegend>
        </chart:SfCircularChart.Legend>
    
    </chart:SfCircularChart>
    SfCircularChart chart = new SfCircularChart();
    
    chart.Legend = new ChartLegend(); 
    ChartLegendLabelStyle labelStyle = new ChartLegendLabelStyle()
       {
            FontAttributes = FontAttributes.Bold,
       };
    
    chart.Legend=labelStyle;

    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <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>
    SfCircularChart chart = new SfCircularChart();
    
    chart.Legend = new ChartLegend(); 
    ChartLegendLabelStyle labelStyle = new ChartLegendLabelStyle()
       {
            FontFamily="PlaywriteAR-Regular",
       };
    
    chart.Legend=labelStyle;

    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCircularChart>
    
        <chart:SfCircularChart.Legend>
            <chart:ChartLegend>
               <chart:ChartLegend.LabelStyle>
                   <chart:ChartLegendLabelStyle FontSize="25"/>
               </chart:ChartLegend.LabelStyle>
           </chart:ChartLegend>
        </chart:SfCircularChart.Legend>
    
    </chart:SfCircularChart>
    SfCircularChart chart = new SfCircularChart();
    
    chart.Legend = new ChartLegend(); 
    ChartLegendLabelStyle labelStyle = new ChartLegendLabelStyle()
       {
           FontSize = 25,
       };
    
    chart.Legend=labelStyle;

    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCircularChart>
    
        <chart:SfCircularChart.Legend>
            <chart:ChartLegend>
               <chart:ChartLegend.LabelStyle>
                   <chart:ChartLegendLabelStyle Margin="10"/>
               </chart:ChartLegend.LabelStyle>
           </chart:ChartLegend>
        </chart:SfCircularChart.Legend>
    
    </chart:SfCircularChart>
    SfCircularChart chart = new SfCircularChart();
    
    chart.Legend = new ChartLegend(); 
    ChartLegendLabelStyle labelStyle = new ChartLegendLabelStyle()
       {
            Margin=10,
       };
    
    chart.Legend=labelStyle;

    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCircularChart>
    
        <chart:SfCircularChart.Legend>
            <chart:ChartLegend>
               <chart:ChartLegend.LabelStyle>
                   <chart:ChartLegendLabelStyle TextColor = "Red"/>
               </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,
       };
    
    chart.Legend=labelStyle;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved