Configures the appearance and behavior of legends in charts.
Defines the alignment of the legend in the chart. The options are:
Defaults to ‘Center’
string
The background color of the legend, which accepts values in hex and rgba as valid CSS color strings.
Defaults to ‘transparent’
Options for customizing the border of the legend.
Options to customize the left, right, top, and bottom padding for the chart legend container.
string
A description of the legend that provides additional information for screen readers.
Defaults to null
boolean
If set to true, the series will be highlighted when hovering over the legend.
Defaults to false
boolean
If set to true, the legend will be displayed using pages.
Defaults to true
string
Specifies the height of the legend in pixels.
Defaults to null
boolean
If isInversed
is set to true, it inverses the legend item content (image and text).
Defaults to false.
number
Option to customize the padding between legend items.
Defaults to null
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
position
must be set toCustom
for this feature to work.
<div id='Chart'></div>
let chart: Chart = new Chart({
...
legendSettings: {
visible: true,
position: 'Custom',
location: { x: 100, y: 150 }
}
...
});
chart.appendTo('#Chart');
Options for customizing the left, right, top, and bottom margins of the chart.
number
Specifies the maximum width of the legend text labels.
Defaults to null
number
Specifies the maximum width of the legend title.
Defaults to 100
Defines the mode for displaying legend items.
Gradient - Displays a single linear bar that represents the range color mapping property.
Note that this property is applicable only for the chart component.
number
Customizes the opacity of the legend.
Defaults to 1
number
Option to customize the padding around the legend items.
Defaults to 8
Sets the position of the legend in the chart. Available options include:
Defaults to ‘Auto’
boolean
If reverse
is set to true, it reverses the order of the legend items.
Defaults to false
number
Specify the height of the legend in pixels.
Defaults to 10
number
Padding between the legend shape and text.
Defaults to 8
number
Specify the width of the legend in pixels.
Defaults to 10
number
The tabIndex
property determines the order in which the legend receives focus when navigating through elements with the keyboard.
Defaults to 3
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.Defaults to ‘Ellipsis’
The textStyle
property provides options to customize the appearance of the text in the legend, including the font family, size, style, weight, and color.
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.Defaults to ‘Normal’
string
Specifies the title of the legend.
Defaults to null
The titlePosition
property specifies the position of the legend title.
Available options are:
Defaults to ‘Top’
The titleStyle
property configures the font settings for the legend title, including font family, size, style, weight, and color.
boolean
If set to true, the series visibility will collapse based on the legend’s visibility.
Defaults to true
boolean
If set to true, the legend will be displayed for the chart.
Defaults to true
string
Specifies the width of the legend in pixels.
Defaults to null