From 9d21faf38cbbfec0f47380948d8e0eafe7bbabd9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 23 Nov 2023 11:36:47 +0100 Subject: [PATCH] Make sure summary case is set before assigning curve axis --- .../SummaryPlotCommands/RicSummaryPlotEditorUi.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index d017dc4766..cc85235e62 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -705,7 +705,7 @@ void RicSummaryPlotEditorUi::updateTargetPlot() //-------------------------------------------------------------------------------------------------- void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve, RimSummaryPlot* plot, bool forceVisible ) { - RimSummaryCurve* curveCopy = + auto curveCopy = dynamic_cast( curve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); CVF_ASSERT( curveCopy ); @@ -714,11 +714,11 @@ void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve curveCopy->setCheckState( true ); } - plot->addCurveNoUpdate( curveCopy, false ); - curveCopy->setLeftOrRightAxisY( curve->axisY() ); - - // The curve creator is not a descendant of the project, and need to be set manually curveCopy->setSummaryCaseY( curve->summaryCaseY() ); + + bool autoAssignAxis = true; + plot->addCurveNoUpdate( curveCopy, autoAssignAxis ); + curveCopy->initAfterReadRecursively(); curveCopy->loadDataAndUpdate( false ); }