Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/chart/surface_chart.py: 77%

64 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1# Copyright (c) 2010-2022 openpyxl 

2 

3from openpyxl.descriptors.serialisable import Serialisable 

4from openpyxl.descriptors import ( 

5 Typed, 

6 Integer, 

7 Bool, 

8 Alias, 

9 Sequence, 

10) 

11from openpyxl.descriptors.excel import ExtensionList 

12from openpyxl.descriptors.nested import ( 

13 NestedInteger, 

14 NestedBool, 

15) 

16 

17from ._chart import ChartBase 

18from ._3d import _3DBase 

19from .axis import TextAxis, NumericAxis, SeriesAxis 

20from .shapes import GraphicalProperties 

21from .series import Series 

22 

23 

24class BandFormat(Serialisable): 

25 

26 tagname = "bandFmt" 

27 

28 idx = NestedInteger() 

29 spPr = Typed(expected_type=GraphicalProperties, allow_none=True) 

30 graphicalProperties = Alias("spPr") 

31 

32 __elements__ = ('idx', 'spPr') 

33 

34 def __init__(self, 

35 idx=0, 

36 spPr=None, 

37 ): 

38 self.idx = idx 

39 self.spPr = spPr 

40 

41 

42class BandFormatList(Serialisable): 

43 

44 tagname = "bandFmts" 

45 

46 bandFmt = Sequence(expected_type=BandFormat, allow_none=True) 

47 

48 __elements__ = ('bandFmt',) 

49 

50 def __init__(self, 

51 bandFmt=(), 

52 ): 

53 self.bandFmt = bandFmt 

54 

55 

56class _SurfaceChartBase(ChartBase): 

57 

58 wireframe = NestedBool(allow_none=True) 

59 ser = Sequence(expected_type=Series, allow_none=True) 

60 bandFmts = Typed(expected_type=BandFormatList, allow_none=True) 

61 

62 _series_type = "surface" 

63 

64 __elements__ = ('wireframe', 'ser', 'bandFmts') 

65 

66 def __init__(self, 

67 wireframe=None, 

68 ser=(), 

69 bandFmts=None, 

70 **kw 

71 ): 

72 self.wireframe = wireframe 

73 self.ser = ser 

74 self.bandFmts = bandFmts 

75 super(_SurfaceChartBase, self).__init__(**kw) 

76 

77 

78class SurfaceChart3D(_SurfaceChartBase, _3DBase): 

79 

80 tagname = "surface3DChart" 

81 

82 wireframe = _SurfaceChartBase.wireframe 

83 ser = _SurfaceChartBase.ser 

84 bandFmts = _SurfaceChartBase.bandFmts 

85 

86 extLst = Typed(expected_type=ExtensionList, allow_none=True) 

87 

88 x_axis = Typed(expected_type=TextAxis) 

89 y_axis = Typed(expected_type=NumericAxis) 

90 z_axis = Typed(expected_type=SeriesAxis) 

91 

92 __elements__ = _SurfaceChartBase.__elements__ + ('axId',) 

93 

94 def __init__(self, **kw): 

95 self.x_axis = TextAxis() 

96 self.y_axis = NumericAxis() 

97 self.z_axis = SeriesAxis() 

98 super(SurfaceChart3D, self).__init__(**kw) 

99 

100 

101class SurfaceChart(SurfaceChart3D): 

102 

103 tagname = "surfaceChart" 

104 

105 wireframe = _SurfaceChartBase.wireframe 

106 ser = _SurfaceChartBase.ser 

107 bandFmts = _SurfaceChartBase.bandFmts 

108 

109 extLst = Typed(expected_type=ExtensionList, allow_none=True) 

110 

111 __elements__ = SurfaceChart3D.__elements__ 

112 

113 def __init__(self, **kw): 

114 super(SurfaceChart, self).__init__(**kw) 

115 self.y_axis.delete = True 

116 self.view3D.x_rotation = 90 

117 self.view3D.y_rotation = 0 

118 self.view3D.perspective = False 

119 self.view3D.right_angle_axes = False