Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to set Highchart options dynamically?

Is it possible to toggle chart dataLabels (enabled/disabled) on click (without redrawing the chart) much like the following:

('.inner-container').click(function() {
    chart.setTitle({text: "New Title"});
});

I have tried the method below but it does not work.

('.inner-container').click(function() {
    chart.setOptions({dataLabels: {enabled: true}});
});

I can't seem to find any details on how to set chart options dynamically in the documentation. If anyone could point me in the right direction then that would be greatly appreciated.

like image 712
Thomas Avatar asked Dec 13 '25 22:12

Thomas


1 Answers

I managed to figure it out, by using the series.update() method.

chart.series[0].update({
    dataLabels: {
        enabled: true
    }
});

Thanks for your help.

like image 118
Thomas Avatar answered Dec 15 '25 21:12

Thomas



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!