Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding click event dynamically created highchart

how we can add click event to highchart from chart object that we get after the creation.

Why i need this is, need to a create re-usable function to create a chart. after creation of chart I need to trigger click event to show some data in lightbox.

is there anything like addSeries eg:

chart.addSeries({
        data: [216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5]        
    });

for click?

chart.click(function(){})
like image 229
peterkr Avatar asked Aug 11 '26 11:08

peterkr


2 Answers

Hierarchy

#chart
    -events
        -click

Check out the Highcharts ref

Here is the jsFiddle Demo

like image 136
Wazy Avatar answered Aug 13 '26 01:08

Wazy


Not sure if this is what you are looking for

Check .on

chart.on('click','serie selector',function(){code});
like image 30
Mario Corchero Avatar answered Aug 13 '26 01:08

Mario Corchero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!