请教c# ZedGraph控件画实时曲线的一个问题
为什么我与下位机(仿真时用的虚拟串口发送数据)通信时接收数据是100ms一个数据的时候可以画出折线但是1ms就不可以?1ms时可以存入数据库,但就是画不出来曲线,10ms...
为什么我与下位机(仿真时用的虚拟串口发送数据)通信时接收数据是100ms一个数据的时候可以画出折线但是1ms就不可以?1ms时可以存入数据库,但就是画不出来曲线,10ms也不行。小白希望可以得到指导,谢谢!还有怎么定横坐标显示多少格?这里横坐标表示时间,怎么定每隔多少ms?(隐去了关于坐标轴等设计)
public partial class frmDataAnalysis : Form
{
public static double count = 0;
public static double ecgdata;
PointPairList list = new PointPairList();
public frmDataAnalysis()
{
InitializeComponent();
}
private void frmDataAnalysis_Load(object sender, EventArgs e)
{
GraphPane pane = zgc.GraphPane;
LineItem curve = pane.AddCurve("label", list, Color.Blue, SymbolType.None);
curve.Line.Width = 2F;
zgc.AxisChange();
timer1.Interval = 1 ;
timer1.Start();
timer1.Tick +=new EventHandler(timer1_Tick);
txtCount.Text = count.ToString();
labMax.Text = "00.000";
labMin.Text = "00.000";
labAve.Text = "00.000";
}
private void timer1_Tick(object sender, EventArgs e)
{
txtCount.Text = count.ToString();
}
private void txtCount_TextChanged(object sender, EventArgs e)
{
GraphPane pane = zgc.GraphPane;
list.Add(count, ecgdata);
zgc.AxisChange();
zgc.Refresh();
zgc.IsShowPointValues = true;
txtCount.Text = count.ToString();
} 展开
public partial class frmDataAnalysis : Form
{
public static double count = 0;
public static double ecgdata;
PointPairList list = new PointPairList();
public frmDataAnalysis()
{
InitializeComponent();
}
private void frmDataAnalysis_Load(object sender, EventArgs e)
{
GraphPane pane = zgc.GraphPane;
LineItem curve = pane.AddCurve("label", list, Color.Blue, SymbolType.None);
curve.Line.Width = 2F;
zgc.AxisChange();
timer1.Interval = 1 ;
timer1.Start();
timer1.Tick +=new EventHandler(timer1_Tick);
txtCount.Text = count.ToString();
labMax.Text = "00.000";
labMin.Text = "00.000";
labAve.Text = "00.000";
}
private void timer1_Tick(object sender, EventArgs e)
{
txtCount.Text = count.ToString();
}
private void txtCount_TextChanged(object sender, EventArgs e)
{
GraphPane pane = zgc.GraphPane;
list.Add(count, ecgdata);
zgc.AxisChange();
zgc.Refresh();
zgc.IsShowPointValues = true;
txtCount.Text = count.ToString();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询