#2108 Summary Plot : Use calculation short name in axis title

This commit is contained in:
Magne Sjaastad 2017-12-11 14:44:16 +01:00
parent c1537664e3
commit ffbd4cda82
2 changed files with 31 additions and 5 deletions

View File

@ -206,16 +206,28 @@ QString RimSummaryPlotYAxisFormatter::autoAxisTitle() const
{
for (RimSummaryCurve* rimCurve : m_summaryCurves)
{
unitToQuantityNameMap[rimCurve->unitNameX()].insert(rimCurve->summaryAddressX().quantityName());
std::string quantityName = rimCurve->summaryAddressX().quantityName();
if (rimCurve->summaryAddressX().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED)
{
quantityName = shortCalculationName(quantityName);
}
unitToQuantityNameMap[rimCurve->unitNameX()].insert(quantityName);
}
}
else
{
for ( RimSummaryCurve* rimCurve : m_summaryCurves )
for (RimSummaryCurve* rimCurve : m_summaryCurves)
{
if ( rimCurve->axisY() == this->m_axisProperties->plotAxisType() )
if (rimCurve->axisY() == this->m_axisProperties->plotAxisType())
{
unitToQuantityNameMap[rimCurve->unitNameY()].insert(rimCurve->summaryAddressY().quantityName());
std::string quantityName = rimCurve->summaryAddressY().quantityName();
if (rimCurve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED)
{
quantityName = shortCalculationName(quantityName);
}
unitToQuantityNameMap[rimCurve->unitNameY()].insert(quantityName);
}
}
}
@ -258,9 +270,21 @@ QString RimSummaryPlotYAxisFormatter::autoAxisTitle() const
return assembledYAxisText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RimSummaryPlotYAxisFormatter::shortCalculationName(const std::string& calculationName)
{
QString calculationShortName = QString::fromStdString(calculationName);
int indexOfFirstSpace = calculationShortName.indexOf(' ');
if (indexOfFirstSpace > -1 && indexOfFirstSpace < calculationShortName.size())
{
calculationShortName = calculationShortName.left(indexOfFirstSpace);
}
return calculationShortName.toStdString();
}

View File

@ -42,6 +42,8 @@ public:
private:
QString autoAxisTitle() const;
static std::string shortCalculationName(const std::string& calculationName);
private:
RimSummaryAxisProperties* m_axisProperties;