Commit 99a52f9b06b877ef1b8fcaf97a54a93e9021b3fc
Exists in
master
and in
15 other branches
Merge branch 'amdadev' of https://gitlab.irap.omp.eu/CDPP/AMDA_Kernel into amdadev
Showing
2 changed files
with
23 additions
and
15 deletions
Show diff stats
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<std::pair<double,double>> &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<std::pair<double,double>> &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,8 @@ 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 | + double yMin = lYRange.getMin() ; | |
308 | + double yMax = lYRange.getMax() ; | |
310 | 309 | |
311 | 310 | unsigned int xBinNumber = pHistogramProperties.getManualProperties().getXBinNumber(); |
312 | 311 | |
... | ... | @@ -326,7 +325,7 @@ void HistoPlot::histo1DUtils(double startDate, double stopDate, HistogramSeriesP |
326 | 325 | xValues = xData.getValues(pHistogramProperties.getIndex(), xStartIndex); |
327 | 326 | |
328 | 327 | pHistogramProperties.getHistotypeProperties().getHisto1DFunction()->apply(grid,xValues,xNbValues,lXRange, xBinSize, |
329 | - (lYAxis->_scale==Axis::Scale::LOGARITHMIC) ? true : false,yMin, yMax); | |
328 | + (lYAxis->_scale==Axis::Scale::LOGARITHMIC) ,yMin, yMax); | |
330 | 329 | |
331 | 330 | if(lXAxis->_scale==Axis::Scale::LOGARITHMIC) |
332 | 331 | free(xValues); |
... | ... | @@ -334,7 +333,7 @@ void HistoPlot::histo1DUtils(double startDate, double stopDate, HistogramSeriesP |
334 | 333 | if(!std::isnan(yMin)) |
335 | 334 | lYRange.setMin(yMin); |
336 | 335 | if(!std::isnan(yMax)) |
337 | - lYRange.setMax(yMax*1.05); | |
336 | + lYRange.setMax(yMax); | |
338 | 337 | lYRange._extend = lYAxis->isExtended(); |
339 | 338 | lYAxis->setRange(lYRange); |
340 | 339 | } | ... | ... |