Use a time based summary plot as source for time axis linking

If a summary plot is created with a cross plot curve, the time axis object might not be configured. Always use a time based summary plot as source for linking of time axis.
This commit is contained in:
Magne Sjaastad
2023-10-27 15:45:15 +02:00
parent 184ed5fb65
commit 4ffd11da24
2 changed files with 21 additions and 8 deletions

View File

@@ -456,7 +456,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
}
else if ( changedField == &m_linkTimeAxis )
{
updateTimeAxisRangesFromFirstPlot();
updateTimeAxisRangesFromFirstTimePlot();
}
else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation || changedField == &m_linkTimeAxis )
{
@@ -760,7 +760,7 @@ void RimSummaryMultiPlot::zoomAll()
updateZoom();
updateTimeAxisRangesFromFirstPlot();
updateTimeAxisRangesFromFirstTimePlot();
return;
}
@@ -770,18 +770,31 @@ void RimSummaryMultiPlot::zoomAll()
syncAxisRanges();
updateTimeAxisRangesFromFirstPlot();
updateTimeAxisRangesFromFirstTimePlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::updateTimeAxisRangesFromFirstPlot()
void RimSummaryMultiPlot::updateTimeAxisRangesFromFirstTimePlot()
{
if ( m_linkTimeAxis && !summaryPlots().empty() )
if ( m_linkTimeAxis )
{
setAutoScaleXEnabled( false );
syncTimeAxisRanges( summaryPlots().front() );
auto allPlots = summaryPlots();
for ( auto plot : allPlots )
{
auto curves = plot->summaryAndEnsembleCurves();
for ( auto curve : curves )
{
if ( curve->axisTypeX() == RiaDefines::HorizontalAxisType::TIME )
{
setAutoScaleXEnabled( false );
syncTimeAxisRanges( plot );
return;
}
}
}
}
}

View File

@@ -148,7 +148,7 @@ private:
void onSubPlotAxisReloadRequired( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot );
void onSubPlotAutoTitleChanged( const caf::SignalEmitter* emitter, bool isEnabled );
void updateTimeAxisRangesFromFirstPlot();
void updateTimeAxisRangesFromFirstTimePlot();
void updateReadOnlyState();