Results 1 to 16 of 16

Thread: how to scroll qwtplot?

  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default how to scroll qwtplot?

    Hello everybody...
    I have a little problem with qwtplot.
    I've written a plot such a cpuplot(Qwt examples). How can i make it to scroll with time. For example suppose that it's been two hours which it runs, i want to let user go back with scroll to zero.
    How can i do that??? (Don't say look at realtime example, cuase it's different approach; i want to scroll with time not when zooming)
    Thanks everybody

  2. #2
    Join Date
    Jan 2012
    Posts
    17
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  3. #3
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    Thanks for reply...
    So how can i attach a scroll to QwtPlot???

  4. #4
    Join Date
    Jan 2012
    Posts
    17
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    Quote Originally Posted by desantossierra View Post
    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

  6. The following user says thank you to Uwe for this useful post:

    alizadeh91 (9th February 2012)

  7. #6
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default 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.

  8. #7
    Join Date
    Feb 2012
    Posts
    10
    Qt products
    Qt4

    Default Re: how to scroll qwtplot?

    Quote Originally Posted by alizadeh91 View Post
    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.

  9. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    Quote Originally Posted by alizadeh91 View Post
    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

  10. #9
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default 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

  11. #10
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    Quote Originally Posted by alizadeh91 View Post
    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

  12. #11
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    I want (if possible) full option of scrolling along time axis!!

  13. #12
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    Quote Originally Posted by alizadeh91 View Post
    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
    Last edited by Uwe; 17th February 2012 at 12:17.

  14. #13
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: how to scroll qwtplot?

    Quote Originally Posted by Uwe View Post
    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. Screenshot at 2012-02-17 22:08:36.jpg

  15. The following 2 users say thank you to liversedge for this useful post:

    alizadeh91 (19th February 2012), van.der.sam (10th March 2012)

  16. #14
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    Thanks liversedge...
    Can u explain more about GoldenCheetah?? Is it a Qt component or something like that??

  17. #15
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Cool 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.

  18. #16
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: how to scroll qwtplot?

    That is a good way sonulohani Thanks

Similar Threads

  1. Scroll bars in scroll area not comming in scroll area
    By aurora in forum Qt Programming
    Replies: 3
    Last Post: 4th January 2012, 07:50
  2. Scroll bars in scroll area not comming
    By aurora in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2011, 20:56
  3. QDial disabling key scroll and mouse wheel scroll
    By ldg20 in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2010, 00:05
  4. Replies: 0
    Last Post: 28th December 2009, 13:24
  5. Replies: 6
    Last Post: 14th April 2006, 06:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.