private void UpdatePlot(LineChart mChart, int broadcast_idx, float[] dataVector) { LineData data = mChart.LineData; if (data != null) { ILineDataSet setx = (ILineDataSet)data.DataSets[0]; ILineDataSet sety = (ILineDataSet)data.DataSets[1]; ILineDataSet setz = (ILineDataSet)data.DataSets[2]; // add new plot entry data.AddEntry(new Entry(broadcast_idx, dataVector[0]), 0); data.AddEntry(new Entry(broadcast_idx, dataVector[1]), 1); data.AddEntry(new Entry(broadcast_idx, dataVector[2]), 2); mChart.NotifyDataSetChanged(); // limit the number of visible entries mChart.SetVisibleXRangeMaximum(max_entries); // remove plot entries outside of current view if (setx.EntryCount == max_entries_saved) { setx.RemoveEntry(0); sety.RemoveEntry(0); setz.RemoveEntry(0); mChart.AxisLeft.SpaceTop = 10f; } // move to the latest entry mChart.MoveViewToX(broadcast_idx); } }
private void AddOrientEntry(float valueX, float valueY, float valueZ) { LineData data = mOrientationChart.LineData; if (data != null) { ILineDataSet set = (ILineDataSet)data.DataSets[0]; data.AddEntry(new Entry(set.EntryCount, valueX), 0); data.AddEntry(new Entry(set.EntryCount, valueY), 1); data.AddEntry(new Entry(set.EntryCount, valueZ), 2); mOrientationChart.NotifyDataSetChanged(); // limit the number of visible entries mOrientationChart.SetVisibleXRangeMaximum(100); // move to the latest entry mOrientationChart.MoveViewToX(data.EntryCount); } }