
Originally Posted by
Spitfire
II may have missed your point.
If you worry about performance you can subclass curve to cache itself when it's plotted.
Then next time you replot the plot curve should check what have changed since last time, use the part of cache that's the same and draw only extra points ,then cache new pixmap again.
Drawing a pixmap is usually too slow for "realtime" conditions. Using such a cache might make sense for very few situations ( stable scales and a fixed size of the plot canvas ).
I would recommend to study the realtime example first as it is much simpler than the oscilloscope. It simply appends points to the end of the curve data and then uses QwtPlotDirectPointer to paint only these points on top of the existing plot. Guess you could use the code of the IncrementalPlot class like it is - beside some modifications, when you want to draw lines and not only symbols:
void IncrementalPlot
::appendPoint( const QPointF &point
) {
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->append( point );
int from = qMin( data->size() - 2, 0 );
d_directPainter->drawSeries( d_curve, from, data->size() - 1 );
}
void IncrementalPlot::appendPoint( const QPointF &point )
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->append( point );
int from = qMin( data->size() - 2, 0 );
d_directPainter->drawSeries( d_curve, from, data->size() - 1 );
}
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks