summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-12-09 21:18:12 +0100
committerTomaž Vajngerl <quikee@gmail.com>2013-12-09 23:05:12 +0100
commitee545ea38e89da0ab12684a1121a38f4a0c7d867 (patch)
tree86de5498de1a1f7261d854a03bd2070145d738e8 /chart2
parent6c4f8bbadd9c3196725600f9cddb2b151622caa6 (diff)
Display correct equation with multiple trendlines in chart.
When there were multiple trendlines for one data series and one was selected, always the equation and R^2 of the first trendline was displayed in status bar. Change-Id: I320261e129c51bbdd1228173ca2f1d8447fdcb89
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx4
-rw-r--r--chart2/source/inc/RegressionCurveHelper.hxx7
-rw-r--r--chart2/source/tools/RegressionCurveHelper.cxx24
3 files changed, 34 insertions, 1 deletions
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 81146d389259..648a6c7e7b98 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -552,9 +552,11 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
aRet = SCH_RESSTR( STR_OBJECT_CURVE_WITH_PARAMETERS );
Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+
if( xCurveCnt.is())
{
- Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ));
+ sal_Int32 nCurveIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
+ Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getRegressionCurveAtIndex(xCurveCnt, nCurveIndex) );
if( xCurve.is())
{
try
diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx
index dd6c8b7b9d31..f9637e26eb99 100644
--- a/chart2/source/inc/RegressionCurveHelper.hxx
+++ b/chart2/source/inc/RegressionCurveHelper.hxx
@@ -104,6 +104,13 @@ public:
const com::sun::star::uno::Reference<
com::sun::star::chart2::XRegressionCurveContainer >& xCurveContainer );
+ /** Returns the regression curve found at the index provided.
+ */
+ static com::sun::star::uno::Reference<com::sun::star::chart2::XRegressionCurve >
+ getRegressionCurveAtIndex(
+ const com::sun::star::uno::Reference<com::sun::star::chart2::XRegressionCurveContainer >& xCurveContainer,
+ sal_Int32 aIndex);
+
/** Returns the type of the first regression curve found that is not of type
mean-value line
*/
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx
index a19affda5e32..e7a5d5c1b859 100644
--- a/chart2/source/tools/RegressionCurveHelper.cxx
+++ b/chart2/source/tools/RegressionCurveHelper.cxx
@@ -509,6 +509,30 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveN
return NULL;
}
+uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getRegressionCurveAtIndex(
+ const Reference< XRegressionCurveContainer >& xCurveContainer,
+ sal_Int32 aIndex )
+{
+ if( !xCurveContainer.is())
+ return NULL;
+
+ try
+ {
+ uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(xCurveContainer->getRegressionCurves());
+ if(0 <= aIndex && aIndex < aCurves.getLength())
+ {
+ if(!isMeanValueLine(aCurves[aIndex]))
+ return aCurves[aIndex];
+ }
+ }
+ catch( const Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return NULL;
+}
+
RegressionCurveHelper::tRegressionType RegressionCurveHelper::getRegressionType(
const Reference< XRegressionCurve > & xCurve )
{