I have Ubuntu 14.04
, I'm working with QT
C ++
. I will paint two lines ( in QcustomPlot
) Each line has a different color from the other. I will to paint a line Red Then line green, like this My code :
customPlot->addGraph() ; // color red
customPlot->addGraph() ; // color green
customPlot->graph(0)->setPen(QPen(Qt::red));
customPlot->graph(1)->setPen(QPen(Qt::red));
customPlot->graph(1)->setPen(QPen(Qt::green);
customPlot->graphe(0)->adddata(1,1) ;
customPlot->graphe(0)->adddata(5,1) ;
customPlot->graphe(1)->adddata(5,1) ;
customPlot->graphe(1)->adddata(10,1) ;
customPlot->graphe(0)->adddata(10,1) ;
customPlot->graphe(0)->adddata(15,1) ;
The problem is that the red line painted on the green How to solve the problem?
QCPItemLine *item ;
item = new QCPItemLine(ui->courbe);
customPlot->addItem(item);
item->setPen(QPen(Qt::red));
item->start->setCoords(1,1);
item->end->setCoords(5,1);
item = new QCPItemLine(ui->courbe);
item->start->setCoords(6,1);
item->end->setCoords(10,1);
customPlot->replot();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.