小弟现在要做一个显示实时数据的曲线,利用zedGraph控件+timer来实现,现在不知道如何将曲线的横坐标设置成系统时间?
另外,timer空间可以设置的最小时间为1ms,还有没有可以设置更短时间的办法
下面是timer1_Tick的程序。程序很简单,做一个随时间变化的余弦曲线,希望把横坐标修改成系统时间,不要年月日,只显示时分秒
int i = 0;
int N = 360;
double PI = 3.1415926;
private void timer1_Tick(object sender, EventArgs e)
{
zedGraphControl1.GraphPane.XAxis.Scale.MaxAuto = true;
//double x = (double)new XDate(DateTime.Now);
//double y = ran.NextDouble(); double x;
double y;
x= i * PI / 180;
y = Math.Cos(x);
list.Add(x, y);
myCurve = zedGraphControl1.GraphPane.AddCurve("", list, Color.DarkGreen, SymbolType.None);
this.zedGraphControl1.AxisChange();
this.zedGraphControl1.Refresh();
i +=1;
}
另外,timer空间可以设置的最小时间为1ms,还有没有可以设置更短时间的办法
下面是timer1_Tick的程序。程序很简单,做一个随时间变化的余弦曲线,希望把横坐标修改成系统时间,不要年月日,只显示时分秒
int i = 0;
int N = 360;
double PI = 3.1415926;
private void timer1_Tick(object sender, EventArgs e)
{
zedGraphControl1.GraphPane.XAxis.Scale.MaxAuto = true;
//double x = (double)new XDate(DateTime.Now);
//double y = ran.NextDouble(); double x;
double y;
x= i * PI / 180;
y = Math.Cos(x);
list.Add(x, y);
myCurve = zedGraphControl1.GraphPane.AddCurve("", list, Color.DarkGreen, SymbolType.None);
this.zedGraphControl1.AxisChange();
this.zedGraphControl1.Refresh();
i +=1;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货