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 <helling@atdotde.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Robert C. Helling 2021-01-17 13:34:18 +01:00 committed by Dirk Hohndel
parent 1797b59c10
commit 5c098eea29
10 changed files with 57 additions and 1 deletions

View file

@ -11,6 +11,7 @@
#include "core/dive.h"
#include "core/divelist.h"
#include "core/qthelper.h"
#include "core/selection.h"
ScatterSeries::ScatterSeries(StatsView &view, StatsAxis *xAxis, StatsAxis *yAxis,
const StatsVariable &varX, const StatsVariable &varY) :
@ -72,6 +73,16 @@ std::vector<int> ScatterSeries::getItemsUnderMouse(const QPointF &point) const
return res;
}
void ScatterSeries::selectItemsUnderMouse(const QPointF &point)
{
std::vector<struct dive *> selected;
for(int idx: getItemsUnderMouse(point))
selected.push_back(items[idx].d);
setSelection(selected, selected.empty() ? nullptr : selected.front());
}
static QString dataInfo(const StatsVariable &var, const dive *d)
{
// For "numeric" variables, we display value and unit.