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<double> dataPoint = new List<double>();
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, "", "", "");
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();
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CnVzaW5nIFN5c3RlbS5XaW5kb3dzLkZvcm1zLkRhdGFWaXN1YWxpemF0aW9uLkNoYXJ0aW5nOwoKbmFtZXNwYWNlIFdpbmRvd3NGb3Jtc0FwcGxpY2F0aW9uMQp7CiAgICBwdWJsaWMgcGFydGlhbCBjbGFzcyBGb3JtMSA6IEZvcm0KICAgIHsKICAgICAgICBwdWJsaWMgRm9ybTEoKQogICAgICAgIHsKICAgICAgICAgICAgSW5pdGlhbGl6ZUNvbXBvbmVudCgpOwogICAgICAgIH0KICAgICAgICBMaXN0PGRvdWJsZT4gZGF0YVBvaW50ID0gbmV3IExpc3Q8ZG91YmxlPigpOwogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9Mb2FkKG9iamVjdCBzZW5kZXIsIEV2ZW50QXJncyBlKQogICAgICAgIHsKCiAgICAgICAgICAgIGNoYXJ0MS5TZXJpZXNbMF0uWVZhbHVlc1BlclBvaW50ID0gMTsKICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDA7IGkrKykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZGF0YVBvaW50LkFkZCgwRCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2hhcnQxLlNlcmllc1swXS5Qb2ludHMuRGF0YUJpbmQoZGF0YVBvaW50LCAiIiwgIiIsICIiKTsKICAgICAgICAgICAgVGltZXIgdCA9IG5ldyBUaW1lcigpOwogICAgICAgICAgICB0LkludGVydmFsID0gMTAwOwogICAgICAgICAgICB0LlRpY2sgKz0gbmV3IEV2ZW50SGFuZGxlcih0X1RpY2spOwogICAgICAgICAgICB0LkVuYWJsZWQgPSB0cnVlOwogICAgICAgIH0KICAgICAgICBSYW5kb20gcm5kID0gbmV3IFJhbmRvbSgpOwogICAgICAgIGludCBpbmRleCA9IDA7CiAgICAgICAgdm9pZCB0X1RpY2sob2JqZWN0IHNlbmRlciwgRXZlbnRBcmdzIGUpCiAgICAgICAgewogICAgICAgICAgICB0aGlzLlRleHQgPSBpbmRleC5Ub1N0cmluZygpOwoKICAgICAgICAgICAgZGF0YVBvaW50W2luZGV4XSA9IChkb3VibGUpcm5kLk5leHQoMCwgMTAwKTsKICAgICAgICAgICAgY2hhcnQxLlNlcmllc1swXS5Qb2ludHMuRGF0YUJpbmQoZGF0YVBvaW50LCAiIiwgIiIsICIiKTsKICAgICAgICAgICAgaW5kZXgrKzsKICAgICAgICAgICAgaWYgKGluZGV4ID09IGNoYXJ0MS5TZXJpZXNbMF0uUG9pbnRzLkNvdW50KSBpbmRleCA9IDA7CiAgICAgICAgICAgIHRoaXMuSW52YWxpZGF0ZSgpOwogICAgICAgIH0KICAgIH0KfQo=