mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add custom tickmark configuration for Summary Plot (#9867)
- Added custom tickmark configuration in time axis properties for `Time Mode = Date` - Refactor code to separate handling of time axis properties and regular axis properties in RimSummaryPlot - Add method for setting major ticks by use of list for RiuPlotWidget interface.
This commit is contained in:
@@ -386,6 +386,17 @@ void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, b
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setMajorTicksList( RiuPlotAxis axis, const QList<double>& majorTicks, double minValue, double maxValue )
|
||||
{
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
QwtScaleDiv scaleDiv( minValue, maxValue );
|
||||
scaleDiv.setTicks( QwtScaleDiv::TickType::MajorTick, majorTicks );
|
||||
m_plot->setAxisScaleDiv( qwtAxis, scaleDiv );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -395,12 +406,12 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis,
|
||||
double minValue,
|
||||
double maxValue )
|
||||
{
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
auto* scaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
if ( scaleEngine )
|
||||
auto qwtAxis = toQwtPlotAxis( axis );
|
||||
auto* linearScaleEngine = dynamic_cast<RiuQwtLinearScaleEngine*>( m_plot->axisScaleEngine( qwtAxis ) );
|
||||
if ( linearScaleEngine )
|
||||
{
|
||||
QwtScaleDiv scaleDiv =
|
||||
scaleEngine->divideScaleWithExplicitIntervals( minValue, maxValue, majorTickInterval, minorTickInterval );
|
||||
linearScaleEngine->divideScaleWithExplicitIntervals( minValue, maxValue, majorTickInterval, minorTickInterval );
|
||||
|
||||
m_plot->setAxisScaleDiv( qwtAxis, scaleDiv );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user