views:

833

answers:

1

I am attempting to create a stacked chart using the relatively new Microsoft Chart Controls. I am sure that I am missing something obvious but a bit of help will go a long way. The below code creates a chart with two columns. I'd like the columns to be stacked on top of each other. Further, I'd like the total of the two to be displayed on the chart. Any help would be much appreciated.

Series activeSeries = new Series("Active");
activeSeries.ChartType = SeriesChartType.StackedColumn;
activeSeries.BorderWidth = 3;
activeSeries.ShadowOffset = 2;

activeSeries.Points.AddY(3000);
LaptopChart.Series.Add(activeSeries);

Series inactiveSeries = new Series("Inactive");
inactiveSeries.ChartType = SeriesChartType.StackedColumn;
inactiveSeries.BorderWidth = 3;
inactiveSeries.ShadowOffset = 2;

activeSeries.Points.AddY(987);
LaptopChart.Series.Add(inactiveSeries);
A: 

Bone head move when creating the second series I added the inactive points to the active series. Sometimes no matter how often you walk through your own code it takes a second set of eyes to find things. Sorry for wasting anyone's time looking at this. The second reference to activeSeries.Points.AddY(987); should be inactiveSeries.Points.AddY(987);

ahsteele