Results 1 to 3 of 3

Thread: Smartest way of efficiently replot with Qwt

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Smartest way of efficiently replot with Qwt

    Hello!

    As some older posts show, I'm trying to plot some graphs in a embedded linux environment which requires very efficient plotting using Qwt. For now I'm looking how to do this considering Qwt alone, and with this respect I noticed that use replot() constantly wasn't a good idea, so I decided to move towards a way of higher plot efficiency and I came about using QwtPlotDirectPainter.

    Here comes my first question: is there another way of improve plotting efficiency than by using QwtPlotDirectPainter instead of QwtPlot::replot()? Is there somewhere, btw, a manual with all tips and tricks of Qwt including those related to plot efficiency?

    Now considering this method (using QwtPlotDirectPainter). As the manual states, it draws only the desired, new data (if so configured) without erasing the background. Now this is a little bit inconvenient, for I'll need to repaint only the part of a curve that has new data, but obviously erasing the paintings related to a older value. If one wants to use a invariable points vector for drawing (so when the new data reaches the last point in the vector, it starts populating from 0 again), I wouldn't know how to use QwtPlotDirectPainter for this, leading either to call QwtPlot::replot() each time the points vector is completely changed (such as in the code posted here¹) or having to abandon a fixed sized QVector in favor of a continuously growing QwtPlot.

    Second question: is there a way to come around this problem with QwtPlotDirectPainter?



    Thanks,

    Momergil



    ¹: http://www.qtcentre.org/threads/5902...ectly?p=262506
    May the Lord be with you. Always.

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

    Default Re: Smartest way of efficiently replot with Qwt

    First of all I would always decouple the sample rate from the refresh rate of the plot. F.e by using a timer that updates the plot in fixed intervals ( of course only when new samples have arrived ). Then you can avoid that the plot updates kill your system by reducing the refresh rate.

    Next you have to accept, that the only way to erase parts of the plot is by repainting it - this is a general limitation since Qt 4 ( Qt3 was the last version offering painting in XOR mode ). So you can try to avoid, hat you have to repaint something ( like it is done in the oscilloscope example ) or you can try to speed up repainting of the area to be erased. What exactly can be done heavily depends on the individual characteristics of a plot, but the second option usually means to have a stable part that can be cached in a pixmap.

    Uwe

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

    Momergil (7th May 2014)

  4. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Smartest way of efficiently replot with Qwt

    Hello Uwe and thanks for the reply.

    Quote Originally Posted by Uwe View Post
    First of all I would always decouple the sample rate from the refresh rate of the plot. F.e by using a timer that updates the plot in fixed intervals ( of course only when new samples have arrived ). Then you can avoid that the plot updates kill your system by reducing the refresh rate.
    No problem; already done.

    Quote Originally Posted by Uwe View Post
    you can try to speed up repainting of the area to be erased. What exactly can be done heavily depends on the individual characteristics of a plot, but the second option usually means to have a stable part that can be cached in a pixmap.
    Uwe
    I'm not familiar with this solution. Is there any example of this in Qwt's examples or somewhere you know?

    Finally, a new question: QwtPlot::replot() performs a repaint of all the area. Isn't there a way to re-implement replot (or create another method) that does the same, but for a limited, defined area? If that can be done, than I probably will use this tactic.


    Thanks,

    Momergil
    Last edited by Momergil; 7th May 2014 at 13:18.
    May the Lord be with you. Always.

Similar Threads

  1. How to manage windows efficiently?
    By aprado in forum Newbie
    Replies: 1
    Last Post: 12th April 2013, 19:43
  2. How to add alternative shortcuts in smartest way?
    By jmj in forum Qt Programming
    Replies: 1
    Last Post: 29th August 2010, 09:36
  3. Creating thumbnails efficiently
    By Luc4 in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2010, 14:05
  4. Efficiently plotting curves
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2009, 13:24
  5. Checking progress efficiently | C++
    By Backslash in forum General Programming
    Replies: 3
    Last Post: 23rd February 2008, 21:58

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.