statistics: add enough entries for date axis

We must add one more entries than there are days, because the
entries describe the values between histograms.

The root cause of the problem here is that a histogram axis
is misused for a continuous day-axis.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-10-19 22:17:56 +02:00 committed by Dirk Hohndel
parent 48659c3f7d
commit 56c91a46b6
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,6 @@
statistics: show correct color of selected scatter items when switching to unbinned mode
statistics: fix display of month number in continuous date axis
statistics: fix range of continuous date axis
desktop: fix dive time display in time shift dialog
---

View file

@ -623,7 +623,9 @@ static std::vector<HistogramAxisEntry> timeRangeToBins(double from, double to)
QString format = day_before_month ? QStringLiteral("%1%2%3")
: QStringLiteral("%3%2%1");
QString sep = QString(separator);
for (auto act = day_from; act < day_to; inc(act)) {
// Attention: In a histogramm axis, we must add one more entries than
// histogram bins. The entries are the values *between* the histograms.
for (auto act = day_from; act <= day_to; inc(act)) {
double val = date_to_double(act[0], act[1], act[2]);
if (act[1] == 0) {
res.push_back({ QString::number(act[0]), val, true });