Search code examples
highchartshighmaps

How to get xAxis and yAxis information on a Highcharts heatmap click event?


In a Highcharts heatmap, I define a click event as usually:

options.plotOptions = {
    series: {
        cursor: 'pointer',
        point: {
            events: {
                click: function() {
                /* action */
                }
            }
        }
    }
};

How can I get the xAxis and yAxis information in this function?

For example, in this demo, when I click 0.67 at the top left conner, I want to alert "Friday, Alexander".

Can I pass arguments to this function? Or is there any other approach?

Thanks! : )


Solution

  • The event has the point attached to it. So, you can do something like this:

               click: function (event) {
                    var str = event.point.series.yAxis.categories[event.point.y] + ',' +
                        event.point.series.xAxis.categories[event.point.x]
                    alert(str);
                }
    

    http://jsfiddle.net/blaird/3UWaA/26/