mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 21:06:17 +00:00
statistics: improve formatting of date axis in day-mode
In January it would just show the year for every day. That's silly. Show the year only for Jan 1st. Moreover, it would never show the month, because day-of-month is counted from 1 (whereas month-of-year is counted from 0). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
916c88ded9
commit
dd466d2d48
2 changed files with 3 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
statistics: show proper dates in January
|
||||||
desktop: add country to the fields indexed for full text search
|
desktop: add country to the fields indexed for full text search
|
||||||
import: update libdivecomputer version, add support for the Scubapro G3 / Luna and Shearwater Tern
|
import: update libdivecomputer version, add support for the Scubapro G3 / Luna and Shearwater Tern
|
||||||
desktop: add a button linking to the 'Contribute' page
|
desktop: add a button linking to the 'Contribute' page
|
||||||
|
|
|
@ -630,9 +630,9 @@ static std::vector<HistogramAxisEntry> timeRangeToBins(double from, double to)
|
||||||
// histogram bins. The entries are the values *between* the histograms.
|
// histogram bins. The entries are the values *between* the histograms.
|
||||||
for (auto act = day_from; act <= day_to; inc(act)) {
|
for (auto act = day_from; act <= day_to; inc(act)) {
|
||||||
double val = date_to_double(act[0], act[1], act[2]);
|
double val = date_to_double(act[0], act[1], act[2]);
|
||||||
if (act[1] == 0) {
|
if (act[1] == 0 && act[2] == 1) {
|
||||||
res.push_back({ QString::number(act[0]), val, true });
|
res.push_back({ QString::number(act[0]), val, true });
|
||||||
} else if (act[2] == 0) {
|
} else if (act[2] == 1) {
|
||||||
res.push_back({ monthname(act[1]), val, true });
|
res.push_back({ monthname(act[1]), val, true });
|
||||||
} else {
|
} else {
|
||||||
QString s = format.arg(QString::number(act[2]), sep, QString::number(act[1] + 1));
|
QString s = format.arg(QString::number(act[2]), sep, QString::number(act[1] + 1));
|
||||||
|
|
Loading…
Add table
Reference in a new issue