1# Copyright (c) 2010-2024 openpyxl
2
3from openpyxl.descriptors.serialisable import Serialisable
4from openpyxl.descriptors import (
5 Typed,
6 Sequence,
7 Alias,
8)
9from openpyxl.descriptors.excel import ExtensionList
10
11from ._chart import ChartBase
12from .axis import TextAxis, NumericAxis, ChartLines
13from .updown_bars import UpDownBars
14from .label import DataLabelList
15from .series import Series
16
17
18class StockChart(ChartBase):
19
20 tagname = "stockChart"
21
22 ser = Sequence(expected_type=Series) #min 3, max4
23 dLbls = Typed(expected_type=DataLabelList, allow_none=True)
24 dataLabels = Alias('dLbls')
25 dropLines = Typed(expected_type=ChartLines, allow_none=True)
26 hiLowLines = Typed(expected_type=ChartLines, allow_none=True)
27 upDownBars = Typed(expected_type=UpDownBars, allow_none=True)
28 extLst = Typed(expected_type=ExtensionList, allow_none=True)
29
30 x_axis = Typed(expected_type=TextAxis)
31 y_axis = Typed(expected_type=NumericAxis)
32
33 _series_type = "line"
34
35 __elements__ = ('ser', 'dLbls', 'dropLines', 'hiLowLines', 'upDownBars',
36 'axId')
37
38 def __init__(self,
39 ser=(),
40 dLbls=None,
41 dropLines=None,
42 hiLowLines=None,
43 upDownBars=None,
44 extLst=None,
45 **kw
46 ):
47 self.ser = ser
48 self.dLbls = dLbls
49 self.dropLines = dropLines
50 self.hiLowLines = hiLowLines
51 self.upDownBars = upDownBars
52 self.x_axis = TextAxis()
53 self.y_axis = NumericAxis()
54 super().__init__(**kw)