diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-01-02 15:02:00 +0100 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-01-08 10:54:08 +0000 |
commit | 5553d6a9314fd778b9a124d8a2c7e9dd1d7a58a3 (patch) | |
tree | ba7296c19328f412e5d85f362930b63f1335b64b /chart2/source/view | |
parent | 0c0c8de9b2df98c7d6394e703fc2fcb9e97e20c0 (diff) |
tdf#96807 Reset min/max of auto scale
Y minimum for auto scale was accidentaly set to 0.
This avoided correct calculation of Y auto log scale (tdf#96807)
But also set linear Y auto scale from 0 (tdf#85690)
This fix detects if both min and max are equal to 0, and reset them (+-inf)
Change-Id: Ifaf306831f3b5a18a86483c88e807f478b447c77
Reviewed-on: https://gerrit.libreoffice.org/21055
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'chart2/source/view')
-rw-r--r-- | chart2/source/view/axes/ScaleAutomatism.cxx | 14 | ||||
-rw-r--r-- | chart2/source/view/inc/ScaleAutomatism.hxx | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx index f58bde445981..61df0aff8689 100644 --- a/chart2/source/view/axes/ScaleAutomatism.cxx +++ b/chart2/source/view/axes/ScaleAutomatism.cxx @@ -99,8 +99,7 @@ ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale, const Date& rNu , m_nTimeResolution(::com::sun::star::chart::TimeUnit::DAY) , m_aNullDate(rNullDate) { - ::rtl::math::setNan( &m_fValueMinimum ); - ::rtl::math::setNan( &m_fValueMaximum ); + resetValueRange(); double fExplicitOrigin = 0.0; if( m_aSourceScale.Origin >>= fExplicitOrigin ) @@ -110,8 +109,19 @@ ScaleAutomatism::~ScaleAutomatism() { } +void ScaleAutomatism::resetValueRange( ) +{ + ::rtl::math::setNan( &m_fValueMinimum ); + ::rtl::math::setNan( &m_fValueMaximum ); +} + void ScaleAutomatism::expandValueRange( double fMinimum, double fMaximum ) { + // if m_fValueMinimum and m_fValueMaximum == 0, it means that they were not determined. + // m_fValueMinimum == 0 makes impossible to determine real minimum, + // so they need to be reseted tdf#96807 + if( (m_fValueMinimum == 0.0) && (m_fValueMaximum == 0.0) ) + resetValueRange(); if( (fMinimum < m_fValueMinimum) || ::rtl::math::isNan( m_fValueMinimum ) ) m_fValueMinimum = fMinimum; if( (fMaximum > m_fValueMaximum) || ::rtl::math::isNan( m_fValueMaximum ) ) diff --git a/chart2/source/view/inc/ScaleAutomatism.hxx b/chart2/source/view/inc/ScaleAutomatism.hxx index 17370fb4a5da..513cf7d6c456 100644 --- a/chart2/source/view/inc/ScaleAutomatism.hxx +++ b/chart2/source/view/inc/ScaleAutomatism.hxx @@ -53,6 +53,7 @@ public: * undefined (that is empty `uno::Any` objects). */ void expandValueRange( double fMinimum, double fMaximum ); + void resetValueRange(); /** Sets additional auto scaling options. @param bExpandBorderToIncrementRhythm If true, expands automatic |