thecore_ui_commons 3.2.3 → 3.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 701e53633008dcb66db88ad1a92ecccd70650a7f0baa25b705594c9eec412db4
4
- data.tar.gz: 8658b31d7f6eb144c8e3228c0304cc32c826f6181ecc4b2019f4126c1b18aa4e
3
+ metadata.gz: 26b9472612777418bfe9a37c644662f6d90dbfd6d6599ff5ca73a15693bbbc47
4
+ data.tar.gz: ce8e60bec7a4211ba712d966192fc29702fc206a55661dd324787470da2523af
5
5
  SHA512:
6
- metadata.gz: 9bb4bd9d27c0e5e6b0b88feea4233d38adc1d3746d40d1a073050763040bc52d6cb5778ab4b08a3aa51f1dada1d9a1cce401a3a333de56627a42fc9ab30a7661
7
- data.tar.gz: 2824c851e38cef0a4ac0560ca3e5c83c512a416748941170b7b12f4b6004ad7fb507b52d9b9b3205ac5ed609203feb22aca5d29a85d8d356668cce13cd3638fb
6
+ metadata.gz: 94c9bf707dd6d139766364c12a783e8907ec2fde3ae73eaefed2943022a730111ba3f1b11958d2b8d38e28b4898689d3d77e97d10588b611959b70282f2ce082
7
+ data.tar.gz: a74426cedb97ed25919634fe4906e5fd89644d45aadd302f5c9c729f0dd68a48dbcb3d363fc8183ff5841cd994d3024c62e039e1f570779112773ba92a8ca4ce
@@ -0,0 +1,40 @@
1
+ module Echarts
2
+ module Binary
3
+ def self.get_config(value, title, subtitle, yLabel)
4
+ {
5
+ grid: {
6
+ top: 80,
7
+ },
8
+ title: {
9
+ text: title,
10
+ subtext: subtitle,
11
+ },
12
+ toolbox: {
13
+ feature: {
14
+ saveAsImage: {},
15
+ },
16
+ },
17
+ tooltip: {
18
+ trigger: "axis",
19
+ },
20
+ series: [
21
+ {
22
+ name: 'Alert',
23
+ type: 'pie',
24
+ radius: '50%',
25
+ data: [
26
+ { value: value, name: yLabel, itemStyle: { color: value == 0 ? 'limegreen' : 'tomato' } },
27
+ ],
28
+ emphasis: {
29
+ itemStyle: {
30
+ shadowBlur: 10,
31
+ shadowOffsetX: 0,
32
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
33
+ }
34
+ },
35
+ },
36
+ ],
37
+ }
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,46 @@
1
+ module Echarts
2
+ module BinarySeries
3
+ def self.get_config(x, values, title, subtitle, xLabel, yLabel)
4
+ Rails.logger.debug("X: #{x}\nValues: #{values}")
5
+ {
6
+ grid: {
7
+ top: 80,
8
+ },
9
+ title: {
10
+ text: title,
11
+ subtext: subtitle,
12
+ },
13
+ toolbox: {
14
+ feature: {
15
+ saveAsImage: {},
16
+ dataView: {},
17
+ dataZoom: {},
18
+ restore: {},
19
+ },
20
+ },
21
+ tooltip: {
22
+ trigger: "axis",
23
+ },
24
+ xAxis: {
25
+ type: "category",
26
+ data: x,
27
+ name: xLabel,
28
+ },
29
+ yAxis: {
30
+ type: "value",
31
+ name: yLabel
32
+ },
33
+ # Data series is always 1 for each element in x array
34
+ # The color of the bar (the graph is a bargraph) depends
35
+ # on the value, if it's 1, then it's red, otherwise it's green
36
+ series: [
37
+ {
38
+ name: "Values",
39
+ data: x.map.with_index { |_, index| { value: 1, itemStyle: { color: values[index].to_i == 1 ? 'tomato' : 'limegreen' } } },
40
+ type: "bar"
41
+ },
42
+ ],
43
+ }
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,161 @@
1
+ module Echarts
2
+ module Map
3
+ def self.get_config coordinates, title
4
+ # coordinates is an array of two elements arrays, each element is a coordinate in lat, long format.
5
+ # Example: [[lat1, long1, injested_at], [lat2, long2, injested_at], ...]
6
+ # Create the lines array, which is an array of objects with the coordinates of the start and end of the line, and with label the injested_at value
7
+ lines = coordinates.each_cons(2).map do |(start, finish)|
8
+ {
9
+ coords: [start[0..1], finish[0..1]],
10
+ lineStyle: {
11
+ color: 'purple',
12
+ opacity: 0.6,
13
+ width: 1
14
+ },
15
+ label: {
16
+ show: true,
17
+ formatter: finish[2]
18
+ }
19
+ }
20
+ end
21
+
22
+ {
23
+ backgroundColor: 'transparent',
24
+ bmap: {
25
+ center: [120.13066322374, 30.240018034923],
26
+ zoom: 14,
27
+ roam: true,
28
+ mapStyle: {
29
+ styleJson: [
30
+ {
31
+ featureType: 'water',
32
+ elementType: 'all',
33
+ stylers: {
34
+ color: '#d1d1d1'
35
+ }
36
+ },
37
+ {
38
+ featureType: 'land',
39
+ elementType: 'all',
40
+ stylers: {
41
+ color: '#f3f3f3'
42
+ }
43
+ },
44
+ {
45
+ featureType: 'railway',
46
+ elementType: 'all',
47
+ stylers: {
48
+ visibility: 'off'
49
+ }
50
+ },
51
+ {
52
+ featureType: 'highway',
53
+ elementType: 'all',
54
+ stylers: {
55
+ color: '#fdfdfd'
56
+ }
57
+ },
58
+ {
59
+ featureType: 'highway',
60
+ elementType: 'labels',
61
+ stylers: {
62
+ visibility: 'off'
63
+ }
64
+ },
65
+ {
66
+ featureType: 'arterial',
67
+ elementType: 'geometry',
68
+ stylers: {
69
+ color: '#fefefe'
70
+ }
71
+ },
72
+ {
73
+ featureType: 'arterial',
74
+ elementType: 'geometry.fill',
75
+ stylers: {
76
+ color: '#fefefe'
77
+ }
78
+ },
79
+ {
80
+ featureType: 'poi',
81
+ elementType: 'all',
82
+ stylers: {
83
+ visibility: 'off'
84
+ }
85
+ },
86
+ {
87
+ featureType: 'green',
88
+ elementType: 'all',
89
+ stylers: {
90
+ visibility: 'off'
91
+ }
92
+ },
93
+ {
94
+ featureType: 'subway',
95
+ elementType: 'all',
96
+ stylers: {
97
+ visibility: 'off'
98
+ }
99
+ },
100
+ {
101
+ featureType: 'manmade',
102
+ elementType: 'all',
103
+ stylers: {
104
+ color: '#d1d1d1'
105
+ }
106
+ },
107
+ {
108
+ featureType: 'local',
109
+ elementType: 'all',
110
+ stylers: {
111
+ color: '#d1d1d1'
112
+ }
113
+ },
114
+ {
115
+ featureType: 'arterial',
116
+ elementType: 'labels',
117
+ stylers: {
118
+ visibility: 'off'
119
+ }
120
+ },
121
+ {
122
+ featureType: 'boundary',
123
+ elementType: 'all',
124
+ stylers: {
125
+ color: '#fefefe'
126
+ }
127
+ },
128
+ {
129
+ featureType: 'building',
130
+ elementType: 'all',
131
+ stylers: {
132
+ color: '#d1d1d1'
133
+ }
134
+ },
135
+ {
136
+ featureType: 'label',
137
+ elementType: 'labels.text.fill',
138
+ stylers: {
139
+ color: '#999999'
140
+ }
141
+ }
142
+ ]
143
+ }
144
+ },
145
+ series: [
146
+ {
147
+ type: 'lines',
148
+ coordinateSystem: 'bmap',
149
+ data: lines,
150
+ polyline: true,
151
+ lineStyle: {
152
+ color: 'purple',
153
+ opacity: 0.6,
154
+ width: 1
155
+ }
156
+ }
157
+ ]
158
+ }
159
+ end
160
+ end
161
+ end
@@ -19,7 +19,6 @@ module Echarts
19
19
  },
