#2838 Ensemble Curve Name : Improve logic for display of legend

This commit is contained in:
Magne Sjaastad
2018-05-02 12:00:21 +02:00
parent 26975e3ce3
commit b023bd02a3
2 changed files with 22 additions and 11 deletions

View File

@@ -19,6 +19,7 @@
#include "RimPlotCurve.h"
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveCollection.h"
#include "RimSummaryCurveFilter.h"
@@ -583,14 +584,6 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
{
bool showLegendInQwt = m_showLegend();
RimSummaryPlot* summaryPlot = nullptr;
this->firstAncestorOrThisOfType(summaryPlot);
if (summaryPlot && summaryPlot->curveCount() == 1)
{
// Disable display of legend if the summary plot has only one single curve
showLegendInQwt = false;
}
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
this->firstAncestorOrThisOfType(ensembleCurveSet);
if (ensembleCurveSet)
@@ -602,6 +595,21 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate()
showLegendInQwt = false;
}
}
else
{
RimSummaryPlot* summaryPlot = nullptr;
this->firstAncestorOrThisOfType(summaryPlot);
if (summaryPlot)
{
if (summaryPlot->ensembleCurveSets()->visibleCurveSets().empty() && summaryPlot->curveCount() == 1)
{
// Disable display of legend if the summary plot has only one single curve
showLegendInQwt = false;
}
}
}
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, showLegendInQwt);
}