ps-python-pptx 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. pptx/__init__.py +84 -0
  2. pptx/action.py +270 -0
  3. pptx/api.py +49 -0
  4. pptx/chart/__init__.py +0 -0
  5. pptx/chart/axis.py +523 -0
  6. pptx/chart/category.py +200 -0
  7. pptx/chart/chart.py +280 -0
  8. pptx/chart/data.py +864 -0
  9. pptx/chart/datalabel.py +288 -0
  10. pptx/chart/legend.py +79 -0
  11. pptx/chart/marker.py +70 -0
  12. pptx/chart/plot.py +412 -0
  13. pptx/chart/point.py +101 -0
  14. pptx/chart/series.py +258 -0
  15. pptx/chart/xlsx.py +272 -0
  16. pptx/chart/xmlwriter.py +1840 -0
  17. pptx/dml/__init__.py +0 -0
  18. pptx/dml/chtfmt.py +40 -0
  19. pptx/dml/color.py +301 -0
  20. pptx/dml/effect.py +41 -0
  21. pptx/dml/fill.py +468 -0
  22. pptx/dml/line.py +100 -0
  23. pptx/enum/__init__.py +0 -0
  24. pptx/enum/action.py +71 -0
  25. pptx/enum/base.py +175 -0
  26. pptx/enum/chart.py +492 -0
  27. pptx/enum/dml.py +405 -0
  28. pptx/enum/lang.py +685 -0
  29. pptx/enum/shapes.py +1029 -0
  30. pptx/enum/text.py +371 -0
  31. pptx/exc.py +23 -0
  32. pptx/media.py +197 -0
  33. pptx/opc/__init__.py +0 -0
  34. pptx/opc/constants.py +331 -0
  35. pptx/opc/oxml.py +188 -0
  36. pptx/opc/package.py +762 -0
  37. pptx/opc/packuri.py +109 -0
  38. pptx/opc/serialized.py +296 -0
  39. pptx/opc/shared.py +20 -0
  40. pptx/opc/spec.py +44 -0
  41. pptx/oxml/__init__.py +492 -0
  42. pptx/oxml/action.py +53 -0
  43. pptx/oxml/chart/__init__.py +0 -0
  44. pptx/oxml/chart/axis.py +297 -0
  45. pptx/oxml/chart/chart.py +282 -0
  46. pptx/oxml/chart/datalabel.py +252 -0
  47. pptx/oxml/chart/legend.py +72 -0
  48. pptx/oxml/chart/marker.py +61 -0
  49. pptx/oxml/chart/plot.py +345 -0
  50. pptx/oxml/chart/series.py +254 -0
  51. pptx/oxml/chart/shared.py +219 -0
  52. pptx/oxml/coreprops.py +288 -0
  53. pptx/oxml/dml/__init__.py +0 -0
  54. pptx/oxml/dml/color.py +111 -0
  55. pptx/oxml/dml/fill.py +197 -0
  56. pptx/oxml/dml/line.py +12 -0
  57. pptx/oxml/ns.py +129 -0
  58. pptx/oxml/presentation.py +130 -0
  59. pptx/oxml/shapes/__init__.py +19 -0
  60. pptx/oxml/shapes/autoshape.py +455 -0
  61. pptx/oxml/shapes/connector.py +107 -0
  62. pptx/oxml/shapes/graphfrm.py +342 -0
  63. pptx/oxml/shapes/groupshape.py +280 -0
  64. pptx/oxml/shapes/picture.py +270 -0
  65. pptx/oxml/shapes/shared.py +523 -0
  66. pptx/oxml/simpletypes.py +740 -0
  67. pptx/oxml/slide.py +347 -0
  68. pptx/oxml/table.py +588 -0
  69. pptx/oxml/text.py +748 -0
  70. pptx/oxml/theme.py +29 -0
  71. pptx/oxml/xmlchemy.py +717 -0
  72. pptx/package.py +222 -0
  73. pptx/parts/__init__.py +0 -0
  74. pptx/parts/chart.py +95 -0
  75. pptx/parts/coreprops.py +167 -0
  76. pptx/parts/embeddedpackage.py +93 -0
  77. pptx/parts/image.py +275 -0
  78. pptx/parts/media.py +37 -0
  79. pptx/parts/presentation.py +126 -0
  80. pptx/parts/slide.py +297 -0
  81. pptx/parts/theme.py +13 -0
  82. pptx/presentation.py +113 -0
  83. pptx/py.typed +0 -0
  84. pptx/shapes/__init__.py +26 -0
  85. pptx/shapes/autoshape.py +355 -0
  86. pptx/shapes/base.py +293 -0
  87. pptx/shapes/connector.py +297 -0
  88. pptx/shapes/freeform.py +337 -0
  89. pptx/shapes/graphfrm.py +166 -0
  90. pptx/shapes/group.py +69 -0
  91. pptx/shapes/picture.py +203 -0
  92. pptx/shapes/placeholder.py +407 -0
  93. pptx/shapes/shapetree.py +1190 -0
  94. pptx/shared.py +82 -0
  95. pptx/slide.py +577 -0
  96. pptx/spec.py +632 -0
  97. pptx/table.py +520 -0
  98. pptx/templates/default.pptx +0 -0
  99. pptx/templates/docx-icon.emf +0 -0
  100. pptx/templates/generic-icon.emf +0 -0
  101. pptx/templates/notes.xml +23 -0
  102. pptx/templates/notesMaster.xml +352 -0
  103. pptx/templates/pptx-icon.emf +0 -0
  104. pptx/templates/theme.xml +321 -0
  105. pptx/templates/xlsx-icon.emf +0 -0
  106. pptx/text/__init__.py +0 -0
  107. pptx/text/fonts.py +399 -0
  108. pptx/text/layout.py +325 -0
  109. pptx/text/text.py +770 -0
  110. pptx/theme.py +135 -0
  111. pptx/types.py +36 -0
  112. pptx/util.py +284 -0
  113. ps_python_pptx-1.1.0.dist-info/METADATA +75 -0
  114. ps_python_pptx-1.1.0.dist-info/RECORD +117 -0
  115. ps_python_pptx-1.1.0.dist-info/WHEEL +5 -0
  116. ps_python_pptx-1.1.0.dist-info/licenses/LICENSE +20 -0
  117. ps_python_pptx-1.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,297 @@
1
+ """Axis-related oxml objects."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pptx.enum.chart import XL_AXIS_CROSSES, XL_TICK_LABEL_POSITION, XL_TICK_MARK
6
+ from pptx.oxml.chart.shared import CT_Title
7
+ from pptx.oxml.simpletypes import ST_AxisUnit, ST_LblOffset, ST_Orientation
8
+ from pptx.oxml.text import CT_TextBody
9
+ from pptx.oxml.xmlchemy import (
10
+ BaseOxmlElement,
11
+ OneAndOnlyOne,
12
+ OptionalAttribute,
13
+ RequiredAttribute,
14
+ ZeroOrOne,
15
+ )
16
+
17
+
18
+ class BaseAxisElement(BaseOxmlElement):
19
+ """Base class for catAx, dateAx, valAx, and perhaps other axis elements."""
20
+
21
+ @property
22
+ def defRPr(self):
23
+ """
24
+ ``<a:defRPr>`` great-great-grandchild element, added with its
25
+ ancestors if not present.
26
+ """
27
+ txPr = self.get_or_add_txPr()
28
+ defRPr = txPr.defRPr
29
+ return defRPr
30
+
31
+ @property
32
+ def orientation(self):
33
+ """Value of `val` attribute of `c:scaling/c:orientation` grandchild element.
34
+
35
+ Defaults to `ST_Orientation.MIN_MAX` if attribute or any ancestors are not
36
+ present.
37
+ """
38
+ orientation = self.scaling.orientation
39
+ if orientation is None:
40
+ return ST_Orientation.MIN_MAX
41
+ return orientation.val
42
+
43
+ @orientation.setter
44
+ def orientation(self, value):
45
+ """`value` is a member of `ST_Orientation`."""
46
+ self.scaling._remove_orientation()
47
+ if value == ST_Orientation.MAX_MIN:
48
+ self.scaling.get_or_add_orientation().val = value
49
+
50
+ def _new_title(self):
51
+ return CT_Title.new_title()
52
+
53
+ def _new_txPr(self):
54
+ return CT_TextBody.new_txPr()
55
+
56
+
57
+ class CT_AxisUnit(BaseOxmlElement):
58
+ """Used for `c:majorUnit` and `c:minorUnit` elements, and others."""
59
+
60
+ val = RequiredAttribute("val", ST_AxisUnit)
61
+
62
+
63
+ class CT_CatAx(BaseAxisElement):
64
+ """`c:catAx` element, defining a category axis."""
65
+
66
+ _tag_seq = (
67
+ "c:axId",
68
+ "c:scaling",
69
+ "c:delete",
70
+ "c:axPos",
71
+ "c:majorGridlines",
72
+ "c:minorGridlines",
73
+ "c:title",
74
+ "c:numFmt",
75
+ "c:majorTickMark",
76
+ "c:minorTickMark",
77
+ "c:tickLblPos",
78
+ "c:spPr",
79
+ "c:txPr",
80
+ "c:crossAx",
81
+ "c:crosses",
82
+ "c:crossesAt",
83
+ "c:auto",
84
+ "c:lblAlgn",
85
+ "c:lblOffset",
86
+ "c:tickLblSkip",
87
+ "c:tickMarkSkip",
88
+ "c:noMultiLvlLbl",
89
+ "c:extLst",
90
+ )
91
+ scaling = OneAndOnlyOne("c:scaling")
92
+ delete_ = ZeroOrOne("c:delete", successors=_tag_seq[3:])
93
+ majorGridlines = ZeroOrOne("c:majorGridlines", successors=_tag_seq[5:])
94
+ minorGridlines = ZeroOrOne("c:minorGridlines", successors=_tag_seq[6:])
95
+ title = ZeroOrOne("c:title", successors=_tag_seq[7:])
96
+ numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[8:])
97
+ majorTickMark = ZeroOrOne("c:majorTickMark", successors=_tag_seq[9:])
98
+ minorTickMark = ZeroOrOne("c:minorTickMark", successors=_tag_seq[10:])
99
+ tickLblPos = ZeroOrOne("c:tickLblPos", successors=_tag_seq[11:])
100
+ spPr = ZeroOrOne("c:spPr", successors=_tag_seq[12:])
101
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[13:])
102
+ crosses = ZeroOrOne("c:crosses", successors=_tag_seq[15:])
103
+ crossesAt = ZeroOrOne("c:crossesAt", successors=_tag_seq[16:])
104
+ lblOffset = ZeroOrOne("c:lblOffset", successors=_tag_seq[19:])
105
+ del _tag_seq
106
+
107
+
108
+ class CT_ChartLines(BaseOxmlElement):
109
+ """Used for `c:majorGridlines` and `c:minorGridlines`.
110
+
111
+ Specifies gridlines visual properties such as color and width.
112
+ """
113
+
114
+ spPr = ZeroOrOne("c:spPr", successors=())
115
+
116
+
117
+ class CT_Crosses(BaseOxmlElement):
118
+ """`c:crosses` element, specifying where the other axis crosses this one."""
119
+
120
+ val = RequiredAttribute("val", XL_AXIS_CROSSES)
121
+
122
+
123
+ class CT_DateAx(BaseAxisElement):
124
+ """`c:dateAx` element, defining a date (category) axis."""
125
+
126
+ _tag_seq = (
127
+ "c:axId",
128
+ "c:scaling",
129
+ "c:delete",
130
+ "c:axPos",
131
+ "c:majorGridlines",
132
+ "c:minorGridlines",
133
+ "c:title",
134
+ "c:numFmt",
135
+ "c:majorTickMark",
136
+ "c:minorTickMark",
137
+ "c:tickLblPos",
138
+ "c:spPr",
139
+ "c:txPr",
140
+ "c:crossAx",
141
+ "c:crosses",
142
+ "c:crossesAt",
143
+ "c:auto",
144
+ "c:lblOffset",
145
+ "c:baseTimeUnit",
146
+ "c:majorUnit",
147
+ "c:majorTimeUnit",
148
+ "c:minorUnit",
149
+ "c:minorTimeUnit",
150
+ "c:extLst",
151
+ )
152
+ scaling = OneAndOnlyOne("c:scaling")
153
+ delete_ = ZeroOrOne("c:delete", successors=_tag_seq[3:])
154
+ majorGridlines = ZeroOrOne("c:majorGridlines", successors=_tag_seq[5:])
155
+ minorGridlines = ZeroOrOne("c:minorGridlines", successors=_tag_seq[6:])
156
+ title = ZeroOrOne("c:title", successors=_tag_seq[7:])
157
+ numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[8:])
158
+ majorTickMark = ZeroOrOne("c:majorTickMark", successors=_tag_seq[9:])
159
+ minorTickMark = ZeroOrOne("c:minorTickMark", successors=_tag_seq[10:])
160
+ tickLblPos = ZeroOrOne("c:tickLblPos", successors=_tag_seq[11:])
161
+ spPr = ZeroOrOne("c:spPr", successors=_tag_seq[12:])
162
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[13:])
163
+ crosses = ZeroOrOne("c:crosses", successors=_tag_seq[15:])
164
+ crossesAt = ZeroOrOne("c:crossesAt", successors=_tag_seq[16:])
165
+ lblOffset = ZeroOrOne("c:lblOffset", successors=_tag_seq[18:])
166
+ del _tag_seq
167
+
168
+
169
+ class CT_LblOffset(BaseOxmlElement):
170
+ """`c:lblOffset` custom element class."""
171
+
172
+ val = OptionalAttribute("val", ST_LblOffset, default=100)
173
+
174
+
175
+ class CT_Orientation(BaseOxmlElement):
176
+ """`c:xAx/c:scaling/c:orientation` element, defining category order.
177
+
178
+ Used to reverse the order categories appear in on a bar chart so they start at the
179
+ top rather than the bottom. Because we read top-to-bottom, the default way looks odd
180
+ to many and perhaps most folks. Also applicable to value and date axes.
181
+ """
182
+
183
+ val = OptionalAttribute("val", ST_Orientation, default=ST_Orientation.MIN_MAX)
184
+
185
+
186
+ class CT_Scaling(BaseOxmlElement):
187
+ """`c:scaling` element.
188
+
189
+ Defines axis scale characteristics such as maximum value, log vs. linear, etc.
190
+ """
191
+
192
+ _tag_seq = ("c:logBase", "c:orientation", "c:max", "c:min", "c:extLst")
193
+ orientation = ZeroOrOne("c:orientation", successors=_tag_seq[2:])
194
+ max = ZeroOrOne("c:max", successors=_tag_seq[3:])
195
+ min = ZeroOrOne("c:min", successors=_tag_seq[4:])
196
+ del _tag_seq
197
+
198
+ @property
199
+ def maximum(self):
200
+ """
201
+ The float value of the ``<c:max>`` child element, or |None| if no max
202
+ element is present.
203
+ """
204
+ max = self.max
205
+ if max is None:
206
+ return None
207
+ return max.val
208
+
209
+ @maximum.setter
210
+ def maximum(self, value):
211
+ """
212
+ Set the value of the ``<c:max>`` child element to the float *value*,
213
+ or remove the max element if *value* is |None|.
214
+ """
215
+ self._remove_max()
216
+ if value is None:
217
+ return
218
+ self._add_max(val=value)
219
+
220
+ @property
221
+ def minimum(self):
222
+ """
223
+ The float value of the ``<c:min>`` child element, or |None| if no min
224
+ element is present.
225
+ """
226
+ min = self.min
227
+ if min is None:
228
+ return None
229
+ return min.val
230
+
231
+ @minimum.setter
232
+ def minimum(self, value):
233
+ """
234
+ Set the value of the ``<c:min>`` child element to the float *value*,
235
+ or remove the min element if *value* is |None|.
236
+ """
237
+ self._remove_min()
238
+ if value is None:
239
+ return
240
+ self._add_min(val=value)
241
+
242
+
243
+ class CT_TickLblPos(BaseOxmlElement):
244
+ """`c:tickLblPos` element."""
245
+
246
+ val = OptionalAttribute("val", XL_TICK_LABEL_POSITION)
247
+
248
+
249
+ class CT_TickMark(BaseOxmlElement):
250
+ """Used for `c:minorTickMark` and `c:majorTickMark`."""
251
+
252
+ val = OptionalAttribute("val", XL_TICK_MARK, default=XL_TICK_MARK.CROSS)
253
+
254
+
255
+ class CT_ValAx(BaseAxisElement):
256
+ """`c:valAx` element, defining a value axis."""
257
+
258
+ _tag_seq = (
259
+ "c:axId",
260
+ "c:scaling",
261
+ "c:delete",
262
+ "c:axPos",
263
+ "c:majorGridlines",
264
+ "c:minorGridlines",
265
+ "c:title",
266
+ "c:numFmt",
267
+ "c:majorTickMark",
268
+ "c:minorTickMark",
269
+ "c:tickLblPos",
270
+ "c:spPr",
271
+ "c:txPr",
272
+ "c:crossAx",
273
+ "c:crosses",
274
+ "c:crossesAt",
275
+ "c:crossBetween",
276
+ "c:majorUnit",
277
+ "c:minorUnit",
278
+ "c:dispUnits",
279
+ "c:extLst",
280
+ )
281
+ scaling = OneAndOnlyOne("c:scaling")
282
+ delete_ = ZeroOrOne("c:delete", successors=_tag_seq[3:])
283
+ majorGridlines = ZeroOrOne("c:majorGridlines", successors=_tag_seq[5:])
284
+ minorGridlines = ZeroOrOne("c:minorGridlines", successors=_tag_seq[6:])
285
+ title = ZeroOrOne("c:title", successors=_tag_seq[7:])
286
+ numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[8:])
287
+ majorTickMark = ZeroOrOne("c:majorTickMark", successors=_tag_seq[9:])
288
+ minorTickMark = ZeroOrOne("c:minorTickMark", successors=_tag_seq[10:])
289
+ tickLblPos = ZeroOrOne("c:tickLblPos", successors=_tag_seq[11:])
290
+ spPr = ZeroOrOne("c:spPr", successors=_tag_seq[12:])
291
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[13:])
292
+ crossAx = ZeroOrOne("c:crossAx", successors=_tag_seq[14:])
293
+ crosses = ZeroOrOne("c:crosses", successors=_tag_seq[15:])
294
+ crossesAt = ZeroOrOne("c:crossesAt", successors=_tag_seq[16:])
295
+ majorUnit = ZeroOrOne("c:majorUnit", successors=_tag_seq[18:])
296
+ minorUnit = ZeroOrOne("c:minorUnit", successors=_tag_seq[19:])
297
+ del _tag_seq
@@ -0,0 +1,282 @@
1
+ """Custom element classes for top-level chart-related XML elements."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import cast
6
+
7
+ from pptx.oxml import parse_xml
8
+ from pptx.oxml.chart.shared import CT_Title
9
+ from pptx.oxml.ns import nsdecls, qn
10
+ from pptx.oxml.simpletypes import ST_Style, XsdString
11
+ from pptx.oxml.text import CT_TextBody
12
+ from pptx.oxml.xmlchemy import (
13
+ BaseOxmlElement,
14
+ OneAndOnlyOne,
15
+ RequiredAttribute,
16
+ ZeroOrMore,
17
+ ZeroOrOne,
18
+ )
19
+
20
+
21
+ class CT_Chart(BaseOxmlElement):
22
+ """`c:chart` custom element class."""
23
+
24
+ _tag_seq = (
25
+ "c:title",
26
+ "c:autoTitleDeleted",
27
+ "c:pivotFmts",
28
+ "c:view3D",
29
+ "c:floor",
30
+ "c:sideWall",
31
+ "c:backWall",
32
+ "c:plotArea",
33
+ "c:legend",
34
+ "c:plotVisOnly",
35
+ "c:dispBlanksAs",
36
+ "c:showDLblsOverMax",
37
+ "c:extLst",
38
+ )
39
+ title = ZeroOrOne("c:title", successors=_tag_seq[1:])
40
+ autoTitleDeleted = ZeroOrOne("c:autoTitleDeleted", successors=_tag_seq[2:])
41
+ plotArea = OneAndOnlyOne("c:plotArea")
42
+ legend = ZeroOrOne("c:legend", successors=_tag_seq[9:])
43
+ rId: str = RequiredAttribute("r:id", XsdString) # pyright: ignore[reportAssignmentType]
44
+
45
+ @property
46
+ def has_legend(self):
47
+ """
48
+ True if this chart has a legend defined, False otherwise.
49
+ """
50
+ legend = self.legend
51
+ if legend is None:
52
+ return False
53
+ return True
54
+
55
+ @has_legend.setter
56
+ def has_legend(self, bool_value):
57
+ """
58
+ Add, remove, or leave alone the ``<c:legend>`` child element depending
59
+ on current state and *bool_value*. If *bool_value* is |True| and no
60
+ ``<c:legend>`` element is present, a new default element is added.
61
+ When |False|, any existing legend element is removed.
62
+ """
63
+ if bool(bool_value) is False:
64
+ self._remove_legend()
65
+ else:
66
+ if self.legend is None:
67
+ self._add_legend()
68
+
69
+ @staticmethod
70
+ def new_chart(rId: str) -> CT_Chart:
71
+ """Return a new `c:chart` element."""
72
+ return cast(CT_Chart, parse_xml(f'<c:chart {nsdecls("c")} {nsdecls("r")} r:id="{rId}"/>'))
73
+
74
+ def _new_title(self):
75
+ return CT_Title.new_title()
76
+
77
+
78
+ class CT_ChartSpace(BaseOxmlElement):
79
+ """`c:chartSpace` root element of a chart part."""
80
+
81
+ _tag_seq = (
82
+ "c:date1904",
83
+ "c:lang",
84
+ "c:roundedCorners",
85
+ "c:style",
86
+ "c:clrMapOvr",
87
+ "c:pivotSource",
88
+ "c:protection",
89
+ "c:chart",
90
+ "c:spPr",
91
+ "c:txPr",
92
+ "c:externalData",
93
+ "c:printSettings",
94
+ "c:userShapes",
95
+ "c:extLst",
96
+ )
97
+ date1904 = ZeroOrOne("c:date1904", successors=_tag_seq[1:])
98
+ style = ZeroOrOne("c:style", successors=_tag_seq[4:])
99
+ chart = OneAndOnlyOne("c:chart")
100
+ txPr = ZeroOrOne("c:txPr", successors=_tag_seq[10:])
101
+ externalData = ZeroOrOne("c:externalData", successors=_tag_seq[11:])
102
+ del _tag_seq
103
+
104
+ @property
105
+ def catAx_lst(self):
106
+ return self.chart.plotArea.catAx_lst
107
+
108
+ @property
109
+ def date_1904(self):
110
+ """
111
+ Return |True| if the `c:date1904` child element resolves truthy,
112
+ |False| otherwise. This value indicates whether date number values
113
+ are based on the 1900 or 1904 epoch.
114
+ """
115
+ date1904 = self.date1904
116
+ if date1904 is None:
117
+ return False
118
+ return date1904.val
119
+
120
+ @property
121
+ def dateAx_lst(self):
122
+ return self.xpath("c:chart/c:plotArea/c:dateAx")
123
+
124
+ def get_or_add_title(self):
125
+ """Return the `c:title` grandchild, newly created if not present."""
126
+ return self.chart.get_or_add_title()
127
+
128
+ @property
129
+ def plotArea(self):
130
+ """
131
+ Return the required `c:chartSpace/c:chart/c:plotArea` grandchild
132
+ element.
133
+ """
134
+ return self.chart.plotArea
135
+
136
+ @property
137
+ def valAx_lst(self):
138
+ return self.chart.plotArea.valAx_lst
139
+
140
+ @property
141
+ def xlsx_part_rId(self):
142
+ """
143
+ The string in the required ``r:id`` attribute of the
144
+ `<c:externalData>` child, or |None| if no externalData element is
145
+ present.
146
+ """
147
+ externalData = self.externalData
148
+ if externalData is None:
149
+ return None
150
+ return externalData.rId
151
+
152
+ def _add_externalData(self):
153
+ """
154
+ Always add a ``<c:autoUpdate val="0"/>`` child so auto-updating
155
+ behavior is off by default.
156
+ """
157
+ externalData = self._new_externalData()
158
+ externalData._add_autoUpdate(val=False)
159
+ self._insert_externalData(externalData)
160
+ return externalData
161
+
162
+ def _new_txPr(self):
163
+ return CT_TextBody.new_txPr()
164
+
165
+
166
+ class CT_ExternalData(BaseOxmlElement):
167
+ """
168
+ `<c:externalData>` element, defining link to embedded Excel package part
169
+ containing the chart data.
170
+ """
171
+
172
+ autoUpdate = ZeroOrOne("c:autoUpdate")
173
+ rId = RequiredAttribute("r:id", XsdString)
174
+
175
+
176
+ class CT_PlotArea(BaseOxmlElement):
177
+ """
178
+ ``<c:plotArea>`` element.
179
+ """
180
+
181
+ catAx = ZeroOrMore("c:catAx")
182
+ valAx = ZeroOrMore("c:valAx")
183
+
184
+ def iter_sers(self):
185
+ """
186
+ Generate each of the `c:ser` elements in this chart, ordered first by
187
+ the document order of the containing xChart element, then by their
188
+ ordering within the xChart element (not necessarily document order).
189
+ """
190
+ for xChart in self.iter_xCharts():
191
+ for ser in xChart.iter_sers():
192
+ yield ser
193
+
194
+ def iter_xCharts(self):
195
+ """
196
+ Generate each xChart child element in document.
197
+ """
198
+ plot_tags = (
199
+ qn("c:area3DChart"),
200
+ qn("c:areaChart"),
201
+ qn("c:bar3DChart"),
202
+ qn("c:barChart"),
203
+ qn("c:bubbleChart"),
204
+ qn("c:doughnutChart"),
205
+ qn("c:line3DChart"),
206
+ qn("c:lineChart"),
207
+ qn("c:ofPieChart"),
208
+ qn("c:pie3DChart"),
209
+ qn("c:pieChart"),
210
+ qn("c:radarChart"),
211
+ qn("c:scatterChart"),
212
+ qn("c:stockChart"),
213
+ qn("c:surface3DChart"),
214
+ qn("c:surfaceChart"),
215
+ )
216
+
217
+ for child in self.iterchildren():
218
+ if child.tag not in plot_tags:
219
+ continue
220
+ yield child
221
+
222
+ @property
223
+ def last_ser(self):
224
+ """
225
+ Return the last `<c:ser>` element in the last xChart element, based
226
+ on series order (not necessarily the same element as document order).
227
+ """
228
+ last_xChart = self.xCharts[-1]
229
+ sers = last_xChart.sers
230
+ if not sers:
231
+ return None
232
+ return sers[-1]
233
+
234
+ @property
235
+ def next_idx(self):
236
+ """
237
+ Return the next available `c:ser/c:idx` value within the scope of
238
+ this chart, the maximum idx value found on existing series,
239
+ incremented by one.
240
+ """
241
+ idx_vals = [s.idx.val for s in self.sers]
242
+ if not idx_vals:
243
+ return 0
244
+ return max(idx_vals) + 1
245
+
246
+ @property
247
+ def next_order(self):
248
+ """
249
+ Return the next available `c:ser/c:order` value within the scope of
250
+ this chart, the maximum order value found on existing series,
251
+ incremented by one.
252
+ """
253
+ order_vals = [s.order.val for s in self.sers]
254
+ if not order_vals:
255
+ return 0
256
+ return max(order_vals) + 1
257
+
258
+ @property
259
+ def sers(self):
260
+ """
261
+ Return a sequence containing all the `c:ser` elements in this chart,
262
+ ordered first by the document order of the containing xChart element,
263
+ then by their ordering within the xChart element (not necessarily
264
+ document order).
265
+ """
266
+ return tuple(self.iter_sers())
267
+
268
+ @property
269
+ def xCharts(self):
270
+ """
271
+ Return a sequence containing all the `c:{x}Chart` elements in this
272
+ chart, in document order.
273
+ """
274
+ return tuple(self.iter_xCharts())
275
+
276
+
277
+ class CT_Style(BaseOxmlElement):
278
+ """
279
+ ``<c:style>`` element; defines the chart style.
280
+ """
281
+
282
+ val = RequiredAttribute("val", ST_Style)