i have add three series in a stacked graph. i want to add value at the top of each bar. not each series. because some bar doesn’t have some series.
so, i want to add vaue at the top of each column.
chart1.Legends.Add("Legend").Alignment = StringAlignment.Center;
chart1.Palette = ChartColorPalette.None;
chart1.PaletteCustomColors = new Color[] { Color.FromArgb(0, 255, 0), Color.FromArgb(0, 128, 0), Color.FromArgb(255, 0, 0), Color.Green };
// Series for the graph.
Series series1;
Series series2;
Series series3;
Series series4;
series1= new Series("series1");
series12= new Series("series2");
series13= new Series("series3");
series14= new Series("series4");
series1.Points.AddXY(values);
series2.Points.AddXY(values);
series3.Points.AddXY(values);
series4.Points.AddXY(values);
series1.CustomProperties = "PixelPointWidth = 17";
series2.CustomProperties = "PixelPointWidth = 17";
series3.CustomProperties = "PixelPointWidth = 2";
series4.CustomProperties = "PixelPointWidth = 17";
series3.ChartType = SeriesChartType.Line;
series3.BorderWidth = 2;
series3.Color = Color.Blue;
series1.ChartType = series2 = series4.ChartType = SeriesChartType.StackedColumn;
series1.Font = series2.Font = series3.Font = series4.Font = new Font("Verdana", 8.25f, FontStyle.Regular);
chart1.Series.Add(series1);
chart1.Series.Add(series2);
chart1.Series.Add(series3);
chart1.Series.Add(series4);
foreach (Series series in chart1.Series)
{
if (series.Name == "series1")
{
series.ChartType = SeriesChartType.StackedColumn;
series["ColumnDrawingStyle"] = "series1Style";
series["LabelStyle"] = "Top";
// this willl shows the label at top of bar
series.IsValueShownAsLabel = true;
}
}
I believe you want to show some Total on top of the
StackColumnand not in the center of the Column as is the case with the stacked type.Then it would be better to add one more series which is the Total and it could be say of
ChartType = Bubbleand then you can only set labels for this series and disable for the forming making part of the stacked column.