PDA

View Full Version : Uwe : How to create real time plot with auto scale axis and zooming functionality.



vinothrajendran
18th November 2014, 09:59
I have a scenario where i should be plotting real time data for an hour. But first i have to display only first 2 min in x axis, when time reaches 2 min i should expand my scale to 4 min and it should keep on going......

I tried using QwtPlotDirectPainter which is efficient but after 2 min , i dont know how to rescale it to 4 min ....

But if i use QwtPlotCurve with replot() and autoaxisscale() feature , i am able to acheive this, but with delay in plotting as time increases ....

Any help will be appreciated.....


I feel QwtPlotDirectPainter will be efficient, please give a solution with it.....
I tried looking at Oscilloscope example , i could not get it....If possible try give source code with explanation......

Uwe
19th November 2014, 06:48
I have a scenario where i should be plotting real time data for an hour. But first i have to display only first 2 min in x axis, when time reaches 2 min i should expand my scale to 4 min and it should keep on going......


void YourPlot::addPoint( const QPointF &pos )
{
const QwtInterval interval = axisInterval( QwtPlot::xBottom );
if ( pos.x() > interval.maxValue() )
{
setAxisScale( interval.minValue(), interval.maxValue() + ... );
replot();
}

...
}Uwe