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