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>
This commit is contained in:
Berthold Stoeger 2021-01-15 18:39:14 +01:00 committed by bstoeger
parent faf3e7079d
commit 2008857660
6 changed files with 124 additions and 75 deletions

26
stats/regressionitem.h Normal file
View file

@ -0,0 +1,26 @@
// A regression line and confidence area
#ifndef REGRESSION_H
#define REGRESSION_H
#include "chartitem.h"
class StatsAxis;
class StatsView;
struct regression_data {
double a,b;
double res2, r2, sx2, xavg;
int n;
};
class RegressionItem : public ChartPixmapItem {
public:
RegressionItem(StatsView &view, regression_data data, StatsAxis *xAxis, StatsAxis *yAxis);
~RegressionItem();
void updatePosition();
private:
StatsAxis *xAxis, *yAxis;
regression_data reg;
};
#endif