Search results

LegendSettings API in JavaScript (ES5) Accumulation Chart API control

Configures the legends in charts.

Properties

alignment

Alignment

Legend in chart can be aligned as follows:

  • 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.

Defaults to ‘Center’

background

string

The background color of the legend that accepts value in hex and rgba as a valid CSS color string.

Defaults to ‘transparent’

border

BorderModel

Options to customize the border of the legend.

containerPadding

ContainerPaddingModel

Options to customize left, right, top and bottom padding for legend container of the chart.

description

string

Description for legends.

Defaults to null

enableHighlight

boolean

If set to true, the series get highlighted, while hovering the legend.

Defaults to false

enablePages

boolean

If set to true, legend will be visible using pages.

Defaults to true

height

string

The height of the legend in pixels.

Defaults to null

isInversed

boolean

If isInversed set to true, then it inverses legend item content (image and text).

Defaults to false.

itemPadding

number

Option to customize the padding between legend items.

Defaults to null

location

LocationModel

Specifies the location of the legend, relative to the chart. If x is 20, legend moves by 20 pixels to the right of the chart. It requires the position to be Custom.

<div id='Chart'></div>
let chart: Chart = new Chart({
...
  legendSettings: {
    visible: true,
    position: 'Custom',
    location: { x: 100, y: 150 },
  },
...
});
chart.appendTo('#Chart');

margin

MarginModel

Options to customize left, right, top and bottom margins of the chart.

maximumLabelWidth

number

Maximum label width for the legend text.

Defaults to null

maximumTitleWidth

number

maximum width for the legend title.

Defaults to 100

mode

LegendMode

Mode of legend items.

  • Series: Legend items generated based on series count.
  • Point: Legend items generated based on unique data points.
  • Range: Legend items generated based on range color mapping property.
  • Gradient: Single linear bar generated based on range color mapping property. This property is applicable for chart component only.

opacity

number

Opacity of the legend.

Defaults to 1

padding

number

Option to customize the padding around the legend items.

Defaults to 8

position

LegendPosition

Position of the legend in the chart. Available options include:

  • Auto: Places the legend based on the area type.
  • Top: Displays the legend at the top of the chart.
  • Left: Displays the legend at the left of the chart.
  • Bottom: Displays the legend at the bottom of the chart.
  • Right: Displays the legend at the right of the chart.
  • Custom: Displays the legend based on the given x and y values.

Defaults to ‘Auto’

reverse

boolean

If reverse is set to true, it reverses the order of legend items.

Defaults to false

shapeHeight

number

Shape height of the legend in pixels.

Defaults to 10

shapePadding

number

Padding between the legend shape and text.

Defaults to 8

shapeWidth

number

Shape width of the legend in pixels.

Defaults to 10

tabIndex

number

TabIndex value for the legend.

Defaults to 3

textOverflow

LabelOverflow

Defines the text overflow behavior to employ when the individual legend text overflows

  • Clip - Specifies the text is clipped and not accessible.
  • Ellipsis - Specifies an ellipsis (“…”) to the clipped text.

Defaults to ‘Ellipsis’

textStyle

FontModel

Options to customize the legend text.

textWrap

TextWrap

Defines the text wrap behavior to employ when the individual legend text overflows

  • Normal - Specifies to break words only at allowed break points.
  • Wrap - Specifies to break a word once it is too long to fit on a line by itself.
  • AnyWhere - Specifies to break a word at any point if there are no otherwise-acceptable break points in the line.

Defaults to ‘Normal’

title

string

Title for legends.

Defaults to null

titlePosition

LegendTitlePosition

legend title position.

Defaults to ‘Top’

titleStyle

FontModel

Options to customize the legend title.

toggleVisibility

boolean

If set to true, series visibility collapses based on the legend visibility.

Defaults to true

visible

boolean

If set to true, the legend will be displayed for the chart.

Defaults to true

width

string

The width of the legend in pixels.

Defaults to null