thecore_ui_commons 3.2.1 → 3.2.2

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: fdff559b019de14881d80b1c3eb160d18f2b947122d553fb3aa46c9a4d84024d
4
- data.tar.gz: b2681fdf1a5a18ccc2675cd317a74e4c5d564915fd24e73275273b476f3f21da
3
+ metadata.gz: 1397fe46c5905e2eab3f8f09a5867f863e9e95f476f3f7af94a73366cc1fd306
4
+ data.tar.gz: 4418e1cc044ce42a196594284320403ff78ba6458f747a9a9bec450b2302cc6c
5
5
  SHA512:
6
- metadata.gz: 44db9e1a31c3990ef5624174e423b9c03d8acfa308758d602794f94e129355446369c4258d9d870910e3d7d7a586c5db86edf62e5afa547aa32bf582100f4805
7
- data.tar.gz: 8be6bd95516a7fcbafcab3f3606abbcfd68c1196df9812804b7ce9785ef81ea1eef05a115d07f5f6f746902c276557085b7f5360c1a07293ba17be1308e4856c
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
@@ -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, measure_unit, name, color_ok = "limegreen", color_error = "tomato", color_generic = "dodgerblue")
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,13 @@ 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
+ },
79
86
  toolbox: {
80
87
  feature: {
81
88
  saveAsImage: {},
@@ -127,7 +134,7 @@ module Echarts
127
134
  data: [
128
135
  {
129
136
  value: value,
130
- name: name,
137
+ name: vLabel,
131
138
  },
132
139
  ],
133
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
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiCommons
2
- VERSION = "3.2.1".freeze
2
+ VERSION = "3.2.2".freeze
3
3
  end
@@ -6,6 +6,8 @@ require "groupdate"
6
6
  # require "apexcharts"
7
7
  require "rails_charts"
8
8
  require "echarts/speedometer"
9
+ require "echarts/vector"
10
+ require "echarts/multiple_vectors"
9
11
 
10
12
  require "thecore_ui_commons/engine"
11
13
 
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.1
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-03 00:00:00.000000000 Z
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.11
174
+ rubygems_version: 3.5.16
173
175
  signing_key:
174
176
  specification_version: 4
175
177
  summary: Common artifacts for the UIs.