A distinct plot that appears in the plot area of a chart. A chart may have more than one plot, in which case they appear as superimposed layers, such as a line plot appearing on top of a bar chart.
| 16 | |
| 17 | |
| 18 | class _BasePlot(object): |
| 19 | """ |
| 20 | A distinct plot that appears in the plot area of a chart. A chart may |
| 21 | have more than one plot, in which case they appear as superimposed |
| 22 | layers, such as a line plot appearing on top of a bar chart. |
| 23 | """ |
| 24 | |
| 25 | def __init__(self, xChart, chart): |
| 26 | super(_BasePlot, self).__init__() |
| 27 | self._element = xChart |
| 28 | self._chart = chart |
| 29 | |
| 30 | @lazyproperty |
| 31 | def categories(self): |
| 32 | """ |
| 33 | Returns a |category.Categories| sequence object containing |
| 34 | a |category.Category| object for each of the category labels |
| 35 | associated with this plot. The |category.Category| class derives from |
| 36 | ``str``, so the returned value can be treated as a simple sequence of |
| 37 | strings for the common case where all you need is the labels in the |
| 38 | order they appear on the chart. |category.Categories| provides |
| 39 | additional properties for dealing with hierarchical categories when |
| 40 | required. |
| 41 | """ |
| 42 | return Categories(self._element) |
| 43 | |
| 44 | @property |
| 45 | def chart(self): |
| 46 | """ |
| 47 | The |Chart| object containing this plot. |
| 48 | """ |
| 49 | return self._chart |
| 50 | |
| 51 | @property |
| 52 | def data_labels(self): |
| 53 | """ |
| 54 | |DataLabels| instance providing properties and methods on the |
| 55 | collection of data labels associated with this plot. |
| 56 | """ |
| 57 | dLbls = self._element.dLbls |
| 58 | if dLbls is None: |
| 59 | raise ValueError("plot has no data labels, set has_data_labels = True first") |
| 60 | return DataLabels(dLbls) |
| 61 | |
| 62 | @property |
| 63 | def has_data_labels(self): |
| 64 | """ |
| 65 | Read/write boolean, |True| if the series has data labels. Assigning |
| 66 | |True| causes data labels to be added to the plot. Assigning False |
| 67 | removes any existing data labels. |
| 68 | """ |
| 69 | return self._element.dLbls is not None |
| 70 | |
| 71 | @has_data_labels.setter |
| 72 | def has_data_labels(self, value): |
| 73 | """ |
| 74 | Add, remove, or leave alone the ``<c:dLbls>`` child element depending |
| 75 | on current state and assigned *value*. If *value* is |True| and no |
no outgoing calls
searching dependent graphs…