diff options
author | Laurent Balland <laurent.balland@mailo.fr> | 2023-06-27 21:23:19 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-06-29 15:19:17 +0200 |
commit | 2e04c00f21cf2566c3de34d9dd828cc1615329fd (patch) | |
tree | f67aaeee67611e72a4d8951d280d3e5c8c03b15c /chart2 | |
parent | a2389bcd630b8c011e3dc236a33c7d2de43fd2be (diff) |
tdf#155526 Restore status bar for moving average
Previous commit dc03f59374d4fc74dd44ddedc903bb9c00a74bb7 broke text in
status bar when a moving average trend line is selected
Change-Id: I259fb9aee1eccf9fac93038c6dd2755490769f88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153677
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 125b0f6609332523d30bef600979b698c2d216f8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153706
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/dialogs/ObjectNameProvider.cxx | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 41eae9e7f1a8..2097e43c2130 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -597,33 +597,41 @@ OUString ObjectNameProvider::getHelpText( std::u16string_view rObjectCID, const if ( !(xEqProp->getPropertyValue( "YName") >>= aYName) ) aYName = "f(x)"; } - xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, 2, aMovingType); + xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, aPeriod, aMovingType); xCalculator->setXYNames ( aXName, aYName ); RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel ); - // replace formula - OUString aWildcard = "%FORMULA"; - sal_Int32 nIndex = aRet.indexOf( aWildcard ); - if( nIndex != -1 ) + // change text for Moving Average + if ( RegressionCurveHelper::getRegressionType( xCurve ) == SvxChartRegress::MovingAverage ) + { + aRet = xCalculator->getRepresentation(); + } + else { - OUString aFormula ( xCalculator->getRepresentation() ); - if ( cDecSeparator != '.' ) + // replace formula + OUString aWildcard = "%FORMULA"; + sal_Int32 nIndex = aRet.indexOf( aWildcard ); + if( nIndex != -1 ) { - aFormula = aFormula.replace( '.', cDecSeparator ); + OUString aFormula ( xCalculator->getRepresentation() ); + if ( cDecSeparator != '.' ) + { + aFormula = aFormula.replace( '.', cDecSeparator ); + } + aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aFormula ); } - aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aFormula ); - } - // replace r^2 - aWildcard = "%RSQUARED"; - nIndex = aRet.indexOf( aWildcard ); - if( nIndex != -1 ) - { - double fR( xCalculator->getCorrelationCoefficient()); - aRet = aRet.replaceAt( - nIndex, aWildcard.getLength(), - ::rtl::math::doubleToUString( - fR*fR, rtl_math_StringFormat_G, 4, cDecSeparator, true )); + // replace r^2 + aWildcard = "%RSQUARED"; + nIndex = aRet.indexOf( aWildcard ); + if( nIndex != -1 ) + { + double fR( xCalculator->getCorrelationCoefficient()); + aRet = aRet.replaceAt( + nIndex, aWildcard.getLength(), + ::rtl::math::doubleToUString( + fR*fR, rtl_math_StringFormat_G, 4, cDecSeparator, true )); + } } } catch( const uno::Exception & ) |