VS2010图表控件,如何显示空白图表? [英] VS2010 Chart control, how to display a blank chart?

查看:155
本文介绍了VS2010图表控件,如何显示空白图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Windows窗体上的图表控件,并有工作,绘制一些实时数据,数据到达没有显示然而之前。我想显示为10 30的XY空图,但仍然有图形自动范围,如果值上面去这一点。

I'm trying to use the chart control on a windows form and have it working, plotting some real time data, however before the data arrives nothing is displayed. I would like to show an empty graph with an X Y of 10 30 but still have the graph auto range if values go above this.

我无法找到一个属性来展示空白图它这个可能,如果又如何?

I cannot find a property to show the "blank" graph it this possible and if so how?

感谢

推荐答案

您可以通过它的线条颜色透明隐藏一个系列的所有数据。如果还设置了的LegendText为你可以看到的是轴心国蜱。您可以通过添加几个点,并通过设置最小值和最大值控制他们,我们的虚拟

You can hide all data of a Series by making its line color Transparent. If you also set its LegendText to be " " all you can see are the Axis ticks. you can control them by adding a few Points and by setting the Minimum and Maximum values:

// 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, e.g. 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;



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

The result looks like an empty chart:

这篇关于VS2010图表控件,如何显示空白图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