Is it possible to use or define a factor that would be used to determine sample array points y-coordinate ?
For example I am now using this code to modify each points Y value accordint to a factor.
void CustomQwtCurve::setYFactor(const qreal &value)
{
if (value==0) return;
qDebug() << " current factor: " << y_factor;
qreal newfactor=value/y_factor;
y_factor=value;
qDebug() << " factor to multiply current points: " << newfactor;
qDebug() << " new y_factor: " << y_factor;
for (int i=0; i<points_x.count(); i++) {
qreal px=points_x.at(i);
qreal py=points_y.at(i);
py=py * newfactor;
points_y[i]=py;
}
}
void CustomQwtCurve::setYFactor(const qreal &value)
{
if (value==0) return;
qDebug() << " current factor: " << y_factor;
qreal newfactor=value/y_factor;
y_factor=value;
qDebug() << " factor to multiply current points: " << newfactor;
qDebug() << " new y_factor: " << y_factor;
for (int i=0; i<points_x.count(); i++) {
qreal px=points_x.at(i);
qreal py=points_y.at(i);
py=py * newfactor;
points_y[i]=py;
}
}
To copy to clipboard, switch view to plain text mode
Problem is this is very slow approach as I might have 100 000 or even more samples in an array.
Would it be possible to define a factor (where ?) that would be used only when drawing points so that I would not have to modify the array every time ?
For drawing I use:
QwtPlotDirectPainter->drawSeries( curve, curve->getLastX()-2, curve->pointsCount() - 1 );
'curve' is own class derived from QwtPlotCurve
Bookmarks