summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorLaurent Balland <laurent.balland@mailo.fr>2023-06-27 21:23:19 +0200
committerTomaž Vajngerl <quikee@gmail.com>2023-06-29 08:02:02 +0200
commit125b0f6609332523d30bef600979b698c2d216f8 (patch)
treeead903e5eef56ed8627f279b761fc1040074b501 /chart2/source
parentc2018d21b64ef47ab10228915b8fdd52b36c75bc (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>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx48
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 & )