summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2016-01-02 15:02:00 +0100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-02-14 01:42:50 +0000
commit2fa4b37e8d6d516e9ac9190ee45456534611c3e7 (patch)
tree3669926e7b63856d1825e73a0733b6c3a6f456e2
parenta2f62cb17fbf7b920c901c1200412e110fadc84a (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> (cherry picked from commit 5553d6a9314fd778b9a124d8a2c7e9dd1d7a58a3) Reviewed-on: https://gerrit.libreoffice.org/21278 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> (cherry picked from commit 98982ca06a87e8b63204b0acda2105c66ae57440) Reviewed-on: https://gerrit.libreoffice.org/21459 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r--chart2/source/view/axes/ScaleAutomatism.cxx14
-rw-r--r--chart2/source/view/inc/ScaleAutomatism.hxx1
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