Results 1 to 10 of 10

Thread: QwtPolar surface Plot performance zooming

  1. #1
    Join Date
    Jul 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QwtPolar surface Plot performance zooming

    Hi I have a program that I am working on that uses QwtPolarPlot to plot a QwtPolarSpectrogram and it is working great but when I zoom in with the scroll wheel after a short while the performance starts to bog down. Is there any performance tuning on the zoom that I could do to help this?

    Thanks for the hard work guys.

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

    Default Re: QwtPolar surface Plot performance zooming

    What about the polar spectrogram example - do you see any performance issue when zooming in there ?

    In general: with QPainter you have the effect, that it renders before it clips. For a spectrogram this is of no importance, but any type of vector graphics this might become an issue when zoom in in deep.
    Should be no issue with standard Qwt plot items as they do clipping before calling QPainter methods ( check f.e QwtPolarGrid::ClipGridLines ). So it might be worth to test your application without any other plot item beside the spectrogram.

    If you still see performance issues it could be a problem of your raster data implementation ( or do you use QwtMatrixRasterData ? ), but you would have to show some code then ?

    Uwe

  3. #3
    Join Date
    Jul 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QwtPolar surface Plot performance zooming

    Hi Uwe.

    The spectrogram demo works fine.
    In our implementation of the zoom starts to slow down significantly after four to five rolls of the mouse wheel.
    We are using QwtMatrixRasterData.
    Is the a setting in QwtPolar like QwtPlot for a max zoom stop?
    I tried the ClipGridLines option but it made no difference.
    We have very few other items on the plot besides the spectrogram and grid but I will check that and see if it makes a difference.

  4. #4
    Join Date
    Jul 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QwtPolar surface Plot performance zooming

    QwtPlotZoomer has setMaxStackDepth does QwtPolar have a similar function that can be used with the QwtPolarMagnifier to set a maximum zoom?

    I counted the number of clicks on the mouse for zooming and it was around 30 when the zooming started to bog down.

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

    Default Re: QwtPolar surface Plot performance zooming

    There has to be a reason why your plot slows down and it should be possible to find it out !

    a) What happens, when using SpectrogramData of the spectrogram example in your application - instead of your data class ?
    b) If you have a small demo showing the issue, I will have a look at it

    Uwe

  6. #6
    Join Date
    Jul 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QwtPolar surface Plot performance zooming

    Here is an example.
    Attached Files Attached Files

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

    Default Re: QwtPolar surface Plot performance zooming

    Reason for the performance issue can be found in QwtPolarSpectrogram::draw.

    Here the spectrogram calculates a clip region for the bounding circle of the data. When you zoom in deep the circle gets huge and calculating the region ( = approximation of the circle by a list of rects ) becomes very expensive.
    The difference between the spectrogram example and your demo is simply, that in the spectrogram example the range of the data is unlimited and therefore no clipping needs to be done.

    For your use case you could simply remove the "if ( radialInterval.isValid() ) ... " block, as QwtMatrixRasterData returns NaN for out of bound requests, what gets mapped to a transparent RGB value.
    Unfortunately this doesn't work for Indexed8 colors as there is no transparent color in the color table ( NaN is mapped to the first color ).

    For the moment I added a quick fix to filter out situations, where you don't need the clip, because the canvas is completely inside of the data circle. But when you zoom in deep at the border of the data circle ( cutting the canvas ) I need a better fix - hope QwtClipper will help me here too.

    Uwe

  8. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,258
    Thanked 862 Times in 811 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPolar surface Plot performance zooming

    Guess I found a better one using clip paths instead of clip regions, what avoids any issues with huge rectangle lists.

    Fixed in SVN,
    Uwe


    Added after 4 minutes:


    Quote Originally Posted by john_k View Post
    Here is an example.
    One comment about RasterData::setXInterval() in your demo: here you are excluding 2 * M_PI, but including 0.0.
    In certain zoom levels 2 * M_PI happens leading to a vertical line with missing RGB values. I would recommend to allow 2 * M_PI instead:

    Qt Code:
    1. setInterval( Qt::XAxis, QwtInterval( 0, 2 * M_PI ), QwtInterval::IncludeBorders );
    To copy to clipboard, switch view to plain text mode 
    Uwe
    Last edited by Uwe; 1st November 2014 at 15:29.

  9. #9
    Join Date
    Jul 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QwtPolar surface Plot performance zooming

    Thanks Uwe.

    Right now we are running qwtpolar-1.1.0 that we downloaded the source from from http://qwtpolar.sourceforge.net/ is there a way to get just the fix we are talking about here or do we have to take all the fixes that are in SVN? (never used SVN so not to sure of the procedure)

    Thanks again Uwe for your hard work.

  10. #10
    Join Date
    Jul 2014
    Posts
    16
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: QwtPolar surface Plot performance zooming

    Found the code at http://sourceforge.net/p/qwtpolar/code/181/ , compiled it and it works

Similar Threads

  1. Replies: 2
    Last Post: 19th December 2011, 00:34
  2. QwtPolar: Plot using a 2-dimensional array
    By hgstoehr in forum Newbie
    Replies: 0
    Last Post: 14th December 2011, 22:39
  3. Replies: 1
    Last Post: 9th February 2011, 08:30
  4. Replies: 13
    Last Post: 21st September 2010, 16:12
  5. Replies: 7
    Last Post: 22nd September 2008, 23:05

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.