mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#11696 Make sure PC axis is visible when required
Use QwtPlotCurve directly to make it possible to see the Y Axis
This commit is contained in:
@@ -27,14 +27,12 @@
|
||||
#include "RiuDockedQwtPlot.h"
|
||||
#include "RiuGuiTheme.h"
|
||||
#include "RiuPlotCurveSymbol.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuQwtSymbol.h"
|
||||
#include "RiuRelativePermeabilityPlotUpdater.h"
|
||||
#include "RiuTextDialog.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfTrace.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_plot.h"
|
||||
@@ -89,6 +87,14 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par
|
||||
, m_swat( HUGE_VAL )
|
||||
, m_sgas( HUGE_VAL )
|
||||
, m_plotUpdater( new RiuRelativePermeabilityPlotUpdater( this ) )
|
||||
, m_qwtPlot( nullptr )
|
||||
, m_selectedCurvesButtonGroup( nullptr )
|
||||
, m_groupBox( nullptr )
|
||||
, m_logarithmicScaleKrAxisCheckBox( nullptr )
|
||||
, m_showUnscaledCheckBox( nullptr )
|
||||
, m_fixedXAxisCheckBox( nullptr )
|
||||
, m_fixedLeftYAxisCheckBox( nullptr )
|
||||
|
||||
{
|
||||
m_qwtPlot = new RelPermQwtPlot( this );
|
||||
m_qwtPlot->setProperty( "qss-class", "RelPermPlot" );
|
||||
@@ -161,7 +167,6 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par
|
||||
RiuRelativePermeabilityPlotPanel::~RiuRelativePermeabilityPlotPanel()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -352,11 +357,10 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS
|
||||
plotOnWhichYAxis = RIGHT_YAXIS;
|
||||
}
|
||||
|
||||
RiuQwtPlotCurve* qwtCurve = new RiuQwtPlotCurve( nullptr, curve.name.c_str() );
|
||||
QwtPlotCurve* qwtCurve = new QwtPlotCurve( curve.name.c_str() );
|
||||
|
||||
CVF_ASSERT( curve.saturationVals.size() == curve.yVals.size() );
|
||||
const bool includePositiveValuesOnly = ( logScaleLeftAxis && plotOnWhichYAxis == LEFT_YAXIS );
|
||||
qwtCurve->setSamplesFromXValuesAndYValues( curve.saturationVals, curve.yVals, includePositiveValuesOnly );
|
||||
qwtCurve->setSamples( curve.saturationVals.data(), curve.yVals.data(), static_cast<int>( curve.saturationVals.size() ) );
|
||||
|
||||
qwtCurve->setTitle( curve.name.c_str() );
|
||||
|
||||
@@ -390,7 +394,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS
|
||||
const QPen curvePen( QBrush(), 1, penStyle );
|
||||
qwtCurve->setPen( curvePen );
|
||||
|
||||
RiuQwtSymbol* curveSymbol = new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_ELLIPSE );
|
||||
auto* curveSymbol = new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_ELLIPSE );
|
||||
curveSymbol->setSize( 6, 6 );
|
||||
curveSymbol->setBrush( Qt::NoBrush );
|
||||
qwtCurve->setSymbol( curveSymbol );
|
||||
@@ -403,7 +407,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS
|
||||
|
||||
if ( plotOnWhichYAxis == RIGHT_YAXIS )
|
||||
{
|
||||
qwtCurve->setYAxis( RiuPlotAxis::defaultRight() );
|
||||
qwtCurve->setYAxis( { QwtAxis::YRight, 0 } );
|
||||
shouldEnableRightYAxis = true;
|
||||
}
|
||||
|
||||
@@ -432,9 +436,15 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS
|
||||
}
|
||||
|
||||
if ( shouldEnableRightYAxis )
|
||||
{
|
||||
plot->setAxesCount( QwtAxis::YRight, 1 );
|
||||
plot->setAxisVisible( QwtAxis::YRight, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
plot->setAxesCount( QwtAxis::YRight, 0 );
|
||||
plot->setAxisVisible( QwtAxis::YRight, false );
|
||||
}
|
||||
|
||||
addTransparentCurve( plot, points, axes, logScaleLeftAxis );
|
||||
|
||||
|
Reference in New Issue
Block a user