diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-04 21:41:30 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-06 12:31:22 -0800 |
commit | 90129aa26f991676be8b0f94a5c1cffe123ffbb6 (patch) | |
tree | b93de819524fad37f11da28e041018fb42350e19 /stats/statsview.h | |
parent | ccc95f938a8538bde005b2865dc2868ffa8946c8 (diff) | |
download | subsurface-90129aa26f991676be8b0f94a5c1cffe123ffbb6.tar.gz |
statistics: render title
Since we want to get rid of QtCharts, we have to render our own
title. Simply keep around a QGraphicsSimpleTextItem and put in
the center of the chart. Define the borders to the scene as
constants.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'stats/statsview.h')
-rw-r--r-- | stats/statsview.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/stats/statsview.h b/stats/statsview.h index 1ef88b96c..fac61a55b 100644 --- a/stats/statsview.h +++ b/stats/statsview.h @@ -4,6 +4,7 @@ #include "statsstate.h" #include <memory> +#include <QFont> #include <QQuickWidget> struct dive; @@ -17,6 +18,7 @@ namespace QtCharts { class QChart; } class QGraphicsLineItem; +class QGraphicsSimpleTextItem; class StatsSeries; class CategoryAxis; class CountAxis; @@ -74,6 +76,8 @@ private: const StatsVariable *categoryVariable, const StatsBinner *categoryBinner, const StatsVariable *valueVariable); void plotScatter(const std::vector<dive *> &dives, const StatsVariable *categoryVariable, const StatsVariable *valueVariable); void setTitle(const QString &); + void updateTitlePos(); // After resizing, set title to correct position + void plotChart(); template <typename T, class... Args> T *createSeries(Args&&... args); @@ -115,11 +119,13 @@ private: StatsState state; QtCharts::QChart *chart; + QFont titleFont; std::vector<std::unique_ptr<StatsAxis>> axes; std::vector<std::unique_ptr<StatsSeries>> series; std::unique_ptr<Legend> legend; std::vector<QuartileMarker> quartileMarkers; std::vector<LineMarker> lineMarkers; + std::unique_ptr<QGraphicsSimpleTextItem> title; StatsSeries *highlightedSeries; // This is unfortunate: we can't derive from QChart, because the chart is allocated by QML. |