marker.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. Alias,
  7. )
  8. from openpyxl.descriptors.excel import(
  9. ExtensionList,
  10. _explicit_none,
  11. )
  12. from openpyxl.descriptors.nested import (
  13. NestedBool,
  14. NestedInteger,
  15. NestedMinMax,
  16. NestedNoneSet,
  17. )
  18. from .layout import Layout
  19. from .picture import PictureOptions
  20. from .shapes import *
  21. from .text import *
  22. from .error_bar import *
  23. class Marker(Serialisable):
  24. tagname = "marker"
  25. symbol = NestedNoneSet(values=(['circle', 'dash', 'diamond', 'dot', 'picture',
  26. 'plus', 'square', 'star', 'triangle', 'x', 'auto']),
  27. to_tree=_explicit_none)
  28. size = NestedMinMax(min=2, max=72, allow_none=True)
  29. spPr = Typed(expected_type=GraphicalProperties, allow_none=True)
  30. graphicalProperties = Alias('spPr')
  31. extLst = Typed(expected_type=ExtensionList, allow_none=True)
  32. __elements__ = ('symbol', 'size', 'spPr')
  33. def __init__(self,
  34. symbol=None,
  35. size=None,
  36. spPr=None,
  37. extLst=None,
  38. ):
  39. self.symbol = symbol
  40. self.size = size
  41. if spPr is None:
  42. spPr = GraphicalProperties()
  43. self.spPr = spPr
  44. class DataPoint(Serialisable):
  45. tagname = "dPt"
  46. idx = NestedInteger()
  47. invertIfNegative = NestedBool(allow_none=True)
  48. marker = Typed(expected_type=Marker, allow_none=True)
  49. bubble3D = NestedBool(allow_none=True)
  50. explosion = NestedInteger(allow_none=True)
  51. spPr = Typed(expected_type=GraphicalProperties, allow_none=True)
  52. graphicalProperties = Alias('spPr')
  53. pictureOptions = Typed(expected_type=PictureOptions, allow_none=True)
  54. extLst = Typed(expected_type=ExtensionList, allow_none=True)
  55. __elements__ = ('idx', 'invertIfNegative', 'marker', 'bubble3D',
  56. 'explosion', 'spPr', 'pictureOptions')
  57. def __init__(self,
  58. idx=None,
  59. invertIfNegative=None,
  60. marker=None,
  61. bubble3D=None,
  62. explosion=None,
  63. spPr=None,
  64. pictureOptions=None,
  65. extLst=None,
  66. ):
  67. self.idx = idx
  68. self.invertIfNegative = invertIfNegative
  69. self.marker = marker
  70. self.bubble3D = bubble3D
  71. self.explosion = explosion
  72. if spPr is None:
  73. spPr = GraphicalProperties()
  74. self.spPr = spPr
  75. self.pictureOptions = pictureOptions