summaryrefslogtreecommitdiffstats
path: root/stats/statsview.cpp
AgeCommit message (Collapse)Author
2021-01-06statistics: fix chart features: regression line and median/meanGravatar Berthold Stoeger
The coordinates of these were calculated when creating the feature. This is wrong, because the min/max values of the axes can change on resize to get "nice" number. Therefore, recalculate after resizing. This means that the general "LineMarker" class has to be split into two classes, one for regression lines and one for median/mean markers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: paint custom gridGravatar Berthold Stoeger
With removal of QtCharts' axes, the grid was lost. Readd it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: draw title of axesGravatar Berthold Stoeger
Easy enough to implement, but one weirdness: To get the height of the rotated text, one has to access the width() member of the boundingRect. I'm not sure if that makes sense, but so be it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: replace QtCharts' axesGravatar Berthold Stoeger
Replace by custom implementation, with the ultimate goal to remove the QtCharts module. This doesn't yet display axis titles or a grid. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06statistics: render titleGravatar Berthold Stoeger
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>
2021-01-06statistics: save chart in axis classGravatar Berthold Stoeger
The chart was passed as argument to the function recalculating the axis labels. Instead, pass the chart in the constructor of the axes and save it. This gains us flexibility for the future: There will be more functions that need to access the chart (e.g. resizing of the axes). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-04stats: fix line segment intersection mathGravatar Dirk Hohndel
Linear algebra class was a while ago, but somehow this does look more logical to me. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-03statistics: don't crash if the QCharts QML modules aren't foundGravatar Dirk Hohndel
We don't really give a user visible error message which is kind of a problem, but at least we don't crash anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-03statistics: clip regression lineGravatar Berthold Stoeger
A steep regression line would shoot out of the chart. Therefore, clip to the y = minY and y = maxY lines. QtGraphicsScene has its own clipping routines, but they are very general, so let's do this trivial case by hand. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-03statistics: add parentheses around percentage in horizontal barsGravatar Berthold Stoeger
For better visual guidance, format labels as "count (percentage)" in horizontal bar charts. In vertical bar charts two lines are used anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-03statistics: reverse chart selection logicGravatar Berthold Stoeger
The old ways was to select the chart first, then depending on the chart choose the binning. Willem says that it should work the other way round: select the binning (or operation) and make the charts depend on that. I'm not arguing one way or the other, just note that the new way is much more tricky, because it is easy to get unsupported combinations. For example, there is no chart where the first variable is unbinned, but the second axis is binned or has an operation. This makes things distinctly more tricky and this code still needs a thorough audit. Since this is all more tricky, implement a "invalid" chart state. Ideally that should be never shown to the user, but let's try to be defensive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02statistics: implement StatsViewGravatar Berthold Stoeger
The StatsView shows the chart described by the StatsState structure. It is based on a QML ChartView. This should make it possible to easily port to mobile. It does not include any of the UI around the chart, viz. the variable and chart selection, etc. The code checking for the statistical significance of the regression line was written by Willem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>