Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts' verifying stacking issues

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?

like image 972
mtlewis Avatar asked Feb 05 '26 04:02

mtlewis


1 Answers

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

like image 189
Ricardo Alvaro Lohmann Avatar answered Feb 06 '26 18:02

Ricardo Alvaro Lohmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!