MS图表控件:更改图例中系列的顺序

Jef*_*ang 5 mschart

如何更改图例中系列的顺序?

我的行系列出现在我的StackedColumn系列之前,但出现在我的Column系列之后。

Chart c = new Chart();
ChartArea ca = c.ChartAreas.Add("main");
Legend lg = c.Legends.Add("mainLegend");
Series s1 = c.Series.Add("s1");
s1.ChartType = ChartType.StackedColumn;
Series s2 = c.Series.Add("s2");
s2.ChartType = ChartType.Column;
Series s3 = c.Series.Add("s3");
s3.ChartType = ChartType.Line;
Run Code Online (Sandbox Code Playgroud)

原谅可怜的ASCII艺术,但图例看起来像:

....... [黄色] s2 ....... [红色] s3 ...... [蓝色] s1 ............

当我希望按顺序进行时:s1,s2,s3。

有任何想法吗?

Emi*_*adh 3

这看起来确实很奇怪。在我看来,图例中系列的顺序应该与添加它们的顺序相同,或者如果您将实例LegendItemOrder的属性设置为相反的顺序。LegendReversedSeriesOrder