Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding only one clickable point to the chart in Highcharts?

I saw the documentation of the Highcharts and couldn't find any example that add only one clickable point to the chart. There is no point or all of them are clickable.
Is it posible to bind only for one point to click ?
Thanks in advance!

like image 545
Soroush Khosravi Avatar asked Oct 10 '12 17:10

Soroush Khosravi


1 Answers

This is not so obvious. You know that you can pass the data to the chart as an array of Point objects, like this:

series: [{
    data: [{
        name: 'Point 1',
        x: 0,
        y: 1
    }, {
        name: 'Point 2',
        x: 1,
        y: 5
    }]
}]

But you may not know that any Point can have its own events. So you can do something like this:

series: [{
    data: [{
        name: 'Point 1',
        x: 0,
        y: 1,
        events: {
            click: function () {
                alert ('Click!');
            }
        }
    }]
}]

And there's a jsFiddle demonstration of above.

like image 186
Igor Shastin Avatar answered Sep 20 '22 02:09

Igor Shastin