mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
5d5ebfcf3c
commit
409f159e1d
4 changed files with 117 additions and 56 deletions
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue