layrz-sdk 3.0.14__py3-none-any.whl → 3.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of layrz-sdk might be problematic. Click here for more details.

Files changed (123) hide show
  1. layrz_sdk/__init__.py +1 -1
  2. layrz_sdk/constants.py +5 -0
  3. layrz_sdk/entities/__init__.py +129 -73
  4. layrz_sdk/entities/asset.py +71 -0
  5. layrz_sdk/entities/{general/asset_operation_mode.py → asset_operation_mode.py} +31 -30
  6. layrz_sdk/entities/broadcast_request.py +12 -0
  7. layrz_sdk/entities/broadcast_response.py +12 -0
  8. layrz_sdk/entities/broadcast_result.py +20 -0
  9. layrz_sdk/entities/{broadcasts/status.py → broadcast_status.py} +28 -27
  10. layrz_sdk/entities/case.py +47 -0
  11. layrz_sdk/entities/case_ignored_status.py +26 -0
  12. layrz_sdk/entities/case_status.py +23 -0
  13. layrz_sdk/entities/charts/axis_config.py +15 -0
  14. layrz_sdk/entities/charts/{bar.py → bar_chart.py} +171 -208
  15. layrz_sdk/entities/charts/chart_alignment.py +27 -0
  16. layrz_sdk/entities/charts/chart_color.py +44 -0
  17. layrz_sdk/entities/charts/chart_configuration.py +10 -0
  18. layrz_sdk/entities/charts/chart_data_serie.py +19 -0
  19. layrz_sdk/entities/charts/chart_data_serie_type.py +28 -0
  20. layrz_sdk/entities/charts/chart_data_type.py +27 -0
  21. layrz_sdk/entities/charts/{render_technology.py → chart_render_technology.py} +30 -29
  22. layrz_sdk/entities/charts/{column.py → column_chart.py} +197 -236
  23. layrz_sdk/entities/charts/html_chart.py +34 -0
  24. layrz_sdk/entities/charts/{line.py → line_chart.py} +244 -282
  25. layrz_sdk/entities/charts/map_center_type.py +22 -0
  26. layrz_sdk/entities/charts/map_chart.py +104 -0
  27. layrz_sdk/entities/charts/map_point.py +22 -0
  28. layrz_sdk/entities/charts/number_chart.py +50 -0
  29. layrz_sdk/entities/charts/{pie.py → pie_chart.py} +127 -148
  30. layrz_sdk/entities/charts/radar_chart.py +77 -0
  31. layrz_sdk/entities/charts/{radial_bar.py → radial_bar_chart.py} +127 -148
  32. layrz_sdk/entities/charts/{scatter.py → scatter_chart.py} +206 -290
  33. layrz_sdk/entities/charts/scatter_serie.py +15 -0
  34. layrz_sdk/entities/charts/scatter_serie_item.py +8 -0
  35. layrz_sdk/entities/charts/table_chart.py +50 -0
  36. layrz_sdk/entities/charts/table_header.py +8 -0
  37. layrz_sdk/entities/charts/table_row.py +9 -0
  38. layrz_sdk/entities/charts/timeline_chart.py +75 -0
  39. layrz_sdk/entities/charts/timeline_serie.py +12 -0
  40. layrz_sdk/entities/charts/timeline_serie_item.py +12 -0
  41. layrz_sdk/entities/checkpoint.py +18 -0
  42. layrz_sdk/entities/comment.py +16 -0
  43. layrz_sdk/entities/custom_field.py +10 -0
  44. layrz_sdk/entities/custom_report_page.py +16 -0
  45. layrz_sdk/entities/device.py +13 -0
  46. layrz_sdk/entities/event.py +23 -0
  47. layrz_sdk/entities/geofence.py +11 -0
  48. layrz_sdk/entities/last_message.py +12 -0
  49. layrz_sdk/entities/message.py +23 -0
  50. layrz_sdk/entities/outbound_service.py +10 -0
  51. layrz_sdk/entities/position.py +101 -0
  52. layrz_sdk/entities/presence_type.py +16 -0
  53. layrz_sdk/entities/{reports/report.py → report.py} +257 -286
  54. layrz_sdk/entities/report_col.py +40 -0
  55. layrz_sdk/entities/report_configuration.py +8 -0
  56. layrz_sdk/entities/report_data_type.py +28 -0
  57. layrz_sdk/entities/{reports/format.py → report_format.py} +27 -26
  58. layrz_sdk/entities/report_header.py +43 -0
  59. layrz_sdk/entities/report_page.py +17 -0
  60. layrz_sdk/entities/report_row.py +28 -0
  61. layrz_sdk/entities/sensor.py +11 -0
  62. layrz_sdk/entities/{formatting/text_align.py → text_alignment.py} +26 -25
  63. layrz_sdk/entities/trigger.py +11 -0
  64. layrz_sdk/entities/user.py +10 -0
  65. layrz_sdk/entities/waypoint.py +18 -0
  66. layrz_sdk/helpers/__init__.py +8 -2
  67. layrz_sdk/helpers/color.py +41 -45
  68. layrz_sdk/lcl/__init__.py +7 -2
  69. layrz_sdk/lcl/core.py +832 -820
  70. layrz_sdk/py.typed +0 -0
  71. {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.1.dist-info}/LICENSE +6 -6
  72. {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.1.dist-info}/METADATA +48 -45
  73. layrz_sdk-3.1.1.dist-info/RECORD +75 -0
  74. {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.1.dist-info}/WHEEL +1 -1
  75. layrz_sdk/entities/broadcasts/__init__.py +0 -6
  76. layrz_sdk/entities/broadcasts/request.py +0 -30
  77. layrz_sdk/entities/broadcasts/response.py +0 -30
  78. layrz_sdk/entities/broadcasts/result.py +0 -53
  79. layrz_sdk/entities/broadcasts/service.py +0 -28
  80. layrz_sdk/entities/cases/__init__.py +0 -4
  81. layrz_sdk/entities/cases/case.py +0 -120
  82. layrz_sdk/entities/cases/comment.py +0 -37
  83. layrz_sdk/entities/cases/trigger.py +0 -31
  84. layrz_sdk/entities/charts/__init__.py +0 -21
  85. layrz_sdk/entities/charts/alignment.py +0 -26
  86. layrz_sdk/entities/charts/color.py +0 -38
  87. layrz_sdk/entities/charts/configuration.py +0 -54
  88. layrz_sdk/entities/charts/data_type.py +0 -26
  89. layrz_sdk/entities/charts/exceptions.py +0 -29
  90. layrz_sdk/entities/charts/html.py +0 -44
  91. layrz_sdk/entities/charts/map.py +0 -179
  92. layrz_sdk/entities/charts/number.py +0 -52
  93. layrz_sdk/entities/charts/radar.py +0 -102
  94. layrz_sdk/entities/charts/serie.py +0 -56
  95. layrz_sdk/entities/charts/serie_type.py +0 -27
  96. layrz_sdk/entities/charts/table.py +0 -74
  97. layrz_sdk/entities/charts/timeline.py +0 -148
  98. layrz_sdk/entities/checkpoints/__init__.py +0 -4
  99. layrz_sdk/entities/checkpoints/checkpoint.py +0 -50
  100. layrz_sdk/entities/checkpoints/waypoint.py +0 -52
  101. layrz_sdk/entities/events/__init__.py +0 -2
  102. layrz_sdk/entities/events/event.py +0 -58
  103. layrz_sdk/entities/formatting/__init__.py +0 -2
  104. layrz_sdk/entities/general/__init__.py +0 -9
  105. layrz_sdk/entities/general/asset.py +0 -72
  106. layrz_sdk/entities/general/custom_field.py +0 -29
  107. layrz_sdk/entities/general/device.py +0 -45
  108. layrz_sdk/entities/general/geofence.py +0 -53
  109. layrz_sdk/entities/general/sensor.py +0 -31
  110. layrz_sdk/entities/general/user.py +0 -29
  111. layrz_sdk/entities/repcom/__init__.py +0 -2
  112. layrz_sdk/entities/repcom/transaction.py +0 -54
  113. layrz_sdk/entities/reports/__init__.py +0 -7
  114. layrz_sdk/entities/reports/col.py +0 -86
  115. layrz_sdk/entities/reports/header.py +0 -57
  116. layrz_sdk/entities/reports/page.py +0 -64
  117. layrz_sdk/entities/reports/row.py +0 -43
  118. layrz_sdk/entities/telemetry/__init__.py +0 -5
  119. layrz_sdk/entities/telemetry/last_message.py +0 -41
  120. layrz_sdk/entities/telemetry/message.py +0 -37
  121. layrz_sdk/entities/telemetry/position.py +0 -51
  122. layrz_sdk-3.0.14.dist-info/RECORD +0 -70
  123. {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.1.dist-info}/top_level.txt +0 -0
