layrz-sdk 3.1.12__py3-none-any.whl → 3.1.13__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 -5
- layrz_sdk/entities/__init__.py +129 -129
- layrz_sdk/entities/asset.py +60 -60
- layrz_sdk/entities/asset_operation_mode.py +31 -31
- layrz_sdk/entities/broadcast_request.py +12 -12
- layrz_sdk/entities/broadcast_response.py +12 -12
- layrz_sdk/entities/broadcast_result.py +20 -20
- layrz_sdk/entities/broadcast_status.py +28 -28
- layrz_sdk/entities/case.py +48 -48
- layrz_sdk/entities/case_ignored_status.py +26 -26
- layrz_sdk/entities/case_status.py +23 -23
- layrz_sdk/entities/charts/axis_config.py +15 -15
- layrz_sdk/entities/charts/bar_chart.py +175 -175
- layrz_sdk/entities/charts/chart_alignment.py +27 -27
- layrz_sdk/entities/charts/chart_color.py +44 -44
- layrz_sdk/entities/charts/chart_configuration.py +10 -10
- layrz_sdk/entities/charts/chart_data_serie.py +19 -19
- layrz_sdk/entities/charts/chart_data_serie_type.py +28 -28
- layrz_sdk/entities/charts/chart_data_type.py +27 -27
- layrz_sdk/entities/charts/chart_render_technology.py +30 -30
- layrz_sdk/entities/charts/column_chart.py +201 -201
- layrz_sdk/entities/charts/html_chart.py +38 -38
- layrz_sdk/entities/charts/line_chart.py +248 -248
- layrz_sdk/entities/charts/map_center_type.py +22 -22
- layrz_sdk/entities/charts/map_chart.py +108 -108
- layrz_sdk/entities/charts/map_point.py +22 -22
- layrz_sdk/entities/charts/number_chart.py +54 -54
- layrz_sdk/entities/charts/pie_chart.py +131 -131
- layrz_sdk/entities/charts/radar_chart.py +81 -81
- layrz_sdk/entities/charts/radial_bar_chart.py +131 -131
- layrz_sdk/entities/charts/scatter_chart.py +210 -210
- layrz_sdk/entities/charts/scatter_serie.py +13 -13
- layrz_sdk/entities/charts/scatter_serie_item.py +8 -8
- layrz_sdk/entities/charts/table_chart.py +54 -54
- layrz_sdk/entities/charts/table_header.py +8 -8
- layrz_sdk/entities/charts/table_row.py +9 -9
- layrz_sdk/entities/charts/timeline_chart.py +79 -79
- layrz_sdk/entities/charts/timeline_serie.py +10 -10
- layrz_sdk/entities/charts/timeline_serie_item.py +12 -12
- layrz_sdk/entities/checkpoint.py +17 -17
- layrz_sdk/entities/comment.py +16 -16
- layrz_sdk/entities/custom_field.py +10 -10
- layrz_sdk/entities/custom_report_page.py +40 -16
- layrz_sdk/entities/device.py +13 -13
- layrz_sdk/entities/event.py +23 -23
- layrz_sdk/entities/geofence.py +11 -11
- layrz_sdk/entities/last_message.py +12 -12
- layrz_sdk/entities/message.py +23 -23
- layrz_sdk/entities/outbound_service.py +10 -10
- layrz_sdk/entities/position.py +116 -116
- layrz_sdk/entities/presence_type.py +16 -16
- layrz_sdk/entities/report.py +289 -283
- layrz_sdk/entities/report_col.py +40 -40
- layrz_sdk/entities/report_configuration.py +8 -8
- layrz_sdk/entities/report_data_type.py +28 -28
- layrz_sdk/entities/report_format.py +27 -27
- layrz_sdk/entities/report_header.py +43 -43
- layrz_sdk/entities/report_page.py +15 -15
- layrz_sdk/entities/report_row.py +28 -28
- layrz_sdk/entities/sensor.py +11 -11
- layrz_sdk/entities/text_alignment.py +26 -26
- layrz_sdk/entities/trigger.py +11 -11
- layrz_sdk/entities/user.py +10 -10
- layrz_sdk/entities/waypoint.py +18 -18
- layrz_sdk/helpers/__init__.py +5 -5
- layrz_sdk/helpers/color.py +44 -44
- layrz_sdk/lcl/__init__.py +5 -5
- layrz_sdk/lcl/core.py +848 -848
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.13.dist-info}/METADATA +49 -49
- layrz_sdk-3.1.13.dist-info/RECORD +75 -0
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.13.dist-info}/WHEEL +1 -1
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.13.dist-info}/licenses/LICENSE +6 -6
- layrz_sdk-3.1.12.dist-info/RECORD +0 -75
- {layrz_sdk-3.1.12.dist-info → layrz_sdk-3.1.13.dist-info}/top_level.txt +0 -0
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
"""Scatter chart"""
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from typing import Any
|
|
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_type import ChartDataSerieType
|
|
11
|
-
from .chart_render_technology import ChartRenderTechnology
|
|
12
|
-
from .scatter_serie import ScatterSerie
|
|
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 ScatterChart(BaseModel):
|
|
21
|
-
"""Scatter chart configuration"""
|
|
22
|
-
|
|
23
|
-
series: list[ScatterSerie] = Field(description='List of series to be displayed in the chart', default_factory=list)
|
|
24
|
-
title: str = Field(description='Title of the chart', default='Chart')
|
|
25
|
-
align: ChartAlignment = Field(description='Alignment of the chart', default=ChartAlignment.CENTER)
|
|
26
|
-
x_axis_config: AxisConfig = Field(
|
|
27
|
-
default_factory=lambda: AxisConfig(),
|
|
28
|
-
description='Configuration of the X Axis',
|
|
29
|
-
)
|
|
30
|
-
y_axis_config: AxisConfig = Field(
|
|
31
|
-
default_factory=lambda: AxisConfig(),
|
|
32
|
-
description='Configuration of the Y Axis',
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
def render(
|
|
36
|
-
self: Self,
|
|
37
|
-
technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
|
|
38
|
-
) -> dict[str, Any]:
|
|
39
|
-
"""
|
|
40
|
-
Render chart to a graphic Library.
|
|
41
|
-
|
|
42
|
-
:param technology: The technology to use to render the chart.
|
|
43
|
-
:type technology: ChartRenderTechnology
|
|
44
|
-
|
|
45
|
-
:return: The configuration of the chart.
|
|
46
|
-
:rtype: dict[str, Any]
|
|
47
|
-
"""
|
|
48
|
-
if technology == ChartRenderTechnology.GRAPHIC:
|
|
49
|
-
return {
|
|
50
|
-
'library': 'GRAPHIC',
|
|
51
|
-
'chart': 'SCATTER',
|
|
52
|
-
'configuration': self._render_graphic(),
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
|
|
56
|
-
return {
|
|
57
|
-
'library': 'SYNCFUSION_FLUTTER_CHARTS',
|
|
58
|
-
'chart': 'SCATTER',
|
|
59
|
-
'configuration': self._render_syncfusion_flutter_charts(),
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if technology == ChartRenderTechnology.APEX_CHARTS:
|
|
63
|
-
return {
|
|
64
|
-
'library': 'APEXCHARTS',
|
|
65
|
-
'chart': 'SCATTER',
|
|
66
|
-
'configuration': self._render_apexcharts(),
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
'library': 'FLUTTER',
|
|
71
|
-
'chart': 'TEXT',
|
|
72
|
-
'configuration': [f'Unsupported {technology}'],
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
def _render_syncfusion_flutter_charts(self: Self) -> dict[str, Any]:
|
|
76
|
-
"""
|
|
77
|
-
Converts the configuration of the chart to Flutter library Graphic.
|
|
78
|
-
"""
|
|
79
|
-
series = []
|
|
80
|
-
for serie in self.series:
|
|
81
|
-
data = []
|
|
82
|
-
|
|
83
|
-
type_serie = 'SCATTER'
|
|
84
|
-
if serie.serie_type == ChartDataSerieType.SCATTER:
|
|
85
|
-
type_serie = 'SCATTER'
|
|
86
|
-
elif serie.serie_type == ChartDataSerieType.LINE:
|
|
87
|
-
type_serie = 'LINE'
|
|
88
|
-
elif serie.serie_type == ChartDataSerieType.AREA:
|
|
89
|
-
type_serie = 'AREA'
|
|
90
|
-
else:
|
|
91
|
-
continue
|
|
92
|
-
|
|
93
|
-
for item in serie.data:
|
|
94
|
-
if not isinstance(item.x, (int, float)):
|
|
95
|
-
continue
|
|
96
|
-
if not isinstance(item.y, (int, float)):
|
|
97
|
-
continue
|
|
98
|
-
|
|
99
|
-
data.append(
|
|
100
|
-
{
|
|
101
|
-
'xAxis': item.x,
|
|
102
|
-
'yAxis': item.y,
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
series.append(
|
|
107
|
-
{
|
|
108
|
-
'label': serie.label,
|
|
109
|
-
'color': serie.color,
|
|
110
|
-
'values': data,
|
|
111
|
-
'type': type_serie,
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
'series': series,
|
|
117
|
-
'xAxis': {
|
|
118
|
-
'label': self.x_axis_config.label,
|
|
119
|
-
'measureUnit': self.x_axis_config.measure_unit,
|
|
120
|
-
'dataType': self.x_axis_config.data_type.value,
|
|
121
|
-
'minValue': self.x_axis_config.min_value,
|
|
122
|
-
'maxValue': self.x_axis_config.max_value,
|
|
123
|
-
},
|
|
124
|
-
'yAxis': {
|
|
125
|
-
'label': self.y_axis_config.label,
|
|
126
|
-
'measureUnit': self.y_axis_config.measure_unit,
|
|
127
|
-
'dataType': self.y_axis_config.data_type.value,
|
|
128
|
-
'minValue': self.y_axis_config.min_value,
|
|
129
|
-
'maxValue': self.y_axis_config.max_value,
|
|
130
|
-
},
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
def _render_graphic(self: Self) -> list[dict[str, Any]]:
|
|
134
|
-
"""
|
|
135
|
-
Converts the configuration of the chart to Flutter library Graphic.
|
|
136
|
-
"""
|
|
137
|
-
series = []
|
|
138
|
-
for serie in self.series:
|
|
139
|
-
data = []
|
|
140
|
-
|
|
141
|
-
type_serie = 'SCATTER'
|
|
142
|
-
if serie.serie_type == ChartDataSerieType.SCATTER:
|
|
143
|
-
type_serie = 'SCATTER'
|
|
144
|
-
elif serie.serie_type == ChartDataSerieType.LINE:
|
|
145
|
-
type_serie = 'LINE'
|
|
146
|
-
elif serie.serie_type == ChartDataSerieType.AREA:
|
|
147
|
-
type_serie = 'AREA'
|
|
148
|
-
else:
|
|
149
|
-
continue
|
|
150
|
-
|
|
151
|
-
for item in serie.data:
|
|
152
|
-
data.append(
|
|
153
|
-
{
|
|
154
|
-
'x_axis': item.x,
|
|
155
|
-
'y_axis': item.y,
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
series.append(
|
|
160
|
-
{
|
|
161
|
-
'group': serie.label,
|
|
162
|
-
'color': serie.color,
|
|
163
|
-
'values': data,
|
|
164
|
-
'type': type_serie,
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
return series
|
|
169
|
-
|
|
170
|
-
def _render_apexcharts(self: Self) -> dict[str, Any]:
|
|
171
|
-
"""
|
|
172
|
-
Converts the configuration of the chart to Javascript library ApexCharts.
|
|
173
|
-
"""
|
|
174
|
-
|
|
175
|
-
series = []
|
|
176
|
-
colors = []
|
|
177
|
-
|
|
178
|
-
for serie in self.series:
|
|
179
|
-
data = []
|
|
180
|
-
|
|
181
|
-
for item in serie.data:
|
|
182
|
-
data.append([item.x, item.y])
|
|
183
|
-
|
|
184
|
-
series.append(
|
|
185
|
-
{
|
|
186
|
-
'name': serie.label,
|
|
187
|
-
'data': data,
|
|
188
|
-
'type': serie.serie_type.value,
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
colors.append(serie.color)
|
|
192
|
-
|
|
193
|
-
config = {
|
|
194
|
-
'series': series,
|
|
195
|
-
'colors': colors,
|
|
196
|
-
'title': {
|
|
197
|
-
'text': self.title,
|
|
198
|
-
'align': self.align.value,
|
|
199
|
-
'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
|
|
200
|
-
},
|
|
201
|
-
'chart': {
|
|
202
|
-
'type': 'scatter',
|
|
203
|
-
'animations': {'enabled': False},
|
|
204
|
-
'toolbar': {'show': False},
|
|
205
|
-
'zoom': {'enabled': False},
|
|
206
|
-
},
|
|
207
|
-
'dataLabels': {'enabled': True},
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return config
|
|
1
|
+
"""Scatter chart"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from typing import Any
|
|
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_type import ChartDataSerieType
|
|
11
|
+
from .chart_render_technology import ChartRenderTechnology
|
|
12
|
+
from .scatter_serie import ScatterSerie
|
|
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 ScatterChart(BaseModel):
|
|
21
|
+
"""Scatter chart configuration"""
|
|
22
|
+
|
|
23
|
+
series: list[ScatterSerie] = Field(description='List of series to be displayed in the chart', default_factory=list)
|
|
24
|
+
title: str = Field(description='Title of the chart', default='Chart')
|
|
25
|
+
align: ChartAlignment = Field(description='Alignment of the chart', default=ChartAlignment.CENTER)
|
|
26
|
+
x_axis_config: AxisConfig = Field(
|
|
27
|
+
default_factory=lambda: AxisConfig(),
|
|
28
|
+
description='Configuration of the X Axis',
|
|
29
|
+
)
|
|
30
|
+
y_axis_config: AxisConfig = Field(
|
|
31
|
+
default_factory=lambda: AxisConfig(),
|
|
32
|
+
description='Configuration of the Y Axis',
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def render(
|
|
36
|
+
self: Self,
|
|
37
|
+
technology: ChartRenderTechnology = ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS,
|
|
38
|
+
) -> dict[str, Any]:
|
|
39
|
+
"""
|
|
40
|
+
Render chart to a graphic Library.
|
|
41
|
+
|
|
42
|
+
:param technology: The technology to use to render the chart.
|
|
43
|
+
:type technology: ChartRenderTechnology
|
|
44
|
+
|
|
45
|
+
:return: The configuration of the chart.
|
|
46
|
+
:rtype: dict[str, Any]
|
|
47
|
+
"""
|
|
48
|
+
if technology == ChartRenderTechnology.GRAPHIC:
|
|
49
|
+
return {
|
|
50
|
+
'library': 'GRAPHIC',
|
|
51
|
+
'chart': 'SCATTER',
|
|
52
|
+
'configuration': self._render_graphic(),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if technology == ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS:
|
|
56
|
+
return {
|
|
57
|
+
'library': 'SYNCFUSION_FLUTTER_CHARTS',
|
|
58
|
+
'chart': 'SCATTER',
|
|
59
|
+
'configuration': self._render_syncfusion_flutter_charts(),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if technology == ChartRenderTechnology.APEX_CHARTS:
|
|
63
|
+
return {
|
|
64
|
+
'library': 'APEXCHARTS',
|
|
65
|
+
'chart': 'SCATTER',
|
|
66
|
+
'configuration': self._render_apexcharts(),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
'library': 'FLUTTER',
|
|
71
|
+
'chart': 'TEXT',
|
|
72
|
+
'configuration': [f'Unsupported {technology}'],
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
def _render_syncfusion_flutter_charts(self: Self) -> dict[str, Any]:
|
|
76
|
+
"""
|
|
77
|
+
Converts the configuration of the chart to Flutter library Graphic.
|
|
78
|
+
"""
|
|
79
|
+
series = []
|
|
80
|
+
for serie in self.series:
|
|
81
|
+
data = []
|
|
82
|
+
|
|
83
|
+
type_serie = 'SCATTER'
|
|
84
|
+
if serie.serie_type == ChartDataSerieType.SCATTER:
|
|
85
|
+
type_serie = 'SCATTER'
|
|
86
|
+
elif serie.serie_type == ChartDataSerieType.LINE:
|
|
87
|
+
type_serie = 'LINE'
|
|
88
|
+
elif serie.serie_type == ChartDataSerieType.AREA:
|
|
89
|
+
type_serie = 'AREA'
|
|
90
|
+
else:
|
|
91
|
+
continue
|
|
92
|
+
|
|
93
|
+
for item in serie.data:
|
|
94
|
+
if not isinstance(item.x, (int, float)):
|
|
95
|
+
continue
|
|
96
|
+
if not isinstance(item.y, (int, float)):
|
|
97
|
+
continue
|
|
98
|
+
|
|
99
|
+
data.append(
|
|
100
|
+
{
|
|
101
|
+
'xAxis': item.x,
|
|
102
|
+
'yAxis': item.y,
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
series.append(
|
|
107
|
+
{
|
|
108
|
+
'label': serie.label,
|
|
109
|
+
'color': serie.color,
|
|
110
|
+
'values': data,
|
|
111
|
+
'type': type_serie,
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
'series': series,
|
|
117
|
+
'xAxis': {
|
|
118
|
+
'label': self.x_axis_config.label,
|
|
119
|
+
'measureUnit': self.x_axis_config.measure_unit,
|
|
120
|
+
'dataType': self.x_axis_config.data_type.value,
|
|
121
|
+
'minValue': self.x_axis_config.min_value,
|
|
122
|
+
'maxValue': self.x_axis_config.max_value,
|
|
123
|
+
},
|
|
124
|
+
'yAxis': {
|
|
125
|
+
'label': self.y_axis_config.label,
|
|
126
|
+
'measureUnit': self.y_axis_config.measure_unit,
|
|
127
|
+
'dataType': self.y_axis_config.data_type.value,
|
|
128
|
+
'minValue': self.y_axis_config.min_value,
|
|
129
|
+
'maxValue': self.y_axis_config.max_value,
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
def _render_graphic(self: Self) -> list[dict[str, Any]]:
|
|
134
|
+
"""
|
|
135
|
+
Converts the configuration of the chart to Flutter library Graphic.
|
|
136
|
+
"""
|
|
137
|
+
series = []
|
|
138
|
+
for serie in self.series:
|
|
139
|
+
data = []
|
|
140
|
+
|
|
141
|
+
type_serie = 'SCATTER'
|
|
142
|
+
if serie.serie_type == ChartDataSerieType.SCATTER:
|
|
143
|
+
type_serie = 'SCATTER'
|
|
144
|
+
elif serie.serie_type == ChartDataSerieType.LINE:
|
|
145
|
+
type_serie = 'LINE'
|
|
146
|
+
elif serie.serie_type == ChartDataSerieType.AREA:
|
|
147
|
+
type_serie = 'AREA'
|
|
148
|
+
else:
|
|
149
|
+
continue
|
|
150
|
+
|
|
151
|
+
for item in serie.data:
|
|
152
|
+
data.append(
|
|
153
|
+
{
|
|
154
|
+
'x_axis': item.x,
|
|
155
|
+
'y_axis': item.y,
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
series.append(
|
|
160
|
+
{
|
|
161
|
+
'group': serie.label,
|
|
162
|
+
'color': serie.color,
|
|
163
|
+
'values': data,
|
|
164
|
+
'type': type_serie,
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
return series
|
|
169
|
+
|
|
170
|
+
def _render_apexcharts(self: Self) -> dict[str, Any]:
|
|
171
|
+
"""
|
|
172
|
+
Converts the configuration of the chart to Javascript library ApexCharts.
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
series = []
|
|
176
|
+
colors = []
|
|
177
|
+
|
|
178
|
+
for serie in self.series:
|
|
179
|
+
data = []
|
|
180
|
+
|
|
181
|
+
for item in serie.data:
|
|
182
|
+
data.append([item.x, item.y])
|
|
183
|
+
|
|
184
|
+
series.append(
|
|
185
|
+
{
|
|
186
|
+
'name': serie.label,
|
|
187
|
+
'data': data,
|
|
188
|
+
'type': serie.serie_type.value,
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
colors.append(serie.color)
|
|
192
|
+
|
|
193
|
+
config = {
|
|
194
|
+
'series': series,
|
|
195
|
+
'colors': colors,
|
|
196
|
+
'title': {
|
|
197
|
+
'text': self.title,
|
|
198
|
+
'align': self.align.value,
|
|
199
|
+
'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
|
|
200
|
+
},
|
|
201
|
+
'chart': {
|
|
202
|
+
'type': 'scatter',
|
|
203
|
+
'animations': {'enabled': False},
|
|
204
|
+
'toolbar': {'show': False},
|
|
205
|
+
'zoom': {'enabled': False},
|
|
206
|
+
},
|
|
207
|
+
'dataLabels': {'enabled': True},
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return config
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
|
|
3
|
-
from .chart_data_serie_type import ChartDataSerieType
|
|
4
|
-
from .scatter_serie_item import ScatterSerieItem
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ScatterSerie(BaseModel):
|
|
8
|
-
"""Chart Data Serie for Timeline charts"""
|
|
9
|
-
|
|
10
|
-
data: list[ScatterSerieItem] = Field(description='List of data points', default_factory=list)
|
|
11
|
-
color: str = Field(description='Color of the serie', default='')
|
|
12
|
-
label: str = Field(description='Label of the serie', default='')
|
|
13
|
-
serie_type: ChartDataSerieType = Field(description='Type of the serie', default=ChartDataSerieType.SCATTER)
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
|
|
3
|
+
from .chart_data_serie_type import ChartDataSerieType
|
|
4
|
+
from .scatter_serie_item import ScatterSerieItem
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ScatterSerie(BaseModel):
|
|
8
|
+
"""Chart Data Serie for Timeline charts"""
|
|
9
|
+
|
|
10
|
+
data: list[ScatterSerieItem] = Field(description='List of data points', default_factory=list)
|
|
11
|
+
color: str = Field(description='Color of the serie', default='')
|
|
12
|
+
label: str = Field(description='Label of the serie', default='')
|
|
13
|
+
serie_type: ChartDataSerieType = Field(description='Type of the serie', default=ChartDataSerieType.SCATTER)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class ScatterSerieItem(BaseModel):
|
|
5
|
-
"""Chart Data Serie Item for Scatter Charts"""
|
|
6
|
-
|
|
7
|
-
x: float = Field(description='X value of the item')
|
|
8
|
-
y: float = Field(description='Y value of the item')
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ScatterSerieItem(BaseModel):
|
|
5
|
+
"""Chart Data Serie Item for Scatter Charts"""
|
|
6
|
+
|
|
7
|
+
x: float = Field(description='X value of the item')
|
|
8
|
+
y: float = Field(description='Y value of the item')
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"""Number chart"""
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
|
-
from .chart_render_technology import ChartRenderTechnology
|
|
9
|
-
from .table_header import TableHeader
|
|
10
|
-
from .table_row import TableRow
|
|
11
|
-
|
|
12
|
-
if sys.version_info >= (3, 11):
|
|
13
|
-
from typing import Self
|
|
14
|
-
else:
|
|
15
|
-
from typing_extensions import Self
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class TableChart(BaseModel):
|
|
19
|
-
"""Table chart configuration"""
|
|
20
|
-
|
|
21
|
-
columns: list[TableHeader] = Field(description='List of columns', default_factory=list)
|
|
22
|
-
rows: list[TableRow] = Field(description='List of rows', default_factory=list)
|
|
23
|
-
|
|
24
|
-
def render(self: Self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER) -> dict[str, Any]:
|
|
25
|
-
"""
|
|
26
|
-
Render chart to a graphic Library.
|
|
27
|
-
|
|
28
|
-
:param technology: The technology to use to render the chart.
|
|
29
|
-
:type technology: ChartRenderTechnology
|
|
30
|
-
|
|
31
|
-
:return: The configuration of the chart.
|
|
32
|
-
:rtype: dict[str, Any]
|
|
33
|
-
"""
|
|
34
|
-
if technology == ChartRenderTechnology.FLUTTER:
|
|
35
|
-
return {
|
|
36
|
-
'library': 'FLUTTER',
|
|
37
|
-
'chart': 'TABLE',
|
|
38
|
-
'configuration': self._render_flutter(),
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
'library': 'FLUTTER',
|
|
43
|
-
'chart': 'TEXT',
|
|
44
|
-
'configuration': [f'Unsupported {technology}'],
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
def _render_flutter(self: Self) -> dict[str, Any]:
|
|
48
|
-
"""
|
|
49
|
-
Converts the configuration of the chart to a Flutter native components.
|
|
50
|
-
"""
|
|
51
|
-
return {
|
|
52
|
-
'columns': [{'key': column.key, 'label': column.label} for column in self.columns],
|
|
53
|
-
'rows': [{'data': row.data} for row in self.rows],
|
|
54
|
-
}
|
|
1
|
+
"""Number chart"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
from .chart_render_technology import ChartRenderTechnology
|
|
9
|
+
from .table_header import TableHeader
|
|
10
|
+
from .table_row import TableRow
|
|
11
|
+
|
|
12
|
+
if sys.version_info >= (3, 11):
|
|
13
|
+
from typing import Self
|
|
14
|
+
else:
|
|
15
|
+
from typing_extensions import Self
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TableChart(BaseModel):
|
|
19
|
+
"""Table chart configuration"""
|
|
20
|
+
|
|
21
|
+
columns: list[TableHeader] = Field(description='List of columns', default_factory=list)
|
|
22
|
+
rows: list[TableRow] = Field(description='List of rows', default_factory=list)
|
|
23
|
+
|
|
24
|
+
def render(self: Self, technology: ChartRenderTechnology = ChartRenderTechnology.FLUTTER) -> dict[str, Any]:
|
|
25
|
+
"""
|
|
26
|
+
Render chart to a graphic Library.
|
|
27
|
+
|
|
28
|
+
:param technology: The technology to use to render the chart.
|
|
29
|
+
:type technology: ChartRenderTechnology
|
|
30
|
+
|
|
31
|
+
:return: The configuration of the chart.
|
|
32
|
+
:rtype: dict[str, Any]
|
|
33
|
+
"""
|
|
34
|
+
if technology == ChartRenderTechnology.FLUTTER:
|
|
35
|
+
return {
|
|
36
|
+
'library': 'FLUTTER',
|
|
37
|
+
'chart': 'TABLE',
|
|
38
|
+
'configuration': self._render_flutter(),
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
'library': 'FLUTTER',
|
|
43
|
+
'chart': 'TEXT',
|
|
44
|
+
'configuration': [f'Unsupported {technology}'],
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
def _render_flutter(self: Self) -> dict[str, Any]:
|
|
48
|
+
"""
|
|
49
|
+
Converts the configuration of the chart to a Flutter native components.
|
|
50
|
+
"""
|
|
51
|
+
return {
|
|
52
|
+
'columns': [{'key': column.key, 'label': column.label} for column in self.columns],
|
|
53
|
+
'rows': [{'data': row.data} for row in self.rows],
|
|
54
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class TableHeader(BaseModel):
|
|
5
|
-
"""Table header chart configuration"""
|
|
6
|
-
|
|
7
|
-
label: str = Field(description='Label of the header')
|
|
8
|
-
key: str = Field(description='Key of the header')
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TableHeader(BaseModel):
|
|
5
|
+
"""Table header chart configuration"""
|
|
6
|
+
|
|
7
|
+
label: str = Field(description='Label of the header')
|
|
8
|
+
key: str = Field(description='Key of the header')
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TableRow(BaseModel):
|
|
7
|
-
"""Table row chart configuration"""
|
|
8
|
-
|
|
9
|
-
data: Any = Field(description='Data of the row')
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TableRow(BaseModel):
|
|
7
|
+
"""Table row chart configuration"""
|
|
8
|
+
|
|
9
|
+
data: Any = Field(description='Data of the row')
|