layrz-sdk 3.0.13__py3-none-any.whl → 3.1.0__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 -813
  70. layrz_sdk/py.typed +0 -0
  71. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/LICENSE +6 -6
  72. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/METADATA +48 -45
  73. layrz_sdk-3.1.0.dist-info/RECORD +75 -0
  74. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.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.13.dist-info/RECORD +0 -70
  123. {layrz_sdk-3.0.13.dist-info → layrz_sdk-3.1.0.dist-info}/top_level.txt +0 -0
@@ -1,236 +1,197 @@
1
- """Column chart"""
2
-
3
- from typing import Any, List
4
-
5
- from layrz_sdk.helpers import convert_to_rgba
6
-
7
- from .alignment import ChartAlignment
8
- from .configuration import AxisConfig
9
- from .exceptions import ChartException
10
- from .render_technology import ChartRenderTechnology
11
- from .serie import ChartDataSerie
12
- from .serie_type import ChartDataSerieType
13
-
14
-
15
- class ColumnChart:
16
- """
17
- Column chart configuration
18
-
19
- """
20
-
21
- def __init__(
22
- self,
23
- x_axis: ChartDataSerie,
24
- y_axis: List[ChartDataSerie],
25
- title: str = 'Chart',
26
- align: ChartAlignment = ChartAlignment.CENTER,
27
- x_axis_config: AxisConfig = None,
28
- y_axis_config: AxisConfig = None,
29
- ) -> None:
30
- """
31
- Constructor
32
- ----
33
- Arguments
34
- - x_axis : Defines the X Axis of the chart, uses the ChartDataSerie class.
35
- Please read the documentation to more information.
36
- - y_axis : Defines the Y Axis of the chart, uses the ChartDataSerie class.
37
- Please read the documentation to more information.
38
- - title : Title of the chart
39
- - align : Alignment of the title
40
- - x_axis_config : Configuration of the X Axis
41
- - y_axis_config : Configuration of the Y Axis
42
- """
43
- for i, serie in enumerate(y_axis):
44
- if not isinstance(serie, ChartDataSerie):
45
- raise ChartException(f'Y Axis serie {i} must be an instance of ChartDataSerie')
46
- self.y_axis = y_axis
47
-
48
- if not isinstance(x_axis, ChartDataSerie):
49
- raise ChartException('X Axis must be an instance of ChartDataSerie')
50
- self.x_axis = x_axis
51
-
52
- if not isinstance(title, str):
53
- raise ChartException('title must be an instance of str')
54
- self.title = title
55
-
56
- if not isinstance(align, ChartAlignment):
57
- raise ChartException('align must be an instance of ChartAlignment')
58
- self.align = align
59
-
60
- if x_axis_config is None:
61
- x_axis_config = AxisConfig()
62
-
63
- if not isinstance(x_axis_config, AxisConfig):
64
- raise ChartException('x_axis_config must be an instance of AxisConfig')
65
- self.x_axis_config = x_axis_config
66
-
67
- if y_axis_config is None:
68
- y_axis_config = AxisConfig()
69
-
70
- if not isinstance(y_axis_config, AxisConfig):
71
- raise ChartException('y_axis_config must be an instance of AxisConfig')
72
- self.y_axis_config = y_axis_config
73
-
74
- def render(
75
- self,
76
- technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
77
- ) -> Any:
78
- """
79
- Render chart to a graphic Library.
80
- We have two graphic libraries: GRAPHIC and APEXCHARTS.
81
-
82
- GRAPHIC is a Flutter chart library. To return this option, use the parameter use_new_definition=True.
83
- APEXCHARTS is a Javascript chart library. This is the default option.
84
- """
85
- if technology == ChartRenderTechnology.GRAPHIC:
86
- return {
87
- 'library': 'GRAPHIC',
88
- 'chart': 'COLUMN',
89
- 'configuration': self._render_graphic(),
90
- }
91
-
92
- if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
93
- return {
94
- 'library': 'SYNCFUSION_FLUTTER_CHARTS',
95
- 'chart': 'COLUMN',
96
- 'configuration': self._render_syncfusion_flutter_charts(),
97
- }
98
-
99
- if technology == ChartRenderTechnology.APEX_CHARTS:
100
- return {
101
- 'library': 'APEXCHARTS',
102
- 'chart': 'COLUMN',
103
- 'configuration': self._render_apexcharts(),
104
- }
105
-
106
- return {
107
- 'library': 'FLUTTER',
108
- 'chart': 'TEXT',
109
- 'configuration': [f'Unsupported {technology}'],
110
- }
111
-
112
- def _render_syncfusion_flutter_charts(self) -> Any:
113
- """
114
- Converts the configuration of the chart to Syncfusion Flutter Charts.
115
- """
116
- series = []
117
-
118
- for serie in self.y_axis:
119
- values = []
120
- for i, value in enumerate(serie.data):
121
- x_axis = self.x_axis.data[i]
122
- values.append({'xAxis': x_axis, 'yAxis': value})
123
-
124
- series.append(
125
- {
126
- 'label': serie.label,
127
- 'color': serie.color,
128
- 'values': values,
129
- }
130
- )
131
-
132
- return {
133
- 'series': series,
134
- 'xAxis': {
135
- 'label': self.x_axis_config.label,
136
- 'measureUnit': self.x_axis_config.measure_unit,
137
- 'dataType': self.x_axis_config.data_type.value,
138
- 'minValue': self.x_axis_config.min_value,
139
- 'maxValue': self.x_axis_config.max_value,
140
- },
141
- 'yAxis': {
142
- 'label': self.y_axis_config.label,
143
- 'measureUnit': self.y_axis_config.measure_unit,
144
- 'dataType': self.y_axis_config.data_type.value,
145
- 'minValue': self.y_axis_config.min_value,
146
- 'maxValue': self.y_axis_config.max_value,
147
- },
148
- }
149
-
150
- def _render_graphic(self) -> Any:
151
- """
152
- Converts the configuration of the chart to Flutter library graphic.
153
- """
154
-
155
- series = []
156
-
157
- for serie in self.y_axis:
158
- for i, value in enumerate(serie.data):
159
- x_axis = self.x_axis.data[i]
160
- series.append(
161
- {
162
- 'label': serie.label,
163
- 'color': serie.color,
164
- 'category': x_axis,
165
- 'value': value,
166
- }
167
- )
168
-
169
- return series
170
-
171
- def _render_apexcharts(self) -> Any:
172
- """
173
- Converts the configuration of the chart to Javascript library ApexCharts.
174
- """
175
-
176
- series = []
177
- colors = []
178
- stroke = {'width': [], 'dashArray': []}
179
- markers = []
180
-
181
- for serie in self.y_axis:
182
- modified_serie = {
183
- 'name': serie.label,
184
- }
185
- if serie.serie_type == ChartDataSerieType.SCATTER:
186
- modified_serie['data'] = [{'x': item.x, 'y': item.y} for item in serie.data]
187
- modified_serie['type'] = 'scatter'
188
- stroke['width'].append(0)
189
- markers.append(10)
190
- else:
191
- modified_serie['data'] = [{'x': self.x_axis.data[i], 'y': item} for i, item in enumerate(serie.data)]
192
-
193
- if serie.serie_type is not ChartDataSerieType.NONE:
194
- modified_serie['type'] = serie.serie_type.value
195
- else:
196
- modified_serie['type'] = 'column'
197
-
198
- if serie.dashed and serie.serie_type == ChartDataSerieType.LINE:
199
- stroke['dashArray'].append(5)
200
- else:
201
- stroke['dashArray'].append(0)
202
-
203
- stroke['width'].append(3)
204
- markers.append(0)
205
-
206
- series.append(modified_serie)
207
-
208
- if serie.serie_type == ChartDataSerieType.AREA:
209
- color = convert_to_rgba(serie.color)
210
- colors.append(f'rgba({color[0]}, {color[1]}, {color[2]}, 0.5)')
211
- else:
212
- colors.append(serie.color)
213
-
214
- config = {
215
- 'series': series,
216
- 'colors': colors,
217
- 'xaxis': {
218
- 'type': self.x_axis.data_type.value,
219
- 'title': {
220
- 'text': self.x_axis.label,
221
- 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
222
- },
223
- },
224
- 'dataLabels': {'enabled': False},
225
- 'title': {
226
- 'text': self.title,
227
- 'align': self.align.value,
228
- 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
229
- },
230
- 'markers': {'size': markers},
231
- 'fill': {'type': 'solid'},
232
- 'stroke': stroke,
233
- 'chart': {'animations': {'enabled': False}, 'toolbar': {'show': False}, 'zoom': {'enabled': False}},
234
- }
235
-
236
- return config
1
+ """Column chart"""
2
+
3
+ import sys
4
+ from typing import Any, Dict, List
5
+
6
+ from layrz_sdk.helpers import convert_to_rgba
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
+ from pydantic import BaseModel, Field
19
+
20
+
21
+ class ColumnChart(BaseModel):
22
+ """Column chart configuration"""
23
+
24
+ x_axis: ChartDataSerie = Field(description='Defines the X Axis of the chart')
25
+ y_axis: List[ChartDataSerie] = Field(description='Defines the Y Axis of the chart', default_factory=list)
26
+ title: str = Field(default='Chart', description='Title of the chart')
27
+ align: ChartAlignment = Field(default=ChartAlignment.CENTER, description='Alignment of the title')
28
+ x_axis_config: AxisConfig = Field(
29
+ default_factory=lambda: AxisConfig(),
30
+ description='Configuration of the X Axis',
31
+ )
32
+ y_axis_config: AxisConfig = Field(
33
+ default_factory=lambda: AxisConfig(),
34
+ description='Configuration of the Y Axis',
35
+ )
36
+
37
+ def render(
38
+ self: Self,
39
+ technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
40
+ ) -> Any:
41
+ """
42
+ Render chart to a graphic Library.
43
+ :param technology: The technology to use to render the chart.
44
+ :return: The configuration of the chart.
45
+ """
46
+ if technology == ChartRenderTechnology.GRAPHIC:
47
+ return {
48
+ 'library': 'GRAPHIC',
49
+ 'chart': 'COLUMN',
50
+ 'configuration': self._render_graphic(),
51
+ }
52
+
53
+ if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
54
+ return {
55
+ 'library': 'SYNCFUSION_FLUTTER_CHARTS',
56
+ 'chart': 'COLUMN',
57
+ 'configuration': self._render_syncfusion_flutter_charts(),
58
+ }
59
+
60
+ if technology == ChartRenderTechnology.APEX_CHARTS:
61
+ return {
62
+ 'library': 'APEXCHARTS',
63
+ 'chart': 'COLUMN',
64
+ 'configuration': self._render_apexcharts(),
65
+ }
66
+
67
+ return {
68
+ 'library': 'FLUTTER',
69
+ 'chart': 'TEXT',
70
+ 'configuration': [f'Unsupported {technology}'],
71
+ }
72
+
73
+ def _render_syncfusion_flutter_charts(self: Self) -> Dict[str, Any]:
74
+ """
75
+ Converts the configuration of the chart to Syncfusion Flutter Charts.
76
+ """
77
+ series = []
78
+
79
+ for serie in self.y_axis:
80
+ values = []
81
+ for i, value in enumerate(serie.data):
82
+ x_axis = self.x_axis.data[i]
83
+ values.append({'xAxis': x_axis, 'yAxis': value})
84
+
85
+ series.append(
86
+ {
87
+ 'label': serie.label,
88
+ 'color': serie.color,
89
+ 'values': values,
90
+ }
91
+ )
92
+
93
+ return {
94
+ 'series': series,
95
+ 'xAxis': {
96
+ 'label': self.x_axis_config.label,
97
+ 'measureUnit': self.x_axis_config.measure_unit,
98
+ 'dataType': self.x_axis_config.data_type.value,
99
+ 'minValue': self.x_axis_config.min_value,
100
+ 'maxValue': self.x_axis_config.max_value,
101
+ },
102
+ 'yAxis': {
103
+ 'label': self.y_axis_config.label,
104
+ 'measureUnit': self.y_axis_config.measure_unit,
105
+ 'dataType': self.y_axis_config.data_type.value,
106
+ 'minValue': self.y_axis_config.min_value,
107
+ 'maxValue': self.y_axis_config.max_value,
108
+ },
109
+ }
110
+
111
+ def _render_graphic(self: Self) -> List[Dict[str, Any]]:
112
+ """
113
+ Converts the configuration of the chart to Flutter library graphic.
114
+ """
115
+
116
+ series = []
117
+
118
+ for serie in self.y_axis:
119
+ for i, value in enumerate(serie.data):
120
+ x_axis = self.x_axis.data[i]
121
+ series.append(
122
+ {
123
+ 'label': serie.label,
124
+ 'color': serie.color,
125
+ 'category': x_axis,
126
+ 'value': value,
127
+ }
128
+ )
129
+
130
+ return series
131
+
132
+ def _render_apexcharts(self: Self) -> Dict[str, Any]:
133
+ """
134
+ Converts the configuration of the chart to Javascript library ApexCharts.
135
+ """
136
+
137
+ series = []
138
+ colors = []
139
+ stroke: Dict[str, Any] = {'width': [], 'dashArray': []}
140
+ markers = []
141
+
142
+ for serie in self.y_axis:
143
+ modified_serie: Dict[str, Any] = {
144
+ 'name': serie.label,
145
+ }
146
+ if serie.serie_type == ChartDataSerieType.SCATTER:
147
+ modified_serie['data'] = [{'x': item.x, 'y': item.y} for item in serie.data]
148
+ modified_serie['type'] = 'scatter'
149
+ stroke['width'].append(0)
150
+ markers.append(10)
151
+ else:
152
+ modified_serie['data'] = [{'x': self.x_axis.data[i], 'y': item} for i, item in enumerate(serie.data)]
153
+
154
+ if serie.serie_type is not ChartDataSerieType.NONE:
155
+ modified_serie['type'] = serie.serie_type.value
156
+ else:
157
+ modified_serie['type'] = 'column'
158
+
159
+ if serie.dashed and serie.serie_type == ChartDataSerieType.LINE:
160
+ stroke['dashArray'].append(5)
161
+ else:
162
+ stroke['dashArray'].append(0)
163
+
164
+ stroke['width'].append(3)
165
+ markers.append(0)
166
+
167
+ series.append(modified_serie)
168
+
169
+ if serie.serie_type == ChartDataSerieType.AREA:
170
+ color = convert_to_rgba(serie.color)
171
+ colors.append(f'rgba({color[0]}, {color[1]}, {color[2]}, 0.5)')
172
+ else:
173
+ colors.append(serie.color)
174
+
175
+ config = {
176
+ 'series': series,
177
+ 'colors': colors,
178
+ 'xaxis': {
179
+ 'type': self.x_axis.data_type.value,
180
+ 'title': {
181
+ 'text': self.x_axis.label,
182
+ 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
183
+ },
184
+ },
185
+ 'dataLabels': {'enabled': False},
186
+ 'title': {
187
+ 'text': self.title,
188
+ 'align': self.align.value,
189
+ 'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
190
+ },
191
+ 'markers': {'size': markers},
192
+ 'fill': {'type': 'solid'},
193
+ 'stroke': stroke,
194
+ 'chart': {'animations': {'enabled': False}, 'toolbar': {'show': False}, 'zoom': {'enabled': False}},
195
+ }
196
+
197
+ return config
@@ -0,0 +1,34 @@
1
+ """HTML chart"""
2
+
3
+ import sys
4
+ from typing import Any, Dict
5
+
6
+ from pydantic import BaseModel, Field
7
+
8
+ if sys.version_info >= (3, 11):
9
+ from typing import Self
10
+ else:
11
+ from typing_extensions import Self
12
+
13
+
14
+ class HTMLChart(BaseModel):
15
+ """HTML chart configuration"""
16
+
17
+ content: str = Field(description='HTML content of the chart', default='<p>N/A</p>')
18
+ title: str = Field(description='Title of the chart', default='Chart')
19
+
20
+ def render(self: Self) -> Dict[str, Any]:
21
+ """
22
+ Render chart to a graphic Library.
23
+ :param technology: The technology to use to render the chart.
24
+ :return: The configuration of the chart.
25
+ """
26
+ return {'library': 'HTML', 'configuration': self._render_html()}
27
+
28
+ def _render_html(self: Self) -> Dict[str, Any]:
29
+ """
30
+ Converts the configuration of the chart to HTML render engine.
31
+ """
32
+ config = {'content': self.content, 'title': self.title}
33
+
34
+ return config