mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-16 10:22:15 -05:00
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:
1 parent
51fe80b897
commit
cdda7480f3
19 files changed
+401
-233
No files matched your search
@@ -21,6 +21,8 @@
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifCsvDataTableFormatter.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafFontTools.h"
|
||||
@@ -836,6 +838,62 @@ void RiuGroupedBarChartBuilder::setLabelFontSize( int labelPointSize )
|
||||
m_labelPointSize = labelPointSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuGroupedBarChartBuilder::plotContentAsText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
QTextStream stream( &text );
|
||||
QString fieldSeparator = "\t";
|
||||
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
|
||||
formatter.setUseQuotes( false );
|
||||
|
||||
bool hasTextForMajor = false;
|
||||
bool hasTextForMid = false;
|
||||
bool hasTextForMinor = false;
|
||||
bool hasTextForLegend = false;
|
||||
bool hasTextForBar = false;
|
||||
|
||||
for ( const BarEntry& barDef : m_sortedBarEntries )
|
||||
{
|
||||
if ( !barDef.m_majTickText.isEmpty() ) hasTextForMajor = true;
|
||||
if ( !barDef.m_midTickText.isEmpty() ) hasTextForMid = true;
|
||||
if ( !barDef.m_minTickText.isEmpty() ) hasTextForMinor = true;
|
||||
if ( !barDef.m_legendText.isEmpty() ) hasTextForLegend = true;
|
||||
if ( !barDef.m_barText.isEmpty() && barDef.m_barText != barDef.m_legendText ) hasTextForBar = true;
|
||||
}
|
||||
|
||||
std::vector<RifTextDataTableColumn> header;
|
||||
if ( hasTextForMajor ) header.emplace_back( RifTextDataTableColumn( "Major" ) );
|
||||
if ( hasTextForMid ) header.emplace_back( RifTextDataTableColumn( "Mid" ) );
|
||||
if ( hasTextForMinor ) header.emplace_back( RifTextDataTableColumn( "Minor" ) );
|
||||
if ( hasTextForLegend ) header.emplace_back( RifTextDataTableColumn( "Legend" ) );
|
||||
if ( hasTextForBar ) header.emplace_back( RifTextDataTableColumn( "Bar" ) );
|
||||
|
||||
header.emplace_back( RifTextDataTableColumn( "Value", RifTextDataTableDoubleFormat::RIF_FLOAT ) );
|
||||
|
||||
formatter.header( header );
|
||||
|
||||
for ( const BarEntry& barDef : m_sortedBarEntries )
|
||||
{
|
||||
if ( hasTextForMajor ) formatter.add( barDef.m_majTickText );
|
||||
if ( hasTextForMid ) formatter.add( barDef.m_midTickText );
|
||||
if ( hasTextForMinor ) formatter.add( barDef.m_minTickText );
|
||||
if ( hasTextForLegend ) formatter.add( barDef.m_legendText );
|
||||
if ( hasTextForBar ) formatter.add( barDef.m_barText );
|
||||
|
||||
formatter.add( barDef.m_value );
|
||||
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -50,6 +50,8 @@ public:
|
||||
void addBarChartToPlot( QwtPlot* plot, Qt::Orientation orientation, int maxBarCount = -1 );
|
||||
void setLabelFontSize( int labelPointSize );
|
||||
|
||||
QString plotContentAsText() const;
|
||||
|
||||
private:
|
||||
double midPoint( double v1, double v2 ) { return v1 + 0.5 * ( v2 - 1.0 - v1 ); }
|
||||
|
||||
|
||||
Reference in new issue
Block a user