python-pptx2 2.13.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.
- pptx2/__init__.py +152 -0
- pptx2/_color.py +75 -0
- pptx2/_slide_importer.py +597 -0
- pptx2/_svg.py +155 -0
- pptx2/_template_applier.py +292 -0
- pptx2/_textstyle.py +187 -0
- pptx2/accessibility.py +365 -0
- pptx2/action.py +270 -0
- pptx2/animation.py +2237 -0
- pptx2/api.py +49 -0
- pptx2/audit.py +258 -0
- pptx2/chart/__init__.py +0 -0
- pptx2/chart/analytics.py +381 -0
- pptx2/chart/axis.py +543 -0
- pptx2/chart/category.py +200 -0
- pptx2/chart/chart.py +670 -0
- pptx2/chart/data.py +864 -0
- pptx2/chart/datalabel.py +406 -0
- pptx2/chart/legend.py +86 -0
- pptx2/chart/marker.py +70 -0
- pptx2/chart/palettes.py +129 -0
- pptx2/chart/plot.py +462 -0
- pptx2/chart/point.py +101 -0
- pptx2/chart/quick_layouts.py +325 -0
- pptx2/chart/series.py +334 -0
- pptx2/chart/xlsx.py +272 -0
- pptx2/chart/xmlwriter.py +1845 -0
- pptx2/compose/__init__.py +28 -0
- pptx2/compose/from_spec.py +1094 -0
- pptx2/design/__init__.py +8 -0
- pptx2/design/components.py +607 -0
- pptx2/design/figures.py +389 -0
- pptx2/design/layout.py +370 -0
- pptx2/design/recipes.py +1967 -0
- pptx2/design/style.py +209 -0
- pptx2/design/tokens.py +915 -0
- pptx2/diagrams.py +754 -0
- pptx2/dml/__init__.py +0 -0
- pptx2/dml/chtfmt.py +40 -0
- pptx2/dml/color.py +496 -0
- pptx2/dml/effect.py +909 -0
- pptx2/dml/fill.py +691 -0
- pptx2/dml/line.py +287 -0
- pptx2/dml/picture.py +212 -0
- pptx2/dml/three_d.py +381 -0
- pptx2/enum/__init__.py +0 -0
- pptx2/enum/action.py +71 -0
- pptx2/enum/animation.py +31 -0
- pptx2/enum/base.py +218 -0
- pptx2/enum/chart.py +574 -0
- pptx2/enum/dml.py +740 -0
- pptx2/enum/lang.py +685 -0
- pptx2/enum/presentation.py +133 -0
- pptx2/enum/shapes.py +1029 -0
- pptx2/enum/text.py +230 -0
- pptx2/exc.py +42 -0
- pptx2/formats.py +139 -0
- pptx2/geometry.py +420 -0
- pptx2/inherit.py +109 -0
- pptx2/lint.py +2256 -0
- pptx2/math.py +177 -0
- pptx2/media.py +197 -0
- pptx2/opc/__init__.py +0 -0
- pptx2/opc/constants.py +332 -0
- pptx2/opc/oxml.py +188 -0
- pptx2/opc/package.py +762 -0
- pptx2/opc/packuri.py +109 -0
- pptx2/opc/serialized.py +296 -0
- pptx2/opc/shared.py +20 -0
- pptx2/opc/spec.py +45 -0
- pptx2/oxml/__init__.py +555 -0
- pptx2/oxml/action.py +53 -0
- pptx2/oxml/chart/__init__.py +0 -0
- pptx2/oxml/chart/axis.py +337 -0
- pptx2/oxml/chart/chart.py +481 -0
- pptx2/oxml/chart/datalabel.py +253 -0
- pptx2/oxml/chart/legend.py +72 -0
- pptx2/oxml/chart/marker.py +61 -0
- pptx2/oxml/chart/plot.py +365 -0
- pptx2/oxml/chart/series.py +425 -0
- pptx2/oxml/chart/shared.py +220 -0
- pptx2/oxml/coreprops.py +288 -0
- pptx2/oxml/dml/__init__.py +0 -0
- pptx2/oxml/dml/color.py +135 -0
- pptx2/oxml/dml/effect.py +213 -0
- pptx2/oxml/dml/fill.py +316 -0
- pptx2/oxml/dml/line.py +12 -0
- pptx2/oxml/dml/three_d.py +110 -0
- pptx2/oxml/ns.py +135 -0
- pptx2/oxml/presentation.py +313 -0
- pptx2/oxml/shapes/__init__.py +19 -0
- pptx2/oxml/shapes/autoshape.py +467 -0
- pptx2/oxml/shapes/connector.py +107 -0
- pptx2/oxml/shapes/graphfrm.py +347 -0
- pptx2/oxml/shapes/groupshape.py +329 -0
- pptx2/oxml/shapes/picture.py +270 -0
- pptx2/oxml/shapes/shared.py +577 -0
- pptx2/oxml/simpletypes.py +1027 -0
- pptx2/oxml/slide.py +563 -0
- pptx2/oxml/table.py +650 -0
- pptx2/oxml/text.py +815 -0
- pptx2/oxml/theme.py +36 -0
- pptx2/oxml/xmlchemy.py +717 -0
- pptx2/package.py +222 -0
- pptx2/parts/__init__.py +0 -0
- pptx2/parts/chart.py +95 -0
- pptx2/parts/coreprops.py +167 -0
- pptx2/parts/diagram.py +37 -0
- pptx2/parts/embeddedpackage.py +93 -0
- pptx2/parts/image.py +275 -0
- pptx2/parts/media.py +37 -0
- pptx2/parts/presentation.py +136 -0
- pptx2/parts/slide.py +371 -0
- pptx2/presentation.py +408 -0
- pptx2/py.typed +0 -0
- pptx2/render.py +586 -0
- pptx2/section.py +272 -0
- pptx2/shapes/__init__.py +26 -0
- pptx2/shapes/autoshape.py +442 -0
- pptx2/shapes/base.py +1078 -0
- pptx2/shapes/connector.py +297 -0
- pptx2/shapes/freeform.py +337 -0
- pptx2/shapes/graphfrm.py +316 -0
- pptx2/shapes/group.py +264 -0
- pptx2/shapes/picture.py +422 -0
- pptx2/shapes/placeholder.py +468 -0
- pptx2/shapes/shapetree.py +2027 -0
- pptx2/shared.py +82 -0
- pptx2/skill/SKILL.md +450 -0
- pptx2/skill/__init__.py +78 -0
- pptx2/skill/__main__.py +64 -0
- pptx2/skill/references/animations.md +189 -0
- pptx2/skill/references/basics.md +421 -0
- pptx2/skill/references/charts.md +254 -0
- pptx2/skill/references/compose.md +234 -0
- pptx2/skill/references/design.md +366 -0
- pptx2/skill/references/effects.md +249 -0
- pptx2/skill/references/end-to-end-deck.md +231 -0
- pptx2/skill/references/geometry-and-arrows.md +334 -0
- pptx2/skill/references/lint.md +275 -0
- pptx2/skill/references/math.md +86 -0
- pptx2/skill/references/picture-effects.md +129 -0
- pptx2/skill/references/render.md +151 -0
- pptx2/skill/references/smart-art.md +75 -0
- pptx2/skill/references/space-aware-authoring.md +249 -0
- pptx2/skill/references/tables.md +244 -0
- pptx2/skill/references/theme.md +127 -0
- pptx2/skill/references/three-d.md +109 -0
- pptx2/skill/references/transitions.md +100 -0
- pptx2/slide.py +1244 -0
- pptx2/smart_art.py +220 -0
- pptx2/spec.py +633 -0
- pptx2/table.py +1181 -0
- pptx2/table_styles.py +184 -0
- pptx2/templates/default.pptx +0 -0
- pptx2/templates/docx-icon.emf +0 -0
- pptx2/templates/generic-icon.emf +0 -0
- pptx2/templates/notes.xml +23 -0
- pptx2/templates/notesMaster.xml +352 -0
- pptx2/templates/pptx-icon.emf +0 -0
- pptx2/templates/theme.xml +321 -0
- pptx2/templates/xlsx-icon.emf +0 -0
- pptx2/text/__init__.py +0 -0
- pptx2/text/fonts.py +482 -0
- pptx2/text/layout.py +374 -0
- pptx2/text/text.py +1272 -0
- pptx2/theme.py +721 -0
- pptx2/types.py +36 -0
- pptx2/util.py +263 -0
- python_pptx2-2.13.0.dist-info/METADATA +351 -0
- python_pptx2-2.13.0.dist-info/RECORD +175 -0
- python_pptx2-2.13.0.dist-info/WHEEL +5 -0
- python_pptx2-2.13.0.dist-info/entry_points.txt +3 -0
- python_pptx2-2.13.0.dist-info/licenses/LICENSE +22 -0
- python_pptx2-2.13.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"""Chart data-label related oxml objects."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pptx2.enum.chart import XL_DATA_LABEL_POSITION
|
|
6
|
+
from pptx2.oxml import parse_xml
|
|
7
|
+
from pptx2.oxml.ns import nsdecls
|
|
8
|
+
from pptx2.oxml.text import CT_TextBody
|
|
9
|
+
from pptx2.oxml.xmlchemy import (
|
|
10
|
+
BaseOxmlElement,
|
|
11
|
+
OneAndOnlyOne,
|
|
12
|
+
RequiredAttribute,
|
|
13
|
+
ZeroOrMore,
|
|
14
|
+
ZeroOrOne,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CT_DLbl(BaseOxmlElement):
|
|
19
|
+
"""
|
|
20
|
+
``<c:dLbl>`` element specifying the properties of the data label for an
|
|
21
|
+
individual data point.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
_tag_seq = (
|
|
25
|
+
"c:idx",
|
|
26
|
+
"c:layout",
|
|
27
|
+
"c:tx",
|
|
28
|
+
"c:numFmt",
|
|
29
|
+
"c:spPr",
|
|
30
|
+
"c:txPr",
|
|
31
|
+
"c:dLblPos",
|
|
32
|
+
"c:showLegendKey",
|
|
33
|
+
"c:showVal",
|
|
34
|
+
"c:showCatName",
|
|
35
|
+
"c:showSerName",
|
|
36
|
+
"c:showPercent",
|
|
37
|
+
"c:showBubbleSize",
|
|
38
|
+
"c:separator",
|
|
39
|
+
"c:extLst",
|
|
40
|
+
)
|
|
41
|
+
idx = OneAndOnlyOne("c:idx")
|
|
42
|
+
tx = ZeroOrOne("c:tx", successors=_tag_seq[3:])
|
|
43
|
+
spPr = ZeroOrOne("c:spPr", successors=_tag_seq[5:])
|
|
44
|
+
txPr = ZeroOrOne("c:txPr", successors=_tag_seq[6:])
|
|
45
|
+
dLblPos = ZeroOrOne("c:dLblPos", successors=_tag_seq[7:])
|
|
46
|
+
del _tag_seq
|
|
47
|
+
|
|
48
|
+
def get_or_add_rich(self):
|
|
49
|
+
"""
|
|
50
|
+
Return the `c:rich` descendant representing the text frame of the
|
|
51
|
+
data label, newly created if not present. Any existing `c:strRef`
|
|
52
|
+
element is removed along with its contents.
|
|
53
|
+
"""
|
|
54
|
+
tx = self.get_or_add_tx()
|
|
55
|
+
tx._remove_strRef()
|
|
56
|
+
return tx.get_or_add_rich()
|
|
57
|
+
|
|
58
|
+
def get_or_add_tx_rich(self):
|
|
59
|
+
"""
|
|
60
|
+
Return the `c:tx[c:rich]` subtree, newly created if not present.
|
|
61
|
+
"""
|
|
62
|
+
tx = self.get_or_add_tx()
|
|
63
|
+
tx._remove_strRef()
|
|
64
|
+
tx.get_or_add_rich()
|
|
65
|
+
return tx
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def idx_val(self):
|
|
69
|
+
"""
|
|
70
|
+
The integer value of the `val` attribute on the required `c:idx`
|
|
71
|
+
child.
|
|
72
|
+
"""
|
|
73
|
+
return self.idx.val
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def new_dLbl(cls):
|
|
77
|
+
"""Return a newly created "loose" `c:dLbl` element.
|
|
78
|
+
|
|
79
|
+
The `c:dLbl` element contains the same (fairly extensive) default
|
|
80
|
+
subtree added by PowerPoint when an individual data label is
|
|
81
|
+
customized in the UI. Note that the idx value must be set by the
|
|
82
|
+
client. Failure to set the idx value will likely result in any
|
|
83
|
+
changes not being visible and may result in a repair error on open.
|
|
84
|
+
"""
|
|
85
|
+
return parse_xml(
|
|
86
|
+
"<c:dLbl %s>\n"
|
|
87
|
+
' <c:idx val="666"/>\n'
|
|
88
|
+
" <c:spPr/>\n"
|
|
89
|
+
" <c:txPr>\n"
|
|
90
|
+
" <a:bodyPr/>\n"
|
|
91
|
+
" <a:lstStyle/>\n"
|
|
92
|
+
" <a:p>\n"
|
|
93
|
+
" <a:pPr>\n"
|
|
94
|
+
" <a:defRPr/>\n"
|
|
95
|
+
" </a:pPr>\n"
|
|
96
|
+
' <a:endParaRPr lang="en-US"/>\n'
|
|
97
|
+
" </a:p>\n"
|
|
98
|
+
" </c:txPr>\n"
|
|
99
|
+
' <c:showLegendKey val="0"/>\n'
|
|
100
|
+
' <c:showVal val="1"/>\n'
|
|
101
|
+
' <c:showCatName val="0"/>\n'
|
|
102
|
+
' <c:showSerName val="0"/>\n'
|
|
103
|
+
' <c:showPercent val="0"/>\n'
|
|
104
|
+
' <c:showBubbleSize val="0"/>\n'
|
|
105
|
+
"</c:dLbl>" % nsdecls("c", "a")
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
def remove_tx_rich(self):
|
|
109
|
+
"""
|
|
110
|
+
Remove any `c:tx[c:rich]` child, or do nothing if not present.
|
|
111
|
+
"""
|
|
112
|
+
matches = self.xpath("c:tx[c:rich]")
|
|
113
|
+
if not matches:
|
|
114
|
+
return
|
|
115
|
+
tx = matches[0]
|
|
116
|
+
self.remove(tx)
|
|
117
|
+
|
|
118
|
+
def _new_txPr(self):
|
|
119
|
+
return CT_TextBody.new_txPr()
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class CT_DLblPos(BaseOxmlElement):
|
|
123
|
+
"""
|
|
124
|
+
``<c:dLblPos>`` element specifying the positioning of a data label with
|
|
125
|
+
respect to its data point.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
val = RequiredAttribute("val", XL_DATA_LABEL_POSITION)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class CT_DLbls(BaseOxmlElement):
|
|
132
|
+
"""`c:dLbls` element specifying properties for a set of data labels."""
|
|
133
|
+
|
|
134
|
+
_tag_seq = (
|
|
135
|
+
"c:dLbl",
|
|
136
|
+
"c:numFmt",
|
|
137
|
+
"c:spPr",
|
|
138
|
+
"c:txPr",
|
|
139
|
+
"c:dLblPos",
|
|
140
|
+
"c:showLegendKey",
|
|
141
|
+
"c:showVal",
|
|
142
|
+
"c:showCatName",
|
|
143
|
+
"c:showSerName",
|
|
144
|
+
"c:showPercent",
|
|
145
|
+
"c:showBubbleSize",
|
|
146
|
+
"c:separator",
|
|
147
|
+
"c:showLeaderLines",
|
|
148
|
+
"c:leaderLines",
|
|
149
|
+
"c:extLst",
|
|
150
|
+
)
|
|
151
|
+
dLbl = ZeroOrMore("c:dLbl", successors=_tag_seq[1:])
|
|
152
|
+
numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[2:])
|
|
153
|
+
txPr = ZeroOrOne("c:txPr", successors=_tag_seq[4:])
|
|
154
|
+
dLblPos = ZeroOrOne("c:dLblPos", successors=_tag_seq[5:])
|
|
155
|
+
showLegendKey = ZeroOrOne("c:showLegendKey", successors=_tag_seq[6:])
|
|
156
|
+
showVal = ZeroOrOne("c:showVal", successors=_tag_seq[7:])
|
|
157
|
+
showCatName = ZeroOrOne("c:showCatName", successors=_tag_seq[8:])
|
|
158
|
+
showSerName = ZeroOrOne("c:showSerName", successors=_tag_seq[9:])
|
|
159
|
+
showPercent = ZeroOrOne("c:showPercent", successors=_tag_seq[10:])
|
|
160
|
+
del _tag_seq
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def defRPr(self):
|
|
164
|
+
"""
|
|
165
|
+
``<a:defRPr>`` great-great-grandchild element, added with its
|
|
166
|
+
ancestors if not present.
|
|
167
|
+
"""
|
|
168
|
+
txPr = self.get_or_add_txPr()
|
|
169
|
+
defRPr = txPr.defRPr
|
|
170
|
+
return defRPr
|
|
171
|
+
|
|
172
|
+
def get_dLbl_for_point(self, idx):
|
|
173
|
+
"""
|
|
174
|
+
Return the `c:dLbl` child representing the label for the data point
|
|
175
|
+
at index *idx*.
|
|
176
|
+
"""
|
|
177
|
+
matches = self.xpath('c:dLbl[c:idx[@val="%d"]]' % idx)
|
|
178
|
+
if matches:
|
|
179
|
+
return matches[0]
|
|
180
|
+
return None
|
|
181
|
+
|
|
182
|
+
def get_or_add_dLbl_for_point(self, idx):
|
|
183
|
+
"""
|
|
184
|
+
Return the `c:dLbl` element representing the label of the point at
|
|
185
|
+
index *idx*.
|
|
186
|
+
"""
|
|
187
|
+
matches = self.xpath('c:dLbl[c:idx[@val="%d"]]' % idx)
|
|
188
|
+
if matches:
|
|
189
|
+
return matches[0]
|
|
190
|
+
return self._insert_dLbl_in_sequence(idx)
|
|
191
|
+
|
|
192
|
+
@classmethod
|
|
193
|
+
def new_dLbls(cls):
|
|
194
|
+
"""Return a newly created "loose" `c:dLbls` element."""
|
|
195
|
+
return parse_xml(
|
|
196
|
+
"<c:dLbls %s>\n"
|
|
197
|
+
' <c:showLegendKey val="0"/>\n'
|
|
198
|
+
' <c:showVal val="0"/>\n'
|
|
199
|
+
' <c:showCatName val="0"/>\n'
|
|
200
|
+
' <c:showSerName val="0"/>\n'
|
|
201
|
+
' <c:showPercent val="0"/>\n'
|
|
202
|
+
' <c:showBubbleSize val="0"/>\n'
|
|
203
|
+
' <c:showLeaderLines val="1"/>\n'
|
|
204
|
+
"</c:dLbls>" % nsdecls("c")
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
def _insert_dLbl_in_sequence(self, idx):
|
|
208
|
+
"""
|
|
209
|
+
Return a newly created `c:dLbl` element having `c:idx` child of *idx*
|
|
210
|
+
and inserted in numeric sequence among the `c:dLbl` children of this
|
|
211
|
+
element.
|
|
212
|
+
"""
|
|
213
|
+
new_dLbl = self._new_dLbl()
|
|
214
|
+
new_dLbl.idx.val = idx
|
|
215
|
+
|
|
216
|
+
dLbl = None
|
|
217
|
+
for dLbl in self.dLbl_lst:
|
|
218
|
+
if dLbl.idx_val > idx:
|
|
219
|
+
dLbl.addprevious(new_dLbl)
|
|
220
|
+
return new_dLbl
|
|
221
|
+
if dLbl is not None:
|
|
222
|
+
dLbl.addnext(new_dLbl)
|
|
223
|
+
else:
|
|
224
|
+
self.insert(0, new_dLbl)
|
|
225
|
+
return new_dLbl
|
|
226
|
+
|
|
227
|
+
def _new_dLbl(self):
|
|
228
|
+
return CT_DLbl.new_dLbl()
|
|
229
|
+
|
|
230
|
+
def _new_showCatName(self):
|
|
231
|
+
"""Return a new `c:showCatName` with value initialized.
|
|
232
|
+
|
|
233
|
+
This method is called by the metaclass-generated code whenever a new
|
|
234
|
+
`c:showCatName` element is required. In this case, it defaults to
|
|
235
|
+
`val=true`, which is not what we need so we override to make val
|
|
236
|
+
explicitly False.
|
|
237
|
+
"""
|
|
238
|
+
return parse_xml('<c:showCatName %s val="0"/>' % nsdecls("c"))
|
|
239
|
+
|
|
240
|
+
def _new_showLegendKey(self):
|
|
241
|
+
return parse_xml('<c:showLegendKey %s val="0"/>' % nsdecls("c"))
|
|
242
|
+
|
|
243
|
+
def _new_showPercent(self):
|
|
244
|
+
return parse_xml('<c:showPercent %s val="0"/>' % nsdecls("c"))
|
|
245
|
+
|
|
246
|
+
def _new_showSerName(self):
|
|
247
|
+
return parse_xml('<c:showSerName %s val="0"/>' % nsdecls("c"))
|
|
248
|
+
|
|
249
|
+
def _new_showVal(self):
|
|
250
|
+
return parse_xml('<c:showVal %s val="0"/>' % nsdecls("c"))
|
|
251
|
+
|
|
252
|
+
def _new_txPr(self):
|
|
253
|
+
return CT_TextBody.new_txPr()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""lxml custom element classes for legend-related XML elements."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pptx2.enum.chart import XL_LEGEND_POSITION
|
|
6
|
+
from pptx2.oxml.text import CT_TextBody
|
|
7
|
+
from pptx2.oxml.xmlchemy import BaseOxmlElement, OptionalAttribute, ZeroOrOne
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CT_Legend(BaseOxmlElement):
|
|
11
|
+
"""
|
|
12
|
+
``<c:legend>`` custom element class
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
_tag_seq = (
|
|
16
|
+
"c:legendPos",
|
|
17
|
+
"c:legendEntry",
|
|
18
|
+
"c:layout",
|
|
19
|
+
"c:overlay",
|
|
20
|
+
"c:spPr",
|
|
21
|
+
"c:txPr",
|
|
22
|
+
"c:extLst",
|
|
23
|
+
)
|
|
24
|
+
legendPos = ZeroOrOne("c:legendPos", successors=_tag_seq[1:])
|
|
25
|
+
layout = ZeroOrOne("c:layout", successors=_tag_seq[3:])
|
|
26
|
+
overlay = ZeroOrOne("c:overlay", successors=_tag_seq[4:])
|
|
27
|
+
txPr = ZeroOrOne("c:txPr", successors=_tag_seq[6:])
|
|
28
|
+
del _tag_seq
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def defRPr(self):
|
|
32
|
+
"""
|
|
33
|
+
`./c:txPr/a:p/a:pPr/a:defRPr` great-great-grandchild element, added
|
|
34
|
+
with its ancestors if not present.
|
|
35
|
+
"""
|
|
36
|
+
txPr = self.get_or_add_txPr()
|
|
37
|
+
defRPr = txPr.defRPr
|
|
38
|
+
return defRPr
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def horz_offset(self):
|
|
42
|
+
"""
|
|
43
|
+
The float value in ./c:layout/c:manualLayout/c:x when
|
|
44
|
+
./c:layout/c:manualLayout/c:xMode@val == "factor". 0.0 if that
|
|
45
|
+
XPath expression has no match.
|
|
46
|
+
"""
|
|
47
|
+
layout = self.layout
|
|
48
|
+
if layout is None:
|
|
49
|
+
return 0.0
|
|
50
|
+
return layout.horz_offset
|
|
51
|
+
|
|
52
|
+
@horz_offset.setter
|
|
53
|
+
def horz_offset(self, offset):
|
|
54
|
+
"""
|
|
55
|
+
Set the value of ./c:layout/c:manualLayout/c:x@val to *offset* and
|
|
56
|
+
./c:layout/c:manualLayout/c:xMode@val to "factor". Remove
|
|
57
|
+
./c:layout/c:manualLayout if *offset* == 0.
|
|
58
|
+
"""
|
|
59
|
+
layout = self.get_or_add_layout()
|
|
60
|
+
layout.horz_offset = offset
|
|
61
|
+
|
|
62
|
+
def _new_txPr(self):
|
|
63
|
+
return CT_TextBody.new_txPr()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class CT_LegendPos(BaseOxmlElement):
|
|
67
|
+
"""
|
|
68
|
+
``<c:legendPos>`` element specifying position of legend with respect to
|
|
69
|
+
chart as a member of ST_LegendPos.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
val = OptionalAttribute("val", XL_LEGEND_POSITION, default=XL_LEGEND_POSITION.RIGHT)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Series-related oxml objects."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pptx2.enum.chart import XL_MARKER_STYLE
|
|
6
|
+
from pptx2.oxml.simpletypes import ST_MarkerSize
|
|
7
|
+
from pptx2.oxml.xmlchemy import BaseOxmlElement, RequiredAttribute, ZeroOrOne
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CT_Marker(BaseOxmlElement):
|
|
11
|
+
"""
|
|
12
|
+
`c:marker` custom element class, containing visual properties for a data
|
|
13
|
+
point marker on line-type charts.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
_tag_seq = ("c:symbol", "c:size", "c:spPr", "c:extLst")
|
|
17
|
+
symbol = ZeroOrOne("c:symbol", successors=_tag_seq[1:])
|
|
18
|
+
size = ZeroOrOne("c:size", successors=_tag_seq[2:])
|
|
19
|
+
spPr = ZeroOrOne("c:spPr", successors=_tag_seq[3:])
|
|
20
|
+
del _tag_seq
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def size_val(self):
|
|
24
|
+
"""
|
|
25
|
+
Return the value of `./c:size/@val`, specifying the size of this
|
|
26
|
+
marker in points. Returns |None| if no `c:size` element is present or
|
|
27
|
+
its val attribute is not present.
|
|
28
|
+
"""
|
|
29
|
+
size = self.size
|
|
30
|
+
if size is None:
|
|
31
|
+
return None
|
|
32
|
+
return size.val
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def symbol_val(self):
|
|
36
|
+
"""
|
|
37
|
+
Return the value of `./c:symbol/@val`, specifying the shape of this
|
|
38
|
+
marker. Returns |None| if no `c:symbol` element is present.
|
|
39
|
+
"""
|
|
40
|
+
symbol = self.symbol
|
|
41
|
+
if symbol is None:
|
|
42
|
+
return None
|
|
43
|
+
return symbol.val
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CT_MarkerSize(BaseOxmlElement):
|
|
47
|
+
"""
|
|
48
|
+
`c:size` custom element class, specifying the size (in points) of a data
|
|
49
|
+
point marker for a line, XY, or radar chart.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
val = RequiredAttribute("val", ST_MarkerSize)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class CT_MarkerStyle(BaseOxmlElement):
|
|
56
|
+
"""
|
|
57
|
+
`c:symbol` custom element class, specifying the shape of a data point
|
|
58
|
+
marker for a line, XY, or radar chart.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
val = RequiredAttribute("val", XL_MARKER_STYLE)
|