Results 1 to 11 of 11

Thread: Qwt realtime plotting using QwtPlotDirectPainter

Hybrid View

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

    Default Re: Qwt realtime plotting using QwtPlotDirectPainter

    Quote Originally Posted by Spitfire View Post
    II may have missed your point.
    If you worry about performance you can subclass curve to cache itself when it's plotted.
    Then next time you replot the plot curve should check what have changed since last time, use the part of cache that's the same and draw only extra points ,then cache new pixmap again.
    Drawing a pixmap is usually too slow for "realtime" conditions. Using such a cache might make sense for very few situations ( stable scales and a fixed size of the plot canvas ).

    I would recommend to study the realtime example first as it is much simpler than the oscilloscope. It simply appends points to the end of the curve data and then uses QwtPlotDirectPointer to paint only these points on top of the existing plot. Guess you could use the code of the IncrementalPlot class like it is - beside some modifications, when you want to draw lines and not only symbols:

    Qt Code:
    1. void IncrementalPlot::appendPoint( const QPointF &point )
    2. {
    3. CurveData *data = static_cast<CurveData *>( d_curve->data() );
    4. data->append( point );
    5.  
    6. int from = qMin( data->size() - 2, 0 );
    7. d_directPainter->drawSeries( d_curve, from, data->size() - 1 );
    8. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

  2. #2
    Join Date
    Feb 2012
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt realtime plotting using QwtPlotDirectPainter

    I'll look into the Realtime example some more. I assume you meant QwtPlotDirectPainter. I was actually trying to do what you did in your code, in the code that I attached; however, I see that I'm trying to paint an object that does not yet exist when I run my code. Does this mean that I cannot use Qt Designer for the plot?

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

    Default Re: Qwt realtime plotting using QwtPlotDirectPainter

    Important is when the code is executed - this has nothing to do with the tool you are using to write your code.
    The designer is no compiler and won't execute any C++ code at all.

    Uwe

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

    Jean-Luc (12th February 2012)

  5. #4
    Join Date
    Feb 2012
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt realtime plotting using QwtPlotDirectPainter

    Thank you for your help. I have gotten it to work.

  6. #5
    Join Date
    Mar 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt realtime plotting using QwtPlotDirectPainter

    Hi,

    I am a newbie to Qt/Qwt; but find it very useful; I am having similar question as Jean-Luc; I have been studying Qwt examples: Oscilloscope, Refreshtest, and Curvedemo2.

    Oscilloscope does a 'replot" so the plot is restarted at the beginning of the plot window, Refreshtest does a "scroll" to the data; I would like to do a "erase bar" to the wave; so very similar to Oscilloscope but does NOT clear the plot window; I can stop the refresh by not doing "replot" after the interval; but I can't seem to create the "simple" erase bar; ie. deleting the previous plot(eg. 5 points in the future) and replacing them with the new points(as currently done in the examples); I am thinking of doing the "brute force method" of using similar brush as background color; but thought, there maybe a better solution or even a simpler solution.

    Appreciate any suggestion to do this.

    Thanks.

    Lee

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

    Default Re: Qwt realtime plotting using QwtPlotDirectPainter

    In earlier Qt releases ( Qt 3 ) it was possible to erase something by drawing in XOR mode, but this feature is lost since Qt 4.0. So the answer is simple, you can't erase something from a widget ( by Qt design ).

    Uwe

Similar Threads

  1. QWT Realtime Plot zoom
    By Gavin Harper in forum Qwt
    Replies: 2
    Last Post: 13th September 2010, 08:04
  2. Replies: 1
    Last Post: 18th June 2010, 15:34
  3. Replies: 1
    Last Post: 16th March 2010, 09:29
  4. RealTime Images
    By shiranraviv in forum Qt Programming
    Replies: 8
    Last Post: 31st December 2009, 00:41
  5. how can i display curve in realtime?
    By blm in forum Qt Programming
    Replies: 1
    Last Post: 11th September 2008, 20:03

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
  •  
Qt is a trademark of The Qt Company.