Results 1 to 5 of 5

Thread: zooming/panning Curve with 2 millions points or more

  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default zooming/panning Curve with 2 millions points or more

    Hi,

    I using a curve to display up to 2M points or maybe more,

    I using Nocurve and using qwtsumbol to represent each point.

    myCurve->setStyle(QwtPlotCurve::NoCurve);
    myCurve->setSymbol(P_Symbol);

    the points are drawn fine and time is good, the problem is when i try to zoom in/out or pan the curve around its really slow,

    I using QwtPlotPanner and QwtPlotMagnifier for panning and zooming.

    how can i make zooming and panning faster ??

    thanks.

  2. #2
    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: zooming/panning Curve with 2 millions points or more

    The time for drawing the points isn't fine and your question is: how to speed up the replot operation of a scatter plot ?


    • try Qwt from SVN. and play with QwtPlotCurve::FilterPoints - and maybe QwtPlotCurve::ImageBuffer - flags that have an effect for scatter plots.
    • depending on the symbol and the paint engine ( with raster always ) the symbol should be cached. In the version from SVN the best cache strategy is auto detected ( QwtSymbol::CachePolicy ) with Qwt 6.0 you have to enable QwtPlotCurve::CacheSymbols.


    When you are on X11 - and you have a simple symbol ( f.e XCross ) - it might be faster without a cache. In this special situation you need to disable the slow raster paint engine ( default since Qt 4.8 ) and of course disable antialiasing and use a pen width of 0 ( no 1 ! ).

    But in the end it is about the question to find strategies how to reduce the number of points - or to implement a navigation, where a delay doesn't hurt. F.e QwtPlotMaginifier starts to become unusable for delays of 500ms, while QwtPlotZoomer remains usable for larger delays.
    QwtPlotPanner can't be slow ( here I don't believe you ) beside the final replot.

    Uwe

  3. #3
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: zooming/panning Curve with 2 millions points or more

    thanks for the hints,

    I do use the SVN version, but that was since a while which is about 4 months.

    In the version from SVN the best cache strategy is auto detected ( QwtSymbol::CachePolicy )
    the best cache strategty is : qwtSymbol->setCachePolicy(QwtSymbol::AutoCache) ???

    with Qwt 6.0 you have to enable QwtPlotCurve::CacheSymbols
    SVN is a QWT6.0 or not ??so should i use it with SVN version or not ??




    When i said the time to draw the points is fine, i didnt mean that there is not delay, but the user can wait lil bit as drawing 2M points cannot be in no time.
    but when they are painted, the delay can be annoying, when zooming or panning.


    QwtPlotMaginifier starts to become unusable for delays of 500ms, while QwtPlotZoomer remains usable for larger delays
    sorry, but do u mean QwtPlotZoomer would be better then QwtPlotMaginifier, or what make the Maginifier unusable for large delays, while Zoomer is ?

    QwtPlotPanner can't be slow ( here I don't believe you ) beside the final replot.
    you may mean when im pressing the and moving. but the delay i mean when i release the mouse button(thefinal replot). as u know when i user pan a graph,he would not just hold the mouse button and move one time, but he will do that few times to until it is where he wants it to be. so the delay will happen each time he release the mouse button.




    The symbol i use is an Ellipse, with size of 1 and the user can change the size, as the user needs to interact with the points and get info from them.

  4. #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: zooming/panning Curve with 2 millions points or more

    SVN is a QWT6.0 or not ??so should i use it with SVN version or not ??.
    When talking about the version from SVN I meant the version from SVN trunk. This will be a 6.1.

    sorry, but do u mean QwtPlotZoomer would be better then QwtPlotMaginifier, or what make the Maginifier unusable for large delays, while Zoomer is ?
    The problem of the magnifier is that it triggers replots according to wheel events without waiting for the previous replot to be finished. With slow replots you accumulate a queue of pending replots soon. Of course replots of the zoomer are not faster, but here you won't start a new zoom operation before the result of the previous one is visible.

    The symbol i use is an Ellipse, with size of 1 and the user can change the size, as the user needs to interact with the points and get info from them.
    An ellipse of size 1 is the same as using QwtPlotCurve::Dots what should be faster.

    When using Dots you should try the QwtPlotCurve::ImageBuffer flag. This is a very special optimization, where points are directly mapped to a rgbbuffer in memory and only the resulting image is painted. In this combination the image composition is done in Qwt code only without any QPainter overhead ( see QwtPointMapper::toImage ). For a scatter plot with many points this should be by far the best what you can get.

    I have tested the combination Dots/ImageBuffer in a modified version of the realtime example and found it being buggy. After fixing it ( so you need to update your Qwt version from SVN trunk. ) the performance is o.k for 2 million points - only a small delay is left on my slow atom box. In fact there is even more potential for optimizations as the image composition could be distributed to several threads ( like it is available for raster plot items) what would speed up by a factor according to the number of CPU cores.

    Using an ellipse with a larger size than 1 doesn't make much sense in a situation, where you see all 2 million points. So this should be something that happens in zoomed in situations where QwtPlotCurve::FilterPoints should be very successful.

    Uwe

  5. #5
    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: zooming/panning Curve with 2 millions points or more

    Quote Originally Posted by Uwe View Post
    In fact there is even more potential for optimizations as the image composition could be distributed to several threads ( like it is available for raster plot items) what would speed up by a factor according to the number of CPU cores.
    I have added the option for simple dots to SVN trunk. At the moment it is available for 1 pixel dots only, but sooner or later I will add an implementation for larger pens too.

    If you want to test it you have to do the following:

    Qt Code:
    1. curve->setRenderThreadCount( 0 ); // 0: use QThread::idealThreadCount()
    2. curve->setSymbol( NULL );
    3. curve->setStyle( QwtPlotCurve::Dots );
    To copy to clipboard, switch view to plain text mode 
    I checked the ( new ) scatterplot example with 1 million points on a dual core system ( Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz ). For 1 thread the image composition takes ~40ms, for 2 threads it is about ~22ms. On my Atom board ( Intel(R) Atom(TM) CPU 330 @ 1.60GHz ) with Qwt compiled in debug mode it is 280ms and 150 ms.

    Using the magnifier on X11 feels o.k. but not perfect on the Atom board for fullscreen plots - probably because of the QImage -> QPixmap transformation. With using the raster paint engine on X11 ( default since Qt 4.8 ) this step is of course not necessary. So this is one of the situations, where the raster paint engine is faster than the X11 paint engine. Of course the situation is very different for remote X11.

    Uwe

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

    jesse_mark (20th December 2012)

Similar Threads

  1. Replies: 7
    Last Post: 23rd November 2011, 20:13
  2. Replies: 6
    Last Post: 4th November 2011, 06:51
  3. smooth panning and zooming an image, to use OpenGL or not?
    By scarleton in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2010, 22:25
  4. Graphics View Panning ,zooming
    By linuxdev in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2008, 07:17
  5. Get the points of a fitted curve
    By giusepped in forum Qwt
    Replies: 4
    Last Post: 25th December 2008, 07:42

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.