From 56c91a46b6f94b31940cfe15c1fe29a9d952df91 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 19 Oct 2022 22:17:56 +0200 Subject: [PATCH] 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 --- CHANGELOG.md | 3 +++ stats/statsaxis.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 040ea7990..f88aad29c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 --- diff --git a/stats/statsaxis.cpp b/stats/statsaxis.cpp index 2f7bbc9a1..e543b7b25 100644 --- a/stats/statsaxis.cpp +++ b/stats/statsaxis.cpp @@ -623,7 +623,9 @@ static std::vector 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 });