Results 1 to 4 of 4

Thread: Qwt real time

  1. #1
    Join Date
    Jan 2012
    Posts
    23
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Qwt real time

    Hello. Doing real time plot. At the moment, adding new points, the graph starts to shrink, so that all points fit on the screen.
    But, I need to do so, as is done in the example "Cpu plot". That is, when the graph of the curve reaches the right edge, the leftmost points are removed, and right there is a place for new points. Approximately as shown in the picture:
    TIME3.jpg

    But I can not understand how it is implemented in the example Cpu Plot.
    Please help me to reach this target.

  2. #2
    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: Qwt real time

    In Cpu Plot there is a double array which keep yleft scale. after every second all of its member increment by one and then rescale and replot. So what you need is to replot your plot every second by two double array: one for scale and one for values. Note that scale array must increment by one every second. Hope i could help

  3. The following user says thank you to alizadeh91 for this useful post:

    oddytz1989 (10th February 2012)

  4. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt real time

    Or every time you add new point manually set scale div using setInterval():
    Qt Code:
    1. plot->axisScaleDiv( QwtPlot::xBottom )->setInterval( new_point_time - visible_time_span, new_point_time );
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to Spitfire for this useful post:

    oddytz1989 (10th February 2012)

  6. #4
    Join Date
    Jan 2012
    Posts
    23
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt real time

    Thanks. Made so:

    Qt Code:
    1. if ((vectX1.size()) < 10)
    2. {
    3. vectX1.append(time1.fromTime_t(osX).toTime_t());
    4. vectY1.append(osY);
    5. curv1->setSamples(vectX1,vectY1);
    6. }
    7. else
    8. {
    9.  
    10. vectX1.pop_front();
    11. vectY1.pop_front();
    12. vectX1.append(time1.fromTime_t(osX).toTime_t());
    13. vectY1.append(osY);
    14. curv1->setSamples(vectX1,vectY1);
    15.  
    16. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by oddytz1989; 10th February 2012 at 11:13.

Similar Threads

  1. Zoom in real time
    By oddytz1989 in forum Qwt
    Replies: 4
    Last Post: 7th February 2012, 06:00
  2. Real time QT application?
    By marc2050 in forum Newbie
    Replies: 1
    Last Post: 8th June 2011, 07:08
  3. Real time rendering
    By kaszewczyk in forum Newbie
    Replies: 1
    Last Post: 7th July 2010, 18:26
  4. real time plotting
    By agostain in forum Qwt
    Replies: 0
    Last Post: 10th August 2009, 11:47
  5. real time plotting
    By gyre in forum Qwt
    Replies: 4
    Last Post: 11th December 2007, 17:13

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.