Using QwtSeriesData as data bridge for large datasets
Hi, I'm new to qt/qwt and am having some performance issues with large datasets. (linux OS, qt 5.7, qwt-6.1.3)
I've been looking at a few post about using QwtSeriesData as a data bridge for large datasets, thus having no need to copy the data into a QVector.
http://www.qtcentre.org/threads/2843...ng-application
http://www.qtcentre.org/threads/6729...-data?p=295423
My dataset consists of a large array of doubles and a static increment value, e.g.
Code:
int numPoints = 10000000
double data[numPoints]
double delta = .054;
QVector<QPointF> points
As of now I copy the data with an associated x value into a QVector<QPointF>
Code:
for (i=0; i<numPoints; i++)
{
time = (i)*delta;
points.
append(QPointF(time, data
[i
]))}
but unfortunately with my limited experience I'm unsure how to best reuse the linked examples for my application. Any basic examples to get me started would be much appreciated.
Re: Using QwtSeriesData as data bridge for large datasets
Code:
class YourData: public QwtSeriesData<QPointF>
{
....
virtual size_t size() const
{
return 1000000;
}
virtual QPointF sample
( size_t i
) const {
return QPointF( i
* delta, m_values
[i
] );
}
// optional
virtual QRectF boundingRect
() const {
return QRect( 0.0, yMin, size
() * delta, ymax
- yMin
);
}
private:
double *m_values;
};
When workin with huge datasets you might want to have a look at the QwtPlotCurve::FilterPointsAggressive from svn trunk.
Uwe
Re: Using QwtSeriesData as data bridge for large datasets
Exactly what I needed. Thanks for the code snippet and the example recommendation Uwe