Soroush Khosravi
Soroush Khosravi

Reputation: 917

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!

Upvotes: 5

Views: 1126

Answers (1)

Igor Shastin
Igor Shastin

Reputation: 2888

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.

Upvotes: 7

Related Questions