c# – Microsoft Chart堆叠列与非堆叠列
作者:互联网
我希望能够显示4组数据.每组有1个堆叠列,1个非堆叠列.这是我所追求的模型:
获得四组很容易,这给了我想要的东西:
Series series = chart.Series.Add("Budget");
series.ChartType = SeriesChartType.Column;
series.Name = "Budget";
series.Points.Add(55);
series.Points.Add(10);
series.Points.Add(50);
series.Points.Add(50);
series = chart.Series.Add("Actual");
series.ChartType = SeriesChartType.Column;
series.Name = "Actual";
series.Points.Add(80);
series.Points.Add(90);
series.Points.Add(10);
series.Points.Add(10);
现在我想把黄色条棒叠起来.我已经尝试过添加3个系列; ChartType = Column,StackedColumn,StackedColumn.但堆叠的列出现在非堆叠的列的前面.
我正在尝试的是什么?
解决方法:
在系列调用CustomPropertiesMethod并为组分配不同的StackedGroupNames,例如,如果您希望系列1和2堆叠但希望系列3在旁边
Series1.CustomProperties =“StackedGroupName = Group1”;
Series2.CustomProperties =“StackedGroupName = Group1”;
Series3.CustomProperties =“StackedGroupName = Group2”;
标签:c,asp-net,mschart 来源: https://codeday.me/bug/20190704/1379959.html