Search code examples
javascriptjqueryclickhighcharts

Clickable Bars in js Highcharts?


I have horizontal bar chart with Highcharts. How can I make each bar clickable for an event, for example like 'alert' ?

I have this series for example:

series : [{
    name: 'John',
    data: [5, 3, 4, 7, 2]
}, {
    name: 'Jane',
    data: [2, 2, 3, 2, 1]
}, {
    name: 'Joe',
    data: [3, 4, 4, 2, 5]
}];

What more should I do?


Solution

  • You might find the Highcharts Options Reference a good starting point.

    From the reference, here's an example of a column chart where clicking a column fires an alert.

    http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-point-events-click-column/