本文整理汇总了C++中QCustomPlot::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QCustomPlot::show方法的具体用法?C++ QCustomPlot::show怎么用?C++ QCustomPlot::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCustomPlot
的用法示例。
在下文中一共展示了QCustomPlot::show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateGraph
void CurrencyPane::UpdateGraph(const QMap<double, double> map) {
QCustomPlot* customPlot = ui->plotWidget;
if (map.size() < 2) {
customPlot->hide();
return;
}
if (customPlot->isHidden()) {
customPlot->show();
}
//customPlot->setBackground(Qt::transparent);
double lastDate = map.lastKey();
double weekAgo = QDateTime(QDate::currentDate()).addDays(-7).toTime_t();
double highestVal = 0;
if (!map.isEmpty()) {
highestVal = from(map.values().toVector().toStdVector()).max();
}
if (customPlot->graphCount() > 0) {
customPlot->removeGraph(0);
}
customPlot->addGraph();
customPlot->graph()->setName("Net Worth");
QPen pen;
pen.setColor(QColor(0, 0, 255, 200));
customPlot->graph()->setLineStyle(QCPGraph::lsLine);
customPlot->graph()->setPen(pen);
customPlot->graph()->setBrush(QBrush(QColor(255/4.0,160,50,150)));
customPlot->graph()->setData(map.keys().toVector(), map.values().toVector());
// configure bottom axis to show date and time instead of number:
customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
customPlot->xAxis->setDateTimeFormat("ddd");
// set a more compact font size for bottom and left axis tick labels:
customPlot->xAxis->setTickLabelFont(QFont(QFont().family(), 8));
customPlot->yAxis->setTickLabelFont(QFont(QFont().family(), 8));
// set axis labels:
customPlot->xAxis->setLabel("Date");
customPlot->yAxis->setLabel("Total Worth in Chaos");
// make top and right axes visible but without ticks and labels:
customPlot->xAxis2->setVisible(true);
customPlot->yAxis2->setVisible(true);
customPlot->xAxis2->setTicks(false);
customPlot->yAxis2->setTicks(false);
customPlot->xAxis2->setTickLabels(false);
customPlot->yAxis2->setTickLabels(false);
// set axis ranges to show all data:
customPlot->xAxis->setRange(weekAgo, lastDate);
customPlot->yAxis->setRange(0, highestVal);
// show legend:
customPlot->legend->setVisible(true);
}
示例2: drawPlot
void Snakes::drawPlot(std::vector<double> inputX, std::vector<double> inputY) {
QCustomPlot *customPlot = new QCustomPlot();
customPlot->resize(500, 500);
QVector<double> x = QVector<double>::fromStdVector(inputX);
QVector<double> y = QVector<double>::fromStdVector(inputY);
customPlot->addGraph();
customPlot->graph(0)->setData(x, y);
customPlot->xAxis->setLabel("x");
customPlot->yAxis->setLabel("y");
customPlot->xAxis->setRange(inputX.front(), inputX.back());
customPlot->yAxis->setRange(inputY.front(), inputY.back());
customPlot->replot();
customPlot->show();
}