mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8522 Summary Plot: Prune unused axes after move or delete
This commit is contained in:
@@ -860,7 +860,7 @@ void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQtChartsPlotWidget::ensureAxis( RiuPlotAxis axis )
|
||||
void RiuQtChartsPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis )
|
||||
{
|
||||
if ( m_axes.find( axis ) == m_axes.end() )
|
||||
{
|
||||
@@ -874,7 +874,7 @@ void RiuQtChartsPlotWidget::ensureAxis( RiuPlotAxis axis )
|
||||
void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series )
|
||||
{
|
||||
// Make sure the axis we are about to set exists.
|
||||
ensureAxis( axis );
|
||||
ensureAxisIsCreated( axis );
|
||||
|
||||
if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) )
|
||||
{
|
||||
@@ -1111,3 +1111,20 @@ Qt::Alignment RiuQtChartsPlotWidget::mapPlotAxisToQtAlignment( RiaDefines::PlotA
|
||||
if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft;
|
||||
return Qt::AlignRight;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQtChartsPlotWidget::pruneAxes( const std::set<RiuPlotAxis>& usedAxes )
|
||||
{
|
||||
for ( auto [plotAxis, qtAxis] : m_axes )
|
||||
{
|
||||
if ( usedAxes.count( plotAxis ) == 0 )
|
||||
{
|
||||
// This axis is now unused, and can be disabled
|
||||
qtAxis->setVisible( false );
|
||||
m_axesEnabled[plotAxis] = false;
|
||||
m_axesAutoScale[plotAxis] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user