void Plot::open(QString filename) { this->detachItems(); // Insert new curves curve = new QwtPlotCurve( "y = sin(x)" ); curve->setRenderHint( QwtPlotItem::RenderAntialiased ); curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true ); curve->setPen( Qt::red ); curve->attach( this ); Data* data = new Data(filename); curve->setData(data); setAxisScale( yLeft, data->yMin, data->yMax); setAxisScale( xBottom, data->xMin, data->xMax); QwtPlotGrid* grid = new QwtPlotGrid(); grid->setPen(Qt::black, 0.1, Qt::DashLine); grid->attach(this); }
void Plot::paste() { QLocale l; QClipboard *clipboard = QApplication::clipboard(); QString text = clipboard->text(); if(!text.isEmpty()) { QList<QString> items = text.split('\n'); QList<float> values; for(int i = 0; i < items.count(); i++) { values.append(l.toFloat(items[i])); } this->detachItems(); // Insert new curves curve = new QwtPlotCurve( "y = sin(x)" ); curve->setRenderHint( QwtPlotItem::RenderAntialiased ); curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true ); curve->setPen( Qt::red ); curve->attach( this ); Data* data = new Data(&values); curve->setData(data); setAxisScale( yLeft, data->yMin, data->yMax); setAxisScale( xBottom, data->xMin, data->xMax); QwtPlotGrid* grid = new QwtPlotGrid(); grid->setPen(Qt::black, 0.1, Qt::DashLine); grid->attach(this); } }
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(); }
RandomPlot::RandomPlot(QWidget *parent): IncrementalPlot(parent), d_timer(0), d_timerCount(0) { setFrameStyle(QFrame::NoFrame); setLineWidth(0); setCanvasLineWidth(2); plotLayout()->setAlignCanvasToScales(true); QwtPlotGrid *grid = new QwtPlotGrid; grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); grid->attach(this); setCanvasBackground(QColor(29, 100, 141)); // nice blue setAxisScale(xBottom, 0, c_rangeMax); setAxisScale(yLeft, 0, c_rangeMax); replot(); // enable zooming (void) new Zoomer(canvas()); }
void MainWindow::setupPlot() { plotTimer.setInterval(1000/settingsDialog->rate); connect(&plotTimer, SIGNAL(timeout()), this, SLOT(plotUpdate())); plotTimer.start(); if (!ui->plot->legend()) { QwtLegend* legend = new QwtLegend; legend->setItemMode(QwtLegend::CheckableItem); ui->plot->insertLegend(legend, QwtPlot::RightLegend); } ui->plot->setAxisTitle(QwtPlot::xBottom, "seconds"); ui->plot->setCanvasBackground(Qt::white); QColor gridColor; gridColor.setNamedColor("grey"); QPen gridPen(gridColor); gridPen.setStyle(Qt::DotLine); QwtPlotGrid* grid = new QwtPlotGrid; grid->setMajPen(gridPen); grid->attach(ui->plot); connect(ui->plot, SIGNAL(legendChecked(QwtPlotItem*,bool)), this, SLOT(showCurve(QwtPlotItem*,bool))); }
Plot::Plot(QWidget *parent): QwtPlot(parent), d_mapItem(NULL), d_mapRect(0.0, 0.0, 100.0, 100.0) // something { #if 1 /* d_mapRect is only a reference for zooming, but the ranges are nothing useful for the user. So we hide the axes. */ plotLayout()->setCanvasMargin(0); for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ ) enableAxis(axis, false); #else QwtPlotGrid *grid = new QwtPlotGrid(); grid->attach(this); #endif /* Navigation: Left Mouse Button: Panning Mouse Wheel: Zooming In/Out Right Mouse Button: Reset to initial */ (void)new QwtPlotPanner(canvas()); (void)new QwtPlotMagnifier(canvas()); canvas()->setFocusPolicy(Qt::WheelFocus); rescale(); }
void MainWindow::addPlotGrid()//сетка с делениями { // #include <qwt_plot_grid.h> QwtPlotGrid *grid = new QwtPlotGrid(); grid->setMajorPen(QPen( Qt::gray, 1 )); // цвет линий и толщина grid->attach( ui->Qwt_Widget ); }
void Plot::populate() { QwtPlotGrid *grid = new QwtPlotGrid(); grid->setMinorPen( Qt::black, 0, Qt::DashLine ); grid->enableXMin( true ); 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( 10.0, 4.4 ) << QPointF( 100.0, 3.0 ) << QPointF( 200.0, 4.5 ) << QPointF( 300.0, 6.8 ) << QPointF( 400.0, 7.9 ) << QPointF( 500.0, 7.1 ) << QPointF( 600.0, 7.9 ) << QPointF( 700.0, 7.1 ) << QPointF( 800.0, 5.4 ) << QPointF( 900.0, 2.8 ) << QPointF( 1000.0, 3.6 ); curve->setSamples( points ); curve->attach( this ); }
DataPlotFFT::DataPlotFFT(QWidget *parent): QwtPlot(parent), d_data(NULL), d_curve(NULL) { setAutoReplot(false); setFrameStyle(QFrame::NoFrame); setLineWidth(0); setCanvasLineWidth(2); //plotLayout()->setAlignCanvasToScales(true); QwtPlotGrid *grid = new QwtPlotGrid; grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); grid->attach(this); setCanvasBackground(Qt::white); //setCanvasBackground(QColor(29, 100, 141)); // nice blue //setAxisAutoScale(xBottom); //s/etAxisAutoScale(yLeft); setAxisScale(xBottom, 0.5, -0.5); setAxisScale(yLeft, -10.00, 10.00); setAxisAutoScale(yLeft); //setAxisAutoScale(xBottom); replot(); }
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); }
int main(int argc, char **argv) { QApplication app(argc, argv); QwtPlot plot; plot.setCanvasBackground(QColor(Qt::white)); plot.setTitle("Bar Chart"); QwtPlotGrid *grid = new QwtPlotGrid; grid->enableX(false); grid->enableYMin(true); grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); grid->attach(&plot); BarChartItem *item = new BarChartItem(); item->attach(&plot); QList< QPair<int, QString> > barHeights; barHeights.append(QPair<int, QString>(10, "")); barHeights.append(QPair<int, QString>(100, "")); barHeights.append(QPair<int, QString>(20, "")); item->setData(barHeights); plot.enableAxis(QwtPlot::xBottom, false); plot.resize(600, 400); plot.show(); return app.exec(); }
// MyPlot2D::MyPlot2D(QWidget *parent, const char *name) MyPlot2D::MyPlot2D( QWidget *parent ): QwtPlot(parent) { setAutoReplot( false ); setTitle( "Comparison of WATER FIT against Measurements" ); QwtPlotCanvas *canvas = new QwtPlotCanvas(); canvas->setBorderRadius( 10 ); setCanvas( canvas ); setCanvasBackground( QColor( "LightGray" ) ); // legend // QwtLegend *legend = new QwtLegend; // insertLegend( legend, QwtPlot::BottomLegend ); // grid QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin( true ); grid->setMajorPen( Qt::white, 0, Qt::DotLine ); grid->setMinorPen( Qt::gray, 0 , Qt::DotLine ); grid->attach( this ); // axes enableAxis( QwtPlot::yRight ); setAxisTitle( QwtPlot::xBottom, "Distance from CAX (cm)" ); setAxisTitle( QwtPlot::yLeft, "Relative Output Factor" ); // setAxisTitle( QwtPlot::yRight, "Phase [deg]" ); // setAxisMaxMajor( QwtPlot::xBottom, 6 ); // setAxisMaxMinor( QwtPlot::xBottom, 9 ); // setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine ); setAutoReplot( true ); }
void CentralWidget::initTmpPlotAndGL() { QwtPlot *plot = new QwtPlot(this); plot->setTitle( "Plot Demo" ); plot->setCanvasBackground( Qt::white ); plot->setAxisScale( QwtPlot::yLeft, 0.0, 10.0 ); QwtPlotGrid *grid = new QwtPlotGrid(); grid->attach( plot ); QwtPlotCurve *curve = new QwtPlotCurve(); curve->setTitle( "Some Points" ); curve->setPen( Qt::blue, 4 ), curve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); 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( plot ); this->addTab(plot, tr("Tmp Plot")); MyGLWidget *widget = new MyGLWidget(this); this->addTab(widget, tr("Tmp OpenGL")); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiuPvtPlotWidget::setPlotDefaults(QwtPlot* plot) { // Plot background and frame look QPalette newPalette(plot->palette()); newPalette.setColor(QPalette::Background, Qt::white); plot->setPalette(newPalette); plot->setAutoFillBackground(true); plot->setCanvasBackground(Qt::white); QFrame* canvasFrame = dynamic_cast<QFrame*>(plot->canvas()); if (canvasFrame) { canvasFrame->setFrameShape(QFrame::NoFrame); } // Grid { QwtPlotGrid* grid = new QwtPlotGrid; grid->attach(plot); QPen gridPen(Qt::SolidLine); gridPen.setColor(Qt::lightGray); grid->setPen(gridPen); } // Axis number font { QFont axisFont = plot->axisFont(QwtPlot::xBottom); axisFont.setPointSize(8); plot->setAxisFont(QwtPlot::xBottom, axisFont); plot->setAxisFont(QwtPlot::yLeft, axisFont); } // Axis title font { QwtText axisTitle = plot->axisTitle(QwtPlot::xBottom); QFont axisTitleFont = axisTitle.font(); axisTitleFont.setPointSize(8); axisTitleFont.setBold(false); axisTitle.setFont(axisTitleFont); axisTitle.setRenderFlags(Qt::AlignRight); plot->setAxisTitle(QwtPlot::xBottom, axisTitle); plot->setAxisTitle(QwtPlot::yLeft, axisTitle); } // Title font { QwtText plotTitle = plot->title(); QFont titleFont = plotTitle.font(); titleFont.setPointSize(12); plotTitle.setFont(titleFont); plot->setTitle(plotTitle); } plot->setAxisMaxMinor(QwtPlot::xBottom, 2); plot->setAxisMaxMinor(QwtPlot::yLeft, 3); plot->plotLayout()->setAlignCanvasToScales(true); }
Plot::Plot( QWidget *parent ): QwtPlot( parent ) { setAutoFillBackground( true ); setPalette( Qt::darkGray ); setCanvasBackground( Qt::white ); plotLayout()->setAlignCanvasToScales( true ); initAxis( QwtAxis::yLeft, "Local Time", Qt::LocalTime ); initAxis( QwtAxis::yRight, "Coordinated Universal Time ( UTC )", Qt::UTC ); QwtPlotPanner *panner = new QwtPlotPanner( canvas() ); QwtPlotMagnifier *magnifier = new QwtPlotMagnifier( canvas() ); for ( int axis = 0; axis < QwtAxis::PosCount; axis++ ) { const bool on = QwtAxis::isYAxis( axis ); setAxisVisible( axis, on ); panner->setAxisEnabled( axis, on ); magnifier->setAxisEnabled( axis, on ); } QwtPlotGrid *grid = new QwtPlotGrid(); grid->setMajorPen( Qt::black, 0, Qt::SolidLine ); grid->setMinorPen( Qt::gray, 0 , Qt::SolidLine ); grid->enableX( false ); grid->enableXMin( false ); grid->enableY( true ); grid->enableYMin( true ); grid->attach( this ); }
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(); }
SimDialog::SimDialog( QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { setupUi(this); // setup the plot ... m_plot->setTitle("Comparing Similarity Measures"); m_plot->insertLegend(new QwtLegend(), QwtPlot::BottomLegend); // set up the axes ... m_plot->setAxisTitle(QwtPlot::xBottom, "Variations"); m_plot->setAxisScale(QwtPlot::xBottom, -10, 10); m_plot->setAxisTitle(QwtPlot::yLeft, "Similarity"); m_plot->setAxisScale(QwtPlot::yLeft, -1.5, 1.5); // enable grid ... QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin(true); grid->enableYMin(true); grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); grid->attach(m_plot); // Insert zero line at y = 0 QwtPlotMarker *mY = new QwtPlotMarker(); mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); mY->setLineStyle(QwtPlotMarker::HLine); mY->setYValue(0.0); mY->attach(m_plot); // Insert zero line at x = 0 QwtPlotMarker *mX = new QwtPlotMarker(); mX->setLabelAlignment(Qt::AlignRight|Qt::AlignTop); mX->setLineStyle(QwtPlotMarker::VLine); mX->setXValue(0.0); mX->attach(m_plot); // Insert new curves cReg = new QwtPlotCurve("Regular Similarity Measure"); cReg->attach(m_plot); cOct = new QwtPlotCurve("Octree based Similarity Measure"); cOct->attach(m_plot); // Set curve styles cReg->setPen(QPen(Qt::red, 2)); cOct->setPen(QPen(Qt::blue, 2)); // Populate the volume combos ... MainWindow* _win = (MainWindow *)this->parent(); viewer3d * _view = (viewer3d *) _win->getViewer(); QList<Volume*> _vols = _view->getVolumes(); // append Volume names to combo boxes ... // Need to modify Volume class so that it stored patient name ... // More importantly modify PatientBrowser so that the data can be directly // loaded. }
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); }
int main(int argc, char *argv[]) { /*const int L = 10; fftw_complex *in; fftw_complex *out; gsl_sf_bessel_k0_scaled(0.684684); fftw_plan p; in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*L); out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*L); p = fftw_plan_dft_1d(L, in, out,FFTW_FORWARD,FFTW_MEASURE); fftw_execute(p); fftw_destroy_plan(p); fftw_free(in); fftw_free(out); QApplication a(argc, argv); Ekg w; w.show(); qDebug() << "sdfsdfsd"; std::cout << "ALKO PROJEKT CPP CHLOSTA!"; return a.exec();*/ QApplication a( argc, argv ); QwtPlot plot; plot.setTitle( "Plot Demo" ); plot.setCanvasBackground( Qt::white ); plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 ); plot.insertLegend( new QwtLegend() ); QwtPlotGrid *grid = new QwtPlotGrid(); grid->attach( &plot ); 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( &plot ); plot.resize( 600, 400 ); plot.show(); return a.exec(); }
// Init X axis. void DataPlot::setGridPlot() { QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin(true); grid->enableYMin(true); grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); grid->attach(this); }
//#include "freeems/fetable2ddata.h" TableView2D::TableView2D(QWidget *parent) { Q_UNUSED(parent) //m_isSignedData = isSigned; m_isFlashOnly = false; ui.setupUi(this); metaDataValid = false; tableData=0; //ui.tableWidget->setColumnCount(1); ui.tableWidget->setRowCount(2); ui.tableWidget->horizontalHeader()->hide(); ui.tableWidget->verticalHeader()->hide(); //ui.tableWidget->setColumnWidth(0,100); connect(ui.savePushButton,SIGNAL(clicked()),this,SLOT(saveClicked())); connect(ui.loadFlashPushButton,SIGNAL(clicked()),this,SLOT(loadFlashClicked())); connect(ui.loadRamPushButton,SIGNAL(clicked()),this,SLOT(loadRamClicked())); connect(ui.tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(tableCellChanged(int,int))); connect(ui.tableWidget,SIGNAL(currentCellChanged(int,int,int,int)),this,SLOT(tableCurrentCellChanged(int,int,int,int))); connect(ui.exportPushButton,SIGNAL(clicked()),this,SLOT(exportClicked())); connect(ui.importPushButton,SIGNAL(clicked()),this,SLOT(importClicked())); connect(ui.tableWidget,SIGNAL(hotKeyPressed(int,Qt::KeyboardModifiers)),this,SLOT(hotKeyPressed(int,Qt::KeyboardModifiers))); ui.tableWidget->addHotkey(Qt::Key_Plus,Qt::ShiftModifier); ui.tableWidget->addHotkey(Qt::Key_Minus,Qt::NoModifier); ui.tableWidget->addHotkey(Qt::Key_Underscore,Qt::ShiftModifier); ui.tableWidget->addHotkey(Qt::Key_Equal,Qt::NoModifier); ui.tableWidget->setItemDelegate(new TableWidgetDelegate()); QPalette pal = ui.plot->palette(); pal.setColor(QPalette::Background,QColor::fromRgb(0,0,0)); ui.plot->setPalette(pal); curve = new QwtPlotCurve("Test"); curve->attach(ui.plot); curve->setPen(QPen(QColor::fromRgb(255,0,0),3)); QwtPlotGrid *grid = new QwtPlotGrid(); grid->setPen(QPen(QColor::fromRgb(100,100,100))); grid->attach(ui.plot); //curve->setData() //QwtSeriesData<QwtIntervalSample> series; /*if (!isram) { //Is only flash ui.loadRamPushButton->setVisible(false); } else if (!isflash) { //Is only ram ui.loadFlashPushButton->setVisible(false); ui.savePushButton->setVisible(false); } else { //Is both ram and flash }*/ connect(ui.tracingCheckBox,SIGNAL(stateChanged(int)),this,SLOT(tracingCheckBoxStateChanged(int))); }
MSPeaksWnd::MSPeaksWnd(QWidget *parent) : QWidget(parent) { plots_.push_back( std::make_shared< adwplot::Dataplot >() ); plots_.push_back( std::make_shared< adwplot::Dataplot >() ); plotMarkers_.resize( plots_.size() ); plotCurves_.resize( plots_.size() ); static struct { const char * xBottom; const char * yLeft; } axis_titles [] = { { "√<span style=\"text-decoration: overline\"> <i>m/z</i></span>" , "time (μs)" } , { "flight length (m)" , "time (μs)" } }; assert( sizeof( axis_titles ) / sizeof( axis_titles[0] ) == plots_.size() ); QFont font; qtwrapper::font::setFont( font, qtwrapper::fontSizeSmall, qtwrapper::fontAxisLabel ); font.setFamily( "Consolas" ); font.setBold( false ); font.setPointSize( 8 ); int n = 0; for ( auto& plot: plots_ ) { plot->setMinimumHeight( 40 ); plot->setMinimumWidth( 40 ); plot->enableAxis( QwtPlot::yRight ); plot->setAxisFont( QwtPlot::xBottom, font ); plot->setAxisFont( QwtPlot::yLeft, font ); plot->setAxisFont( QwtPlot::yRight, font ); plot->setAxisTitle( QwtPlot::yLeft, QwtText( axis_titles[ n ].yLeft, QwtText::RichText ) ); plot->setAxisTitle( QwtPlot::xBottom, QwtText( axis_titles[ n ].xBottom, QwtText::RichText ) ); plot->setAxisTitle( QwtPlot::yRight, QwtText( "δ(ns)", QwtText::RichText ) ); plot->axisAutoScale( QwtPlot::xBottom ); plot->axisAutoScale( QwtPlot::yLeft ); ++n; QwtPlotGrid * grid = new QwtPlotGrid; grid->setMajorPen( Qt::gray, 0, Qt::DotLine ); grid->attach( plot.get() ); QwtPlotLegendItem * legendItem = new QwtPlotLegendItem; legendItem->attach( plot.get() ); }; init(); }
Plot::Plot(QWidget *parent): QwtPlot(parent), d_paintedPoints(0), d_interval(0.0, 10.0), d_timerId(-1) { d_directPainter = new QwtPlotDirectPainter(); setAutoReplot(false); // We don't need the cache here canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); //canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); #if defined(Q_WS_X11) // Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent // works on X11. This has a nice effect on the performance. canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true); canvas()->setAttribute(Qt::WA_PaintOnScreen, true); #endif plotLayout()->setAlignCanvasToScales(true); setAxisTitle(QwtPlot::xBottom, "Time [s]"); setAxisScale(QwtPlot::xBottom, d_interval.minValue(), d_interval.maxValue()); setAxisScale(QwtPlot::yLeft, -200.0, 200.0); QwtPlotGrid *grid = new QwtPlotGrid(); grid->setPen(QPen(Qt::gray, 0.0, Qt::DotLine)); grid->enableX(true); grid->enableXMin(true); grid->enableY(true); grid->enableYMin(false); grid->attach(this); d_origin = new QwtPlotMarker(); d_origin->setLineStyle(QwtPlotMarker::Cross); d_origin->setValue(d_interval.minValue() + d_interval.width() / 2.0, 0.0); d_origin->setLinePen(QPen(Qt::gray, 0.0, Qt::DashLine)); d_origin->attach(this); d_curve = new QwtPlotCurve(); d_curve->setStyle(QwtPlotCurve::Lines); d_curve->setPen(QPen(Qt::green)); #if 1 d_curve->setRenderHint(QwtPlotItem::RenderAntialiased, true); #endif #if 1 d_curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, false); #endif d_curve->setData(new CurveData()); d_curve->attach(this); }
QmitkHistogramWidget::QmitkHistogramWidget(QWidget * parent, bool showreport) : QDialog(parent) { QBoxLayout *layout = new QVBoxLayout(this); //***histogram*** QGroupBox *hgroupbox = new QGroupBox("", this); hgroupbox->setMinimumSize(900, 400); m_Plot = new QwtPlot(hgroupbox); m_Plot->setCanvasBackground(QColor(Qt::white)); m_Plot->setTitle("Histogram"); QwtText text = m_Plot->titleLabel()->text(); text.setFont(QFont("Helvetica", 12, QFont::Normal)); QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin(true); grid->enableYMin(true); grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine)); grid->attach(m_Plot); layout->addWidget(hgroupbox); layout->setSpacing(20); if (showreport == true) { //***report*** QGroupBox *rgroupbox = new QGroupBox("", this); rgroupbox->setMinimumSize(900, 400); QLabel *label = new QLabel("Gray Value Analysis", rgroupbox); label->setAlignment(Qt::AlignHCenter); label->setFont(QFont("Helvetica", 14, QFont::Bold)); m_Textedit = new QTextEdit(rgroupbox); m_Textedit->setFont(QFont("Helvetica", 12, QFont::Normal)); m_Textedit->setReadOnly(true); layout->addWidget(rgroupbox); } m_Picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPicker::PointSelection, QwtPlotPicker::NoRubberBand, QwtPicker::AlwaysOn, m_Plot->canvas()); connect(m_Picker, SIGNAL(selected(const QwtDoublePoint &)), SLOT(OnSelect(const QwtDoublePoint &))); }
void GenericHistogramView::populate() { QwtPlotGrid* grid = new QwtPlotGrid(); grid->enableX(false); grid->enableY(true); grid->enableXMin(false); grid->enableYMin(false); grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine)); grid->attach(_qwtPlot); for(unsigned int i = 0; i < _image->getNbChannels(); ++i) { imagein::Array<unsigned int>* histogram; if(_projection) histogram = new imagein::ProjectionHistogram(*_image, _value, _horizontal, *_rectangle, i); else histogram = new imagein::Histogram(*_image, i, *_rectangle); int values[histogram->getWidth()]; for(unsigned int j = 0; j < histogram->getWidth(); ++j) values[j] = (*histogram)[j]; GraphicalHistogram* graphicalHisto; switch(i) { case 0: if(_image->getNbChannels() == 1 || _image->getNbChannels() == 2) graphicalHisto = new GraphicalHistogram("Black", Qt::black); else graphicalHisto = new GraphicalHistogram("Red", Qt::red); break; case 1: if(_image->getNbChannels() == 1 || _image->getNbChannels() == 2) graphicalHisto = new GraphicalHistogram("Alpha", Qt::white); else graphicalHisto = new GraphicalHistogram("Green", Qt::green); break; case 2: graphicalHisto = new GraphicalHistogram("Blue", Qt::blue); break; case 3: graphicalHisto = new GraphicalHistogram("Alpha", Qt::black); break; default: graphicalHisto = new GraphicalHistogram("Default", Qt::black); } graphicalHisto->setValues(sizeof(values) / sizeof(int), values); if(_horizontal) graphicalHisto->setOrientation(Qt::Horizontal); graphicalHisto->attach(_qwtPlot); _graphicalHistos.push_back(graphicalHisto); } }
RTVTPlotWindow::RTVTPlotWindow(QWidget *parent) : QWidget(parent), ui(new Ui::RTVTPlotWindow) { ui->setupUi(this); connect(ui->plotChannelListView, SIGNAL(clicked(QModelIndex)), this, SLOT(curveSelected(QModelIndex))); // Setup curves numberOfCurves = 10; startColorIndex = 0; channelListStringModel = new QStringListModel(); channelListStringModel->setStringList(channelStringList); ui->plotChannelListView->setModel(channelListStringModel); // Setup the plot view ui->plotQwtView->setCanvasBackground(QColor(Qt::darkBlue)); ui->plotQwtView->setTitle("Frequency Response of Amplifier"); ui->plotQwtView->setTitle("Amplitude"); ui->plotQwtView->setAxisTitle(QwtPlot::yLeft,"dBm"); ui->plotQwtView->setAxisTitle(QwtPlot::xBottom,"Frequency (Hz)"); // grid 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(ui->plotQwtView); ui->plotQwtView->setAxisMaxMajor(QwtPlot::xBottom, 6); ui->plotQwtView->setAxisMaxMinor(QwtPlot::xBottom, 10); ui->plotQwtView->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine); //QwtPlotGrid *gridy = new QwtPlotGrid(); //gridy->attach(ui->plotQwtView); /*QwtLog10ScaleEngine * log10SE = new QwtLog10ScaleEngine(); double x1=0.0, x2=4.3, stepSize=0.1; log10SE->autoScale(100, x1, x2, stepSize); QwtLinearScaleEngine * yAxisEngine = new QwtLinearScaleEngine(); double y1=-100.0, y2 = 10.0, yStep = 10.0; yAxisEngine->autoScale(10, y1, y2, yStep);*/ //ui->plotQwtView->setAxisScaleEngine(QwtPlot::xBottom,log10SE); //ui->plotQwtView->setAxisScaleEngine(QwtPlot::yLeft,yAxisEngine); //ui->plotQwtView->setAxis ui->plotQwtView->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 ); }
MavPlot::MavPlot(QWidget *parent) : QwtPlot(parent), _havePrintColors(false) { setAutoReplot(false); setTitle("MAV System Data Plot"); setCanvasBackground(QColor(Qt::darkGray)); // legend QwtLegend *legend = new QwtLegend; insertLegend(legend, QwtPlot::BottomLegend); #if (QWT_VERSION < QWT_VERSION_CHECK(6,1,0)) legend->setItemMode(QwtLegend::ClickableItem); connect(this, SIGNAL(legendClicked(QwtPlotItem*)), SLOT(legendClicked(QwtPlotItem*))); #else legend->setDefaultItemMode(QwtLegendData::Clickable); connect(legend, SIGNAL(clicked(const QVariant&, int)), SLOT(legendClickedNew(const QVariant&, int))); #endif // grid QwtPlotGrid *grid = new QwtPlotGrid; grid->enableXMin(true); #if (QWT_VERSION < QWT_VERSION_CHECK(6,1,0)) grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); grid->setMinPen(QPen(QColor(0x8, 0x8, 0x8), 0 , Qt::DotLine)); #else grid->setMajorPen(QPen(Qt::gray, 0, Qt::DotLine)); grid->setMinorPen(QPen(QColor(0x8, 0x8, 0x8), 0 , Qt::DotLine)); #endif grid->attach(this); // axes //enableAxis(QwtPlot::yRight); setAxisTitle(QwtPlot::xBottom, "time"); setAxisScaleDraw(QwtPlot::xBottom, new HumanReadableTime()); // no need to de-alloc or store, plot does it // A-B markers for (int i=0; i<2; i++) { _user_markers[i].setLineStyle(QwtPlotMarker::VLine); _user_markers[i].setLabelAlignment(Qt::AlignRight | Qt::AlignBottom); _user_markers[i].setLinePen(QPen(QColor(255, 140, 0), 0, Qt::SolidLine)); _user_markers_visible[i] = false; } _user_markers[0].setLabel(QwtText("A")); _user_markers[1].setLabel(QwtText("B")); // data marker _data_marker.setLineStyle(QwtPlotMarker::VLine); _data_marker.setLinePen(QPen(QColor(255, 160, 47), 2, Qt::SolidLine)); _data_marker.setLabel(QwtText("data")); _data_marker.setLabelAlignment(Qt::AlignTop | Qt::AlignRight); _data_marker_visible = false; _data_marker.setZ(9999); // higher value -> paint on top of everything else setAutoReplot(true); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //----------------------------------------------------- vBox = new QWidget; vBox->setWindowTitle( "Графік температури" ); TempPlot *plot = new TempPlot; plot->setParent(this); plot->setTitle( "Графік температури" ); QwtPlotGrid *grid; grid = new QwtPlotGrid; grid->enableXMin(true); grid->setMajorPen(QPen(Qt::gray,0,Qt::DashLine)); grid->setMinorPen((QPen(Qt::gray,0,Qt::DotLine))); grid->attach(plot); QwtPlotZoomer *zoom; zoom = new QwtPlotZoomer(plot->canvas()); zoom->setRubberBandPen(QPen(Qt::white)); const int margin = 1; plot->setContentsMargins( margin, margin, margin, margin ); QVBoxLayout *layout = new QVBoxLayout( vBox ); layout->addWidget( plot ); vBox->resize( 650, 330); //----------------------------------------------------- vBox2 = new QWidget; vBox2->setWindowTitle( "Графік рівня радіосигналу"); RssiPlot *plot2 = new RssiPlot; plot2->setParent(this); plot2->setTitle( "Графік рівня радіосигналу" ); QwtPlotGrid *grid2; grid2 = new QwtPlotGrid; grid2->enableXMin(true); grid2->setMajorPen(QPen(Qt::gray,0,Qt::DashLine)); grid2->setMinorPen((QPen(Qt::gray,0,Qt::DotLine))); grid2->attach(plot2); QwtPlotZoomer *zoom2; zoom2 = new QwtPlotZoomer(plot2->canvas()); zoom2->setRubberBandPen(QPen(Qt::white)); const int margin2 = 1; plot2->setContentsMargins( margin2, margin2, margin2, margin2 ); QVBoxLayout *layout2 = new QVBoxLayout( vBox2 ); layout2->addWidget( plot2 ); vBox2->resize( 650, 330 ); //----------------------------------------------------- timer = new QTimer(this); serial = new QSerialPort(this); QString str; foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()) { str=serialPortInfo.portName(); ui->comboBox_2->addItem(str); }
int qfit::setupGui() { // if(QApplication::arguments().size() > 1) // filePath->setText(QApplication::arguments().at(1)); if(QApplication::argc() == 2) { filePath->setText(QApplication::argv()[1]); } selectFit->addItem(tr("Fit Linear"));/*TODO add once are available in FitTools selectFit->addItem(tr("Fit Slope")); selectFit->addItem(tr("Fit Horizontal")); selectFit->addItem(tr("Fit Exponential")); selectFit->addItem(tr("Fit Logarithmic"));*/ #ifdef Qwt6_FOUND // plot stuff // panning with the middle mouse button QwtPlotPanner *panner = new QwtPlotPanner(qwtPlot->canvas()); panner->setMouseButton(Qt::MidButton); // zoom in/out with the wheel (void) new QwtPlotMagnifier(qwtPlot->canvas()); // zoom an area with left button QwtPlotZoomer *zoomer = new QwtPlotZoomer(qwtPlot->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); // canvas qwtPlot->canvas()->setLineWidth(1); qwtPlot->canvas()->setFrameStyle(QFrame::Box | QFrame::Plain); qwtPlot->canvas()->setBorderRadius(10); qwtPlot->canvas()->setPalette(Qt::darkGray); //grid QwtPlotGrid *grid = new QwtPlotGrid(); grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine)); // grid->setMinPen(QPen(Qt::gray, 0, Qt::DotLine)); grid->attach(qwtPlot); #endif // tooltips infoButton->setToolTip(trUtf8("About")); openFileButton->setToolTip(trUtf8("Open file")); selectFit->setToolTip(trUtf8("Fit typology")); startFit->setToolTip(trUtf8("GO!")); cleanLogButton->setToolTip(trUtf8("Clear log")); #ifdef Qwt6_FOUND savePlotButton->setToolTip(trUtf8("Save plot")); #endif return(0); }