mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
8549 qtcharts fix time axis (#8564)
* #8549 QtCharts: Fix time axis range setting * #8549 QtCharts: Fix 'zoom all' behavior
This commit is contained in:
parent
0879f3748b
commit
4913677955
@ -674,11 +674,15 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale )
|
|||||||
if ( autoScale )
|
if ( autoScale )
|
||||||
{
|
{
|
||||||
rescaleAxis( axis );
|
rescaleAxis( axis );
|
||||||
|
|
||||||
QAbstractAxis* ax = plotAxis( axis );
|
QAbstractAxis* ax = plotAxis( axis );
|
||||||
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( ax );
|
||||||
if ( valueAxis )
|
if ( valueAxis )
|
||||||
{
|
{
|
||||||
|
// Block signals to avoid triggering RimSummaryPlot::onPlotZoomed
|
||||||
|
valueAxis->blockSignals( true );
|
||||||
valueAxis->applyNiceNumbers();
|
valueAxis->applyNiceNumbers();
|
||||||
|
valueAxis->blockSignals( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -687,9 +691,16 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale )
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max )
|
void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max )
|
||||||
|
{
|
||||||
|
if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE )
|
||||||
|
{
|
||||||
|
plotAxis( axis )->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
plotAxis( axis )->setRange( min, max );
|
plotAxis( axis )->setRange( min, max );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -974,6 +985,9 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Block signals to avoid triggering RimSummaryPlot::onPlotZoomed
|
||||||
|
pAxis->blockSignals( true );
|
||||||
|
|
||||||
if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE )
|
if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE )
|
||||||
{
|
{
|
||||||
pAxis->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) );
|
pAxis->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) );
|
||||||
@ -982,6 +996,8 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis )
|
|||||||
{
|
{
|
||||||
pAxis->setRange( min, max );
|
pAxis->setRange( min, max );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pAxis->blockSignals( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user