Results 1 to 6 of 6

Thread: PlotWin with scroll on real time

  1. #1
    Join Date
    Aug 2008
    Location
    Germany
    Posts
    5
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default PlotWin with scroll on real time

    Hi,
    I need help to construct a window like the attached one.
    There should be a realtime plot with scroll view per default. I will scroll at the hole plotted curve all the time.
    I read/tried all the qwt examples and did the first steps, but the scroll behaviour makes me crazy.
    I implement a plot with curveplot and x-axis as
    setAxisScaleDraw(QwtPlot::xBottom,xScaleDraw);
    the real time plot works, I give the x and y values.
    If I try :
    setAxisScale(QwtPlot::xBottom, 0, 10, 5);
    the start of x axis is ever 0, This i understand.
    Have I ever do replot the axis if the curve is outside the canvas?
    I thought QWT has implement such behaviour. This should be a normal bahaviour in my eyes.
    Or did I not found this.

    thanks a lot for help

    looki
    Attached Images Attached Images

  2. #2
    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: PlotWin with scroll on real time

    You can manage the axis by yourself ( QwtPlot::setAxisScale, QwtPlot::setAxisScaleDiv ) or you enable autoscaling (QwtPlot::setAxisAutoScaling), so that the axis is adjusted to the range of the attached curves ( in fact it is adjusted to the bounding rectangle of all plot items, with an QwtPlotItem::AutoScale attribute ).

    Whenever the scales or the curve attributes have changed a replot is necessary to make these changes visible. You can enable the autoReplot mode or you call replot manually, what might avoid useless replots in situations, where you need to change more than one attribute.

    Uwe

  3. #3
    Join Date
    Aug 2008
    Location
    Germany
    Posts
    5
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PlotWin with scroll on real time

    I tried with autoScale and it works in that way -> x-axis will be larger
    thats nice, but not for me.

    I update the plot every second, for example. after 10 seconds the x range is 0 ... 11 after 30 seconds 0 ... 31
    but I want to see only a 10 second range: 0 ... 10 1...11 2...12 ...
    and will scroll back to 0...10 on capturing.
    If I go back to last printed value e.g. 15 s the window should scroll automaticly further

    I think this will work within qwt ...

    thanks for further discussion - help

  4. #4
    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: PlotWin with scroll on real time

    As far as I understand you want to show a 10s interval starting from a value that depends on the time ( and some other stuff I didn't understand ) - similar to the cpuplot example.

    Then all you need to do is to increment the scales by one each second ( using setAxisScale(t, t +10.0, ...).

    Uwe

  5. #5
    Join Date
    Aug 2008
    Location
    Germany
    Posts
    5
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PlotWin with scroll on real time

    Uwe,
    thanks,
    that sounds good and is simple ... why do I have not this idea?!?!

    but it's possible to implement a scroll bar per default? it works with zoom.
    I need a default x-scrollbar so I can scroll through the hole plot every time ....


    looki

  6. #6
    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: PlotWin with scroll on real time

    Quote Originally Posted by looki View Post
    but it's possible to implement a scroll bar per default?
    Sure, put a QScrollBar somewhere and connect its signals to slots, where you shift the range of the x-axis ( using setAxisScaleDiv() ).

    F.e look at the event_filter example, that uses a QwtWheel for scrolling. Another sources for inspiration could be the ScrollZoomer/ScrollBar classes of the realtime example - but don't use them as they are, when you don't need a zoomer.

    Uwe

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

    looki (11th August 2008)

Similar Threads

  1. real time plotting
    By gyre in forum Qwt
    Replies: 4
    Last Post: 11th December 2007, 17:13
  2. Rendering real time video using SDL and QT
    By venk2ksubbu in forum Newbie
    Replies: 4
    Last Post: 13th September 2007, 16:20
  3. How to find the presence of scroll bars at run time
    By anju123 in forum Qt Programming
    Replies: 8
    Last Post: 28th July 2007, 21:30
  4. Display the camera frame in real time
    By alex_lue in forum Qt Programming
    Replies: 8
    Last Post: 27th July 2007, 11:31
  5. Displaying real time images
    By Sheetal in forum Qt Programming
    Replies: 9
    Last Post: 22nd February 2007, 12:29

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.