admin管理员组文章数量:1335357
I have a lovely Highcharts plot with stacked columns. I'd like a button which can toggle whether the stacking is 'normal' or 'percent'.
I'm trying the following (which doesn't work):
$('#button').click(function () {
var chart = $('#container').highcharts();
chart.options.plotOptions.column.stacking = 'percent';
chart.redraw();
});
Fiddle here: /
Any help would be much appreciated!
I have a lovely Highcharts plot with stacked columns. I'd like a button which can toggle whether the stacking is 'normal' or 'percent'.
I'm trying the following (which doesn't work):
$('#button').click(function () {
var chart = $('#container').highcharts();
chart.options.plotOptions.column.stacking = 'percent';
chart.redraw();
});
Fiddle here: http://jsfiddle/CRKcj/2/
Any help would be much appreciated!
Share Improve this question edited Aug 28, 2013 at 11:19 Arturs 1,2585 gold badges21 silver badges28 bronze badges asked Aug 28, 2013 at 10:54 ewelsewels 5132 gold badges7 silver badges22 bronze badges1 Answer
Reset to default 8It's not possible to change plotOptions in real time. Instead you can update options for each series instead, for example:
$('#button').click(function () {
var chart = $('#container').highcharts(),
s = chart.series,
sLen = s.length;
for(var i =0; i < sLen; i++){
s[i].update({
stacking: 'percent'
}, false);
}
chart.redraw();
});
Jsfiddle demo here.
本文标签: javascriptHighchartschange column stacking on clickStack Overflow
版权声明:本文标题:javascript - Highcharts - change column stacking on click - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742267805a2443737.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论