mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Missing legend (#9095)
* Make sure ensemble curveset legends are shown in multiplot legend. * Remove information already shown in title from curve legend. * Fix missing legend when creating curve plot from ensemble curves * Show actual curve color in legend
This commit is contained in:
@@ -304,11 +304,6 @@ void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot )
|
||||
{
|
||||
curve->setParentPlotNoReplot( plot );
|
||||
}
|
||||
|
||||
if ( !m_plotCurveForLegendText )
|
||||
{
|
||||
m_plotCurveForLegendText = plot->createPlotCurve( nullptr, "", Qt::black );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -338,15 +333,6 @@ void RimEnsembleCurveSet::reattachPlotCurves()
|
||||
{
|
||||
curve->reattach();
|
||||
}
|
||||
|
||||
if ( m_plotCurveForLegendText )
|
||||
{
|
||||
m_plotCurveForLegendText->detach();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot && plot->plotWidget() ) m_plotCurveForLegendText->attachToPlot( plot->plotWidget() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -625,15 +611,6 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
|
||||
if ( changedField == &m_showCurves )
|
||||
{
|
||||
if ( !m_showCurves() && m_plotCurveForLegendText )
|
||||
{
|
||||
// Need to detach the legend since the plot type might change from Qwt to QtCharts.
|
||||
// The plot curve for legend text needs to be recreated when curves are shown next time.
|
||||
m_plotCurveForLegendText->detach();
|
||||
delete m_plotCurveForLegendText;
|
||||
m_plotCurveForLegendText = nullptr;
|
||||
}
|
||||
|
||||
loadDataAndUpdate( true );
|
||||
|
||||
updateConnectedEditors();
|
||||
@@ -1589,6 +1566,11 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
curvesToColor[i]->updateCurveAppearance();
|
||||
}
|
||||
|
||||
if ( m_plotCurveForLegendText )
|
||||
{
|
||||
m_plotCurveForLegendText->setColor( RiaColorTools::toQColor( m_color ) );
|
||||
}
|
||||
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot && plot->plotWidget() )
|
||||
@@ -1730,9 +1712,6 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
|
||||
newSummaryCurves[i]->updatePlotAxis();
|
||||
newSummaryCurves[i]->setShowInLegend( false );
|
||||
}
|
||||
|
||||
if ( plot->plotWidget() && m_plotCurveForLegendText )
|
||||
m_plotCurveForLegendText->attachToPlot( plot->plotWidget() );
|
||||
}
|
||||
|
||||
if ( plot->plotWidget() )
|
||||
@@ -1741,6 +1720,14 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
|
||||
plot->scheduleReplotIfVisible();
|
||||
plot->updateAxes();
|
||||
plot->updatePlotInfoLabel();
|
||||
|
||||
if ( !m_plotCurveForLegendText )
|
||||
{
|
||||
m_plotCurveForLegendText =
|
||||
plot->plotWidget()->createPlotCurve( nullptr, "", RiaColorTools::toQColor( m_color ) );
|
||||
}
|
||||
m_plotCurveForLegendText->attachToPlot( plot->plotWidget() );
|
||||
updateEnsembleLegendItem();
|
||||
}
|
||||
}
|
||||
updateCurveColors();
|
||||
@@ -2044,8 +2031,8 @@ QString RimEnsembleCurveSet::createAutoName() const
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
|
||||
QString curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(),
|
||||
plot->activePlotTitleHelperAllCurves() );
|
||||
QString curveSetName =
|
||||
m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), plot->plotTitleHelper() );
|
||||
if ( curveSetName.isEmpty() )
|
||||
{
|
||||
curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), nullptr );
|
||||
|
||||
Reference in New Issue
Block a user