mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
76136010bf
commit
23d781deba
3 changed files with 35 additions and 30 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue