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