mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add legend support to Report Plot
This commit is contained in:
@@ -498,6 +498,22 @@ const caf::ColorTable& RiaColorTables::waterAndRockPaletteColors()
|
|||||||
return colorTable;
|
return colorTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const caf::ColorTable& RiaColorTables::correlationPaletteColors()
|
||||||
|
{
|
||||||
|
static std::vector<cvf::Color3ub> colors{
|
||||||
|
cvf::Color3ub( 255, 25, 50 ), // Bluish red
|
||||||
|
cvf::Color3ub( 240, 240, 240 ), // Light Gray
|
||||||
|
cvf::Color3ub( 255, 100, 50 ), // Dark red Orange
|
||||||
|
};
|
||||||
|
|
||||||
|
static caf::ColorTable colorTable = caf::ColorTable( colors );
|
||||||
|
|
||||||
|
return colorTable;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public:
|
|||||||
static const caf::ColorTable& editableWellPathsPaletteColors();
|
static const caf::ColorTable& editableWellPathsPaletteColors();
|
||||||
static const caf::ColorTable& wellPathsPaletteColors();
|
static const caf::ColorTable& wellPathsPaletteColors();
|
||||||
static const caf::ColorTable& waterAndRockPaletteColors();
|
static const caf::ColorTable& waterAndRockPaletteColors();
|
||||||
|
static const caf::ColorTable& correlationPaletteColors();
|
||||||
|
|
||||||
static cvf::Color3f undefinedCellColor();
|
static cvf::Color3f undefinedCellColor();
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" );
|
||||||
m_legendConfig = new RimRegularLegendConfig();
|
m_legendConfig = new RimRegularLegendConfig();
|
||||||
m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 );
|
m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 );
|
||||||
|
m_legendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CORRELATION ) );
|
||||||
|
|
||||||
m_selectMultipleVectors = true;
|
m_selectMultipleVectors = true;
|
||||||
}
|
}
|
||||||
@@ -190,6 +191,14 @@ bool RimCorrelationMatrixPlot::sortByAbsoluteValues() const
|
|||||||
return m_sortByAbsoluteValues;
|
return m_sortByAbsoluteValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimRegularLegendConfig* RimCorrelationMatrixPlot::legendConfig()
|
||||||
|
{
|
||||||
|
return m_legendConfig();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -275,10 +284,10 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate()
|
|||||||
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale );
|
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale );
|
||||||
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotItem );
|
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotItem );
|
||||||
|
|
||||||
|
updateLegend();
|
||||||
createMatrix();
|
createMatrix();
|
||||||
|
|
||||||
m_plotWidget->insertLegend( nullptr );
|
m_plotWidget->insertLegend( nullptr );
|
||||||
m_plotWidget->updateLegend();
|
|
||||||
|
|
||||||
this->updateAxes();
|
this->updateAxes();
|
||||||
this->updatePlotTitle();
|
this->updatePlotTitle();
|
||||||
@@ -547,11 +556,15 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
|
|||||||
{
|
{
|
||||||
m_description = QString( "%1 Matrix for Parameters vs Result Vectors" ).arg( m_correlationFactor().uiText() );
|
m_description = QString( "%1 Matrix for Parameters vs Result Vectors" ).arg( m_correlationFactor().uiText() );
|
||||||
}
|
}
|
||||||
m_plotWidget->setPlotTitle( m_description );
|
|
||||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
if ( m_plotWidget )
|
||||||
if ( isMdiWindow() )
|
|
||||||
{
|
{
|
||||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
m_plotWidget->setPlotTitle( m_description );
|
||||||
|
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||||
|
if ( isMdiWindow() )
|
||||||
|
{
|
||||||
|
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,14 +573,7 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimCorrelationMatrixPlot::updateLegend()
|
void RimCorrelationMatrixPlot::updateLegend()
|
||||||
{
|
{
|
||||||
if ( m_showAbsoluteValues )
|
if ( m_plotWidget ) m_plotWidget->updateLegend();
|
||||||
{
|
|
||||||
m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_legendConfig->setAutomaticRanges( 0.0, 1.0, 0.0, 1.0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ public:
|
|||||||
RimCorrelationMatrixPlot();
|
RimCorrelationMatrixPlot();
|
||||||
~RimCorrelationMatrixPlot() override;
|
~RimCorrelationMatrixPlot() override;
|
||||||
|
|
||||||
CorrelationFactor correlationFactor() const;
|
CorrelationFactor correlationFactor() const;
|
||||||
bool showAbsoluteValues() const;
|
bool showAbsoluteValues() const;
|
||||||
bool sortByAbsoluteValues() const;
|
bool sortByAbsoluteValues() const;
|
||||||
|
RimRegularLegendConfig* legendConfig();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void matrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& );
|
void matrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& );
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "RimCorrelationMatrixPlot.h"
|
#include "RimCorrelationMatrixPlot.h"
|
||||||
#include "RimParameterResultCrossPlot.h"
|
#include "RimParameterResultCrossPlot.h"
|
||||||
|
#include "RimRegularLegendConfig.h"
|
||||||
|
|
||||||
#include "RiuMultiPlotPage.h"
|
#include "RiuMultiPlotPage.h"
|
||||||
|
|
||||||
@@ -329,8 +330,8 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
|
|||||||
void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
m_correlationMatrixPlot->uiOrdering( "report", uiOrdering );
|
m_correlationMatrixPlot->uiOrdering( "report", uiOrdering );
|
||||||
auto plotGroup = uiOrdering.addNewGroup( "Plot Settings" );
|
auto plotGroup = uiOrdering.addNewGroup( "Font Settings" );
|
||||||
RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, *plotGroup );
|
plotGroup->add( &m_titleFontSize );
|
||||||
plotGroup->add( &m_subTitleFontSize );
|
plotGroup->add( &m_subTitleFontSize );
|
||||||
plotGroup->add( &m_labelFontSize );
|
plotGroup->add( &m_labelFontSize );
|
||||||
plotGroup->add( &m_axisTitleFontSize );
|
plotGroup->add( &m_axisTitleFontSize );
|
||||||
@@ -344,6 +345,7 @@ void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
|
|||||||
void RimCorrelationReportPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
void RimCorrelationReportPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||||
QString uiConfigName /*= "" */ )
|
QString uiConfigName /*= "" */ )
|
||||||
{
|
{
|
||||||
|
uiTreeOrdering.add( m_correlationMatrixPlot->legendConfig() );
|
||||||
uiTreeOrdering.skipRemainingChildren( true );
|
uiTreeOrdering.skipRemainingChildren( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ void RimRegularLegendConfig::ColorRangeEnum::setUp()
|
|||||||
addItem( RimRegularLegendConfig::BLUE_LIGHT_DARK, "BLUE_DARK_LIGHT", "Blue Light to Dark" );
|
addItem( RimRegularLegendConfig::BLUE_LIGHT_DARK, "BLUE_DARK_LIGHT", "Blue Light to Dark" );
|
||||||
addItem( RimRegularLegendConfig::GREEN_RED, "GREEN_RED", "Green to Red" );
|
addItem( RimRegularLegendConfig::GREEN_RED, "GREEN_RED", "Green to Red" );
|
||||||
addItem( RimRegularLegendConfig::BLUE_MAGENTA, "BLUE_MAGENTA", "Blue to Magenta" );
|
addItem( RimRegularLegendConfig::BLUE_MAGENTA, "BLUE_MAGENTA", "Blue to Magenta" );
|
||||||
|
addItem( RimRegularLegendConfig::CORRELATION, "CORRELATION", "Correlation colors" );
|
||||||
addItem( RimRegularLegendConfig::UNDEFINED, "UNDEFINED", "Undefined" );
|
addItem( RimRegularLegendConfig::UNDEFINED, "UNDEFINED", "Undefined" );
|
||||||
setDefault( RimRegularLegendConfig::UNDEFINED );
|
setDefault( RimRegularLegendConfig::UNDEFINED );
|
||||||
}
|
}
|
||||||
@@ -928,6 +929,9 @@ cvf::Color3ubArray RimRegularLegendConfig::colorArrayFromColorType( ColorRangesT
|
|||||||
case RimRegularLegendConfig::STIMPLAN:
|
case RimRegularLegendConfig::STIMPLAN:
|
||||||
return RiaColorTables::stimPlanPaletteColors().color3ubArray();
|
return RiaColorTables::stimPlanPaletteColors().color3ubArray();
|
||||||
break;
|
break;
|
||||||
|
case RimRegularLegendConfig::CORRELATION:
|
||||||
|
return RiaColorTables::correlationPaletteColors().color3ubArray();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if ( ColorManager::isEnsembleColorRange( colorType ) )
|
if ( ColorManager::isEnsembleColorRange( colorType ) )
|
||||||
return ColorManager::EnsembleColorRanges().at( colorType );
|
return ColorManager::EnsembleColorRanges().at( colorType );
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ public:
|
|||||||
RED_LIGHT_DARK,
|
RED_LIGHT_DARK,
|
||||||
GREEN_LIGHT_DARK,
|
GREEN_LIGHT_DARK,
|
||||||
BLUE_LIGHT_DARK,
|
BLUE_LIGHT_DARK,
|
||||||
|
|
||||||
|
CORRELATION,
|
||||||
|
|
||||||
UNDEFINED
|
UNDEFINED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user