Class
ChartLegendLabels

Configures the text styling and content for legend labels in ChartLegend. Use this component to customize how series names and information are displayed in the legend, including text color, font styling, custom templates, and spacing. Legend labels provide essential textual identification that helps users understand what each visual element represents in the chart. Children: ChartLegendLabelsMargin, ChartLegendLabelsPadding.

Definition

Constructors

ChartLegendLabels()

Declaration

cs-api-definition
public ChartLegendLabels()

Properties

ChildContent

Declaration

cs-api-definition
[Parameter]
public RenderFragment ChildContent { get; set; }

Property Value

RenderFragment

Color

Sets the text color for legend labels. Accepts any valid CSS color including hex codes (#333333), RGB values (rgb(51,51,51)), named colors (darkgray), or HSL values. Choose colors that provide good contrast with the legend background for optimal readability and accessibility in different viewing conditions and themes.

Declaration

cs-api-definition
[Parameter]
public string Color { get; set; }

Property Value

string

Font

Defines the font styling for legend labels using CSS font notation. Specify properties like size, weight, and family in a single string, for example: "14px Arial", "bold 16px 'Times New Roman'", or "italic 12px sans-serif". Proper font styling ensures legend text is readable and matches your application's typography standards.

Declaration

cs-api-definition
[Parameter]
public string Font { get; set; }

Property Value

string

Template

Defines a custom template for rendering legend labels with dynamic content. Use placeholders like {text} for series names, {series} for series data, {value} for point values (donut/pie charts), or {percentage} for percentage values (donut/pie/100% stacked charts). Templates enable rich legend content with series-specific information, formatting, and custom styling.

Declaration

cs-api-definition
[Parameter]
public string Template { get; set; }

Property Value

string

Methods

BuildRenderTree(RenderTreeBuilder)

Declaration

cs-api-definition
protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder

RenderTreeBuilder

Overrides ComponentBase.BuildRenderTree(RenderTreeBuilder)

OnAfterRender(bool)

Declaration

cs-api-definition
protected override void OnAfterRender(bool firstRender)

Parameters

firstRender

bool

Overrides ComponentBase.OnAfterRender(bool)

OnInitialized()

Declaration

cs-api-definition
protected override void OnInitialized()

Overrides DataVizChildComponent.OnInitialized()

OnParametersSet()

Declaration

cs-api-definition
protected override void OnParametersSet()

Overrides ComponentBase.OnParametersSet()

Serialize()

Declaration

cs-api-definition
public Dictionary<string, object> Serialize()

Returns

Dictionary<string, object>