1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
22 #include <com/sun/star/uno/Sequence.hxx>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/chart2/data/XDataSource.hpp>
25 #include <com/sun/star/chart2/data/XDataProvider.hpp>
26 #include <com/sun/star/chart2/XDataSeries.hpp>
27 #include "charttoolsdllapi.hxx"
32 namespace StatisticsHelper
34 /** Calculates 1/n * sum (x_i - x_mean)^2.
36 @see http://mathworld.wolfram.com/Variance.html
38 @param bUnbiasedEstimator
39 If true, 1/(n-1) * sum (x_i - x_mean)^2 is returned.
41 OOO_DLLPUBLIC_CHARTTOOLS
double getVariance( const ::com::sun::star::uno::Sequence
< double > & rData
,
42 bool bUnbiasedEstimator
= false );
44 // square root of the variance
45 OOO_DLLPUBLIC_CHARTTOOLS
double getStandardDeviation( const ::com::sun::star::uno::Sequence
< double > & rData
);
47 // also called "Standard deviation of the mean (SDOM)"
48 OOO_DLLPUBLIC_CHARTTOOLS
double getStandardError( const ::com::sun::star::uno::Sequence
< double > & rData
);
50 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
<
51 ::com::sun::star::chart2::data::XLabeledDataSequence
>
52 getErrorLabeledDataSequenceFromDataSource(
53 const ::com::sun::star::uno::Reference
<
54 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
56 bool bYError
= true );
58 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
<
59 ::com::sun::star::chart2::data::XDataSequence
>
60 getErrorDataSequenceFromDataSource(
61 const ::com::sun::star::uno::Reference
<
62 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
64 bool bYError
= true );
66 OOO_DLLPUBLIC_CHARTTOOLS
double getErrorFromDataSource(
67 const ::com::sun::star::uno::Reference
<
68 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
71 bool bYError
= true );
73 OOO_DLLPUBLIC_CHARTTOOLS
void setErrorDataSequence(
74 const ::com::sun::star::uno::Reference
<
75 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
76 const ::com::sun::star::uno::Reference
<
77 ::com::sun::star::chart2::data::XDataProvider
> & xDataProvider
,
78 const OUString
& rNewRange
,
81 OUString
* pXMLRange
= 0 );
83 /// @return the newly created or existing error bar object
84 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
<
85 ::com::sun::star::beans::XPropertySet
>
87 const ::com::sun::star::uno::Reference
<
88 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
89 const ::com::sun::star::uno::Reference
<
90 ::com::sun::star::uno::XComponentContext
> & xContext
,
92 bool bYError
= true );
94 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
<
95 ::com::sun::star::beans::XPropertySet
>
97 const ::com::sun::star::uno::Reference
<
98 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
99 bool bYError
= true );
101 OOO_DLLPUBLIC_CHARTTOOLS
bool hasErrorBars(
102 const ::com::sun::star::uno::Reference
<
103 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
104 bool bYError
= true );
106 OOO_DLLPUBLIC_CHARTTOOLS
void removeErrorBars(
107 const ::com::sun::star::uno::Reference
<
108 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
109 bool bYError
= true );
111 OOO_DLLPUBLIC_CHARTTOOLS
bool usesErrorBarRanges(
112 const ::com::sun::star::uno::Reference
<
113 ::com::sun::star::chart2::XDataSeries
> & xDataSeries
,
114 bool bYError
= true );
119 // INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */