当前位置: 首页>>代码示例>>C++>>正文


C++ plotLayout函数代码示例

本文整理汇总了C++中plotLayout函数的典型用法代码示例。如果您正苦于以下问题:C++ plotLayout函数的具体用法?C++ plotLayout怎么用?C++ plotLayout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了plotLayout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QCustomPlot

PlotterWidget::PlotterWidget(QWidget *parent): QCustomPlot(parent), m_main_scale(0), m_plots_container(0)
{
    //clear the layout
    plotLayout()->clear(); //clear all

    /// a main scale object at LEFT
    m_main_scale = new  MainScale(this);
    plotLayout()->addElement(0,0,m_main_scale);

    /// an area with plots at RIGHT
    m_plots_container = new PlotsContainer();
    plotLayout()->addElement(0,1, m_plots_container);

    /// a group for aligning graphs
    m_group = new QCPMarginGroup(this);
    getMainAxisRect()->setMarginGroup(QCP::msTop|QCP::msBottom, m_group);

    setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables | QCP::iSelectAxes );

//    SinglePlot * sp =  new SinglePlot(this);

//    spc::ContinousValuesLog * log =  new spc::ContinousValuesLog;
//    log->resize(100);
//    for(int i = 0 ; i < log->size(); ++i)
//        log->setValue(i, i);

//    sp->updateDataWith(log);
//    addSinglePlot(sp);

    replot();

}
开发者ID:luca-penasa,项目名称:vombat,代码行数:32,代码来源:PlotterWidget.cpp

示例2: QCustomPlot

DrawInteraction::DrawInteraction(QWidget *parent) :
    QCustomPlot(parent)
{
    resize(600,400);

    statusBar = new QStatusBar(this);

    srand(QDateTime::currentDateTime().toTime_t());

    setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
                                      QCP::iSelectLegend | QCP::iSelectPlottables);
    xAxis->setRange(-8, 8);
    yAxis->setRange(-5, 5);
    axisRect()->setupFullAxesBox();

    plotLayout()->insertRow(0);
    plotLayout()->addElement(0, 0, new QCPPlotTitle(this, "Interaction Example"));

    xAxis->setLabel("x Axis");
    yAxis->setLabel("y Axis");
    legend->setVisible(true);
    QFont legendFont = font();
    legendFont.setPointSize(10);
    legend->setFont(legendFont);
    legend->setSelectedFont(legendFont);
    legend->setSelectableParts(QCPLegend::spItems); // legend box shall not be selectable, only legend items

    addRandomGraph();
    addRandomGraph();
    addRandomGraph();
    addRandomGraph();

    // connect slot that ties some axis selections together (especially opposite axes):
    connect(this, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
    // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
    connect(this, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
    connect(this, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));

    // make bottom and left axes transfer their ranges to top and right axes:
    connect(xAxis, SIGNAL(rangeChanged(QCPRange)), xAxis2, SLOT(setRange(QCPRange)));
    connect(yAxis, SIGNAL(rangeChanged(QCPRange)), yAxis2, SLOT(setRange(QCPRange)));

    // connect some interaction slots:
    connect(this, SIGNAL(titleDoubleClick(QMouseEvent*,QCPPlotTitle*)), this, SLOT(titleDoubleClick(QMouseEvent*,QCPPlotTitle*)));
    connect(this, SIGNAL(axisDoubleClick(QCPAxis*,QCPAxis::SelectablePart,QMouseEvent*)), this, SLOT(axisLabelDoubleClick(QCPAxis*,QCPAxis::SelectablePart)));
    connect(this, SIGNAL(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*,QMouseEvent*)), this, SLOT(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*)));

    // connect slot that shows a message in the status bar when a graph is clicked:
    connect(this, SIGNAL(plottableClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*)));

    // setup policy and connect slot for context menu popup:
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint)));
}
开发者ID:mayqiren,项目名称:QCustomPlotLearning,代码行数:54,代码来源:drawinteraction.cpp

示例3: setAxisTitle

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();
}
开发者ID:hzzlzz,项目名称:InteractiveCourse,代码行数:54,代码来源:icresultchart.cpp

示例4: transform

