Home > Net >  Help!!!!! Timer graphing, how can let the chart data Y value corresponding definition of random vari
Help!!!!! Timer graphing, how can let the chart data Y value corresponding definition of random vari

Time:10-18

using System;
Using System. Collections. Generic;
Using System.Com ponentModel;
Using System. The Data;
Using System. Drawing;
Using System. Linq;
using System.Text;
Using System. The Threading. The Tasks;
Using System. Windows. Forms;
Using System. Windows. Forms. DataVisualization. Charting;
The namespace RealChart
{
Public partial class RealChart: Form
{
Private Queue DataQueue=new Queue (100);
Private Queue DatbQueue=new Queue (100);
Private Queue DatcQueue=new Queue (100);
Private Queue DatdQueue=new Queue (100);
Private Queue DateQueue=new Queue (100);
Private Queue DatfQueue=new Queue (100);
Private int curValue=https://bbs.csdn.net/topics/0;
Private int cuaValue=https://bbs.csdn.net/topics/0;
Private int cubValue=https://bbs.csdn.net/topics/0;
Private int cucValue=https://bbs.csdn.net/topics/0;
Private int cudValue=https://bbs.csdn.net/topics/0;
Private int cueValue=https://bbs.csdn.net/topics/0;
Private int num=5;//delete every time add a few point

Public RealChart ()
{
Enclosing skinEngine1=new Sunisoft. IrisSkin. SkinEngine (((System.ComponentModel.Com ponent) (this)));
InitializeComponent();

}

Private void timer1_Tick (object sender, EventArgs e)
{
UpdataQueueValue ();
This. Chart1. Series [0]. Points. The Clear ();
For (int I=0; I & lt; DataQueue. Count; I++)
{
This. Chart1. Series [0]. Points. The AddXY ((I + 1), dataQueue ElementAt (I));
}

UpdatbQueueValue ();
This. Chart2. Series [0]. Points. The Clear ();
For (int v=0; V & lt; DatbQueue. Count; V++)
{
This. Chart2. Series [0]. Points. The AddXY ((n + 1), datbQueue ElementAt (v));
}
UpdatcQueueValue ();
This. Chart3. Series [0]. Points. The Clear ();
For (int v=0; V & lt; DatcQueue. Count; V++)
{
This. Chart3. Series [0]. Points. The AddXY ((n + 1), dataQueue ElementAt (v));
}
UpdatdQueueValue ();
This. Chart4. Series [0]. Points. The Clear ();
For (int v=0; V & lt; DatdQueue. Count; V++)
{
This. Chart4. Series [0]. Points. The AddXY ((n + 1), datdQueue ElementAt (v));
}
UpdateQueueValue ();
This. Chart5. Series [0]. Points. The Clear ();
For (int v=0; V & lt; DateQueue. Count; V++)
{
This. Chart5. Series [0]. Points. The AddXY ((n + 1), dateQueue ElementAt (v));
}
UpdatfQueueValue ();
This. Chart6. Series [0]. Points. The Clear ();
For (int v=0; V & lt; DatfQueue. Count; V++)
{
This. Chart6. Series [0]. Points. The AddXY ((n + 1), datfQueue ElementAt (v));
}
}

Private void btnInit_Click (object sender, EventArgs e)
{
InitChart ();
}

Private void btnStart_Click (object sender, EventArgs e)
{
This. The timer1. Start ();
}

Private void btnStop_Click (object sender, EventArgs e)
{
This. The timer1. Stop ();
}

Private void InitChart () {
//define the chart area
This. Chart1. ChartAreas. The Clear ();
ChartArea chartArea1=new ChartArea (" C1 ");
This. Chart1. ChartAreas. Add (chartArea1);
This. Chart2. ChartAreas. The Clear ();
ChartArea chartArea2=new ChartArea (" C2 ");
This. Chart2. ChartAreas. Add (chartArea2);
Enclosing chart3. ChartAreas. The Clear ();
ChartArea chartArea3=new ChartArea (" C3 ");
Enclosing chart3. ChartAreas. Add (chartArea3);
Enclosing chart4. ChartAreas. The Clear ();
ChartArea chartArea4=new ChartArea (" C4 ");
Enclosing chart4. ChartAreas. Add (chartArea4);
Enclosing chart5. ChartAreas. The Clear ();
ChartArea chartArea5=new ChartArea (" C5 ");
Enclosing chart5. ChartAreas. Add (chartArea5);
Enclosing chart6. ChartAreas. The Clear ();
ChartArea chartArea6=new ChartArea (" C6 ");
Enclosing chart6. ChartAreas. Add (chartArea6);
This. Chart1. Series. The Clear ();
The Series series1=new Series (" S1 ");
Series1. ChartArea="C1";
This. Chart1. Series. The Add (series1);
This. Chart2. Series. The Clear ();
The Series series2=new Series (" S2 ");
Series2. ChartArea="C2";
This. Chart2. Series. The Add (series2);
Enclosing chart3. Series. The Clear ();
The Series series3=new Series (" S3 ");
Series3. ChartArea="C3";
Enclosing chart3. Series. The Add (series3);
Enclosing chart4. Series. The Clear ();
The Series series4=new Series (" S4 ");
Series4. ChartArea="C4";
Enclosing chart4. Series. The Add (series4);
Enclosing chart5. Series. The Clear ();
S5 Series series5=new Series (" ");
Series5. ChartArea="C5";
Enclosing chart5. Series. The Add (series5);
Enclosing chart6. Series. The Clear ();
The Series series6=new Series (" S6 ");
Series6. ChartArea="C6";
Enclosing chart6. Series. The Add (series6);

//set the chart shows the style
This. Chart1. ChartAreas [0]. AxisY. Minimum=0;
This. Chart1. ChartAreas [0]. AxisY. Maximum=100;
This. Chart1. ChartAreas [0]. AxisX. Interval=5;
This. Chart1. ChartAreas [0]. AxisX. MajorGrid. LineColor=System. Drawing. The Color, Silver;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related