From ccc95f938a8538bde005b2865dc2868ffa8946c8 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 4 Jan 2021 20:34:44 +0100 Subject: 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 --- stats/statsseries.cpp | 3 ++- stats/statsseries.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'stats') 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 -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 -- cgit v1.2.3-70-g09d2