Skip to main content

API Methods

Highcharts provides a comprehensive set of methods for manipulating charts, series, axes, and points at runtime.

Global Methods

Highcharts.chart()

Create a new chart instance.
Parameters:
  • renderTo (string | HTMLElement) - Container element or ID
  • options (Object) - Chart configuration
  • callback (Function) - Optional callback after chart load
Returns: Highcharts.Chart

Highcharts.stockChart()

Create a Highstock chart (requires Highstock).

Highcharts.mapChart()

Create a Highmaps chart (requires Highmaps).

Highcharts.ganttChart()

Create a Gantt chart (requires Gantt module).

Chart Methods

Methods available on the chart instance.

chart.addSeries()

Add a new series to the chart.
Parameters:
  • options (Object) - Series configuration
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options
Returns: Highcharts.Series

chart.addAxis()

Add a new axis to the chart.
Parameters:
  • options (Object) - Axis configuration
  • isX (Boolean) - True for X axis, false for Y axis
  • redraw (Boolean) - Whether to redraw
  • animation (Boolean | Object) - Animation options
Returns: Highcharts.Axis

chart.get()

Get an axis, series, or point by ID.
Parameters:
  • id (String) - ID of the element
Returns: Highcharts.Axis | Highcharts.Series | Highcharts.Point | undefined

chart.update()

Update chart options.
Parameters:
  • options (Object) - Options to update
  • redraw (Boolean) - Whether to redraw (default: true)
  • oneToOne (Boolean) - One-to-one update mode (default: false)
  • animation (Boolean | Object) - Animation options

chart.redraw()

Redraw the chart.
Parameters:
  • animation (Boolean | Object) - Animation options

chart.reflow()

Reflow the chart to fit container.

chart.setSize()

Resize the chart.
Parameters:
  • width (Number | null) - New width in pixels
  • height (Number | null) - New height in pixels
  • animation (Boolean | Object) - Animation options

chart.setTitle()

Update title and subtitle.
Parameters:
  • title (Object) - Title options
  • subtitle (Object) - Subtitle options
  • redraw (Boolean) - Whether to redraw (default: true)

chart.showLoading() / hideLoading()

Show or hide loading indicator.
Parameters (showLoading):
  • message (String) - Loading message

chart.destroy()

Destroy the chart and free resources.

chart.exportChart()

Export the chart (requires exporting module).
Parameters:
  • options (Object) - Export options
  • chartOptions (Object) - Temporary chart options for export

chart.print()

Print the chart.

chart.getSVG()

Get SVG string of the chart.
Parameters:
  • options (Object) - Temporary chart options
Returns: String (SVG markup)

Series Methods

series.addPoint()

Add a point to the series.
Parameters:
  • options (Number | Array | Object) - Point data
  • redraw (Boolean) - Whether to redraw (default: true)
  • shift (Boolean) - Remove first point (default: false)
  • animation (Boolean | Object) - Animation options

series.removePoint()

Remove a point by index.
Parameters:
  • index (Number) - Point index
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options

series.setData()

Replace all series data.
Parameters:
  • data (Array) - New data array
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options
  • updatePoints (Boolean) - Update existing points (default: true)

series.update()

Update series options.
Parameters:
  • options (Object) - Options to update
  • redraw (Boolean) - Whether to redraw (default: true)

series.remove()

Remove the series.
Parameters:
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options

series.show() / hide()

Show or hide the series.

series.setVisible()

Set series visibility.
Parameters:
  • visible (Boolean) - Visibility state
  • redraw (Boolean) - Whether to redraw (default: true)

Axis Methods

axis.setExtremes()

Set axis range.
Parameters:
  • min (Number | null) - New minimum
  • max (Number | null) - New maximum
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options
  • eventArguments (Object) - Custom event data

axis.update()

Update axis options.
Parameters:
  • options (Object) - Options to update
  • redraw (Boolean) - Whether to redraw (default: true)

axis.setTitle()

Set axis title.
Parameters:
  • title (Object) - Title options
  • redraw (Boolean) - Whether to redraw (default: true)

axis.setCategories()

Set axis categories.
Parameters:
  • categories (Array) - Category names
  • redraw (Boolean) - Whether to redraw (default: true)

axis.addPlotLine() / addPlotBand()

Add plot line or band.
Parameters:
  • options (Object) - Plot line/band options
Returns: Highcharts.PlotLineOrBand

axis.removePlotLine() / removePlotBand()

Remove plot line or band by ID.
Parameters:
  • id (String) - Plot line/band ID

axis.toValue() / toPixels()

Convert between axis values and pixel positions.
Parameters:
  • value or pixel (Number) - Value to convert
  • paneCoordinates (Boolean) - Pane-relative coordinates
Returns: Number

axis.remove()

Remove the axis.
Parameters:
  • redraw (Boolean) - Whether to redraw (default: true)

Point Methods

point.update()

Update point data.
Parameters:
  • options (Number | Object) - New value or options
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options

point.remove()

Remove the point.
Parameters:
  • redraw (Boolean) - Whether to redraw (default: true)
  • animation (Boolean | Object) - Animation options

point.select()

Select or deselect the point.
Parameters:
  • selected (Boolean) - Selection state
  • accumulate (Boolean) - Add to selection (default: false)

See Also