I am using a System.Windows.Forms.Timer in my application which triggers a method that adds new data to four LiveCharts. The interval is set to 1000 ms. It works fine for like the first one or two minutes but then the interval gets bigger and bigger and after 10 minutes it triggers only every 15 seconds or so. I have tried using different Timers without any luck. Might it be that the performance of the application/LiveCharts is just too bad and because the timer runs on the UI thread it has to wait for the application to be "ready"?
Thanks!
Timer setup
graphRefreshTimer = new System.Windows.Forms.Timer();
graphRefreshTimer.Interval = 1000;
graphRefreshTimer.Tick += new EventHandler(refreshUI);
graphRefreshTimer.Start();
refreshUI (basically just adding new ChartValues to the LiveCharts. Takes a maximum of 100 ms to run)
//...
B1VoltageValues.Add(new MeasureModel
{
DateTime = now,
Value = Convert.ToDouble(B1.Voltage) / 1000
});
B1CurrentValues.Add(new MeasureModel
{
DateTime = now,
Value = Convert.ToDouble(B1.Current) / 1000
});
B1ChargingCapacityValues.Add(new MeasureModel
{
DateTime = now,
Value = Convert.ToDouble(B1.getChargeCapIfTrue()) / 1000
});
B1DischargingCapacityValues.Add(new MeasureModel
{
DateTime = now,
Value = Convert.ToDouble(B1.getDischargeCapIfTrue()) / 1000
});
B1EnergyValues.Add(new MeasureModel
{
DateTime = now,
Value = Convert.ToDouble(B1.Energy) / 1000
});
//...
The solution to the problem was to use the LiveCharts.Geared package which can handle way more data that the standard one. No further freezes of the UI occured after using this package.