Results 1 to 20 of 20

Thread: Regarding plotting using .csv file in QWT

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi ,

    I am trying to create graph which is attachedtemplog_spec_qwt_post.jpg.
    (templog_spec_qwt_post.png)
    But as of now the status is like the one attached myapp.png.

    Please suggest how to get the scales like the one specified(templog_spec), also I want to plot graph dynamically
    where the data is coming for every 5 seconds, the data is Time and its corresponding temperature in a csv format.

    It may not be smooth sinusoidal curve as the templog_spec is showing.

    Thanks in advance.

    Aster

  2. #2
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi

    I am now using latest build of qwt-6.0.1 on Ubuntu 10.04, but when tried to install qwt am getting below error:


    qmake is /usr/local/Trolltech/Qt-4.7.0/bin/qmake
    root@ubuntu:/home/ravi/Desktop/qwt-6.0.1# qmake qwt.pro
    root@ubuntu:/home/ravi/Desktop/qwt-6.0.1# make
    cd src/ && make -f Makefile
    make[1]: Entering directory `/home/ravi/Desktop/qwt-6.0.1/src'
    g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I/usr/include/qt3 -Imoc/ -o obj/qwt_abstract_scale_draw.o qwt_abstract_scale_draw.cpp
    In file included from qwt_scale_div.h:14,
    from qwt_abstract_scale_draw.h:14,
    from qwt_abstract_scale_draw.cpp:10:
    qwt_interval.h:15: fatal error: qdebug.h: No such file or directory
    compilation terminated.
    make[1]: *** [obj/qwt_abstract_scale_draw.o] Error 1
    make[1]: Leaving directory `/home/ravi/Desktop/qwt-6.0.1/src'
    make: *** [sub-src-make_default-ordered] Error 2

    I think its a well known problem , I did not get any where work around for this. Please help on this.

    Thanks in advance.

    Aster.

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

    Default Re: Regarding plotting using .csv file in QWT

    Quote Originally Posted by Aster036 View Post
    ...-I/usr/share/qt3/mkspecs/default -I. -I/usr/include/qt3 ...
    Obviously you are trying to build Qwt 6.x with Qt3.

    Uwe

  4. #4
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi Uwe,

    Can you please reply on my post which has two images attached.

    Thanks in advance.

  5. #5
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi ,

    I tried to download qt csv file from below site:

    http://qcsv.svn.sourceforge.net/

    but when unzipped the file contains nothing, if you have csv file reader in Qt app download link please share.

    Thanks and Regards

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: Regarding plotting using .csv file in QWT

    -- I am able to see the read csv values in the command prompt when I print them on the screen using qDebug() macro.
    You said this in an earlier post. If you are already able to read your data from the CSV file, then why are you wasting time downloading something from SourceForge? An if you go to the SF page you linked to , you will see that it clearly says:

    Files shown: 0
    so why are you surprised when your tarball is empty?

    Posting two images (one of which is clearly something made using a graphics editing program, not with Qwt) and asking "What am I doing wrong?" - How are we supposed to know? You have not shown us ANY SOURCE CODE AT ALL. How are we supposed to guess what you are doing wrong when you have told us absolutely nothing about what you are doing?

  7. #7
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi ,


    Please find the attached files of my application.

    Right now I am plotting the graph for 30 hard coded values , but they should be read from the csv files which are added as resources.

    Thanks in advance.
    Attached Files Attached Files

  8. #8
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi

    Does anybody has qwt example code which does dynamic plotting ? Please share the same.

    Thanks in advance.

  9. #9
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: Regarding plotting using .csv file in QWT

    I have looked at your code. It is clear to me from the fact that there are more lines of commented out code than there are non-commented lines that you really don't have any idea how to do what you want. I think you are totally confusing things and making it more difficult than it is. From what I understand, you want to do two things:

    1 - Read time and temperature strings from a CSV file and convert them to numbers
    2 - Create a Qwt plot that displays the temperature vs . time values as a curve

    First, you have to understand that reading the data and plotting the data are completely unrelated activities. So don't mix them all up in the same method (or even the same C++ class). Make a C++ class whose job is to read the data file and return the x and y arrays of doubles. It basically needs three methods and a couple of arrays:

    Qt Code:
    1. class CSVReader
    2. {
    3. public:
    4. CSVReader() {}
    5.  
    6. // opens the CSV file, reads the data into time and temperature arrays, returns true if OK, false otherwise
    7. bool readDataFromFile( const QString & fileName );
    8.  
    9. const QVector<double> & temperature() const { return mTemperature; }
    10. const QVector<double> & time() const { return mTime; }
    11.  
    12. private:
    13. QVector<double> mTemperature;
    14. QVector<double> mTime;
    15. };
    To copy to clipboard, switch view to plain text mode 

    Next, use this class to read the data, then pass the data to your curve:

    Qt Code:
    1. CSVReader dataSource;
    2.  
    3. if ( dataSource.readDataFromFile( "myfile.csv" ) )
    4. {
    5. const QVector<double> & temps = dataSource.temperature();
    6. const QVector<double> & times = dataSource.time();
    7. curve->setSamples( times.data(), temps.data(), times.size() ); // makes a copy of the data
    8. }
    To copy to clipboard, switch view to plain text mode 

    That's about as simple as it gets. Please notice, any two QVector<double> instances could be used to build the curve. The fact that the vectors were created by reading a CSV file is completely irrelevant as far as the plot is concerned. A tiny spaceship could land on your PC and a little green man could step out and hand you two vectors, and they would work the same way as far as the plot is concerned.

  10. #10
    Join Date
    Apr 2010
    Location
    Bangalore
    Posts
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Regarding plotting using .csv file in QWT

    Hi Stranz,

    Thanks a ton for your useful post.

    I was bit stranded as to what to do and what am I doing wrong?

    I shall get back to you if I get some more new problems.

    Thank you.
    Aster

Similar Threads

  1. Plotting in 3D
    By FelixB in forum Qwt
    Replies: 1
    Last Post: 1st October 2010, 16:26
  2. Using QGLWidget for plotting
    By llemes4011 in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2010, 14:40
  3. Replies: 0
    Last Post: 4th August 2009, 15:24
  4. Plotting graph of 1/x
    By Persoontje in forum Qwt
    Replies: 1
    Last Post: 20th March 2009, 14:26
  5. Plotting from Left to Right ??
    By dheeraj in forum Qwt
    Replies: 3
    Last Post: 3rd June 2008, 07:09

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.