1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <memory>
#include <VSeriesPlotter.hxx>
namespace chart
{
class BarPositionHelper;
class BarChart : public VSeriesPlotter
{
// public methods
public:
BarChart() = delete;
BarChart( const rtl::Reference< ::chart::ChartType >& xChartTypeModel
, sal_Int32 nDimensionCount );
virtual ~BarChart() override;
virtual void createShapes() override;
virtual void addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot ) override;
virtual css::drawing::Direction3D getPreferredDiagramAspectRatio() const override;
private: //methods
static rtl::Reference< SvxShape >
createDataPoint3D_Bar(
const rtl::Reference<SvxShapeGroupAnyD>& xTarget
, const css::drawing::Position3D& rPosition
, const css::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
, const css::uno::Reference< css::beans::XPropertySet >& xObjectProperties
, sal_Int32 nGeometry3D );
css::awt::Point getLabelScreenPositionAndAlignment(
LabelAlignment& rAlignment, sal_Int32 nLabelPlacement
, double fScaledX, double fScaledLowerYValue, double fScaledUpperYValue, double fScaledZ
, double fScaledLowerBarDepth, double fScaledUpperBarDepth, double fBaseValue
, BarPositionHelper const * pPosHelper ) const;
virtual PlottingPositionHelper& getPlottingPositionHelper( sal_Int32 nAxisIndex ) const override;//nAxisIndex indicates whether the position belongs to the main axis ( nAxisIndex==0 ) or secondary axis ( nAxisIndex==1 )
void adaptOverlapAndGapwidthForGroupBarsPerAxis();
//better performance for big data
struct FormerBarPoint
{
FormerBarPoint( double fX, double fUpperY, double fLowerY, double fZ )
: m_fX(fX), m_fUpperY(fUpperY), m_fLowerY(fLowerY), m_fZ(fZ)
{}
FormerBarPoint()
: m_fX(std::numeric_limits<double>::quiet_NaN())
, m_fUpperY(std::numeric_limits<double>::quiet_NaN())
, m_fLowerY(std::numeric_limits<double>::quiet_NaN())
, m_fZ(std::numeric_limits<double>::quiet_NaN())
{
}
double m_fX;
double m_fUpperY;
double m_fLowerY;
double m_fZ;
};
void doZSlot(
bool& bDrawConnectionLines, bool& bDrawConnectionLinesInited, const std::vector< VDataSeriesGroup >& rZSlot,
sal_Int32 nZ, sal_Int32 nPointIndex, sal_Int32 nStartIndex,
const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveTarget,
const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveEquationTarget,
const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
std::unordered_set<rtl::Reference<SvxShape>>& aShapeSet,
std::map< VDataSeries*, FormerBarPoint >& aSeriesFormerPointMap,
std::map< sal_Int32, double >& aLogicYSumMap);
void doXSlot(
const VDataSeriesGroup& rXSlot,
bool& bDrawConnectionLines, bool& bDrawConnectionLinesInited,
sal_Int32 nZ, sal_Int32 nPointIndex, sal_Int32 nStartIndex,
const rtl::Reference<SvxShapeGroupAnyD>& xSeriesTarget,
const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveTarget,
const rtl::Reference<SvxShapeGroupAnyD>& xRegressionCurveEquationTarget,
const rtl::Reference<SvxShapeGroupAnyD>& xTextTarget,
std::unordered_set<rtl::Reference<SvxShape>>& aShapeSet,
std::map< VDataSeries*, FormerBarPoint >& aSeriesFormerPointMap,
std::map< sal_Int32, double >& aLogicYSumMap,
double fLogicBaseWidth, double fSlotX,
BarPositionHelper* const pPosHelper,
double fLogicPositiveYSum, double fLogicNegativeYSum,
sal_Int32 nAttachedAxisIndex);
private: //member
std::unique_ptr<BarPositionHelper> m_pMainPosHelper;
css::uno::Sequence< sal_Int32 > m_aOverlapSequence;
css::uno::Sequence< sal_Int32 > m_aGapwidthSequence;
};
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|