From 4d1595681afc377165ee6e1fe1d0d3f46792d741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 20 Apr 2018 18:34:36 +0200 Subject: [PATCH] #2657 Add title to legend, and hide the legend when ensemble curve set are not visible --- .../Summary/RimEnsembleCurveSet.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 7065d265aa..330119542b 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -172,15 +172,6 @@ void RimEnsembleCurveSet::loadDataAndUpdate(bool updateParentPlot) parentPlot->qwtPlot()->updateLegend(); parentPlot->updateAxes(); parentPlot->updateZoomInQwt(); - - if (m_showCurves() && m_colorMode() == BY_ENSEMBLE_PARAM) - { - parentPlot->qwtPlot()->addOrUpdateEnsembleCurveSetLegend(this); - } - else - { - parentPlot->qwtPlot()->removeEnsembleCurveSetLegend(this); - } } } @@ -507,6 +498,8 @@ void RimEnsembleCurveSet::updateCurveColors() { RimSummaryCaseCollection* group = m_yValuesSummaryGroup(); QString parameterName = m_ensembleParameter(); + m_legendConfig->setTitle(parameterName); + if (group && !parameterName.isEmpty()) { double minValue = std::numeric_limits::infinity(); @@ -549,7 +542,7 @@ void RimEnsembleCurveSet::updateCurveColors() firstAncestorOrThisOfType(plot); if (plot && plot->qwtPlot()) { - if (m_colorMode == BY_ENSEMBLE_PARAM && m_legendConfig->showLegend()) + if (isCurvesVisible() && m_colorMode == BY_ENSEMBLE_PARAM && m_legendConfig->showLegend()) { plot->qwtPlot()->addOrUpdateEnsembleCurveSetLegend(this); }