thecore_ui_commons 3.2.0 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/echarts/multiple_vectors.rb +70 -0
- data/lib/echarts/speedometer.rb +14 -2
- data/lib/echarts/vector.rb +65 -0
- data/lib/thecore_ui_commons/version.rb +1 -1
- data/lib/thecore_ui_commons.rb +2 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1397fe46c5905e2eab3f8f09a5867f863e9e95f476f3f7af94a73366cc1fd306
|
4
|
+
data.tar.gz: 4418e1cc044ce42a196594284320403ff78ba6458f747a9a9bec450b2302cc6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9529bd616b5266a72270b0126aa9c472202c6d1d68534ef24772cb1530f4eac5df2bbe4adec7f94fdb261ce410e5249e156e06153c95783d304795c0552c1c0a
|
7
|
+
data.tar.gz: 50d63d6d262d56a8034b054998f0a9fed501744ab4892e15873946911f767559ef83a41aaf3459b4cc45333dcc7c7e4d7a32eeacdcbaf1fb50b0b1fb077514d0
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Echarts
|
2
|
+
module MultipleVectors
|
3
|
+
def self.get_config(stacks, legend, min, max, lower_bound, upper_bound, title, subtitle, xLabel, yLabel, color_min = "limegreen", color_max = "tomato")
|
4
|
+
Rails.logger.debug("Legend: #{legend}\nLegend size: #{legend.size}")
|
5
|
+
Rails.logger.debug("Stacks size: #{stacks.size}")
|
6
|
+
{
|
7
|
+
grid: {
|
8
|
+
top: 80,
|
9
|
+
},
|
10
|
+
legend: {
|
11
|
+
top: 80,
|
12
|
+
show: true,
|
13
|
+
data: legend,
|
14
|
+
type: "scroll",
|
15
|
+
},
|
16
|
+
title: {
|
17
|
+
text: title,
|
18
|
+
subtext: subtitle,
|
19
|
+
},
|
20
|
+
toolbox: {
|
21
|
+
feature: {
|
22
|
+
saveAsImage: {},
|
23
|
+
saveAsImage: {},
|
24
|
+
dataView: {},
|
25
|
+
dataZoom: {},
|
26
|
+
restore: {},
|
27
|
+
},
|
28
|
+
},
|
29
|
+
tooltip: {
|
30
|
+
trigger: "axis",
|
31
|
+
},
|
32
|
+
xAxis: {
|
33
|
+
type: "category",
|
34
|
+
name: xLabel,
|
35
|
+
},
|
36
|
+
yAxis: {
|
37
|
+
type: "value",
|
38
|
+
name: yLabel,
|
39
|
+
# Set Upper and Lower bounds to the upper and lower bounds of the data
|
40
|
+
# min: lower_bound,
|
41
|
+
# max: upper_bound,
|
42
|
+
},
|
43
|
+
series: stacks.map.with_index do |stack, index|
|
44
|
+
{
|
45
|
+
name: legend[index],
|
46
|
+
data: stack,
|
47
|
+
type: "line",
|
48
|
+
smooth: true,
|
49
|
+
markLine: {
|
50
|
+
data: [
|
51
|
+
# Min line (create an array repeating the min value for each x value)
|
52
|
+
{
|
53
|
+
name: "Min Reference",
|
54
|
+
yAxis: min,
|
55
|
+
lineStyle: { color: color_min },
|
56
|
+
},
|
57
|
+
# Max line (create an array repeating the max value for each x value)
|
58
|
+
{
|
59
|
+
name: "Max Reference",
|
60
|
+
yAxis: max,
|
61
|
+
lineStyle: { color: color_max },
|
62
|
+
}
|
63
|
+
]
|
64
|
+
}
|
65
|
+
}
|
66
|
+
end
|
67
|
+
}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/echarts/speedometer.rb
CHANGED
@@ -66,7 +66,7 @@ module Echarts
|
|
66
66
|
# @param color_error [String] The color for values outside the range.
|
67
67
|
# @param color_generic [String] The color for generic values.
|
68
68
|
# @return [Hash] The options for the gauge chart.
|
69
|
-
def self.get_config(value, min, max, lower_bound, upper_bound,
|
69
|
+
def self.get_config(value, min, max, lower_bound, upper_bound, title, subtitle, vLabel, color_ok = "limegreen", color_error = "tomato", color_generic = "dodgerblue")
|
70
70
|
min_in_percentage = compute_percentage(min, lower_bound, upper_bound)
|
71
71
|
max_in_percentage = compute_percentage(max, lower_bound, upper_bound)
|
72
72
|
value_in_percentage = compute_percentage(value, lower_bound, upper_bound)
|
@@ -76,6 +76,18 @@ module Echarts
|
|
76
76
|
|
77
77
|
# The gauge chart
|
78
78
|
raw_js_options = {
|
79
|
+
grid: {
|
80
|
+
top: 80,
|
81
|
+
},
|
82
|
+
title: {
|
83
|
+
text: title,
|
84
|
+
subtext: subtitle,
|
85
|
+
},
|
86
|
+
toolbox: {
|
87
|
+
feature: {
|
88
|
+
saveAsImage: {},
|
89
|
+
}
|
90
|
+
},
|
79
91
|
series: [
|
80
92
|
{
|
81
93
|
type: "gauge",
|
@@ -122,7 +134,7 @@ module Echarts
|
|
122
134
|
data: [
|
123
135
|
{
|
124
136
|
value: value,
|
125
|
-
name:
|
137
|
+
name: vLabel,
|
126
138
|
},
|
127
139
|
],
|
128
140
|
},
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Echarts
|
2
|
+
module Vector
|
3
|
+
def self.get_config(x, value, min, max, lower_bound, upper_bound, title, subtitle, xLabel, yLabel, color_min = "limegreen", color_max = "tomato", color_generic = "dodgerblue")
|
4
|
+
{
|
5
|
+
grid: {
|
6
|
+
top: 80,
|
7
|
+
},
|
8
|
+
title: {
|
9
|
+
text: title,
|
10
|
+
subtext: subtitle,
|
11
|
+
},
|
12
|
+
toolbox: {
|
13
|
+
feature: {
|
14
|
+
saveAsImage: {},
|
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
|
+
# Set Upper and Lower bounds to the upper and lower bounds of the data
|
33
|
+
# min: lower_bound,
|
34
|
+
# max: upper_bound,
|
35
|
+
},
|
36
|
+
series: [
|
37
|
+
{
|
38
|
+
name: "Values",
|
39
|
+
data: value,
|
40
|
+
type: "line",
|
41
|
+
smooth: true,
|
42
|
+
# stack: 'Total',
|
43
|
+
itemStyle: { color: color_generic },
|
44
|
+
markLine: {
|
45
|
+
data: [
|
46
|
+
# Min line (create an array repeating the min value for each x value)
|
47
|
+
{
|
48
|
+
name: "Min Reference",
|
49
|
+
yAxis: min,
|
50
|
+
lineStyle: { color: color_min },
|
51
|
+
},
|
52
|
+
# Max line (create an array repeating the max value for each x value)
|
53
|
+
{
|
54
|
+
name: "Max Reference",
|
55
|
+
yAxis: max,
|
56
|
+
lineStyle: { color: color_max },
|
57
|
+
},
|
58
|
+
],
|
59
|
+
},
|
60
|
+
},
|
61
|
+
],
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/thecore_ui_commons.rb
CHANGED
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.
|
4
|
+
version: 3.2.2
|
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-
|
11
|
+
date: 2024-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_backend_commons
|
@@ -142,7 +142,9 @@ files:
|
|
142
142
|
- config/locales/it.yml
|
143
143
|
- config/routes.rb
|
144
144
|
- db/seeds.rb
|
145
|
+
- lib/echarts/multiple_vectors.rb
|
145
146
|
- lib/echarts/speedometer.rb
|
147
|
+
- lib/echarts/vector.rb
|
146
148
|
- lib/tasks/thecore_ui_commons_tasks.rake
|
147
149
|
- lib/thecore_ui_commons.rb
|
148
150
|
- lib/thecore_ui_commons/engine.rb
|
@@ -169,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
171
|
- !ruby/object:Gem::Version
|
170
172
|
version: '0'
|
171
173
|
requirements: []
|
172
|
-
rubygems_version: 3.5.
|
174
|
+
rubygems_version: 3.5.16
|
173
175
|
signing_key:
|
174
176
|
specification_version: 4
|
175
177
|
summary: Common artifacts for the UIs.
|