I have a real time plot where data is continuously added. When a tick label appears from the right of the x-axis (time) the axis is compressed a little and when the tick label disappears on the left side of the x-axis it is stretched a little. This affects my waveforms and also looks like lag.
The only scaling I am doing in the initialization of the plot is:
qwtDateScaleDraw = new QwtDateScaleDraw (Qt::OffsetFromUTC);
qwtDateScaleDraw->setDateFormat(QwtDate::Second, "hh:mm:ss");
qwtDateScaleDraw
->setUtcOffset
(QDateTime::currentMSecsSinceEpoch() / 1000);
qwtDateScaleDraw = new QwtDateScaleDraw (Qt::OffsetFromUTC);
qwtDateScaleDraw->setDateFormat(QwtDate::Second, "hh:mm:ss");
qwtDateScaleDraw->setUtcOffset(QDateTime::currentMSecsSinceEpoch() / 1000);
To copy to clipboard, switch view to plain text mode
And when new data is appended to the plot I rescale it to always have the previous 10 seconds of data visible by doing this:
plot
->setAxisScale
(QwtPlot::xBottom, timeStamp
- 10000, timeStamp,
1000);
plot->setAxisScale(QwtPlot::xBottom, timeStamp - 10000, timeStamp, 1000);
To copy to clipboard, switch view to plain text mode
(where timeStamp is QDateTime::currentMSecsSinceEpoch())
I have been trying to get this to work for days now, but I can not figure it out =/
Bookmarks