Class ChartLegendSettings
Inheritance
Namespace: Syncfusion.EJ2.Charts
Assembly: Syncfusion.EJ2.dll
Syntax
public class ChartLegendSettings : EJTagHelper
Constructors
ChartLegendSettings()
Declaration
public ChartLegendSettings()
Properties
Accessibility
Options to improve accessibility for legend elements.
Declaration
public LegendSettingsAccessibility Accessibility { get; set; }
Property Value
| Type | Description |
|---|---|
| LegendSettingsAccessibility | The default value is null |
Alignment
Defines the alignment of the legend in the chart. The options are: Near - Aligns the legend to the left of the chart. Center - Aligns the legend to the center of the chart. Far - Aligns the legend to the right of the chart.
Declaration
public Alignment Alignment { get; set; }
Property Value
| Type | Description |
|---|---|
| Alignment | The default value is Syncfusion.EJ2.Charts.Alignment.Center |
Background
The background color of the legend, which accepts values in hex and rgba as valid CSS color strings.
Declaration
public string Background { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is "transparent" |
Border
Options for customizing the border of the legend.
Declaration
public ChartLegendBorder Border { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartLegendBorder | The default value is null |
ContainerPadding
Options to customize the left, right, top, and bottom padding for the chart legend container.
Declaration
public object ContainerPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object | The default value is null |
ContentTemplate
To get or set value for ContentTemplate.
Declaration
public MvcTemplate<object> ContentTemplate { get; set; }
Property Value
| Type |
|---|
| Syncfusion.EJ2.MvcTemplate<System.Object> |
Description
A description of the legend that provides additional information for screen readers.
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is null |
EnableHighlight
If set to true, the series will be highlighted when hovering over the legend.
Declaration
public bool EnableHighlight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is false |
EnablePages
If set to true, the legend will be displayed using pages.
Declaration
public bool EnablePages { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is true |
FixedWidth
When set to true, all legend items are rendered with an equal width, which is the maximum width of all items.
Declaration
public bool FixedWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is false |
Height
Specifies the height of the legend in pixels.
Declaration
public string Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is null |
IsInversed
If isInversed is set to true, it inverses the legend item content (image and text).
Declaration
public bool IsInversed { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is false |
ItemPadding
Option to customize the padding between legend items.
Declaration
public double ItemPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is Double.NaN |
Layout
Specifies the layout of the legend items in the chart.
Available options are:
Vertical: Legend items are arranged in a single column. If the legend items exceed the available space, paging is automatically applied to allow the user to navigate through the legend.
Horizontal: Legend items are arranged in a single row. If the legend items exceed the available space, paging is automatically applied to allow the user to navigate through the legend.
Auto (default): Legend items are placed based on the available space.
Declaration
public LegendLayout Layout { get; set; }
Property Value
| Type | Description |
|---|---|
| LegendLayout | The default value is LegendLayout.Auto |
Location
Specifies the location of the legend relative to the chart. If x is 20, the legend moves 20 pixels to the right of the chart.
Note that the
positionmust be set toCustomfor this feature to work.
Declaration
public ChartLocation Location { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartLocation | The default value is null |
Margin
Options for customizing the left, right, top, and bottom margins of the chart.
Declaration
public object Margin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object | The default value is null |
MaximumColumns
Specifies the maximum number of columns to allow in the available space when the layout is set to 'Auto'.
Declaration
public double MaximumColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is Double.NaN |
MaximumLabelWidth
Specifies the maximum width of the legend text labels.
Declaration
public double MaximumLabelWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is Double.NaN |
MaximumTitleWidth
Specifies the maximum width of the legend title.
Declaration
public double MaximumTitleWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 100 |
Mode
Defines the mode for displaying legend items. Series - Legend items are generated based on the count of series. Point - Legend items are created according to each unique data point. Range - Legend items are generated based on the range color mapping property. Gradient - Displays a single linear bar that represents the range color mapping property.
Note that this property is applicable only for the chart component.
Declaration
public LegendMode Mode { get; set; }
Property Value
| Type | Description |
|---|---|
| LegendMode | The default value is null |
Opacity
Customizes the opacity of the legend.
Declaration
public double Opacity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 1 |
Padding
Option to customize the padding around the legend items.
Declaration
public double Padding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 8 |
Position
Sets the position of the legend in the chart. Available options include: Auto - Places the legend according to the area type. Top - Displays the legend at the top of the chart. Left - Displays the legend on the left side of the chart. Bottom - Displays the legend at the bottom of the chart. Right - Displays the legend to the right of the chart. Custom - Displays the legend according to the given x and y position values.
Declaration
public LegendPosition Position { get; set; }
Property Value
| Type | Description |
|---|---|
| LegendPosition | The default value is LegendPosition.Auto |
Reverse
If reverse is set to true, it reverses the order of the legend items.
Declaration
public bool Reverse { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is false |
ShapeHeight
Specify the height of the legend in pixels.
Declaration
public double ShapeHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 10 |
ShapePadding
Padding between the legend shape and text.
Declaration
public double ShapePadding { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 8 |
ShapeWidth
Specify the width of the legend in pixels.
Declaration
public double ShapeWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 10 |
TabIndex
The tabIndex property determines the order in which the legend receives focus when navigating through elements with the keyboard.
Declaration
public double TabIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | The default value is 3 |
Template
Specifies the custom template used to display the legend content. The template can contain any valid HTML element or layout. When set, the provided template replaces the default legend text for the series.
Declaration
public object Template { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object | The default value is null |
TextOverflow
Defines the behavior for handling the overflow of legend text.
Clip - Specifies that the text is clipped and not accessible.
Ellipsis - Specifies an ellipsis (“...â€) for the clipped text.
Declaration
public LabelOverflow TextOverflow { get; set; }
Property Value
| Type | Description |
|---|---|
| LabelOverflow | The default value is LabelOverflow.Ellipsis |
TextStyle
The textStyle property provides options to customize the appearance of the text in the legend, including the font family, size, style, weight, and color.
Declaration
public ChartLegendTextStyle TextStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartLegendTextStyle | The default value is null |
TextWrap
Defines the text wrap behavior for the legend text when it overflows.
Available options are:
Normal - Specifies that words should only break at allowed break points.
Wrap - Specifies that a word should break if it is too long to fit on a line by itself.
AnyWhere - Specifies to break a word at any point if there are no acceptable break points in the line.
Declaration
public TextWrap TextWrap { get; set; }
Property Value
| Type | Description |
|---|---|
| TextWrap | The default value is TextWrap.Normal |
Title
Specifies the title of the legend.
Declaration
public string Title { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is null |
TitlePosition
The titlePosition property specifies the position of the legend title.
Available options are:
Top - Aligns the title to the top of the legend.
Left - Aligns the title to the left of the legend.
Right - Aligns the title to the right of the legend.
Declaration
public LegendTitlePosition TitlePosition { get; set; }
Property Value
| Type | Description |
|---|---|
| LegendTitlePosition | The default value is LegendTitlePosition.Top |
TitleStyle
The titleStyle property configures the font settings for the legend title, including font family, size, style, weight, and color.
Declaration
public ChartLegendTitleStyle TitleStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartLegendTitleStyle | The default value is null |
ToggleVisibility
If set to true, the series visibility will collapse based on the legend's visibility.
Declaration
public bool ToggleVisibility { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is true |
Visible
If set to true, the legend will be displayed for the chart.
Declaration
public bool Visible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is true |
Width
Specifies the width of the legend in pixels.
Declaration
public string Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The default value is null |