mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8787 Summary Multiplot: Fix inversion of axis with axis aggregation.
This commit is contained in:
parent
01e670a3d8
commit
1aa41968a5
@ -768,10 +768,11 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
{
|
||||
double minVal = axis->visibleRangeMin();
|
||||
double maxVal = axis->visibleRangeMax();
|
||||
if ( axis->isAxisInverted() ) std::swap( minVal, maxVal );
|
||||
|
||||
if ( axisRanges.count( axis->plotAxisType() ) == 0 )
|
||||
{
|
||||
axisRanges[axis->plotAxisType()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() );
|
||||
axisRanges[axis->plotAxisType()] = std::make_pair( minVal, maxVal );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -787,7 +788,8 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
{
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
{
|
||||
const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
auto [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
if ( axis->isAxisInverted() ) std::swap( minVal, maxVal );
|
||||
axis->setAutoZoom( false );
|
||||
axis->setVisibleRangeMin( minVal );
|
||||
axis->setVisibleRangeMax( maxVal );
|
||||
@ -955,25 +957,23 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
// set all plots to use the global min/max values for each category
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
{
|
||||
QwtLinearScaleEngine scaleEngine;
|
||||
|
||||
const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
if ( axis->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT && minVal <= maxVal )
|
||||
auto [minVal, maxVal] = axisRanges[axis->plotAxisType()];
|
||||
if ( RiaDefines::isVertical( axis->plotAxisType().axis() ) && !std::isinf( minVal ) && !std::isinf( maxVal ) )
|
||||
{
|
||||
axis->setAutoZoom( false );
|
||||
|
||||
auto adjustedMin = minVal;
|
||||
auto adjustedMax = maxVal;
|
||||
if ( axis->isAxisInverted() ) std::swap( minVal, maxVal );
|
||||
|
||||
if ( !axis->isLogarithmicScaleEnabled() )
|
||||
{
|
||||
int maxMajorTickIntervalCount = 8;
|
||||
double stepSize = 0.0;
|
||||
scaleEngine.autoScale( maxMajorTickIntervalCount, adjustedMin, adjustedMax, stepSize );
|
||||
int maxMajorTickIntervalCount = 8;
|
||||
double stepSize = 0.0;
|
||||
QwtLinearScaleEngine scaleEngine;
|
||||
scaleEngine.autoScale( maxMajorTickIntervalCount, minVal, maxVal, stepSize );
|
||||
}
|
||||
|
||||
axis->setVisibleRangeMin( adjustedMin );
|
||||
axis->setVisibleRangeMax( adjustedMax );
|
||||
axis->setVisibleRangeMin( minVal );
|
||||
axis->setVisibleRangeMax( maxVal );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,11 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
if ( !m_linkSubPlotAxes() ) return;
|
||||
if ( !m_linkSubPlotAxes() )
|
||||
{
|
||||
syncAxisRanges();
|
||||
return;
|
||||
}
|
||||
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
@ -1142,6 +1146,8 @@ void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitte
|
||||
plot->updateAll();
|
||||
}
|
||||
}
|
||||
|
||||
syncAxisRanges();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -911,9 +911,10 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis )
|
||||
}
|
||||
else
|
||||
{
|
||||
plotWidget()->setAxisScale( yAxisProps->plotAxisType(),
|
||||
yAxisProps->visibleRangeMin(),
|
||||
yAxisProps->visibleRangeMax() );
|
||||
double min = yAxisProps->visibleRangeMin();
|
||||
double max = yAxisProps->visibleRangeMax();
|
||||
if ( yAxisProps->isAxisInverted() ) std::swap( min, max );
|
||||
plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max );
|
||||
}
|
||||
|
||||
plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() );
|
||||
@ -1662,6 +1663,8 @@ void RimSummaryPlot::updateZoomFromParentPlot()
|
||||
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties )
|
||||
{
|
||||
auto [axisMin, axisMax] = plotWidget()->axisRange( axisProperties->plotAxisType() );
|
||||
if ( axisProperties->isAxisInverted() ) std::swap( axisMin, axisMax );
|
||||
|
||||
axisProperties->setVisibleRangeMax( axisMax );
|
||||
axisProperties->setVisibleRangeMin( axisMin );
|
||||
axisProperties->updateConnectedEditors();
|
||||
|
Loading…
Reference in New Issue
Block a user