Beispiel #1
0
void PlotZoz::setAxisVisible(bool left, bool right, bool bottom, bool top)
{
    enableAxis(QwtPlot::yLeft, left);
    enableAxis(QwtPlot::yRight, right);
    enableAxis(QwtPlot::xBottom, bottom);
    enableAxis(QwtPlot::xTop, top);
}
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
}
VectorWidget::VectorWidget(DataContainer * d, QWidget *parent) :
        LabWidget(d, parent),
        phasor1(new QwtPlotCurve("Phasor 1")),
        phasor2(new QwtPlotCurve("Phasor 2")),
        sumVector(new QwtPlotCurve("Resultant Vector")),
        plotLine(new QwtPlotCurve("Plot Line")),
        phasor1_pen(new QPen(Qt::red)),
        phasor2_pen(new QPen(Qt::green)),
        sumVector_pen(new QPen(Qt::black)),
        plotLine_pen(new QPen(Qt::blue)),
        xScale(new QwtPlotScaleItem(QwtScaleDraw::BottomScale, frameWidth() / 2.0)),
        yScale(new QwtPlotScaleItem(QwtScaleDraw::LeftScale, frameWidth() / 2.0))
{    
    xScale->attach(this);
    enableAxis(QwtPlot::xBottom, false);

    yScale->attach(this);
    enableAxis(QwtPlot::yLeft, false);

    //-------------------------------
    // Modify line widths, 1 is normal
    phasor1_pen->setWidthF(1.5);
    phasor2_pen->setWidthF(1.5);
    sumVector_pen->setWidthF(1.5);
    plotLine_pen->setWidthF(1.5);
    //-------------------------------

    phasor1->setPen(*phasor1_pen);
    phasor2->setPen(*phasor2_pen);
    sumVector->setPen(*sumVector_pen);
    plotLine->setPen(*plotLine_pen);
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::setDefaults()
{
    QPalette newPalette(palette());
    newPalette.setColor(QPalette::Background, Qt::white);
    setPalette(newPalette);

    setAutoFillBackground(true);
    setCanvasBackground(Qt::white);

    QFrame* canvasFrame = dynamic_cast<QFrame*>(canvas());
    if (canvasFrame)
    {
        canvasFrame->setFrameShape(QFrame::NoFrame);
    }

    canvas()->setMouseTracking(true);
    canvas()->installEventFilter(this);

    QPen gridPen(Qt::SolidLine);
    gridPen.setColor(Qt::lightGray);
    m_grid->setPen(gridPen);

    enableAxis(QwtPlot::xBottom, true);
    enableAxis(QwtPlot::yLeft, true);
    enableAxis(QwtPlot::xTop, false);
    enableAxis(QwtPlot::yRight, false);

    plotLayout()->setAlignCanvasToScales(true);

    useDateBasedTimeAxis();

    QFont xAxisFont = axisFont(QwtPlot::xBottom);
    xAxisFont.setPixelSize(11);
    setAxisFont(QwtPlot::xBottom, xAxisFont);
    setAxisMaxMinor(QwtPlot::xBottom, 2);

    QFont yAxisFont = axisFont(QwtPlot::yLeft);
    yAxisFont.setPixelSize(11);
    setAxisFont(QwtPlot::yLeft, yAxisFont);

    setAxisMaxMinor(QwtPlot::yLeft, 3);

    QwtText axisTitleY = axisTitle(QwtPlot::yLeft);
    QFont yAxisTitleFont = axisTitleY.font();
    yAxisTitleFont.setPixelSize(11);
    yAxisTitleFont.setBold(false);
    axisTitleY.setFont(yAxisTitleFont);
    axisTitleY.setRenderFlags(Qt::AlignRight);
    setAxisTitle(QwtPlot::yLeft, axisTitleY);


    QwtLegend* legend = new QwtLegend(this);
    // The legend will be deleted in the destructor of the plot or when 
    // another legend is inserted.
    this->insertLegend(legend, BottomLegend);
}
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();
}
PlotViewWidget::PlotViewWidget(QString name, QWidget *parent) : QwtPlot(parent), mLabel(name), mWidgetHeight(200), mSecondaryAxis(false)
{
    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setSizePolicy(sizePolicy);
    setMinimumHeight(mWidgetHeight);
    setMaximumHeight(1500);

    enableAxis(QwtPlot::yLeft);
    enableAxis(QwtPlot::yRight);

    int scaleWidth = 60;
    axisScaleDraw(QwtPlot::yLeft)->setMinimumExtent( scaleWidth );
    axisScaleDraw(QwtPlot::yRight)->setMinimumExtent( scaleWidth );
}
Beispiel #7
0
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();
}
AllPlotInterval::AllPlotInterval(QWidget *parent, Context *context):
    QwtPlot(parent),
    bydist(false),
    context(context),
    rideItem(NULL),
    groupMatch(false)
{
    // tick draw
    //TimeScaleDraw *tsd = new TimeScaleDraw(&this->bydist) ;
    //tsd->setTickLength(QwtScaleDiv::MajorTick, 3);
    //setAxisScaleDraw(QwtPlot::xBottom, tsd);
    //pal.setColor(QPalette::WindowText, GColor(CPLOTMARKER));
    //pal.setColor(QPalette::Text, GColor(CPLOTMARKER));
    //axisWidget(QwtPlot::xBottom)->setPalette(pal);

    enableAxis(xBottom, false);
    setAxisVisible(xBottom, false);
    setAxisVisible(yLeft, false);

    tooltip = new LTMToolTip(QwtPlot::xBottom, QwtAxis::yLeft,
                                   QwtPicker::NoRubberBand,
                                   QwtPicker::AlwaysOn,
                                   canvas(),
                                   "");

    canvasPicker = new AllPlotIntervalCanvasPicker(this);

    connect(context, SIGNAL(intervalHover(IntervalItem*)), this, SLOT(intervalHover(IntervalItem*)));
    connect(canvasPicker, SIGNAL(pointHover(QwtPlotIntervalCurve*, int)), this, SLOT(intervalCurveHover(QwtPlotIntervalCurve*)));
    connect(canvasPicker, SIGNAL(pointClicked(QwtPlotIntervalCurve*,int)), this, SLOT(intervalCurveClick(QwtPlotIntervalCurve*)));
    connect(canvasPicker, SIGNAL(pointDblClicked(QwtPlotIntervalCurve*,int)), this, SLOT(intervalCurveDblClick(QwtPlotIntervalCurve*)));

    configChanged(CONFIG_APPEARANCE);
}
Beispiel #9
0
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();
}
Beispiel #10
0
Plot::Plot( QWidget *parent ):
    QwtPlot( parent)
{
    setAutoReplot( false );

    setTitle( "Animated Curves" );

    // hide all axes
    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
        enableAxis( axis, false );

    plotLayout()->setCanvasMargin( 10 );

    d_curves[0] = new Curve1();
    d_curves[1] = new Curve2();
    d_curves[2] = new Curve3();
    d_curves[3] = new Curve4();

    updateCurves();

    for ( int i = 0; i < CurveCount; i++ )
        d_curves[i]->attach( this );

    d_time.start();
    ( void )startTimer( 40 );
}
/**
 * Tworzy wykres spektrogramu.
 *
 * Przygotowuje mapowanie kolorów, skale osi we właściwych jednostkach itp.
 *
 * @param parent obiekt rodzica
 */
