Plotter::Plotter( QWidget *parent ): QwtPlot( parent ) { // Assign a title setTitle( "WAVE DATA" ); QwtPlotCanvas *canvas = new QwtPlotCanvas(); canvas->setFrameStyle( QFrame::Box | QFrame::Plain ); canvas->setLineWidth( 1 ); canvas->setPalette( Qt::white ); setCanvas( canvas ); alignScales(); // Insert grid d_grid = new QwtPlotGrid(); d_grid->attach( this ); // Axis setAxisTitle( QwtPlot::xBottom, "Time" ); // setAxisScale( QwtPlot::xBottom, -d_interval, 0.0 ); setAxisTitle( QwtPlot::yLeft, "Amplitude" ); // setAxisScale( QwtPlot::yLeft, -1.0, 1.0 ); resize(600, 350); }
Plot::Plot(QWidget *parent): QwtPlot( parent ) { // panning with the left mouse button (void) new QwtPlotPanner( canvas() ); // zoom in/out with the wheel (void) new QwtPlotMagnifier( canvas() ); setAutoFillBackground( true ); setPalette( QPalette( QColor( 165, 193, 228 ) ) ); updateGradient(); setTitle("A Simple QwtPlot Demonstration"); insertLegend(new QwtLegend(), QwtPlot::RightLegend); // axes setAxisTitle(xBottom, "x -->" ); setAxisScale(xBottom, 0.0, 10.0); setAxisTitle(yLeft, "y -->"); setAxisScale(yLeft, -1.0, 1.0); // canvas canvas()->setLineWidth( 1 ); canvas()->setFrameStyle( QFrame::Box | QFrame::Plain ); canvas()->setBorderRadius( 15 ); QPalette canvasPalette( Qt::white ); canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) ); canvas()->setPalette( canvasPalette ); populate(); }
void HistPlot::populate() { setTitle("Watching TV during a weekend"); setAxisTitle(QwtPlot::yLeft, "Number of People"); setAxisTitle(QwtPlot::xBottom, "Number of Hours"); QwtPlotGrid *grid = new QwtPlotGrid; grid->enableX(false); grid->enableY(true); grid->enableXMin(false); grid->enableYMin(false); grid->setMajPen(QPen(Qt::black, 0, Qt::SolidLine)); grid->attach(this); const double juneValues[] = { 7, 19, 24, 32, 10, 5, 3 }; const double novemberValues[] = { 4, 15, 22, 34, 13, 8, 4 }; Histogram *histogramJune = new Histogram("Summer", Qt::red); histogramJune->setValues( sizeof(juneValues) / sizeof(double), juneValues); histogramJune->attach(this); Histogram *histogramNovember = new Histogram("Winter", Qt::blue); histogramNovember->setValues( sizeof(novemberValues) / sizeof(double), novemberValues); histogramNovember->attach(this); }
PerfPlot::PerfPlot() : STScurve(NULL), LTScurve(NULL), SBcurve(NULL), DAYcurve(NULL) { xsd = new PPTimeScaleDraw(QDateTime()); xsd->setTickLength(QwtScaleDiv::MajorTick, 3); setAxisScaleDraw(QwtPlot::xBottom, xsd); insertLegend(new QwtLegend(), QwtPlot::BottomLegend); setAxisTitle(yLeft, tr("Exponentially Weighted Average Stress")); setAxisTitle(xBottom, tr("Time (days)")); setAxisTitle(yRight, tr("Daily Stress")); enableAxis(yRight, true); static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame); setAxisMaxMinor(xBottom, 0); setAxisMaxMinor(yLeft, 0); setAxisMaxMinor(yRight, 0); QwtScaleDraw *sd = new QwtScaleDraw; sd->setTickLength(QwtScaleDiv::MajorTick, 3); setAxisScaleDraw(QwtPlot::yLeft, sd); sd = new QwtScaleDraw; sd->setTickLength(QwtScaleDiv::MajorTick, 3); setAxisScaleDraw(QwtPlot::yRight, sd); grid = new QwtPlotGrid(); grid->attach(this); configUpdate(); }
void BarChart::setOrientation( int o ) { const Qt::Orientation orientation = ( o == 0 ) ? Qt::Vertical : Qt::Horizontal; int axis1 = QwtPlot::xBottom; int axis2 = QwtPlot::yLeft; if ( orientation == Qt::Horizontal ) qSwap( axis1, axis2 ); d_barChartItem->setOrientation( orientation ); setAxisTitle( axis1, "Distros" ); setAxisMaxMinor( axis1, 3 ); setAxisScaleDraw( axis1, new DistroScaleDraw( orientation, d_distros ) ); setAxisTitle( axis2, "Hits per day ( HPD )" ); setAxisMaxMinor( axis2, 3 ); QwtScaleDraw *scaleDraw = new QwtScaleDraw(); scaleDraw->setTickLength( QwtScaleDiv::MediumTick, 4 ); setAxisScaleDraw( axis2, scaleDraw ); plotLayout()->setCanvasMargin( 0 ); replot(); }
EcgCh::EcgCh(QWidget *parent) : QwtPlot(parent) { setMinimumHeight(10); setMinimumWidth(10); QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin(true); grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); grid->attach(this); setAxisTitle(QwtPlot::xBottom, "Czas [s]"); setAxisTitle(QwtPlot::yLeft, "Amplituda [mv]"); // picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas()); // picker->setStateMachine(new QwtPickerDragPointMachine()); // picker->setRubberBandPen(QColor(Qt::green)); // picker->setRubberBand(QwtPicker::CrossRubberBand); // picker->setTrackerPen(QColor(Qt::white)); curve = new QwtPlotCurve("signal"); curve->setYAxis(QwtPlot::yLeft); curve->attach(this); peaksCurve = new QwtPlotCurve("signal"); peaksCurve->setYAxis(QwtPlot::yLeft); peaksCurve->setStyle(QwtPlotCurve::CurveStyle::Dots); peaksCurve->setPen(QPen(Qt::red, 5)); peaksCurve->attach(this); samples = new QVector<QPointF>; data = new QwtPointSeriesData; peaksSamples = new QVector<QPointF>; peaksData = new QwtPointSeriesData; replot(); }
void matrixofpixels::HistogramPlotProperty(double Xmin, double Xmax, double Ymax) { changeitems(); setAxisAutoScale(this->xTop); setAxisAutoScale(this->xBottom); //setAxisFont(QwtPlot::xBottom,QFont("Helvetica",15,1)); QwtText xlabel("Value"); QwtText ylabel("Events"); QColor col(Qt::red); xlabel.setColor(col); ylabel.setColor(col); xlabel.setFont(QFont("Helvetica",15,1)); ylabel.setFont(QFont("Helvetica",15,1)); setAxisTitle(QwtPlot::xBottom,xlabel); setAxisTitle(QwtPlot::yLeft,ylabel); setCanvasBackground(QColor(Qt::white)); setAxisScale(QwtPlot::xBottom, Xmin, Xmax); setAxisMaxMinor(QwtPlot::xBottom, 0); setAxisScale(QwtPlot::yLeft, 0, Ymax); setAxisMaxMinor(QwtPlot::yLeft, 0); plotLayout()->setAlignCanvasToScales(true); his->attach(this); /*QwtPlotGrid **/grid = new QwtPlotGrid; grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); grid->attach(this); replot(); }
Plot::Plot( QWidget *parent ): QwtPlot( parent ), d_interval( 10.0 ), // seconds d_timerId( -1 ) { // Assign a title setTitle( "Testing Refresh Rates" ); setCanvasBackground( Qt::white ); alignScales(); // Insert grid d_grid = new QwtPlotGrid(); d_grid->attach( this ); // Insert curve d_curve = new QwtPlotCurve( "Data Moving Right" ); d_curve->setPen( QPen( Qt::black ) ); d_curve->setData( new CircularBuffer( d_interval, 10 ) ); d_curve->attach( this ); // Axis setAxisTitle( QwtPlot::xBottom, "Seconds" ); setAxisScale( QwtPlot::xBottom, -d_interval, 0.0 ); setAxisTitle( QwtPlot::yLeft, "Values" ); setAxisScale( QwtPlot::yLeft, -1.0, 1.0 ); d_clock.start(); setSettings( d_settings ); }
//----------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------- Plot::Plot(QString aname, QString acasename, QWidget *parent) : QwtPlot(parent) { name = aname; for (int i=0; i<ncmax; i++) { curve[i] = 0; } ncurves = 0; yscale = 0; if (acasename.compare("conc")==0) { setAxisTitle(QwtPlot::xBottom, "Distance (um)"); } else if (acasename.compare("vol")==0) { setAxisTitle(QwtPlot::xBottom, "Volume fraction"); } else if (acasename.compare("oxy")==0) { setAxisTitle(QwtPlot::xBottom, "O2 level"); } else { setAxisTitle(QwtPlot::xBottom, "Time (hours)"); } if (name.compare("") != 0) { curve[0] = new QwtPlotCurve(acasename); curve[0]->attach(this); ncurves = 1; replot(); } }
BarChart::BarChart( QWidget *parent ): QwtPlot( parent ) { setAutoFillBackground( true ); setPalette( Qt::white ); canvas()->setPalette( QColor( "LemonChiffon" ) ); setTitle( "Bar Chart" ); setAxisTitle( QwtPlot::yLeft, "Whatever" ); setAxisTitle( QwtPlot::xBottom, "Whatever" ); d_barChartItem = new QwtPlotMultiBarChart( "Bar Chart " ); d_barChartItem->setLayoutPolicy( QwtPlotMultiBarChart::AutoAdjustSamples ); d_barChartItem->setSpacing( 20 ); d_barChartItem->setMargin( 3 ); d_barChartItem->attach( this ); insertLegend( new QwtLegend() ); populate(); setOrientation( 0 ); setAutoReplot( true ); }
Plot::Plot( QWidget *parent ): QwtPlot( parent ) { setPalette( QColor( 60, 60, 60 ) ); canvas()->setPalette( Qt::white ); // panning with the left mouse button ( void ) new QwtPlotPanner( canvas() ); // zoom in/out with the wheel ( void ) new QwtPlotMagnifier( canvas() ); setTitle( "Shapes" ); insertLegend( new QwtLegend(), QwtPlot::RightLegend ); // axes setAxisTitle( QwtAxis::xBottom, "x -->" ); setAxisTitle( QwtAxis::yLeft, "y -->" ); #if 0 setAxisScaleEngine( QwtAxis::xBottom, new QwtLog10ScaleEngine ); setAxisScaleEngine( QwtAxis::yLeft, new QwtLog10ScaleEngine ); #endif populate(); }
Plot::Plot( QWidget *parent ): QwtPlot( parent ), d_curve( NULL ) { /*canvas()->setStyleSheet( "border: 2px solid Black;" "border-radius: 15px;" "background-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1," "stop: 0 LemonChiffon, stop: 1 PaleGoldenrod );" );*/ //QwtPlotCanvas *newcanvas=new QwtPlotCanvas(); //newcanvas->setPalette(Qt::white); //newcanvas->setBorderRadius(10); //setCanvas( newcanvas ); //plotLayout()->setAlignCanvasToScales( true ); setAxisTitle( QwtPlot::yLeft, "ylabel" ); setAxisTitle( QwtPlot::xBottom, "xlabel" ); //setAxisScale(QwtPlot::yLeft,0.0,25.0); //setAxisScale(QwtPlot::xBottom,0.0,25.0); //canvas()->resize(800, 600); //plotLayout(AlignScales); // attach curve d_curve = new QwtPlotCurve( "Scattered Points" ); d_curve->setPen( QColor( "Black" ) ); // d_curve->setCurveAttribute(fitten); // when using QwtPlotCurve::ImageBuffer simple dots can be // rendered in parallel on multicore systems. d_curve->setRenderThreadCount( 0 ); // 0: use QThread::idealThreadCount() //d_curve->setCurveAttribute(QwtPlotCurve::Fitted, true); d_curve->attach( this ); QwtSymbol * symbol2 = new QwtSymbol( QwtSymbol::XCross, QBrush(Qt::white), QPen(Qt::red, 1), QSize(6,6)); //QwtSymbol::Style style = Cross; setSymbol( symbol2 ); //setSymbol(NULL); // panning with the left mouse button (void )new QwtPlotPanner( canvas() ); // zoom in/out with the wheel QwtPlotMagnifier *magnifier = new QwtPlotMagnifier( canvas() ); magnifier->setMouseButton( Qt::NoButton ); // distanve measurement with the right mouse button DistancePicker *picker = new DistancePicker( canvas() ); picker->setMousePattern( QwtPlotPicker::MouseSelect1, Qt::RightButton ); picker->setRubberBandPen( QPen( Qt::blue ) ); QwtPlotGrid *grid = new QwtPlotGrid; grid->enableX( true );//设置网格线 grid->enableY( true ); grid->setMajorPen( Qt::black, 0, Qt::DotLine ); grid->attach( this ); //QSize sizeH = sizeHint(); }
StPlot::StPlot(QWidget* parent): QwtPlot(parent), viewFactor(-1.0) { setMinimumHeight(10); setMinimumWidth(10); QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin(true); grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); grid->attach(this); setAxisTitle(QwtPlot::xBottom, "Czas [s]"); setAxisTitle(QwtPlot::yLeft, "Amplituda [mv]"); curve = new QwtPlotCurve("Filtered signal"); curve->setYAxis(QwtPlot::yLeft); curve->attach(this); ISOPoints = new QwtPlotCurve("ISO"); ISOPoints->setStyle(QwtPlotCurve::NoCurve); ISOPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::green), QColor(Qt::green), QSize(5, 5))); ISOPoints->setYAxis(QwtPlot::yLeft); ISOPoints->attach(this); JPoints = new QwtPlotCurve("J"); JPoints->setStyle(QwtPlotCurve::NoCurve); JPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::blue), QColor(Qt::blue), QSize(5, 5))); JPoints->setYAxis(QwtPlot::yLeft); JPoints->attach(this); STPoints = new QwtPlotCurve("ST"); STPoints->setStyle(QwtPlotCurve::NoCurve); STPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::red), QColor(Qt::red), QSize(5, 5))); STPoints->setYAxis(QwtPlot::yLeft); STPoints->attach(this); RPoints = new QwtPlotCurve("R"); RPoints->setStyle(QwtPlotCurve::NoCurve); RPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::yellow), QColor(Qt::yellow), QSize(5, 5))); RPoints->setYAxis(QwtPlot::yLeft); //RPoints->attach(this); legend = new QwtLegend(); legend->setItemMode(QwtLegend::ReadOnlyItem); legend->setWhatsThis("Click on an item to show/hide the plot"); this->insertLegend(legend, QwtPlot::RightLegend); samples = new QVector<QPointF>; data = new QwtPointSeriesData; replot(); zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, canvas()); zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect4, Qt::NoButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect5, Qt::NoButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect6, Qt::NoButton); }
HistoricPlot::HistoricPlot(QWidget *parent) :QwtPlot(parent) { //Fondo del canvas negro canvas()->setPalette(Qt::black); //Auto repintar las curvas setAutoReplot(true); setTitle("Historian Variable Plot"); // Grid m_grid = new QwtPlotGrid; m_grid->enableXMin( true ); m_grid->setMajorPen( Qt::gray, 0, Qt::DotLine ); m_grid->setMinorPen( Qt::darkGray, 0, Qt::DotLine ); m_grid->attach( this ); //Scale m_scaleDraw = new QwtDateScaleDraw( Qt::UTC ); m_scaleDraw->setDateFormat( QwtDate::Millisecond, "hh:mm:ss:zzz\nddd dd MMM yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Second, "hh:mm:ss\nddd dd MMM yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Minute, "hh:mm\nddd dd MMM yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Hour, "hh:mm\nddd dd MMM yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Day, "ddd dd MMM yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Week, "Www yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Month, "MMM yyyy" ); m_scaleDraw->setDateFormat( QwtDate::Year, "yyyy"); m_scaleEngine = new QwtDateScaleEngine( Qt::UTC ); //Axis setAxisTitle( QwtPlot::xBottom, QString( "Time" ) ); setAxisScaleDraw( QwtPlot::xBottom, m_scaleDraw ); setAxisScaleEngine( QwtPlot::xBottom, m_scaleEngine ); setAxisLabelRotation( QwtPlot::xBottom, -50.0 ); setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom ); setAxisTitle( QwtPlot::yLeft, QString( "Value" ) ); //Legend m_legend = new QwtLegend; insertLegend(m_legend); //Zoomer m_zoomer = new Zoomer( canvas() ); m_zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier ); m_zoomer->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton ); //Panner m_panner = new QwtPlotPanner( canvas() ); m_panner->setMouseButton( Qt::MidButton ); resize(800,600); }
CpintPlot::CpintPlot(Context *context, QString p, const Zones *zones, bool rangemode) : path(p), thisCurve(NULL), CPCurve(NULL), allCurve(NULL), zones(zones), series(RideFile::watts), context(context), current(NULL), bests(NULL), isFiltered(false), shadeMode(2), rangemode(rangemode) { setAutoFillBackground(true); setAxisTitle(xBottom, tr("Interval Length")); LogTimeScaleDraw *ld = new LogTimeScaleDraw; ld->setTickLength(QwtScaleDiv::MajorTick, 3); setAxisScaleDraw(xBottom, ld); setAxisScaleEngine(xBottom, new QwtLogScaleEngine); QwtScaleDiv div( (double)0.017, (double)60 ); div.setTicks(QwtScaleDiv::MajorTick, LogTimeScaleDraw::ticks); setAxisScaleDiv(QwtPlot::xBottom, div); QwtScaleDraw *sd = new QwtScaleDraw; sd->setTickLength(QwtScaleDiv::MajorTick, 3); sd->enableComponent(QwtScaleDraw::Ticks, false); sd->enableComponent(QwtScaleDraw::Backbone, false); setAxisScaleDraw(yLeft, sd); setAxisTitle(yLeft, tr("Average Power (watts)")); setAxisMaxMinor(yLeft, 0); plotLayout()->setAlignCanvasToScales(true); //grid = new QwtPlotGrid(); //grid->enableX(true); //grid->attach(this); curveTitle.attach(this); curveTitle.setXValue(5); curveTitle.setYValue(60); curveTitle.setLabel(QwtText("", QwtText::PlainText)); // default to no title zoomer = new penTooltip(static_cast<QwtPlotCanvas*>(this->canvas())); zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ShiftModifier); canvasPicker = new LTMCanvasPicker(this); static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame); connect(canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), this, SLOT(pointHover(QwtPlotCurve*, int))); configChanged(); // apply colors ecp = new ExtendedCriticalPower(context); extendedCPCurve4 = NULL; extendedCurveTitle2 = NULL; }
SweepInspector::SweepInspector(QWidget *parent) : QwtPlot(parent), data(NULL), d_curve(NULL), picker(NULL) { setObjectName( "SweepData" ); setTitle( "RF Sweep" ); setAxisTitle( QwtPlot::xBottom, "Frequency"); setAxisTitle( QwtPlot::yLeft, QString( "Power Level (dBm)")); setAutoReplot(true); enableAxis(QwtPlot::xBottom, true); enableAxis(QwtPlot::yLeft, true); enableAxis(QwtPlot::xTop, false); enableAxis(QwtPlot::yRight, false); canvas = new QwtPlotCanvas(); canvas->setPalette( Qt::black ); canvas->setBorderRadius(0); setCanvas(canvas); //Allow zooming / panning zoomer = new QwtPlotZoomer( canvas ); zoomer->setRubberBandPen( QColor( Qt::white ) ); zoomer->setTrackerPen( QColor( Qt::white ) ); connect(zoomer, SIGNAL(zoomed(const QRectF &)), this, SLOT(zoomed(const QRectF &))); panner = new QwtPlotPanner( canvas ); panner->setMouseButton( Qt::MidButton ); //Show the X/Y markers that follow the mouse picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas); picker->setStateMachine( new QwtPickerTrackerMachine() ); picker->setRubberBandPen( QColor( Qt::cyan ) ); picker->setTrackerPen( QColor( Qt::cyan ) ); //FreqdBmPicker *er = new FreqdBmPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas); //Setup grid grid = new QwtPlotGrid(); grid->enableXMin( true ); grid->enableYMin( true ); QColor color(Qt::gray); color.setAlpha(128); grid->setMajorPen( color, 1, Qt::DotLine ); grid->setMinorPen( color, 1, Qt::DotLine ); grid->attach( this ); //format in kHz, MHz, GHz, not raw values setAxisScaleDraw(QwtPlot::xBottom, new FreqScaleDraw); setAxisAutoScale(QwtPlot::xBottom, true); //setAxisScale(QwtPlot::xBottom, 1, 4.4e9, 4.4e9 / 5.0); //setAxisScale(QwtPlot::yLeft, -135, 20, 20.0); setAxisScale(QwtPlot::yRight, 0, 10, 1); setAxisScale(QwtPlot::xTop, 0, 10, 1); repaint(); replot(); }
void ICResultChart::setOrientation(int orientation) { QwtPlot::Axis axis1, axis2; if (orientation == 0) { axis1 = QwtPlot::xBottom; axis2 = QwtPlot::yLeft; d_barChartItem->setOrientation(Qt::Vertical); } else { axis1 = QwtPlot::yLeft; axis2 = QwtPlot::xBottom; d_barChartItem->setOrientation(Qt::Horizontal); } setAxisTitle(axis2, tr("Number")); setAxisTitle(axis1, tr("Answers")); setAxisScaleDraw(axis1, new ChoicesScaleDraw(result.keys())); setAxisScaleDraw(axis2, new QwtScaleDraw); int size = result.size()-1 <= 0 ? 0: result.size()-1; if (size == 0) { setAxisAutoScale(axis1); } else { setAxisScale(axis1, 0, size, 1.0); } int maxsize = 0; foreach (int size, result.values()) { if (maxsize < size) maxsize = size; } setAxisScale(axis2, 0, maxsize * 1.3); QwtScaleDraw *scaleDraw1 = axisScaleDraw(axis1); scaleDraw1->enableComponent(QwtScaleDraw::Backbone, false); scaleDraw1->enableComponent(QwtScaleDraw::Ticks, false); QwtScaleDraw *scaleDraw2 = axisScaleDraw(axis2); scaleDraw2->enableComponent(QwtScaleDraw::Backbone, false); scaleDraw2->enableComponent(QwtScaleDraw::Ticks, true); //plotLayout()->setAlignCanvasToScales( true ); plotLayout()->setAlignCanvasToScale(axis1, true); plotLayout()->setAlignCanvasToScale(axis2, false); plotLayout()->setCanvasMargin(0); updateCanvasMargins(); replot(); }
Plot::Plot( QWidget *parent ): QwtPlot( parent ) { setObjectName( "FriedbergPlot" ); setTitle( "Temperature of Friedberg/Germany" ); setAxisTitle( QwtPlot::xBottom, "2007" ); setAxisScaleDiv( QwtPlot::xBottom, yearScaleDiv() ); setAxisScaleDraw( QwtPlot::xBottom, new YearScaleDraw() ); setAxisTitle( QwtPlot::yLeft, QString( "Temperature [%1C]" ).arg( QChar( 0x00B0 ) ) ); // grid QwtPlotGrid *grid = new Grid; grid->attach( this ); insertLegend( new QwtLegend(), QwtPlot::RightLegend ); const int numDays = 365; QVector<QPointF> averageData( numDays ); QVector<QwtIntervalSample> rangeData( numDays ); for ( int i = 0; i < numDays; i++ ) { const Temperature &t = friedberg2007[i]; averageData[i] = QPointF( double( i ), t.averageValue ); rangeData[i] = QwtIntervalSample( double( i ), QwtInterval( t.minValue, t.maxValue ) ); } insertCurve( "Average", averageData, Qt::black ); insertErrorBars( "Range", rangeData, Qt::blue ); // 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 ) ); 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 ); }
PlotHRVTriangle::PlotHRVTriangle(QWidget *parent) : QwtPlot(parent) { setMinimumHeight(10); setMinimumWidth(10); setAxisTitle(QwtPlot::xBottom, "TINN [s]"); setAxisTitle(QwtPlot::yLeft, "Liczba wszystkich odstępów RR"); rr = new QwtPlotCurve("RR"); rr->setStyle(QwtPlotCurve::Sticks); rr->setOrientation(Qt::Orientation::Vertical); rr->attach(this); xn = new QwtPlotCurve("X-N"); xn->setPen(QPen(Qt::darkGray, 0, Qt::DashLine)); xn->attach(this); xm = new QwtPlotCurve("X-M"); xm->setPen(QPen(Qt::darkGray, 0, Qt::DashLine)); xm->attach(this); mx = new QwtPlotMarker(); mx->setLineStyle(QwtPlotMarker::VLine); mx->setLabel(tr("X")); mx->setLabelAlignment(Qt::AlignLeft | Qt::AlignTop); mx->setLinePen(QPen(Qt::gray, 0, Qt::DashLine)); mx->attach(this); my = new QwtPlotMarker(); mx->setLineStyle(QwtPlotMarker::HLine); mx->setLabel(tr("Y")); mx->setLabelAlignment(Qt::AlignRight | Qt::AlignTop); mx->setLinePen(QPen(Qt::gray, 0, Qt::DashLine)); my->attach(this); mn = new QwtPlotMarker(); mx->setLineStyle(QwtPlotMarker::VLine); mx->setLabel(tr("X")); mx->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom); mx->setLinePen(QPen(Qt::gray, 0, Qt::DashLine)); mn->attach(this); mm = new QwtPlotMarker(); mx->setLineStyle(QwtPlotMarker::VLine); mx->setLabel(tr("X")); mx->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom); mx->setLinePen(QPen(Qt::gray, 0, Qt::DashLine)); mm->attach(this); }
MyPlot::MyPlot( const QwtText& name, QWidget *parent ) : QwtPlot( name, parent ) { // Show a title setTitle( "This is an Example" ); QwtLegend * legend= new QwtLegend(); // Show a legend at the bottom insertLegend(legend, QwtPlot::BottomLegend); // Show the axes setAxisTitle( xBottom, "x" ); setAxisTitle( yLeft, "y" ); // Insert two curves and get IDs for them QwtPlotCurve *curve1 = new QwtPlotCurve("y = sin(x)"); QwtPlotCurve *curve2 = new QwtPlotCurve("y = sign(sin(x)"); // Calculate the data, 500 points each const int points = 500; double x[ points ]; double sn[ points ]; double sg[ points ]; for( int i=0; i<points; i++ ) { x[i] = (3.0*3.14/double(points))*double(i); sn[i] = 2.0*sin( x[i] ); sg[i] = (sn[i]>0)?1:((sn[i]<0)?-1:0); } // Copy the data to the plot curve1->setData( x, sn, points ); curve2->setData( x, sg, points ); // Attach curve1->attach( this ); curve2->attach( this ); // Set the style of the curves curve1->setPen( QPen( Qt::blue ) ); curve2->setPen( QPen( Qt::green, 3 ) ); // Show the plots replot(); }
PerfPlot::PerfPlot() : STScurve(NULL), LTScurve(NULL), SBcurve(NULL), DAYcurve(NULL) { insertLegend(new QwtLegend(), QwtPlot::BottomLegend); setTitle(tr("Performance Manager")); setAxisTitle(yLeft, "Exponentially Weighted Average Stress"); setAxisTitle(xBottom, "Time (days)"); setAxisTitle(yRight, "Daily Stress"); enableAxis(yRight, true); grid = new QwtPlotGrid(); grid->attach(this); configUpdate(); }
PlotDFA2::PlotDFA2(QWidget *parent) : QwtPlot(parent) { setMinimumHeight(10); setMinimumWidth(10); setAxisTitle(QwtPlot::xBottom, "Ilość RR, k"); setAxisTitle(QwtPlot::yLeft, "y(k)"); rrint = new QwtPlotCurve("RR integrated"); rrint->attach(this); replot(); }
Aerolab::Aerolab( AerolabWindow *parent, MainWindow *mainWindow ): QwtPlot(parent), mainWindow(mainWindow), parent(parent), rideItem(NULL), smooth(1), bydist(true), autoEoffset(true) { crr = 0.005; cda = 0.500; totalMass = 85.0; rho = 1.236; eta = 1.0; eoffset = 0.0; useMetricUnits = mainWindow->useMetricUnits; insertLegend(new QwtLegend(), QwtPlot::BottomLegend); setCanvasBackground(Qt::white); canvas()->setFrameStyle(QFrame::NoFrame); setXTitle(); setAxisTitle(yLeft, tr("Elevation (m)")); setAxisScale(yLeft, -300, 300); setAxisTitle(xBottom, tr("Distance (km)")); setAxisScale(xBottom, 0, 60); veCurve = new QwtPlotCurve(tr("V-Elevation")); altCurve = new QwtPlotCurve(tr("Elevation")); // get rid of nasty blank space on right of the plot veCurve->setYAxis( yLeft ); altCurve->setYAxis( yLeft ); intervalHighlighterCurve = new QwtPlotCurve(); intervalHighlighterCurve->setBaseline(-5000); intervalHighlighterCurve->setYAxis( yLeft ); intervalHighlighterCurve->setData( new IntervalAerolabData( this, mainWindow ) ); intervalHighlighterCurve->attach( this ); this->legend()->remove( intervalHighlighterCurve ); // don't show in legend grid = new QwtPlotGrid(); grid->enableX(false); grid->attach(this); configChanged(); }
Plot::Plot(QWidget *parent, const char *name) : QwtPlot(parent,name) { movedGraph=FALSE; graphToResize=FALSE; ShiftButton=FALSE; d_lineWidth = 1; minTickLength = 5; majTickLength = 9; setGeometry(QRect(0,0,500,400)); setAutoLegend(FALSE); // We don't want a Qwt legend setAxisTitle(0, tr("Y Axis Title")); setAxisTitle(2, tr("X Axis Title")); //custom scale for (int i= 0; i<QwtPlot::axisCnt; i++) { ticksType<<Out; QwtScale *scale = (QwtScale *) axis(i); if (scale) scale->setBaselineDist(0); ScaleDraw *sd= new ScaleDraw(1); setAxisScaleDraw (i, sd); } QwtPlotLayout *pLayout=plotLayout(); pLayout->setCanvasMargin(0); QwtPlotCanvas* plCanvas=canvas(); plCanvas->setFocusPolicy(QWidget::StrongFocus); plCanvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator); plCanvas->setFocus(); plCanvas->setFrameShadow( QwtPlot::Plain); plCanvas->setCursor(Qt::arrowCursor); plCanvas->setLineWidth(0); setFocusPolicy(QWidget::StrongFocus); setFocusProxy(plCanvas); setFrameShape (QFrame::Box); setFrameShadow(QFrame::Plain); setLineWidth(0); //setCanvasBackground (QColor(gray)); }
CpintPlot::CpintPlot(Context *context, QString p, const Zones *zones) : path(p), thisCurve(NULL), CPCurve(NULL), allCurve(NULL), zones(zones), series(RideFile::watts), context(context), current(NULL), bests(NULL), isFiltered(false), shadeMode(2) { setInstanceName("CP Plot"); assert(!USE_T0_IN_CP_MODEL); // doesn't work with energyMode=true setAxisTitle(xBottom, tr("Interval Length")); LogTimeScaleDraw *ld = new LogTimeScaleDraw; ld->setTickLength(QwtScaleDiv::MajorTick, 3); setAxisScaleDraw(xBottom, ld); setAxisScaleEngine(xBottom, new LogTimeScaleEngine); setAxisScale(xBottom, (double)0.017, (double)60); QwtScaleDraw *sd = new QwtScaleDraw; sd->setTickLength(QwtScaleDiv::MajorTick, 3); setAxisScaleDraw(yLeft, sd); setAxisTitle(yLeft, tr("Average Power (watts)")); setAxisMaxMinor(yLeft, 0); plotLayout()->setAlignCanvasToScales(true); grid = new QwtPlotGrid(); grid->enableX(true); grid->attach(this); curveTitle.attach(this); curveTitle.setXValue(5); curveTitle.setYValue(20); curveTitle.setLabel(QwtText("", QwtText::PlainText)); // default to no title zoomer = new penTooltip(this->canvas()); zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ShiftModifier); canvasPicker = new LTMCanvasPicker(this); canvas()->setFrameStyle(QFrame::NoFrame); connect(canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), this, SLOT(pointHover(QwtPlotCurve*, int))); configChanged(); // apply colors }
Plot::Plot() { setTitle("A Simple QwtPlot Demonstration"); insertLegend(new QwtLegend(), QwtPlot::RightLegend); // Set axis titles setAxisTitle(xBottom, "x -->"); setAxisTitle(yLeft, "y -->"); // Insert new curves QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)"); #if QT_VERSION >= 0x040000 cSin->setRenderHint(QwtPlotItem::RenderAntialiased); #endif cSin->setPen(QPen(Qt::red)); cSin->attach(this); QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)"); #if QT_VERSION >= 0x040000 cCos->setRenderHint(QwtPlotItem::RenderAntialiased); #endif cCos->setPen(QPen(Qt::blue)); cCos->attach(this); // Create sin and cos data const int nPoints = 100; cSin->setData(SimpleData(::sin, nPoints)); cCos->setData(SimpleData(::cos, nPoints)); // Insert markers // ...a horizontal line at y = 0... QwtPlotMarker *mY = new QwtPlotMarker(); mY->setLabel(QString::fromLatin1("y = 0")); mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); mY->setLineStyle(QwtPlotMarker::HLine); mY->setYValue(0.0); mY->attach(this); // ...a vertical line at x = 2 * pi QwtPlotMarker *mX = new QwtPlotMarker(); mX->setLabel(QString::fromLatin1("x = 2 pi")); mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom); mX->setLabelOrientation(Qt::Vertical); mX->setLineStyle(QwtPlotMarker::VLine); mX->setLinePen(QPen(Qt::black, 0, Qt::DashDotLine)); mX->setXValue(2.0 * M_PI); mX->attach(this); }
Aerolab::Aerolab( AerolabWindow *parent, Context *context ): QwtPlot(parent), context(context), parent(parent), rideItem(NULL), smooth(1), bydist(true), autoEoffset(true) { crr = 0.005; cda = 0.500; totalMass = 85.0; rho = 1.236; eta = 1.0; eoffset = 0.0; constantAlt = false; insertLegend(new QwtLegend(), QwtPlot::BottomLegend); setCanvasBackground(Qt::white); static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame); setXTitle(); setAxisTitle(yLeft, tr("Elevation (m)")); setAxisScale(yLeft, -300, 300); setAxisTitle(xBottom, tr("Distance (km)")); setAxisScale(xBottom, 0, 60); veCurve = new QwtPlotCurve(tr("V-Elevation")); altCurve = new QwtPlotCurve(tr("Elevation")); // get rid of nasty blank space on right of the plot veCurve->setYAxis( yLeft ); altCurve->setYAxis( yLeft ); intervalHighlighterCurve = new QwtPlotCurve(); intervalHighlighterCurve->setBaseline(-5000); intervalHighlighterCurve->setYAxis( yLeft ); intervalHighlighterCurve->setSamples( new IntervalAerolabData( this, context ) ); intervalHighlighterCurve->attach( this ); //XXX broken this->legend()->remove( intervalHighlighterCurve ); // don't show in legend grid = new QwtPlotGrid(); grid->enableX(false); grid->attach(this); configChanged(CONFIG_APPEARANCE); }
TVPlot::TVPlot( QWidget *parent ): QwtPlot( parent ) { setTitle( "Watching TV during a weekend" ); QwtPlotCanvas *canvas = new QwtPlotCanvas(); canvas->setPalette( Qt::gray ); canvas->setBorderRadius( 10 ); setCanvas( canvas ); plotLayout()->setAlignCanvasToScales( true ); setAxisTitle( QwtPlot::yLeft, "Number of People" ); setAxisTitle( QwtPlot::xBottom, "Number of Hours" ); QwtLegend *legend = new QwtLegend; legend->setDefaultItemMode( QwtLegendData::Checkable ); insertLegend( legend, QwtPlot::RightLegend ); populate(); connect( legend, SIGNAL( checked( const QVariant &, bool, int ) ), SLOT( showItem( const QVariant &, bool ) ) ); replot(); // creating the legend items QwtPlotItemList items = itemList( QwtPlotItem::Rtti_PlotHistogram ); for ( int i = 0; i < items.size(); i++ ) { if ( i == 0 ) { const QVariant itemInfo = itemToInfo( items[i] ); QwtLegendLabel *legendLabel = qobject_cast<QwtLegendLabel *>( legend->legendWidget( itemInfo ) ); if ( legendLabel ) legendLabel->setChecked( true ); items[i]->setVisible( true ); } else { items[i]->setVisible( false ); } } setAutoReplot( true ); }
SpinScanPolarPlot::SpinScanPolarPlot(QWidget *parent, uint8_t *spinData) : QwtPlot(parent), leftCurve(NULL), rightCurve(NULL), spinData(spinData) { // Setup the axis setAxisTitle(yLeft, "SpinScan"); setAxisMaxMinor(xBottom, 0); setAxisMaxMinor(yLeft, 0); QPalette pal; setAxisScale(yLeft, -90, 90); // max 8 bit plus a little setAxisScale(xBottom, -90, 90); // max 8 bit plus a little pal.setColor(QPalette::WindowText, GColor(CSPINSCANLEFT)); pal.setColor(QPalette::Text, GColor(CSPINSCANLEFT)); axisWidget(QwtPlot::yLeft)->setPalette(pal); axisWidget(QwtPlot::yLeft)->scaleDraw()->setTickLength(QwtScaleDiv::MajorTick, 3); enableAxis(xBottom, false); // very little value and some cpu overhead enableAxis(yLeft, false); rightCurve = new QwtPlotCurve("SpinScan Right"); rightCurve->setRenderHint(QwtPlotItem::RenderAntialiased); // too cpu intensive rightCurve->attach(this); rightCurve->setYAxis(QwtPlot::yLeft); rightSpinScanPolarData = new SpinScanPolarData(spinData, false); leftCurve = new QwtPlotCurve("SpinScan Left"); leftCurve->setRenderHint(QwtPlotItem::RenderAntialiased); // too cpu intensive leftCurve->attach(this); leftCurve->setYAxis(QwtPlot::yLeft); leftSpinScanPolarData = new SpinScanPolarData(spinData, true); static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame); configChanged(CONFIG_APPEARANCE); // set colors }
PowerHist::PowerHist(MainWindow *mainWindow): rideItem(NULL), mainWindow(mainWindow), series(RideFile::watts), lny(false), shade(false), zoned(false), binw(3), withz(true), dt(1), minX(0), absolutetime(true), cache(NULL), source(Ride) { binw = appsettings->value(this, GC_HIST_BIN_WIDTH, 5).toInt(); if (appsettings->value(this, GC_SHADEZONES, true).toBool() == true) shade = true; else shade = false; // create a background object for shading bg = new PowerHistBackground(this); bg->attach(this); hrbg = new HrHistBackground(this); hrbg->attach(this); setCanvasBackground(Qt::white); canvas()->setFrameStyle(QFrame::NoFrame); setParameterAxisTitle(); setAxisTitle(yLeft, absolutetime ? tr("Time (minutes)") : tr("Time (percent)")); curve = new QwtPlotCurve(""); curve->setStyle(QwtPlotCurve::Steps); curve->setRenderHint(QwtPlotItem::RenderAntialiased); curve->attach(this); curveSelected = new QwtPlotCurve(""); curveSelected->setStyle(QwtPlotCurve::Steps); curveSelected->setRenderHint(QwtPlotItem::RenderAntialiased); curveSelected->attach(this); grid = new QwtPlotGrid(); grid->enableX(false); grid->attach(this); zoneLabels = QList<PowerHistZoneLabel *>(); hrzoneLabels = QList<HrHistZoneLabel *>(); zoomer = new penTooltip(this->canvas()); canvasPicker = new LTMCanvasPicker(this); connect(canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), this, SLOT(pointHover(QwtPlotCurve*, int))); setAxisMaxMinor(xBottom, 0); setAxisMaxMinor(yLeft, 0); configChanged(); }