Provides access to properties of data labels for a plot or a series. This is not a collection and does not provide access to individual data labels. Access to individual labels is via the |Point| object. The properties this object provides control formatting of *all* the data labels
| 7 | |
| 8 | |
| 9 | class DataLabels(object): |
| 10 | """Provides access to properties of data labels for a plot or a series. |
| 11 | |
| 12 | This is not a collection and does not provide access to individual data |
| 13 | labels. Access to individual labels is via the |Point| object. The |
| 14 | properties this object provides control formatting of *all* the data |
| 15 | labels in its scope. |
| 16 | """ |
| 17 | |
| 18 | def __init__(self, dLbls): |
| 19 | super(DataLabels, self).__init__() |
| 20 | self._element = dLbls |
| 21 | |
| 22 | @lazyproperty |
| 23 | def font(self): |
| 24 | """ |
| 25 | The |Font| object that provides access to the text properties for |
| 26 | these data labels, such as bold, italic, etc. |
| 27 | """ |
| 28 | defRPr = self._element.defRPr |
| 29 | font = Font(defRPr) |
| 30 | return font |
| 31 | |
| 32 | @property |
| 33 | def number_format(self): |
| 34 | """ |
| 35 | Read/write string specifying the format for the numbers on this set |
| 36 | of data labels. Returns 'General' if no number format has been set. |
| 37 | Note that this format string has no effect on rendered data labels |
| 38 | when :meth:`number_format_is_linked` is |True|. Assigning a format |
| 39 | string to this property automatically sets |
| 40 | :meth:`number_format_is_linked` to |False|. |
| 41 | """ |
| 42 | numFmt = self._element.numFmt |
| 43 | if numFmt is None: |
| 44 | return "General" |
| 45 | return numFmt.formatCode |
| 46 | |
| 47 | @number_format.setter |
| 48 | def number_format(self, value): |
| 49 | self._element.get_or_add_numFmt().formatCode = value |
| 50 | self.number_format_is_linked = False |
| 51 | |
| 52 | @property |
| 53 | def number_format_is_linked(self): |
| 54 | """ |
| 55 | Read/write boolean specifying whether number formatting should be |
| 56 | taken from the source spreadsheet rather than the value of |
| 57 | :meth:`number_format`. |
| 58 | """ |
| 59 | numFmt = self._element.numFmt |
| 60 | if numFmt is None: |
| 61 | return True |
| 62 | souceLinked = numFmt.sourceLinked |
| 63 | if souceLinked is None: |
| 64 | return True |
| 65 | return numFmt.sourceLinked |
| 66 |
no outgoing calls
searching dependent graphs…