Re: how to scroll qwtplot?
you could try moving plot axis scale like this
plot->setAxisScale(QwtPlot::xBottom,from,to);
where from is x start value and to is de x end value
Re: how to scroll qwtplot?
Thanks for reply...
So how can i attach a scroll to QwtPlot???
Re: how to scroll qwtplot?
you can use a Qt Scroll Widget, but you can't attach to your plot.
or you could implement a drag and drop function with a QwtPlotPicket or something like that
Re: how to scroll qwtplot?
Quote:
Originally Posted by
desantossierra
you can use a Qt Scroll Widget, ...
There are many different ways to implement "scrolling". Basically it is not more than translating some sort of user input to changes of the current scale.
Qwt offers a couple of ways how to navigate by user inputs on the plot canvas. But of course you could also use any type of QAbstractSlider ( like a scroll bar ) or QwtAbstractSlider. But when using some sort of slider the application has to implement the layout code - the realtime example shows it for scroll bars, the eventFilter examples for a wheel.
The interesting thing about using a wheel is, that you don't need to have a reference interval ( min, max ) and you can scroll up/down without limits relative to the current scale interval.
Uwe
Re: how to scroll qwtplot?
Thanks Uwe for replying..
can u explain more? I want to scroll back to previous times not when user zooms.
Re: how to scroll qwtplot?
Quote:
Originally Posted by
alizadeh91
Thanks Uwe for replying..
can u explain more? I want to scroll back to previous times not when user zooms.
How do you assign data to your plot? If say you have an array with full data which is constantly growing and
from time to time you pass it to curve object. Suppose you have X as a number of seconds from start.
Then every time, after updating data to curve you do
plot->setAxisScale(QwtPlot::xBottom,lastSecondOfData - intervalToDisplayInSeconds , lastSecondOfData );
which will show you last (intervalToDisplayInSeconds) seconds of data, not all of them.
Other way is to use piece of full array(say last several elements), and assign this piece to plot curve, it will be
showing updating data.
Re: how to scroll qwtplot?
Quote:
Originally Posted by
alizadeh91
Thanks Uwe for replying..
can u explain more? I want to scroll back to previous times not when user zooms.
zooming != scrolling - don't expect any useful answer as long as there is no reasonable question.
Uwe
Re: how to scroll qwtplot?
Thanks. I have a full array of data that only a part of it (last interval) will plot. So i want to go back to previous data by scrolling. All of data are growing
Re: how to scroll qwtplot?
Quote:
Originally Posted by
alizadeh91
Thanks. I have a full array of data that only a part of it (last interval) will plot. So i want to go back to previous data by scrolling. All of data are growing
Pagewise by forward/backward buttons - or what type of user interaction do you have in mind ?
Uwe
Re: how to scroll qwtplot?
I want (if possible) full option of scrolling along time axis!!
Re: how to scroll qwtplot?
Quote:
Originally Posted by
alizadeh91
I want (if possible) full option of scrolling along time axis!!
You can always modify the scales using QwtPlot::setAxisScale, but when you want to have some sort of user interaction you have to tell us which one.
If you can't - or don't want to - don't expect any further answers.
Uwe
1 Attachment(s)
Re: how to scroll qwtplot?
Quote:
Originally Posted by
Uwe
zooming != scrolling - don't expect any useful answer as long as there is no reasonable question.
Interestingly, we scroll AND zoom via a separate plot in GoldenCheetah and using a qxtspanslider.
Attached is a screenshot. Attachment 7413
Re: how to scroll qwtplot?
Thanks liversedge...
Can u explain more about GoldenCheetah?? Is it a Qt component or something like that??
Re: how to scroll qwtplot?
Use
(void) new QwtPlotPanner(plot->canvas());
(void) new QwtPlotMagnifier(plot->canvas());
and dont forget to include qwt_plot_magnifier.h and qwt_plot_panner.h
you will able to zoom in or zoom out through mouse scroll.
and you can able to move your curve.
Re: how to scroll qwtplot?
That is a good way sonulohani :) Thanks