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
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 41eae9e..2097e43 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 )
{
OUString aFormula ( xCalculator->getRepresentation() );
if ( cDecSeparator != '.' )
{
aFormula = aFormula.replace( '.', cDecSeparator );
}
aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aFormula );
aRet = xCalculator->getRepresentation();
}
// replace r^2
aWildcard = "%RSQUARED";
nIndex = aRet.indexOf( aWildcard );
if( nIndex != -1 )
else
{
double fR( xCalculator->getCorrelationCoefficient());
aRet = aRet.replaceAt(
nIndex, aWildcard.getLength(),
::rtl::math::doubleToUString(
fR*fR, rtl_math_StringFormat_G, 4, cDecSeparator, true ));
// replace formula
OUString aWildcard = "%FORMULA";
sal_Int32 nIndex = aRet.indexOf( aWildcard );
if( nIndex != -1 )
{
OUString aFormula ( xCalculator->getRepresentation() );
if ( cDecSeparator != '.' )
{
aFormula = aFormula.replace( '.', cDecSeparator );
}
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 ));
}
}
}
catch( const uno::Exception & )