summaryrefslogtreecommitdiffstats
path: root/stats/statsview.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-04 17:16:13 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-06 12:31:22 -0800
commit23d781debab71d7cdac2fd9213938c33376a8bf1 (patch)
tree808868c1b9100236fa34717c0e72d24f23ecbeb2 /stats/statsview.cpp
parent76136010bf72e6452701dd7dffc24c9eabfaf97d (diff)
downloadsubsurface-23d781debab71d7cdac2fd9213938c33376a8bf1.tar.gz
statistics: save chart in axis class
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>
Diffstat (limited to 'stats/statsview.cpp')
-rw-r--r--stats/statsview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/stats/statsview.cpp b/stats/statsview.cpp
index 817f8001d..11dbe4f1e 100644
--- a/stats/statsview.cpp
+++ b/stats/statsview.cpp
@@ -86,7 +86,7 @@ StatsView::~StatsView()
void StatsView::plotAreaChanged(const QRectF &)
{
for (auto &axis: axes)
- axis->updateLabels(chart);
+ axis->updateLabels();
for (auto &series: series)
series->updatePositions();
for (QuartileMarker &marker: quartileMarkers)
@@ -142,9 +142,9 @@ void StatsView::setTitle(const QString &s)
template <typename T, class... Args>
T *StatsView::createAxis(const QString &title, Args&&... args)
{
- T *res = new T(std::forward<Args>(args)...);
+ T *res = new T(chart, std::forward<Args>(args)...);
axes.emplace_back(res);
- axes.back()->updateLabels(chart);
+ axes.back()->updateLabels();
axes.back()->qaxis()->setTitleText(title);
return res;
}