Kaydet (Commit) ee545ea3 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

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
üst 6c4f8bba
......@@ -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
......
......@@ -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
*/
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment