Commit dce2cd6f488f968ab207318af3b7a6f367ef8264

Authored by Erdogan Furkan
1 parent 476afccf

#11379 - Done

src/ParamOutputImpl/Plot/HistoPlot/Histo1DFunction.cc
... ... @@ -36,12 +36,17 @@ std::map<int,std::vector<double>> Histo1DFunction::getGridValues(double* xData,
36 36 void Density1DFunction::apply(std::vector<std::pair<double,double>> &grid, double* xData, int nbData, Range xRange,
37 37 double& xBinSize, bool yIsLog, double& yMin, double& yMax)
38 38 {
  39 + bool yMaxToModify=true;
39 40 if(!_cacheGrid.empty()){
40 41 grid = _cacheGrid;
41 42 return;
42 43 }
43   - yMin = (yIsLog) ? 1 : 0;
44   - yMax = 0;
  44 + if(std::isnan(yMin))
  45 + yMin = (yIsLog) ? 1 : 0;
  46 + if(std::isnan(yMax))
  47 + yMax = 0;
  48 + else
  49 + yMaxToModify = false;
45 50 std::map<int,std::vector<double>> allValues;
46 51  
47 52 allValues = getGridValues(xData,nbData,xRange,xBinSize);
... ... @@ -50,11 +55,11 @@ void Density1DFunction::apply(std::vector&lt;std::pair&lt;double,double&gt;&gt; &amp;grid, doub
50 55 if (allValues[i].size() > 0)
51 56 _cacheGrid.push_back(std::make_pair(xRange.getMin()+xBinSize*i,
52 57 (yIsLog) ? log10(allValues[i].size()) : allValues[i].size() ));
53   -
54   - if(yMax < allValues[i].size())
55   - yMax = allValues[i].size();
  58 + if(yMaxToModify)
  59 + if(yMax < allValues[i].size())
  60 + yMax = allValues[i].size();
56 61 }
57   -
  62 +
58 63 grid = _cacheGrid;
59 64 }
60 65  
... ... @@ -64,13 +69,17 @@ void NormDensity1DFunction::apply(std::vector&lt;std::pair&lt;double,double&gt;&gt; &amp;grid,
64 69 double& xBinSize, bool yIsLog, double& yMin, double& yMax)
65 70 {
66 71  
  72 + bool yMaxToModify=true;
67 73 if(!_cacheGrid.empty()){
68 74 grid = _cacheGrid;
69 75 return;
70 76 }
71   -
72   - yMin = (yIsLog) ? 1 : 0;
73   - yMax = 0;
  77 + if(std::isnan(yMin))
  78 + yMin = (yIsLog) ? 1 : 0;
  79 + if(std::isnan(yMax))
  80 + yMax = 0;
  81 + else
  82 + yMaxToModify = false;
74 83 std::map<int,std::vector<double>> allValues;
75 84  
76 85 allValues = getGridValues(xData,nbData,xRange,xBinSize);
... ...
src/ParamOutputImpl/Plot/HistoPlot/HistoPlot.cc
... ... @@ -266,7 +266,7 @@ void HistoPlot::configureSeriesAxis(double startDate, double stopDate) {
266 266 std::vector<std::pair<double,double>> grid;
267 267 double xBinSize = 0;
268 268  
269   - // Call histo1DUtils to get yMin/yMax dans send these to PanelPlotOutput::drawHistogram to draw the y axis
  269 + // Call histo1DUtils to get yMin/yMax and send these to PanelPlotOutput::drawHistogram to draw the y axis
270 270 histo1DUtils(startDate, stopDate,*pHistogramProperties.get(), grid, xBinSize);
271 271 }
272 272  
... ... @@ -304,9 +304,9 @@ void HistoPlot::histo1DUtils(double startDate, double stopDate, HistogramSeriesP
304 304 if(std::isnan(lXRange.getMin()) || std::isnan(lXRange.getMax()))
305 305 return;
306 306 Range lYRange = lYAxis->Axis::getRange();
307   -
308   - double yMin = NAN ;
309   - double yMax = NAN ;
  307 + std::cout << lYRange.getMin() << " ----- " << lYRange.getMax() << std::endl;
  308 + double yMin = lYRange.getMin() ;
  309 + double yMax = lYRange.getMax() ;
310 310  
311 311 unsigned int xBinNumber = pHistogramProperties.getManualProperties().getXBinNumber();
312 312  
... ... @@ -326,7 +326,7 @@ void HistoPlot::histo1DUtils(double startDate, double stopDate, HistogramSeriesP
326 326 xValues = xData.getValues(pHistogramProperties.getIndex(), xStartIndex);
327 327  
328 328 pHistogramProperties.getHistotypeProperties().getHisto1DFunction()->apply(grid,xValues,xNbValues,lXRange, xBinSize,
329   - (lYAxis->_scale==Axis::Scale::LOGARITHMIC) ? true : false,yMin, yMax);
  329 + (lYAxis->_scale==Axis::Scale::LOGARITHMIC) ,yMin, yMax);
330 330  
331 331 if(lXAxis->_scale==Axis::Scale::LOGARITHMIC)
332 332 free(xValues);
... ... @@ -334,7 +334,7 @@ void HistoPlot::histo1DUtils(double startDate, double stopDate, HistogramSeriesP
334 334 if(!std::isnan(yMin))
335 335 lYRange.setMin(yMin);
336 336 if(!std::isnan(yMax))
337   - lYRange.setMax(yMax*1.05);
  337 + lYRange.setMax(yMax);
338 338 lYRange._extend = lYAxis->isExtended();
339 339 lYAxis->setRange(lYRange);
340 340 }
... ...