Skip to content

Commit

Permalink
Use a time based summary plot as source for time axis linking
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
magnesj committed Oct 27, 2023
1 parent 37f8343 commit 3a12c35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -760,7 +760,7 @@ void RimSummaryMultiPlot::zoomAll()

updateZoom();

updateTimeAxisRangesFromFirstPlot();
updateTimeAxisRangesFromFirstTimePlot();

return;
}
Expand All @@ -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;
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep
void onSubPlotAxisReloadRequired( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot );
void onSubPlotAutoTitleChanged( const caf::SignalEmitter* emitter, bool isEnabled );

void updateTimeAxisRangesFromFirstPlot();
void updateTimeAxisRangesFromFirstTimePlot();

void updateReadOnlyState();

Expand Down

0 comments on commit 3a12c35

Please sign in to comment.