marker.py 2.5 KB

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