aboutsummaryrefslogtreecommitdiffstats
path: root/stats/pieseries.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-20 14:36:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-02-13 13:02:54 -0800
commit18a5b5b5930247ed880cfbe8f94778b4c19b0bb2 (patch)
treecdaf28e252a7e512774379e2f12e981e1f68ccb3 /stats/pieseries.h
parent622e9ba373f898a0d51fc009f3615d83ffd3a7fc (diff)
downloadsubsurface-18a5b5b5930247ed880cfbe8f94778b4c19b0bb2.tar.gz
statistics: use dive instead of count bins
If we want to make bar charts selectable (when clicking on a bar select the dives the bar represents), then we must store the dives behind bars. Therefore, use dive-based bins instead of count based bins in bar charts and pie charts. This gave some churn because every structure where a count is stored has to be changed to store a vector of dives. Try to use move semantics where possible to avoid duplication of dive lists. On a positive note, the count_dives() function of the binners can now be removed, since it is unused. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/pieseries.h')
-rw-r--r--stats/pieseries.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/stats/pieseries.h b/stats/pieseries.h
index 0cb5e12cb..4fbf689bd 100644
--- a/stats/pieseries.h
+++ b/stats/pieseries.h
@@ -10,6 +10,7 @@
#include <vector>
#include <QString>
+struct dive;
struct InformationBox;
struct ChartPieItem;
struct ChartTextItem;
@@ -21,7 +22,7 @@ public:
// If keepOrder is false, bins will be sorted by size, otherwise the sorting
// of the shown bins will be retained. Small bins are omitted for clarity.
PieSeries(StatsView &view, StatsAxis *xAxis, StatsAxis *yAxis, const QString &categoryName,
- const std::vector<std::pair<QString, int>> &data, bool keepOrder);
+ std::vector<std::pair<QString, std::vector<dive *>>> data, bool keepOrder);
~PieSeries();
void updatePositions() override;
@@ -42,9 +43,9 @@ private:
ChartItemPtr<ChartTextItem> innerLabel, outerLabel;
QString name;
double angleFrom, angleTo; // In fraction of total
- int count;
+ std::vector<dive *> dives;
QPointF innerLabelPos, outerLabelPos; // With respect to a (-1, -1)-(1, 1) rectangle.
- Item(StatsView &view, const QString &name, int from, int count, int totalCount,
+ Item(StatsView &view, const QString &name, int from, std::vector<dive *> dives, int totalCount,
int bin_nr, int numBins);
void updatePositions(const QPointF &center, double radius);
void highlight(ChartPieItem &item, int bin_nr, bool highlight, int numBins);