diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2015-04-16 21:45:58 +0200 |
---|---|---|
committer | Philippe Jung <phil.jung@free.fr> | 2015-06-22 09:57:14 +0000 |
commit | cad19fa8414b419f2e0f9ee88139e9b7a2dd4ff4 (patch) | |
tree | 75be9cc3f2048d7e6181d0343529a9d990366dc4 /chart2/source/inc | |
parent | 733f5887af46d1d5e2fbea6be93cabb2a1749752 (diff) |
tdf#70673 Exponential trendline: enable negative Y values
With a negative intercept, Y values can be negative
Rebase with forced intercept fec037e68f0dea164915fbfe1db4699a3861adf4
Conflicts:
chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
Change-Id: Ie351c006fb1688ef3e657da7ce0789a9da1317f0
Reviewed-on: https://gerrit.libreoffice.org/15353
Reviewed-by: Philippe Jung <phil.jung@free.fr>
Tested-by: Philippe Jung <phil.jung@free.fr>
Diffstat (limited to 'chart2/source/inc')
-rw-r--r-- | chart2/source/inc/ExponentialRegressionCurveCalculator.hxx | 3 | ||||
-rw-r--r-- | chart2/source/inc/RegressionCalculationHelper.hxx | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx index 1247d41d6517..782fb57aaca6 100644 --- a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx +++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx @@ -56,10 +56,11 @@ private: throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - // formula is: f(x) = exp(m_fLogIntercept) * exp( m_fLogSlope * x ) + // formula is: f(x) = m_fSign * exp(m_fLogIntercept) * exp( m_fLogSlope * x ) // mathematical model f(x) = Intercept * Slope^x double m_fLogSlope; double m_fLogIntercept; + double m_fSign; }; } // namespace chart diff --git a/chart2/source/inc/RegressionCalculationHelper.hxx b/chart2/source/inc/RegressionCalculationHelper.hxx index 32456cf8dbb4..2e0e3a4adc53 100644 --- a/chart2/source/inc/RegressionCalculationHelper.hxx +++ b/chart2/source/inc/RegressionCalculationHelper.hxx @@ -102,6 +102,18 @@ public: } }; +class isValidAndYNegative : public ::std::binary_function< double, double, bool > +{ +public: + inline bool operator()( double x, double y ) + { return ! ( ::rtl::math::isNan( x ) || + ::rtl::math::isNan( y ) || + ::rtl::math::isInf( x ) || + ::rtl::math::isInf( y ) || + y >= 0.0 ); + } +}; + class isValidAndBothPositive : public ::std::binary_function< double, double, bool > { public: |