customPlot->addGraph();// blue line
customPlot->graph(0)->setPen(QPen(Qt::blue));
customPlot->graph(0)->setName("曲线名称");
customPlot->addGraph(); // red line
customPlot->graph(1)->setPen(QPen(Qt::red));
customPlot->graph(1)->setName("曲线名称");
QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);
timeTicker->setTimeFormat("%h:%m:%s");
customPlot->xAxis->setTicker(timeTicker);
customPlot->axisRect()->setupFullAxesBox();
customPlot->yAxis->setRange(-1.2, 1.2);
// make left and bottom axes 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)));
// setup a timer that repeatedly ca