mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Multiaxis: add support for Qwt multiaxis plot
This commit is contained in:
committed by
Kristian Bendiksen
parent
22d6e3f853
commit
dde0487024
@@ -164,7 +164,7 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" );
|
||||
m_valueAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||
m_valueAxisProperties = new RimPlotAxisProperties;
|
||||
m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtPlot::yLeft ) );
|
||||
m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::YLeft ) );
|
||||
m_valueAxisProperties->enableRangeSettings( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" );
|
||||
@@ -910,7 +910,7 @@ void RimAnalysisPlot::onAxisSelected( int axis, bool toggle )
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
|
||||
caf::PdmObject* itemToSelect = nullptr;
|
||||
if ( axis == QwtPlot::yLeft )
|
||||
if ( axis == QwtAxis::YLeft )
|
||||
{
|
||||
if ( m_barOrientation == BARS_VERTICAL )
|
||||
{
|
||||
@@ -921,7 +921,7 @@ void RimAnalysisPlot::onAxisSelected( int axis, bool toggle )
|
||||
itemToSelect = this;
|
||||
}
|
||||
}
|
||||
else if ( axis == QwtPlot::xBottom )
|
||||
else if ( axis == QwtAxis::XBottom )
|
||||
{
|
||||
if ( m_barOrientation == BARS_HORIZONTAL )
|
||||
{
|
||||
|
||||
@@ -400,8 +400,8 @@ void RimCorrelationMatrixPlot::updateAxes()
|
||||
{
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::YLeft, new TextScaleDraw( m_resultLabels ) );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Result Vector" );
|
||||
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(),
|
||||
@@ -421,8 +421,8 @@ void RimCorrelationMatrixPlot::updateAxes()
|
||||
|
||||
auto scaleDraw = new TextScaleDraw( m_paramLabels );
|
||||
scaleDraw->setLabelRotation( 30.0 );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::XBottom, scaleDraw );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Ensemble Parameter" );
|
||||
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(),
|
||||
@@ -440,7 +440,7 @@ void RimCorrelationMatrixPlot::updateAxes()
|
||||
0.0,
|
||||
(double)m_paramLabels.size() );
|
||||
|
||||
m_plotWidget->qwtPlot()->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignRight );
|
||||
m_plotWidget->qwtPlot()->setAxisLabelAlignment( QwtAxis::XBottom, Qt::AlignRight );
|
||||
}
|
||||
|
||||
template <typename KeyType, typename ValueType>
|
||||
|
||||
@@ -376,11 +376,11 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
RimPlotAxisProperties* properties = nullptr;
|
||||
if ( axis == QwtPlot::yLeft )
|
||||
if ( axis == QwtAxis::YLeft )
|
||||
{
|
||||
properties = m_yAxisProperties;
|
||||
}
|
||||
else if ( axis == QwtPlot::xBottom )
|
||||
else if ( axis == QwtAxis::XBottom )
|
||||
{
|
||||
properties = m_xAxisProperties;
|
||||
}
|
||||
|
||||
@@ -382,15 +382,15 @@ void RimSummaryPlot::onAxisSelected( int axis, bool toggle )
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
|
||||
caf::PdmObject* itemToSelect = nullptr;
|
||||
if ( axis == QwtPlot::yLeft )
|
||||
if ( axis == QwtAxis::YLeft )
|
||||
{
|
||||
itemToSelect = m_leftYAxisProperties_OBSOLETE;
|
||||
}
|
||||
else if ( axis == QwtPlot::yRight )
|
||||
else if ( axis == QwtAxis::YRight )
|
||||
{
|
||||
itemToSelect = m_rightYAxisProperties_OBSOLETE;
|
||||
}
|
||||
else if ( axis == QwtPlot::xBottom )
|
||||
else if ( axis == QwtAxis::XBottom )
|
||||
{
|
||||
if ( m_isCrossPlot )
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
|
||||
auto qwtPlotWidget = dynamic_cast<RiuQwtPlotWidget*>( plotWidget );
|
||||
if ( qwtPlotWidget )
|
||||
{
|
||||
QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() );
|
||||
auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis );
|
||||
|
||||
if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO &&
|
||||
m_axisProperties->scaleFactor() == 1.0 )
|
||||
|
||||
@@ -823,11 +823,11 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals()
|
||||
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
|
||||
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::xTop, div );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtAxis::XTop, div );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::yLeft, div );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtAxis::YLeft, div );
|
||||
}
|
||||
}
|
||||
else if ( m_explicitTickIntervals )
|
||||
@@ -1256,13 +1256,13 @@ void RimWellLogTrack::onLoadDataAndUpdate()
|
||||
|
||||
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
|
||||
{
|
||||
m_plotWidget->setAxisEnabled( QwtPlot::xTop, true );
|
||||
m_plotWidget->setAxisEnabled( QwtPlot::xBottom, false );
|
||||
m_plotWidget->setAxisEnabled( QwtAxis::XTop, true );
|
||||
m_plotWidget->setAxisEnabled( QwtAxis::XBottom, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->setAxisEnabled( QwtPlot::xTop, false );
|
||||
m_plotWidget->setAxisEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisEnabled( QwtAxis::XTop, false );
|
||||
m_plotWidget->setAxisEnabled( QwtAxis::XBottom, true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2034,17 +2034,17 @@ void RimWellLogTrack::updateAxisScaleEngine()
|
||||
|
||||
if ( m_isLogarithmicScaleEnabled )
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XTop, new QwtLogScaleEngine );
|
||||
|
||||
// NB! Must assign scale engine to bottom in order to make QwtPlotGrid work
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new QwtLogScaleEngine );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XTop, new RiuQwtLinearScaleEngine );
|
||||
|
||||
// NB! Must assign scale engine to bottom in order to make QwtPlotGrid work
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new RiuQwtLinearScaleEngine );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2053,17 +2053,17 @@ void RimWellLogTrack::updateAxisScaleEngine()
|
||||
|
||||
if ( m_isLogarithmicScaleEnabled )
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new QwtLogScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new QwtLogScaleEngine );
|
||||
|
||||
// NB! Must assign scale engine to bottom in order to make QwtPlotGrid work
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yRight, new QwtLogScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YRight, new QwtLogScaleEngine );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new RiuQwtLinearScaleEngine );
|
||||
|
||||
// NB! Must assign scale engine to bottom in order to make QwtPlotGrid work
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yRight, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YRight, new RiuQwtLinearScaleEngine );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2125,12 +2125,12 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* wheelEvent )
|
||||
|
||||
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
|
||||
{
|
||||
QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft );
|
||||
QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtAxis::YLeft );
|
||||
zoomCenter = scaleMap.invTransform( position.y() );
|
||||
}
|
||||
else
|
||||
{
|
||||
QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::xTop );
|
||||
QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtAxis::XTop );
|
||||
zoomCenter = scaleMap.invTransform( position.x() );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user