SpectrogramPlot::SpectrogramPlot(QWidget* parent):
    QwtPlot(tr("Wave file not loaded"), parent)
{
    spectrogram = new QwtPlotSpectrogram();
    QwtLinearColorMap colorMap(Qt::black, Qt::red);
    colorMap.addColorStop(0.3, Qt::darkBlue);
    colorMap.addColorStop(0.4, Qt::blue);
    colorMap.addColorStop(0.65, Qt::green);
    colorMap.addColorStop(0.85, Qt::yellow);
    spectrogram->setColorMap(colorMap);

    // kolorowa prawa oœś
    QwtScaleWidget *rightAxis = axisWidget(yRight);
    rightAxis->setTitle(tr("Intensity [dB]"));
    rightAxis->setColorBarEnabled(true);
    enableAxis(yRight);
    spectrogram->attach(this);
    const QFontMetrics fmRight(rightAxis->font());
    int intensityWidth = rightAxis->colorBarWidth() + fmRight.width("888 888");
    axisScaleDraw(yRight)->setMinimumExtent(intensityWidth);

    QwtPlotPanner *panner = new QwtPlotPanner(canvas());
    panner->setAxisEnabled(QwtPlot::yRight, false);
    panner->setMouseButton(Qt::MidButton);

    // dolna oś
    setAxisScaleDraw(xBottom, new DurationScaleDraw());
}
void
RealtimePlot::showAlt(int state)
{
    showAltState = state;
    altPwrCurve->setVisible(state == Qt::Checked);
    enableAxis(yLeft, showAltState == Qt::Checked || showPowerState == Qt::Checked || showPow30sState == Qt::Checked);
    replot();
}
void
RealtimePlot::showCad(int state)
{
    showCadState = state;
    cadCurve->setVisible(state == Qt::Checked);
    enableAxis(yRight, showCadState == Qt::Checked || showHrState == Qt::Checked);
    replot();
}
void
RealtimePlot::showSpeed(int state)
{
    showSpeedState = state;
    spdCurve->setVisible(state == Qt::Checked);
    enableAxis(yRight2, state == Qt::Checked);
    replot();
}
Beispiel #15
0
Plot::Plot( QWidget *parent ):
    QwtPlot( parent ),
    d_formatType( 0 ),
    d_alpha(255)
{
    d_spectrogram = new QwtPlotSpectrogram();
    d_spectrogram->setRenderThreadCount( 0 ); // use system specific thread count
    d_spectrogram->setCachePolicy( QwtPlotRasterItem::PaintCache );

    QList<double> contourLevels;
    for ( double level = 0.5; level < 10.0; level += 1.0 )
        contourLevels += level;
    d_spectrogram->setContourLevels( contourLevels );

    d_spectrogram->setData( new SpectrogramData() );
    d_spectrogram->attach( this );

    const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );

    // A color bar on the right axis
    QwtScaleWidget *rightAxis = axisWidget( QwtPlot::yRight );
    rightAxis->setTitle( "Intensity" );
    rightAxis->setColorBarEnabled( true );

    setAxisScale( QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue() );
    enableAxis( QwtPlot::yRight );

    plotLayout()->setAlignCanvasToScales( true );

    setColorMap( Plot::RGBMap );

    // LeftButton for the zooming
    // MidButton for the panning
    // RightButton: zoom out by 1
    // Ctrl+RighButton: zoom out to full size

    QwtPlotZoomer* zoomer = new MyZoomer( canvas() );
    zoomer->setMousePattern( QwtEventPattern::MouseSelect2,
        Qt::RightButton, Qt::ControlModifier );
    zoomer->setMousePattern( QwtEventPattern::MouseSelect3,
        Qt::RightButton );

    QwtPlotPanner *panner = new QwtPlotPanner( canvas() );
    panner->setAxisEnabled( QwtPlot::yRight, false );
    panner->setMouseButton( Qt::MidButton );

    // Avoid jumping when labels with more/less digits
    // appear/disappear when scrolling vertically

    const QFontMetrics fm( axisWidget( QwtPlot::yLeft )->font() );
    QwtScaleDraw *sd = axisScaleDraw( QwtPlot::yLeft );
    sd->setMinimumExtent( fm.width( "100.00" ) );

    const QColor c( Qt::darkBlue );
    zoomer->setRubberBandPen( c );
    zoomer->setTrackerPen( c );
}
Beispiel #16
0
Graph::Graph():
m_needSquareCorrection(false)
{
  setTitle("");
  setAxisTitle(QtAPI::Plot::xBottom,"");
  setAxisTitle(QtAPI::Plot::yLeft,"");
  enableAxis(QtAPI::Plot::xTop);
  enableAxis(QtAPI::Plot::yRight);
  setZoomBase();

  setRescaler(new QtAPI::ConstSizeRescaler(this));
  setXAxisScale(-10,10,false);
  setYAxisScale(-10,10,false);

  correctToSquare();

  auto circle = new GraphCircle;
  circle->attach(this);

}
Beispiel #17
0
void matrixofpixels::PixPlotSpect(int TypeOfSpec,QwtMatrixRasterData *rasterpixdata)
{
    changeitems();
    MapPlot->setData(rasterpixdata);
    MapPlot->setRenderThreadCount(0);
    setAxisAutoScale(this->xTop);
    setAxisAutoScale(this->xBottom);



    switch (TypeOfSpec)
    {
    case 1:
        MapPlot->setColorMap(new ColorMap(BLUERED));
        break;
    case 2:
        MapPlot->setColorMap(new ColorMap(BLACKWHITE));
        break;
    default:
        MapPlot->setColorMap(new ColorMap(BLUERED));
    }

    MapPlot->attach(/*MainPlot*/this);

    const QwtInterval zInterval = MapPlot->data()->interval(Qt::ZAxis);

    setAxisScale(QwtPlot::xBottom, 0, Npix);
    setAxisMaxMinor(QwtPlot::xBottom, 0);
    setAxisScale(QwtPlot::yLeft, 0, Npix);
    setAxisMaxMinor(QwtPlot::yLeft, 0);

    //rightAxis = new QwtScaleWidget();
    QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight);

    //rightAxis = axisWidget(QwtPlot::yRight);
    rightAxis->setColorBarEnabled(true);
    rightAxis->setColorBarWidth(20);
    rightAxis->setColorMap(zInterval, new ColorMap(TypeOfSpec) );
    //ColorMap(TypeOfSpec);

    plotLayout()->setAlignCanvasToScales(true);

    setAxisScale(QwtPlot::yRight,zInterval.minValue(),zInterval.maxValue());
    enableAxis(QwtPlot::yRight);
    replot();
    setAutoFillBackground(true);

    /**
      setAutoFillBackground(true); - autozapolnenie, ctobi isklyuchit'
    nalozjeniya graphikov
    */

}
Beispiel #18
0
/*** PUBLIC ***/
ScoreDistribution::ScoreDistribution(QWidget *parent)
    : QwtPlot(parent)
    , qppPicker(canvas())
{
    axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
    enableAxis(QwtPlot::xBottom, false);
    enableAxis(QwtPlot::yLeft, false);
    setAutoReplot(true);
    setFrameShadow(QFrame::Sunken);
    setFrameStyle(QFrame::StyledPanel);

    QPen impostorPen; impostorPen.setColor(QColor(228, 26, 28, 240)); impostorPen.setWidth(2);
    qpcImpostor.setPen(impostorPen);
    qpcImpostor.setBrush(QColor(228, 26, 28, 180));
    qpcImpostor.setRenderHint(QwtPlotItem::RenderAntialiased);
    qpcImpostor.attach(this);

    QPen genuinePen; genuinePen.setColor(QColor(55, 126, 184, 240)); genuinePen.setWidth(2);
    qpcGenuine.setPen(genuinePen);
    qpcGenuine.setBrush(QColor(55, 126, 184, 180));
    qpcGenuine.setRenderHint(QwtPlotItem::RenderAntialiased);
    qpcGenuine.attach(this);

    QPen livePen; livePen.setColor(QColor(152, 78, 163, 200)); livePen.setWidth(4);
    qpcLive.setPen(livePen);
    qpcLive.setStyle(QwtPlotCurve::Dots);
    qpcLive.setRenderHint(QwtPlotItem::RenderAntialiased);
    qpcLive.attach(this);

    QPen pen; pen.setColor(QColor(77, 175, 74)); pen.setWidth(2);
    qpmMarker.setLinePen(pen);
    qpmMarker.setLineStyle(QwtPlotMarker::VLine);
    qpmMarker.setRenderHint(QwtPlotItem::RenderAntialiased);
    qpmMarker.attach(this);

    qppPicker.setStateMachine(new QwtPickerDragPointMachine());
    connect(&qppPicker, SIGNAL(selected(QPointF)), this, SLOT(selected(QPointF)));
    connect(&qppPicker, SIGNAL(moved(QPointF)), this, SLOT(selected(QPointF)));
}
Beispiel #19
0
Lineplot::Lineplot(QWidget *parent)
  :QwtPlot(parent)
  ,xMin_(0)
  ,xMax_(0)
{
  counter_ = 0;
  numPoints_ = 1;
  indexPoints_ = new double[numPoints_];
  dataPoints_ = new double[numPoints_];

  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

  QPalette palette;
  palette.setColor(canvas()->backgroundRole(), QColor("white"));
  canvas()->setPalette(palette);

  curve_ = new QwtPlotCurve("Curve");
  curve_->setPen(QPen(Qt::blue, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  curve_->setStyle(QwtPlotCurve::Lines);
  curve_->setRawSamples(indexPoints_, dataPoints_, numPoints_);
  curve_->setYAxis(QwtPlot::yLeft);
  curve_->attach(this);

  memset(dataPoints_, 0x0, numPoints_*sizeof(double));
  for(int i=0;i<numPoints_;i++)
    indexPoints_[i] = i;

  enableAxis(QwtPlot::yRight);
  QwtScaleWidget *leftAxis = axisWidget(QwtPlot::yLeft);
  connect(leftAxis, SIGNAL(scaleDivChanged()), this, SLOT(linkScales()));

  setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine);
  setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
  setAxisScaleEngine(QwtPlot::yRight, new QwtLinearScaleEngine);

  axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating,true);
  axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating,true);
  axisScaleEngine(QwtPlot::yRight)->setAttribute(QwtScaleEngine::Floating,true);

  zoomer_ = new MyZoomer(canvas());
  zoomer_->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
  zoomer_->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton,
                           Qt::ControlModifier);

  panner_ = new QwtPlotPanner(canvas());
  panner_->setMouseButton(Qt::RightButton);

  magnifier_ = new QwtPlotMagnifier(canvas());
  magnifier_->setMouseButton(Qt::NoButton);

}
Beispiel #20
0
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();
}
Beispiel #21
0
MainWindow::MainWindow():
    PlotMatrix(3, 4)
{
    enableAxis(QwtPlot::yLeft);
    enableAxis(QwtPlot::yRight);
    enableAxis(QwtPlot::xBottom);

    for ( int row = 0; row < numRows(); row++ )
    {
        const double v = qPow(10.0, row);
        setAxisScale(QwtPlot::yLeft, row, -v, v);
        setAxisScale(QwtPlot::yRight, row, -v, v);
    }

    for ( int col = 0; col < numColumns(); col++ )
    {
        const double v = qPow(10.0, col);
        setAxisScale(QwtPlot::xBottom, col, -v, v);
        setAxisScale(QwtPlot::xTop, col, -v, v);
    }

    for ( int row = 0; row < numRows(); row++ )
    {
        for ( int col = 0; col < numColumns(); col++ )
        {
            QwtPlot *plt = plot(row, col);
            plt->setCanvasBackground(QColor(Qt::darkBlue));

            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(plt);
        }
    }
}
void Spectrogramplot::setZAxisScale(double zMin, double zMax)
{
  zMin_ = zMin;
  zMax_ = zMax;
  data_->setInterval( Qt::ZAxis, QwtInterval( zMin_, zMax_ ) );

  //Set up the intensity bar on the right
  const QwtInterval zInterval = spectrogram_->data()->interval( Qt::ZAxis );
  QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight);
  rightAxis->setColorBarEnabled(true);
  rightAxis->setColorMap( zInterval, new ColorMap());
  setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue() );
  enableAxis(QwtPlot::yRight);

  plotLayout()->setAlignCanvasToScales(true);
  replot();
}
Beispiel #23
0
Plot::Plot( QWidget *parent ):
    QwtPlot( parent )
{
    QwtPlotCanvas *canvas = new QwtPlotCanvas();
    canvas->setBorderRadius( 10 );
    setCanvas( canvas );

#if 0
    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->setPen( Qt::DotLine );
    grid->attach( this );
#endif

    d_spectrogram = new QwtPlotSpectrogram();
    d_spectrogram->setRenderThreadCount( 0 ); // use system specific thread count

    d_spectrogram->setColorMap( new ColorMap() );

    d_spectrogram->setData( new RasterData() );
    d_spectrogram->attach( this );

    const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
    // A color bar on the right axis
    QwtScaleWidget *rightAxis = axisWidget( QwtPlot::yRight );
    rightAxis->setColorBarEnabled( true );
    rightAxis->setColorBarWidth( 40 );
    rightAxis->setColorMap( zInterval, new ColorMap() );

    setAxisScale( QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue() );
    enableAxis( QwtPlot::yRight );

    plotLayout()->setAlignCanvasToScales( true );

    setAxisScale( QwtPlot::xBottom, 0.0, 3.0 );
    setAxisMaxMinor( QwtPlot::xBottom, 0 );
    setAxisScale( QwtPlot::yLeft, 0.0, 3.0 );
    setAxisMaxMinor( QwtPlot::yLeft, 0 );

    QwtPlotMagnifier *magnifier = new QwtPlotMagnifier( canvas );
    magnifier->setAxisEnabled( QwtPlot::yRight, false );

    QwtPlotPanner *panner = new QwtPlotPanner( canvas );
    panner->setAxisEnabled( QwtPlot::yRight, false );
}
Beispiel #24
0
EEGPlot::EEGPlot(int channelId, QWidget *parent, const QObject* sender,
				 const char* dataSignal, unsigned int numChannels)
	: QwtPlot(parent)
	, m_channelId(channelId)
	, m_firstPacket(true)
	, m_numChannels(numChannels)
{
	setAutoReplot(false);

	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	CENT::connect(sender, dataSignal, this, SLOT(dataReceived(CentData::AnalogData)));

	m_curve = new QwtPlotCurve("signal channel");
	m_curve->setStyle(QwtPlotCurve::Lines);
	m_curve->setPen(QPen(Qt::darkBlue));

	m_curve->setRenderHint(QwtPlotItem::RenderAntialiased, false);
	m_curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true);
	
	m_arraySeriesData = new ArraySeriesData();
	m_curve->setData(m_arraySeriesData);
	m_curve->attach(this);

	// Canvas
	setCanvasBackground(QBrush(Qt::white));

	// Axes
	enableAxis(QwtPlot::yLeft, true);
	setAxisTitle(QwtPlot::yLeft, Y_AXIS_TEXT);
	setAxisAutoScale(QwtPlot::yLeft, true);
	setAxisScaleDraw(QwtPlot::yLeft, new IntegerScaleDraw);


	setAxisAutoScale(QwtPlot::xBottom, false);
	QwtText xText(tr(X_AXIS_TEXT_LOC));
	setAxisTitle(QwtPlot::xBottom, xText);

	CENT::connect(&m_redrawTimer, SIGNAL(timeout()), this, SLOT(replotManual()));
	m_redrawTimer.setInterval(200);
	m_redrawTimer.start();
}
Beispiel #25
0
/* ------- Вкл/Выкл Оси ------- */
void PlotZoz::setAxisEnableForAll(bool b)
{
    for (int i=0; i<4; i++)
        enableAxis(i,b);
}
Beispiel #26
0
Plot::Plot (QString name, QWidget *p) : QwtPlot (p)
{
    //TODO
    high = 0;
    low = 0;
  destroying = false;
    //PlotSettings
  _plotSettings.name = name;
  _plotSettings.spacing = 4;
  _plotSettings.high = 0;
  _plotSettings.low = 0;
  _plotSettings.startPos = -1;
  _plotSettings.endPos = -1;
  _plotSettings.selected = 0;
  _plotSettings.antiAlias = TRUE;
  _plotSettings.barLength = BarLength::_DAILY;
  _plotSettings.status = PlotStatus::_NONE;
  _plotSettings.info = TRUE;

  mpage = 360; //default

  setMinimumHeight(20);

  setCanvasBackground(QColor(Qt::black));
  setMargin(0);
  enableAxis(QwtPlot::yRight, TRUE);
  enableAxis(QwtPlot::yLeft, FALSE);

  // add custom date scale drawing class to plot
  _dateScaleDraw = new PlotDateScaleDraw;
  setAxisScaleDraw(QwtPlot::xBottom, _dateScaleDraw);

  // add custom date scale drawing class to plot
  _plotScaleDraw = new PlotScaleDraw;
  setAxisScaleDraw(QwtPlot::yRight, _plotScaleDraw);

  _grid = new QwtPlotGrid;
//  _grid->enableXMin(FALSE);
  _grid->enableX(FALSE);
  _grid->enableYMin(FALSE);
  _grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
  _grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
  _grid->setYAxis(QwtPlot::yRight);
  _grid->attach(this);

  // try to set the scale width to a sane size to keep plots aligned
  QwtScaleWidget *sw = axisWidget(QwtPlot::yRight);
  sw->scaleDraw()->setMinimumExtent(60);

  // setup the mouse events handler
  _picker = new PlotPicker(this);
  connect(_picker, SIGNAL(signalMouseMove(QPoint)), this, SLOT(mouseMove(QPoint)));
  connect(_picker, SIGNAL(signalMouseClick(int, QPoint)), this, SLOT(mouseClick(int, QPoint)));
  connect(_picker, SIGNAL(signalMouseDoubleClick(int, QPoint)), this, SLOT(mouseDoubleClick(int, QPoint)));
//  connect(_picker, SIGNAL(signalMouseRelease(int, QPoint)), this, SLOT(mouseRelease(int, QPoint)));

  // setup the context menu
  createMenu();
  
//  grabGesture(Qt::TapAndHoldGesture);
//  grabGesture(Qt::SwipeGesture);

  _plotInfo = new PlotInfo;
  _plotInfo->attach(this);
}
Beispiel #27
0
void Plot::showDate (bool d)
{
  enableAxis(QwtPlot::xBottom, d);
}
Plot::Plot(QWidget *parent):
    QwtPlot(parent)
{
    d_spectrogram = new QwtPlotSpectrogram();

    QwtLinearColorMap colorMap(Qt::darkCyan, Qt::red);
    colorMap.addColorStop(0.1, Qt::cyan);
    colorMap.addColorStop(0.6, Qt::green);
    colorMap.addColorStop(0.95, Qt::yellow);

    d_spectrogram->setColorMap(colorMap);

    d_spectrogram->setData(SpectrogramData());
    d_spectrogram->attach(this);

    QwtValueList contourLevels;
    for ( double level = 0.5; level < 10.0; level += 1.0 )
        contourLevels += level;
    d_spectrogram->setContourLevels(contourLevels);

    QwtScaleWidget *rightAxis = axisWidget(QwtPlot::yRight);
    rightAxis->setTitle("Intensity");
    rightAxis->setColorBarEnabled(true);
    rightAxis->setColorMap(d_spectrogram->data().range(),
        d_spectrogram->colorMap());

    setAxisScale(QwtPlot::yRight, 
        d_spectrogram->data().range().minValue(),
        d_spectrogram->data().range().maxValue() );
    enableAxis(QwtPlot::yRight);

    plotLayout()->setAlignCanvasToScales(true);
    replot();

    // 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());
#if QT_VERSION < 0x040000
    zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
        Qt::RightButton, Qt::ControlButton);
