[英]How do you paint two lines on QcustomPlot in QT in Ubuntu?
我有Ubuntu 14.04
,正在使用QT
C ++
。 我將繪制兩行(在QcustomPlot
),每一行具有QcustomPlot
不同的顏色。 我將畫一條紅色的線然后畫一條綠色的線, 就像我的代碼:
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) ;
問題是紅線塗在綠色上怎么解決問題?
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();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.