line_chart.py 3.9 KB

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