using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } List dataPoint = new List(); private void Form1_Load(object sender, EventArgs e) { chart1.Series[0].YValuesPerPoint = 1; for (int i = 0; i < 100; i++) { dataPoint.Add(0D); } chart1.Series[0].Points.DataBind(dataPoint, "", "", ""); chart1.ChartAreas[0].AxisY.Maximum = 120; Timer t = new Timer(); t.Interval = 100; t.Tick += new EventHandler(t_Tick); t.Enabled = true; } Random rnd = new Random(); int index = 0; void t_Tick(object sender, EventArgs e) { this.Text = index.ToString(); dataPoint[index] = (double)rnd.Next(0, 100); chart1.Series[0].Points.DataBind(dataPoint, "", "", ""); index++; if (index == chart1.Series[0].Points.Count) index = 0; this.Invalidate(); } } }