From 5c098eea29fdb1cd663b78db4e430a1c76c2209a Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sun, 17 Jan 2021 13:34:18 +0100 Subject: statistics: select dives from Scatter Plot When clicking on items in a plot, select the corresponding dives. This can be useful for data validation. Signed-off-by: Robert C. Helling Signed-off-by: Berthold Stoeger --- stats/barseries.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'stats/barseries.cpp') diff --git a/stats/barseries.cpp b/stats/barseries.cpp index 8767a04db..a501ddea9 100644 --- a/stats/barseries.cpp +++ b/stats/barseries.cpp @@ -6,6 +6,7 @@ #include "statstranslations.h" #include "statsview.h" #include "zvalues.h" +#include "core/selection.h" #include // for lrint() #include @@ -404,3 +405,13 @@ void BarSeries::unhighlight() items[highlighted.bar].highlight(highlighted.subitem, false, binCount()); highlighted = Index(); } + +void BarSeries::selectItemsUnderMouse(const QPointF &pos) +{ + Index index = getItemUnderMouse(pos); + if (index.bar < 0) + return setSelection({}, nullptr); + + const std::vector &dives = items[index.bar].subitems[index.subitem].dives; + setSelection(dives, dives.empty() ? nullptr : dives.front()); +} -- cgit v1.2.3-70-g09d2