I have an issue with the Legend on a StackedColumn chart. I have set the following dataSeries and legend elements.
In the code, I have the following for loop to assign all the labels to the values so that they appear in the legend.
v = compositeData.dataSeries;
y = compositeData.legend;
for (i = 0; i < v.length; i++) {
dataSeries = v[i];
r += ' ynchart.addSeries("'+y[i]+'", ['+dataSeries+']);'+@NewLine();
}
When I run the code, I end up with
showing the legend except the order of the labels is not in the order I expected. Element [3] is first, followed by [0], 1 and 2. The color of the elements in the legend are in the correct order but somehow the label is not. I have no code in the script anywhere else that sorts anything. Why is the order of the legend label reordering itself and how do I fix it?