Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.
Have a look at: http://qwt.sourceforge.net/class_qwt_series_data.html and http://qwt.sourceforge.net/class_qwt...05dfae2d1668e6
The implementation could be like this:
Code:
virtual QPointF YourData
::sample( size_t index
) const {
qreal currentX = ...;
qreal x = ...;
qreal y = ...;
}
This translates "ms since being started" into "ms before now" and you can set a range of [-10000, 0] to always see the samples of the last 10 seconds.
Be careful, that calculating x/y/currentX is not expensive - in case you need to render many points ( many more than 400 isn't ).
In case of having many points outside of the 10s ( or whatever your frame is ) it might be worth to enable polygon clipping.
Uwe
Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.
Uwe, many thanks, I will try it.
Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.
Uwe,
Code:
virtual QPointF YourData
::sample( size_t index
) const {
...
qreal currentX = ...;
...
}
Are you sure that this will not a bootleneck too? Because for this situation we need to call the QDateTime::currentDatetime() each time for each sample...
Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.
Quote:
Originally Posted by
kuzulis
Because for this situation we need to call the QDateTime::currentDatetime() each time for each sample...
Of course you have to calculate your reference time only once and not for each call of sample().
So what about storing QDateTime::currentDatetime() as reference time inside of the data object, whenever you receive a new set of samples.
You could also rely on the fact, that iterating over samples always starts at index 0 and always update the reference time on this one.
But I wouldn't recommend to do this, as you always have a delay until the plot is updated and then you have a gap between the data and the reference time.
Uwe
Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.
Uwe,
So, your idea is to calculate the reference time like this:
e.g.:
Code:
...
MySeriesData : public QwtSeriesData
{
...
MySeriesData (qint64 reftime, const QVector<QPointF> &samples)
: m_reftime(reftime)
, m_samples(samples)
{
}
{
...
...
}
private:
qint64 m_reftime= 0;
QVector<QPointF> m_samples;
}
...
// And then...
const auto reftime
= QDateTime::currentMSecsSinceEpoch();
curve->setData(new MySeriesData(reftime, samples));
..
?
Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.
Well, m_reftime is a qint64, while the samples are doubles. But as long as they match, why not.
Uwe