2016-04-15 39 views
1

私はWindows 7 x64、Qt 5.6、Visual Studio 2015、QCustomPlot 1.3.2を使用します。私はセンサから温度グラフを描く必要があります(リアルタイム)。私は500msごとに温度値を受け取ります(frequency = 2Hz)。 time_period = 10分に最後の値を受け取るには、QCustomPlotインスタンスにどのような設定を適用する必要がありますか?ここ はリニューアルスロットの断片である:リアルタイム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 = 8some_delta = 0.25

答えて

1

あなたxAxisは、次のようにその範囲を設定する必要があります10分(600秒)の一定の範囲を持つために、数秒である場合:some_deltaの値が最大である

custom_plot_->xAxis->setRange(key + some_delta, 600, Qt::AlignRight); 

君は。 QCPAxis Class Referenceを見てください。

関連する問題