diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-02-07 18:10:08 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-02-13 13:02:54 -0800 |
commit | bd252fc8201c7e77882ac95ef90ddbf4a16356d3 (patch) | |
tree | 15bfc73e8e569d6616ab3edd2d55c025b6b2af10 /stats/boxseries.cpp | |
parent | 91d371374b618ea6a173dcd94f9f11b2e96b85ce (diff) | |
download | subsurface-bd252fc8201c7e77882ac95ef90ddbf4a16356d3.tar.gz |
statistics: highlight selected boxes in box plot
In analogy to bar plots, highlight selected boxes in box plots.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/boxseries.cpp')
-rw-r--r-- | stats/boxseries.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/stats/boxseries.cpp b/stats/boxseries.cpp index 5362aa7af..78a3d258f 100644 --- a/stats/boxseries.cpp +++ b/stats/boxseries.cpp @@ -27,9 +27,10 @@ BoxSeries::~BoxSeries() } BoxSeries::Item::Item(StatsView &view, BoxSeries *series, double lowerBound, double upperBound, - const StatsQuartiles &q, const QString &binName) : - lowerBound(lowerBound), upperBound(upperBound), q(q), - binName(binName) + const StatsQuartiles &qIn, const QString &binName) : + lowerBound(lowerBound), upperBound(upperBound), q(qIn), + binName(binName), + selected(allDivesSelected(q.dives)) { item = view.createChartItem<ChartBoxItem>(ChartZValue::Series, boxBorderWidth); highlight(false); @@ -44,6 +45,8 @@ void BoxSeries::Item::highlight(bool highlight) { if (highlight) item->setColor(highlightedColor, highlightedBorderColor); + else if (selected) + item->setColor(selectedColor, selectedBorderColor); else item->setColor(fillColor, ::borderColor); } @@ -155,3 +158,17 @@ bool BoxSeries::selectItemsUnderMouse(const QPointF &pos, bool) setSelection(dives, dives.empty() ? nullptr : dives.front()); return true; } + +void BoxSeries::divesSelected(const QVector<dive *> &) +{ + for (auto &item: items) { + bool selected = allDivesSelected(item->q.dives); + if (item->selected != selected) { + item->selected = selected; + + int idx = &item - &items[0]; + bool highlight = idx == highlighted; + item->highlight(highlight); + } + } +} |