fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Windows.Forms.DataVisualization.Charting;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. List<double> dataPoint = new List<double>();
  20. private void Form1_Load(object sender, EventArgs e)
  21. {
  22.  
  23. chart1.Series[0].YValuesPerPoint = 1;
  24. for (int i = 0; i < 100; i++)
  25. {
  26. dataPoint.Add(0D);
  27. }
  28. chart1.Series[0].Points.DataBind(dataPoint, "", "", "");
  29. chart1.ChartAreas[0].AxisY.Maximum = 120;
  30. Timer t = new Timer();
  31. t.Interval = 100;
  32. t.Tick += new EventHandler(t_Tick);
  33. t.Enabled = true;
  34. }
  35. Random rnd = new Random();
  36. int index = 0;
  37. void t_Tick(object sender, EventArgs e)
  38. {
  39. this.Text = index.ToString();
  40.  
  41. dataPoint[index] = (double)rnd.Next(0, 100);
  42. chart1.Series[0].Points.DataBind(dataPoint, "", "", "");
  43. index++;
  44. if (index == chart1.Series[0].Points.Count) index = 0;
  45. this.Invalidate();
  46. }
  47. }
  48. }
  49.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty