layrz-sdk 3.0.14__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.
- layrz_sdk/__init__.py +1 -1
- layrz_sdk/constants.py +5 -0
- layrz_sdk/entities/__init__.py +129 -73
- layrz_sdk/entities/asset.py +71 -0
- layrz_sdk/entities/{general/asset_operation_mode.py → asset_operation_mode.py} +31 -30
- layrz_sdk/entities/broadcast_request.py +12 -0
- layrz_sdk/entities/broadcast_response.py +12 -0
- layrz_sdk/entities/broadcast_result.py +20 -0
- layrz_sdk/entities/{broadcasts/status.py → broadcast_status.py} +28 -27
- layrz_sdk/entities/case.py +47 -0
- layrz_sdk/entities/case_ignored_status.py +26 -0
- layrz_sdk/entities/case_status.py +23 -0
- layrz_sdk/entities/charts/axis_config.py +15 -0
- layrz_sdk/entities/charts/{bar.py → bar_chart.py} +171 -208
- layrz_sdk/entities/charts/chart_alignment.py +27 -0
- layrz_sdk/entities/charts/chart_color.py +44 -0
- layrz_sdk/entities/charts/chart_configuration.py +10 -0
- layrz_sdk/entities/charts/chart_data_serie.py +19 -0
- layrz_sdk/entities/charts/chart_data_serie_type.py +28 -0
- layrz_sdk/entities/charts/chart_data_type.py +27 -0
- layrz_sdk/entities/charts/{render_technology.py → chart_render_technology.py} +30 -29
- layrz_sdk/entities/charts/{column.py → column_chart.py} +197 -236
- layrz_sdk/entities/charts/html_chart.py +34 -0
- layrz_sdk/entities/charts/{line.py → line_chart.py} +244 -282
- layrz_sdk/entities/charts/map_center_type.py +22 -0
- layrz_sdk/entities/charts/map_chart.py +104 -0
- layrz_sdk/entities/charts/map_point.py +22 -0
- layrz_sdk/entities/charts/number_chart.py +50 -0
- layrz_sdk/entities/charts/{pie.py → pie_chart.py} +127 -148
- layrz_sdk/entities/charts/radar_chart.py +77 -0
- layrz_sdk/entities/charts/{radial_bar.py → radial_bar_chart.py} +127 -148
- layrz_sdk/entities/charts/{scatter.py → scatter_chart.py} +206 -290
- layrz_sdk/entities/charts/scatter_serie.py +15 -0
- layrz_sdk/entities/charts/scatter_serie_item.py +8 -0
- layrz_sdk/entities/charts/table_chart.py +50 -0
- layrz_sdk/entities/charts/table_header.py +8 -0
- layrz_sdk/entities/charts/table_row.py +9 -0
- layrz_sdk/entities/charts/timeline_chart.py +75 -0
- layrz_sdk/entities/charts/timeline_serie.py +12 -0
- layrz_sdk/entities/charts/timeline_serie_item.py +12 -0
- layrz_sdk/entities/checkpoint.py +18 -0
- layrz_sdk/entities/comment.py +16 -0
- layrz_sdk/entities/custom_field.py +10 -0
- layrz_sdk/entities/custom_report_page.py +16 -0
- layrz_sdk/entities/device.py +13 -0
- layrz_sdk/entities/event.py +23 -0
- layrz_sdk/entities/geofence.py +11 -0
- layrz_sdk/entities/last_message.py +12 -0
- layrz_sdk/entities/message.py +23 -0
- layrz_sdk/entities/outbound_service.py +10 -0
- layrz_sdk/entities/position.py +101 -0
- layrz_sdk/entities/presence_type.py +16 -0
- layrz_sdk/entities/{reports/report.py → report.py} +257 -286
- layrz_sdk/entities/report_col.py +40 -0
- layrz_sdk/entities/report_configuration.py +8 -0
- layrz_sdk/entities/report_data_type.py +28 -0
- layrz_sdk/entities/{reports/format.py → report_format.py} +27 -26
- layrz_sdk/entities/report_header.py +43 -0
- layrz_sdk/entities/report_page.py +17 -0
- layrz_sdk/entities/report_row.py +28 -0
- layrz_sdk/entities/sensor.py +11 -0
- layrz_sdk/entities/{formatting/text_align.py → text_alignment.py} +26 -25
- layrz_sdk/entities/trigger.py +11 -0
- layrz_sdk/entities/user.py +10 -0
- layrz_sdk/entities/waypoint.py +18 -0
- layrz_sdk/helpers/__init__.py +8 -2
- layrz_sdk/helpers/color.py +41 -45
- layrz_sdk/lcl/__init__.py +7 -2
- layrz_sdk/lcl/core.py +832 -820
- layrz_sdk/py.typed +0 -0
- {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.0.dist-info}/LICENSE +6 -6
- {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.0.dist-info}/METADATA +48 -45
- layrz_sdk-3.1.0.dist-info/RECORD +75 -0
- {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.0.dist-info}/WHEEL +1 -1
- layrz_sdk/entities/broadcasts/__init__.py +0 -6
- layrz_sdk/entities/broadcasts/request.py +0 -30
- layrz_sdk/entities/broadcasts/response.py +0 -30
- layrz_sdk/entities/broadcasts/result.py +0 -53
- layrz_sdk/entities/broadcasts/service.py +0 -28
- layrz_sdk/entities/cases/__init__.py +0 -4
- layrz_sdk/entities/cases/case.py +0 -120
- layrz_sdk/entities/cases/comment.py +0 -37
- layrz_sdk/entities/cases/trigger.py +0 -31
- layrz_sdk/entities/charts/__init__.py +0 -21
- layrz_sdk/entities/charts/alignment.py +0 -26
- layrz_sdk/entities/charts/color.py +0 -38
- layrz_sdk/entities/charts/configuration.py +0 -54
- layrz_sdk/entities/charts/data_type.py +0 -26
- layrz_sdk/entities/charts/exceptions.py +0 -29
- layrz_sdk/entities/charts/html.py +0 -44
- layrz_sdk/entities/charts/map.py +0 -179
- layrz_sdk/entities/charts/number.py +0 -52
- layrz_sdk/entities/charts/radar.py +0 -102
- layrz_sdk/entities/charts/serie.py +0 -56
- layrz_sdk/entities/charts/serie_type.py +0 -27
- layrz_sdk/entities/charts/table.py +0 -74
- layrz_sdk/entities/charts/timeline.py +0 -148
- layrz_sdk/entities/checkpoints/__init__.py +0 -4
- layrz_sdk/entities/checkpoints/checkpoint.py +0 -50
- layrz_sdk/entities/checkpoints/waypoint.py +0 -52
- layrz_sdk/entities/events/__init__.py +0 -2
- layrz_sdk/entities/events/event.py +0 -58
- layrz_sdk/entities/formatting/__init__.py +0 -2
- layrz_sdk/entities/general/__init__.py +0 -9
- layrz_sdk/entities/general/asset.py +0 -72
- layrz_sdk/entities/general/custom_field.py +0 -29
- layrz_sdk/entities/general/device.py +0 -45
- layrz_sdk/entities/general/geofence.py +0 -53
- layrz_sdk/entities/general/sensor.py +0 -31
- layrz_sdk/entities/general/user.py +0 -29
- layrz_sdk/entities/repcom/__init__.py +0 -2
- layrz_sdk/entities/repcom/transaction.py +0 -54
- layrz_sdk/entities/reports/__init__.py +0 -7
- layrz_sdk/entities/reports/col.py +0 -86
- layrz_sdk/entities/reports/header.py +0 -57
- layrz_sdk/entities/reports/page.py +0 -64
- layrz_sdk/entities/reports/row.py +0 -43
- layrz_sdk/entities/telemetry/__init__.py +0 -5
- layrz_sdk/entities/telemetry/last_message.py +0 -41
- layrz_sdk/entities/telemetry/message.py +0 -37
- layrz_sdk/entities/telemetry/position.py +0 -51
- layrz_sdk-3.0.14.dist-info/RECORD +0 -70
- {layrz_sdk-3.0.14.dist-info → layrz_sdk-3.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,208 +1,171 @@
|
|
|
1
|
-
"""Bar chart"""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
from
|
|
7
|
-
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
from .
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
'
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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,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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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}'
|