#7752 Statistics Plot: Add titles for x and y axis

This commit is contained in:
Kristian Bendiksen 2021-06-30 10:46:10 +02:00
parent d1ecac012d
commit 84bf5d5454
6 changed files with 45 additions and 0 deletions

View File

@ -164,3 +164,13 @@ QString RimEnsembleFractureStatisticsPlot::createAutoName() const
return nameTags.join( ", " );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEnsembleFractureStatisticsPlot::createXAxisTitle() const
{
if ( m_ensembleFractureStatistics() == nullptr ) return "";
return caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::uiText( m_property() );
}

View File

@ -51,6 +51,7 @@ protected:
bool* useOptionsOnly ) override;
QString createAutoName() const override;
QString createXAxisTitle() const override;
void setDefaults();
bool hasStatisticsData() const override;

View File

@ -314,3 +314,22 @@ QString RimGridStatisticsPlot::timeStepString() const
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridStatisticsPlot::createXAxisTitle() const
{
if ( m_case() == nullptr ) return "";
QStringList nameTags;
nameTags += m_property()->resultVariable();
QString timeStepStr = timeStepString();
if ( !timeStepStr.isEmpty() )
{
nameTags += timeStepStr;
}
return nameTags.join( ", " );
}

View File

@ -62,6 +62,8 @@ protected:
QString createAutoName() const override;
QString timeStepString() const;
QString createXAxisTitle() const override;
void setDefaults();
bool hasStatisticsData() const override;
RigHistogramData createStatisticsData() const override;

View File

@ -311,11 +311,13 @@ void RimStatisticsPlot::updatePlots()
QValueAxis* axisX = new QValueAxis();
axisX->setRange( histogramData.min - xAxisExtension, histogramData.max + xAxisExtension );
axisX->setLabelFormat( RiaNumberFormat::sprintfFormat( m_tickNumberFormat(), m_precision ) );
axisX->setTitleText( createXAxisTitle() );
chart->addAxis( axisX, Qt::AlignBottom );
QValueAxis* axisY = new QValueAxis();
axisY->setRange( minValue, maxValue );
axisY->setLabelFormat( RiaNumberFormat::sprintfFormat( m_tickNumberFormat(), m_precision ) );
axisY->setTitleText( createYAxisTitle() );
chart->addAxis( axisY, Qt::AlignLeft );
if ( !std::isinf( histogramData.p10 ) )
@ -382,3 +384,11 @@ void RimStatisticsPlot::performAutoNameUpdate()
m_plotWindowTitle = name;
setUiName( name );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimStatisticsPlot::createYAxisTitle() const
{
return caf::AppEnum<RimStatisticsPlot::HistogramFrequencyType>::uiText( m_histogramFrequencyType() );
}

View File

@ -79,6 +79,9 @@ protected:
virtual RigHistogramData createStatisticsData() const = 0;
virtual QString createAutoName() const = 0;
virtual QString createXAxisTitle() const = 0;
virtual QString createYAxisTitle() const;
void performAutoNameUpdate();
private: