void OnTimerElapsed(object sender, ElapsedEventArgs e) { Device.BeginInvokeOnMainThread(() => { if (isRunning) { if (sensor != null && sensor.IsData) { chart.SuspendRender(); xAxisSeriesData.AddData(sensor.GetXValue()); yAxisSeriesData.AddData(sensor.GetYValue()); zAxisSeriesData.AddData(sensor.GetZValue()); chart.ResumeRender(); } timer.Start(); } }); }
void OnTimerElapsed(object sender, ElapsedEventArgs e) { Device.BeginInvokeOnMainThread(() => { if (isRunning) { if (sensor != null && sensor.IsData) { chart.SuspendRender(); XAxisSeriesData.Add(new DateTimeData(DateTime.Now, sensor.GetXValue())); RemoveExcessData(XAxisSeriesData); YAxisSeriesData.Add(new DateTimeData(DateTime.Now, sensor.GetYValue())); RemoveExcessData(YAxisSeriesData); ZAxisSeriesData.Add(new DateTimeData(DateTime.Now, sensor.GetZValue())); RemoveExcessData(ZAxisSeriesData); chart.ResumeRender(); } timer.Start(); } }); }