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. #1
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QwtPlotCurve plots quite slowly with 5K points

    Hi, I am using Qwt5 and Qt4.2.3 to plot curve with 5K points and it may take 20 seconds to plot every time.
    I looked up some similar threads in the forum but still have no idea.
    My code referred to Qwt Example realtime_plot:
    Qt Code:
    1. class CustomData
    2. {
    3. public:
    4. CustomData();
    5. void append(double *x, double *y, int count);
    6.  
    7. int count() const;
    8. int size() const;
    9. const double *x() const;
    10. const double *y() const;
    11. private:
    12. int d_count;
    13. QwtArray<double> d_x;
    14. QwtArray<double> d_y;
    15. };
    16.  
    17. //class CustomQwtPlot:public QwtPlot
    18. void CustomQwtPlot::appendDataShow(double *x, double *y, int size, const QPen &curvePen)
    19. {
    20. ......
    21.  
    22. if ( d_data == NULL )
    23. d_data = new CustomData;
    24. if(cur == NULL)
    25. {
    26. cur = new QwtPlotCurve("curve");
    27. cur->setPaintAttribute(QwtPlotCurve::PaintFiltered);
    28. cur->setRenderHint(QwtPlotItem::RenderAntialiased);
    29. d_data->append(x, y, size);
    30. cur->setRawData(d_data->x(), d_data->y(), d_data->count());
    31. cur->setPen(curvePen);
    32. cur->attach(this);
    33. }
    34.  
    35. ......
    36. }
    37.  
    38. //CustomQwtPlot *energyplot;
    39. void plot::updateEnergyplot(QList<QStringList> data, QStringList header)
    40. {
    41. ......
    42.  
    43. if (energyplot == NULL)
    44. {
    45. ......
    46. energyplot = new CustomQwtPlot;
    47. double *xData = new double[count];
    48. double *yData = new double[count];
    49.  
    50. for (int i = 0; i < count; i++)
    51. {
    52. xData[i] = (double)i;
    53. yData[i] = data.at(0).at(i).toDouble(&ok);
    54. }
    55. energyplot->appendDataShow(xData, yData, count, c);
    56. ......
    57.  
    58. delete []xData;
    59. delete []yData;
    60.  
    61. ......
    62. }
    63. }
    To copy to clipboard, switch view to plain text mode 

    Hope someone can help me.
    Thanks.
    Regards,
    sexgirl
    Last edited by wysota; 5th April 2012 at 12:25. Reason: missing [code] tags

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.