Results 1 to 12 of 12

Thread: Moving TimeScaleDraw in real time

Hybrid View

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

    Default Re: Moving TimeScaleDraw in real time

    Quote Originally Posted by Maximus2 View Post
    For the QwtPlotMarker, since the position is always in middle of the graph canvas, I could use a custom QLabel that sit there and doesn't move..
    Sure, but for this particular use case this doesn't make much sense as all what needs to be done is a plot item that draws a vertical line in the center of the canvas:

    Qt Code:
    1. class MarkerItem: public QwtPlotItem
    2. {
    3. public:
    4. virtual void draw( QPainter *painter,
    5. const QwtScaleMap &, const QwtScaleMap &,
    6. const QRectF &canvasRect ) const
    7. {
    8. painter->setPen( ... );
    9. painter->drawLine( canvasRect.center.x(), canvasRect.top(), canvasRect.center.x(), canvasRect.bottom() );
    10. }
    11. };
    To copy to clipboard, switch view to plain text mode 

    Using widget overlays makes sense when the content of the overlay is moving fast and you want to avoid replots.

    But before using just any widget for such a use case you should have a look at QwtWidgetOverlay, what is tailored for this situation. In opposite to regular widgets it calculates a widget mask to avoid full repaints ( = flushing the backing store ) of the plot canvas, when its content changes. In a powerful environment you won't see the difference, but f.e. when running the itemeditor remote X11 ( or on slow embedded devices with QWS ) example you will see a major difference.

    Uwe

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

    Maximus2 (10th January 2014)

  3. #2
    Join Date
    Oct 2013
    Location
    Quebec
    Posts
    31
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Moving TimeScaleDraw in real time

    Hey Uwe,

    Just wanted to update this.
    I can move the graph in real-time successfully as shown here :
    https://www.youtube.com/watch?v=I7C-GyJBzog

    The graph is not lagging when the width of the graph is big enough and I'm happy with the performance.
    The only thing that I would like to improve is when the width of the graph get smaller (windows resize or smaller resolution), the bottom axis get laggier as the graph get smaller. Not sure why this happen, seems to be related to the bottom axis getting too small. Maybe I need to put a minimumWidth on the graph or find another elegant solution for smaller graph.

    On a side note, i'm using 6.1 inside Qt 5.4 and all is working fine, I had to modify qwt_transform.h and qwt_transform.cpp so it can compile under 5.4

    qwt_transform.h:
    Qt Code:
    1. static const double LogMin;
    2. static const double LogMax;
    3. //QT_STATIC_CONST double LogMin;
    4. //QT_STATIC_CONST double LogMax;
    To copy to clipboard, switch view to plain text mode 

    qwt_transform.cpp:
    Qt Code:
    1. const double QwtLogTransform::LogMin = 1.0e-150;
    2. const double QwtLogTransform::LogMax = 1.0e150;
    3. //QT_STATIC_CONST_IMPL double QwtLogTransform::LogMin = 1.0e-150;
    4. //QT_STATIC_CONST_IMPL double QwtLogTransform::LogMax = 1.0e150;
    To copy to clipboard, switch view to plain text mode 

    Thanks for Qwt i'm enjoying it,
    Max

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

    Default Re: Moving TimeScaleDraw in real time

    This has been fixed in the 6.1 SVN branch some time ago. There will be a Qwt 6.1.2 as soon as I succeeded to build Qt 5.4.0 on my box - unfortunately building Qt 5.4.0 is far from being an easy one.

    Uwe

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

    Default Re: Moving TimeScaleDraw in real time

    O.k done: Qwt 6.1.2 is available see https://sourceforge.net/projects/qwt/files/qwt/6.1.2

    Uwe

Similar Threads

  1. real time image GUI with Qt
    By sanda199 in forum Newbie
    Replies: 0
    Last Post: 25th January 2013, 06:43
  2. Real Time Applications in Qt
    By shammy in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2012, 07:17
  3. Qwt real time plotting
    By santoshpradeep in forum Qwt
    Replies: 8
    Last Post: 28th June 2012, 09:53
  4. Qwt real time
    By oddytz1989 in forum Qwt
    Replies: 3
    Last Post: 10th February 2012, 04:41
  5. real time plotting
    By gyre in forum Qwt
    Replies: 4
    Last Post: 11th December 2007, 16: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.