/*!
  \param axisId Axis
  \return Map for the axis on the canvas. With this map pixel coordinates can
          translated to plot coordinates and vice versa.
  \sa QwtScaleMap, transform(), invTransform()

*/
QwtScaleMap QwtPlot::canvasMap( int axisId ) const
{
    QwtScaleMap map;
    if ( !d_data->canvas )
        return map;

    map.setTransformation( axisScaleEngine( axisId )->transformation() );

    const QwtScaleDiv &sd = axisScaleDiv( axisId );
    map.setScaleInterval( sd.lowerBound(), sd.upperBound() );

    if ( axisEnabled( axisId ) )
    {
        const QwtScaleWidget *s = axisWidget( axisId );
        if ( axisId == yLeft || axisId == yRight )
        {
            double y = s->y() + s->startBorderDist() - d_data->canvas->y();
            double h = s->height() - s->startBorderDist() - s->endBorderDist();
            map.setPaintInterval( y + h, y );
        }
        else
        {
            double x = s->x() + s->startBorderDist() - d_data->canvas->x();
            double w = s->width() - s->startBorderDist() - s->endBorderDist();
            map.setPaintInterval( x, x + w );
        }
    }
    else
    {
        const QRect &canvasRect = d_data->canvas->contentsRect();
        if ( axisId == yLeft || axisId == yRight )
        {
            int top = 0;
            if ( !plotLayout()->alignCanvasToScale( xTop ) )
                top = plotLayout()->canvasMargin( xTop );

            int bottom = 0;
            if ( !plotLayout()->alignCanvasToScale( xBottom ) )
                bottom = plotLayout()->canvasMargin( xBottom );

            map.setPaintInterval( canvasRect.bottom() - bottom,
                                  canvasRect.top() + top );
        }
        else
        {
            int left = 0;
            if ( !plotLayout()->alignCanvasToScale( yLeft ) )
                left = plotLayout()->canvasMargin( yLeft );

            int right = 0;
            if ( !plotLayout()->alignCanvasToScale( yRight ) )
                right = plotLayout()->canvasMargin( yRight );

            map.setPaintInterval( canvasRect.left() + left,
                                  canvasRect.right() - right );
        }
    }

    return map;
}
开发者ID:fangzhuang2004,项目名称:OpenPilot,代码行数:67,代码来源:qwt_plot.cpp

示例5: QwtPlot

HistPlot::HistPlot(QWidget *parent):
QwtPlot(parent)
{
	setCanvasBackground(QColor(Qt::black));
	plotLayout()->setAlignCanvasToScales(true);

	//QwtLegend *legend = new QwtLegend;
	//legend->setItemMode(QwtLegend::CheckableItem);
	//insertLegend(legend, QwtPlot::RightLegend);

	//populate();

	//connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)),
	//	SLOT(showItem(QwtPlotItem *, bool)));

	//replot(); // creating the legend items

	QwtPlotItemList items = itemList(QwtPlotItem::Rtti_PlotHistogram);
	for ( int i = 0; i < items.size(); i++ )
	{
		if ( i == 0 )
		{
			//QwtLegendItem *legendItem = (QwtLegendItem *)legend->find(items[i]);
			//if ( legendItem )
			//	legendItem->setChecked(true);
			items[i]->setVisible(true);
		}
		else
			items[i]->setVisible(false);
	}

	setAutoReplot(true);
}
开发者ID:Quenii,项目名称:adcevm,代码行数:33,代码来源:histplot.cpp

示例6: QwtPlot

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 );
}
开发者ID:27sparks,项目名称:GoldenCheetah,代码行数:35,代码来源:plot.cpp

示例7: qSwap

void BarChart::setOrientation( int o )
{
    const Qt::Orientation orientation =
        ( o == 0 ) ? Qt::Vertical : Qt::Horizontal;

    int axis1 = QwtPlot::xBottom;
    int axis2 = QwtPlot::yLeft;

    if ( orientation == Qt::Horizontal )
        qSwap( axis1, axis2 );

    d_barChartItem->setOrientation( orientation );

    setAxisTitle( axis1, "Distros" );
    setAxisMaxMinor( axis1, 3 );
    setAxisScaleDraw( axis1, new DistroScaleDraw( orientation, d_distros ) );

    setAxisTitle( axis2, "Hits per day ( HPD )" );
    setAxisMaxMinor( axis2, 3 );

    QwtScaleDraw *scaleDraw = new QwtScaleDraw();
    scaleDraw->setTickLength( QwtScaleDiv::MediumTick, 4 );
    setAxisScaleDraw( axis2, scaleDraw );

    plotLayout()->setCanvasMargin( 0 );
    replot();
}
开发者ID:Au-Zone,项目名称:qwt,代码行数:27,代码来源:barchart.cpp

示例8: QCustomPlot

Plot2D::Plot2D(QWidget *parent) : QCustomPlot(parent), canvasBrush_(Qt::white) {
  setBackgroundColor(canvasBrush_);
  setAutoAddPlottableToLegend(false);
  setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
                  QCP::iSelectLegend | QCP::iSelectPlottables);
  plotLayout()->clear();
}
开发者ID:narunlifescience,项目名称:AlphaPlot,代码行数:7,代码来源:Plot2D.cpp

示例9: IncrementalPlot

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());
}
开发者ID:albore,项目名称:pandora,代码行数:26,代码来源:randomplot.cpp

示例10: QwtPlot

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();
}
开发者ID:BryanF1947,项目名称:GoldenCheetah,代码行数:33,代码来源:plot.cpp

示例11: changeitems

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();
}
开发者ID:elkinvg,项目名称:prmpixread,代码行数:31,代码来源:matrixofpixels.cpp

