chart2/source/controller/dialogs/ObjectNameProvider.cxx | 48 +++++++++------- 1 file changed, 28 insertions(+), 20 deletions(-)
New commits: commit 37d8a0f0a4814891b563eac789379787d9179cf5 Author: Laurent Balland <laurent.ball...@mailo.fr> AuthorDate: Tue Jun 27 21:23:19 2023 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jul 3 15:35:10 2023 +0200 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 <qui...@gmail.com> (cherry picked from commit 125b0f6609332523d30bef600979b698c2d216f8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153706 (cherry picked from commit 2e04c00f21cf2566c3de34d9dd828cc1615329fd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153839 diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index ab002761bde6..ffd2bf74d17f 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 & )