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/Reference.h>
23 #include <rtl/ustring.hxx>
24 #include "charttoolsdllapi.hxx"
26 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XPropertySet
; } } } }
27 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XDataSeries
; } } } }
28 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ namespace data
{ class XDataProvider
; } } } } }
29 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ namespace data
{ class XDataSequence
; } } } } }
30 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ namespace data
{ class XDataSource
; } } } } }
31 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ namespace data
{ class XLabeledDataSequence
; } } } } }
32 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{ template <typename
> class Sequence
; } } } }
37 namespace StatisticsHelper
39 /** Calculates 1/n * sum (x_i - x_mean)^2.
41 @see http://mathworld.wolfram.com/Variance.html
43 OOO_DLLPUBLIC_CHARTTOOLS
double getVariance( const css::uno::Sequence
< double > & rData
);
45 // square root of the variance
46 OOO_DLLPUBLIC_CHARTTOOLS
double getStandardDeviation( const css::uno::Sequence
< double > & rData
);
48 // also called "Standard deviation of the mean (SDOM)"
49 OOO_DLLPUBLIC_CHARTTOOLS
double getStandardError( const css::uno::Sequence
< double > & rData
);
51 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
52 getErrorLabeledDataSequenceFromDataSource(
53 const css::uno::Reference
< css::chart2::data::XDataSource
> & xDataSource
,
55 bool bYError
= true );
57 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
< css::chart2::data::XDataSequence
>
58 getErrorDataSequenceFromDataSource(
59 const css::uno::Reference
< css::chart2::data::XDataSource
> & xDataSource
,
61 bool bYError
= true );
63 OOO_DLLPUBLIC_CHARTTOOLS
double getErrorFromDataSource(
64 const css::uno::Reference
< css::chart2::data::XDataSource
> & xDataSource
,
67 bool bYError
= true );
69 OOO_DLLPUBLIC_CHARTTOOLS
void setErrorDataSequence(
70 const css::uno::Reference
< css::chart2::data::XDataSource
> & xDataSource
,
71 const css::uno::Reference
< css::chart2::data::XDataProvider
> & xDataProvider
,
72 const OUString
& rNewRange
,
75 OUString
const * pXMLRange
= nullptr );
77 /// @return the newly created or existing error bar object
78 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
< css::beans::XPropertySet
>
80 const css::uno::Reference
< css::chart2::XDataSeries
> & xDataSeries
,
82 bool bYError
= true );
84 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
< css::beans::XPropertySet
>
86 const css::uno::Reference
< css::chart2::XDataSeries
> & xDataSeries
,
87 bool bYError
= true );
89 OOO_DLLPUBLIC_CHARTTOOLS
bool hasErrorBars(
90 const css::uno::Reference
< css::chart2::XDataSeries
> & xDataSeries
,
91 bool bYError
= true );
93 OOO_DLLPUBLIC_CHARTTOOLS
void removeErrorBars(
94 const css::uno::Reference
< css::chart2::XDataSeries
> & xDataSeries
,
95 bool bYError
= true );
97 OOO_DLLPUBLIC_CHARTTOOLS
bool usesErrorBarRanges(
98 const css::uno::Reference
< css::chart2::XDataSeries
> & xDataSeries
,
99 bool bYError
= true );
104 // INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */