我正在尝试按照代码创建条形图,其中条形必须按用户名分组,但不知何故重复问题标签如下所示,
我的数据表类似于,
Question="Gravimetry"
Project-test1=0
Project-test2=1
Question="Sub-Surface"
Project-test1=0
Project-test2=2
Question="VSP"
Project-test1=2
Project-test2=3
.....
C# 是,
Series Series = new Series("Series1");
Chart4.Series.Add("Series1");
Chart4.Series.Add("Series2");
Chart4.ChartAreas.Add("ChartArea1");
// Set series chart type
Chart4.Series["Series1"].ChartType = SeriesChartType.Bar;
Chart4.Series["Series2"].ChartType = SeriesChartType.Bar;
// Set series point width
Chart4.Series["Series1"]["PointWidth"] = "0.6";
Chart4.Series["Series2"]["PointWidth"] = "0.6";
// Show data points labels
Chart4.Series["Series1"].IsValueShownAsLabel = true;
Chart4.Series["Series2"].IsValueShownAsLabel = true;
// Set data points label style
Chart4.Series["Series1"]["BarLabelStyle"] = "Center";
Chart4.Series["Series2"]["BarLabelStyle"] = "Center";
// Draw as 3D Cylinder
Chart4.Series["Series1"]["DrawingStyle"] = "Cylinder";
Chart4.Series["Series2"]["DrawingStyle"] = "Cylinder";
Chart4.DataSource = dt.DefaultView;
Chart4.ChartAreas["ChartArea1"].AxisX.Interval = 1;
Chart4.Series["Series1"].XValueMember = "Question";
//Chart4.Series["Series1"].YValuesPerPoint = 2;
Chart4.Series["Series1"].YValueMembers = "Project-test1";
Chart4.Series["Series2"].YValueMembers = "Project-test2";
Chart4.DataBind();
任何帮助都感激不尽!