The data label associated with an individual data point.
| 141 | |
| 142 | |
| 143 | class DataLabel(object): |
| 144 | """ |
| 145 | The data label associated with an individual data point. |
| 146 | """ |
| 147 | |
| 148 | def __init__(self, ser, idx): |
| 149 | super(DataLabel, self).__init__() |
| 150 | self._ser = self._element = ser |
| 151 | self._idx = idx |
| 152 | |
| 153 | @lazyproperty |
| 154 | def font(self): |
| 155 | """The |Font| object providing text formatting for this data label. |
| 156 | |
| 157 | This font object is used to customize the appearance of automatically |
| 158 | inserted text, such as the data point value. The font applies to the |
| 159 | entire data label. More granular control of the appearance of custom |
| 160 | data label text is controlled by a font object on runs in the text |
| 161 | frame. |
| 162 | """ |
| 163 | txPr = self._get_or_add_txPr() |
| 164 | text_frame = TextFrame(txPr, self) |
| 165 | paragraph = text_frame.paragraphs[0] |
| 166 | return paragraph.font |
| 167 | |
| 168 | @property |
| 169 | def has_text_frame(self): |
| 170 | """ |
| 171 | Return |True| if this data label has a text frame (implying it has |
| 172 | custom data label text), and |False| otherwise. Assigning |True| |
| 173 | causes a text frame to be added if not already present. Assigning |
| 174 | |False| causes any existing text frame to be removed along with any |
| 175 | text contained in the text frame. |
| 176 | """ |
| 177 | dLbl = self._dLbl |
| 178 | if dLbl is None: |
| 179 | return False |
| 180 | if dLbl.xpath("c:tx/c:rich"): |
| 181 | return True |
| 182 | return False |
| 183 | |
| 184 | @has_text_frame.setter |
| 185 | def has_text_frame(self, value): |
| 186 | if bool(value) is True: |
| 187 | self._get_or_add_tx_rich() |
| 188 | else: |
| 189 | self._remove_tx_rich() |
| 190 | |
| 191 | @property |
| 192 | def position(self): |
| 193 | """ |
| 194 | Read/write :ref:`XlDataLabelPosition` member specifying the position |
| 195 | of this data label with respect to its data point, or |None| if no |
| 196 | position is specified. Assigning |None| causes PowerPoint to choose |
| 197 | the default position, which varies by chart type. |
| 198 | """ |
| 199 | dLbl = self._dLbl |
| 200 | if dLbl is None: |
no outgoing calls
searching dependent graphs…