Class ChartLegendSettings
Implements
Inherited Members
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class ChartLegendSettings : ChartSubComponent, ISubcomponentTracker, ILegendBase
Constructors
ChartLegendSettings()
Declaration
public ChartLegendSettings()
Properties
AccessibilityDescriptionFormat
Gets or sets the format for the legend item accessibility description of the ChartLegendSettings.
Declaration
public string AccessibilityDescriptionFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a string that defines the format for the legend item accessibility description of the ChartLegendSettings. The default value is null. |
Remarks
Use this property to specify a format for the legend item accessibility description of the ChartLegendSettings. The placeholder ${value} can be used to set the accessibility text for the legend item. For example, the format "Selected the ${value} legend" will read as "Selected the Product A legend" for the legend item with text "Product A".
AccessibilityRole
Gets or sets the accessibility role for the ChartLegendSettings.
Declaration
public string AccessibilityRole { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a string that defines the accessibility role for the ChartLegendSettings. The default value is null. |
Remarks
Use this property to provide an accessibility role for the ChartLegendSettings.
Alignment
Gets or sets the alignment of the legend.
Declaration
public Alignment Alignment { get; set; }
Property Value
Type | Description |
---|---|
Alignment | One of the Alignment enumerations that specifies the legend alignment. Options include: |
Remarks
The alignment of the legend works as follows:
Near
: Aligns the legend to the top-left of the chart if Position isLegendPosition.Top
and to the right-top of the chart if Position isLegendPosition.Right
.Center
: Aligns the legend to the top center of the chart if Position isLegendPosition.Top
and to the right center of the chart if Position isLegendPosition.Right
.Far
: Aligns the legend to the top-right of the chart if Position isLegendPosition.Top
and to the right-bottom of the chart if Position isLegendPosition.Right
.
Background
Gets or sets the background color of the chart legend area.
Declaration
public string Background { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value specifying the background color of the chart legend area. The default value is "transparent". |
Remarks
The value can be specified in hex or rgba format, following valid CSS color string conventions.
Border
Gets or sets an instance of ChartLegendBorder that specifies the border of the legend.
Declaration
public ChartLegendBorder Border { get; set; }
Property Value
Type | Description |
---|---|
ChartLegendBorder | The default value is an instance of ChartLegendBorder. |
Description
Gets or sets the description for accessibility purposes, particularly when focused on the legend element by screen readers.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the description for legends. |
EnableHighlight
Gets or sets a value indicating whether to enable highlighting when hovered over the legend element.
Declaration
public bool EnableHighlight { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if highlight options are enabled; otherwise, false. The default value is false. |
Remarks
If set to true, when hovered over the legend element, the respective series will be highlighted.
Focusable
Gets or sets the accessibility keyboard navigation focus option for the ChartLegendSettings.
Declaration
public bool Focusable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Accepts the boolean value to enable or disable the keyboard navigation for the ChartLegendSettings. The default value is true. |
Remarks
Use this property to toggle the keyboard navigation focus for the ChartLegendSettings.
Height
Gets or sets the height for the legend element.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the height of the legend element. The default value is null. Based on the legend position, the height of the legend will be calculated. |
Remarks
Accepts values in either pixels or percentage.
IsInversed
Gets or sets a value indicating whether to inverse legend item content (image and text).
Declaration
public bool IsInversed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend content should be inversed; otherwise, false. The default value is false. |
Remarks
When set to true, the legend element will display the text before the associated shape. This is different from the default, where the shape is shown first, followed by the text.
ItemPadding
Gets or sets the padding between legend items.
Declaration
public double ItemPadding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the padding between legend items. The default value is NaN. |
Location
Gets or sets an instance of ChartLocation that specifies the location of the legend relative to the chart. If x is set to 20, the legend will move 20 pixels to the right of the chart.
Declaration
public ChartLocation Location { get; set; }
Property Value
Type | Description |
---|---|
ChartLocation | The default value is an instance of ChartLocation. |
Remarks
The Position must be set to LegendPosition.Custom
to position the legend in the chart using the specified x and y offsets.
Margin
Gets or sets an instance of ChartLegendMargin which specifies the margin for the legend.
Declaration
public ChartLegendMargin Margin { get; set; }
Property Value
Type | Description |
---|---|
ChartLegendMargin | The default value is an instance of ChartLegendMargin allowing customization of left, right, top, and bottom margins. |
Remarks
The ChartLegendMargin class provides options to customize the left, right, top, and bottom margins of the chart legend. Adjusting these margins controls the space between the legend and the surrounding elements.
MaximumLabelWidth
Gets or sets the maximum width of the individual legend item after which they get trimmed, wrapped, or clipped.
Declaration
public double MaximumLabelWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Specifies the maximum width for the legend text. The default value is null. |
Opacity
Gets or sets the opacity of the legend background.
Declaration
public double Opacity { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the opacity of the legend background. The default value is 1. |
Remarks
The provided background color will be rendered with the applied opacity value.
Padding
Gets or sets the padding around the legend collection.
Declaration
public double Padding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the padding around the legend collection. The default value is 8. |
Position
Gets or sets the position of the legend in the chart.
Declaration
public LegendPosition Position { get; set; }
Property Value
Type | Description |
---|---|
LegendPosition | One of the LegendPosition enumeration that specifies the position of the legend. The options include:
|
Reverse
Gets or sets a value indicating whether to reverse the order of legend items.
Declaration
public bool Reverse { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend items should be reversed; otherwise, false. The default value is false. |
Remarks
If set to true, the last series in the collection will be placed first.
ShapeHeight
Gets or sets the height of the legend shape.
Declaration
public double ShapeHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the height of the legend shape. The default value is 10. |
ShapePadding
Gets or sets the padding between the legend shape and legend text.
Declaration
public double ShapePadding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the padding between the legend shape and legend text. The default value is 8. |
ShapeWidth
Gets or sets the width of the legend shape.
Declaration
public double ShapeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the width of the legend shape. The default value is 10. |
TabIndex
Gets or sets the tabindex value of the legend for accessibility purposes.
Declaration
public double TabIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the tabindex value for the legend. The default value is 3. |
TextOverflow
Gets or sets the text overflow behavior to employ when the individual legend text overflows the legend bounds or MaximumLabelWidth.
Declaration
public LabelOverflow TextOverflow { get; set; }
Property Value
Type | Description |
---|---|
LabelOverflow | One of the LabelOverflow enumeration values that specifies the text overflow option. The options include:
|
TextStyle
Gets or sets an instance of ChartLegendTextStyle that specifies the text style of the legend.
Declaration
public ChartLegendTextStyle TextStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartLegendTextStyle | The default value is an instance of ChartLegendTextStyle. |
Remarks
The legend text font and alignment can be customized using this instance of ChartLegendTextStyle.
TextWrap
Gets or sets the text wrap behavior when the individual legend text overflows the legend bounds or MaximumLabelWidth.
Declaration
public TextWrap TextWrap { get; set; }
Property Value
Type | Description |
---|---|
TextWrap | One of the TextWrap enumeration values that specify the text wrap option. The default value is Normal. |
Remarks
This property is applicable only when TextOverflow is set to LabelOverflow.Ellipse.
ToggleVisibility
Gets or sets a value indicating whether the series' visibility collapses on the legend click.
Declaration
public bool ToggleVisibility { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the series' visibility collapses on the legend click; otherwise, false. The default value is true. |
Visible
Gets or sets a value indicating the visibility of the legend.
Declaration
public bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend is visible; otherwise, false. The default value is true. |
Width
Gets or sets the width for the legend.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the width of the legend. Based on the legend position, the width will be calculated. The default value is null. |
Remarks
Accepts values in either pixels or percentage.
Methods
OnInitialized()
Declaration
protected override void OnInitialized()