Building stack bottom up
Hi,
We want to add stacks in reverse order without touching legends order. I tried to dig into code and found that while (i--) unconditional
you can add new property so that generic solution can be applied
Code as in 3.0.7
/**
* Build the stacks from top down
*/
buildStacks: function () {
var series = this.series,
i = series.length;
if (!this.isXAxis) {
while (i--) {
series[i].setStackedPoints();
}
// Loop up again to compute percent stack
if (this.usePercentage) {
for (i = 0; i < series.length; i++) {
series[i].setPercentStacks();
}
}
}
},
Proposed code with new property
buildStacks: function () {
var series = this.series,
i = series.length;
if(!this.isXAxis)
{
if(this.stacksBottomUp)
{
for(i = 0; i < series.length; i++)
{
series[i].setStackedPoints();
}
}
else
{
while (i--) {
series[i].setStackedPoints();
}
}
// Loop up again to compute percent stack
if(this.usePercentage)
{
for(i = 0; i < series.length; i++)
{
series[i].setPercentStacks();
}
}
}
},
Thanks,
Ashish
