summaryrefslogtreecommitdiffstats
path: root/stats/statsaxis.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-06 14:17:51 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-06 12:31:22 -0800
commit405e6b6b693234024ae541a74cfb9733f3b8f09d (patch)
treef95b47d547c77ed492f357118b5b87071e199b99 /stats/statsaxis.cpp
parentab324ed769b4d39816020bf649defb61cb4bff41 (diff)
downloadsubsurface-405e6b6b693234024ae541a74cfb9733f3b8f09d.tar.gz
statistics: fix chart features: regression line and median/mean
The coordinates of these were calculated when creating the feature. This is wrong, because the min/max values of the axes can change on resize to get "nice" number. Therefore, recalculate after resizing. This means that the general "LineMarker" class has to be split into two classes, one for regression lines and one for median/mean markers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/statsaxis.cpp')
-rw-r--r--stats/statsaxis.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/stats/statsaxis.cpp b/stats/statsaxis.cpp
index 3bdb8e427..ebd41fb94 100644
--- a/stats/statsaxis.cpp
+++ b/stats/statsaxis.cpp
@@ -52,6 +52,12 @@ std::pair<double, double> StatsAxis::minMax() const
return { min, max };
}
+std::pair<double, double> StatsAxis::minMaxScreen() const
+{
+ return horizontal ? std::make_pair(zeroOnScreen, zeroOnScreen + size)
+ : std::make_pair(zeroOnScreen, zeroOnScreen - size);
+}
+
void StatsAxis::setRange(double minIn, double maxIn)
{
min = minIn;