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

Class _BaseAxis

src/pptx/chart/axis.py:19–242  ·  view source on GitHub ↗

Base class for chart axis objects. All axis objects share these properties.

Source from the content-addressed store, hash-verified

17
18
19class _BaseAxis(object):
20 """Base class for chart axis objects. All axis objects share these properties."""
21
22 def __init__(self, xAx):
23 super(_BaseAxis, self).__init__()
24 self._element = xAx # axis element, c:catAx or c:valAx
25 self._xAx = xAx
26
27 @property
28 def axis_title(self):
29 """An |AxisTitle| object providing access to title properties.
30
31 Calling this property is destructive in the sense that it adds an
32 axis title element (`c:title`) to the axis XML if one is not already
33 present. Use :attr:`has_title` to test for presence of axis title
34 non-destructively.
35 """
36 return AxisTitle(self._element.get_or_add_title())
37
38 @lazyproperty
39 def format(self):
40 """
41 The |ChartFormat| object providing access to the shape formatting
42 properties of this axis, such as its line color and fill.
43 """
44 return ChartFormat(self._element)
45
46 @property
47 def has_major_gridlines(self):
48 """
49 Read/write boolean value specifying whether this axis has gridlines
50 at its major tick mark locations. Assigning |True| to this property
51 causes major gridlines to be displayed. Assigning |False| causes them
52 to be removed.
53 """
54 if self._element.majorGridlines is None:
55 return False
56 return True
57
58 @has_major_gridlines.setter
59 def has_major_gridlines(self, value):
60 if bool(value) is True:
61 self._element.get_or_add_majorGridlines()
62 else:
63 self._element._remove_majorGridlines()
64
65 @property
66 def has_minor_gridlines(self):
67 """
68 Read/write boolean value specifying whether this axis has gridlines
69 at its minor tick mark locations. Assigning |True| to this property
70 causes minor gridlines to be displayed. Assigning |False| causes them
71 to be removed.
72 """
73 if self._element.minorGridlines is None:
74 return False
75 return True
76

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…