VS2010图表控件,如何显示空白图表?

我正在尝试在Windows窗体上使用图表控件并让它工作,绘制一些实时数据,但是在数据到达之前没有显示任何内容。 我想显示一个XY为10 30的空图,但如果值高于此值,仍然会有图表自动范围。

我找不到一个属性来显示“空白”图表这可能,如果是这样的话怎么样?

谢谢

您可以通过使其线条颜色透明来隐藏系列的所有数据。 如果您还将其LegendText设置为“”,则可以看到Axis刻度线。 您可以通过添加几个点并设置最小值和最大值来控制它们:

// short reference for our dummy: Series S0 = chart1.Series[0]; // a simple type S0.ChartType = SeriesChartType.Line; // set 10 point with x-values going from 0-100 and y-values going from 1-10: for (int i = 0; i < 100; i +=10) S0.Points.AddXY(i , i / 10); // or add only a few, eg the first and last points: //S0.Points.AddXY(100, 10); //S0.Points.AddXY(0, 10); // hide the line: S0.Color = Color.Transparent; // hide the legend text (it will still take up a little space, though) S0.LegendText = " "; // limit the axis to the target values chart1.ChartAreas[0].AxisX.Maximum = 100; chart1.ChartAreas[0].AxisX.Minimum = 0; 

结果看起来像一个空图表:

emtpy图表