Calculate correct standard deviation for XErrorBar.
- Add method to calculate X standard deviation. - Set correct XErrorBar position when using standard deviation error type.
This commit is contained in:
committed by
Markus Mohrhard
parent
0e3bd5c0c4
commit
67c45c9dbd
@@ -823,7 +823,12 @@ void VSeriesPlotter::createErrorBar(
|
|||||||
|
|
||||||
drawing::Position3D aUnscaledLogicPosition(rUnscaledLogicPosition);
|
drawing::Position3D aUnscaledLogicPosition(rUnscaledLogicPosition);
|
||||||
if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION)
|
if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION)
|
||||||
aUnscaledLogicPosition.PositionY = rVDataSeries.getYMeanValue();
|
{
|
||||||
|
if (bYError)
|
||||||
|
aUnscaledLogicPosition.PositionY = rVDataSeries.getYMeanValue();
|
||||||
|
else
|
||||||
|
aUnscaledLogicPosition.PositionX = rVDataSeries.getXMeanValue();
|
||||||
|
}
|
||||||
|
|
||||||
bool bCreateNegativeBorder = false;//make a vertical line at the negative end of the error bar
|
bool bCreateNegativeBorder = false;//make a vertical line at the negative end of the error bar
|
||||||
bool bCreatePositiveBorder = false;//make a vertical line at the positive end of the error bar
|
bool bCreatePositiveBorder = false;//make a vertical line at the positive end of the error bar
|
||||||
|
@@ -102,6 +102,7 @@ public:
|
|||||||
::com::sun::star::uno::Sequence< double > getAllX() const;
|
::com::sun::star::uno::Sequence< double > getAllX() const;
|
||||||
::com::sun::star::uno::Sequence< double > getAllY() const;
|
::com::sun::star::uno::Sequence< double > getAllY() const;
|
||||||
|
|
||||||
|
double getXMeanValue() const;
|
||||||
double getYMeanValue() const;
|
double getYMeanValue() const;
|
||||||
|
|
||||||
bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
|
bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
|
||||||
@@ -216,6 +217,7 @@ private: //member
|
|||||||
|
|
||||||
VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
|
VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
|
||||||
|
|
||||||
|
mutable double m_fXMeanValue;
|
||||||
mutable double m_fYMeanValue;
|
mutable double m_fYMeanValue;
|
||||||
|
|
||||||
::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
|
::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
|
||||||
|
@@ -176,6 +176,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
|
|||||||
, m_aValues_Bubble_Size()
|
, m_aValues_Bubble_Size()
|
||||||
, m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
|
, m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
|
||||||
|
|
||||||
|
, m_fXMeanValue(1.0)
|
||||||
, m_fYMeanValue(1.0)
|
, m_fYMeanValue(1.0)
|
||||||
|
|
||||||
, m_aAttributedDataPointIndexList()
|
, m_aAttributedDataPointIndexList()
|
||||||
@@ -207,6 +208,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
|
|||||||
, m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
|
, m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
|
||||||
, m_bAllowPercentValueInDataLabel(false)
|
, m_bAllowPercentValueInDataLabel(false)
|
||||||
{
|
{
|
||||||
|
::rtl::math::setNan( & m_fXMeanValue );
|
||||||
::rtl::math::setNan( & m_fYMeanValue );
|
::rtl::math::setNan( & m_fYMeanValue );
|
||||||
|
|
||||||
uno::Reference<data::XDataSource> xDataSource =
|
uno::Reference<data::XDataSource> xDataSource =
|
||||||
@@ -729,6 +731,19 @@ uno::Sequence< double > VDataSeries::getAllY() const
|
|||||||
return m_aValues_Y.Doubles;
|
return m_aValues_Y.Doubles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double VDataSeries::getXMeanValue() const
|
||||||
|
{
|
||||||
|
if( ::rtl::math::isNan( m_fXMeanValue ) )
|
||||||
|
{
|
||||||
|
uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( "com.sun.star.chart2.MeanValueRegressionCurve" ) );
|
||||||
|
uno::Sequence< double > aXValuesDummy;
|
||||||
|
xCalculator->recalculateRegression( aXValuesDummy, getAllX() );
|
||||||
|
double fXDummy = 1.0;
|
||||||
|
m_fXMeanValue = xCalculator->getCurveValue( fXDummy );
|
||||||
|
}
|
||||||
|
return m_fXMeanValue;
|
||||||
|
}
|
||||||
|
|
||||||
double VDataSeries::getYMeanValue() const
|
double VDataSeries::getYMeanValue() const
|
||||||
{
|
{
|
||||||
if( ::rtl::math::isNan( m_fYMeanValue ) )
|
if( ::rtl::math::isNan( m_fYMeanValue ) )
|
||||||
|
Reference in New Issue
Block a user