Results 1 to 2 of 2

Thread: what is the Fix to the bug in plooting simple graph using qwt int qt?

  1. #1
    Join Date
    Oct 2010
    Posts
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default what is the Fix to the bug in plooting simple graph using qwt int qt?

    HI i am not able to fix the error .
    It gives Errror during compiling as

    qwt.jpg

    This is the code i wrote
    --------------------------------------------------------------------------------

    Qt Code:
    1. #include<qwt.h>
    2. #include<math.h>
    3. #include <qwt_plot.h>
    4. #include <qwt_plot_curve.h>
    5. #include<QApplication>
    6. int main(int argc, char **argv )
    7. {
    8.  
    9.  
    10. QwtPlot *myPlot = new QwtPlot();
    11.  
    12. // add curves
    13. QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
    14. QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2");
    15.  
    16. // copy the data into the curves
    17. const int points = 500;
    18. double x[ points ];
    19. double sn[ points ];
    20. double sg[ points ];
    21.  
    22. for( int i=0; i<points; i++ )
    23. {
    24. x[i] = (3.0*3.14/double(points))*double(i);
    25.  
    26. sn[i] = 2.0*sin( x[i] );
    27. sg[i] = (sn[i]>0)?1:((sn[i]<0)?-1:0);
    28. }
    29. curve1->setData(x, sn, points );
    30. curve2->setData( x, sg, points);
    31.  
    32. curve1->attach(myPlot);
    33. curve2->attach(myPlot);
    34.  
    35. // finally, refresh the plot
    36. myPlot->replot();
    37. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 3rd December 2010 at 09:45. Reason: missing [code] tags

  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: what is the Fix to the bug in plooting simple graph using qwt int qt?

    Don't try to compile code that was written for Qwt 5.x against Qwt 6.x.

    Uwe

Similar Threads

  1. Whats the right approach for drawing a simple graph?
    By Menia in forum Qt Programming
    Replies: 1
    Last Post: 2nd September 2010, 15:34
  2. Plot a graph without Qwt
    By abghosh in forum Qwt
    Replies: 2
    Last Post: 17th August 2010, 10:33
  3. graph
    By sonu111 in forum Qwt
    Replies: 1
    Last Post: 15th December 2008, 22:14
  4. Scatter graph
    By elcuco in forum Qwt
    Replies: 5
    Last Post: 27th December 2007, 11:48
  5. regarding graph plotting in qt
    By sar_van81 in forum Qt for Embedded and Mobile
    Replies: 11
    Last Post: 30th April 2007, 08:51

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.