mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Better headers and sorting
This commit is contained in:
@@ -100,6 +100,7 @@ public:
|
|||||||
, m_correlations( correlations )
|
, m_correlations( correlations )
|
||||||
, m_values( values )
|
, m_values( values )
|
||||||
, m_correlationSum( 0.0 )
|
, m_correlationSum( 0.0 )
|
||||||
|
, m_correlationAbsSum( 0.0 )
|
||||||
{
|
{
|
||||||
bool anyValid = false;
|
bool anyValid = false;
|
||||||
for ( auto value : correlations )
|
for ( auto value : correlations )
|
||||||
@@ -107,14 +108,14 @@ public:
|
|||||||
if ( RiaCurveDataTools::isValidValue( value, false ) )
|
if ( RiaCurveDataTools::isValidValue( value, false ) )
|
||||||
{
|
{
|
||||||
m_correlationSum += value;
|
m_correlationSum += value;
|
||||||
m_correlationMagnitude += value * value;
|
m_correlationAbsSum += std::abs( value );
|
||||||
anyValid = true;
|
anyValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !anyValid )
|
if ( !anyValid )
|
||||||
{
|
{
|
||||||
m_correlationSum = std::numeric_limits<double>::infinity();
|
m_correlationSum = std::numeric_limits<double>::infinity();
|
||||||
m_correlationMagnitude = std::numeric_limits<double>::infinity();
|
m_correlationAbsSum = std::numeric_limits<double>::infinity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ public:
|
|||||||
std::vector<double> m_correlations;
|
std::vector<double> m_correlations;
|
||||||
std::vector<ValueType> m_values;
|
std::vector<ValueType> m_values;
|
||||||
double m_correlationSum;
|
double m_correlationSum;
|
||||||
double m_correlationMagnitude;
|
double m_correlationAbsSum;
|
||||||
};
|
};
|
||||||
|
|
||||||
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<EnsembleParameter, RiaSummaryCurveDefinition>;
|
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<EnsembleParameter, RiaSummaryCurveDefinition>;
|
||||||
@@ -138,7 +139,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_correlationFactor, "CorrelationFactor", "Correlation Factor", "", "", "" );
|
||||||
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
m_correlationFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||||
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", true, "Show Absolute Values", "", "", "" );
|
CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" );
|
||||||
CAF_PDM_InitField( &m_sortByValues, "CorrelationSorting", true, "Sort Matrix by Values", "", "", "" );
|
CAF_PDM_InitField( &m_sortByValues, "CorrelationSorting", true, "Sort Matrix by Values", "", "", "" );
|
||||||
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
|
CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" );
|
||||||
|
|
||||||
@@ -209,7 +210,10 @@ void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
|
|||||||
correlationGroup->add( &m_correlationFactor );
|
correlationGroup->add( &m_correlationFactor );
|
||||||
correlationGroup->add( &m_showAbsoluteValues );
|
correlationGroup->add( &m_showAbsoluteValues );
|
||||||
correlationGroup->add( &m_sortByValues );
|
correlationGroup->add( &m_sortByValues );
|
||||||
correlationGroup->add( &m_sortByAbsoluteValues );
|
if ( !m_showAbsoluteValues() )
|
||||||
|
{
|
||||||
|
correlationGroup->add( &m_sortByAbsoluteValues );
|
||||||
|
}
|
||||||
|
|
||||||
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" );
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" );
|
||||||
m_selectedVarsUiField = selectedVarsText();
|
m_selectedVarsUiField = selectedVarsText();
|
||||||
@@ -352,7 +356,7 @@ void sortEntries( std::vector<CorrelationMatrixRowOrColumn<KeyType, ValueType>>&
|
|||||||
[&sortByAbsoluteValues]( const CorrelationMatrixRowOrColumn<KeyType, ValueType>& lhs,
|
[&sortByAbsoluteValues]( const CorrelationMatrixRowOrColumn<KeyType, ValueType>& lhs,
|
||||||
const CorrelationMatrixRowOrColumn<KeyType, ValueType>& rhs ) -> bool {
|
const CorrelationMatrixRowOrColumn<KeyType, ValueType>& rhs ) -> bool {
|
||||||
if ( sortByAbsoluteValues )
|
if ( sortByAbsoluteValues )
|
||||||
return lhs.m_correlationMagnitude > rhs.m_correlationMagnitude;
|
return lhs.m_correlationAbsSum > rhs.m_correlationAbsSum;
|
||||||
else
|
else
|
||||||
return lhs.m_correlationSum > rhs.m_correlationSum;
|
return lhs.m_correlationSum > rhs.m_correlationSum;
|
||||||
} );
|
} );
|
||||||
@@ -472,12 +476,12 @@ void RimCorrelationMatrixPlot::createMatrix()
|
|||||||
}
|
}
|
||||||
|
|
||||||
eraseInvalidEntries( correlationMatrixColumns );
|
eraseInvalidEntries( correlationMatrixColumns );
|
||||||
if ( m_sortByValues() ) sortEntries( correlationMatrixColumns, m_sortByAbsoluteValues() );
|
if ( m_sortByValues() ) sortEntries( correlationMatrixColumns, m_sortByAbsoluteValues() || m_showAbsoluteValues() );
|
||||||
|
|
||||||
auto correlationMatrixRows = transpose( correlationMatrixColumns );
|
auto correlationMatrixRows = transpose( correlationMatrixColumns );
|
||||||
|
|
||||||
eraseInvalidEntries( correlationMatrixRows );
|
eraseInvalidEntries( correlationMatrixRows );
|
||||||
if ( m_sortByValues() ) sortEntries( correlationMatrixRows, m_sortByAbsoluteValues() );
|
if ( m_sortByValues() ) sortEntries( correlationMatrixRows, m_sortByAbsoluteValues() || m_showAbsoluteValues() );
|
||||||
|
|
||||||
for ( size_t rowIdx = 0u; rowIdx < correlationMatrixRows.size(); ++rowIdx )
|
for ( size_t rowIdx = 0u; rowIdx < correlationMatrixRows.size(); ++rowIdx )
|
||||||
{
|
{
|
||||||
@@ -523,7 +527,8 @@ 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->setPlotTitle( m_description );
|
||||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||||
|
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ void RimCorrelationPlot::updatePlotTitle()
|
|||||||
}
|
}
|
||||||
m_plotWidget->setPlotTitle( m_description );
|
m_plotWidget->setPlotTitle( m_description );
|
||||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||||
|
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -257,5 +257,6 @@ void RimParameterResultCrossPlot::updatePlotTitle()
|
|||||||
m_description = QString( "Cross Plot %1 x %2" ).arg( m_ensembleParameter ).arg( m_selectedVarsUiField() );
|
m_description = QString( "Cross Plot %1 x %2" ).arg( m_ensembleParameter ).arg( m_selectedVarsUiField() );
|
||||||
}
|
}
|
||||||
m_plotWidget->setPlotTitle( m_description );
|
m_plotWidget->setPlotTitle( m_description );
|
||||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||||
|
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,8 @@
|
|||||||
|
|
||||||
#include "RiaQDateTimeTools.h"
|
#include "RiaQDateTimeTools.h"
|
||||||
#include <qwt_date.h>
|
#include <qwt_date.h>
|
||||||
|
#include <qwt_plot.h>
|
||||||
class QwtPlot;
|
#include <qwt_plot_shapeitem.h>
|
||||||
class QwtPlotShapeItem;
|
|
||||||
|
|
||||||
class RiuQwtPlotTools
|
class RiuQwtPlotTools
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -239,6 +239,18 @@ bool RiuQwtPlotWidget::plotTitleEnabled() const
|
|||||||
return m_plotTitleEnabled;
|
return m_plotTitleEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuQwtPlotWidget::setPlotTitleFontSize( int titleFontSize )
|
||||||
|
{
|
||||||
|
auto title = this->title();
|
||||||
|
QFont font = title.font();
|
||||||
|
font.setPixelSize( RiaFontCache::pointSizeToPixelSize( titleFontSize ) );
|
||||||
|
title.setFont( font );
|
||||||
|
setTitle( title );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ public:
|
|||||||
const QString& plotTitle() const;
|
const QString& plotTitle() const;
|
||||||
void setPlotTitleEnabled( bool enabled );
|
void setPlotTitleEnabled( bool enabled );
|
||||||
bool plotTitleEnabled() const;
|
bool plotTitleEnabled() const;
|
||||||
|
void setPlotTitleFontSize( int titleFontSize );
|
||||||
|
|
||||||
void setLegendFontSize( int fontSize );
|
void setLegendFontSize( int fontSize );
|
||||||
void setLegendVisible( bool visible );
|
void setLegendVisible( bool visible );
|
||||||
|
|||||||
Reference in New Issue
Block a user