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:
parent
2284dadfec
commit
9656692afc
@ -691,49 +691,62 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
||||
{
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
if ( m_explicitTickIntervals )
|
||||
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->setMajorAndMinorTickIntervals( QwtPlot::xTop,
|
||||
m_majorTickInterval(),
|
||||
m_minorTickInterval(),
|
||||
m_visibleXRangeMin(),
|
||||
m_visibleXRangeMax() );
|
||||
m_plotWidget->enableGridLines( QwtPlot::xTop, false, false );
|
||||
m_plotWidget->setAxisRange( QwtPlot::xTop, 0.0, 1.0 );
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
int majorTickIntervals = 3;
|
||||
int minorTickIntervals = 0;
|
||||
switch ( m_widthScaleFactor() )
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, true );
|
||||
|
||||
if ( m_explicitTickIntervals )
|
||||
{
|
||||
case EXTRA_NARROW:
|
||||
majorTickIntervals = 3;
|
||||
minorTickIntervals = 2;
|
||||
break;
|
||||
case NARROW:
|
||||
majorTickIntervals = 3;
|
||||
minorTickIntervals = 5;
|
||||
break;
|
||||
case NORMAL:
|
||||
majorTickIntervals = 5;
|
||||
minorTickIntervals = 5;
|
||||
break;
|
||||
case WIDE:
|
||||
majorTickIntervals = 5;
|
||||
minorTickIntervals = 10;
|
||||
break;
|
||||
case EXTRA_WIDE:
|
||||
majorTickIntervals = 10;
|
||||
minorTickIntervals = 10;
|
||||
break;
|
||||
m_plotWidget->setMajorAndMinorTickIntervals( QwtPlot::xTop,
|
||||
m_majorTickInterval(),
|
||||
m_minorTickInterval(),
|
||||
m_visibleXRangeMin(),
|
||||
m_visibleXRangeMax() );
|
||||
}
|
||||
m_plotWidget->setAutoTickIntervalCounts( QwtPlot::xTop, majorTickIntervals, minorTickIntervals );
|
||||
m_plotWidget->setAxisRange( QwtPlot::xTop, m_visibleXRangeMin, m_visibleXRangeMax );
|
||||
else
|
||||
{
|
||||
int majorTickIntervals = 3;
|
||||
int minorTickIntervals = 0;
|
||||
switch ( m_widthScaleFactor() )
|
||||
{
|
||||
case EXTRA_NARROW:
|
||||
majorTickIntervals = 3;
|
||||
minorTickIntervals = 2;
|
||||
break;
|
||||
case NARROW:
|
||||
majorTickIntervals = 3;
|
||||
minorTickIntervals = 5;
|
||||
break;
|
||||
case NORMAL:
|
||||
majorTickIntervals = 5;
|
||||
minorTickIntervals = 5;
|
||||
break;
|
||||
case WIDE:
|
||||
majorTickIntervals = 5;
|
||||
minorTickIntervals = 10;
|
||||
break;
|
||||
case EXTRA_WIDE:
|
||||
majorTickIntervals = 10;
|
||||
minorTickIntervals = 10;
|
||||
break;
|
||||
}
|
||||
m_plotWidget->setAutoTickIntervalCounts( QwtPlot::xTop, majorTickIntervals, minorTickIntervals );
|
||||
m_plotWidget->setAxisRange( QwtPlot::xTop, m_visibleXRangeMin, m_visibleXRangeMax );
|
||||
}
|
||||
|
||||
m_plotWidget->enableGridLines( QwtPlot::xTop,
|
||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||
}
|
||||
|
||||
m_plotWidget->enableGridLines( QwtPlot::xTop,
|
||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( 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::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;
|
||||
|
||||
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 );
|
||||
// Make space for a fairly long value label
|
||||
|
Loading…
Reference in New Issue
Block a user