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


C++ QCPGraph::rescaleAxes方法代码示例

本文整理汇总了C++中QCPGraph::rescaleAxes方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPGraph::rescaleAxes方法的具体用法?C++ QCPGraph::rescaleAxes怎么用?C++ QCPGraph::rescaleAxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QCPGraph的用法示例。


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

示例1: setupDateTest

void MainWindow::setupDateTest(QCustomPlot *customPlot)
{
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
	customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
	QCPGraph *g = customPlot->addGraph();
	g->addData(QDateTime(QDate(350,5,21), QTime(0, 0)).toMSecsSinceEpoch()/1000.0, 1);
	g->addData(QDateTime(QDate(650,5,21), QTime(0, 0)).toMSecsSinceEpoch()/1000.0, 2);
	g->addData(QDateTime(QDate(740,5,21), QTime(0, 0)).toMSecsSinceEpoch()/1000.0, 4);
	g->addData(QDateTime(QDate(1000,5,21), QTime(0, 0)).toMSecsSinceEpoch()/1000.0, 8);
	g->rescaleAxes();
#endif
}
开发者ID:shenglonglinapple,项目名称:slin_code,代码行数:12,代码来源:mainwindow.cpp

示例2: addBodePlot

void BodeWidget::addBodePlot(BodeData *data, const QString& name){
    QCPGraph* dbGraph = dbPlot->addGraph();
    QCPGraph* paGraph = paPlot->addGraph();

    dbGraph->setData(data->at(0), data->at(1));
    paGraph->setData(data->at(0), data->at(2));

    dbGraph->setName(name);
    paGraph->setName(name);


    dbGraph->setPen(QPen(QColor::fromHsv(hue, 255, 255, 192)));
    paGraph->setPen(QPen(QColor::fromHsv(hue, 255, 255, 192)));

    paGraph->setVisible(false);

    dbGraph->rescaleAxes();
    paGraph->rescaleAxes();

    hue += 17;
    hue %= 360;

    this->paGraphMap[dbGraph] = paGraph;
}
开发者ID:Bakhazard,项目名称:plc-gnosis,代码行数:24,代码来源:bodewidget.cpp

示例3: updatePlot


//.........这里部分代码省略.........
            graph->setScatterStyle(QCP::ssDisc);
            graph->setScatterSize(10);

            Group group = *groupIterator;

            QColor color = group.getColor();
            mapGroupGraph[group] = graph;
            color.setAlphaF(0.3);
            pen.setColor(color);
            graph->setPen(pen);
        }
    }

    //int numberOfTrip = selectedTrips->size();
    map<Group,pair<QVector<double>,QVector<double> > > mapGroupData;
    if(buildGlobalPlot){
        int numberOfTrips = selectedTrips->size();
        //QVector<double> x(numberOfTrips), y(numberOfTrips);
        QVector<double> x, y;
        mapGroupData[QColor(0,0,0)] = make_pair(x,y);
    }
    else{
        QVector<double> x, y;
        for(groupIterator = groups.begin() ; groupIterator != groups.end() ; ++groupIterator){
            Group group = *groupIterator;

            mapGroupData[group.getColor()] = make_pair(x,y);

        }
    }

    // add graphs with different scatter styles:
    KdTrip::TripSet::iterator it = selectedTrips->begin();
    for (; it != selectedTrips->end(); ++it) {
        const KdTrip::Trip * trip = *it;
        QPointF coords = getCoords(trip);

        if(buildGlobalPlot){
            pair<QVector<double>,QVector<double> > &data =
                    mapGroupData[QColor(0,0,0)];
            QVector<double> &x = data.first;
            QVector<double> &y = data.second;
            x << coords.x();
            y << coords.y();
        }
        else{
            for(groupIterator = groups.begin() ; groupIterator != groups.end() ; ++groupIterator){
                Group currentGroup = *groupIterator;

                assert(mapGroupToNodes.count(currentGroup) > 0 && mapGroupToEdges.count(currentGroup) > 0);

                if(tripSatisfiesConstraints(trip, mapGroupToNodes[currentGroup],mapGroupToEdges[currentGroup])){
                    pair<QVector<double>,QVector<double> > &data =
                            mapGroupData[currentGroup.getColor()];
                    QVector<double> &x = data.first;
                    QVector<double> &y = data.second;
                    x << coords.x();
                    y << coords.y();
                    continue; // make sure the point is only added once
                }
            }
        }
    }

    if(buildGlobalPlot){
        pair<QVector<double>,QVector<double> > &data =
                mapGroupData[QColor(0,0,0)];
        QVector<double> &x = data.first;
        QVector<double> &y = data.second;
        QCPGraph* graph = mapGroupGraph[QColor(0,0,0)];
        graph->setData(x, y);
        graph->rescaleAxes(true);
    }
    else{
        for(groupIterator = groups.begin() ; groupIterator != groups.end() ; ++groupIterator){
            Group currentGroup = *groupIterator;
            pair<QVector<double>,QVector<double> > &data =
                    mapGroupData[currentGroup.getColor()];
            QVector<double> &x = data.first;
            QVector<double> &y = data.second;
            QCPGraph* graph = mapGroupGraph[currentGroup.getColor()];
            graph->setData(x, y);
            graph->rescaleAxes(true);
        }
    }

    //
    int numGraphs = ui->customPlot->graphCount();
    for(int i = 0 ; i < numGraphs ; ++i){
        ui->customPlot->graph(i)->rescaleAxes(false,true);
    }
    //ui->customPlot->yAxis->scaleRange(1.1, ui->customPlot->yAxis->range().center());
    ui->customPlot->setRangeDrag(Qt::Horizontal|Qt::Vertical);
    ui->customPlot->setRangeZoom(Qt::Horizontal|Qt::Vertical);
    ui->customPlot->setInteractions(QCustomPlot::iRangeDrag | QCustomPlot::iRangeZoom | QCustomPlot::iSelectAxes |
                                    QCustomPlot::iSelectLegend | QCustomPlot::iSelectPlottables | QCustomPlot::iSelectTitle);

    //
    ui->customPlot->replot();
}
开发者ID:Rambo2015,项目名称:TaxiVis,代码行数:101,代码来源:scatterplotwidget.cpp


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