new Legend(chart, options)
The overview of the chart's series. The legend object is instantiated
internally in the chart constructor, and is available from the chart.legend
property. Each chart has only one legend.
Parameters:
Name | Type | Description |
---|---|---|
chart |
Highcharts.Chart | The chart instance. |
options |
Highcharts.LegendOptions | Legend options. |
Members
-
<readonly> allItems :Array.<(Highcharts.Point|Highcharts.Series)>
-
All items for the legend, which is an array of series for most series and an array of points for pie series and its derivatives.
Type:
- Array.<(Highcharts.Point|Highcharts.Series)>
-
<readonly> box :Highcharts.SVGElement
-
SVG element of the legend box.
Type:
-
<readonly> chart :Highcharts.Chart
-
Chart of this legend.
Type:
-
<readonly> group :Highcharts.SVGElement
-
SVG group of the legend.
Type:
-
<readonly> options :Highcharts.LegendOptions
-
Legend options.
Type:
- Highcharts.LegendOptions
-
<readonly> title :Highcharts.SVGElement
-
SVG element of the legend title.
Type:
Methods
-
setText(item)
-
Set the legend item text.
Parameters:
Name Type Description item
Highcharts.Point | Highcharts.Series 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
Highcharts.LegendOptions Legend options.
redraw
boolean <optional>
true Whether to redraw the chart after the axis is altered. If doing more operations on the chart, it is a good idea to set redraw to false and call Highcharts.Chart#redraw after. Whether to redraw the chart.
Fires:
- Highcharts.Legends#event:afterUpdate
Try it