The Chart objectThe chart object is the JavaScript object representing a single chart in the web page. The pointer to your chart object is returned when a chart is created using the Highcharts.Chart() constructor:
var chart = new Highcharts.Chart(options);
The reference to the variable can be set in PHP renderChart method - see parameter $chart
Methods
addSeries (Object options, [Boolean redraw], [Mixed animation]) : Series
Add a series to the chart after render time. Note that this method should never be used when adding data synchronously at chart render time, as it adds expense to the calculations and rendering. When adding data at the same time as the chart is initiated, add the series as a configuration option instead.
Parameters
- options: Object
The series options, as documented under plotOptions.series and under the plotOptions for each series type.
- redraw: Boolean
Defaults to true. Whether to redraw the chart after the series is added. See the redraw() method below.
- animation: Mixed
Defaults to true. When true, the series' updating will be animated with default animation options. The animation can also be a configuration object with properties duration and easing.
Returns
The series added, if successful.
destroy ()
Removes the chart and purges memory. This method should be called before writing a new chart into the same container. It is called internally on window unload to prevent leaks.
exportChart (Object options, Object chartOptions) : null
Submit an SVG version of the chart to a server along with some parameters for conversion.
Parameters
- options: Object
Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method. All options default to the values given in the exporting config optins. filename: the filename for the export without extension, url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server, type: the MIME type of the converted image.
- chartOptions: Object
Additional chart options for the exported chart. For example a different background color can be added here.
get (String id) : Axis|Series|Point
Get an axis, series or point by its id as given in the configuration options.
Parameters
- id: String
The id of the axis, series or point to get.
Returns
The first Axis, Series or Point with a matching id if found, null if not.
getSelectedPoints () : Array<Point>
Returns an array of all currently selected points in the chart. Points can be selected either programmatically by the point.select() method or by clicking.
Returns
An array of the selected points.
getSelectedPoints () : Array<Point>
Returns an array of all currently selected points in the chart. Points can be selected either programmatically by the point.select() method or by clicking.
Returns
An array of the selected points.
getSVG (Object additionalOptions) :
Get an SVG string representing the chart.
Parameters
- additionalOptions: Object
Chart options to add to the exported chart in addition to the options given for the original chart. For example if series.lineWidth should be greater in the exported chart than in the original, or the chart should have a different background color, this is added here.
hideLoading () :
Hide the loading screen. Options for the loading screen are defined at options.loading.
print () : null
Exporting module required. Clears away other elements in the page and prints the chart as it is displayed. By default, when the exporting module is enabled, a button at the upper left calls this method.
redraw () : null
Redraw the chart after changes have been done to the data or axis extremes. All methods for updating axes, series or points have a parameter for redrawing the chart. This is true by default. But in many cases you want to do more than one operation on the chart before redrawing, for example add a number of points. In those cases it is a waste of resources to redraw the chart for each new point added. So you add the points and call chart.redraw() after.
The chart.redraw() method only redraws those parts of the chart that are actually changed. If the data of a series is changed and it doesn't affect the axes, only the series itself is redrawn. If the new data requires the axis extremes to be altered, the axis and all other series depending on it are redrawn.
setSize (Number width, Number height, [Mixed animation]) :
Resize the chart to a given width and height.
Parameters
- width: Number
The new pixel width of the chart.
- height: Number
The new pixel height of the chart.
- animation: Mixed
Defaults to true. When true, the resize will be animated with default animation options. The animation can also be a configuration object with properties duration and easing.
setTitle (Object title, object subtitle) :
Set a new title or subtitle for the chart
Parameters
- title: Object
A configuration object for the new title as defined at #title.
- subtitle: Object
A configuration object for the new subtitle as defined at #subtitle.
showLoading (String str) : null
Dim the chart's plot area and show a loading label text. Options for the loading screen are defined at options.loading. A custom text can be given as a parameter for loadind