Commit 11754f0124984ee892faa9baaa2bd4258c42373f

Authored by Benjamin Renard
1 parent 3ab32f47

Fix axis range for an instant plot

Showing 1 changed file with 16 additions and 8 deletions   Show diff stats
src/ParamOutputImpl/Plot/InstantPlot/InstantPlot.cc
@@ -761,13 +761,17 @@ void InstantPlot::configureTableAxis (boost::shared_ptr<Axis> axisSPtr, bool isS @@ -761,13 +761,17 @@ void InstantPlot::configureTableAxis (boost::shared_ptr<Axis> axisSPtr, bool isS
761 761
762 if (isSpectro) 762 if (isSpectro)
763 { 763 {
764 - lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin()));  
765 - lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax())); 764 + if (!isNAN(crtBound.min))
  765 + lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin()));
  766 + if (!isNAN(crtBound.max))
  767 + lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax()));
766 } 768 }
767 else 769 else
768 { 770 {
769 - lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin()));  
770 - lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax())); 771 + if (!isNAN(crtBound.min) && !isNAN(crtBound.max))
  772 + lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin()));
  773 + if (!isNAN(crtBound.min) && !isNAN(crtBound.max))
  774 + lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax()));
771 } 775 }
772 } 776 }
773 } 777 }
@@ -810,13 +814,17 @@ void InstantPlot::configureTableAxis (boost::shared_ptr<Axis> axisSPtr, bool isS @@ -810,13 +814,17 @@ void InstantPlot::configureTableAxis (boost::shared_ptr<Axis> axisSPtr, bool isS
810 crtBound = tableSPtr->getBound(&_parameterManager, i, &paramsTableData); 814 crtBound = tableSPtr->getBound(&_parameterManager, i, &paramsTableData);
811 if (isSpectro) 815 if (isSpectro)
812 { 816 {
813 - lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin()));  
814 - lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax())); 817 + if (!isNAN(crtBound.min))
  818 + lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin()));
  819 + if (!isNAN(crtBound.max))
  820 + lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax()));
815 } 821 }
816 else 822 else
817 { 823 {
818 - lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin()));  
819 - lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax())); 824 + if (!isNAN(crtBound.min) && !isNAN(crtBound.max))
  825 + lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin()));
  826 + if (!isNAN(crtBound.min) && !isNAN(crtBound.max))
  827 + lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax()));
820 } 828 }
821 } 829 }
822 } 830 }