1*d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef com_sun_star_chart2_XRegressionCurveCalculator_idl
24cdf0e10cSrcweir#define com_sun_star_chart2_XRegressionCurveCalculator_idl
25cdf0e10cSrcweir
26cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
27cdf0e10cSrcweir
28cdf0e10cSrcweir#include <com/sun/star/util/XNumberFormatsSupplier.idl>
29cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
30cdf0e10cSrcweir#include <com/sun/star/geometry/RealPoint2D.idl>
31cdf0e10cSrcweir#include <com/sun/star/chart2/XScaling.idl>
32cdf0e10cSrcweir
33cdf0e10cSrcweirmodule com
34cdf0e10cSrcweir{
35cdf0e10cSrcweirmodule sun
36cdf0e10cSrcweir{
37cdf0e10cSrcweirmodule star
38cdf0e10cSrcweir{
39cdf0e10cSrcweirmodule chart2
40cdf0e10cSrcweir{
41cdf0e10cSrcweir
42cdf0e10cSrcweirinterface XRegressionCurveCalculator : com::sun::star::uno::XInterface
43cdf0e10cSrcweir{
44cdf0e10cSrcweir    /** recalculates the parameters of the internal regression curve according to
45cdf0e10cSrcweir        the <it>x</it>- and <it>y</it>-values given.
46cdf0e10cSrcweir
47cdf0e10cSrcweir        @param aXValues
48cdf0e10cSrcweir            All x-values that represent the measurement points on
49cdf0e10cSrcweir            which the regression is based
50cdf0e10cSrcweir
51cdf0e10cSrcweir        @param aYValues
52cdf0e10cSrcweir            All y-values that represent the measurement points on
53cdf0e10cSrcweir            which the regression is based
54cdf0e10cSrcweir    */
55cdf0e10cSrcweir    void recalculateRegression( [in] sequence< double > aXValues,
56cdf0e10cSrcweir                                [in] sequence< double > aYValues );
57cdf0e10cSrcweir
58cdf0e10cSrcweir
59cdf0e10cSrcweir    /** calculates the value of the regression curve for <it>x</it>.
60cdf0e10cSrcweir
61cdf0e10cSrcweir        @param x
62cdf0e10cSrcweir            The abscissa value for which the value of the regression
63cdf0e10cSrcweir            curve should be calculated.  All numbers that are part of
64cdf0e10cSrcweir            the domain of the regression function are valid.
65cdf0e10cSrcweir
66cdf0e10cSrcweir        @return
67cdf0e10cSrcweir            If <it>x</it> is element of the domain of the regression
68cdf0e10cSrcweir            curve function, the result is its value.
69cdf0e10cSrcweir
70cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
71cdf0e10cSrcweir            If <it>x</it> is not part of the domain of the regression
72cdf0e10cSrcweir            function.
73cdf0e10cSrcweir     */
74cdf0e10cSrcweir    double getCurveValue( [in] double x )
75cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
76cdf0e10cSrcweir
77cdf0e10cSrcweir    /** calculate multiple points of a regression curve at once. Note
78cdf0e10cSrcweir        that this method may optimize the output by returning less
79cdf0e10cSrcweir        points, e.g. for a line you may get only two resulting points
80cdf0e10cSrcweir        instead of <member>nPointCount</member> points.  This is only
81cdf0e10cSrcweir        allowed if the parameter
82cdf0e10cSrcweir        <member>bMaySkipPointsInCalculation</member> is set to
83cdf0e10cSrcweir        <TRUE/>.
84cdf0e10cSrcweir
85cdf0e10cSrcweir        <p>It is important that a renderer takes the scalings into
86cdf0e10cSrcweir        account. When one of these parameters is unknown, no
87cdf0e10cSrcweir        optimization must be done.</p>
88cdf0e10cSrcweir
89cdf0e10cSrcweir        @param bMaySkipPointsInCalculation determines whether it is
90cdf0e10cSrcweir               allowed to skip points in the calculation. When this
91cdf0e10cSrcweir               parameter is <TRUE/> it is assumed that the underlying
92cdf0e10cSrcweir               coordinate system is cartesian.
93cdf0e10cSrcweir
94cdf0e10cSrcweir        @param xScalingX a scaling that is used for the values in
95cdf0e10cSrcweir               x-direction
96cdf0e10cSrcweir
97cdf0e10cSrcweir        @param xScalingY a scaling that is used for the values in
98cdf0e10cSrcweir               y-direction
99cdf0e10cSrcweir     */
100cdf0e10cSrcweir    sequence< com::sun::star::geometry::RealPoint2D > getCurveValues(
101cdf0e10cSrcweir        [in] double min,
102cdf0e10cSrcweir        [in] double max,
103cdf0e10cSrcweir        [in] long nPointCount,
104cdf0e10cSrcweir        [in] XScaling xScalingX,
105cdf0e10cSrcweir        [in] XScaling xScalingY,
106cdf0e10cSrcweir        [in] boolean bMaySkipPointsInCalculation )
107cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
108cdf0e10cSrcweir
109cdf0e10cSrcweir    /** Returns the value of the correlation coefficient for the given
110cdf0e10cSrcweir        regression.  This value is often denoted as <it>r</it> or
111cdf0e10cSrcweir        <it>R</it>.
112cdf0e10cSrcweir
113cdf0e10cSrcweir        <p>The value of <it>r</it> is signed.  Often
114cdf0e10cSrcweir        <it>r</it><sup>2</sup> is used instead of <it>r</it> to denote
115cdf0e10cSrcweir        a regression curve's accuray.</p>
116cdf0e10cSrcweir
117cdf0e10cSrcweir        @return
118cdf0e10cSrcweir            The return value is the fraction of the variance in the
119cdf0e10cSrcweir            data that is explained by the regression.
120cdf0e10cSrcweir     */
121cdf0e10cSrcweir    double getCorrelationCoefficient();
122cdf0e10cSrcweir
123cdf0e10cSrcweir    /** Retrieve a string showing the regression curve's function with
124cdf0e10cSrcweir        calculated parameters.
125cdf0e10cSrcweir
126cdf0e10cSrcweir        @return
127cdf0e10cSrcweir            The string returned contains the regression curve's
128cdf0e10cSrcweir            formula in a form <pre>"f(x) = ..."</pre>, where the
129cdf0e10cSrcweir            calculated parts are filled out.  For a linear regression
130cdf0e10cSrcweir            you might get <pre>"f(x) = 0.341 x + 1.45"</pre>.
131cdf0e10cSrcweir     */
132cdf0e10cSrcweir    string getRepresentation();
133cdf0e10cSrcweir
134cdf0e10cSrcweir    /** Returns a representation using the given numnber format for formatting all numbers
135cdf0e10cSrcweir        contained in the formula.
136cdf0e10cSrcweir
137cdf0e10cSrcweir        @see getRepresentation
138cdf0e10cSrcweir     */
139cdf0e10cSrcweir    string getFormattedRepresentation( [in] com::sun::star::util::XNumberFormatsSupplier xNumFmtSupplier,
140cdf0e10cSrcweir                                       [in] long nNumberFormatKey );
141cdf0e10cSrcweir};
142cdf0e10cSrcweir
143cdf0e10cSrcweir} ; // chart2
144cdf0e10cSrcweir} ; // com
145cdf0e10cSrcweir} ; // sun
146cdf0e10cSrcweir} ; // star
147cdf0e10cSrcweir
148cdf0e10cSrcweir#endif
149