menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ChartLegendTextStyle - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartLegendTextStyle

    Represents the text style properties for legend text in a chart.

    Inheritance
    System.Object
    ChartSubComponent
    ChartDefaultFont
    ChartLegendTextStyle
    Inherited Members
    ChartDefaultFont.Color
    ChartDefaultFont.FontStyle
    ChartDefaultFont.Opacity
    ChartDefaultFont.TextAlignment
    ChartDefaultFont.TextOverflow
    Namespace: Syncfusion.Blazor.Charts
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ChartLegendTextStyle : ChartDefaultFont, ISubcomponentTracker, IChartDefaultFont

    Constructors

    ChartLegendTextStyle()

    Declaration
    public ChartLegendTextStyle()

    Properties

    FontFamily

    Gets or sets the font family for the legend text.

    Declaration
    public override string FontFamily { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the font family for the legend text. The default font family is determined by the chart's theme. By default, the theme is set to Material with the font family Roboto.

    Overrides
    ChartDefaultFont.FontFamily
    Remarks

    This property enables setting a specific font style for the legend text, allowing for better visual harmony with other theme elements.

    Examples
    // This example demonstrates how to customize the legend text font family in a chart.
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" Name="Gold" XName="Country" YName="Gold" />
        </ChartSeriesCollection>
        <ChartLegendSettings Visible="true">
            <ChartLegendTextStyle FontFamily="Roboto"  />
        </ChartLegendSettings>
    </SfChart>

    FontWeight

    Gets or sets the font weight for the legend text.

    Declaration
    public override string FontWeight { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the font weight for the legend text. The default font weight is determined by the chart's theme. By default, the theme is set to Material with a font weight of 400.

    Overrides
    ChartDefaultFont.FontWeight
    Remarks

    Use this property to control the boldness or thinness of the legend text, which can affect readability and emphasis.

    Examples
    // This example demonstrates how to customize the legend text font weight in a chart.
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" Name="Gold" XName="Country" YName="Gold" />
        </ChartSeriesCollection>
        <ChartLegendSettings Visible="true">
            <ChartLegendTextStyle FontWeight="400"  />
        </ChartLegendSettings>
    </SfChart>

    Size

    Gets or sets the font size for the legend text.

    Declaration
    public override string Size { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the font size for the legend text. The default font size for the legend text is 14px.

    Overrides
    ChartDefaultFont.Size
    Remarks

    This property allows customization of how large or small the legend's text should appear.

    Examples
    // This example demonstrates how to customize the legend text size in a chart.
    <SfChart>
        <ChartSeriesCollection>
            <ChartSeries DataSource="@MedalDetails" Name="Gold" XName="Country" YName="Gold" />
        </ChartSeriesCollection>
        <ChartLegendSettings Visible="true">
            <ChartLegendTextStyle Size="14px" />
        </ChartLegendSettings>
    </SfChart>
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved