ui(new Ui::Widget)
{
ui->setupUi(this);
QwtPlotOpenGLCanvas *plotCanvas = new QwtPlotOpenGLCanvas();
plotCanvas
->setPalette
( QColor("khaki") );
setTitle("Test Plot");
setCanvas( plotCanvas );
setAxisScale
( QwtPlot::yLeft,
0.0,
10.0 );
setAxisScale
( QwtPlot::xBottom,
0.0,
7.0 );
grid->attach( this );
curve->setTitle( "Some Points" );
curve->setPen( Qt::blue, 4 ),
curve
->setRenderHint
( QwtPlotItem::RenderAntialiased,
true );
curve->setSymbol( symbol );
curve->setSamples( points );
curve->attach( this );
resize( 600, 400 );
show();
}
Widget::Widget(QwtPlot *parent) :
QwtPlot(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QwtPlotOpenGLCanvas *plotCanvas = new QwtPlotOpenGLCanvas();
plotCanvas->setPalette( QColor("khaki") );
setTitle("Test Plot");
setCanvas( plotCanvas );
setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
setAxisScale( QwtPlot::xBottom, 0.0, 7.0 );
insertLegend( new QwtLegend() );
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( this );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Some Points" );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve->setSymbol( symbol );
QPolygonF points;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
curve->setSamples( points );
curve->attach( this );
resize( 600, 400 );
show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks