summaryrefslogtreecommitdiffstats
path: root/stats/statsvariables.cpp
AgeCommit message (Collapse)Author
2021-02-13statistics: save dive list with quartilesGravatar Berthold Stoeger
To make box-and-whiskers charts selectable (select corresponding dives when clicking on box), save the dive list with the quartile data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: use dive instead of count binsGravatar Berthold Stoeger
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>
2021-01-10statistics: split people binnerGravatar Berthold Stoeger
The people binner (called "buddies") is too coarse. Split into buddies, dive guide and people (the old "buddies", which is a combination of buddies and dive guide). Reported-by: Peter Zaal <peter.zaal@gmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: fix 20 m binnerGravatar Berthold Stoeger
Copy&paste error: the 20 m binner binned to 10 m. Reported-by: Peter Zaal <peter.zaal@gmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: add count to box and whisker plotsGravatar Berthold Stoeger
When calculating the quartiles, we need the count of dives anyway, which makes it trivial to export this value to the frontend. Fixes an erroneous "mean", which should be "median". Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: add tags variableGravatar Berthold Stoeger
Trivially a copy of the "buddies" code. Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: sort dive sitesGravatar Berthold Stoeger
The dive sites where sorted by location in RAM, which is just silly. Add a DiveSiteWrapper that sorts by name, though that should probably be improved. Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: add min and max operations for numerical typesGravatar Berthold Stoeger
This makes sense and is easy to implement. Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-09statistics: add a dive-# variableGravatar Berthold Stoeger
This was requested on the mailing list and it makes sense to have it. Of course, not all charts make sense: e.g. a plot dive-# vs. count is a bit redundant... Sadly, this can't use the generic IntRangeBinner, because dive-#s start at 1, not 0. Suggested-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-09statistics: add a mean depth variableGravatar Berthold Stoeger
This was requested on the mailing list. Reduce code size somewhat by deriving the binner and the variable classes from common base classes with a mean-vs-max flag. Suggested-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-05Add dive rating and visibility to statistics variablesGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-01-01statistics: add statistic variablesGravatar Berthold Stoeger
The StatisticVariable class hierarchy encapsulates the concept of a dive-variable, which can be plotted in charts either as dependend or independend variable. There are three types of these variables: 1) discrete: For example dive buddies or suit type. 2) continuous: Has a notion of linear metric - can be used as histogram or scatter plot axis. 3) numeric: Like continuous, but allows for operations such as calculating the mean or the sum over numerous dives. All variables support binning. The bins are defined per variable. Continuous variables can be converted into an arbitrary double value, which is used to be plotted on a continuous axis. Moreover, numeric variables support a number of operations, which depend on the variable. Since binning is based on different types, the code is rather template-heavy. Of course, this could be solved with unions/variants and runtime-polymorphism, but using templates was just much quicker. Notably, this uses the CRTP (curiously recurring template pattern) where a subclass passes itself as argument to the baseclass. This is a weird kind of "reverse inheritance". The StatsTranslations class is a dummy class which will be used to collect all translations of the statistics module. This includes changes by Dirk to fix compilation of the downloader. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>