I'm using Highcharts for plotting some graphics for my system's users. It works fine, but I'm having some trouble with the stacking option.
To stack a chart, here's what I'm doing:
chart.options.plotOptions.series.stacking = 'normal';
That's how it's done, according to Highcharts API. It works fine; but aside stacking, I also need to show some information to the user, but these information should only be visible if the chart is stacked. So here's what I'm doing:
var stacking = chart.options.plotOptions.series.stacking;
if (stacking == 'normal'){
//show something
}
That should make sure the chart is stacked, but "stacking" is always returning "undefined" instead of 'normal' or blank - even though in another function I just attributed it 'normal'. Keep in mind "chart" is a global variable, so any changes on it should be accessable by any other JS function.
For details: http://jsfiddle.net/GtjdU/
Any ideas?
The problem is that you said you did the following:
chart.options.plotOptions.series.stacking = 'normal';
^
But you did it ?
No, if you take a look your fiddle, you'll see that you did the following:
chart.options.plotOptions.column.stacking = 'normal';
^
That's why you're getting undefined
demo
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