图表从零开始所有堆积的列

在堆叠的柱状图中,并非所有的条形都从零开始。

如下代码:


using System.Drawing
using System.Web.UI.DataVisualization.Charting
using System.Globalization

void Issue()
{
   var c = new Chart();
   var a = new ChartArea();
   c.ChartAreas.Add(a);

   var s1 = new Series("s1");
   s1.ChartType = SeriesChartType.StackedColumn;
   var s2 = new Series("s2");
   s2.ChartType = SeriesChartType.StackedColumn;

   s1.Points.Add(new DataPoint(3, 2));
   s1.Points.Add(new DataPoint(7, 1));
   s1.Points.Add(new DataPoint(8, 2));
   s2.Points.Add(new DataPoint(5, 1));

   c.Series.Add(s1);
   c.Series.Add(s2);
   c.SaveImage("d:\\temp\\issue.png", ChartImageFormat.Png);

}

结果是:

enter image description here

如何使黄条从零开始?

评论