Class: Legend

Highcharts. Legend

new Legend()

The overview of the chart's series. The legend object is instanciated internally in the chart constructor, and available from chart.legend. Each chart has only one legend.

Methods

destroy()

Destroy the legend. Used internally. To reflow objects, chart.redraw must be called after destruction.

destroyItem(item)

Destroy a single legend item, used internally on removing series items.

Parameters:
Name Type Description
item Highcharts.Series | Point

The item to remove

getAllItems()

Get all items, which is one item per series for most series and one item per point for pie series and its derivatives.

Returns:
Array.<(Highcharts.Series|Point)> .

The current items in the legend.

render()

Render the legend. This method can be called both before and after chart.render. If called after, it will only rearrange items instead of creating new ones. Called internally on initial render and after redraws.

scroll(scrollBy, animation)

Scroll the legend by a number of pages.

Parameters:
Name Type Description
scrollBy Number

The number of pages to scroll.

animation AnimationOptions

Whether and how to apply animation.

setText(item)

Set the legend item text.

Parameters:
Name Type Description
item Highcharts.Series | Point

The item for which to update the text in the legend.

update(options [, redraw])

Update the legend with new options. Equivalent to running chart.update with a legend configuration option.

Parameters:
Name Type Argument Default Description
options LegendOptions

Legend options.

redraw Boolean <optional>
true

Whether to redraw the chart.

Try it