layrz-sdk 3.1.2__py3-none-any.whl → 3.1.3__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 (75) hide show
  1. layrz_sdk/__init__.py +1 -1
  2. layrz_sdk/constants.py +5 -5
  3. layrz_sdk/entities/__init__.py +129 -129
  4. layrz_sdk/entities/asset.py +69 -71
  5. layrz_sdk/entities/asset_operation_mode.py +31 -31
  6. layrz_sdk/entities/broadcast_request.py +12 -12
  7. layrz_sdk/entities/broadcast_response.py +12 -12
  8. layrz_sdk/entities/broadcast_result.py +20 -20
  9. layrz_sdk/entities/broadcast_status.py +28 -28
  10. layrz_sdk/entities/case.py +47 -47
  11. layrz_sdk/entities/case_ignored_status.py +26 -26
  12. layrz_sdk/entities/case_status.py +23 -23
  13. layrz_sdk/entities/charts/axis_config.py +15 -15
  14. layrz_sdk/entities/charts/bar_chart.py +171 -171
  15. layrz_sdk/entities/charts/chart_alignment.py +27 -27
  16. layrz_sdk/entities/charts/chart_color.py +44 -44
  17. layrz_sdk/entities/charts/chart_configuration.py +10 -10
  18. layrz_sdk/entities/charts/chart_data_serie.py +19 -19
  19. layrz_sdk/entities/charts/chart_data_serie_type.py +28 -28
  20. layrz_sdk/entities/charts/chart_data_type.py +27 -27
  21. layrz_sdk/entities/charts/chart_render_technology.py +30 -30
  22. layrz_sdk/entities/charts/column_chart.py +197 -197
  23. layrz_sdk/entities/charts/html_chart.py +34 -34
  24. layrz_sdk/entities/charts/line_chart.py +244 -244
  25. layrz_sdk/entities/charts/map_center_type.py +22 -22
  26. layrz_sdk/entities/charts/map_chart.py +104 -104
  27. layrz_sdk/entities/charts/map_point.py +22 -22
  28. layrz_sdk/entities/charts/number_chart.py +50 -50
  29. layrz_sdk/entities/charts/pie_chart.py +127 -127
  30. layrz_sdk/entities/charts/radar_chart.py +77 -77
  31. layrz_sdk/entities/charts/radial_bar_chart.py +127 -127
  32. layrz_sdk/entities/charts/scatter_chart.py +206 -206
  33. layrz_sdk/entities/charts/scatter_serie.py +15 -15
  34. layrz_sdk/entities/charts/scatter_serie_item.py +8 -8
  35. layrz_sdk/entities/charts/table_chart.py +50 -50
  36. layrz_sdk/entities/charts/table_header.py +8 -8
  37. layrz_sdk/entities/charts/table_row.py +9 -9
  38. layrz_sdk/entities/charts/timeline_chart.py +75 -75
  39. layrz_sdk/entities/charts/timeline_serie.py +12 -12
  40. layrz_sdk/entities/charts/timeline_serie_item.py +12 -12
  41. layrz_sdk/entities/checkpoint.py +18 -18
  42. layrz_sdk/entities/comment.py +16 -16
  43. layrz_sdk/entities/custom_field.py +10 -10
  44. layrz_sdk/entities/custom_report_page.py +16 -16
  45. layrz_sdk/entities/device.py +13 -13
  46. layrz_sdk/entities/event.py +23 -23
  47. layrz_sdk/entities/geofence.py +11 -11
  48. layrz_sdk/entities/last_message.py +12 -12
  49. layrz_sdk/entities/message.py +23 -23
  50. layrz_sdk/entities/outbound_service.py +10 -10
  51. layrz_sdk/entities/position.py +101 -101
  52. layrz_sdk/entities/presence_type.py +16 -16
  53. layrz_sdk/entities/report.py +257 -257
  54. layrz_sdk/entities/report_col.py +40 -40
  55. layrz_sdk/entities/report_configuration.py +8 -8
  56. layrz_sdk/entities/report_data_type.py +28 -28
  57. layrz_sdk/entities/report_format.py +27 -27
  58. layrz_sdk/entities/report_header.py +43 -43
  59. layrz_sdk/entities/report_page.py +17 -17
  60. layrz_sdk/entities/report_row.py +28 -28
  61. layrz_sdk/entities/sensor.py +11 -11
  62. layrz_sdk/entities/text_alignment.py +26 -26
  63. layrz_sdk/entities/trigger.py +11 -11
  64. layrz_sdk/entities/user.py +10 -10
  65. layrz_sdk/entities/waypoint.py +18 -18
  66. layrz_sdk/helpers/__init__.py +8 -8
  67. layrz_sdk/helpers/color.py +41 -41
  68. layrz_sdk/lcl/__init__.py +7 -7
  69. layrz_sdk/lcl/core.py +832 -832
  70. {layrz_sdk-3.1.2.dist-info → layrz_sdk-3.1.3.dist-info}/LICENSE +6 -6
  71. {layrz_sdk-3.1.2.dist-info → layrz_sdk-3.1.3.dist-info}/METADATA +48 -48
  72. layrz_sdk-3.1.3.dist-info/RECORD +75 -0
  73. {layrz_sdk-3.1.2.dist-info → layrz_sdk-3.1.3.dist-info}/WHEEL +1 -1
  74. layrz_sdk-3.1.2.dist-info/RECORD +0 -75
  75. {layrz_sdk-3.1.2.dist-info → layrz_sdk-3.1.3.dist-info}/top_level.txt +0 -0
