0
我正在使用MPAndroidchart来绘制实时线图。我在一秒钟内绘制了240个值。但是绘图太慢,需要5秒以上来绘制一秒钟的数据。如何在一秒钟内绘制1秒数据?Android MPandroidchart绘图不与实时同步
private void addEntryGraph1() {
LineData data = graph1.getLineData();
if (data != null) {
ILineDataSet set = data.getDataSetByIndex(0);
if (set == null) {
set = createSet();
data.addDataSet(set);
}
data.addXValue(new SimpleDateFormat("HH:mm:ss")
.format(new Date(System.currentTimeMillis())));
for (int i = 0; i < sampleRatio; i++)
data.addEntry(new Entry((float) (ch1Buffer.get(i)), set.getEntryCount()), 0);
graph1.notifyDataSetChanged();
graph1.setVisibleXRange(240, 240);
graph1.moveViewToX(0);
synchronized (ch1Buffer) {
ch1Buffer.subList(0, sampleRatio).clear();
}
}
}
。 https://github.com/PhilJay/MPAndroidChart – Jagu
我已经创建。问题编号是#1676 – somia