Introducing Highcharts events
So far, we have gone through most of the Highcharts configurations, however there is one area not yet covered, which is event handling. Highcharts offers a set of event options in several areas such as chart events, series events, and axis base events, and they are triggered by API calls and user interactions with the chart.
Highcharts events can be specified through object configuration while creating a chart or through APIs that accept object configurations, such as Chart.addSeries
, Axis.addPlotLine
, and Axis.addPlotBand
.
An event object is passed by an event handler, which contains mouse information and specific action data related to the event action; for example, event.xAxis[0]
and event.yAxis[0]
are stored in the event parameter for the chart.events.click
handler. Inside each event function, the 'this'
keyword can be used and refers to a Highcharts component where the event function is based. For example, the 'this'
keyword in chart.events.click
refers to...