stock_chart.py 1.6 KB

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