我正经历着比正常的反应为LineChart在拉斯宾-覆盆子Pi。我正在编码示波器和连续重绘2系列500点(总共1000点)。动画关机了。数据收集是可执行的(低于2ms)。当前数据重绘时间约为800 ms左右。所需重绘时间至少为100 is。我在下面包含了代码片段。在覆盆子皮上显示性能良好的javafx图表的最佳实践是什么?我是不是走错路了?我是否应该使用不同的图表来连续地重新绘制两条线?
平台:
- JavaFX Version: armv6hf-sdk 8.0.102 (build b00)
- Memory Split: 512 MB Graphics, 512 MB System
- Video: HDMI
- SoC: Broadcom BCM2837
- CPU: 4× ARM Cortex-A53, 1.2GHz
显示码
@FXML
LineChart oscilloscope;
//indicates that the previous data has been displayed
//and that the latest data should now be displayed
//didn't bother to synchronize
boolean needsUpdating = true;
protected void startDisplay() {
oscilloscope.setAnimated(false);
oscilloscope.setCreateSymbols(false);
oscilloscope.getXAxis().setLabel("Time (ms)");
oscilloscope.getXAxis().setAutoRanging(false);
oscilloscope.getYAxis().setLabel("Volts (v)");
oscilloscope.getYAxis().setAutoRanging(false);
new Thread() {
public void run() {
while (!done) {
XYChart.Series ch1 = getChan1Data();
XYChart.Series ch2 = getChan2Data();
ch1.setName("Channel 1");
ch2.setName("Channel 2");
if (needsUpdated) {
needsUpdated = false;
Platform.runLater(new Runnable() {
@Override
public void run() {
//performance is the same whether I use this or
//oscilloscope.getData().clear()
oscilloscope.setData(FXCollections.observableArrayList());
oscilloscope.getData().addAll(ch1, ch2);
needsUpdating = true;
} //end run()
} //end Platform.runLater()
} //end if(needsUpdating)
} //end while(!done)
}.start(); //end new Thread
} //end startDisplay()发布于 2017-11-07 22:47:48
我发现从图表中删除网格线非常有帮助。
例如:
chart.setHorizontalGridLinesVisible(false);
chart.setVerticalGridLinesVisible(false);没有尝试减少网格线的数量。
https://stackoverflow.com/questions/41943662
复制相似问题