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(); }
void DataExplorer::updateEnvironment() { ui->selectEnvironment->clearPlottables(); int idx = 0; QVector<double> ticks; QVector<QString> labels; for (QCPAbstractPlottable *p : ui->selectMetric->selectedPlottables()) { int unit = p->property("UID").toInt(); int eid = 0; for (const Environment* e : exp->runs.keys()) { StatisticalSet vals = e->aggregate(unit,exp); QCPStatisticalBox* b = new QCPStatisticalBox(ui->selectEnvironment->xAxis,ui->selectEnvironment->yAxis); b->setData(idx,vals.min(),vals.quantile(0.25),vals.median(),vals.quantile(0.75),vals.max()); b->setProperty("UID",unit); b->setProperty("EID",eid++); ui->selectEnvironment->addPlottable(b); b->setSelected(true); labels.append(QString("%1 @ %2").arg(exp->data.at(unit)->descriptor->name(),e->label)); ticks.append(idx++); } } ui->selectEnvironment->xAxis->setAutoTicks(false); ui->selectEnvironment->xAxis->setAutoTickLabels(false); ui->selectEnvironment->xAxis->setSubTickCount(0); ui->selectEnvironment->xAxis->setTickLength(0, 4); ui->selectEnvironment->xAxis->setTickLabelRotation(90); ui->selectEnvironment->xAxis->setTickVector(ticks); ui->selectEnvironment->xAxis->setTickVectorLabels(labels); ui->selectEnvironment->setInteractions(QCP::iMultiSelect | QCP::iSelectPlottables); ui->selectEnvironment->setSelectionTolerance(10); ui->selectEnvironment->rescaleAxes(); ui->selectEnvironment->xAxis->scaleRange(1.1, ui->selectEnvironment->xAxis->range().center()); connect(ui->selectEnvironment,SIGNAL(selectionChangedByUser()), this, SLOT(updateDetails())); if (ui->axisFromZero->isChecked()) ui->selectEnvironment->yAxis->setRangeLower(0); ui->selectEnvironment->replot(); updateDetails(); }
void DataExplorer::on_dispUnit_currentIndexChanged(int) { QVector<double> ticks; ui->selectMetric->clearPlottables(); QBrush boxBrush(QColor(60, 60, 255, 100),Qt::Dense6Pattern); QVector<QString> labels; int i = -1; for (DataSeries* p : exp->data) { if (p == nullptr) continue; if (p->descriptor->unit() != ui->dispUnit->currentText()) continue; ++i; StatisticalSet v = exp->aggregate(p->descriptor->uid(),exp); QCPStatisticalBox* b = new QCPStatisticalBox(ui->selectMetric->xAxis,ui->selectMetric->yAxis); b->setBrush(boxBrush); b->setProperty("UID",p->descriptor->uid()); b->setData(i,v.min(),v.quantile(0.25),v.median(),v.quantile(0.75),v.max()); ui->selectMetric->addPlottable(b); ticks.append(i); labels.append(p->descriptor->name()); } ui->selectMetric->xAxis->setSubTickCount(0); ui->selectMetric->xAxis->setTickLength(0, 4); ui->selectMetric->xAxis->setTickLabelRotation(40); ui->selectMetric->xAxis->setAutoTicks(false); ui->selectMetric->xAxis->setAutoTickLabels(false); ui->selectMetric->xAxis->setTickVector(ticks); ui->selectMetric->xAxis->setTickVectorLabels(labels); ui->selectMetric->setInteractions(QCP::iMultiSelect | QCP::iSelectPlottables); ui->selectMetric->rescaleAxes(); ui->selectMetric->xAxis->scaleRange(1.1, ui->selectMetric->xAxis->range().center()); connect(ui->selectMetric,SIGNAL(selectionChangedByUser()), this, SLOT(updateEnvironment())); if (ui->axisFromZero->isChecked()) ui->selectMetric->yAxis->setRangeLower(0); ui->selectMetric->replot(); }