#8522 Summary Plot: Prune unused axes after move or delete

This commit is contained in:
Kristian Bendiksen
2022-02-21 11:32:26 +01:00
parent 1a1acfa006
commit 10cb2d7d0b
9 changed files with 62 additions and 11 deletions

View File

@@ -95,8 +95,15 @@ RimPlotAxisProperties::RimPlotAxisProperties()
m_annotations.uiCapability()->setUiTreeHidden( true );
updateOptionSensitivity();
}
setDeletable( true );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotAxisProperties::isDeletable() const
{
// The default axes (which have index 0) are not deletable
return m_plotAxisIndex != 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -77,6 +77,9 @@ public:
bool isAxisInverted() const override;
void setAxisInverted( bool inverted );
bool isDeletable() const override;
std::vector<RimPlotAxisAnnotation*> annotations() const override;
void appendAnnotation( RimPlotAxisAnnotation* annotation ) override;
void removeAllAnnotations() override;

View File

@@ -753,6 +753,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
updatePlotAxis();
plot->updateAxes();
plot->updateAll();
updateTextInPlot = true;
}
@@ -2099,6 +2100,11 @@ void RimEnsembleCurveSet::setAxisY( RiuPlotAxis plotAxis )
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis );
for ( RimSummaryCurve* curve : curves() )
{
curve->setLeftOrRightAxisY( axisY() );
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -845,7 +845,7 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis )
}
double min, max;
RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves );
RimPlotAxisLogRangeCalculator calc( plotAxis.axis(), plotCurves );
calc.computeAxisRange( &min, &max );
if ( yAxisProps->isAxisInverted() )
@@ -2008,7 +2008,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
for ( auto axisProperties : m_axisProperties )
{
plotWidget()->ensureAxis( axisProperties->plotAxisType() );
plotWidget()->ensureAxisIsCreated( axisProperties->plotAxisType() );
}
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
@@ -2482,6 +2482,13 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr
if ( plotWidget() )
{
std::set<RiuPlotAxis> usedPlotAxis;
for ( auto axisProperties : m_axisProperties )
{
usedPlotAxis.insert( axisProperties->plotAxisType() );
}
plotWidget()->pruneAxes( usedPlotAxis );
updateAxes();
plotWidget()->scheduleReplot();
}