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 committed 2023-10-30 11:20:21 +01:00
1 parent 184ed5fb65
commit 4ffd11da24
2 files changed
+21 -8

No files matched your search

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