Results 1 to 6 of 6

Thread: qwt_data.h and qwt_data.cpp

  1. #1
    Join Date
    Oct 2010
    Posts
    58
    Thanks
    26
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qwt_data.h and qwt_data.cpp

    Hi,

    I installed qwt-6.0.0-rc2.zip and have all the examples working with Visual Studio 2008, but I don't have qwt_data.h or qwt_data.cpp in my source files. does anyone know where I can get these files?
    Thanks


    Added after 17 minutes:


    What I am trying to do is load some double time and double price data into a 2d graph. I want to use setRawData but I don't have the qwt_data files.
    Is there another way to do this?

    here is some of my code:

    Qt Code:
    1. class newPlot : public QwtPlot{
    2. public:
    3. newPlot();
    4. ~newPlot(){}
    5. };
    6. newPlot::newPlot()
    7. {
    8. setTitle("Sunday Plot");
    9. insertLegend(new QwtLegend(), QwtPlot::RightLegend);
    10.  
    11. setAxisTitle(xBottom, "Time");
    12. setAxisScale(xBottom, 0.0, 100000.0);
    13.  
    14. setAxisTitle(yLeft, "Price");
    15. setAxisScale(yLeft, 0.0, 1.0);
    16.  
    17. QwtPlotCurve *myCurve = new QwtPlotCurve("price over time");
    18. myCurve->setPen(QPen(Qt::red));
    19. myCurve->attach(this);
    20.  
    21. ////some example data
    22. double *tm= new double [1000];
    23. double *pr= new double [1000];
    24. for (int i=0; i<1000; i++){
    25. tm[i] = i;
    26. vvvll[i] = i+1;
    27. }
    28.  
    29. myCurve->setRawData();
    30.  
    31. }
    32.  
    33. int main(int argc, char **argv)
    34. {
    35. QApplication a(argc, argv);
    36.  
    37. newPlot plot;
    38. plot.resize(1000,400);
    39. plot.show();
    40.  
    41. return a.exec();
    42. }
    To copy to clipboard, switch view to plain text mode 

    I don't know what to do to get some data into myCurve

    thanks.
    Last edited by kja; 25th October 2010 at 02:33.

  2. #2
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    694
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwt_data.h and qwt_data.cpp

    Hi,
    please give a look at this routine setCurveData(..)
    You can follow this simple tutorial http://www.digitalfanatics.org/proje...chapter11.html

    Regards
    Franco Amato

  3. #3
    Join Date
    Oct 2010
    Posts
    58
    Thanks
    26
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qwt_data.h and qwt_data.cpp

    Hi, thanks for your help.

    I tried to run that example but I get a bunch of errors, am I forgetting to include something?

    Qt Code:
    1. #include <qapplication.h>
    2. #include <qwt_plot.h>
    3.  
    4. class MyPlot : public QwtPlot
    5. {
    6. public:
    7. MyPlot( QWidget *parent=0, char *name=0 ) : QwtPlot( parent, name )
    8. {
    9. setTitle( "This is an Example" );
    10.  
    11. setAutoLegend( true );
    12. setLegendPos( Qwt::Bottom );
    13.  
    14. setAxisTitle( xBottom, "x" );
    15. setAxisTitle( yLeft, "y" );
    16.  
    17. long cSin = insertCurve( "y = sin(x)" );
    18. long cSign = insertCurve( "y = sign(sin(x))" );
    19.  
    20. const int points = 500;
    21. double x[ points ];
    22. double sn[ points ];
    23. double sg[ points ];
    24.  
    25. for( int i=0; i<points; i++ )
    26. {
    27. x[i] = (3.0*3.14/double(points))*double(i);
    28.  
    29. sn[i] = 2.0*sin( x[i] );
    30. sg[i] = (sn[i]>0)?1:((sn[i]<0)?-1:0);
    31. }
    32.  
    33. setCurveData( cSin, x, sn, points );
    34. setCurveData( cSign, x, sg, points );
    35.  
    36. setCurvePen( cSin, QPen( blue ) );
    37. setCurvePen( cSign, QPen( green, 3 ) );
    38.  
    39. replot();
    40. }
    41. };
    42.  
    43. int main( int argc, char **argv )
    44. {
    45. QApplication a( argc, argv );
    46.  
    47. MyPlot p;
    48. a.setMainWidget( &p );
    49. p.show();
    50.  
    51. return a.exec();
    52. }
    To copy to clipboard, switch view to plain text mode 


    these are the errors I get:

    Qt Code:
    1. 1>(16) : error C2664: 'QwtPlot::QwtPlot(const QwtText &,QWidget *)' : cannot convert parameter 1 from 'QWidget *' to 'const QwtText &'
    2. 1> Reason: cannot convert from 'QWidget *' to 'const QwtText'
    3. 1> No constructor could take the source type, or constructor overload resolution was ambiguous
    4. 1>(21) : error C3861: 'setAutoLegend': identifier not found
    5. 1>(22) : error C2653: 'Qwt' : is not a class or namespace name
    6. 1>(22) : error C2065: 'Bottom' : undeclared identifier
    7. 1>(22) : error C3861: 'setLegendPos': identifier not found
    8. 1>(29) : error C3861: 'insertCurve': identifier not found
    9. 1>(30) : error C3861: 'insertCurve': identifier not found
    10. 1>(47) : error C3861: 'setCurveData': identifier not found
    11. 1>(48) : error C3861: 'setCurveData': identifier not found
    12. 1>(51) : error C2065: 'blue' : undeclared identifier
    13. 1>(51) : error C3861: 'setCurvePen': identifier not found
    14. 1>(52) : error C2065: 'green' : undeclared identifier
    15. 1>(52) : error C3861: 'setCurvePen': identifier not found
    16. 1>(64) : error C2039: 'setMainWidget' : is not a member of 'QApplication'
    17. 1> (95) : see declaration of 'QApplication'
    To copy to clipboard, switch view to plain text mode 



    That setCurveData seems like just what I need..... hmmmmm

  4. #4
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    694
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qwt_data.h and qwt_data.cpp

    Which version are you using? I think that example is refered to an older version. In the past I did something very basic with the version 5*.
    Meanwhile I just downloaded the last version ( 6 ) and there is a 'example' folder with lots of examples.
    Giving a look at curvdemo1 you can see the call to the setRawSamples method that take the x vector, the y vector and the array size.
    To call setRawSamples you have to create a 'QwtPlotCurve' object.

    Regards
    Franco Amato

  5. #5
    Join Date
    Oct 2010
    Posts
    58
    Thanks
    26
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qwt_data.h and qwt_data.cpp

    Thanks a lot! that setRawSamples worked great for me!

    Thanks for the help

  6. #6
    Join Date
    Nov 2010
    Posts
    1
    Thanked 2 Times in 1 Post

    Default Re: qwt_data.h and qwt_data.cpp

    Quote Originally Posted by kja View Post
    I don't have qwt_data.h or qwt_data.cpp in my source files. does anyone know where I can get these files?
    These files were deleted in https://qwt.svn.sourceforge.net/svnroot/qwt/trunk/qwt, revision 56 ...
    QwtSeriesData<T> is the successor of QwtData.

    HTH

    --

    Semen A. Trygubenko | http://trygub.com

  7. The following 2 users say thank you to trygub for this useful post:

    fatecasino (16th January 2011), kja (3rd December 2010)

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.