Results 1 to 3 of 3

Thread: Using QwtSeriesData as data bridge for large datasets

  1. #1
    Join Date
    Feb 2017
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Using QwtSeriesData as data bridge for large datasets

    Hi, I'm new to qt/qwt and am having some performance issues with large datasets. (linux OS, qt 5.7, qwt-6.1.3)
    I've been looking at a few post about using QwtSeriesData as a data bridge for large datasets, thus having no need to copy the data into a QVector.
    http://www.qtcentre.org/threads/2843...ng-application
    http://www.qtcentre.org/threads/6729...-data?p=295423

    My dataset consists of a large array of doubles and a static increment value, e.g.
    Qt Code:
    1. int numPoints = 10000000
    2. double data[numPoints]
    3. double delta = .054;
    4. QVector<QPointF> points
    To copy to clipboard, switch view to plain text mode 

    As of now I copy the data with an associated x value into a QVector<QPointF>
    Qt Code:
    1. for (i=0; i<numPoints; i++)
    2. {
    3. time = (i)*delta;
    4. points.append(QPointF(time, data[i]))
    5. }
    To copy to clipboard, switch view to plain text mode 

    but unfortunately with my limited experience I'm unsure how to best reuse the linked examples for my application. Any basic examples to get me started would be much appreciated.

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

    Default Re: Using QwtSeriesData as data bridge for large datasets

    Qt Code:
    1. class YourData: public QwtSeriesData<QPointF>
    2. {
    3. ....
    4. virtual size_t size() const
    5. {
    6. return 1000000;
    7. }
    8.  
    9. virtual QPointF sample( size_t i ) const
    10. {
    11. return QPointF( i * delta, m_values[i] );
    12. }
    13.  
    14. // optional
    15. virtual QRectF boundingRect() const
    16. {
    17. return QRect( 0.0, yMin, size() * delta, ymax - yMin );
    18. }
    19.  
    20. private:
    21. double *m_values;
    22. };
    To copy to clipboard, switch view to plain text mode 

    When workin with huge datasets you might want to have a look at the QwtPlotCurve::FilterPointsAggressive from svn trunk.

    Uwe

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

    jeffL1349 (31st March 2017)

  4. #3
    Join Date
    Feb 2017
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QwtSeriesData as data bridge for large datasets

    Exactly what I needed. Thanks for the code snippet and the example recommendation Uwe

Similar Threads

  1. QTableView and Large data sets
    By KenJustKen in forum Qt Programming
    Replies: 3
    Last Post: 25th January 2016, 10:16
  2. Replies: 3
    Last Post: 28th April 2014, 18:21
  3. Need help with QTableView/QTableWidget and large data
    By aguayro in forum Qt Programming
    Replies: 2
    Last Post: 29th June 2012, 13:09
  4. how to manipulate a very large data using QT?
    By aurora in forum Qt Programming
    Replies: 10
    Last Post: 25th May 2012, 18:37
  5. QWT and large amounts of data
    By ko9 in forum Qwt
    Replies: 1
    Last Post: 17th October 2007, 06:28

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.