@@ -1,47 +1,47 @@
1
- """Events entities"""
2
- import sys
3
- from datetime import datetime
4
- from typing import Any, Dict, List, Optional
5
-
6
- from pydantic import BaseModel, Field, model_validator
7
-
8
- from .case_ignored_status import CaseIgnoredStatus
9
- from .case_status import CaseStatus
10
- from .comment import Comment
11
- from .trigger import Trigger
12
-
13
- if sys.version_info >= (3, 11):
14
- from typing import Self
15
- else:
16
- from typing_extensions import Self
17
-
18
-
19
- class Case(BaseModel):
20
- """Case entity"""
21
-
22
- pk: int = Field(description='Defines the primary key of the case')
23
- trigger: Trigger = Field(description='Defines the trigger of the case')
24
- asset_id: int = Field(description='Defines the asset ID of the case')
25
- comments: List[Comment] = Field(default_factory=list, description='Defines the comments of the case')
26
- opened_at: datetime = Field(description='Defines the date when the case was opened')
27
- closed_at: Optional[datetime] = Field(default=None, description='Defines the date when the case was closed')
28
- status: CaseStatus = Field(description='Defines the status of the case', default=CaseStatus.CLOSED)
29
- ignored_status: CaseIgnoredStatus = Field(
30
- description='Defines the ignored status of the case',
31
- default=CaseIgnoredStatus.NORMAL,
32
- )
33
- sequence: Optional[int | str] = Field(
34
- default=None,
35
- description='Defines the sequence of the case. This is a unique identifier for the case',
36
- )
37
-
38
- @model_validator(mode='before')
39
- def _validate_model(cls: Self, data: Dict[str, Any]) -> Dict[str, Any]:
40
- """Validate model"""
41
- sequence = data.get('sequence')
42
- if sequence is not None and isinstance(sequence, int):
43
- data['sequence'] = f'{data["trigger"].code}/{sequence}'
44
- else:
45
- data['sequence'] = f'GENERIC/{data["pk"]}'
46
-
47
- return data
1
+ """Events entities"""
2
+ import sys
3
+ from datetime import datetime
4
+ from typing import Any, Dict, List, Optional
5
+
6
+ from pydantic import BaseModel, Field, model_validator
7
+
8
+ from .case_ignored_status import CaseIgnoredStatus
9
+ from .case_status import CaseStatus
10
+ from .comment import Comment
11
+ from .trigger import Trigger
12
+
13
+ if sys.version_info >= (3, 11):
14
+ from typing import Self
15
+ else:
16
+ from typing_extensions import Self
17
+
18
+
19
+ class Case(BaseModel):
20
+ """Case entity"""
21
+
22
+ pk: int = Field(description='Defines the primary key of the case')
23
+ trigger: Trigger = Field(description='Defines the trigger of the case')
24
+ asset_id: int = Field(description='Defines the asset ID of the case')
25
+ comments: List[Comment] = Field(default_factory=list, description='Defines the comments of the case')
26
+ opened_at: datetime = Field(description='Defines the date when the case was opened')
27
+ closed_at: Optional[datetime] = Field(default=None, description='Defines the date when the case was closed')
28
+ status: CaseStatus = Field(description='Defines the status of the case', default=CaseStatus.CLOSED)
29
+ ignored_status: CaseIgnoredStatus = Field(
30
+ description='Defines the ignored status of the case',
31
+ default=CaseIgnoredStatus.NORMAL,
32
+ )
33
+ sequence: Optional[int | str] = Field(
34
+ default=None,
35
+ description='Defines the sequence of the case. This is a unique identifier for the case',
36
+ )
37
+
38
+ @model_validator(mode='before')
39
+ def _validate_model(cls: Self, data: Dict[str, Any]) -> Dict[str, Any]:
40
+ """Validate model"""
41
+ sequence = data.get('sequence')
42
+ if sequence is not None and isinstance(sequence, int):
43
+ data['sequence'] = f'{data["trigger"].code}/{sequence}'
44
+ else:
45
+ data['sequence'] = f'GENERIC/{data["pk"]}'
46
+
47
+ return data
@@ -1,26 +1,26 @@
1
- import sys
2
- from enum import Enum
3
-
4
- if sys.version_info >= (3, 11):
5
- from typing import Self
6
- else:
7
- from typing_extensions import Self
8
-
9
-
10
- class CaseIgnoredStatus(Enum):
11
- """
12
- Case ignore status, will define what kind ignore happened.
13
- """
14
-
15
- NORMAL = 'NORMAL'
16
- IGNORED = 'IGNORED'
17
- PRESET = 'PRESET'
18
- AUTO = 'AUTO'
19
-
20
- def __str__(self: Self) -> str:
21
- """Readable property"""
22
- return self.name
23
-
24
- def __repr__(self: Self) -> str:
25
- """Readable property"""
26
- return f'CaseIgnoredStatus.{self.name}'
1
+ import sys
2
+ from enum import Enum
3
+
4
+ if sys.version_info >= (3, 11):
5
+ from typing import Self
6
+ else:
7
+ from typing_extensions import Self
8
+
9
+
10
+ class CaseIgnoredStatus(Enum):
11
+ """
12
+ Case ignore status, will define what kind ignore happened.
13
+ """
14
+
15
+ NORMAL = 'NORMAL'
16
+ IGNORED = 'IGNORED'
17
+ PRESET = 'PRESET'
18
+ AUTO = 'AUTO'
19
+
20
+ def __str__(self: Self) -> str:
21
+ """Readable property"""
22
+ return self.name
23
+
24
+ def __repr__(self: Self) -> str:
25
+ """Readable property"""
26
+ return f'CaseIgnoredStatus.{self.name}'
@@ -1,23 +1,23 @@
1
- import sys
2
- from enum import Enum
3
-
4
- if sys.version_info >= (3, 11):
5
- from typing import Self
6
- else:
7
- from typing_extensions import Self
8
-
9
-
10
- class CaseStatus(Enum):
11
- """Case status enum"""
12
-
13
- PENDING = 'PENDING'
14
- FOLLOWED = 'FOLLOWED'
15
- CLOSED = 'CLOSED'
16
-
17
- def __str__(self: Self) -> str:
18
- """Readable property"""
19
- return self.name
20
-
21
- def __repr__(self: Self) -> str:
22
- """Readable property"""
23
- return f'CaseStatus.{self.name}'
1
+ import sys
2
+ from enum import Enum
3
+
4
+ if sys.version_info >= (3, 11):
5
+ from typing import Self
6
+ else:
7
+ from typing_extensions import Self
8
+
9
+
10
+ class CaseStatus(Enum):
11
+ """Case status enum"""
12
+
13
+ PENDING = 'PENDING'
14
+ FOLLOWED = 'FOLLOWED'
15
+ CLOSED = 'CLOSED'
16
+
17
+ def __str__(self: Self) -> str:
18
+ """Readable property"""
19
+ return self.name
20
+
21
+ def __repr__(self: Self) -> str:
22
+ """Readable property"""
23
+ return f'CaseStatus.{self.name}'
@@ -1,15 +1,15 @@
1
- from typing import Optional
2
-
3
- from pydantic import BaseModel, Field
4
-
5
- from .chart_data_type import ChartDataType
6
-
7
-
8
- class AxisConfig(BaseModel):
9
- """Axis configuration"""
10
-
11
- label: str = Field(default='', description='Label of the axis')
12
- measure_unit: str = Field(default='', description='Measure unit of the axis')
13
- min_value: Optional[float] = Field(default=None, description='Minimum value of the axis')
14
- max_value: Optional[float] = Field(default=None, description='Maximum value of the axis')
15
- data_type: ChartDataType = Field(default=ChartDataType.DATETIME, description='Data type of the axis')
1
+ from typing import Optional
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from .chart_data_type import ChartDataType
6
+
7
+
8
+ class AxisConfig(BaseModel):
9
+ """Axis configuration"""
10
+
11
+ label: str = Field(default='', description='Label of the axis')
12
+ measure_unit: str = Field(default='', description='Measure unit of the axis')
13
+ min_value: Optional[float] = Field(default=None, description='Minimum value of the axis')
14
+ max_value: Optional[float] = Field(default=None, description='Maximum value of the axis')
15
+ data_type: ChartDataType = Field(default=ChartDataType.DATETIME, description='Data type of the axis')
@@ -1,171 +1,171 @@
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
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
@@ -1,27 +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}'
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}'