Source code

Download source archive ↓

src/openpyxl/chart/line_chart.py

1#Autogenerated schema
2from openpyxl.descriptors import (
3    Typed,
4    Sequence,
5    Alias,
6    )
7from openpyxl.descriptors.excel import ExtensionList
8from openpyxl.descriptors.nested import (
9    NestedSet,
10    NestedBool,
11)
12
13from ._chart import ChartBase
14from .updown_bars import UpDownBars
15from .descriptors import NestedGapAmount
16from .axis import TextAxis, NumericAxis, SeriesAxis, ChartLines, _BaseAxis
17from .label import DataLabelList
18from .series import Series
19
20
21class _LineChartBase(ChartBase):
22
23    grouping = NestedSet(values=(['percentStacked', 'standard', 'stacked']))
24    varyColors = NestedBool(allow_none=True)
25    ser = Sequence(expected_type=Series, allow_none=True)
26    dLbls = Typed(expected_type=DataLabelList, allow_none=True)
27    dataLabels = Alias("dLbls")
28    dropLines = Typed(expected_type=ChartLines, allow_none=True)
29
30    _series_type = "line"
31
32    __elements__ = ('grouping', 'varyColors', 'ser', 'dLbls', 'dropLines')
33
34    def __init__(self,
35                 grouping="standard",
36                 varyColors=None,
37                 ser=(),
38                 dLbls=None,
39                 dropLines=None,
40                 **kw
41                ):
42        self.grouping = grouping
43        self.varyColors = varyColors
44        self.ser = ser
45        self.dLbls = dLbls
46        self.dropLines = dropLines
47        super().__init__(**kw)
48
49
50class LineChart(_LineChartBase):
51
52    tagname = "lineChart"
53
54    grouping = _LineChartBase.grouping
55    varyColors = _LineChartBase.varyColors
56    ser = _LineChartBase.ser
57    dLbls = _LineChartBase.dLbls
58    dropLines =_LineChartBase.dropLines
59
60    hiLowLines = Typed(expected_type=ChartLines, allow_none=True)
61    upDownBars = Typed(expected_type=UpDownBars, allow_none=True)
62    marker = NestedBool(allow_none=True)
63    smooth = NestedBool(allow_none=True)
64    extLst = Typed(expected_type=ExtensionList, allow_none=True)
65
66    x_axis = Typed(expected_type=_BaseAxis)
67    y_axis = Typed(expected_type=NumericAxis)
68
69    __elements__ = _LineChartBase.__elements__ + ('hiLowLines', 'upDownBars', 'marker', 'smooth', 'axId')
70
71    def __init__(self,
72                 hiLowLines=None,
73                 upDownBars=None,
74                 marker=None,
75                 smooth=None,
76                 extLst=None,
77                 **kw
78                ):
79        self.hiLowLines = hiLowLines
80        self.upDownBars = upDownBars
81        self.marker = marker
82        self.smooth = smooth
83        self.x_axis = TextAxis()
84        self.y_axis = NumericAxis()
85
86        super().__init__(**kw)
87
88
89class LineChart3D(_LineChartBase):
90
91    tagname = "line3DChart"
92
93    grouping = _LineChartBase.grouping
94    varyColors = _LineChartBase.varyColors
95    ser = _LineChartBase.ser
96    dLbls = _LineChartBase.dLbls
97    dropLines =_LineChartBase.dropLines
98
99    gapDepth = NestedGapAmount()
100    hiLowLines = Typed(expected_type=ChartLines, allow_none=True)
101    upDownBars = Typed(expected_type=UpDownBars, allow_none=True)
102    marker = NestedBool(allow_none=True)
103    smooth = NestedBool(allow_none=True)
104    extLst = Typed(expected_type=ExtensionList, allow_none=True)
105
106    x_axis = Typed(expected_type=TextAxis)
107    y_axis = Typed(expected_type=NumericAxis)
108    z_axis = Typed(expected_type=SeriesAxis)
109
110    __elements__ = _LineChartBase.__elements__ + ('gapDepth', 'hiLowLines',
111                                                  'upDownBars', 'marker', 'smooth', 'axId')
112
113    def __init__(self,
114                 gapDepth=None,
115                 hiLowLines=None,
116                 upDownBars=None,
117                 marker=None,
118                 smooth=None,
119                 **kw
120                ):
121        self.gapDepth = gapDepth
122        self.hiLowLines = hiLowLines
123        self.upDownBars = upDownBars
124        self.marker = marker
125        self.smooth = smooth
126        self.x_axis = TextAxis()
127        self.y_axis = NumericAxis()
128        self.z_axis = SeriesAxis()
129        super(LineChart3D, self).__init__(**kw)