mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 04:00:57 -06:00
#2838 Ensemble Curve Name : Improve logic for display of legend
This commit is contained in:
parent
26975e3ce3
commit
b023bd02a3
@ -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);
|
||||
}
|
||||
|
@ -212,11 +212,14 @@ std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::visibleCurveSet
|
||||
{
|
||||
std::vector<RimEnsembleCurveSet*> visible;
|
||||
|
||||
for (auto c : m_curveSets)
|
||||
if (m_showCurves())
|
||||
{
|
||||
if (c->isCurvesVisible())
|
||||
for (auto c : m_curveSets)
|
||||
{
|
||||
visible.push_back(c);
|
||||
if (c->isCurvesVisible())
|
||||
{
|
||||
visible.push_back(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user