#8779 Summary Multi Plot : Add flag to control visibility of axis number values

Useful for making plots anonymized
This commit is contained in:
Magne Sjaastad 2022-04-07 14:06:57 +02:00
parent a0507c85f4
commit f099a8c89f
8 changed files with 43 additions and 2 deletions

View File

@ -82,6 +82,7 @@ RimPlotAxisProperties::RimPlotAxisProperties()
CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" );
CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" );
CAF_PDM_InitField( &m_isAxisInverted, "AxisInverted", false, "Invert Axis" );
CAF_PDM_InitField( &m_showNumbers, "ShowNumbers", true, "Show Numbers" );
auto defaultPlotAxis = caf::AppEnum<RiaDefines::PlotAxis>( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
CAF_PDM_InitField( &m_plotAxis, "PlotAxis", defaultPlotAxis, "Plot Axis" );
@ -215,6 +216,7 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
{
scaleGroup.add( &m_isLogarithmicScaleEnabled );
scaleGroup.add( &m_isAxisInverted );
scaleGroup.add( &m_showNumbers );
}
scaleGroup.add( &numberFormat );
@ -379,6 +381,22 @@ void RimPlotAxisProperties::setAxisInverted( bool inverted )
m_isAxisInverted = inverted;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotAxisProperties::showNumbers() const
{
return m_showNumbers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisProperties::setShowNumbers( bool enable )
{
m_showNumbers = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -77,6 +77,8 @@ public:
void setAutoZoom( bool enableAutoZoom ) override;
bool isAxisInverted() const override;
void setAxisInverted( bool inverted );
bool showNumbers() const;
void setShowNumbers( bool enable );
bool isDeletable() const override;
@ -124,6 +126,7 @@ private:
caf::PdmField<bool> m_displayUnitText;
caf::PdmField<bool> m_isAutoZoom;
caf::PdmField<bool> m_isAxisInverted;
caf::PdmField<bool> m_showNumbers;
caf::PdmField<double> m_visibleRangeMin;
caf::PdmField<double> m_visibleRangeMax;

View File

@ -825,6 +825,8 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis )
{
plotWidget()->enableAxis( riuPlotAxis, false );
}
plotWidget()->enableAxisNumberLabels( riuPlotAxis, axisProperties->showNumbers() );
}
}
}

View File

@ -92,8 +92,9 @@ public:
bool titleBold = false,
int alignment = (int)Qt::AlignCenter ) = 0;
virtual void enableAxis( RiuPlotAxis axis, bool isEnabled ) = 0;
virtual bool axisEnabled( RiuPlotAxis axis ) const = 0;
virtual void enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) = 0;
virtual void enableAxis( RiuPlotAxis axis, bool isEnabled ) = 0;
virtual bool axisEnabled( RiuPlotAxis axis ) const = 0;
virtual void setAxisScale( RiuPlotAxis axis, double min, double max ) = 0;
virtual void setAxisAutoScale( RiuPlotAxis axis, bool enable ) = 0;

View File

@ -197,6 +197,13 @@ void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int val
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -86,6 +86,7 @@ public:
bool titleBold = false,
int alignment = (int)Qt::AlignCenter ) override;
void enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) override;
void enableAxis( RiuPlotAxis axis, bool isEnabled ) override;
bool axisEnabled( RiuPlotAxis axis ) const override;

View File

@ -1129,6 +1129,14 @@ void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled )
m_plot->setAxisVisible( toQwtPlotAxis( axis ), isEnabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled )
{
m_plot->axisScaleDraw( toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, isEnabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -79,6 +79,7 @@ public:
int alignment = (int)Qt::AlignCenter ) override;
void enableAxis( RiuPlotAxis axis, bool isEnabled ) override;
void enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) override;
bool axisEnabled( RiuPlotAxis axis ) const override;
void setAxisScale( RiuPlotAxis axis, double min, double max ) override;