aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/pptx/dml/chtfmt.py
blob: c37e4844d12c9032268aaa50bca47dca6f1ab8fc (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""|ChartFormat| and related objects.

|ChartFormat| acts as proxy for the `spPr` element, which provides visual shape properties such as
line and fill for chart elements.
"""

from __future__ import annotations

from pptx.dml.fill import FillFormat
from pptx.dml.line import LineFormat
from pptx.shared import ElementProxy
from pptx.util import lazyproperty


class ChartFormat(ElementProxy):
    """
    The |ChartFormat| object provides access to visual shape properties for
    chart elements like |Axis|, |Series|, and |MajorGridlines|. It has two
    properties, :attr:`fill` and :attr:`line`, which return a |FillFormat|
    and |LineFormat| object respectively. The |ChartFormat| object is
    provided by the :attr:`format` property on the target axis, series, etc.
    """

    @lazyproperty
    def fill(self):
        """
        |FillFormat| instance for this object, providing access to fill
        properties such as fill color.
        """
        spPr = self._element.get_or_add_spPr()
        return FillFormat.from_fill_parent(spPr)

    @lazyproperty
    def line(self):
        """
        The |LineFormat| object providing access to the visual properties of
        this object, such as line color and line style.
        """
        spPr = self._element.get_or_add_spPr()
        return LineFormat(spPr)