#7018 VFP plots: Remove brackets for empty unit labels.

This commit is contained in:
Kristian Bendiksen 2020-12-17 09:05:37 +01:00
parent 1724451c45
commit 4414b61efd
2 changed files with 27 additions and 13 deletions

View File

@ -396,16 +396,16 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget,
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
QString xAxisTitle = QString( "%1 [%2]" )
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText(
RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ),
getDisplayUnit( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ) );
QString xAxisTitle =
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText(
RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ),
getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType::LIQUID_FLOW_RATE ) );
plotWidget->setAxisTitleText( QwtPlot::xBottom, xAxisTitle );
QString yAxisTitle = QString( "%1 [%2]" )
.arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
getDisplayUnit( RimVfpPlot::ProductionVariableType::THP ) );
QString yAxisTitle =
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType::THP ) );
plotWidget->setAxisTitleText( QwtPlot::yLeft, yAxisTitle );
std::vector<double> thpValues = table.getTHPAxis();
@ -458,13 +458,13 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget*
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
QString xAxisTitle = QString( "%1 [%2]" )
.arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( primaryVariable ),
getDisplayUnit( primaryVariable ) );
QString xAxisTitle =
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::ProductionVariableType>::uiText( primaryVariable ),
getDisplayUnitWithBracket( primaryVariable ) );
plotWidget->setAxisTitleText( QwtPlot::xBottom, xAxisTitle );
QString yAxisTitle = QString( "%1 [%2]" )
.arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
getDisplayUnit( RimVfpPlot::ProductionVariableType::THP ) );
QString yAxisTitle =
QString( "%1 %2" ).arg( caf::AppEnum<RimVfpPlot::InterpolatedVariableType>::uiText( m_interpolatedVariable() ),
getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType::THP ) );
plotWidget->setAxisTitleText( QwtPlot::yLeft, yAxisTitle );
std::vector<double> primaryAxisValues = getProductionTableData( table, primaryVariable );
@ -574,6 +574,18 @@ void RimVfpPlot::convertToDisplayUnit( std::vector<double>& values, RimVfpPlot::
values[i] = convertToDisplayUnit( values[i], variableType );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimVfpPlot::getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType variableType )
{
QString unit = getDisplayUnit( variableType );
if ( !unit.isEmpty() )
return QString( "[%1]" ).arg( unit );
else
return unit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -126,6 +126,8 @@ private:
static QString getDisplayUnit( RimVfpPlot::ProductionVariableType variableType );
static QString getDisplayUnitWithBracket( RimVfpPlot::ProductionVariableType variableType );
private:
caf::PdmField<caf::FilePath> m_filePath;
caf::PdmField<int> m_tableNumber;