【发布时间】:2011-07-10 23:30:53
【问题描述】:
我正在尝试创建堆积条形图, 但是我在具有“.Series”的行中出现错误(如何定义系列?)
SeriesChartType chart1 = new SeriesChartType();
// Populate series data
Random random = new Random();
for (int pointIndex = 0; pointIndex < 10; pointIndex++)
{
chart1.Series["LightBlue"].Points.AddY(random.Next(45, 95));
}
// Set chart type
chart1.Series["LightBlue"].ChartType = SeriesChartType.StackedArea100;
// Show point labels
chart1.Series["LightBlue"].IsValueShownAsLabel = true;
// Disable X axis margin
chart1.ChartAreas["Default"].AxisX.IsMarginVisible = false;
// Set the first two series to be grouped into Group1
chart1.Series["LightBlue"]["StackedGroupName"] = "Group1";
chart1.Series["Gold"]["StackedGroupName"] = "Group1";
// Set the last two series to be grouped into Group2
chart1.Series["Red"]["StackedGroupName"] = "Group2";
chart1.Series["DarkBlue"]["StackedGroupName"] = "Group2";
【问题讨论】:
标签: c# .net graphics charts bar-chart