mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-03 20:57:39 -06:00
#7751 Statistics Plot: add relative frequency percentage option
This commit is contained in:
parent
84bf5d5454
commit
0cbfd11dc3
@ -55,8 +55,11 @@ namespace caf
|
||||
template <>
|
||||
void caf::AppEnum<RimStatisticsPlot::HistogramFrequencyType>::setUp()
|
||||
{
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::ABSOLUTE_FREQUENCY, "ABSOLUTE_FREQUENCY", "Absolute" );
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::RELATIVE_FREQUENCY, "RELATIVE_FREQUENCY", "Relative" );
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::ABSOLUTE_FREQUENCY, "ABSOLUTE_FREQUENCY", "Absolute Frequency" );
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::RELATIVE_FREQUENCY, "RELATIVE_FREQUENCY", "Relative Frequency" );
|
||||
addItem( RimStatisticsPlot::HistogramFrequencyType::RELATIVE_FREQUENCY_PERCENT,
|
||||
"RELATIVE_FREQUENCY_PERCENT",
|
||||
"Relative Frequency [%]" );
|
||||
setDefault( RimStatisticsPlot::HistogramFrequencyType::ABSOLUTE_FREQUENCY );
|
||||
}
|
||||
} // namespace caf
|
||||
@ -290,6 +293,8 @@ void RimStatisticsPlot::updatePlots()
|
||||
for ( double value : histogramData.histogram )
|
||||
{
|
||||
if ( m_histogramFrequencyType() == HistogramFrequencyType::RELATIVE_FREQUENCY ) value /= sumElements;
|
||||
if ( m_histogramFrequencyType() == HistogramFrequencyType::RELATIVE_FREQUENCY_PERCENT )
|
||||
value = value / sumElements * 100.0;
|
||||
*set0 << value;
|
||||
minValue = std::min( minValue, value );
|
||||
maxValue = std::max( maxValue, value );
|
||||
|
@ -47,7 +47,8 @@ public:
|
||||
enum class HistogramFrequencyType
|
||||
{
|
||||
ABSOLUTE_FREQUENCY,
|
||||
RELATIVE_FREQUENCY
|
||||
RELATIVE_FREQUENCY,
|
||||
RELATIVE_FREQUENCY_PERCENT
|
||||
};
|
||||
|
||||
RimStatisticsPlot();
|
||||
|
Loading…
Reference in New Issue
Block a user