本文整理汇总了C++中QCPGraph::setBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPGraph::setBrush方法的具体用法?C++ QCPGraph::setBrush怎么用?C++ QCPGraph::setBrush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCPGraph
的用法示例。
在下文中一共展示了QCPGraph::setBrush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_listView_clicked
void MainWindow::on_listView_clicked(const QModelIndex &index)
{
//QModelIndex a = ui->listView->selectedIndexes().back();
QVariant selected = dataModel->compNameList->data(index,Qt::DisplayRole);
dataModel->dataViewComp = selected.toString();
QVector<double> dataViewPrice = dataModel->priceBuff.value(selected.toString());
QVector<double> xval;
QVector<double> baseVal;
if(dataViewPrice.empty()) return;
double min = dataViewPrice[0];
for(auto &i : dataViewPrice) min = std::fmin(min,i);
for(int i = 0; i<dataViewPrice.size(); i++){
xval<<i;
baseVal<<min;
}
QCustomPlot* p = ui->qcpDataView;;
p->clearGraphs();
QCPGraph* timeline = new QCPGraph(p->xAxis,p->yAxis);
timeline->addData(xval,dataViewPrice);
QCPGraph* base = new QCPGraph(p->xAxis,p->yAxis);
base->setData(xval,baseVal);
p->addPlottable(timeline);
p->addPlottable(base);
timeline->setChannelFillGraph(base);
timeline->setPen(QPen(QColor(0,0,0,0)));
timeline->setBrush(QColor(0,0,255,100));
//QVector<double> ticks;
QVector<QString> labels;
int L = this->dataModel->dateBuff.values()[0].size()-1;
int len = 6;
float step = (float)L/(float)len;
for(int i = 0; i<= len; i++){
labels<<this->dataModel->dateBuff.values()[0][i*step].toString("MM/yy");
}
p->xAxis->setTickVectorLabels(labels);
p->xAxis->setAutoTicks(true);
p->xAxis->setAutoTickLabels(false);
p->xAxis->setTickLabelRotation(-60);
//p->xAxis->setSubTickCount(0);
//p->xAxis->setTickLength(0, len-1);
p->xAxis->grid()->setVisible(true);
//p->xAxis->setRange(0, len-2);
//p->xAxis->setTickVector(ticks);
p->rescaleAxes();
p->replot();
}