Return the xAxis category on click
I can't seem to get the category from Highchart returned on the click event on the chart itself. In other words, this works great:
plotOptions: {
series: {
events: {
click: function(ev) {
console.log(ev.point.category); // outputs category
}
}
}
}
However, I would like to get a category when the user clicks anywhere in the chart, not just. It will look something like this.
chart: {
events: {
click: function(ev) {
console.log(ev.xAxis[0].category); // undefined because doesn't exist - sure would be nice, tho
}
}
}
I've checked both objects and highcharts objects here, but couldn't find how to determine which category is associated with the return x value.
+3
source to share