Merge pull request #8387 from OPM/qtcharts-summary-plots

Closes #8228 

Major refactoring of summary plotting. Now possible to create plots both with Qwt and QtChart as plotting tool.
This commit is contained in:
Kristian Bendiksen
2022-01-17 13:14:21 +01:00
committed by GitHub
parent d9bb82de91
commit 258fbddc10
145 changed files with 7245 additions and 2932 deletions

View File

@@ -119,7 +119,7 @@ RiaDefines::PhaseType RimWellDistributionPlot::phase() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimWellDistributionPlot::viewer()
RiuPlotWidget* RimWellDistributionPlot::plotWidget()
{
return m_plotWidget;
}
@@ -170,28 +170,28 @@ void RimWellDistributionPlot::updateLegend()
if ( doShowLegend )
{
QwtLegend* legend = new QwtLegend( m_plotWidget );
m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend );
m_plotWidget->qwtPlot()->insertLegend( legend, QwtPlot::BottomLegend );
}
else
{
m_plotWidget->insertLegend( nullptr );
m_plotWidget->qwtPlot()->insertLegend( nullptr );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellDistributionPlot::updateZoomInQwt()
void RimWellDistributionPlot::updateZoomInParentPlot()
{
// cvf::Trace::show("RimWellDistributionPlot::updateZoomInQwt()");
// cvf::Trace::show("RimWellDistributionPlot::updateZoomInParentPlot()");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellDistributionPlot::updateZoomFromQwt()
void RimWellDistributionPlot::updateZoomFromParentPlot()
{
// cvf::Trace::show("RimWellDistributionPlot::updateZoomFromQwt()");
// cvf::Trace::show("RimWellDistributionPlot::updateZoomFromParentPlot()");
}
//--------------------------------------------------------------------------------------------------
@@ -222,7 +222,7 @@ void RimWellDistributionPlot::detachAllCurves()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const
caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* /*curve*/ ) const
{
// cvf::Trace::show("RimWellDistributionPlot::findPdmObjectFromQwtCurve()");
return nullptr;
@@ -282,7 +282,7 @@ void RimWellDistributionPlot::zoomAll()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
RiuPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
{
// cvf::Trace::show("RimWellDistributionPlot::createViewWidget()");
@@ -294,7 +294,7 @@ RiuQwtPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* main
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
m_plotWidget->setAutoReplot( false );
m_plotWidget->qwtPlot()->setAutoReplot( false );
updateLegend();
onLoadDataAndUpdate();
@@ -339,7 +339,7 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
return;
}
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve );
updateLegend();
@@ -374,12 +374,12 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
const QString plotTitleStr =
QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
m_plotWidget->setTitle( plotTitleStr );
m_plotWidget->setPlotTitle( plotTitleStr );
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "TOF [years]" );
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Reservoir Volume [m3]" );
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "TOF [years]" );
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Reservoir Volume [m3]" );
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
m_plotWidget->scheduleReplot();
}
@@ -397,11 +397,11 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
// Currently select this value so that the grid appears on top of the curves
const double baseCurveZValue = 9.5;
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve );
plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 );
plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 );
plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true );
plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTofValues();
if ( tofValuesDays.size() == 0 )
@@ -449,7 +449,7 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
curve->setBrush( qtClr );
curve->setZ( baseCurveZValue - i * 0.0001 );
curve->setSamples( tofValuesYears.data(), yVals.data(), static_cast<int>( tofValuesYears.size() ) );
curve->attach( plotWidget );
curve->attach( plotWidget->qwtPlot() );
}
}