I have a chart with 8 series - name them S1 - S8. They are listed in the chart series, and they are presented using custom legend elements (Legend.CustomItems). Everything works fine, except that there seems to be an error in how the elements are displayed in the legend when the legend wraps around a new line.
I would like the elements to appear in the lines:
S1 S2 S3 S4 S5 S6 S7 S8
Unfortunately, it seems that when a legend discovers that it will occupy two lines, it is filled vertically to the horizontal, for example:
S1 S3 S5 S7 S2 S4 S6 S8
Is there a way to arrange items correctly? Is this a bug with the controls?
var chart = new Chart(); // More chart setup foreach(var s in chart.Series) { if (simpleLegend) chart.Legends[0].CustomItems.Add(s.Color, s.LegendText); else { var legendItem = new LegendItem(); // Legend item customization chart.Legends[0].CustomItems.Add(legendItem); } }
EDIT
To make it clear, the problem is related to the location of the elements of the legend, and not to order. Depending on the length of the legend elements, I can finish this layout:
S1 S3 S5 S7 S8 S2 S4 S6
Shawn source share