I have a dynamic pie chart. On the click of a button the data labels shown when
dataLables
is true to show data points and when it is false it should be hidden.
plotOptions: {
pie: {
allowPointSelect: false,
cursor: 'pointer',
dataLabels: {
enabled: false
}
}
}
You can use the API to toggle the series plot options like this:
var chart = $('#container').highcharts();
var opt = chart.series[0].options;
opt.dataLabels.enabled = !opt.dataLabels.enabled;
chart.series[0].update(opt);
e.g. http://jsfiddle.net/sYMcs/
chart.series[0].options gets the options applying to series 0. series.update amends the current options, and redraws the chart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With