C#实时更新chart曲线
private void Timer1_Tick(object sender, EventArgs e)
{
try
{
seq++;
UpdateChart(); // 图像实时显示
}
catch
{
}
}
public void UpdateChart()
{
if (this.InvokeRequired)
{
this.BeginInvoke(new UpdateChartDelegate(UpdateChartSub));
}
else
{
UpdateChartSub();
}
}
public delegate void UpdateChartDelegate();
public void UpdateChartSub()
{
try
{
UpdateQueueValue();
this.chart1.Series[0].Points.Clear();
this.chart1.Series[1].Points.Clear();
this.chart1.Series[2].Points.Clear();
int chnum = 0;
double chsum = 0;
for (int i = 0; i < dataQueue_ch3.Count; i++)
{
chnum = 0;
chsum = 0;
if (checkBox1.Checked)
{
this.chart1.Series[