Results 1 to 6 of 6

Thread: How to plot a huuuuge number of data points?

  1. #1
    Join Date
    Jun 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Wink How to plot a huuuuge number of data points?

    My project loads a data file of anywhere between 100 and 100,000 data points, and then plots them on a graph.

    Currently I'm trying to figure out what's the most efficient way to do this? Plotting 100,000 data points on a graph would take a long long time (I think).

    Currently, I create two const double arrays and curve->setSamples(x, y, n), but I don't know how well this works for large arrays. Is there some function or method by which I can plot a fraction of the data points (say one in ten?), and then still be able to see all the data points when I zoom in?

    Thanks for any help

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to plot a huuuuge number of data points?

    you can set a CurveFitter to reduce the number of points. I don't know how to use it exactly because I never needed them, but I'm sure reading the documentation will help you

  3. #3
    Join Date
    Jun 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to plot a huuuuge number of data points?

    Thanks! I found the QwtCurveFitter class, and am currently trying to use QwtWeedingCurveFitter.

    I'm kinda new to Qt, and I can't quite get how to construct QPolygonF to hold my data. Could someone show me an example of how to construct one?

    I have two arrays full of double's atm.

    Thanks!!

  4. #4
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to plot a huuuuge number of data points?

    as far as I understand CurveFitter, you don't have to do anything by yourself. just pass the fitter to your curve and activate attribut "fitted". that should be all...

  5. #5
    Join Date
    Jun 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to plot a huuuuge number of data points?

    Thanks for the help!! Finally got it to work with a few sample points!! Now I'll give it a go with my actual data.


    In case anyone's interested in how to use the QwtWeedingCurveFitter:

    Qt Code:
    1. QwtWeedingCurveFitter *velocityCurve = new QwtWeedingCurveFitter();
    2. velocityCurve->setTolerance(1.0);
    3.  
    4. //QwtSplineCurveFitter *velocityCurve = new QwtSplineCurveFitter ();
    5.  
    6. QwtPlotCurve *curve = new QwtPlotCurve();
    7. curve->setStyle(QwtPlotCurve::Lines);
    8. curve->setCurveFitter(velocityCurve);
    9. curve->setCurveAttribute(QwtPlotCurve::Fitted, true);
    10. const double x[] = {0, 1, 2, 4, 5, 8, 10, 13, 14, 19};
    11. const double y[] = {17, 16.5, 8, 3, 5, 7.5, 9, 10, 12, 14};
    12. curve->setSamples(x, y, 10);
    13. curve->attach(leftGraph);
    14.  
    15. leftGraph->replot();
    To copy to clipboard, switch view to plain text mode 


    Edit: I shoulda prolly say that I 'think' it's working. Obviously, without a large number of datapoints to test it on, I can't relaly tell.
    Last edited by CotWoAU; 17th June 2011 at 16:42. Reason: small correction

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

    Default Re: How to plot a huuuuge number of data points?

    Using QwtWeedingCurveFitter this way doesn't make much sense as the algorithm for reducing the points takes much longer than painting all points.

    Instead I recommend to check the refreshtest example first to see, what type of performance you can expect for 100000 points on your system. If this is not fast enough the common way to improve performance is to implement different levels of detail depending on the scale ranges. Here QwtWeedingCurveFitter is of use for creating different data sets.

    Check the archive of this forum,

    Uwe

Similar Threads

  1. QwtPlotCurve: maximum number of points ?
    By OverTheOCean in forum Qwt
    Replies: 2
    Last Post: 20th September 2010, 06:42
  2. Editing points on QWt Plot
    By manmohan in forum Qwt
    Replies: 6
    Last Post: 14th May 2010, 07:43
  3. move/drag points on qwt plot
    By rambo83 in forum Qwt
    Replies: 5
    Last Post: 23rd November 2009, 08:36
  4. Labeling scatter plot points
    By hamid ghous in forum Qwt
    Replies: 1
    Last Post: 29th October 2009, 06:35
  5. Replies: 1
    Last Post: 2nd October 2008, 07:29

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.