1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: StatisticsHelper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CHART2_STATISTICSHELPER_HXX
31 #define CHART2_STATISTICSHELPER_HXX
33 #include <com/sun/star/uno/Sequence.hxx>
34 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <com/sun/star/chart2/data/XDataSource.hpp>
36 #include <com/sun/star/chart2/data/XDataProvider.hpp>
37 #include <com/sun/star/chart2/XDataSeries.hpp>
38 #include "charttoolsdllapi.hxx"
43 class OOO_DLLPUBLIC_CHARTTOOLS StatisticsHelper
46 /** Calculates 1/n * sum (x_i - x_mean)^2.
48 @see http://mathworld.wolfram.com/Variance.html
50 @param bUnbiasedEstimator
51 If true, 1/(n-1) * sum (x_i - x_mean)^2 is returned.
53 static double getVariance( const ::com::sun::star::uno::Sequence
< double > & rData
,
54 bool bUnbiasedEstimator
= false );
56 // square root of the variance
57 static double getStandardDeviation( const ::com::sun::star::uno::Sequence
< double > & rData
);
59 // also called "Standard deviation of the mean (SDOM)"
60 static double getStandardError( const ::com::sun::star::uno::Sequence
< double > & rData
);
62 static ::com::sun::star::uno::Reference
<
63 ::com::sun::star::chart2::data::XLabeledDataSequence
>
64 getErrorLabeledDataSequenceFromDataSource(
65 const ::com::sun::star::uno::Reference
<
66 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
68 bool bYError
= true );
70 static ::com::sun::star::uno::Reference
<
71 ::com::sun::star::chart2::data::XDataSequence
>
72 getErrorDataSequenceFromDataSource(
73 const ::com::sun::star::uno::Reference
<
74 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
76 bool bYError
= true );
78 static double getErrorFromDataSource(
79 const ::com::sun::star::uno::Reference
<
80 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
83 bool bYError
= true );
85 static void setErrorDataSequence(
86 const ::com::sun::star::uno::Reference
<
87 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
88 const ::com::sun::star::uno::Reference
<
89 ::com::sun::star::chart2::data::XDataProvider
> & xDataProvider
,
90 const ::rtl::OUString
& rNewRange
,
93 ::rtl::OUString
* pXMLRange
= 0 );
95 /// @return the newly created or existing error bar object
96 static ::com::sun::star::uno::Reference
<
97 ::com::sun::star::beans::XPropertySet
>
99 const ::com::sun::star::uno::Reference
<
100 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
101 const ::com::sun::star::uno::Reference
<
102 ::com::sun::star::uno::XComponentContext
> & xContext
,
104 bool bYError
= true );
106 static ::com::sun::star::uno::Reference
<
107 ::com::sun::star::beans::XPropertySet
>
109 const ::com::sun::star::uno::Reference
<
110 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
111 bool bYError
= true );
113 static bool hasErrorBars(
114 const ::com::sun::star::uno::Reference
<
115 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
116 bool bYError
= true );
118 static void removeErrorBars(
119 const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
121 bool bYError
= true );
123 static bool usesErrorBarRanges(
124 const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
126 bool bYError
= true );
135 // CHART2_STATISTICSHELPER_HXX