Click event on clicking on the graph

This is explained fairly well in the documentation.

What you can do is something similar to THIS.

So you have to add something like this to your code:

chart: {
    events: {
        click: function(event) {
            alert (
                'x: '+ Highcharts.dateFormat('%Y-%m-%d', event.xAxis[0].value) +', ' +
                'y: '+ event.yAxis[0].value
            );
        }
    }
}

Here is an example of that implementation.

Update

To ensure clicking on the graph itself is also enabled, add the following:

plotOptions: {
    series: {
         cursor: 'pointer',
         point: {
             events: {
                click: function() {
                    alert ('Category: '+ this.category +', value: '+ this.y);
                }
            }
        }
    }
},

You can see a working example HERE

Tags:

Highcharts