Results 1 to 4 of 4

Thread: Improving performance with QwtPlotCurve::Lines

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Improving performance with QwtPlotCurve::Lines

    In my current project I am needing to plot out time series data for 25-50 msec sampled at 62.5 Mhz. qwt handles it wonderfully when the samples are spaced further apart (as in not just baseline noise), however there are times when I do get baseline noise. When this happens the plotting interface really begins to struggle. I tracked down the issue to setStyle(QwtPlotCurve::Lines). By using setStyle(QwtPlotCurve:ots) instead, the performance drastically improved. Any tips on improving performance using Lines? Data reduction will need to be implemented at some point, but for now I need the raw samples.

    Qt Code:
    1. directPainter_m = new QwtPlotDirectPainter();
    2.  
    3.  
    4. setAutoReplot( false );
    5. setCanvas( new Canvas() );
    6. zoom_m = new QwtPlotZoomer(canvas());
    7.  
    8. plotLayout()->setAlignCanvasToScales( true );
    9.  
    10. QwtPlotGrid *grid = new QwtPlotGrid();
    11. grid->setPen(QPen(Qt::gray, 1, Qt::DotLine));
    12. grid->setXAxis(0);
    13. grid->setYAxis(0);
    14. grid->enableX(true);
    15. grid->enableXMin(false);
    16. grid->enableY(true);
    17. grid->enableYMin(false);
    18. grid->attach(this);
    19.  
    20. plotOrigin_m = new QwtPlotMarker();
    21. plotOrigin_m->setLineStyle( QwtPlotMarker::HLine );
    22. plotOrigin_m->setValue(0.0,0.0);
    23. plotOrigin_m->setLinePen( Qt::gray, 0.0, Qt::DashLine );
    24. plotOrigin_m->attach( this );
    25.  
    26. plotCurve_m = new QwtPlotCurve();
    27. //plotCurve_m->setRenderThreadCount(0);
    28. plotCurve_m->setSymbol(NULL);
    29. plotCurve_m->setStyle( QwtPlotCurve::Dots );
    30. plotCurve_m->setPen( canvas()->palette().color( QPalette::WindowText ) );
    31. plotCurve_m->setRenderHint( QwtPlotItem::RenderAntialiased, false );
    32. plotCurve_m->setPaintAttribute( QwtPlotCurve::ClipPolygons, true );
    33. plotCurve_m->setPaintAttribute( QwtPlotCurve::FilterPoints , false );
    34. plotCurve_m->setPaintAttribute( QwtPlotCurve::MinimizeMemory , false );
    35.  
    36.  
    37. setAxisTitle( QwtPlot::xBottom, xLabel_m);
    38. setAxisTitle( QwtPlot::yLeft, yLabel_m);
    39.  
    40. connect(zoom_m, SIGNAL(selected(QRectF)), this, SIGNAL(selectedrect(QRectF)));
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Improving performance with QwtPlotCurve::Lines

    1. What refresh rate do you need ( sample rate != refresh rate !! )
    2. How many points do you have and how many of them are visible
    3. Is it possible to paint incrementally ( no shifting of the axes )
    4. What OS and which Qt version



    Uwe

  3. #3
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Improving performance with QwtPlotCurve::Lines

    Quote Originally Posted by Uwe View Post
    1. What refresh rate do you need ( sample rate != refresh rate !! )
    2. How many points do you have and how many of them are visible
    3. Is it possible to paint incrementally ( no shifting of the axes )
    4. What OS and which Qt version

    Uwe
    What refresh rate do you need
    Not important. Once the data has been received by the system and plotted, it remains static until the next test is performed.

    How many points do you have and how many of them are visible
    For normal testing, I will be need 25-30 msec of data. This would mean that I have about 2 million points at any given time. Upon zooming in I will be looking at portions of the plot < 1 msec so less than 62500 point.

    Is it possible to paint incrementally ( no shifting of the axes )
    I am not exactly sure of what this means, but like I said before, once that data is received and plotted, the only requirement from the plot is zooming based on mouse dragging.

    What OS and which Qt version
    The current build is using Qt 5.4.1 and qwt 6.1.2 on windows 7 with planned deployment on windows 7.

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

    Default Re: Improving performance with QwtPlotCurve::Lines

    Well you have 2 approaches:


    • minimize the costs of rendering lines
    • reduce what needs to be painted


    By minimizing the costs I mean stuff like using a pen width of 1, no antialiasing, trying to use a hardware accelerated backend etc.

    But when talking about 2 million lines, you will have to do some reduction. One candidate is Douglas Peucker offered by QwtWeedingCurveFitter ( expensive algo, so don't use it as curve fitter - instead pass the reduced point set ).
    If you don't mind to use Qwt from svn you could try QwtPlotCurve::FilterPointsAggressive. This algo is pretty fast and should have a significant effect in your case.

    Uwe

Similar Threads

  1. Improving the Qt documentation
    By jeromeNoBLABLA in forum General Discussion
    Replies: 11
    Last Post: 27th January 2017, 18:09
  2. QwtPlotCurve color for connecting lines
    By orignihn in forum Qwt
    Replies: 1
    Last Post: 28th April 2011, 07:08
  3. Replies: 2
    Last Post: 6th July 2010, 14:21
  4. Replies: 2
    Last Post: 7th July 2009, 07:44
  5. Improving GV performance
    By Gopala Krishna in forum Qt Programming
    Replies: 7
    Last Post: 3rd June 2007, 07:59

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.