1. the decision is made which intervals should be displayed on the plot
This decision is known, I always know which of interval I need to display in each moment of a time.
It is not a problem.
Implementing your loading according to 1 is probably the best
Yes, I can start the asynchronous loading of the new data chunks in this 1st moment
(in a moment, when I know the bounds of new "interest interval)", It is not a problem.
I think, I can calculate the "rect of interest" from the "interval of interest",
similar to as it does inside of Qwt. And then, when the new data will be loaded, then
I just will call Plot::replot(). It is not a problem, that the replot() will calls setRectOfInterest(),
because this new "rect of interest" will be same, which is already has been read/prepared
(besides, I can disable the ScaleInterest feature at all.. yes?).
The problem is in access to the "low-level" QwtSeriesData from the parent Plot.
Should I do it like this (pseudo code) ?
// This is 1st moment, when I want the new desired "interest interval" of data.
void Plot::timerEvent(...)
{
// The new interest interval of data, which is in time
// on 1 second to future(repeats each second).
const QwtInterval currentInterval = QwtInterval(m_interval.minValue() + 1000,
m_interval.maxValue() + 1000);
// Now, I need calculate the "new desired rect of interest"? How do it?
const QRectF rect
= rectFromCurrentInterval
(currentInterval
);
// Now. I need to iterate of all attached curves and to get pointers to its data series.
const auto curves = <get curves of this plot>;
for (auto curve : curves) {
auto series = curve->data();
// Starts asynchronous data loading.
series->setRectOfInterest(rect);
}
// save current interval
m_interval = currentInterval;
}
// This is 2st and 3st moments, when all curves's series notifies us (how??) that all data are ready.
void Plot::onAllDataReady(...)
{
// Adjust scales
setAxisScale
(QwtPlot::xBottom, m_interval.
minValue(), m_interval.
maxValue());
// Replot
replot(); // This calls setRectOfInterest() again, but it is not a problem... besides I can disable this feature...
}
// This is 1st moment, when I want the new desired "interest interval" of data.
void Plot::timerEvent(...)
{
// The new interest interval of data, which is in time
// on 1 second to future(repeats each second).
const QwtInterval currentInterval = QwtInterval(m_interval.minValue() + 1000,
m_interval.maxValue() + 1000);
// Now, I need calculate the "new desired rect of interest"? How do it?
const QRectF rect = rectFromCurrentInterval(currentInterval);
// Now. I need to iterate of all attached curves and to get pointers to its data series.
const auto curves = <get curves of this plot>;
for (auto curve : curves) {
auto series = curve->data();
// Starts asynchronous data loading.
series->setRectOfInterest(rect);
}
// save current interval
m_interval = currentInterval;
}
// This is 2st and 3st moments, when all curves's series notifies us (how??) that all data are ready.
void Plot::onAllDataReady(...)
{
// Adjust scales
setAxisScale(QwtPlot::xBottom, m_interval.minValue(), m_interval.maxValue());
// Replot
replot(); // This calls setRectOfInterest() again, but it is not a problem... besides I can disable this feature...
}
To copy to clipboard, switch view to plain text mode
Is this idea ok, or it is bad?
Bookmarks