#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_curve_fitter.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
#include <qwt_scale_engine.h>
int main( int argc, char **argv )
{
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.
setAxisScale( QwtPlot::yLeft,
0,
100 );
plot.
setAxisScale( QwtPlot::xBottom,
50.0,
0.0 );
grid->attach( &plot );
curve->setTitle( "Some Points" );
curve
->setPen
( QPen( Qt
::blue,
1 ) );
curve
->setRenderHint
( QwtPlotItem::RenderAntialiased,
true );
curve->setSymbol( symbol );
curve->setCurveFitter(pCurveFitter);
<<QPointF
( 54.8972,
129.129) <<
QPointF( 56.9157,
154.954) <<QPointF
( 76.675,
1058.86) <<
QPointF(78.6658,
1317.11)
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_curve_fitter.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
#include <qwt_scale_engine.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QwtPlot plot;
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.setAxisScale( QwtPlot::yLeft, 0, 100 );
plot.setAxisScale( QwtPlot::xBottom, 50.0, 0.0 );
plot.insertLegend( new QwtLegend() );
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( &plot );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Some Points" );
curve->setPen( QPen( Qt::blue, 1 ) );
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 1 ), QSize( 2, 2 ) );
curve->setSymbol( symbol );
curve->setCurveAttribute(QwtPlotCurve::Fitted);
QwtSplineCurveFitter *pCurveFitter = new QwtSplineCurveFitter;
pCurveFitter->setFitMode(QwtSplineCurveFitter::ParametricSpline);
curve->setCurveFitter(pCurveFitter);
QPolygonF points;
points << QPointF( 0.0, 2.58258 ) << QPointF( 0.995469, 6.45643 )
<< QPointF( 4.11356, 12.9129 ) << QPointF( 12.565, 19.3693 )
<< QPointF( 25.1777, 25.8257 ) << QPointF( 45.1747, 51.6515 )
<< QPointF( 50.5358, 77.4772) << QPointF( 53.477, 103.303)
<<QPointF( 54.8972, 129.129) << QPointF( 56.9157, 154.954)
<< QPointF( 60.1614, 206.606) << QPointF( 63.6644, 284.083)
<< QPointF( 66.3, 361.56) << QPointF( 68.3328, 439.038)
<< QPointF( 70.5758, 542.341) << QPointF( 74.1964, 800.598)
<<QPointF( 76.675, 1058.86) << QPointF(78.6658, 1317.11)
<< QPointF(81.0151, 1833.63) << QPointF(83.0936, 2608.4)
<< QPointF(84.9255, 3899.69) << QPointF(86.8342, 6482.26)
<< QPointF(87.3439, 8290.06);
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks