Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/chart/pie_chart.py: 79%
85 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1#Autogenerated schema
2from openpyxl.descriptors.serialisable import Serialisable
3from openpyxl.descriptors import (
4 Typed,
5 Bool,
6 MinMax,
7 Integer,
8 NoneSet,
9 Float,
10 Alias,
11 Sequence,
12)
13from openpyxl.descriptors.excel import ExtensionList, Percentage
14from openpyxl.descriptors.nested import (
15 NestedBool,
16 NestedMinMax,
17 NestedInteger,
18 NestedFloat,
19 NestedNoneSet,
20 NestedSet,
21)
22from openpyxl.descriptors.sequence import ValueSequence
24from ._chart import ChartBase
25from .axis import ChartLines
26from .descriptors import NestedGapAmount
27from .series import Series
28from .label import DataLabelList
31class _PieChartBase(ChartBase):
33 varyColors = NestedBool(allow_none=True)
34 ser = Sequence(expected_type=Series, allow_none=True)
35 dLbls = Typed(expected_type=DataLabelList, allow_none=True)
36 dataLabels = Alias("dLbls")
38 _series_type = "pie"
40 __elements__ = ('varyColors', 'ser', 'dLbls')
42 def __init__(self,
43 varyColors=True,
44 ser=(),
45 dLbls=None,
46 ):
47 self.varyColors = varyColors
48 self.ser = ser
49 self.dLbls = dLbls
50 super(_PieChartBase, self).__init__()
54class PieChart(_PieChartBase):
56 tagname = "pieChart"
58 varyColors = _PieChartBase.varyColors
59 ser = _PieChartBase.ser
60 dLbls = _PieChartBase.dLbls
62 firstSliceAng = NestedMinMax(min=0, max=360)
63 extLst = Typed(expected_type=ExtensionList, allow_none=True)
65 __elements__ = _PieChartBase.__elements__ + ('firstSliceAng', )
67 def __init__(self,
68 firstSliceAng=0,
69 extLst=None,
70 **kw
71 ):
72 self.firstSliceAng = firstSliceAng
73 super(PieChart, self).__init__(**kw)
76class PieChart3D(_PieChartBase):
78 tagname = "pie3DChart"
80 varyColors = _PieChartBase.varyColors
81 ser = _PieChartBase.ser
82 dLbls = _PieChartBase.dLbls
84 extLst = Typed(expected_type=ExtensionList, allow_none=True)
86 __elements__ = _PieChartBase.__elements__
89class DoughnutChart(_PieChartBase):
91 tagname = "doughnutChart"
93 varyColors = _PieChartBase.varyColors
94 ser = _PieChartBase.ser
95 dLbls = _PieChartBase.dLbls
97 firstSliceAng = NestedMinMax(min=0, max=360)
98 holeSize = NestedMinMax(min=1, max=90, allow_none=True)
99 extLst = Typed(expected_type=ExtensionList, allow_none=True)
101 __elements__ = _PieChartBase.__elements__ + ('firstSliceAng', 'holeSize')
103 def __init__(self,
104 firstSliceAng=0,
105 holeSize=10,
106 extLst=None,
107 **kw
108 ):
109 self.firstSliceAng = firstSliceAng
110 self.holeSize = holeSize
111 super(DoughnutChart, self).__init__(**kw)
114class CustomSplit(Serialisable):
116 tagname = "custSplit"
118 secondPiePt = ValueSequence(expected_type=int)
120 __elements__ = ('secondPiePt',)
122 def __init__(self,
123 secondPiePt=(),
124 ):
125 self.secondPiePt = secondPiePt
128class ProjectedPieChart(_PieChartBase):
130 """
131 From the spec 21.2.2.126
133 This element contains the pie of pie or bar of pie series on this
134 chart. Only the first series shall be displayed. The splitType element
135 shall determine whether the splitPos and custSplit elements apply.
136 """
138 tagname = "ofPieChart"
140 varyColors = _PieChartBase.varyColors
141 ser = _PieChartBase.ser
142 dLbls = _PieChartBase.dLbls
144 ofPieType = NestedSet(values=(['pie', 'bar']))
145 type = Alias('ofPieType')
146 gapWidth = NestedGapAmount()
147 splitType = NestedNoneSet(values=(['auto', 'cust', 'percent', 'pos', 'val']))
148 splitPos = NestedFloat(allow_none=True)
149 custSplit = Typed(expected_type=CustomSplit, allow_none=True)
150 secondPieSize = NestedMinMax(min=5, max=200, allow_none=True)
151 serLines = Typed(expected_type=ChartLines, allow_none=True)
152 join_lines = Alias('serLines')
153 extLst = Typed(expected_type=ExtensionList, allow_none=True)
155 __elements__ = _PieChartBase.__elements__ + ('ofPieType', 'gapWidth',
156 'splitType', 'splitPos', 'custSplit', 'secondPieSize', 'serLines')
158 def __init__(self,
159 ofPieType="pie",
160 gapWidth=None,
161 splitType="auto",
162 splitPos=None,
163 custSplit=None,
164 secondPieSize=75,
165 serLines=None,
166 extLst=None,
167 **kw
168 ):
169 self.ofPieType = ofPieType
170 self.gapWidth = gapWidth
171 self.splitType = splitType
172 self.splitPos = splitPos
173 self.custSplit = custSplit
174 self.secondPieSize = secondPieSize
175 if serLines is None:
176 self.serLines = ChartLines()
177 super(ProjectedPieChart, self).__init__(**kw)