mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improvements to Correlation plots
This commit is contained in:
parent
2fe4372dc2
commit
e6c2b693ef
@ -51,6 +51,10 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_labelFontSize, "LabelFontSize", "Label Font Size", "", "", "" );
|
||||
m_labelFontSize = caf::FontTools::RelativeSize::XSmall;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size", "", "", "" );
|
||||
m_axisValueFontSize = caf::FontTools::RelativeSize::XSmall;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -128,6 +132,11 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
{
|
||||
this->updatePlotTitle();
|
||||
}
|
||||
else if ( changedField == &m_labelFontSize || changedField == &m_axisTitleFontSize ||
|
||||
changedField == &m_axisValueFontSize )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -170,6 +179,11 @@ QList<caf::PdmOptionItemInfo>
|
||||
options.push_back( caf::PdmOptionItemInfo( timestepString, dateTime ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_labelFontSize || fieldNeedingOptions == &m_axisTitleFontSize ||
|
||||
fieldNeedingOptions == &m_axisValueFontSize )
|
||||
{
|
||||
options = caf::FontTools::relativeSizeValueOptions( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
@ -360,6 +374,54 @@ QDateTime RimAbstractCorrelationPlot::timeStep() const
|
||||
return m_timeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimAbstractCorrelationPlot::labelFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_labelFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimAbstractCorrelationPlot::axisTitleFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisTitleFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimAbstractCorrelationPlot::axisValueFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisValueFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::setLabelFontSize( caf::FontTools::RelativeSize fontSize )
|
||||
{
|
||||
m_labelFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize )
|
||||
{
|
||||
m_axisTitleFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAbstractCorrelationPlot::setAxisValueFontSize( caf::FontTools::RelativeSize fontSize )
|
||||
{
|
||||
m_axisValueFontSize = fontSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -48,6 +48,14 @@ public:
|
||||
void detachAllCurves() override;
|
||||
QDateTime timeStep() const;
|
||||
|
||||
int labelFontSize() const;
|
||||
int axisTitleFontSize() const;
|
||||
int axisValueFontSize() const;
|
||||
|
||||
void setLabelFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setAxisTitleFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
void setAxisValueFontSize( caf::FontTools::RelativeSize fontSize );
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
|
||||
@ -116,4 +124,6 @@ protected:
|
||||
caf::PdmField<QString> m_description;
|
||||
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_labelFontSize;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisTitleFontSize;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisValueFontSize;
|
||||
};
|
||||
|
@ -229,6 +229,9 @@ void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
plotGroup->add( &m_description );
|
||||
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle() );
|
||||
RimPlot::defineUiOrdering( uiConfigName, *plotGroup );
|
||||
plotGroup->add( &m_labelFontSize );
|
||||
plotGroup->add( &m_axisTitleFontSize );
|
||||
plotGroup->add( &m_axisValueFontSize );
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
@ -304,7 +307,7 @@ void RimCorrelationMatrixPlot::updateAxes()
|
||||
m_plotWidget->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Result Vector" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, 10, 6, false, Qt::AlignCenter );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter );
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, true, false );
|
||||
m_plotWidget->setAxisRange( QwtPlot::yLeft, 0.0, (double)m_resultLabels.size() + 1 );
|
||||
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( QwtPlot::yLeft,
|
||||
@ -322,7 +325,11 @@ void RimCorrelationMatrixPlot::updateAxes()
|
||||
m_plotWidget->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Ensemble Parameter" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, 10, 6, false, Qt::AlignCenter | Qt::AlignTop );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom,
|
||||
axisTitleFontSize(),
|
||||
axisValueFontSize(),
|
||||
false,
|
||||
Qt::AlignCenter | Qt::AlignTop );
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xBottom, true, false );
|
||||
m_plotWidget->setAxisRange( QwtPlot::xBottom, 0.0, (double)m_paramLabels.size() + 1 );
|
||||
m_plotWidget->setMajorAndMinorTickIntervalsAndRange( QwtPlot::xBottom,
|
||||
@ -502,7 +509,7 @@ void RimCorrelationMatrixPlot::createMatrix()
|
||||
cvf::Color3f contrastColor = RiaColorTools::contrastColor( cvf::Color3f( color ) );
|
||||
textLabel.setColor( RiaColorTools::toQColor( contrastColor ) );
|
||||
QFont font = textLabel.font();
|
||||
font.setPixelSize( caf::FontTools::pointSizeToPixelSize( 7 ) );
|
||||
font.setPixelSize( caf::FontTools::pointSizeToPixelSize( labelFontSize() ) );
|
||||
textLabel.setFont( font );
|
||||
QwtPlotMarker* marker = new QwtPlotMarker();
|
||||
marker->setLabel( textLabel );
|
||||
@ -526,8 +533,11 @@ void RimCorrelationMatrixPlot::updatePlotTitle()
|
||||
m_description = QString( "%1 Matrix for Parameters vs Result Vectors" ).arg( m_correlationFactor().uiText() );
|
||||
}
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryPlotAxisFormatter.h"
|
||||
|
||||
#include "cafFontTools.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include "qwt_plot_barchart.h"
|
||||
@ -125,6 +126,8 @@ void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
plotGroup->add( &m_useAutoPlotTitle );
|
||||
plotGroup->add( &m_description );
|
||||
RimPlot::defineUiOrdering( uiConfigName, *plotGroup );
|
||||
plotGroup->add( &m_axisTitleFontSize );
|
||||
plotGroup->add( &m_axisValueFontSize );
|
||||
|
||||
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle() );
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
@ -184,11 +187,11 @@ void RimCorrelationPlot::updateAxes()
|
||||
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Parameter" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, 10, 10, false, Qt::AlignCenter );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter );
|
||||
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Pearson Correlation Coefficient" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, 10, 10, false, Qt::AlignCenter );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter );
|
||||
if ( m_showAbsoluteValues )
|
||||
{
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Pearson Correlation Coefficient ABS" );
|
||||
@ -294,8 +297,12 @@ void RimCorrelationPlot::updatePlotTitle()
|
||||
m_description = QString( "%1 for %2" ).arg( m_correlationFactor().uiText() ).arg( m_selectedVarsUiField );
|
||||
}
|
||||
m_plotWidget->setPlotTitle( m_description );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
#include "RimAbstractCorrelationPlot.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimCorrelationReportPlot.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RimCorrelationMatrixPlot.h"
|
||||
@ -54,11 +55,23 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_correlationPlot, "CorrelationPlot", "Correlation Plot", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_parameterResultCrossPlot, "CrossPlot", "Cross Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_labelFontSize, "LabelFontSize", "Label Font Size", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size", "", "", "" );
|
||||
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
m_showWindow = true;
|
||||
m_showPlotLegends = false;
|
||||
|
||||
m_titleFontSize = caf::FontTools::RelativeSize::XLarge;
|
||||
m_subTitleFontSize = caf::FontTools::RelativeSize::Large;
|
||||
m_labelFontSize = caf::FontTools::RelativeSize::XSmall;
|
||||
m_axisTitleFontSize = caf::FontTools::RelativeSize::Small;
|
||||
m_axisValueFontSize = caf::FontTools::RelativeSize::XSmall;
|
||||
|
||||
m_correlationMatrixPlot = new RimCorrelationMatrixPlot;
|
||||
m_correlationMatrixPlot->setLegendsVisible( false );
|
||||
m_correlationMatrixPlot->setColSpan( RimPlot::TWO );
|
||||
@ -166,6 +179,30 @@ int RimCorrelationReportPlot::columnCount() const
|
||||
return 3;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimCorrelationReportPlot::subTitleFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_subTitleFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimCorrelationReportPlot::axisTitleFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisTitleFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimCorrelationReportPlot::axisValueFontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisValueFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -263,6 +300,18 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
|
||||
// m_correlationPlot->setCurveDefinitions( curveDefs );
|
||||
// m_parameterResultCrossPlot->setCurveDefinitions( curveDefs );
|
||||
|
||||
m_correlationMatrixPlot->setLabelFontSize( m_labelFontSize() );
|
||||
m_correlationMatrixPlot->setAxisTitleFontSize( m_axisTitleFontSize() );
|
||||
m_correlationMatrixPlot->setAxisValueFontSize( m_axisValueFontSize() );
|
||||
|
||||
m_correlationPlot->setLabelFontSize( m_labelFontSize() );
|
||||
m_correlationPlot->setAxisTitleFontSize( m_axisTitleFontSize() );
|
||||
m_correlationPlot->setAxisValueFontSize( m_axisValueFontSize() );
|
||||
|
||||
m_parameterResultCrossPlot->setLabelFontSize( m_labelFontSize() );
|
||||
m_parameterResultCrossPlot->setAxisTitleFontSize( m_axisTitleFontSize() );
|
||||
m_parameterResultCrossPlot->setAxisValueFontSize( m_axisValueFontSize() );
|
||||
|
||||
m_correlationPlot->setCorrelationFactor( m_correlationMatrixPlot->correlationFactor() );
|
||||
m_correlationPlot->setShowAbsoluteValues( m_correlationMatrixPlot->showAbsoluteValues() );
|
||||
m_correlationPlot->setSortByAbsoluteValues( m_correlationMatrixPlot->sortByAbsoluteValues() );
|
||||
@ -280,6 +329,12 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
|
||||
void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
m_correlationMatrixPlot->uiOrdering( "report", uiOrdering );
|
||||
auto plotGroup = uiOrdering.addNewGroup( "Plot Settings" );
|
||||
RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, *plotGroup );
|
||||
plotGroup->add( &m_subTitleFontSize );
|
||||
plotGroup->add( &m_labelFontSize );
|
||||
plotGroup->add( &m_axisTitleFontSize );
|
||||
plotGroup->add( &m_axisValueFontSize );
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
@ -310,15 +365,48 @@ void RimCorrelationReportPlot::childFieldChangedByUi( const caf::PdmFieldHandle*
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationReportPlot::doUpdateLayout()
|
||||
{
|
||||
if ( m_showWindow && m_viewer )
|
||||
{
|
||||
m_viewer->setTitleFontSizes( titleFontSize(), subTitleFontSize() );
|
||||
m_viewer->setLegendFontSize( legendFontSize() );
|
||||
m_viewer->setAxisFontSizes( axisTitleFontSize(), axisValueFontSize() );
|
||||
m_viewer->setSubTitlesVisible( true );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimCorrelationReportPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_subTitleFontSize || fieldNeedingOptions == &m_labelFontSize ||
|
||||
fieldNeedingOptions == &m_axisTitleFontSize || fieldNeedingOptions == &m_axisValueFontSize )
|
||||
{
|
||||
options = caf::FontTools::relativeSizeValueOptions( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationReportPlot::onDataSelection( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef )
|
||||
{
|
||||
m_correlationPlot->setCurveDefinitions( { curveDef } );
|
||||
m_correlationPlot->setCurveDefinitions( {curveDef} );
|
||||
m_correlationPlot->loadDataAndUpdate();
|
||||
m_parameterResultCrossPlot->setCurveDefinitions( { curveDef } );
|
||||
m_parameterResultCrossPlot->setCurveDefinitions( {curveDef} );
|
||||
m_parameterResultCrossPlot->setEnsembleParameter( param.name );
|
||||
m_parameterResultCrossPlot->loadDataAndUpdate();
|
||||
// m_viewer->scheduleUpdate();
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->scheduleUpdate();
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ public:
|
||||
RimParameterResultCrossPlot* crossPlot() const;
|
||||
|
||||
int columnCount() const override;
|
||||
int subTitleFontSize() const;
|
||||
int axisTitleFontSize() const;
|
||||
int axisValueFontSize() const;
|
||||
|
||||
private:
|
||||
QString createPlotWindowTitle() const;
|
||||
@ -72,7 +75,10 @@ private:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||
void doUpdateLayout() override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
private slots:
|
||||
void onDataSelection( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef );
|
||||
|
||||
@ -82,6 +88,10 @@ private:
|
||||
caf::PdmChildField<RimCorrelationMatrixPlot*> m_correlationMatrixPlot;
|
||||
caf::PdmChildField<RimCorrelationPlot*> m_correlationPlot;
|
||||
caf::PdmChildField<RimParameterResultCrossPlot*> m_parameterResultCrossPlot;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_subTitleFontSize;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_labelFontSize;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisTitleFontSize;
|
||||
caf::PdmField<caf::FontTools::RelativeSizeEnum> m_axisValueFontSize;
|
||||
|
||||
QPointer<RiuMultiPlotPage> m_viewer;
|
||||
};
|
||||
|
@ -173,12 +173,12 @@ void RimParameterResultCrossPlot::updateAxes()
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, m_selectedVarsUiField );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
m_plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, 10, 10, false, Qt::AlignCenter );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter );
|
||||
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, m_ensembleParameter );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, 10, 10, false, Qt::AlignCenter );
|
||||
m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -253,9 +253,13 @@ void RimParameterResultCrossPlot::updatePlotTitle()
|
||||
{
|
||||
if ( m_useAutoPlotTitle )
|
||||
{
|
||||
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->setPlotTitleEnabled( m_showPlotTitle );
|
||||
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
|
||||
m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );
|
||||
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
m_plotWidget->setPlotTitleFontSize( titleFontSize() );
|
||||
}
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ RiuMultiPlotPage::RiuMultiPlotPage( RimPlotWindow* plotDefinition, QWidget* pare
|
||||
, m_titleFontPixelSize( 12 )
|
||||
, m_subTitleFontPixelSize( 11 )
|
||||
, m_legendFontPixelSize( 8 )
|
||||
, m_axisTitleFontPixelSize( 10 )
|
||||
, m_axisValueFontPixelSize( 10 )
|
||||
, m_axisTitleFontSize( 8 )
|
||||
, m_axisValueFontSize( 8 )
|
||||
|
||||
{
|
||||
CAF_ASSERT( m_plotDefinition );
|
||||
@ -284,8 +284,8 @@ void RiuMultiPlotPage::setLegendFontSize( int legendFontSize )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::setAxisFontSizes( int axisTitleFontSize, int axisValueFontSize )
|
||||
{
|
||||
m_axisTitleFontPixelSize = caf::FontTools::pointSizeToPixelSize( axisTitleFontSize );
|
||||
m_axisValueFontPixelSize = caf::FontTools::pointSizeToPixelSize( axisValueFontSize );
|
||||
m_axisTitleFontSize = axisTitleFontSize;
|
||||
m_axisValueFontSize = axisValueFontSize;
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
@ -636,9 +636,7 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
|
||||
showYAxis( row, column ),
|
||||
showYAxis( row, column ) );
|
||||
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, showYAxis( row, column ) );
|
||||
plotWidgets[visibleIndex]->setAxisFontsAndAlignment( QwtPlot::yLeft,
|
||||
m_axisTitleFontPixelSize,
|
||||
m_axisValueFontPixelSize );
|
||||
plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
|
||||
|
||||
plotWidgets[visibleIndex]->show();
|
||||
|
||||
@ -784,6 +782,7 @@ QList<QPointer<QLabel>> RiuMultiPlotPage::subTitlesForVisiblePlots() const
|
||||
{
|
||||
if ( m_plotWidgets[i]->isChecked() )
|
||||
{
|
||||
m_subTitles[i]->setText( m_plotWidgets[i]->plotTitle() );
|
||||
subTitles.push_back( m_subTitles[i] );
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +146,8 @@ protected:
|
||||
int m_titleFontPixelSize;
|
||||
int m_subTitleFontPixelSize;
|
||||
int m_legendFontPixelSize;
|
||||
int m_axisTitleFontPixelSize;
|
||||
int m_axisValueFontPixelSize;
|
||||
int m_axisTitleFontSize;
|
||||
int m_axisValueFontSize;
|
||||
|
||||
bool m_previewMode;
|
||||
bool m_showSubTitles;
|
||||
|
@ -165,11 +165,14 @@ int RiuQwtPlotWidget::axisValueFontSize( QwtPlot::Axis axis ) const
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
|
||||
int titleFontPixelSize,
|
||||
int valueFontPixelSize,
|
||||
int titleFontSize,
|
||||
int valueFontSize,
|
||||
bool titleBold,
|
||||
int alignment )
|
||||
{
|
||||
int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize );
|
||||
int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize );
|
||||
|
||||
// Axis number font
|
||||
QFont axisFont = this->axisFont( axis );
|
||||
axisFont.setPixelSize( valueFontPixelSize );
|
||||
@ -188,6 +191,17 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
|
||||
applyAxisTitleToQwt( axis );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFontSize, bool titleBold, int alignment )
|
||||
{
|
||||
for ( auto axisTitlePair : m_axisTitles )
|
||||
{
|
||||
setAxisFontsAndAlignment( axisTitlePair.first, titleFontSize, valueFontSize, titleBold, alignment );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -983,7 +997,7 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem
|
||||
bool horizontal = barChart->orientation() == Qt::Horizontal;
|
||||
for ( size_t i = 0; i < barChart->dataSize(); ++i )
|
||||
{
|
||||
QPointF samplePoint = barChart->sample( i );
|
||||
QPointF samplePoint = barChart->sample( (int)i );
|
||||
double dist = horizontal ? std::abs( samplePoint.x() - scalePos.y() )
|
||||
: std::abs( samplePoint.x() - scalePos.x() );
|
||||
if ( dist < distMin )
|
||||
|
@ -72,10 +72,14 @@ public:
|
||||
int axisTitleFontSize( QwtPlot::Axis axis ) const;
|
||||
int axisValueFontSize( QwtPlot::Axis axis ) const;
|
||||
void setAxisFontsAndAlignment( QwtPlot::Axis,
|
||||
int titleFontPixelSize,
|
||||
int valueFontPixelSize,
|
||||
int titleFontSize,
|
||||
int valueFontSize,
|
||||
bool titleBold = false,
|
||||
int alignment = (int)Qt::AlignRight );
|
||||
int alignment = (int)Qt::AlignCenter );
|
||||
void setAxesFontsAndAlignment( int titleFontSize,
|
||||
int valueFontSize,
|
||||
bool titleBold = false,
|
||||
int alignment = (int)Qt::AlignCenter );
|
||||
|
||||
void setAxisTitleText( QwtPlot::Axis axis, const QString& title );
|
||||
void setAxisTitleEnabled( QwtPlot::Axis axis, bool enable );
|
||||
|
Loading…
Reference in New Issue
Block a user