实时QCustomPlot的设置
Settings for real-time QCustomPlot
我使用Windows 7 x64、Qt 5.6、Visual Studio 2015、QCustomPlot 1.3.2。我需要从传感器上绘制温度图(实时)。我每500毫秒接收一次温度值(frequency
=2 Hz)。为了在time_period
=10分钟期间收到最后一个值,我应该对QCustomPlot
实例应用哪些设置?以下是续订时段的片段:
double key = QDateTime::currentDateTime().toMSecsSinceEpoch() / 1000.0;
custom_plot_->graph(0)->addData(key, value);
custom_plot_->graph(0)->removeDataBefore(old_items_count);
custom_plot_->xAxis->setRange(key + some_delta, old_items_count, Qt::AlignRight);
变量old_items_count = func1(time_period, frequency)
和some_delta = func2(time_period, frequency)
的公式是什么?官方演示包含以下值:old_items_count = 8
、some_delta = 0.25
。
如果你的xAxis
是以秒为单位的,为了保持10分钟(600秒)的恒定范围,你需要设置其范围如下:
custom_plot_->xAxis->setRange(key + some_delta, 600, Qt::AlignRight);
其中some_delta
的值由您决定。查看QCPAxis类参考。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 在C++/Linux中设置单调时钟的一些技巧
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 嵌套在类中时无法设置成员数据
- 需要帮助设置在C++中使用的Potrace
- 如何在自删除后将对象设置为nullptr
- 将指针设置为"nullptr"并不能防止双重删除?
- 如何在Ubuntu中使用cmake设置qt4
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- 如何在boost beast http请求中设置http头
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 如何将这个C++哈希表转换为动态扩展和收缩,而不是使用硬设置的最大值
- 为什么文件名被设置为一个点,而不是在读取矢量中的文件名时
- 如何在24位SDL_Surface上设置像素的颜色
- std::设置自定义比较器
- 如何设置一个范围来提取我想要获得的信息
- 如何在C/C++中用FD_set Unix设置套接字文件描述符
- 通过选项卡的文本设置QTabWidget顺序
- 将特征矩阵的向量设置为0
- 实时QCustomPlot的设置