Show Plot Data missing for some plots

* Add plotContentAsText() to bar chart builder
* Add show plot data to analysis plot
* Refactor analysis plot
* Enable context menu in Analysis Plot
* Add show plot data for general RimPlots
* Show plot data for correlation report in three separate text dialogs
This commit is contained in:
Magne Sjaastad
2023-10-11 08:54:52 +02:00
committed by GitHub
parent 51fe80b897
commit cdda7480f3
19 changed files with 401 additions and 233 deletions

View File

@@ -24,6 +24,7 @@
#include "RiaStatisticsTools.h"
#include "RiaSummaryCurveDefinition.h"
#include "RifCsvDataTableFormatter.h"
#include "RifSummaryReaderInterface.h"
#include "RigEnsembleParameter.h"
@@ -108,44 +109,6 @@ private:
std::map<size_t, QString> m_tickLabels;
};
template <typename KeyType, typename ValueType>
class CorrelationMatrixRowOrColumn
{
public:
CorrelationMatrixRowOrColumn( const KeyType& key, const std::vector<double>& correlations, const std::vector<ValueType>& values )
: m_key( key )
, m_correlations( correlations )
, m_values( values )
, m_correlationSum( 0.0 )
, m_correlationAbsSum( 0.0 )
{
bool anyValid = false;
for ( auto value : correlations )
{
if ( RiaCurveDataTools::isValidValue( value, false ) )
{
m_correlationSum += value;
m_correlationAbsSum += std::abs( value );
anyValid = true;
}
}
if ( !anyValid )
{
m_correlationSum = std::numeric_limits<double>::infinity();
m_correlationAbsSum = std::numeric_limits<double>::infinity();
}
}
KeyType m_key;
std::vector<double> m_correlations;
std::vector<ValueType> m_values;
double m_correlationSum;
double m_correlationAbsSum;
};
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<QString, RiaSummaryCurveDefinition>;
using CorrelationMatrixRow = CorrelationMatrixRowOrColumn<RiaSummaryCurveDefinition, QString>;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -249,6 +212,45 @@ bool RimCorrelationMatrixPlot::isCurveHighlightSupported() const
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimCorrelationMatrixPlot::asciiDataForPlotExport() const
{
QString text;
QTextStream stream( &text );
QString fieldSeparator = "\t";
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
formatter.setUseQuotes( false );
std::vector<RifTextDataTableColumn> header;
header.emplace_back( RifTextDataTableColumn( "Vector" ) );
for ( const auto& param : m_paramLabels )
{
header.emplace_back( RifTextDataTableColumn( param.second ) );
}
formatter.header( header );
for ( const auto& row : m_valuesForTextReport )
{
formatter.add( QString::fromStdString( row.m_key.summaryAddressY().uiText() ) );
for ( const auto& corr : row.m_correlations )
{
formatter.add( corr );
}
formatter.rowCompleted();
}
formatter.tableCompleted();
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -645,6 +647,8 @@ void RimCorrelationMatrixPlot::createMatrix()
m_resultLabels[rowIdx] = resultLabel;
}
m_valuesForTextReport = correlationMatrixRows;
}
//--------------------------------------------------------------------------------------------------