Commit e7b3586a31e330bea1233f598767856b1b4a5f87
1 parent
035ba49b
Exists in
master
and in
96 other branches
Fix fill between a serie and a constant with a log axis (fix #6294)
Showing
2 changed files
with
13 additions
and
4 deletions
Show diff stats
src/ParamOutputImpl/Plot/Time/TimePlot.cc
... | ... | @@ -418,7 +418,7 @@ double TimePlot::convertXAxisValue(const std::string &value) { |
418 | 418 | return DD_Time2Double (value.c_str()); |
419 | 419 | } |
420 | 420 | |
421 | -ConstantLine * TimePlot::getConstantLineFromId (int serieId, int constantId) { | |
421 | +ConstantLine * TimePlot::getConstantLineFromId (int serieId, int constantId, boost::shared_ptr<Axis>& yAxis) { | |
422 | 422 | |
423 | 423 | SeriesProperties serieProperties; |
424 | 424 | for (auto parameter : _parameterAxesList) { |
... | ... | @@ -427,7 +427,7 @@ ConstantLine * TimePlot::getConstantLineFromId (int serieId, int constantId) { |
427 | 427 | serieProperties = parameter.getYSeriePropertiesAt(lIndex); |
428 | 428 | |
429 | 429 | if ((serieProperties.getId() == serieId) &&(serieProperties.hasYAxis() == true)) { |
430 | - boost::shared_ptr<Axis> yAxis(_panel->getAxis(serieProperties.getYAxisId())); | |
430 | + yAxis = _panel->getAxis(serieProperties.getYAxisId()); | |
431 | 431 | for (auto constantLine : yAxis->_constantLines) { |
432 | 432 | if (constantLine->getId() == constantId) { |
433 | 433 | return constantLine.get(); |
... | ... | @@ -674,7 +674,11 @@ void TimePlot::drawFills(double startDate, double stopDate) { |
674 | 674 | } |
675 | 675 | |
676 | 676 | // Retrieve constantLine informations for these fill |
677 | - ConstantLine *constantLine = getConstantLineFromId ( fillSerieConstant->getSerieId(), fillSerieConstant->getConstantId()); | |
677 | + boost::shared_ptr<Axis> yAxis; | |
678 | + ConstantLine *constantLine = getConstantLineFromId ( fillSerieConstant->getSerieId(), fillSerieConstant->getConstantId(), yAxis); | |
679 | + | |
680 | + // Retrieve axis attachment | |
681 | + | |
678 | 682 | |
679 | 683 | // Build values2 values2Time array with 2 values : yConst & (first time, last time) for serie |
680 | 684 | values2 = new double [2]; |
... | ... | @@ -683,6 +687,11 @@ void TimePlot::drawFills(double startDate, double stopDate) { |
683 | 687 | values2 [0] = convertYAxisValue (constantLine->getValue()); |
684 | 688 | values2 [1] = convertYAxisValue (constantLine->getValue()); |
685 | 689 | |
690 | + if (yAxis->_scale == Axis::Scale::LOGARITHMIC) { | |
691 | + values2[0] = log10 (values2[0]); | |
692 | + values2[1] = log10 (values2[1]); | |
693 | + } | |
694 | + | |
686 | 695 | values2Time [0] = values1Time [0]; |
687 | 696 | values2Time [1] = values1Time [values1Nb-1]; |
688 | 697 | ... | ... |
src/ParamOutputImpl/Plot/Time/TimePlot.hh
... | ... | @@ -152,7 +152,7 @@ private: |
152 | 152 | /** |
153 | 153 | * @brief Retrieve ConstantLine informations for a given serieId and constantId. |
154 | 154 | */ |
155 | - ConstantLine * getConstantLineFromId (int serieId, int constantId); | |
155 | + ConstantLine * getConstantLineFromId (int serieId, int constantId, boost::shared_ptr<Axis>& yAxis); | |
156 | 156 | |
157 | 157 | /** |
158 | 158 | * @brief Retrieve serie properties by serie Id. | ... | ... |