示例12: QwtPlot

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 );
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:26,代码来源:plot.cpp

示例13: transform

/*!
  \param axisId Axis
  \return Map for the axis on the canvas. With this map pixel coordinates can
          translated to plot coordinates and vice versa.
  \sa QwtScaleMap, transform(), invTransform()

*/
QwtScaleMap QwtPlot::canvasMap( int axisId ) const
{
    QwtScaleMap map;
    if ( !d_data->canvas )
        return map;

    map.setTransformation( axisScaleEngine( axisId )->transformation() );

    const QwtScaleDiv *sd = axisScaleDiv( axisId );
    map.setScaleInterval( sd->lowerBound(), sd->upperBound() );

    if ( axisEnabled( axisId ) )
    {
        const QwtScaleWidget *s = axisWidget( axisId );
        if ( axisId == yLeft || axisId == yRight )
        {
            double y = s->y() + s->startBorderDist() - d_data->canvas->y();
            double h = s->height() - s->startBorderDist() - s->endBorderDist();
            map.setPaintInterval( y + h, y );
        }
        else
        {
            double x = s->x() + s->startBorderDist() - d_data->canvas->x();
            double w = s->width() - s->startBorderDist() - s->endBorderDist();
            map.setPaintInterval( x, x + w );
        }
    }
    else
    {
        int margin = 0;
        if ( !plotLayout()->alignCanvasToScales() )
            margin = plotLayout()->canvasMargin( axisId );

        const QRect &canvasRect = d_data->canvas->contentsRect();
        if ( axisId == yLeft || axisId == yRight )
        {
            map.setPaintInterval( canvasRect.bottom() - margin,
                canvasRect.top() + margin );
        }
        else
        {
            map.setPaintInterval( canvasRect.left() + margin,
                canvasRect.right() - margin );
        }
    }
    return map;
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:54,代码来源:qwt_plot.cpp

示例14: QwtInterval

void Spectrogramplot::setYAxisRange(double yMin, double yMax)
{
  yMin_ = yMin;
  yMax_ = yMax;
  data_->setInterval( Qt::YAxis, QwtInterval( yMin_, yMax_ ) );
  plotLayout()->setAlignCanvasToScales(true);
  replot();
}
开发者ID:andrepuschmann,项目名称:srsGUI,代码行数:8,代码来源:Spectrogramplot.cpp

示例15: path

CpintPlot::CpintPlot(Context *context, QString p, const Zones *zones, bool rangemode) :
    path(p),
    thisCurve(NULL),
    CPCurve(NULL),
    allCurve(NULL),
    zones(zones),
    series(RideFile::watts),
    context(context),
    current(NULL),
    bests(NULL),
    isFiltered(false),
    shadeMode(2),
    rangemode(rangemode)
{
    setAutoFillBackground(true);

    setAxisTitle(xBottom, tr("Interval Length"));
    LogTimeScaleDraw *ld = new LogTimeScaleDraw;

    ld->setTickLength(QwtScaleDiv::MajorTick, 3);
    setAxisScaleDraw(xBottom, ld);
    setAxisScaleEngine(xBottom, new QwtLogScaleEngine);
    QwtScaleDiv div( (double)0.017, (double)60 );
    div.setTicks(QwtScaleDiv::MajorTick, LogTimeScaleDraw::ticks);
    setAxisScaleDiv(QwtPlot::xBottom, div);

    QwtScaleDraw *sd = new QwtScaleDraw;
    sd->setTickLength(QwtScaleDiv::MajorTick, 3);
    sd->enableComponent(QwtScaleDraw::Ticks, false);
    sd->enableComponent(QwtScaleDraw::Backbone, false);
    setAxisScaleDraw(yLeft, sd);
    setAxisTitle(yLeft, tr("Average Power (watts)"));
    setAxisMaxMinor(yLeft, 0);
    plotLayout()->setAlignCanvasToScales(true);

    //grid = new QwtPlotGrid();
    //grid->enableX(true);
    //grid->attach(this);

    curveTitle.attach(this);
    curveTitle.setXValue(5);
    curveTitle.setYValue(60);
    curveTitle.setLabel(QwtText("", QwtText::PlainText)); // default to no title

    zoomer = new penTooltip(static_cast<QwtPlotCanvas*>(this->canvas()));
    zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
                            Qt::LeftButton, Qt::ShiftModifier);

    canvasPicker = new LTMCanvasPicker(this);
    static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame);
    connect(canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), this, SLOT(pointHover(QwtPlotCurve*, int)));

    configChanged(); // apply colors

    ecp = new ExtendedCriticalPower(context);
    extendedCPCurve4 = NULL;
    extendedCurveTitle2 = NULL;
}
开发者ID:prenard,项目名称:GoldenCheetah,代码行数:58,代码来源:CpintPlot.cpp


注:本文中的plotLayout函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。