与分组Microsoft图表堆叠列非堆叠 [英] Microsoft Chart stacked columns grouped with non-stacked

查看:333
本文介绍了与分组Microsoft图表堆叠列非堆叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能对4组显示数据。每个组有1堆积柱形图,和1个非堆叠。这里是什么我以后是一个样机:

获得四个小组是容易的,这给了我什么,我想:

 系列系列= chart.Series.Add(预算);
series.ChartType = SeriesChartType.Column;
series.Name =预算;
series.Points.Add(55);
series.Points.Add(10);
series.Points.Add(50);
series.Points.Add(50);系列= chart.Series.Add(实际);
series.ChartType = SeriesChartType.Column;
series.Name =实际;
series.Points.Add(80);
series.Points.Add(90);
series.Points.Add(10);
series.Points.Add(10);

现在我想使堆叠条形的黄条。我experimened与添加3系列;图表类型=列,StackedColumn,StackedColumn。但堆叠列出现盈方非堆叠之一。

就是我试图可能吗?


解决方案

根据该系列调用CustomPropertiesMethod和分配组,例如不同StackedGroupNames如果你想系列1和2的堆栈,但要3系列是

Series1.CustomProperties =StackedGroupName =组1;
Series2.CustomProperties =StackedGroupName =组1;
Series3.CustomProperties =StackedGroupName =组2;

I was hoping to display data for 4 groups. Each group has 1 stacked column, and 1 non-stacked. Here's a mockup of what I'm after:

Getting four groups is easy, this gives me what I want:

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);

Now I want to make the yellow bars stacked bars. I've experimened with adding 3 series; ChartType = Column, StackedColumn, StackedColumn. But the stacked columns appear infront of the non-stacked one.

Is what I'm attempting possible?

解决方案

Under the Series Invoke the CustomPropertiesMethod and assign the groups different StackedGroupNames for example if you want Series 1 and 2 to stack but want series 3 to be beside

Series1.CustomProperties = "StackedGroupName=Group1"; Series2.CustomProperties = "StackedGroupName=Group1"; Series3.CustomProperties = "StackedGroupName=Group2";

这篇关于与分组Microsoft图表堆叠列非堆叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