///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// // NE PAS MODIFIER JUSQU'A NOUVEL ORDRE!!!! ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// // create graph and assign data to it: customPlot->addGraph(); customPlot->graph(0)->setPen(QPen(Qt::green)); customPlot->graph(0)->setData(t, et); // give the axes some labels: customPlot->xAxis->setLabel("t"); customPlot->yAxis->setLabel("valeur "); // set axes ranges, so we see all data: customPlot->xAxis->setRange(0, t[nbEchantillons-1]); customPlot->yAxis->setRange(0,MaxQuantADC); customPlot->addGraph(); customPlot->graph(1)->setPen(QPen(Qt::red)); customPlot->graph(1)->setData(t, st); if (affichageVirguleFixe) { customPlot->addGraph(); customPlot->graph(2)->setPen(QPen(Qt::black)); customPlot->graph(2)->setData(t, etvfixe); customPlot->addGraph(); customPlot->graph(3)->setPen(QPen(Qt::blue)); customPlot->graph(3)->setData(t, stvfixe); } QColor c(128,128,128); QBrush b(c); customPlot->setBackground(b); if (affichageTemporel==FALSE) { customPlot->graph(0)->setLineStyle(QCPGraph::lsImpulse); customPlot->graph(1)->setLineStyle(QCPGraph::lsImpulse); customPlot->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle:: ssCircle, 5)); customPlot->graph(1)->setScatterStyle(QCPScatterStyle(QCPScatterStyle:: ssCross, 5)); if (affichageVirguleFixe) { customPlot->graph(2)->setLineStyle(QCPGraph::lsImpulse); customPlot->graph(3)->setLineStyle(QCPGraph::lsImpulse); customPlot->graph(2)->setScatterStyle(QCPScatterStyle(QCPScatterStyle:: ssSquare, 5)); customPlot->graph(3)->setScatterStyle(QCPScatterStyle(QCPScatterStyle:: ssPlus, 5)); } } else { customPlot->graph(0)->setLineStyle(QCPGraph::lsStepLeft); customPlot->graph(1)->setLineStyle(QCPGraph::lsStepLeft); if (affichageVirguleFixe) { customPlot->graph(2)->setLineStyle(QCPGraph::lsStepLeft); customPlot->graph(3)->setLineStyle(QCPGraph::lsStepLeft); } } customPlot->legend->setVisible(true); customPlot->legend->setFont(QFont("Helvetica",9)); // set locale to english, so we get english decimal separator: customPlot->setLocale(QLocale(QLocale::English, QLocale::UnitedKingdom)); customPlot->graph(0)->setName("e(t)"); customPlot->graph(1)->setName("s(t)"); if (affichageVirguleFixe) { customPlot->graph(2)->setName("e(t) vfixe"); customPlot->graph(3)->setName("s(t) vfixe"); } // configure right and top axis to show ticks but no labels: // (see QCPAxisRect::setupFullAxesBox for a quicker method to do this) customPlot->xAxis2->setVisible(true); customPlot->xAxis2->setTickLabels(false); customPlot->yAxis2->setVisible(true); customPlot->yAxis2->setTickLabels(false); // make left and bottom axes always transfer their ranges to right and top axes: connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange))); connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange))); // let the ranges scale themselves so graph 0 fits perfectly in the visible area: customPlot->graph(0)->rescaleAxes(); // same thing for graph 1, but only enlarge ranges (in case graph 1 is smaller than graph 0): customPlot->graph(1)->rescaleAxes(true); if (affichageVirguleFixe) { customPlot->graph(2)->rescaleAxes(true); customPlot->graph(3)->rescaleAxes(true); } // Note: we could have also just called customPlot->rescaleAxes(); instead // Allow user to drag axis ranges with mouse, zoom with mouse wheel and select graphs by clicking: customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); } ///////////////////////////////////////////////////////////////////////