PDA

View Full Version : Efficiently plotting curves



Cruz
12th October 2009, 14:09
Hello there,

I need a solution for plotting curves in a fast paced scientific application. So far I'm using a self made widget, that stores the data points in a ring buffer and draws the curve by connecting the data point by point with a line. The data arrives in real time and whenever I get a new data point, I feel the need to shift the whole plot one unit to the left. It's like viewing a time series shifting by in real time if you know what I mean. So with each update of the screen I iterate through the whole buffer and draw the entire curve on the screen in paintEvent(). This is about as fast as my grandma making chicken soup.

Any ideas of how I can get the most performance out of it? I'm looking at Qwt, but does it do anything differently performance wise? Is there a simple trick I can use to juice up my own plotter puppy?

Thanks,
Cruz

Comer352l
12th October 2009, 14:24
I'm using Qwt in an fast paced scientific application, too (well, maybe not as fast as yours ?) and the performance is really good.

Take a look at the differences between e.g. QwtPlotCurve::setData() and setRawData() and make sure you do not unnecessarily reset the plots. But even then it should be fast enough.