stock_chart.py 1.6 KB

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