Adding XYDataSeries to a Stacked Column Chart
To add XYDataSeries to a Stacked Column chart, complete the following:
// 5 points
var ds1 = new XYDataSeries()
{
XValuesSource = new double[]{ 1, 2, 3, 4, 5},
ValuesSource = new double[] { 1, 1, 1, 1, 1}
};
chart.Data.Children.Add(ds1);
// 3 points
var ds2 = new XYDataSeries()
{
XValuesSource = new double[] { 1, 3, 5 },
ValuesSource = new double[] { 1, 1, 1 }
};
chart.Data.Children.Add(ds2);
chart.ChartType = ChartType.ColumnStacked;