aboutsummaryrefslogtreecommitdiffstats
path: root/stats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-04 20:34:44 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-06 12:31:22 -0800
commitccc95f938a8538bde005b2865dc2868ffa8946c8 (patch)
treef7002968f107cae291f1ee38daa3533f1f8ed1f6 /stats
parent23d781debab71d7cdac2fd9213938c33376a8bf1 (diff)
downloadsubsurface-ccc95f938a8538bde005b2865dc2868ffa8946c8.tar.gz
statistics: save axis with series
In the future we want to use our own axis implementation to convert from/to screen coordinates. For this purpose, we need to save the axes with the series. Especially if we want to support multiple series on different axes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats')
-rw-r--r--stats/statsseries.cpp3
-rw-r--r--stats/statsseries.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/stats/statsseries.cpp b/stats/statsseries.cpp
index 2fff4b306..48b31336e 100644
--- a/stats/statsseries.cpp
+++ b/stats/statsseries.cpp
@@ -4,7 +4,8 @@
#include <QChart>
-StatsSeries::StatsSeries(QtCharts::QChart *chart, StatsAxis *xAxis, StatsAxis *yAxis)
+StatsSeries::StatsSeries(QtCharts::QChart *chart, StatsAxis *xAxis, StatsAxis *yAxis) :
+ xAxis(xAxis), yAxis(yAxis)
{
chart->addSeries(this);
if (xAxis && yAxis) {
diff --git a/stats/statsseries.h b/stats/statsseries.h
index 567f32644..9b247fb95 100644
--- a/stats/statsseries.h
+++ b/stats/statsseries.h
@@ -22,6 +22,8 @@ public:
virtual void updatePositions() = 0; // Called if chart geometry changes.
virtual bool hover(QPointF pos) = 0; // Called on mouse movement. Return true if an item of this series is highlighted.
virtual void unhighlight() = 0; // Unhighlight any highlighted item.
+protected:
+ StatsAxis *xAxis, *yAxis; // May be zero for charts without axes (pie charts).
};
#endif