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

@@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridCrossPlot.h"
#include "RiaDefines.h"
#include "RiaFontCache.h"
#include "RiaPreferences.h"
@@ -30,6 +31,7 @@
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimMultiPlot.h"
#include "RimPlotAxisLogRangeCalculator.h"
#include "RimPlotAxisProperties.h"
#include "cafPdmUiCheckBoxEditor.h"
@@ -41,7 +43,6 @@
#include "qwt_legend.h"
#include "qwt_plot.h"
#include "qwt_plot_curve.h"
#include "qwt_scale_engine.h"
#include <QDebug>
@@ -64,13 +65,13 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis" );
m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
m_xAxisProperties = new RimPlotAxisProperties;
m_xAxisProperties->setNameAndAxis( "X-Axis", QwtPlot::xBottom );
m_xAxisProperties->setNameAndAxis( "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
m_xAxisProperties->setEnableTitleTextSettings( false );
CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" );
m_yAxisProperties.uiCapability()->setUiTreeHidden( true );
m_yAxisProperties = new RimPlotAxisProperties;
m_yAxisProperties->setNameAndAxis( "Y-Axis", QwtPlot::yLeft );
m_yAxisProperties->setNameAndAxis( "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
m_yAxisProperties->setEnableTitleTextSettings( false );
connectAxisSignals( m_xAxisProperties() );
@@ -156,7 +157,7 @@ QWidget* RimGridCrossPlot::viewWidget()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimGridCrossPlot::viewer()
RiuPlotWidget* RimGridCrossPlot::plotWidget()
{
return m_plotWidget;
}
@@ -185,7 +186,7 @@ void RimGridCrossPlot::zoomAll()
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
updateZoomInQwt();
updateZoomInParentPlot();
}
//--------------------------------------------------------------------------------------------------
@@ -211,10 +212,13 @@ void RimGridCrossPlot::reattachAllCurves()
dataSet->detachAllCurves();
if ( dataSet->isChecked() )
{
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
dataSet->setParentPlotNoReplot( m_plotWidget );
dataSet->loadDataAndUpdate( false );
}
}
updateZoomInQwt();
updateCurveNamesAndPlotTitle();
updateLegend();
updateZoomInParentPlot();
}
}
@@ -291,7 +295,8 @@ void RimGridCrossPlot::updateInfoBox()
{
if ( !m_infoBox )
{
m_infoBox = new RiuDraggableOverlayFrame( m_plotWidget->canvas(), m_plotWidget->overlayMargins() );
m_infoBox =
new RiuDraggableOverlayFrame( m_plotWidget->getParentForOverlay(), m_plotWidget->overlayMargins() );
m_infoBox->setAnchorCorner( RiuDraggableOverlayFrame::AnchorCorner::TopRight );
RiuTextOverlayContentFrame* textFrame = new RiuTextOverlayContentFrame( m_infoBox );
textFrame->setText( generateInfoBoxText() );
@@ -349,13 +354,13 @@ void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RimGridCrossPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const
caf::PdmObject* RimGridCrossPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* plotCurve ) const
{
for ( auto dataSet : m_crossPlotDataSets )
{
for ( auto curve : dataSet->curves() )
{
if ( curve->qwtPlotCurve() == qwtCurve )
if ( curve->isSameCurve( plotCurve ) )
{
return curve;
}
@@ -454,13 +459,13 @@ void RimGridCrossPlot::onPlotZoomed()
{
setAutoScaleXEnabled( false );
setAutoScaleYEnabled( false );
updateZoomFromQwt();
updateZoomFromParentPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
RiuPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
{
if ( !m_plotWidget )
{
@@ -468,7 +473,7 @@ RiuQwtPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowP
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
dataSet->setParentPlotNoReplot( m_plotWidget );
}
updateCurveNamesAndPlotTitle();
@@ -592,15 +597,16 @@ void RimGridCrossPlot::updatePlot()
{
if ( m_plotWidget )
{
RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget );
RiuQwtPlotTools::setDefaultAxes( m_plotWidget );
RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget->qwtPlot() );
RiuQwtPlotTools::setDefaultAxes( m_plotWidget->qwtPlot() );
updateFonts();
updateAxes();
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
dataSet->setParentPlotNoReplot( m_plotWidget );
dataSet->loadDataAndUpdate( false );
}
updateLegend();
@@ -635,9 +641,9 @@ void RimGridCrossPlot::swapAxes()
RimPlotAxisProperties* xAxisProperties = m_xAxisProperties();
RimPlotAxisProperties* yAxisProperties = m_yAxisProperties();
QString tmpName = xAxisProperties->name();
QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType();
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->qwtPlotAxisType() );
QString tmpName = xAxisProperties->name();
RiaDefines::PlotAxis tmpAxis = xAxisProperties->plotAxisType();
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType() );
yAxisProperties->setNameAndAxis( tmpName, tmpAxis );
m_xAxisProperties.removeChildObject( xAxisProperties );
@@ -760,14 +766,14 @@ void RimGridCrossPlot::updateLegend()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateZoomInQwt()
void RimGridCrossPlot::updateZoomInParentPlot()
{
if ( m_plotWidget )
{
updateAxisInQwt( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
updateAxisInQwt( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
m_plotWidget->updateAxes();
updateZoomFromQwt();
m_plotWidget->qwtPlot()->updateAxes();
updateZoomFromParentPlot();
m_plotWidget->scheduleReplot();
}
}
@@ -775,7 +781,7 @@ void RimGridCrossPlot::updateZoomInQwt()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateZoomFromQwt()
void RimGridCrossPlot::updateZoomFromParentPlot()
{
updateAxisFromQwt( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
updateAxisFromQwt( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
@@ -845,42 +851,39 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
axisParameterString = yAxisParameterString();
}
QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType();
RiaDefines::PlotAxis axis = axisProperties->plotAxisType();
if ( axisProperties->isActive() )
{
m_plotWidget->enableAxis( qwtAxisId, true );
m_plotWidget->enableAxis( axis, true );
Qt::AlignmentFlag alignment = Qt::AlignCenter;
if ( axisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END )
{
alignment = Qt::AlignRight;
}
m_plotWidget->setAxisFontsAndAlignment( qwtAxisId,
m_plotWidget->setAxisFontsAndAlignment( axis,
caf::FontTools::pointSizeToPixelSize( axisProperties->titleFontSize() ),
caf::FontTools::pointSizeToPixelSize( axisProperties->valuesFontSize() ),
true,
alignment );
m_plotWidget->setAxisTitleText( qwtAxisId, axisParameterString );
m_plotWidget->setAxisTitleEnabled( qwtAxisId, true );
m_plotWidget->setAxisTitleText( axis, axisParameterString );
m_plotWidget->setAxisTitleEnabled( axis, true );
if ( axisProperties->isLogarithmicScaleEnabled )
{
QwtLogScaleEngine* currentScaleEngine =
dynamic_cast<QwtLogScaleEngine*>( m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
if ( !currentScaleEngine )
bool isLogScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC;
if ( !isLogScale )
{
m_plotWidget->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine );
m_plotWidget->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 );
m_plotWidget->setAxisScaleType( axis, RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC );
m_plotWidget->setAxisMaxMinor( axis, 5 );
}
double min = axisProperties->visibleRangeMin;
double max = axisProperties->visibleRangeMax;
if ( axisProperties->isAutoZoom() )
{
std::vector<const QwtPlotCurve*> plotCurves = visibleQwtCurves();
RimPlotAxisLogRangeCalculator logRangeCalculator( qwtAxisId, plotCurves );
std::vector<const RimPlotCurve*> plotCurves = visibleCurves();
RimPlotAxisLogRangeCalculator logRangeCalculator( axis, plotCurves );
logRangeCalculator.computeAxisRange( &min, &max );
}
@@ -888,23 +891,21 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
{
std::swap( min, max );
}
m_plotWidget->setAxisScale( qwtAxisId, min, max );
m_plotWidget->setAxisScale( axis, min, max );
}
else
{
QwtLinearScaleEngine* currentScaleEngine =
dynamic_cast<QwtLinearScaleEngine*>( m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
if ( !currentScaleEngine )
bool isLinearScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LINEAR;
if ( !isLinearScale )
{
m_plotWidget->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine );
m_plotWidget->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 );
m_plotWidget->setAxisScaleType( axis, RiuQwtPlotWidget::AxisScaleType::LINEAR );
m_plotWidget->setAxisMaxMinor( axis, 3 );
}
if ( axisProperties->isAutoZoom() )
{
m_plotWidget->setAxisAutoScale( qwtAxisId );
m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() )
->setAttribute( QwtScaleEngine::Inverted, axisProperties->isAxisInverted() );
m_plotWidget->setAxisAutoScale( axis, true );
m_plotWidget->setAxisInverted( axis, axisProperties->isAxisInverted() );
}
else
{
@@ -915,13 +916,13 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
std::swap( min, max );
}
m_plotWidget->setAxisScale( qwtAxisId, min, max );
m_plotWidget->setAxisScale( axis, min, max );
}
}
}
else
{
m_plotWidget->enableAxis( qwtAxisId, false );
m_plotWidget->enableAxis( axis, false );
}
}
@@ -932,20 +933,23 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
{
if ( !m_plotWidget ) return;
QwtInterval xAxisRange = m_plotWidget->axisRange( QwtPlot::xBottom );
QwtInterval yAxisRange = m_plotWidget->axisRange( QwtPlot::yLeft );
auto [xAxisRangeMin, xAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM );
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
QwtInterval axisRange = xAxisRange;
double axisRangeMin = xAxisRangeMin;
double axisRangeMax = xAxisRangeMax;
if ( axisType == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
{
axisProperties = m_yAxisProperties();
axisRange = yAxisRange;
axisProperties = m_yAxisProperties();
auto [yAxisRangeMin, yAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
axisRangeMin = yAxisRangeMin;
axisRangeMax = yAxisRangeMax;
}
axisProperties->visibleRangeMin = std::min( axisRange.minValue(), axisRange.maxValue() );
axisProperties->visibleRangeMax = std::max( axisRange.minValue(), axisRange.maxValue() );
axisProperties->visibleRangeMin = std::min( axisRangeMin, axisRangeMax );
axisProperties->visibleRangeMax = std::max( axisRangeMin, axisRangeMax );
axisProperties->updateConnectedEditors();
}
@@ -953,9 +957,9 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
std::vector<const RimPlotCurve*> RimGridCrossPlot::visibleCurves() const
{
std::vector<const QwtPlotCurve*> plotCurves;
std::vector<const RimPlotCurve*> plotCurves;
for ( auto dataSet : m_crossPlotDataSets )
{
if ( dataSet->isChecked() )
@@ -964,7 +968,7 @@ std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
{
if ( curve->isCurveVisible() )
{
plotCurves.push_back( curve->qwtPlotCurve() );
plotCurves.push_back( curve );
}
}
}

View File

@@ -21,7 +21,7 @@
#include "cafPdmChildField.h"
#include "cafPdmObject.h"
#include "RiaDefines.h"
#include "RiaPlotDefines.h"
#include "RimNameConfig.h"
#include "RimPlot.h"
@@ -34,6 +34,7 @@ class RimPlotAxisProperties;
class RimGridCrossPlotDataSet;
class RiuDraggableOverlayFrame;
class RiuGridCrossQwtPlot;
class RimPlotCurve;
class RimGridCrossPlotNameConfig : public RimNameConfig
{
@@ -69,8 +70,8 @@ public:
std::vector<RimGridCrossPlotDataSet*> dataSets() const;
QWidget* viewWidget() override;
RiuQwtPlotWidget* viewer() override;
QWidget* viewWidget() override;
RiuPlotWidget* plotWidget() override;
QImage snapshotWindowContent() override;
void zoomAll() override;
@@ -98,12 +99,12 @@ public:
void updateLegend() override;
void updateZoomInQwt() override;
void updateZoomFromQwt() override;
void updateZoomInParentPlot() override;
void updateZoomFromParentPlot() override;
void setAutoScaleXEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled ) override;
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override;
void onAxisSelected( int axis, bool toggle ) override;
bool isDeletable() const override;
@@ -124,7 +125,7 @@ protected:
void updateAxisInQwt( RiaDefines::PlotAxis axisType );
void updateAxisFromQwt( RiaDefines::PlotAxis axisType );
std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
std::vector<const RimPlotCurve*> visibleCurves() const;
RimPlotAxisProperties* xAxisProperties();
RimPlotAxisProperties* yAxisProperties();
@@ -135,7 +136,7 @@ protected:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private:
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
void doUpdateLayout() override;
void cleanupBeforeClose();

View File

@@ -18,28 +18,10 @@
#include "RimGridCrossPlotCurve.h"
#include "RigCaseCellResultCalculator.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimGridCrossPlot.h"
#include "RimTools.h"
#include "RiuQwtPlotCurve.h"
#include "RiuQwtSymbol.h"
#include "cafPdmUiComboBoxEditor.h"
#include <QDebug>
#include <QPointF>
#include <QVector>
#include "qwt_graphic.h"
#include "qwt_plot.h"
#include "qwt_plot_curve.h"
#include <random>
#include "RiuPlotCurve.h"
#include "RiuPlotWidget.h"
CAF_PDM_SOURCE_INIT( RimGridCrossPlotCurve, "GridCrossPlotCurve" );
@@ -53,7 +35,7 @@ RimGridCrossPlotCurve::RimGridCrossPlotCurve()
CAF_PDM_InitObject( "Cross Plot Points", ":/WellLogCurve16x16.png" );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
setSymbol( RiuQwtSymbol::SYMBOL_NONE );
setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE );
setSymbolSize( 4 );
}
@@ -73,9 +55,9 @@ void RimGridCrossPlotCurve::setSamples( const std::vector<double>& xValues, cons
{
CVF_ASSERT( xValues.size() == yValues.size() );
if ( xValues.empty() || yValues.empty() || !m_qwtPlotCurve ) return;
if ( xValues.empty() || yValues.empty() || !m_plotCurve ) return;
m_qwtPlotCurve->setSamples( &xValues[0], &yValues[0], static_cast<int>( xValues.size() ) );
m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, false );
}
//--------------------------------------------------------------------------------------------------
@@ -100,7 +82,7 @@ int RimGridCrossPlotCurve::groupIndex() const
//--------------------------------------------------------------------------------------------------
size_t RimGridCrossPlotCurve::sampleCount() const
{
return m_qwtPlotCurve ? m_qwtPlotCurve->dataSize() : 0;
return m_plotCurve ? m_plotCurve->numSamples() : 0;
}
//--------------------------------------------------------------------------------------------------
@@ -108,12 +90,12 @@ size_t RimGridCrossPlotCurve::sampleCount() const
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::determineLegendIcon()
{
if ( !m_qwtPlotCurve ) return;
if ( !m_plotCurve ) return;
RimGridCrossPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
int fontSize = plot->legendFontSize();
m_qwtPlotCurve->setLegendIconSize( QSize( fontSize, fontSize ) );
m_plotCurve->setLegendIconSize( QSize( fontSize, fontSize ) );
}
//--------------------------------------------------------------------------------------------------
@@ -121,9 +103,9 @@ void RimGridCrossPlotCurve::determineLegendIcon()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite )
{
if ( m_qwtPlotCurve )
if ( m_plotCurve )
{
m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
m_plotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
}
}
@@ -132,7 +114,7 @@ void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite )
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::determineSymbol()
{
RiuQwtSymbol::PointSymbolEnum symbol = RiuQwtSymbol::cycledSymbolStyle( m_dataSetIndex );
RiuPlotCurveSymbol::PointSymbolEnum symbol = RiuPlotCurveSymbol::cycledSymbolStyle( m_dataSetIndex );
setSymbol( symbol );
}
@@ -146,20 +128,6 @@ void RimGridCrossPlotCurve::updateZoomInParentPlot()
plot->calculateZoomRangeAndUpdateQwt();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::updateLegendsInPlot()
{
RimGridCrossPlot* plot = nullptr;
this->firstAncestorOrThisOfType( plot );
if ( plot )
{
plot->reattachAllCurves();
}
RimPlotCurve::updateLegendsInPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -175,7 +143,7 @@ void RimGridCrossPlotCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
if ( updateParentPlot )
{
m_parentQwtPlot->replot();
m_parentPlot->replot();
}
}

View File

@@ -19,16 +19,6 @@
#include "RimPlotCurve.h"
#include "cafPdmChildField.h"
#include "cafPdmPtrField.h"
#include <QPointF>
#include <QVector>
class RimCase;
class RimEclipseResultDefinition;
class QwtPlotCurve;
//==================================================================================================
///
///
@@ -52,7 +42,6 @@ public:
protected:
void determineSymbol();
void updateZoomInParentPlot() override;
void updateLegendsInPlot() override;
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;

View File

@@ -34,6 +34,7 @@
#include "RiuDraggableOverlayFrame.h"
#include "RiuGridCrossQwtPlot.h"
#include "RiuPlotWidget.h"
#include "RiuScalarMapperLegendFrame.h"
#include "RimCase.h"
@@ -62,6 +63,8 @@
#include "cvfScalarMapper.h"
#include "cvfqtUtils.h"
#include "qwt_plot.h"
#include <QString>
CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSet, "GridCrossPlotCurveSet" );
@@ -196,11 +199,11 @@ void RimGridCrossPlotDataSet::loadDataAndUpdate( bool updateParentPlot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotDataSet::setParentQwtPlotNoReplot( QwtPlot* parent )
void RimGridCrossPlotDataSet::setParentPlotNoReplot( RiuPlotWidget* parent )
{
for ( auto& curve : m_crossPlotCurves() )
{
curve->setParentQwtPlotNoReplot( m_isChecked() ? parent : nullptr );
curve->setParentPlotNoReplot( m_isChecked() ? parent : nullptr );
}
}
@@ -341,7 +344,7 @@ void RimGridCrossPlotDataSet::detachAllCurves()
{
for ( auto curve : m_crossPlotCurves() )
{
curve->detachQwtCurve();
curve->detach();
}
}
@@ -652,8 +655,9 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves( const RigEclipseCro
{
CVF_ASSERT( m_crossPlotCurves.size() == 1u );
RimGridCrossPlotCurve* curve = m_crossPlotCurves[0];
curve->setSamples( result.xValues, result.yValues );
curve->setGroupingInformation( indexInPlot(), 0 );
curve->updateCurveVisibility();
curve->setSamples( result.xValues, result.yValues );
curve->updateCurveAppearance();
curve->updateUiIconFromPlotSymbol();
}
@@ -665,8 +669,9 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves( const RigEclipseCro
for ( ; curveIt != m_crossPlotCurves.end() && groupIt != m_groupedResults.rend(); ++curveIt, ++groupIt )
{
RimGridCrossPlotCurve* curve = *curveIt;
curve->setSamples( groupIt->second.xValues, groupIt->second.yValues );
curve->setGroupingInformation( indexInPlot(), groupIt->first );
curve->updateCurveVisibility();
curve->setSamples( groupIt->second.xValues, groupIt->second.yValues );
curve->updateCurveAppearance();
curve->updateUiIconFromPlotSymbol();
}
@@ -1009,7 +1014,7 @@ void RimGridCrossPlotDataSet::updateLegendRange()
RimGridCrossPlot* parent;
this->firstAncestorOrThisOfTypeAsserted( parent );
if ( parent->viewer() )
if ( parent->plotWidget() )
{
if ( groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend() )
{
@@ -1050,17 +1055,17 @@ void RimGridCrossPlotDataSet::updateLegendRange()
}
if ( !m_legendOverlayFrame )
{
m_legendOverlayFrame =
new RiuDraggableOverlayFrame( parent->viewer()->canvas(), parent->viewer()->overlayMargins() );
m_legendOverlayFrame = new RiuDraggableOverlayFrame( parent->plotWidget()->getParentForOverlay(),
parent->plotWidget()->overlayMargins() );
}
m_legendOverlayFrame->setContentFrame( legendConfig()->makeLegendFrame() );
parent->viewer()->addOverlayFrame( m_legendOverlayFrame );
parent->plotWidget()->addOverlayFrame( m_legendOverlayFrame );
}
else
{
if ( m_legendOverlayFrame )
{
parent->viewer()->removeOverlayFrame( m_legendOverlayFrame );
parent->plotWidget()->removeOverlayFrame( m_legendOverlayFrame );
}
}
}

View File

@@ -54,6 +54,7 @@ class RiuDraggableOverlayFrame;
class QwtPlot;
class QwtPlotCurve;
class QString;
class RiuPlotWidget;
class RimGridCrossPlotDataSetNameConfig : public RimNameConfig
{
@@ -99,7 +100,7 @@ public:
void setCellFilterView( RimGridView* cellFilterView );
void loadDataAndUpdate( bool updateParentPlot );
void setParentQwtPlotNoReplot( QwtPlot* parent );
void setParentPlotNoReplot( RiuPlotWidget* parent );
QString xAxisName() const;
QString yAxisName() const;
QString infoText() const;