From 11754f0124984ee892faa9baaa2bd4258c42373f Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 24 Nov 2017 09:50:49 +0100 Subject: [PATCH] Fix axis range for an instant plot --- src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc b/src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc index 04a250b..184923b 100644 --- a/src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc +++ b/src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc @@ -761,13 +761,17 @@ void InstantPlot::configureTableAxis (boost::shared_ptr axisSPtr, bool isS if (isSpectro) { - lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin())); - lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax())); + if (!isNAN(crtBound.min)) + lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin())); + if (!isNAN(crtBound.max)) + lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax())); } else { - lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin())); - lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax())); + if (!isNAN(crtBound.min) && !isNAN(crtBound.max)) + lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin())); + if (!isNAN(crtBound.min) && !isNAN(crtBound.max)) + lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax())); } } } @@ -810,13 +814,17 @@ void InstantPlot::configureTableAxis (boost::shared_ptr axisSPtr, bool isS crtBound = tableSPtr->getBound(&_parameterManager, i, ¶msTableData); if (isSpectro) { - lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin())); - lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax())); + if (!isNAN(crtBound.min)) + lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin())); + if (!isNAN(crtBound.max)) + lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax())); } else { - lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin())); - lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax())); + if (!isNAN(crtBound.min) && !isNAN(crtBound.max)) + lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin())); + if (!isNAN(crtBound.min) && !isNAN(crtBound.max)) + lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax())); } } } -- libgit2 0.21.2