0

I need live chart to be updated every 5 millisecond.

I tried to use LiveChart, but it isn't appropriate for me. it crashes after adding 2000 points :D .

Then I used native chart in Visual Studio 2019 ,which I found it in ToolBox, it's better than LiveChart, it doesn't crash, but it works slowly I.e. adding 2000 point to the chart takes 50 seconds! Whereas it should take only 10 seconds.

  • I use WinForm

  • I use timer for update chart, set 5 for Interval

Form1_Load:

var chart = chart1.ChartAreas[0];
chart.AxisX.IntervalType = DateTimeIntervalType.Number;

chart.AxisX.LabelStyle.Format = "";
chart.AxisY.LabelStyle.Format = "";
chart.AxisY.LabelStyle.IsEndLabelVisible = true;

chart1.Series.Add("New");
chart1.Series["New"].ChartType = SeriesChartType.Line;
chart1.Series["New"].Color = Color.Red;
chart1.Series[0].IsVisibleInLegend = false;

timer1_Tick:

if (i >= 2000) return;
Random rnd = new Random();
chart1.Series["New"].Points.AddXY(i++, rnd.Next(50));
The_Black_Smurf
  • 5,178
  • 14
  • 52
  • 78
A.Motahari
  • 173
  • 5
  • 10
  • 7
    I doubt WinForms can render a 2000 point series at 200 FPS. Even if it could are you running a G-Sync or equivalent monitor? –  Aug 04 '20 at 09:00
  • 4
    IMHO it doesn't make sense to update a chart every 5 ms. Updating every 100ms is far enough for the human eye on a chart. So decouple your update mechanism of actual data and visualizing on the screen. – Oliver Aug 04 '20 at 09:12
  • _I use timer for update chart, set 5 for Interval_ Timer only has a resolution of 20-30 ms. So this alone will break your requirements. What do you plan to happen: Add points and squeeze the old ones? Remove old points? Or use one of the two zooming options? [Discussion](https://stackoverflow.com/questions/50076045/chart-auto-scroll-oscilloscope-effect/50077332#50077332) – TaW Aug 04 '20 at 10:19
  • _adding 2000 point to the chart takes 50 seconds!_ No it doesn't. But 2000 Timer Ticks will take so so, as each will only come after around 20-30 ms. – TaW Aug 05 '20 at 06:57

0 Answers0