javascript - Highcharts - change column stacking on click -
i have lovely highcharts plot stacked columns. i'd button can toggle whether stacking 'normal' or 'percent'.
i'm trying following (which doesn't work):
$('#button').click(function () { var chart = $('#container').highcharts(); chart.options.plotoptions.column.stacking = 'percent'; chart.redraw(); });
fiddle here: http://jsfiddle.net/crkcj/2/
any appreciated!
it's not possible change plotoptions in real time. instead can update options each series instead, example:
$('#button').click(function () { var chart = $('#container').highcharts(), s = chart.series, slen = s.length; for(var =0; < slen; i++){ s[i].update({ stacking: 'percent' }, false); } chart.redraw(); });
jsfiddle demo here.
Comments
Post a Comment