Reputation: 255
I tried an example of stacked series on JSFiddle but according to me, series are reversed when stacked:
$(function () {
$('#container').highcharts({
chart: {
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}, {
data: [144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2]
}]
});
});
The first line in blue should be drawn first (January : 29.9), and the second should be added to this one (January : 29.9 + 144 = 173.9 ).
Is there a way to get series in the right order when they are stacked?
Upvotes: 24
Views: 23873
Reputation: 1945
Another way of doing this is by adding .reverse()
to the end of the series array, see example at http://jsfiddle.net/sq9u6q5n/ .
Upvotes: 0
Reputation: 4105
What you are looking for is reversed
in xAxis or yAxis. I tried reversedStacks
but it didn't work and after looking at the documentation, I couldn't find it so assuming that it has been replaced with reversed
.
Upvotes: -2
Reputation: 872
Since this was the top result in google, maybe this saves time for some:
The yAxis
has a reversedStacks
parameter (since version 3.0.10), which is true
by default. To build stacks from bottom up, set this to false
. Legend and shared tooltip item order remain correct this way.
Upvotes: 43
Reputation: 3318
You can use the serie's legendIndex parameter : http://api.highcharts.com/highcharts#series.data.legendIndex
Upvotes: 1
Reputation: 37588
You can change order by index parameter which can be set in serie.
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
index:1
}, {
data: [144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2],
index:0
}]
Upvotes: 31