aboutsummaryrefslogtreecommitdiffstats
path: root/stats/boxseries.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-17 21:07:57 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2021-01-20 08:47:18 +0100
commit409f159e1d8875f72f50d371860d4aef1975f065 (patch)
treef7a5a3c140ef318b48bb09b74429c8c79239e6f0 /stats/boxseries.h
parent5d5ebfcf3c737aa8c36192eb7bf7d7dee6b33099 (diff)
downloadsubsurface-409f159e1d8875f72f50d371860d4aef1975f065.tar.gz
statistics: convert box-and-whiskers plot to QSG
This is lazy: Derive from the bar chart item and add whiskers in the subclassed render() function. The code is ugly, because the base class function clears the dirty flags and therefore the derived class has to remember them. Oh well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/boxseries.h')
-rw-r--r--stats/boxseries.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/stats/boxseries.h b/stats/boxseries.h
index c32f903ca..487870701 100644
--- a/stats/boxseries.h
+++ b/stats/boxseries.h
@@ -5,13 +5,12 @@
#ifndef BOX_SERIES_H
#define BOX_SERIES_H
+#include "chartitem.h"
#include "statsseries.h"
#include "statsvariables.h" // for StatsQuartiles
#include <memory>
#include <vector>
-#include <QGraphicsLineItem>
-#include <QGraphicsRectItem>
struct InformationBox;
class QGraphicsScene;
@@ -36,16 +35,12 @@ private:
int getItemUnderMouse(const QPointF &f);
struct Item {
- QGraphicsRectItem box;
- QGraphicsLineItem topWhisker, bottomWhisker;
- QGraphicsLineItem topBar, bottomBar;
- QGraphicsLineItem center;
- QRectF bounding; // bounding box in screen coordinates
- ~Item();
+ std::unique_ptr<ChartBoxItem> item;
double lowerBound, upperBound;
StatsQuartiles q;
QString binName;
- Item(QGraphicsScene *scene, BoxSeries *series, double lowerBound, double upperBound, const StatsQuartiles &q, const QString &binName);
+ Item(StatsView &view, BoxSeries *series, double lowerBound, double upperBound, const StatsQuartiles &q, const QString &binName);
+ ~Item();
void updatePosition(BoxSeries *series);
void highlight(bool highlight);
};