I've got a chart with 8 series - call them S1 through S8. They're in order in the chart's list of series, and they're presented using custom legend items (Legend.CustomItems). Everything works fine, except there seems to be a bug with how items are displayed in the legend when the legend wraps around to a new line.
I'd like the items to be displayed in rows:
S1 S2 S3 S4
S5 S6 S7 S8
Unfortunately, it seems like when the legend detects that it's going to take two rows, it fills in vertically before horizontally, like so:
S1 S3 S5 S7
S2 S4 S6 S8
Is there any way to get the items arranged properly? 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 issue is with the layout of the legend items, not the order. Depending on the length of the legend items, I may end up with this layout:
S1 S3 S5 S7 S8
S2 S4 S6
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…