我使用Windows7 x64,QT5.6,Visual 2015,QCustomPlot 1.3.2。我需要从传感器绘制温度图(实时)。我每500毫秒接收一次温度值(frequency =2Hz)。为了在QCustomPlot = 10分钟内接收到最后的值,我应该对time_period实例应用什么设置?以下是更新插槽的碎片:
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。
发布于 2016-04-16 18:58:24
如果您的xAxis以秒为单位,为了使其恒定范围为10分钟(600秒),您需要将其范围设置如下:
custom_plot_->xAxis->setRange(key + some_delta, 600, Qt::AlignRight);some_delta的值取决于您。看一看QCPAxis类引用。
https://stackoverflow.com/questions/36650092
复制相似问题