Hi Jörg,

well this is a known inconvenience of this interface. It has to be initialized with the correct values. That is you have to call recalculateRegression( x(), y() ) at the calculator. Where x() and y() are arrays containig the actual values. For a scatter chart you need the data sequence containig the x-values (property "Role") and the one for the y-values. For other chart types you need the y-values and a sequence containig enough equal-distance-values "1, 2, 3, ...".

See this example:

If Not IsNull( oChart ) Then
oSeries = oChart.firstDiagram.CoordinateSystems(0).ChartTypes(0).DataSeries(0) Set oCurves(0) = createUNOService( "com.sun.star.chart2.LinearRegressionCurve" )
    oCurves(0).LineWidth = 60
    oCurves(0).LineColor = oSeries.Color
    oSeries.setRegressionCurves( oCurves() )
    Set oCalculator = oCurves(0).Calculator
    aXValues = oSeries.DataSequences(0).Values.NumericalData
    aYValues = oSeries.DataSequences(1).Values.NumericalData
    oCalculator.recalculateRegression( aXValues, aYValues )
    Print oCalculator.Representation
    Print oCalculator.CorrelationCoefficient
Else
    Print "Chart """; aName; """ not found"
End If

I know, this should be fixed, as this way the usage is quite tedious. I hope we will find time for this.

Sorry for the inconvenience,
-Bjoern

Hello,

i try to get the equation of a regression curve in StarBasic. The
situation is:

[...]
'...
chart=Thiscomponent.sheets(0).charts(0).embeddedobject
msgbox
chart.Diagram.DataRegressionProperties.getCalculator.getRepresentation
'...

and i get (in the messagebox):

"f(x) = 1.#NAN . x + 1.#NAN"


but (imho) this must be:

f(x) = 4 . x - 5.333


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to