summaryrefslogtreecommitdiffstats
path: root/src/bm/plotter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bm/plotter.cpp')
-rw-r--r--src/bm/plotter.cpp71
1 files changed, 66 insertions, 5 deletions
diff --git a/src/bm/plotter.cpp b/src/bm/plotter.cpp
index 8d3592e..8488772 100644
--- a/src/bm/plotter.cpp
+++ b/src/bm/plotter.cpp
@@ -696,13 +696,15 @@ bool IndexPlotter::drawScenes(
HistoriesPlotter::HistoriesPlotter(
const QList<ResultHistoryInfo *> &rhInfos, const bool showBenchmark, const int baseTimestamp,
- const QList<int> *basePos, const QList<QList<int> > *extraPos, const QStringList *extraDescr,
+ const QList<int> *basePos, const QList<QList<int> > *extraPos,
+ const QList<int> *extraTimestamps, const QStringList *extraDescr,
const bool commonValueRange, const bool showOutliers)
: rhInfos(rhInfos)
, showBenchmark(showBenchmark)
, baseTimestamp(baseTimestamp)
, basePos(basePos)
, extraPos(extraPos)
+ , extraTimestamps(extraTimestamps)
, extraDescr(extraDescr)
, commonValueRange(commonValueRange)
, showOutliers(showOutliers)
@@ -912,6 +914,25 @@ bool HistoriesPlotter::drawScenes(
scene_far->addLine(btx, ymin, btx, ymax, QPen(color, 2));
}
+ if (extraTimestamps) {
+ // Draw lines indicating extra timestamps ...
+
+ for (int i = 0; i < extraTimestamps->size(); ++i) {
+
+ const int t = extraTimestamps->at(i);
+
+ if ((t < loTimestamp) || (t > hiTimestamp))
+ continue;
+
+ QColor color("#803300");
+ color.setAlpha(200);
+ const qreal tx = xmin + (t - loTimestamp) * xfact;
+ scene_far->addLine(
+ tx, ymin, tx, ymax,
+ QPen(color, 2, (i == 0) ? Qt::DashLine : Qt::SolidLine));
+ }
+ }
+
const qreal dpSize = 4;
// Draw history curve between data points ...
@@ -974,17 +995,22 @@ bool HistoriesPlotter::drawScenes(
const qreal dpSize_large_2 = dpSize_large / 2;
for (int i = 0; i < exPos.size(); ++i) {
+
+ const int pos = exPos.at(i);
+ if ((pos < 0) || (pos >= x.size()))
+ continue;
+
QPainterPath path;
if (i == 0) {
path.addRect(
- x.at(exPos.at(i)) - dpSize_large_2,
- y.at(exPos.at(i)) - dpSize_large_2,
+ x.at(pos) - dpSize_large_2,
+ y.at(pos) - dpSize_large_2,
dpSize_large, dpSize_large);
} else {
path.addEllipse(
- x.at(exPos.at(i)) - dpSize_large_2,
- y.at(exPos.at(i)) - dpSize_large_2,
+ x.at(pos) - dpSize_large_2,
+ y.at(pos) - dpSize_large_2,
dpSize_large, dpSize_large);
}
@@ -1123,5 +1149,40 @@ bool HistoriesPlotter::drawScenes(
}
+ if (extraTimestamps) {
+
+ for (int i = 0; i < extraTimestamps->size(); ++i) {
+
+ const int t = extraTimestamps->at(i);
+
+ if ((t < loTimestamp) || (t > hiTimestamp))
+ continue;
+
+ const QString xLabel = BMMisc::compactDateString(t);
+ font.setPointSize(12);
+
+ const qreal xpos = xmin + (t - loTimestamp) * xfact;
+ const QColor color("#803300");
+
+ // ... top x axis label ...
+ {
+ QGraphicsSimpleTextItem *text = scene_near->addSimpleText(xLabel, font);
+ text->setPos(
+ xpos - text->boundingRect().width() / 2,
+ ymin - text->boundingRect().height() + labelPad / 2);
+ text->setBrush(color);
+ }
+
+ // ... bottom x axis label ...
+ {
+ QGraphicsSimpleTextItem *text = scene_near->addSimpleText(xLabel, font);
+ text->setPos(
+ xpos - text->boundingRect().width() / 2,
+ ymax + labelPad / 4);
+ text->setBrush(color);
+ }
+ }
+ }
+
return true;
}