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.

Qt Code:
  1. void CustomQwtCurve::setYFactor(const qreal &value)
  2. {
  3. if (value==0) return;
  4. qDebug() << " current factor: " << y_factor;
  5. qreal newfactor=value/y_factor;
  6. y_factor=value;
  7. qDebug() << " factor to multiply current points: " << newfactor;
  8. qDebug() << " new y_factor: " << y_factor;
  9.  
  10. for (int i=0; i<points_x.count(); i++) {
  11. qreal px=points_x.at(i);
  12. qreal py=points_y.at(i);
  13. py=py * newfactor;
  14. points_y[i]=py;
  15. }
  16. }
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