diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-18 22:41:43 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2021-01-20 08:47:18 +0100 |
commit | 9e61a6372a0709a6ddaef5749a27b05d84c5f70c (patch) | |
tree | 5482e33d3230d9089022f527e2e6d6685c571772 | |
parent | db69c38245cc260d19e189716e73dbbbedd56273 (diff) | |
download | subsurface-9e61a6372a0709a6ddaef5749a27b05d84c5f70c.tar.gz |
statistics: fix range in categorical axes
Fix a bug that was fixed in b5c8d0dbb4 and reintroduced in
e7907c494f. Here is the original commit message:
The range for a one-bin chart is [-0.5,0.5], thus the range
in an n-bin chart is [-0.5,n-0.5], not [-0.5,n+0.5].
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | stats/statsaxis.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/stats/statsaxis.cpp b/stats/statsaxis.cpp index 7af41c14b..92c972e0e 100644 --- a/stats/statsaxis.cpp +++ b/stats/statsaxis.cpp @@ -379,7 +379,10 @@ CategoryAxis::CategoryAxis(StatsView &view, const QString &title, const std::vec StatsAxis(view, title, horizontal, true), labelsText(labels) { - setRange(-0.5, static_cast<double>(labels.size()) + 0.5); + if (!labels.empty()) + setRange(-0.5, static_cast<double>(labels.size()) - 0.5); + else + setRange(-1.0, 1.0); } // No implementation because the labels are inside ticks and this |