20
20
  toolbox: {
21
21
  feature: {
22
- saveAsImage: {},
23
22
  saveAsImage: {},
24
23
  dataView: {},
25
24
  dataZoom: {},
@@ -11,7 +11,6 @@ module Echarts
11
11
  },
12
12
  toolbox: {
13
13
  feature: {
14
- saveAsImage: {},
15
14
  saveAsImage: {},
16
15
  dataView: {},
17
16
  dataZoom: {},
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiCommons
2
- VERSION = "3.2.3".freeze
2
+ VERSION = "3.2.5".freeze
3
3
  end
@@ -8,6 +8,9 @@ require "rails_charts"
8
8
  require "echarts/speedometer"
9
9
  require "echarts/vector"
10
10
  require "echarts/multiple_vectors"
11
+ require "echarts/binary"
12
+ require "echarts/binary_series"
13
+ require "echarts/map"
11
14
 
12
15
  require "thecore_ui_commons/engine"
13
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-04 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_backend_commons
@@ -142,6 +142,9 @@ files:
142
142
  - config/locales/it.yml
143
143
  - config/routes.rb
144
144
  - db/seeds.rb
145
+ - lib/echarts/binary.rb
146
+ - lib/echarts/binary_series.rb
147
+ - lib/echarts/map.rb
145
148
  - lib/echarts/multiple_vectors.rb
146
149
  - lib/echarts/speedometer.rb
147
150
  - lib/echarts/vector.rb