本文整理汇总了C++中QCPGraph::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPGraph::setProperty方法的具体用法?C++ QCPGraph::setProperty怎么用?C++ QCPGraph::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCPGraph
的用法示例。
在下文中一共展示了QCPGraph::setProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCurve
void OdroidReader::updateCurve(int row, int col) {
if (col != 0) return;
bool enable = ui->sensors->item(row,col)->checkState() == Qt::Checked;
if (enable && graphs.at(row) == nullptr) {
if (origcols.count() == 0) {
ui->sensors->item(row,col)->setCheckState(Qt::Unchecked);
return;
}
QColor color = origcols.takeFirst();
QCPGraph* graph = ui->globalPlot->addGraph();
DataSeries* series = data[rowMap[row]];
graph->setName(series->descriptor->name());
graph->setProperty("unit",series->descriptor->unit());
graph->setPen(color);
graph->setData(series->getTimestamps(), series->getValues());
connect(series,&DataSeries::newValue,[graph,this](double time, double value) {
graph->addData(time,value);
ui->globalPlot->rescaleAxes();
ui->globalPlot->yAxis->scaleRange(1.2,ui->globalPlot->yAxis->range().center());
ui->globalPlot->replot();
});
graphs[row] = graph;
ui->sensors->item(row,col)->setBackgroundColor(color);
} else if (!enable && graphs.at(row) != nullptr){
disconnect(data.at(rowMap[row]),SIGNAL(newValue(double,double)),0,0);
origcols.push_front(graphs.at(row)->pen().color());
ui->globalPlot->removeGraph(graphs.at(row));
graphs[row] = nullptr;
ui->sensors->item(row,col)->setBackgroundColor(Qt::white);
}
示例2: updateDetails
void DataExplorer::updateDetails() {
//qDebug() << "SELECT!";
ui->runPlot->clearPlottables();
QVector<QString> labels;
QVector<double> ticks;
int colid = 0;
switch (ui->detailType->currentIndex()) {
case 0:
ui->runPlot->xAxis->setAutoTicks(true);
ui->runPlot->xAxis->setAutoTickLabels(true);
for (QCPAbstractPlottable *p : ui->selectEnvironment->selectedPlottables()) {
int unitid = p->property("UID").toInt();
int envid = p->property("EID").toInt();
DataSeries v = exp->runs.keys().at(envid)->run(unitid,ui->runNo->value(),exp);
QCPGraph *g = ui->runPlot->addGraph();
g->setName(v.descriptor->name()+" @ "+exp->runs.keys().at(envid)->label);
g->setProperty("Unit",v.descriptor->unit());
g->setPen(origcols[colid++%origcols.size()]);
g->setData(v.getTimestamps(),v.getValues());
}
break;
case 1:
for (QCPAbstractPlottable *p : ui->selectEnvironment->selectedPlottables()) {
int unitid = p->property("UID").toInt();
int envid = p->property("EID").toInt();
StatisticalSet vals = exp->runs.keys().at(envid)->integral(unitid,exp);
QCPStatisticalBox* b = new QCPStatisticalBox(ui->runPlot->xAxis,ui->runPlot->yAxis);
b->setData(colid,vals.min(),vals.quantile(0.25),vals.median(),vals.quantile(0.75),vals.max());
b->setProperty("StdDev",vals.getStdDev());
b->setProperty("avg",vals.avg());
b->setProperty("avgTime",vals.avgTime());
qWarning() << exp->data.at(unitid)->descriptor->name() << exp->runs.keys().at(envid)->label << vals.avg() << vals.avgTime() << vals.getStdDev();
ui->runPlot->addPlottable(b);
labels.append(QString("%1 @ %2").arg(exp->data.at(unitid)->descriptor->name(),exp->runs.keys().at(envid)->label));
ticks.append(colid++);
ui->runPlot->xAxis->setAutoTicks(false);
ui->runPlot->xAxis->setAutoTickLabels(false);
ui->runPlot->xAxis->setSubTickCount(0);
ui->runPlot->xAxis->setTickLength(0, 4);
ui->runPlot->xAxis->setTickLabelRotation(90);
ui->runPlot->xAxis->setTickVector(ticks);
ui->runPlot->xAxis->setTickVectorLabels(labels);
}
break;
case 2: break;
}
ui->runPlot->rescaleAxes();
if (ui->axisFromZero->isChecked())
ui->runPlot->yAxis->setRangeLower(0);
ui->runPlot->replot();
}