diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-15 18:39:14 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2021-01-20 08:47:18 +0100 |
commit | 20088576604a3159cc9891bcfea888c15b096a96 (patch) | |
tree | 244e1996c21adb6071346d754e5ac401d726aa15 /stats/statsview.h | |
parent | faf3e7079ddd680ab0e53a27a7ddc0d863792117 (diff) | |
download | subsurface-20088576604a3159cc9891bcfea888c15b096a96.tar.gz |
statistics: render regression item using QSGNode
Render the confidence area and the regression line into a pixmap
and show that using a QSGNode.
It is unclear whether it is preferred to do it this way or to
triangulate the confidence area into triangles to be drawn by
the shader.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/statsview.h')
-rw-r--r-- | stats/statsview.h | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/stats/statsview.h b/stats/statsview.h index f472e1e16..b0a199200 100644 --- a/stats/statsview.h +++ b/stats/statsview.h @@ -9,7 +9,6 @@ #include <QImage> #include <QPainter> #include <QQuickItem> -#include <QGraphicsPolygonItem> struct dive; struct StatsBinner; @@ -17,7 +16,6 @@ struct StatsBin; struct StatsState; struct StatsVariable; -class QGraphicsLineItem; class QGraphicsSimpleTextItem; class StatsSeries; class CategoryAxis; @@ -26,6 +24,7 @@ class CountAxis; class HistogramAxis; class HistogramMarker; class QuartileMarker; +class RegressionItem; class StatsAxis; class StatsGrid; class Legend; @@ -36,13 +35,6 @@ enum class ChartSubType : int; enum class ChartZValue : int; enum class StatsOperation : int; -struct regression_data { - double a,b; - double res2, r2, sx2, xavg; - int n; -}; - - class StatsView : public QQuickItem { Q_OBJECT public: @@ -127,17 +119,6 @@ private: // Helper functions to add feature to the chart void addLineMarker(double pos, double low, double high, const QPen &pen, bool isHorizontal); - // A regression line - struct RegressionLine { - std::unique_ptr<QGraphicsPolygonItem> item; - std::unique_ptr<QGraphicsPolygonItem> central; - StatsAxis *xAxis, *yAxis; - const struct regression_data reg; - void updatePosition(); - RegressionLine(const struct regression_data reg, QBrush brush, QGraphicsScene *scene, StatsAxis *xAxis, StatsAxis *yAxis); - }; - - void addLinearRegression(const struct regression_data reg, StatsAxis *xAxis, StatsAxis *yAxis); void addHistogramMarker(double pos, QColor color, bool isHorizontal, StatsAxis *xAxis, StatsAxis *yAxis); StatsState state; @@ -147,9 +128,9 @@ private: std::vector<std::unique_ptr<StatsSeries>> series; std::unique_ptr<Legend> legend; std::vector<std::unique_ptr<QuartileMarker>> quartileMarkers; - std::vector<RegressionLine> regressionLines; std::vector<std::unique_ptr<HistogramMarker>> histogramMarkers; std::unique_ptr<QGraphicsSimpleTextItem> title; + std::unique_ptr<RegressionItem> regressionItem; StatsSeries *highlightedSeries; StatsAxis *xAxis, *yAxis; Legend *draggedItem; |