Class: Series

Highcharts. Series

new Series()

Members

<readonly> index :number

Contains the series' index in the Chart.series array.

Type:
  • number

Methods

addPoint(options [, redraw] [, shift] [, animation] [, withEvent])

Add a point to the series after render time. The point can be added at the end, or by giving it an X value, to the start or in the middle of the series.

Parameters:
Name Type Argument Default Description
options Highcharts.PointOptionsType

The point options. If options is a single number, a point with that y value is appended to the series. If it is an array, it will be interpreted as x and y values respectively. If it is an object, advanced options as outlined under series.data are applied.

redraw boolean <optional>
true

Whether to redraw the chart after the point is added. When adding more than one point, it is highly recommended that the redraw option be set to false, and instead Highcharts.Chart#redraw is explicitly called after the adding of points is finished. Otherwise, the chart will redraw after adding each point.

shift boolean <optional>
false

If true, a point is shifted off the start of the series as one is appended to the end.

animation boolean | Partial.<Highcharts.AnimationOptionsObject> <optional>

Whether to apply animation, and optionally animation configuration.

withEvent boolean <optional>
true

Used internally, whether to fire the series addPoint event.

Fires:
  • Highcharts.Series#event:addPoint
Returns:
Try it

hide()

Hide the series if visible. If the chart.ignoreHiddenSeries option is true, the chart is redrawn without this series.

Fires:
  • Highcharts.Series#event:hide
Try it

onMouseOut()

Runs on mouse out of the series graphical items.

Fires:
  • Highcharts.Series#event:mouseOut

onMouseOver()

Runs on mouse over the series graphical items.

Fires:
  • Highcharts.Series#event:mouseOver

remove( [redraw] [, animation] [, withEvent])

Remove a series and optionally redraw the chart.

Parameters:
Name Type Argument Default Description
redraw boolean <optional>
true

Whether to redraw the chart or wait for an explicit call to Highcharts.Chart#redraw.

animation boolean | Partial.<Highcharts.AnimationOptionsObject> <optional>

Whether to apply animation, and optionally animation configuration.

withEvent boolean <optional>
true

Used internally, whether to fire the series remove event.

Fires:
  • Highcharts.Series#event:remove
Returns:
Try it

removePoint(i [, redraw] [, animation])

Remove a point from the series. Unlike the Highcharts.Point#remove method, this can also be done on a point that is not instanciated because it is outside the view or subject to Highstock data grouping.

Parameters:
Name Type Argument Default Description
i number

The index of the point in the data array.

redraw boolean <optional>
true

Whether to redraw the chart after the point is added. When removing more than one point, it is highly recommended that the redraw option be set to false, and instead Highcharts.Chart#redraw is explicitly called after the adding of points is finished.

animation boolean | Partial.<Highcharts.AnimationOptionsObject> <optional>

Whether and optionally how the series should be animated.

Fires:
  • Highcharts.Point#event:remove
Returns:
Try it

select( [selected])

Select or unselect the series. This means its selected property is set, the checkbox in the legend is toggled and when selected, the series is returned by the Highcharts.Chart#getSelectedSeries function.

Parameters:
Name Type Argument Description
selected boolean <optional>

True to select the series, false to unselect. If undefined, the selection state is toggled.

Fires:
  • Highcharts.Series#event:select
  • Highcharts.Series#event:unselect
Try it

setCompare( [compare])

Highstock only. Set the compare mode of the series after render time. In most cases it is more useful running Highcharts.Axis#setCompare on the X axis to update all its series.

Parameters:
Name Type Argument Description
compare string <optional>

Can be one of null (default), "percent" or "value".

setState( [state] [, inherit])

Set the state of the series. Called internally on mouse interaction operations, but it can also be called directly to visually highlight a series.

Parameters:
Name Type Argument Description
state Highcharts.SeriesStateValue | "" <optional>

The new state, can be either 'hover', 'inactive', 'select', or '' (an empty string), 'normal' or undefined to set to normal state.

inherit boolean <optional>

Determines if state should be inherited by points too.

setVisible( [visible] [, redraw])

Show or hide the series.

Parameters:
Name Type Argument Default Description
visible boolean <optional>

True to show the series, false to hide. If undefined, the visibility is toggled.

redraw boolean <optional>
true

Whether to redraw the chart after the series is altered. If doing more operations on the chart, it is a good idea to set redraw to false and call chart.redraw() after.

Fires:
  • Highcharts.Series#event:hide
  • Highcharts.Series#event:show

show()

Show the series if hidden.

Fires:
  • Highcharts.Series#event:show
Try it

sonify( [options])

Sonify a series.

Parameters:
Name Type Argument Description
options Highcharts.SonifySeriesOptionsObject <optional>

The options for sonifying this series. If not provided, uses options set on chart and series.

Requires:
  • module:modules/sonification
Returns:
Try it

update(options [, redraw])

Update the series with a new set of options. For a clean and precise handling of new options, all methods and elements from the series are removed, and it is initialized from scratch. Therefore, this method is more performance expensive than some other utility methods like Highcharts.Series#setData or Highcharts.Series#setVisible.

Note that Series.update may mutate the passed data options.

Parameters:
Name Type Argument Default Description
options Highcharts.SeriesOptionsType

New options that will be merged with the series' existing options.

redraw boolean <optional>
true

Whether to redraw the chart after the series 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.

Fires:
  • Highcharts.Series#event:update
  • Highcharts.Series#event:afterUpdate
Returns:
Try it