#14539 Summary Plot: Preserve user defined axis ranges when the data source changes

An axis range defined by the user is now kept when a summary case or ensemble is added, reloaded or replaced. The range is marked as user defined when the user edits the min/max values, unchecks "Set Range Automatically" or zooms interactively in the plot.

The user defined range is released by "Zoom All", by double click in a plot, by checking "Set Range Automatically" or by changing the Y axis range aggregation of a summary multi plot.
This commit is contained in:
Magne Sjaastad committed 2026-09-09 12:08:10 +02:00
1 parent f38332b2e6
commit 110bdbe0c7
11 files changed
+121 -7

No files matched your search

@@ -1404,6 +1404,28 @@ void RimSummaryPlot::zoomAll()
axisChanged.send( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::zoomAllAndReleaseUserDefinedRanges()
{
releaseUserDefinedAxisRanges();
zoomAll();
}
//--------------------------------------------------------------------------------------------------
/// Axis ranges defined by the user are kept when the data source of the plot is changed. Release the user defined
/// ranges to make the axes follow the data again.
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::releaseUserDefinedAxisRanges()
{
for ( const auto& ap : m_axisPropertiesArray )
{
ap->setRangeUserDefined( false );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1602,7 +1624,7 @@ void RimSummaryPlot::zoomAllForMultiPlot()
{
if ( auto multiPlot = firstAncestorOrThisOfType<RimMultiPlot>() )
{
multiPlot->zoomAll();
multiPlot->zoomAllAndReleaseUserDefinedRanges();
}
}
@@ -2628,6 +2650,13 @@ void RimSummaryPlot::onPlotZoomed()
setAutoScaleXEnabled( false );
setAutoScaleYEnabled( false );
// The user has defined the visible range by interactive zoom, and the range is kept when the data source of the
// plot is changed
for ( const auto& ap : m_axisPropertiesArray )
{
ap->setRangeUserDefined( true );
}
// Disable auto value for min/max fields
for ( auto p : plotAxes( RimPlotAxisProperties::Orientation::ANY ) )
{
@@ -2998,6 +3027,8 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
{
if ( ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_TOP || ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
if ( enabled && ap->isRangeUserDefined() ) continue;
ap->setAutoZoom( enabled );
}
}
@@ -3012,6 +3043,8 @@ void RimSummaryPlot::setAutoScaleYEnabled( bool enabled )
{
if ( ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
{
if ( enabled && ap->isRangeUserDefined() ) continue;
ap->setAutoZoom( enabled );
}
}