I have got an question about adding points to charts.
My windows forms application is using a thread to get the Y value from another server. Every 500ms I get a new value(string) which should be added as a point, but I have no idea how to do that. It would be really nice if the points will be displayed in realtime and not only after ending the process. I think it is not a real difficult question but I didn`t find a solution.
Thread:
private void Work()
{
int counter = 0;
while (true)
{
counter++;
WebClient code = new WebClient();
speed_str = code.DownloadString("http://192.168.19.41/speedfile.html");
speedval = Convert.ToDouble(speed_str);
Console.WriteLine(speedval.ToString() + "\n Times executed: " + counter);
Thread.Sleep(1000);
}
}
Configuration and chart
Thread thread = new Thread(new ThreadStart(this.Work));
thread.IsBackground = true;
thread.Name = "My Worker.";
thread.Start();
//Speed
Series speed = new Series("Speed[m/s]");
speed.ChartType = SeriesChartType.Spline;
//Engines Left
engleft = new Series("Engines Left");
engleft.ChartType = SeriesChartType.Spline;
Engines.Series.Add(engleft);
engleft.Points.Clear();
string speed_read = Console.ReadLine();
Thanks for help :)