Introducing Highcharts events
By now, we have gone through most of the Highcharts configurations, but there is one area not yet covered: event handling. Highcharts offers a set of event options in several areas such as chart events, series events, and axis base events; 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 that 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...