コード例 #1
1
ファイル: castripplot.cpp プロジェクト: boiarino17/epics
void caStripPlot::setAxis(double interval, double period)
{
    // set axis and in case of a time scale define the time axis
    if(thisXaxisType == TimeScale) {
        QTime timeNow= QTime::currentTime();
        timeNow = timeNow.addSecs((int) -interval);
        setAxisScale(QwtPlot::xBottom, 0, interval);
        setAxisScaleDraw ( QwtPlot::xBottom, new TimeScaleDraw (timeNow) );
    } else {
        setAxisScale(QwtPlot::xBottom, -period, 0);
        setAxisScaleDraw(QwtPlot::xBottom, new QwtScaleDraw());
    }
}
コード例 #2
0
OdomPlot::OdomPlot(QWidget *parent)
   : DataPlot(parent) {
   for (int i = 0; i < PLOT_SIZE; ++i){
      motionData[i] = 0.0; visionData[i] = 0.0; combinedData[i] = 0.0;
   }
   for (int i = 0; i < PLOT_SIZE-1; ++i){
      motionDiff[i] = 0.0; visionDiff[i] = 0.0; combinedDiff[i] = 0.0;
   }
   setTitle("Odometry turn");

   QwtPlotCurve *fcurve = new QwtPlotCurve("Vision");
   fcurve->attach(this);
   fcurve->setRawData(t, visionDiff, PLOT_SIZE-1);
   fcurve->setPen(QPen(Qt::red));

   QwtPlotCurve *rcurve = new QwtPlotCurve("Motion");
   rcurve->attach(this);
   rcurve->setRawData(t, motionDiff, PLOT_SIZE-1);
   rcurve->setPen(QPen(Qt::blue));

   QwtPlotCurve *vcurve = new QwtPlotCurve("Combined");
   vcurve->attach(this);
   vcurve->setRawData(t, combinedDiff, PLOT_SIZE-1);
   vcurve->setPen(QPen(Qt::green));
   
   setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 2);
   setAxisScale(QwtPlot::yLeft, -10, 10);
}
コード例 #3
0
CoronalZMPPlot::CoronalZMPPlot(QWidget *parent)
   : DataPlot(parent) {
   for (int i = 0; i < PLOT_SIZE; ++i) {
      data_l[i] = 0.0;
      data_r[i] = 0.0;
      data_t[i] = 0.0;
   }
   setTitle("Coronal Plane");

   QwtPlotCurve *curveL = new QwtPlotCurve("Left");
   curveL->attach(this);
   curveL->setRawData(t, data_l, PLOT_SIZE);
   curveL->setPen(QPen(Qt::red));

   QwtPlotCurve *curveR = new QwtPlotCurve("Right");
   curveR->attach(this);
   curveR->setRawData(t, data_r, PLOT_SIZE);
   curveR->setPen(QPen(Qt::blue));

   QwtPlotCurve *curveT = new QwtPlotCurve("Total");
   curveT->attach(this);
   curveT->setRawData(t, data_t, PLOT_SIZE);

   setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 1);
   setAxisScale(QwtPlot::yLeft, -100, 100);
}
コード例 #4
0
//changing to angle x comparison plot
FsrPlot::FsrPlot(QWidget *parent)
   : DataPlot(parent) {
   for (int i = 0; i < PLOT_SIZE; ++i)
      data_r2[i] = data_l[i] = data_r[i] = data_t[i] = 0.0;
   setTitle("angleX");

   QwtPlotCurve *curveL = new QwtPlotCurve("filtered angleX");
   curveL->attach(this);
   curveL->setRawData(t, data_l, PLOT_SIZE);
   curveL->setPen(QPen(Qt::red));

   QwtPlotCurve *curveR = new QwtPlotCurve("raw angleX");
   curveR->attach(this);
   curveR->setRawData(t, data_r, PLOT_SIZE);
   curveR->setPen(QPen(Qt::blue));

//   QwtPlotCurve *curveR2 = new QwtPlotCurve("Right2");
//   curveR2->attach(this);
//   curveR2->setRawData(t, data_r2, PLOT_SIZE);
//   curveR2->setPen(QPen(Qt::black));

//   QwtPlotCurve *curveT = new QwtPlotCurve("Total");
//   curveT->attach(this);
//   curveT->setRawData(t, data_t, PLOT_SIZE);

   setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 1);
   setAxisScale(QwtPlot::yLeft, -12, 12);
}
コード例 #5
0
QwtPlotSpectrogram * PlotViewWidget::addSpectrogramData(SpectrogramData *spectrogramData)
{
    QwtPlotSpectrogram *spectrogram = new QwtPlotSpectrogram();
    spectrogram->setRenderThreadCount( 0 ); // use system specific thread count

    QwtLinearColorMap * colorMap = new QwtLinearColorMap(Qt::white, Qt::black);
    spectrogram->setColorMap(colorMap);

    spectrogram->setCachePolicy( QwtPlotRasterItem::PaintCache );
    spectrogram->setData( spectrogramData );

    QRectF r = spectrogramData->boundingRect();
    setAxisScale( QwtPlot::yLeft , 0, 5000, 1000);
    setAxisScale( QwtPlot::yRight , 0, 5000, 1000);
    setAxisScale( QwtPlot::xBottom , r.left(), r.right(), 0.1);

    spectrogram->setDisplayMode( QwtPlotSpectrogram::ImageMode, true );
    spectrogram->setAlpha(100);

    maSpectrogramData << spectrogramData;

    maSpectrograms << spectrogram;
    spectrogram->attach( this );
    repaint();

    return spectrogram;
}
コード例 #6
0
ファイル: plot.cpp プロジェクト: volthouse/desktop
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);
    }
}
コード例 #7
0
IncrementalPlot::IncrementalPlot( QWidget *parent ):
    QwtPlot( parent ),
    d_curve( NULL )
{
    d_directPainter = new QwtPlotDirectPainter( this );

    setCanvasBackground(QColor(Qt::black));
    setAxisScale(QwtPlot::yLeft, 0, 1024);
    setAxisScale(QwtPlot::xBottom, 0, 5000);

    if ( QwtPainter::isX11GraphicsSystem() )
    {
#if QT_VERSION < 0x050000
        canvas()->setAttribute( Qt::WA_PaintOutsidePaintEvent, true );
#endif
        canvas()->setAttribute( Qt::WA_PaintOnScreen, true );
    }

    d_curve = new QwtPlotCurve( "Test Curve" );
    d_curve->setData( new CurveData() );
    showSymbols( true );

    d_curve->attach( this );

    setAutoReplot( false );
}
コード例 #8
0
ファイル: plot.cpp プロジェクト: volthouse/desktop
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);

}
コード例 #9
0
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
}
コード例 #10
0
ファイル: plot.cpp プロジェクト: gibbogle/bone-abm
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
void Plot::redraw(double *x, double *y, int n, QString name)
{
	if (n == 1) { // That is, this is the first plotting instance.
        yscale = max(yscale,calc_yscale(y[0]));
		setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
	}
	// Note: Number of pen colors should match ncmax
	QColor pencolor[] = {Qt::black, Qt::red, Qt::blue, Qt::darkGreen, Qt::magenta, Qt::darkCyan };
	QPen *pen = new QPen();
	QwtLegend *legend = new QwtLegend();
	for (int k=0; k<ncmax; k++) {
		if (curve[k] == 0) continue;
		if (name.compare(curve[k]->title().text()) == 0) {
			// Just in case someone set ncmax > # of pen colors (currently = 6)
			if (k < 6) {
				pen->setColor(pencolor[k]);
			} else {
				pen->setColor(pencolor[0]);
			}
			curve[k]->setPen(*pen);
			curve[k]->setData(x, y, n);
			this->insertLegend(legend, QwtPlot::RightLegend);
			double ylast = y[n-1];
			if (ylast > yscale) {
				yscale = max(yscale,calc_yscale(ylast));
				setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
			}
			replot();
		}
	}
	delete pen;
}
コード例 #11
0
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();
}
コード例 #12
0
ファイル: sinusplot.cpp プロジェクト: albore/pandora
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();
}
コード例 #13
0
ファイル: plot.cpp プロジェクト: gibbogle/trophocell3D-abm
//-----------------------------------------------------------------------------------------
// This is to plot the total number of cognate cells (y2 = ytotal), and the number of 
// "seed" cells (y1 = yseed)
//-----------------------------------------------------------------------------------------
void Plot::redraw2(double *x1, double *y1, double *x2, double *y2, int n1, int n2)
{
	LOG_MSG("redraw2");
	if (n1 == 1) { // That is, this is the first plotting instance.
        yscale = max(yscale,calc_yscale_ts(y1[0]));
        yscale = max(yscale,calc_yscale_ts(y2[0]));
		setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
	}
    curve[0]->setData(x1, y1, n1);
    curve[1]->setData(x2, y2, n2);
	QPen *pen = new QPen();
	pen->setColor(Qt::red);
	curve[1]->setPen(*pen);
	delete pen;
	this->insertLegend(&QwtLegend(), QwtPlot::RightLegend);
	double ylast = y1[n1-1];
	double ylast2 = y2[n2-1];
	if (ylast2 > ylast) {
		ylast = ylast2;
	}
	if (ylast > yscale) {
        yscale = calc_yscale_ts(ylast);
		setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
	}
    replot();
}
コード例 #14
0
ファイル: randomplot.cpp プロジェクト: albore/pandora
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());
}
コード例 #15
0
ファイル: plot.cpp プロジェクト: BryanF1947/GoldenCheetah
void Plot::rescale()
{
    setAxisScale(QwtPlot::xBottom,
        d_mapRect.left(), d_mapRect.right());
    setAxisScale(QwtPlot::yLeft,
        d_mapRect.top(), d_mapRect.bottom());
}
コード例 #16
0
ファイル: matrixofpixels.cpp プロジェクト: elkinvg/prmpixread
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();
}
コード例 #17
0
ファイル: plot.cpp プロジェクト: Spinetta/qwt
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 );
}
コード例 #18
0
ファイル: EEGPlot.cpp プロジェクト: CBRUhelsinki/CENTplatform
void EEGPlot::replotManual()
{
	m_arraySeriesData->lockMutex();
	setAxisScale(QwtPlot::yLeft,m_arraySeriesData->minimumY(), m_arraySeriesData->maximumY(), m_arraySeriesData->maximumY()/4);
	setAxisScale(QwtPlot::xBottom,m_arraySeriesData->minimumX(), m_arraySeriesData->maximumX(),1.0);
	replot();
	m_arraySeriesData->unLockMutex();
}
コード例 #19
0
ファイル: basicplot.cpp プロジェクト: RTXI/plot-lib
void
BasicPlot::setAxes(double xmin, double xmax, double ymin, double ymax)
{
  setAxisScale(xBottom, xmin, xmax);
  setAxisScale(yLeft, ymin, ymax);
  replot();
  // set zoomer to new axes limits
  emit setNewBase(axisScaleDiv(QwtPlot::xBottom), axisScaleDiv(QwtPlot::yLeft));
}
コード例 #20
0
ファイル: zoomplot.cpp プロジェクト: marras/FCS-analyzer
void ZoomPlot :: ZoomIn (double from_x, double from_y, double to_x, double to_y) {
  std::cout << "Zooming from "<<from_x<<","<<from_y<<" to "<<to_x<<","<<to_y<<std::endl;

  if (from_x > to_x) swap (from_x, to_x);
  if (from_y > to_y) swap (from_y, to_y);

  setAxisScale (xBottom, from_x, to_x);
  setAxisScale (yLeft, from_y, to_y);
  replot();
}
コード例 #21
0
ファイル: plot.cpp プロジェクト: PrincetonPAVE/old_igvc
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);
}
コード例 #22
0
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();
}
コード例 #23
0
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();
}
コード例 #24
0
SurfPlot::SurfPlot(QWidget *parent)
   : DataPlot(parent) {
   for (int i = 0; i < SURF_PLOT_SIZE; ++i)
      data[i] = 0.0;
   setTitle("Surf landmark matching score");

   QwtPlotCurve *curve = new QwtPlotCurve("Surf");
   curve->attach(this);
   curve->setRawData(t, data, SURF_PLOT_SIZE);
   setAxisScale(QwtPlot::xBottom, 0, SURF_PLOT_SIZE - 1);
   setAxisScale(QwtPlot::yLeft, 0, 2000);
}
コード例 #25
0
ファイル: plotzoz.cpp プロジェクト: Kansept/SanPasport
void PlotZoz::setGridStep(const int Step)
{               
    setAxisScale(QwtPlot::yLeft,
                 int(pltRasterData->interval(Qt::YAxis).minValue()),
                 int(pltRasterData->interval(Qt::YAxis).maxValue()),
                 Step );

    setAxisScale(QwtPlot::xBottom,
                 int(pltRasterData->interval(Qt::XAxis).minValue()),
                 int(pltRasterData->interval(Qt::XAxis).maxValue()),
                 Step );
}
コード例 #26
0
COMyPlot::COMyPlot(QWidget *parent)
   : XYZPlot(parent) {
   for (int i = 0; i < PLOT_SIZE; ++i)
      data[i] = 0.0;
   setTitle("COM relative to foot touching ground y");

   QwtPlotCurve *curve = new QwtPlotCurve("COMy");
   curve->attach(this);
   curve->setRawData(t, data, PLOT_SIZE);
   setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 1);
   setAxisScale(QwtPlot::yLeft, -100, 100);
}
コード例 #27
0
ファイル: matrixofpixels.cpp プロジェクト: elkinvg/prmpixread
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
    */

}
コード例 #28
0
SagittalZMPPlot::SagittalZMPPlot(QWidget *parent)
   : DataPlot(parent) {
   for (int i = 0; i < PLOT_SIZE; ++i)
      data[i] = 0.0;
   setTitle("Sagittal Plane");

   QwtPlotCurve *curve = new QwtPlotCurve("SagittalZMP");
   curve->attach(this);
   curve->setRawData(t, data, PLOT_SIZE);
   setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 1);
   setAxisScale(QwtPlot::yLeft, -100, 100);
}
コード例 #29
0
SonarPlot::SonarPlot(QWidget *parent)
   : DataPlot(parent) {
   for (int i = 0; i < PLOT_SIZE; ++i)
      for (int j = 0; j < 10; ++j)
         data[j][i] = 0.0;
   setTitle("Sonar");

   QwtPlotCurve *curve = new QwtPlotCurve("Sonar");
   curve->attach(this);
   curve->setRawData(t, data[0], PLOT_SIZE);
   setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 1);
   setAxisScale(QwtPlot::yLeft, 0, 2.55);
}
コード例 #30
0
ファイル: dataplot.cpp プロジェクト: ndtmike/Aggralinx
void DataPlot::displayGraph(const QVector<QPointF>& points)
{
    setAxisScale(QwtPlot::yLeft, minAxisScale(), maxY(points));
    setAxisScale(QwtPlot::xBottom, minAxisScale(), maxX(points));
    Curve->setSamples( points );
    Curve->attach(this);

    createRegLine(plotDataPoints);

    resize( 1200, 800 );
    replot();
    show();
    setFocus();
}