首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LineChart JavaFX性能

LineChart JavaFX性能
EN

Stack Overflow用户
提问于 2017-01-30 19:11:03
回答 1查看 1.5K关注 0票数 2

我正经历着比正常的反应为LineChart在拉斯宾-覆盆子Pi。我正在编码示波器和连续重绘2系列500点(总共1000点)。动画关机了。数据收集是可执行的(低于2ms)。当前数据重绘时间约为800 ms左右。所需重绘时间至少为100 is。我在下面包含了代码片段。在覆盆子皮上显示性能良好的javafx图表的最佳实践是什么?我是不是走错路了?我是否应该使用不同的图表来连续地重新绘制两条线?

平台:

  • 树莓Pi诉3
    • 操作系统:拉斯宾第8版(jessie)
    • Java版本:
      • java版本"1.8.0_65“
      • Java(TM) SE运行时环境(build 1.8.0_65-b17)
      • Java HotSpot(TM)客户端VM (build 25.65-b01,混合模式)

代码语言:javascript
复制
- 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

显示码

代码语言:javascript
复制
@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()
EN

回答 1

Stack Overflow用户

发布于 2017-11-07 22:47:48

我发现从图表中删除网格线非常有帮助。

例如:

代码语言:javascript
复制
chart.setHorizontalGridLinesVisible(false);
chart.setVerticalGridLinesVisible(false);

没有尝试减少网格线的数量。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41943662

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档