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

Class CT_DLbls

src/pptx/oxml/chart/datalabel.py:130–252  ·  view source on GitHub ↗

`c:dLbls` element specifying properties for a set of data labels.

Source from the content-addressed store, hash-verified

128
129
130class CT_DLbls(BaseOxmlElement):
131 """`c:dLbls` element specifying properties for a set of data labels."""
132
133 _tag_seq = (
134 "c:dLbl",
135 "c:numFmt",
136 "c:spPr",
137 "c:txPr",
138 "c:dLblPos",
139 "c:showLegendKey",
140 "c:showVal",
141 "c:showCatName",
142 "c:showSerName",
143 "c:showPercent",
144 "c:showBubbleSize",
145 "c:separator",
146 "c:showLeaderLines",
147 "c:leaderLines",
148 "c:extLst",
149 )
150 dLbl = ZeroOrMore("c:dLbl", successors=_tag_seq[1:])
151 numFmt = ZeroOrOne("c:numFmt", successors=_tag_seq[2:])
152 txPr = ZeroOrOne("c:txPr", successors=_tag_seq[4:])
153 dLblPos = ZeroOrOne("c:dLblPos", successors=_tag_seq[5:])
154 showLegendKey = ZeroOrOne("c:showLegendKey", successors=_tag_seq[6:])
155 showVal = ZeroOrOne("c:showVal", successors=_tag_seq[7:])
156 showCatName = ZeroOrOne("c:showCatName", successors=_tag_seq[8:])
157 showSerName = ZeroOrOne("c:showSerName", successors=_tag_seq[9:])
158 showPercent = ZeroOrOne("c:showPercent", successors=_tag_seq[10:])
159 del _tag_seq
160
161 @property
162 def defRPr(self):
163 """
164 ``<a:defRPr>`` great-great-grandchild element, added with its
165 ancestors if not present.
166 """
167 txPr = self.get_or_add_txPr()
168 defRPr = txPr.defRPr
169 return defRPr
170
171 def get_dLbl_for_point(self, idx):
172 """
173 Return the `c:dLbl` child representing the label for the data point
174 at index *idx*.
175 """
176 matches = self.xpath('c:dLbl[c:idx[@val="%d"]]' % idx)
177 if matches:
178 return matches[0]
179 return None
180
181 def get_or_add_dLbl_for_point(self, idx):
182 """
183 Return the `c:dLbl` element representing the label of the point at
184 index *idx*.
185 """
186 matches = self.xpath('c:dLbl[c:idx[@val="%d"]]' % idx)
187 if matches:

Callers

nothing calls this directly

Calls 2

ZeroOrMoreClass · 0.90
ZeroOrOneClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…