{
setObjectName( "TempPlot" );
setTitle( Title );
setAxisScaleDraw
( QwtPlot::xBottom,
new YearScaleDraw
() );
setAxisTitle
( QwtPlot::yLeft, YLabel
);
setAxisScale
(QwtPlot::yLeft,minY,maxY,
0);
setAutoReplot(true);
// grid
grid->attach( this );
//insertLegend( new QwtLegend(), QwtPlot::RightLegend );
d_curve
->setRenderHint
( QwtPlotItem::RenderAntialiased );
d_curve
->setLegendAttribute
( QwtPlotCurve::LegendShowSymbol );
d_curve->setData( new CurveData() );
d_curve->attach( this );
// LeftButton for the zooming
// MidButton for the panning
// RightButton: zoom out by 1
// Ctrl+RighButton: zoom out to full size
//QwtPlotZoomer* zoomer = new QwtPlotZoomer( canvas() );
zoomer
->setRubberBandPen
( QColor( Qt
::black ) );
zoomer
->setTrackerPen
( QColor( Qt
::black ) );
Qt::RightButton, Qt::ControlModifier );
Qt::RightButton );
panner->setMouseButton( Qt::MidButton );
canvas()->setPalette( Qt::darkGray );
canvas()->setBorderRadius( 10.0 );
connect(zoomer,
SIGNAL(zoomed
(const QRectF
&)),
this,
SLOT(DoZoom
( QRectF )));
}
Plot::Plot( QString Title, QString YLabel, double minY, double maxY, QWidget * parent):
QwtPlot( parent )
{
setObjectName( "TempPlot" );
setTitle( Title );
setAxisScaleDraw( QwtPlot::xBottom, new YearScaleDraw() );
setAxisTitle( QwtPlot::yLeft, YLabel);
setAxisScale(QwtPlot::yLeft,minY,maxY,0);
setAutoReplot(true);
// grid
QwtPlotGrid *grid = new Grid;
grid->attach( this );
//insertLegend( new QwtLegend(), QwtPlot::RightLegend );
d_curve = new QwtPlotCurve( Title );
d_curve->setRenderHint( QwtPlotItem::RenderAntialiased );
d_curve->setStyle( QwtPlotCurve::Lines );//kls
d_curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol );
d_curve->setData( new CurveData() );
d_curve->attach( this );
// LeftButton for the zooming
// MidButton for the panning
// RightButton: zoom out by 1
// Ctrl+RighButton: zoom out to full size
//QwtPlotZoomer* zoomer = new QwtPlotZoomer( canvas() );
zoomer = new QwtPlotZoomer( canvas() );
zoomer->setRubberBandPen( QColor( Qt::black ) );
zoomer->setTrackerPen( QColor( Qt::black ) );
zoomer->setMousePattern( QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier );
zoomer->setMousePattern( QwtEventPattern::MouseSelect3,
Qt::RightButton );
QwtPlotPanner *panner = new QwtPlotPanner( canvas() );
panner->setMouseButton( Qt::MidButton );
canvas()->setPalette( Qt::darkGray );
canvas()->setBorderRadius( 10.0 );
connect(zoomer, SIGNAL(zoomed(const QRectF&)), this, SLOT(DoZoom( QRectF )));
}
To copy to clipboard, switch view to plain text mode
Bookmarks