Enable or disable data labels shown in pie charts in Highcharts on click of a button
highcharts
Solution
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.
Problem
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 } } } ```