#else
    zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
        Qt::RightButton, Qt::ControlModifier);
#endif
    zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
        Qt::RightButton);

    QwtPlotPanner *panner = new QwtPlotPanner(canvas());
    panner->setAxisEnabled(QwtPlot::yRight, false);
    panner->setMouseButton(Qt::MidButton);

    // Avoid jumping when labels with more/less digits
    // appear/disappear when scrolling vertically

    const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
    QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
    sd->setMinimumExtent( fm.width("100.00") );

    const QColor c(Qt::darkBlue);
    zoomer->setRubberBandPen(c);
    zoomer->setTrackerPen(c);
}
Beispiel #29
0
//---------------------------------------------------------------------------
Plot::Plot( size_t streamPos, size_t Type, size_t Group, QWidget *parent ) :
    QwtPlot( parent ),
    m_streamPos( streamPos ),
    m_type( Type ),
    m_group( Group )
{
    setAutoReplot( false );

    QwtPlotCanvas* canvas = dynamic_cast<QwtPlotCanvas*>( this->canvas() );
    if ( canvas )
    {
        canvas->setFrameStyle( QFrame::Plain | QFrame::Panel );
        canvas->setLineWidth( 1 );
#if 1
        canvas->setPalette( QColor("Cornsilk") );
#endif
    }

    setAxisMaxMajor( QwtPlot::yLeft, 0 );
    setAxisMaxMinor( QwtPlot::yLeft, 0 );
    setAxisScaleDraw( QwtPlot::yLeft, new PlotScaleDrawY() );

    enableAxis( QwtPlot::xBottom, false );

    // something invalid
    setAxisScale( QwtPlot::xBottom, -1, 0 );
    setAxisScale( QwtPlot::yLeft, -1, 0 );

    // Plot grid
    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->enableXMin( true );
    grid->enableYMin( true );
    grid->setMajorPen( Qt::darkGray, 0, Qt::DotLine );
    grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
    grid->attach( this );

    m_cursor = new PlotCursor( canvas );
    m_cursor->setPosition( 0 );

    // curves

    for( unsigned j = 0; j < PerStreamType[m_type].PerGroup[m_group].Count; ++j )
    {
        QwtPlotCurve* curve = new QwtPlotCurve( PerStreamType[m_type].PerItem[PerStreamType[m_type].PerGroup[m_group].Start + j].Name );

        curve->setPen( curveColor( j ) );
        curve->setRenderHint( QwtPlotItem::RenderAntialiased );
        curve->setZ( curve->z() - j ); //Invert data order (e.g. MAX before MIN)
        curve->attach( this );

        m_curves += curve;
    }

    // visual helpers
    if ( m_type == Type_Video )
    switch (m_group)
    {
        case Group_Y :
                        Plot_AddHLine( this,  16,  61,  89, 171);
                        Plot_AddHLine( this, 235, 220,  20,  60);
                        break;
        case Group_U :
        case Group_V :
                        Plot_AddHLine( this,  16,  61,  89, 171);
                        Plot_AddHLine( this, 240, 220,  20,  60);
                        break;
        case Group_Sat :
                        Plot_AddHLine( this,  88, 255,   0, 255);
                        Plot_AddHLine( this, 118, 220,  20,  60);
                        break;
        default      :  ;  
    }

    PlotPicker* picker = new PlotPicker( canvas, &PerStreamType[m_type], m_group, &m_curves );
    connect( picker, SIGNAL( moved( const QPointF& ) ), SLOT( onPickerMoved( const QPointF& ) ) );
    connect( picker, SIGNAL( selected( const QPointF& ) ), SLOT( onPickerMoved( const QPointF& ) ) );

    connect( axisWidget( QwtPlot::xBottom ), SIGNAL( scaleDivChanged() ), SLOT( onXScaleChanged() ) );

    // legend
    m_legend = new PlotLegend();
    
    connect( this, SIGNAL( legendDataChanged( const QVariant &, const QList<QwtLegendData> & ) ),
         m_legend, SLOT( updateLegend( const QVariant &, const QList<QwtLegendData> & ) ) );

    updateLegend();
}
Beispiel #30
0
Plot::Plot( QWidget *parent ):
    QwtPlot( parent )
{
    setAutoReplot( false );

    setTitle( "Frequency Response of a Second-Order System" );

    QwtPlotCanvas *canvas = new QwtPlotCanvas();
    canvas->setBorderRadius( 10 );

    setCanvas( canvas );
    setCanvasBackground( QColor( "MidnightBlue" ) );

    // 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, "Normalized Frequency" );
    setAxisTitle( QwtPlot::yLeft, "Amplitude [dB]" );
    setAxisTitle( QwtPlot::yRight, "Phase [deg]" );

    setAxisMaxMajor( QwtPlot::xBottom, 6 );
    setAxisMaxMinor( QwtPlot::xBottom, 9 );
    setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine );

    // curves
    d_curve1 = new QwtPlotCurve( "Amplitude" );
    d_curve1->setRenderHint( QwtPlotItem::RenderAntialiased );
    d_curve1->setPen( Qt::yellow );
    d_curve1->setLegendAttribute( QwtPlotCurve::LegendShowLine );
    d_curve1->setYAxis( QwtPlot::yLeft );
    d_curve1->attach( this );

    d_curve2 = new QwtPlotCurve( "Phase" );
    d_curve2->setRenderHint( QwtPlotItem::RenderAntialiased );
    d_curve2->setPen( Qt::cyan );
    d_curve2->setLegendAttribute( QwtPlotCurve::LegendShowLine );
    d_curve2->setYAxis( QwtPlot::yRight );
    d_curve2->attach( this );

    // marker
    d_marker1 = new QwtPlotMarker();
    d_marker1->setValue( 0.0, 0.0 );
    d_marker1->setLineStyle( QwtPlotMarker::VLine );
    d_marker1->setLabelAlignment( Qt::AlignRight | Qt::AlignBottom );
    d_marker1->setLinePen( Qt::green, 0, Qt::DashDotLine );
    d_marker1->attach( this );

    d_marker2 = new QwtPlotMarker();
    d_marker2->setLineStyle( QwtPlotMarker::HLine );
    d_marker2->setLabelAlignment( Qt::AlignRight | Qt::AlignBottom );
    d_marker2->setLinePen( QColor( 200, 150, 0 ), 0, Qt::DashDotLine );
    d_marker2->setSymbol( new QwtSymbol( QwtSymbol::Diamond,
        QColor( Qt::yellow ), QColor( Qt::green ), QSize( 8, 8 ) ) );
    d_marker2->attach( this );

    setDamp( 0.0 );

    setAutoReplot( true );
}