1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef com_sun_star_chart2_XRegressionCurveCalculator_idl
28*cdf0e10cSrcweir#define com_sun_star_chart2_XRegressionCurveCalculator_idl
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
31*cdf0e10cSrcweir
32*cdf0e10cSrcweir#include <com/sun/star/util/XNumberFormatsSupplier.idl>
33*cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
34*cdf0e10cSrcweir#include <com/sun/star/geometry/RealPoint2D.idl>
35*cdf0e10cSrcweir#include <com/sun/star/chart2/XScaling.idl>
36*cdf0e10cSrcweir
37*cdf0e10cSrcweirmodule com
38*cdf0e10cSrcweir{
39*cdf0e10cSrcweirmodule sun
40*cdf0e10cSrcweir{
41*cdf0e10cSrcweirmodule star
42*cdf0e10cSrcweir{
43*cdf0e10cSrcweirmodule chart2
44*cdf0e10cSrcweir{
45*cdf0e10cSrcweir
46*cdf0e10cSrcweirinterface XRegressionCurveCalculator : com::sun::star::uno::XInterface
47*cdf0e10cSrcweir{
48*cdf0e10cSrcweir    /** recalculates the parameters of the internal regression curve according to
49*cdf0e10cSrcweir        the <it>x</it>- and <it>y</it>-values given.
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir        @param aXValues
52*cdf0e10cSrcweir            All x-values that represent the measurement points on
53*cdf0e10cSrcweir            which the regression is based
54*cdf0e10cSrcweir
55*cdf0e10cSrcweir        @param aYValues
56*cdf0e10cSrcweir            All y-values that represent the measurement points on
57*cdf0e10cSrcweir            which the regression is based
58*cdf0e10cSrcweir    */
59*cdf0e10cSrcweir    void recalculateRegression( [in] sequence< double > aXValues,
60*cdf0e10cSrcweir                                [in] sequence< double > aYValues );
61*cdf0e10cSrcweir
62*cdf0e10cSrcweir
63*cdf0e10cSrcweir    /** calculates the value of the regression curve for <it>x</it>.
64*cdf0e10cSrcweir
65*cdf0e10cSrcweir        @param x
66*cdf0e10cSrcweir            The abscissa value for which the value of the regression
67*cdf0e10cSrcweir            curve should be calculated.  All numbers that are part of
68*cdf0e10cSrcweir            the domain of the regression function are valid.
69*cdf0e10cSrcweir
70*cdf0e10cSrcweir        @return
71*cdf0e10cSrcweir            If <it>x</it> is element of the domain of the regression
72*cdf0e10cSrcweir            curve function, the result is its value.
73*cdf0e10cSrcweir
74*cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
75*cdf0e10cSrcweir            If <it>x</it> is not part of the domain of the regression
76*cdf0e10cSrcweir            function.
77*cdf0e10cSrcweir     */
78*cdf0e10cSrcweir    double getCurveValue( [in] double x )
79*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir    /** calculate multiple points of a regression curve at once. Note
82*cdf0e10cSrcweir        that this method may optimize the output by returning less
83*cdf0e10cSrcweir        points, e.g. for a line you may get only two resulting points
84*cdf0e10cSrcweir        instead of <member>nPointCount</member> points.  This is only
85*cdf0e10cSrcweir        allowed if the parameter
86*cdf0e10cSrcweir        <member>bMaySkipPointsInCalculation</member> is set to
87*cdf0e10cSrcweir        <TRUE/>.
88*cdf0e10cSrcweir
89*cdf0e10cSrcweir        <p>It is important that a renderer takes the scalings into
90*cdf0e10cSrcweir        account. When one of these parameters is unknown, no
91*cdf0e10cSrcweir        optimization must be done.</p>
92*cdf0e10cSrcweir
93*cdf0e10cSrcweir        @param bMaySkipPointsInCalculation determines whether it is
94*cdf0e10cSrcweir               allowed to skip points in the calculation. When this
95*cdf0e10cSrcweir               parameter is <TRUE/> it is assumed that the underlying
96*cdf0e10cSrcweir               coordinate system is cartesian.
97*cdf0e10cSrcweir
98*cdf0e10cSrcweir        @param xScalingX a scaling that is used for the values in
99*cdf0e10cSrcweir               x-direction
100*cdf0e10cSrcweir
101*cdf0e10cSrcweir        @param xScalingY a scaling that is used for the values in
102*cdf0e10cSrcweir               y-direction
103*cdf0e10cSrcweir     */
104*cdf0e10cSrcweir    sequence< com::sun::star::geometry::RealPoint2D > getCurveValues(
105*cdf0e10cSrcweir        [in] double min,
106*cdf0e10cSrcweir        [in] double max,
107*cdf0e10cSrcweir        [in] long nPointCount,
108*cdf0e10cSrcweir        [in] XScaling xScalingX,
109*cdf0e10cSrcweir        [in] XScaling xScalingY,
110*cdf0e10cSrcweir        [in] boolean bMaySkipPointsInCalculation )
111*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
112*cdf0e10cSrcweir
113*cdf0e10cSrcweir    /** Returns the value of the correlation coefficient for the given
114*cdf0e10cSrcweir        regression.  This value is often denoted as <it>r</it> or
115*cdf0e10cSrcweir        <it>R</it>.
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir        <p>The value of <it>r</it> is signed.  Often
118*cdf0e10cSrcweir        <it>r</it><sup>2</sup> is used instead of <it>r</it> to denote
119*cdf0e10cSrcweir        a regression curve's accuray.</p>
120*cdf0e10cSrcweir
121*cdf0e10cSrcweir        @return
122*cdf0e10cSrcweir            The return value is the fraction of the variance in the
123*cdf0e10cSrcweir            data that is explained by the regression.
124*cdf0e10cSrcweir     */
125*cdf0e10cSrcweir    double getCorrelationCoefficient();
126*cdf0e10cSrcweir
127*cdf0e10cSrcweir    /** Retrieve a string showing the regression curve's function with
128*cdf0e10cSrcweir        calculated parameters.
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir        @return
131*cdf0e10cSrcweir            The string returned contains the regression curve's
132*cdf0e10cSrcweir            formula in a form <pre>"f(x) = ..."</pre>, where the
133*cdf0e10cSrcweir            calculated parts are filled out.  For a linear regression
134*cdf0e10cSrcweir            you might get <pre>"f(x) = 0.341 x + 1.45"</pre>.
135*cdf0e10cSrcweir     */
136*cdf0e10cSrcweir    string getRepresentation();
137*cdf0e10cSrcweir
138*cdf0e10cSrcweir    /** Returns a representation using the given numnber format for formatting all numbers
139*cdf0e10cSrcweir        contained in the formula.
140*cdf0e10cSrcweir
141*cdf0e10cSrcweir        @see getRepresentation
142*cdf0e10cSrcweir     */
143*cdf0e10cSrcweir    string getFormattedRepresentation( [in] com::sun::star::util::XNumberFormatsSupplier xNumFmtSupplier,
144*cdf0e10cSrcweir                                       [in] long nNumberFormatKey );
145*cdf0e10cSrcweir};
146*cdf0e10cSrcweir
147*cdf0e10cSrcweir} ; // chart2
148*cdf0e10cSrcweir} ; // com
149*cdf0e10cSrcweir} ; // sun
150*cdf0e10cSrcweir} ; // star
151*cdf0e10cSrcweir
152*cdf0e10cSrcweir#endif
153