1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| using System.Windows.Forms.DataVisualization.Charting;...
// 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";
// Set to 3D
chart1.ChartAreas["Default"].Area3DStyle.Enable3D = true; |
Partager