summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorLaurent Balland <laurent.balland@mailo.fr>2023-06-12 21:48:13 +0200
committerAndras Timar <andras.timar@collabora.com>2023-07-08 20:35:24 +0200
commitbad0db2ea9707ca568db486b6ab91b91ea68e9e7 (patch)
tree3e8e4754680c3e571e5c11628ca07c5541d91f24 /chart2
parent0686e9b99a9b7a3a19f899fad4778c59f42bd615 (diff)
tdf#155526 Add Period to trend line equation
Insert Period value earlier to have it ready for representation Allow Moving average equation in dialog UI Change-Id: I1d20572c39462e60b60ab7eec1f174a3cf934d4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153094 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit dc03f59374d4fc74dd44ddedc903bb9c00a74bb7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153755 Reviewed-by: Laurent Balland <laurent.balland@mailo.fr>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx13
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx4
-rw-r--r--chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx10
3 files changed, 11 insertions, 16 deletions
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index c60ff1ca364a..ab002761bde6 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -601,18 +601,9 @@ OUString ObjectNameProvider::getHelpText( std::u16string_view rObjectCID, const
xCalculator->setXYNames ( aXName, aYName );
RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
- // change text for Moving Average
- OUString aWildcard( "%PERIOD" );
- sal_Int32 nIndex = xCalculator->getRepresentation().indexOf( aWildcard );
- if( nIndex != -1 )
- { // replace period
- aRet = xCalculator->getRepresentation();
- aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::number(aPeriod) );
- }
-
// replace formula
- aWildcard = "%FORMULA";
- nIndex = aRet.indexOf( aWildcard );
+ OUString aWildcard = "%FORMULA";
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
if( nIndex != -1 )
{
OUString aFormula ( xCalculator->getRepresentation() );
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx
index 647c071b1040..58ef6497a538 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -372,10 +372,8 @@ void TrendlineResources::UpdateControlStates()
m_xFmtFld_InterceptValue->set_sensitive( bInterceptAvailable );
if( bMovingAverage )
{
- m_xCB_ShowEquation->set_state(TRISTATE_FALSE);
m_xCB_ShowCorrelationCoeff->set_state(TRISTATE_FALSE);
}
- m_xCB_ShowEquation->set_sensitive( !bMovingAverage );
m_xCB_ShowCorrelationCoeff->set_sensitive( !bMovingAverage );
m_xCB_RegressionMovingType->set_sensitive(bMovingAverage);
m_xNF_Period->set_sensitive(bMovingAverage);
@@ -428,8 +426,6 @@ void TrendlineResources::SetNbPoints( sal_Int32 nNbPoints )
IMPL_LINK_NOARG(TrendlineResources, ShowEquation, weld::Toggleable&, void)
{
- m_xEE_XName->set_sensitive(m_xCB_ShowEquation->get_active());
- m_xEE_YName->set_sensitive(m_xCB_ShowEquation->get_active());
UpdateControlStates();
}
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 6726d9d78b36..f71262f738b9 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -157,7 +157,15 @@ OUString MovingAverageRegressionCurveCalculator::ImplGetRepresentation(
const uno::Reference< util::XNumberFormatter >& /*xNumFormatter*/,
sal_Int32 /*nNumberFormatKey*/, sal_Int32* /*pFormulaLength = nullptr */ ) const
{
- return SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+ OUString aRet = SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+ // change text for Moving Average
+ OUString aWildcard( "%PERIOD" );
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ { // replace period
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::number(mPeriod) );
+ }
+ return aRet;
}
} // namespace chart