Results 1 to 4 of 4

Thread: QT 4.5 and Plotting data

  1. #1
    Join Date
    Sep 2012
    Posts
    2
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QT 4.5 and Plotting data

    Hello,

    I am newbie using QT, I need to made some plots and histogram. Searching in the web I see QWT and QCustomPlot. I would not use QWT because you need to add a new library into device, and QCustomPlot it isn't for QT 4.5.

    is there another libraty like QCustomPlot?

    Thank you

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

    Default Re: QT 4.5 and Plotting data

    You are asking for a library, but don't want to use Qwt because it is a library ?

    Uwe

  3. #3
    Join Date
    Sep 2012
    Posts
    2
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QT 4.5 and Plotting data

    More or less yes. I want something like QCustomPlot, but QT 4.5 compatible code.

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

    Default Re: QT 4.5 and Plotting data

    You can always copy the code of an open source library into your source tree ( taking care of the license !) instead of using it as library - there is nothing special about QCustomPlot beside that it propagates this way. So this is no criteria for a package ( the other way it is: when you need a library and there is none ).

    I'm afraid you won't find something else than Qwt for Qt 4.5, but you can easily strip it down to a smaller size ( and copy the files to your project even if IMHO this doesn't makes much sense ). In qwt/src/src.pro you can see the list of files that are needed for the plot classes only - when building the library you can configure to build them only in qwtconfig.pri ). Additionally you can remove more files for the plot items you don't need ( f.e for curves only ).

    As author of the Qwt package I don't want to compare packages, but I don't agree that things are much easier than this code:

    Qt Code:
    1. #include <qapplication.h>
    2. #include <qwt_plot.h>
    3. #include <qwt_plot_curve.h>
    4. #include <qwt_plot_grid.h>
    5. #include <qwt_symbol.h>
    6. #include <qwt_legend.h>
    7.  
    8. int main( int argc, char **argv )
    9. {
    10. QApplication a( argc, argv );
    11.  
    12. QwtPlot plot;
    13. plot.setTitle( "Plot Demo" );
    14. plot.setCanvasBackground( Qt::white );
    15. plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
    16. plot.insertLegend( new QwtLegend() );
    17.  
    18. QwtPlotGrid *grid = new QwtPlotGrid();
    19. grid->attach( &plot );
    20.  
    21. QwtPlotCurve *curve = new QwtPlotCurve();
    22. curve->setTitle( "Some Points" );
    23. curve->setPen( QPen( Qt::blue, 4 ) ),
    24. curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    25.  
    26. QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
    27. QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
    28. curve->setSymbol( symbol );
    29.  
    30. QPolygonF points;
    31. points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
    32. << QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
    33. << QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
    34. curve->setSamples( points );
    35.  
    36. curve->attach( &plot );
    37.  
    38. plot.resize( 600, 400 );
    39. plot.show();
    40.  
    41. return a.exec();
    42. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

Similar Threads

  1. axes for plotting data
    By timmu in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2012, 12:19
  2. Real time data plotting using Qwt
    By nagabathula in forum Qwt
    Replies: 8
    Last Post: 7th July 2011, 16:47
  3. Plotting socket data
    By catto in forum Qwt
    Replies: 4
    Last Post: 6th March 2011, 08:01
  4. Efficiently plotting 2d data in a QGraphicsscene
    By xenome in forum Qt Programming
    Replies: 0
    Last Post: 5th September 2009, 15:58
  5. Widget for data plotting
    By Benjamin in forum Qt Programming
    Replies: 3
    Last Post: 12th February 2009, 15:38

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.