chart2/qa/extras/chart2_trendcalculators.cxx                |    4 ++--
 chart2/source/tools/PolynomialRegressionCurveCalculator.cxx |    6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 488c8053dc824d4736b02020bb440d43c4933eb2
Author: Laurent Balland-Poirier <laurent.balland-poir...@laposte.net>
Date:   Sun Jul 17 15:10:51 2016 +0200

    Improve polynomial trendline equation representation
    
    Insert a blank between x variable and its coefficient
    Aplly also to linear trendline
    
    Change-Id: I7d1e61f12aa1cf98b4181df6a4849df1e5293793
    Reviewed-on: https://gerrit.libreoffice.org/27265
    Reviewed-by: Noel Grandin <noelgran...@gmail.com>
    Tested-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx 
b/chart2/qa/extras/chart2_trendcalculators.cxx
index aa3717d..f3500fe 100644
--- a/chart2/qa/extras/chart2_trendcalculators.cxx
+++ b/chart2/qa/extras/chart2_trendcalculators.cxx
@@ -152,7 +152,7 @@ void Chart2TrendCalculators::testLinearRegression1()
         xValues[i] = d;
         yValues[i] = - 2.0 * d - 5.0 ;
     }
-    checkCalculator( xValues, yValues, "f(x) = "+ OUStringLiteral1(aMinusSign) 
+" 2x "+ OUStringLiteral1(aMinusSign) +" 5");
+    checkCalculator( xValues, yValues, "f(x) = "+ OUStringLiteral1(aMinusSign) 
+" 2 x "+ OUStringLiteral1(aMinusSign) +" 5");
 }
 
 // test y = A x ^ B
@@ -168,7 +168,7 @@ void Chart2TrendCalculators::testPolynomialRegression1()
         xValues[i] = d;
         yValues[i] =  - 2.0 * d * d + 4 * d - 5;
     }
-    OUString sExpectedFormula( "f(x) = "+ OUStringLiteral1(aMinusSign) +" 2x" 
+ OUStringLiteral1( aSuperscriptFigures[2] ) + " + 4x "+ 
OUStringLiteral1(aMinusSign) +" 5" );
+    OUString sExpectedFormula( "f(x) = "+ OUStringLiteral1(aMinusSign) +" 2 x" 
+ OUStringLiteral1( aSuperscriptFigures[2] ) + " + 4 x "+ 
OUStringLiteral1(aMinusSign) +" 5" );
     checkCalculator( xValues, yValues, sExpectedFormula );
 }
 
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx 
b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index 9b88599..ef3ba7e 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -252,7 +252,7 @@ OUString 
PolynomialRegressionCurveCalculator::ImplGetRepresentation(
                 nCharMin += 3; // " + "
             if ( i > 0 )
             {
-                 nCharMin += mXName.getLength(); // "x"
+                nCharMin += mXName.getLength() + 1; // " x"
                 if ( i > 1 )
                     nCharMin +=1; // "^i"
                 if ( i >= 10 )
@@ -292,7 +292,11 @@ OUString 
PolynomialRegressionCurveCalculator::ImplGetRepresentation(
         sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr;
         OUString aValueString = getFormattedString( xNumFormatter, 
nNumberFormatKey, aValue, pValueLength );
         if ( i == 0 || aValueString != "1" )  // aValueString may be rounded 
to 1 if nValueLength is small
+        {
             aTmpBuf.append( aValueString );
+            if ( i > 0 ) // insert blank between coefficient and x
+                aTmpBuf.append( " " );
+        }
 
         if(i > 0)
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to