diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp index 18adffee19..9fa5af8421 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp @@ -164,3 +164,13 @@ QString RimEnsembleFractureStatisticsPlot::createAutoName() const return nameTags.join( ", " ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEnsembleFractureStatisticsPlot::createXAxisTitle() const +{ + if ( m_ensembleFractureStatistics() == nullptr ) return ""; + + return caf::AppEnum::uiText( m_property() ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h index 8b63156f23..4a04d912fb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h @@ -51,6 +51,7 @@ protected: bool* useOptionsOnly ) override; QString createAutoName() const override; + QString createXAxisTitle() const override; void setDefaults(); bool hasStatisticsData() const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp index f5cab1cd85..2c202c3abd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp @@ -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( ", " ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h index 3aa328fe3a..0e60a92a32 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h @@ -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; diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp index 2c0a26089d..8a80a77537 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp @@ -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::uiText( m_histogramFrequencyType() ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.h b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.h index 280af98901..e0a58f7491 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.h @@ -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: