mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve canvas top alignment in well log plots
This commit is contained in:
@@ -691,6 +691,19 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
|||||||
{
|
{
|
||||||
if ( !m_plotWidget ) return;
|
if ( !m_plotWidget ) return;
|
||||||
|
|
||||||
|
bool emptyRange = std::abs( m_visibleXRangeMax() - m_visibleXRangeMin ) <
|
||||||
|
1.0e-6 * std::max( 1.0, std::max( m_visibleXRangeMax(), m_visibleXRangeMin() ) );
|
||||||
|
|
||||||
|
if ( emptyRange )
|
||||||
|
{
|
||||||
|
m_plotWidget->enableGridLines( QwtPlot::xTop, false, false );
|
||||||
|
m_plotWidget->setAxisRange( QwtPlot::xTop, 0.0, 1.0 );
|
||||||
|
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, false );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, true );
|
||||||
|
|
||||||
if ( m_explicitTickIntervals )
|
if ( m_explicitTickIntervals )
|
||||||
{
|
{
|
||||||
m_plotWidget->setMajorAndMinorTickIntervals( QwtPlot::xTop,
|
m_plotWidget->setMajorAndMinorTickIntervals( QwtPlot::xTop,
|
||||||
@@ -733,7 +746,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
|||||||
m_plotWidget->enableGridLines( QwtPlot::xTop,
|
m_plotWidget->enableGridLines( QwtPlot::xTop,
|
||||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||||
|
}
|
||||||
RimWellLogPlot* wellLogPlot = nullptr;
|
RimWellLogPlot* wellLogPlot = nullptr;
|
||||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||||
if ( wellLogPlot )
|
if ( wellLogPlot )
|
||||||
|
|||||||
@@ -255,8 +255,6 @@ void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( QwtPlot::Axis axis, bool en
|
|||||||
{
|
{
|
||||||
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Ticks, enable );
|
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Ticks, enable );
|
||||||
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Labels, enable );
|
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Labels, enable );
|
||||||
axisScaleDraw( axis )->setMinimumExtent( axisExtent( axis ) );
|
|
||||||
setMinimumWidth( defaultMinimumWidth() + axisExtent( axis ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -351,12 +349,8 @@ int RiuQwtPlotWidget::axisExtent( QwtPlot::Axis axis ) const
|
|||||||
{
|
{
|
||||||
int lineExtent = 5;
|
int lineExtent = 5;
|
||||||
|
|
||||||
if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Ticks ) )
|
|
||||||
{
|
|
||||||
lineExtent += this->axisScaleDraw( axis )->maxTickLength();
|
lineExtent += this->axisScaleDraw( axis )->maxTickLength();
|
||||||
}
|
|
||||||
|
|
||||||
if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Labels ) )
|
|
||||||
{
|
{
|
||||||
QFont tickLabelFont = axisFont( axis );
|
QFont tickLabelFont = axisFont( axis );
|
||||||
// Make space for a fairly long value label
|
// Make space for a fairly long value label
|
||||||
|
|||||||
Reference in New Issue
Block a user