MCPcopy Create free account
hub / github.com/scanny/python-pptx / pt_xml

Method pt_xml

src/pptx/chart/xmlwriter.py:134–155  ·  view source on GitHub ↗

Return the `` `` and sequence of `` `` elements corresponding to *values* as a single unicode text string. `c:ptCount` refers to the number of `c:pt` elements in this sequence. The `idx` attribute value for `c:pt` elements locates the data point

(self, values)

Source from the content-addressed store, hash-verified

132 ).format(**{"wksht_ref": wksht_ref, "number_format": number_format, "pt_xml": pt_xml})
133
134 def pt_xml(self, values):
135 """
136 Return the ``<c:ptCount>`` and sequence of ``<c:pt>`` elements
137 corresponding to *values* as a single unicode text string.
138 `c:ptCount` refers to the number of `c:pt` elements in this sequence.
139 The `idx` attribute value for `c:pt` elements locates the data point
140 in the overall data point sequence of the chart and is started at
141 *offset*.
142 """
143 xml = (' <c:ptCount val="{pt_count}"/>\n').format(pt_count=len(values))
144
145 pt_tmpl = (
146 ' <c:pt idx="{idx}">\n'
147 " <c:v>{value}</c:v>\n"
148 " </c:pt>\n"
149 )
150 for idx, value in enumerate(values):
151 if value is None:
152 continue
153 xml += pt_tmpl.format(idx=idx, value=value)
154
155 return xml
156
157 @property
158 def tx(self):

Callers 1

numRef_xmlMethod · 0.95

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected