diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-02-11 07:53:15 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-02-22 07:36:21 +0100 |
commit | 4141533a3fb984fbaefe87b15fceeda7f2082061 (patch) | |
tree | 46b7dc9e659033666cdef2275ec283dd2de8fd96 /chart2/source/view | |
parent | c40ce0c542b46d45a00561a926953df2fe9a9762 (diff) |
[API CHANGE] tdf#133423 Implement chart:regression-moving-type
Change-Id: Icb967367fbf12e5a1566b7f18ebe5e3d8a3534f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110748
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'chart2/source/view')
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/main/ChartItemPool.cxx | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index c235148a2045..39a97c618a47 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/TimeUnit.hpp> +#include <com/sun/star/chart2/MovingAverageType.hpp> #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp> #include <com/sun/star/chart2/XRegressionCurveContainer.hpp> #include <com/sun/star/container/XChild.hpp> @@ -1335,6 +1336,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer sal_Int32 aDegree = 2; sal_Int32 aPeriod = 2; + sal_Int32 aMovingAverageType = css::chart2::MovingAverageType::Prior; double aExtrapolateForward = 0.0; double aExtrapolateBackward = 0.0; bool bForceIntercept = false; @@ -1344,6 +1346,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer { xProperties->getPropertyValue( "PolynomialDegree") >>= aDegree; xProperties->getPropertyValue( "MovingAveragePeriod") >>= aPeriod; + xProperties->getPropertyValue( "MovingAverageType") >>= aMovingAverageType; xProperties->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward; xProperties->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward; xProperties->getPropertyValue( "ForceIntercept") >>= bForceIntercept; @@ -1370,8 +1373,9 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer fPointScale = std::min(fPointScale, 1000.0); } - xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, aPeriod); - xCalculator->recalculateRegression( rVDataSeries.getAllX(), rVDataSeries.getAllY() ); + xCalculator->setRegressionProperties(aDegree, bForceIntercept, aInterceptValue, aPeriod, + aMovingAverageType); + xCalculator->recalculateRegression(rVDataSeries.getAllX(), rVDataSeries.getAllY()); sal_Int32 nPointCount = 100 * fPointScale; if ( nPointCount < 2 ) diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 7f67cdde45ca..8b5bade3ebc3 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -31,6 +31,7 @@ #include <vector> #include <com/sun/star/chart2/LegendPosition.hpp> +#include <com/sun/star/chart2/MovingAverageType.hpp> namespace chart { @@ -165,6 +166,7 @@ ChartItemPool::ChartItemPool(): rPoolDefaults[SCHATTR_REGRESSION_CURVE_NAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME, OUString()); rPoolDefaults[SCHATTR_REGRESSION_XNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_XNAME, "x"); rPoolDefaults[SCHATTR_REGRESSION_YNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)"); + rPoolDefaults[SCHATTR_REGRESSION_MOVING_TYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_MOVING_TYPE, css::chart2::MovingAverageType::Prior); /************************************************************************** * ItemInfos |