@@ -1,208 +1,171 @@
1
- """Bar chart"""
2
-
3
- from typing import Any, List
4
-
5
- from .alignment import ChartAlignment
6
- from .configuration import AxisConfig
7
- from .exceptions import ChartException
8
- from .render_technology import ChartRenderTechnology
9
- from .serie import ChartDataSerie
10
- from .serie_type import ChartDataSerieType
11
-
12
-
13
- class BarChart:
14
- """
15
- Bar chart configuration
16
- """
17
-
18
- def __init__(
19
- self,
20
- x_axis: ChartDataSerie,
21
- y_axis: List[ChartDataSerie],
22
- title: str = 'Chart',
23
- align: ChartAlignment = ChartAlignment.CENTER,
24
- x_axis_config: AxisConfig = None,
25
- y_axis_config: AxisConfig = None,
26
- ) -> None:
27
- """
28
- Constructor
29
- ----
30
- Arguments
31
- - x_axis : Defines the X Axis of the chart, uses the ChartDataSerie class.
32
- Please read the documentation to more information.
33
- - y_axis : Defines the Y Axis of the chart, uses the ChartDataSerie class.
34
- Please read the documentation to more information.
35
- - title : Title of the chart
36
- - align : Alignment of the title
37
- - x_axis_config : Configuration of the X Axis
38
- - y_axis_config : Configuration of the Y Axis
39
- """
40
- for i, serie in enumerate(y_axis):
41
- if not isinstance(serie, ChartDataSerie):
42
- raise ChartException(f'Y Axis serie {i} must be an instance of ChartDataSerie')
43
- self.y_axis = y_axis
44
-
45
- if not isinstance(x_axis, ChartDataSerie):
46
- raise ChartException('X Axis must be an instance of ChartDataSerie')
47
- self.x_axis = x_axis
48
-
49
- if not isinstance(title, str):
50
- raise ChartException('title must be an instance of str')
51
- self.title = title
52
-
53
- if not isinstance(align, ChartAlignment):
54
- raise ChartException('align must be an instance of ChartAlignment')
55
- self.align = align
56
-
57
- if x_axis_config is None:
58
- x_axis_config = AxisConfig()
59
-
60
- if not isinstance(x_axis_config, AxisConfig):
61
- raise ChartException('x_axis_config must be an instance of AxisConfig')
62
- self.x_axis_config = x_axis_config
63
-
64
- if y_axis_config is None:
65
- y_axis_config = AxisConfig()
66
-
67
- if not isinstance(y_axis_config, AxisConfig):
68
- raise ChartException('y_axis_config must be an instance of AxisConfig')
69
- self.y_axis_config = y_axis_config
70
-
71
- def render(
72
- self,
73
- technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
74
- ) -> Any:
75
- """
76
- Render chart to a graphic Library.
77
- We have two graphic libraries: GRAPHIC and APEXCHARTS.
78
-
79
- GRAPHIC is a Flutter chart library. To return this option, use the parameter use_new_definition=True.
80
- APEXCHARTS is a Javascript chart library. This is the default option.
81
- """
82
- if technology == ChartRenderTechnology.GRAPHIC:
83
- return {
84
- 'library': 'GRAPHIC',
85
- 'chart': 'BAR',
86
- 'configuration': self._render_graphic(),
87
- }
88
-
89
- if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
90
- return {
91
- 'library': 'SYNCFUSION_FLUTTER_CHARTS',
92
- 'chart': 'BAR',
93
- 'configuration': self._render_syncfusion_flutter_charts(),
94
- }
95
-
96
- if technology == ChartRenderTechnology.APEX_CHARTS:
97
- return {
98
- 'library': 'APEXCHARTS',
99
- 'chart': 'BAR',
100
- 'configuration': self._render_apexcharts(),
101
- }
102
-
103
- return {
104
- 'library': 'FLUTTER',
105
- 'chart': 'TEXT',
106
- 'configuration': [f'Unsupported rendering technology {technology.name}'],
107
- }
108
-
109
- def _render_syncfusion_flutter_charts(self) -> Any:
110
- """
111
- Converts the configuration of the chart to Syncfusion Flutter Charts.
112
- """
113
- series = []
114
-
115
- for serie in self.y_axis:
116
- values = []
117
- for i, value in enumerate(serie.data):
118
- x_axis = self.x_axis.data[i]
119
- values.append({'xAxis': x_axis, 'yAxis': value})
120
-
121
- series.append(
122
- {
123
- 'label': serie.label,
124
- 'color': serie.color,
125
- 'values': values,
126
- }
127
- )
128
-
129
- return {
130
- 'series': series,
131
- 'xAxis': {
132
- 'label': self.x_axis_config.label,
133
- 'measureUnit': self.x_axis_config.measure_unit,
134
- 'dataType': self.x_axis_config.data_type.value,
135
- 'minValue': self.x_axis_config.min_value,
136
- 'maxValue': self.x_axis_config.max_value,
137
- },
138
- 'yAxis': {
139
- 'label': self.y_axis_config.label,
140
- 'measureUnit': self.y_axis_config.measure_unit,
141
- 'dataType': self.y_axis_config.data_type.value,
142
- 'minValue': self.y_axis_config.min_value,
143
- 'maxValue': self.y_axis_config.max_value,
144
- },
145
- }
146
-
147
- def _render_graphic(self) -> Any:
148
- """
149
- Converts the configuration of the chart to Flutter library graphic.
150
- """
151
-
152
- series = []
153
-
154
- for serie in self.y_axis:
155
- for i, value in enumerate(serie.data):
156
- x_axis = self.x_axis.data[i]
157
- series.append(
158
- {
159
- 'label': serie.label,
160
- 'color': serie.color,
161
- 'category': x_axis,
162
- 'value': value,
163
- }
164
- )
165
-
166
- return series
167
-
168
- def _render_apexcharts(self) -> Any:
169
- """
170
- Converts the configuration of the chart to Javascript library ApexCharts.
171
- """
172
-
173
- series = []
174
- colors = []
175
-
176
- for serie in self.y_axis:
177
- modified_serie = {'name': serie.label, 'data': serie.data}
178
-
179
- if serie.serie_type is not ChartDataSerieType.NONE:
180
- modified_serie['type'] = serie.serie_type.value
181
-
182
- series.append(modified_serie)
183
- colors.append(serie.color)
184
-
185
- config = {
186
- 'series': series,
187
- 'colors': colors,
188
- 'xaxis': {
189
- 'categories': self.x_axis.data,
190
- 'type': self.x_axis.data_type.value,
191
- 'title': {'text': self.x_axis.label},
192
- },
193
- 'title': {
194
- 'text': self.title,
195
- 'align': self.align.value,
196
- 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
197
- },
198
- 'plotOptions': {'bar': {'horizontal': True, 'borderRadius': 4}},
199
- 'dataLabels': {'enabled': False},
200
- 'chart': {
201
- 'type': 'bar',
202
- 'animations': {'enabled': False},
203
- 'toolbar': {'show': False},
204
- 'zoom': {'enabled': False},
205
- },
206
- }
207
-
208
- return config
1
+ """Bar chart"""
2
+
3
+ import sys
4
+ from typing import Any, Dict, List
5
+
6
+ from pydantic import BaseModel, Field
7
+
8
+ from .axis_config import AxisConfig
9
+ from .chart_alignment import ChartAlignment
10
+ from .chart_data_serie import ChartDataSerie
11
+ from .chart_data_serie_type import ChartDataSerieType
12
+ from .chart_render_technology import ChartRenderTechnology
13
+
14
+ if sys.version_info >= (3, 11):
15
+ from typing import Self
16
+ else:
17
+ from typing_extensions import Self
18
+
19
+
20
+ class BarChart(BaseModel):
21
+ """Bar chart configuration"""
22
+
23
+ x_axis: ChartDataSerie = Field(description='Defines the X Axis of the chart')
24
+ y_axis: List[ChartDataSerie] = Field(description='Defines the Y Axis of the chart', default_factory=list)
25
+ title: str = Field(default='Chart', description='Title of the chart')
26
+ align: ChartAlignment = Field(default=ChartAlignment.CENTER, description='Alignment of the title')
27
+ x_axis_config: AxisConfig = Field(
28
+ default_factory=lambda: AxisConfig(),
29
+ description='Configuration of the X Axis',
30
+ )
31
+ y_axis_config: AxisConfig = Field(
32
+ default_factory=lambda: AxisConfig(),
33
+ description='Configuration of the Y Axis',
34
+ )
35
+
36
+ def render(
37
+ self: Self,
38
+ technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
39
+ ) -> Dict[str, Any]:
40
+ """
41
+ Render chart to a graphic Library.
42
+ :param technology: The technology to use to render the chart.
43
+ :return: The configuration of the chart.
44
+ """
45
+ if technology == ChartRenderTechnology.GRAPHIC:
46
+ return {
47
+ 'library': 'GRAPHIC',
48
+ 'chart': 'BAR',
49
+ 'configuration': self._render_graphic(),
50
+ }
51
+
52
+ if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
53
+ return {
54
+ 'library': 'SYNCFUSION_FLUTTER_CHARTS',
55
+ 'chart': 'BAR',
56
+ 'configuration': self._render_syncfusion_flutter_charts(),
57
+ }
58
+
59
+ if technology == ChartRenderTechnology.APEX_CHARTS:
60
+ return {
61
+ 'library': 'APEXCHARTS',
62
+ 'chart': 'BAR',
63
+ 'configuration': self._render_apexcharts(),
64
+ }
65
+
66
+ return {
67
+ 'library': 'FLUTTER',
68
+ 'chart': 'TEXT',
69
+ 'configuration': [f'Unsupported rendering technology {technology.name}'],
70
+ }
71
+
72
+ def _render_syncfusion_flutter_charts(self: Self) -> Dict[str, Any]:
73
+ """
74
+ Converts the configuration of the chart to Syncfusion Flutter Charts.
75
+ """
76
+ series = []
77
+
78
+ for serie in self.y_axis:
79
+ values = []
80
+ for i, value in enumerate(serie.data):
81
+ x_axis = self.x_axis.data[i]
82
+ values.append({'xAxis': x_axis, 'yAxis': value})
83
+
84
+ series.append(
85
+ {
86
+ 'label': serie.label,
87
+ 'color': serie.color,
88
+ 'values': values,
89
+ }
90
+ )
91
+
92
+ return {
93
+ 'series': series,
94
+ 'xAxis': {
95
+ 'label': self.x_axis_config.label,
96
+ 'measureUnit': self.x_axis_config.measure_unit,
97
+ 'dataType': self.x_axis_config.data_type.value,
98
+ 'minValue': self.x_axis_config.min_value,
99
+ 'maxValue': self.x_axis_config.max_value,
100
+ },
101
+ 'yAxis': {
102
+ 'label': self.y_axis_config.label,
103
+ 'measureUnit': self.y_axis_config.measure_unit,
104
+ 'dataType': self.y_axis_config.data_type.value,
105
+ 'minValue': self.y_axis_config.min_value,
106
+ 'maxValue': self.y_axis_config.max_value,
107
+ },
108
+ }
109
+
110
+ def _render_graphic(self: Self) -> List[Dict[str, Any]]:
111
+ """
112
+ Converts the configuration of the chart to Flutter library graphic.
113
+ """
114
+
115
+ series = []
116
+
117
+ for serie in self.y_axis:
118
+ for i, value in enumerate(serie.data):
119
+ x_axis = self.x_axis.data[i]
120
+ series.append(
121
+ {
122
+ 'label': serie.label,
123
+ 'color': serie.color,
124
+ 'category': x_axis,
125
+ 'value': value,
126
+ }
127
+ )
128
+
129
+ return series
130
+
131
+ def _render_apexcharts(self: Self) -> Dict[str, Any]:
132
+ """
133
+ Converts the configuration of the chart to Javascript library ApexCharts.
134
+ """
135
+
136
+ series = []
137
+ colors = []
138
+
139
+ for serie in self.y_axis:
140
+ modified_serie = {'name': serie.label, 'data': serie.data}
141
+
142
+ if serie.serie_type is not ChartDataSerieType.NONE:
143
+ modified_serie['type'] = serie.serie_type.value
144
+
145
+ series.append(modified_serie)
146
+ colors.append(serie.color)
147
+
148
+ config = {
149
+ 'series': series,
150
+ 'colors': colors,
151
+ 'xaxis': {
152
+ 'categories': self.x_axis.data,
153
+ 'type': self.x_axis.data_type.value,
154
+ 'title': {'text': self.x_axis.label},
155
+ },
156
+ 'title': {
157
+ 'text': self.title,
158
+ 'align': self.align.value,
159
+ 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
160
+ },
161
+ 'plotOptions': {'bar': {'horizontal': True, 'borderRadius': 4}},
162
+ 'dataLabels': {'enabled': False},
163
+ 'chart': {
164
+ 'type': 'bar',
165
+ 'animations': {'enabled': False},
166
+ 'toolbar': {'show': False},
167
+ 'zoom': {'enabled': False},
168
+ },
169
+ }
170
+
171
+ return config
@@ -0,0 +1,27 @@
1
+ """Chart alignment"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class ChartAlignment(Enum):
13
+ """
14
+ Chart Alignment
15
+ """
16
+
17
+ CENTER = 'center'
18
+ LEFT = 'left'
19
+ RIGHT = 'right'
20
+
21
+ def __str__(self: Self) -> str:
22
+ """Readable property"""
23
+ return self.name
24
+
25
+ def __repr__(self: Self) -> str:
26
+ """Readable property"""
27
+ return f'ChartAlignment.{self.name}'
@@ -0,0 +1,44 @@
1
+ """Chart alignment"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+ from typing import Any, List
6
+
7
+ if sys.version_info >= (3, 11):
8
+ from typing import Self
9
+ else:
10
+ from typing_extensions import Self
11
+
12
+
13
+ class ChartColor(Enum):
14
+ """Chart color list, ideal to use to colorize the series"""
15
+
16
+ RED = '#F44336'
17
+ BLUE = '#2196F3'
18
+ GREEN = '#4CAF50'
19
+ PURPLE = '#9C27B0'
20
+ ORANGE = '#FF9800'
21
+ PINK = '#E91E63'
22
+ TEAL = '#009688'
23
+ AMBER = '#FFC107'
24
+ CYAN = '#00BCD4'
25
+ INDIGO = '#3F51B5'
26
+ LIME = '#CDDC39'
27
+
28
+ def __str__(self: Self) -> str:
29
+ """Readable property"""
30
+ return self.name
31
+
32
+ def __repr__(self: Self) -> str:
33
+ """Readable property"""
34
+ return f'ChartColor.{self.name}'
35
+
36
+ @staticmethod
37
+ def get_colors() -> List[str]:
38
+ """Get a color from the list"""
39
+ return [color.value for color in ChartColor]
40
+
41
+
42
+ def get_color_list() -> List[str]:
43
+ """Get all colors"""
44
+ return ChartColor.get_colors()
@@ -0,0 +1,10 @@
1
+ """Charts entities"""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class ChartConfiguration(BaseModel):
7
+ """Chart configuration"""
8
+
9
+ name: str = Field(description='Name of the chart')
10
+ description: str = Field(description='Description of the chart')
@@ -0,0 +1,19 @@
1
+ """Chart Data Serie"""
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from .chart_data_serie_type import ChartDataSerieType
8
+ from .chart_data_type import ChartDataType
9
+
10
+
11
+ class ChartDataSerie(BaseModel):
12
+ """Chart Serie"""
13
+
14
+ data: Any = Field(description='Data of the serie')
15
+ color: str = Field(description='Color of the serie', default='#000000')
16
+ label: str = Field(description='Label of the serie', default='')
17
+ serie_type: ChartDataSerieType = Field(description='Type of the serie', default=ChartDataSerieType.LINE)
18
+ data_type: ChartDataType = Field(description='Type of the data', default=ChartDataType.NUMBER)
19
+ dashed: bool = Field(description='If the serie should be dashed', default=False)
@@ -0,0 +1,28 @@
1
+ """Chart Serie type"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class ChartDataSerieType(Enum):
13
+ """
14
+ Chart data serie type
15
+ """
16
+
17
+ NONE = None
18
+ LINE = 'line'
19
+ AREA = 'area'
20
+ SCATTER = 'scatter'
21
+
22
+ def __str__(self) -> str:
23
+ """Readable property"""
24
+ return self.name
25
+
26
+ def __repr__(self) -> str:
27
+ """Readable property"""
28
+ return f'ChartDataSerieType.{self.name}'
@@ -0,0 +1,27 @@
1
+ """Chart Data type"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class ChartDataType(Enum):
13
+ """
14
+ Chart Data Type
15
+ """
16
+
17
+ STRING = 'STRING'
18
+ DATETIME = 'DATETIME'
19
+ NUMBER = 'NUMBER'
20
+
21
+ def __str__(self: Self) -> str:
22
+ """Readable property"""
23
+ return self.name
24
+
25
+ def __repr__(self: Self) -> str:
26
+ """Readable property"""
27
+ return f'ChartDataType.{self.name}'
@@ -1,29 +1,30 @@
1
- """Chart rendering technology / library"""
2
-
3
- from enum import Enum
4
-
5
-
6
- class ChartRenderTechnology(Enum):
7
- """
8
- Chart Alignment
9
- """
10
-
11
- CANVAS_JS = 'CANVAS_JS'
12
- GRAPHIC = 'GRAPHIC'
13
- SYNCFUSION_FLUTTER_CHARTS = 'SYNCFUSION_FLUTTER_CHARTS'
14
- FLUTTER_MAP = 'FLUTTER_MAP'
15
- APEX_CHARTS = 'APEX_CHARTS'
16
- FLUTTER = 'FLUTTER'
17
-
18
- @property
19
- def _readable(self) -> str | None | bool:
20
- """Readable"""
21
- return f'ChartRenderTechnology.{self.value}'
22
-
23
- def __str__(self) -> str | None | bool:
24
- """Readable property"""
25
- return self._readable
26
-
27
- def __repr__(self) -> str | None | bool:
28
- """Readable property"""
29
- return self._readable
1
+ """Chart rendering technology / library"""
2
+
3
+ import sys
4
+ from enum import Enum
5
+
6
+ if sys.version_info >= (3, 11):
7
+ from typing import Self
8
+ else:
9
+ from typing_extensions import Self
10
+
11
+
12
+ class ChartRenderTechnology(Enum):
13
+ """
14
+ Chart Alignment
15
+ """
16
+
17
+ CANVAS_JS = 'CANVAS_JS'
18
+ GRAPHIC = 'GRAPHIC'
19
+ SYNCFUSION_FLUTTER_CHARTS = 'SYNCFUSION_FLUTTER_CHARTS'
20
+ FLUTTER_MAP = 'FLUTTER_MAP'
21
+ APEX_CHARTS = 'APEX_CHARTS'
22
+ FLUTTER = 'FLUTTER'
23
+
24
+ def __str__(self: Self) -> str:
25
+ """Readable property"""
26
+ return self.name
27
+
28
+ def __repr__(self: Self) -> str:
29
+ """Readable property"""
30
+ return f'ChartRenderTechnology.{self.value}'