mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Regression Curve: Clear and hide regression curve if no source data is available
This commit is contained in:
parent
6858cfe3cf
commit
2fe290bbce
@ -160,27 +160,50 @@ void RimSummaryRegressionAnalysisCurve::onLoadDataAndUpdate( bool updateParentPl
|
||||
extractSourceCurveData();
|
||||
updateDefaultValues();
|
||||
|
||||
// Clear derived data
|
||||
m_valuesX.clear();
|
||||
m_valuesY.clear();
|
||||
m_timeStepsX.clear();
|
||||
m_timeStepsY.clear();
|
||||
m_expressionText = "Undefined";
|
||||
|
||||
std::vector<double> xValues = m_sourceValuesX;
|
||||
std::vector<double> yValues = m_sourceValuesY;
|
||||
std::vector<time_t> timeStepsX = m_sourceTimeStepsX;
|
||||
std::vector<time_t> timeStepsY = m_sourceTimeStepsY;
|
||||
|
||||
if ( yValues.empty() ) return;
|
||||
QStringList errorMessages;
|
||||
|
||||
if ( yValues.empty() )
|
||||
{
|
||||
errorMessages += "No Y values found for regression curve.";
|
||||
}
|
||||
|
||||
if ( axisTypeX() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR )
|
||||
{
|
||||
if ( xValues.size() != yValues.size() ) return RiaLogging::error( "X value count and Y value count differs." );
|
||||
if ( xValues.size() != timeStepsX.size() ) return RiaLogging::error( "X value count and X time step count differs." );
|
||||
if ( xValues.size() != timeStepsY.size() ) return RiaLogging::error( "X value count and Y time step count differs." );
|
||||
if ( xValues.size() != yValues.size() ) errorMessages += "X value count and Y value count differs.";
|
||||
if ( xValues.size() != timeStepsX.size() ) errorMessages += "X value count and X time step count differs.";
|
||||
if ( xValues.size() != timeStepsY.size() ) errorMessages += "X value count and Y time step count differs.";
|
||||
|
||||
if ( timeStepsX != timeStepsY )
|
||||
{
|
||||
return RiaLogging::error(
|
||||
errorMessages +=
|
||||
"Differences in time steps for X and Y axis detected. This is currently not supported. Make sure that the same "
|
||||
"case is used for both axis." );
|
||||
"case is used for both axis.";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !errorMessages.isEmpty() )
|
||||
{
|
||||
// Call parent class to make sure the curve is removed from the plot
|
||||
RimSummaryCurve::onLoadDataAndUpdate( updateParentPlot );
|
||||
|
||||
QString errMsg = errorMessages.join( "\n" );
|
||||
RiaLogging::error( errMsg );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<size_t> indicesToRemove;
|
||||
|
||||
if ( axisTypeX() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR )
|
||||
|
Loading…
Reference in New Issue
Block a user