Results 1 to 5 of 5

Thread: QwtPlotCurve plots quite slowly with 5K points

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,320
    Thanks
    316
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QwtPlotCurve plots quite slowly with 5K points

    Well, for one thing, if you read the documentation for QwtPlotCurve::setRawData(), the pointers to the x and y arrays must be valid for the entire life of the curve. In lines 47-48, you create new arrays, then pass them into the curve, then in 58-59, you delete them. Thus, QwtPlotCurve is trying to draw using pointers that have already been deleted. If you resize your plot or do anything to cause a replot after the first time it draws those points, the program will probably crash. You have been lucky so far because QwtPlot makes a cache of the plot, which is re-built only when something changes to require a replot.

    Second, you are passing your data in as QList of QStringList of QString, then parsing 5000 points from deep down inside this structure from strings into doubles. Why? If all you are interested in is the y values buried down inside this complex data structure, find a way to pass them in as a QVector of doubles instead of converting them into strings and burying them.

    The slowness isn't Qwt's fault at all, it is the way you have chosen to represent and access your data. You are making your PC do so much extra work, I am surprised your PC didn't burn up.
    Last edited by d_stranz; 7th April 2012 at 17:31.

Similar Threads

  1. Replies: 0
    Last Post: 3rd January 2012, 11:16
  2. QwtPlotCurve: maximum number of points ?
    By OverTheOCean in forum Qwt
    Replies: 2
    Last Post: 20th September 2010, 06:42
  3. QwtDial works slowly in QWS
    By simophin in forum Qwt
    Replies: 1
    Last Post: 19th July 2010, 07:00
  4. Application starting slowly.
    By aj2903 in forum Qt Programming
    Replies: 3
    Last Post: 30th December 2008, 11:19
  5. very slowly apps
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2008, 11: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
  •  
Qt is a trademark of The Qt Company.