glib-web 3.16.3 → 3.17.1

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: 26d2c5c409ff911326efa81f445217d859f62b5350630c28185ca4e8a0ef85ad
4
- data.tar.gz: edb315e653b13110b2cdfb896bdbc20e980adc593155ecb8527951a8cfaf232f
3
+ metadata.gz: 9c37ac1c9bd5d4d9565ab86f986291b9632078fbbff826f9fbe97af830bb751c
4
+ data.tar.gz: 492bd2a9ba30eec6f10e305902840f767092689e27c49fbf270eb0bd5934dc53
5
5
  SHA512:
6
- metadata.gz: '05778a76d110933cd70d86343d645d680b19c48df67027affcfdd59a89cbfa7d74489826d116f450c881a9bb67059fbc83f04b22dd80edf228649e9515da0f89'
7
- data.tar.gz: eb2db140e67e307c7cdd5a52ea48887bb5414b4949e6fa154a490822ea64863cfbe85369fc1695036976e49db0009015adb7593f600d53768ef856cbea820441
6
+ metadata.gz: c1825b0b69216a06f5cc44f1caec35d966712b6109fb6db4cd31e0b5ba12736b784c570eab3a02ed050364f61723b45466f2b650cd182665533e85633caa0456
7
+ data.tar.gz: b74fd94c300707ecbe6a64225d0e20125903c9772939bfdcc2e1517b2729666d8e0564f30499c957a4d6c4608b8a270378cb87539a4fd8fc84b6d7c17afe1f05
@@ -94,7 +94,9 @@ module Glib::Json::Traversal
94
94
  traverse_multiple view['leftButtons'], block
95
95
  traverse_multiple view['rightButtons'], block
96
96
 
97
- # TODO: crawl header and footer
97
+ # Table row
98
+ traverse_multiple view['cellViews'], block
99
+
98
100
  # Table/List
99
101
  if (sections = view['sections']).is_a? Array
100
102
  sections.each do |section|
@@ -34,48 +34,42 @@ class Glib::JsonUi::ViewBuilder
34
34
  end
35
35
  end
36
36
 
37
+ module Attributes
38
+ extend ActiveSupport::Concern
39
+
40
+ included do
41
+ array :colors
42
+ string :prefix
43
+ string :suffix
44
+ int :min
45
+ int :max
46
+ hash :legend
47
+ hash :plugins
48
+ end
49
+ end
50
+
37
51
  class Line < View
38
52
  include Series
39
- array :colors
40
- string :prefix
41
- string :suffix
42
- int :min
43
- int :max
44
- string :legend
45
- # idea for the future
46
- # hash :nextPage
53
+ include Attributes
47
54
  end
48
55
 
49
56
  class Column < View
50
57
  include Series
58
+ include Attributes
51
59
 
52
60
  bool :stacked
53
- array :colors
54
- string :prefix
55
- string :suffix
56
- int :min
57
- int :max
58
- string :legend
59
61
  end
60
62
 
61
63
  class Pie < View
62
64
  include Series
63
- array :colors
64
- string :prefix
65
- string :suffix
66
- int :min
67
- int :max
68
- string :legend
69
-
65
+ include Attributes
66
+ array :dataPoints
70
67
  end
71
68
 
72
69
  class Area < View
73
70
  include Series
74
- array :colors
75
- string :prefix
76
- string :suffix
77
- int :min
78
- int :max
71
+ include Attributes
72
+ array :dataPoints
79
73
  end
80
74
 
81
75
  end
@@ -1,3 +1,14 @@
1
+ default_plugins = {
2
+ datalabels: {
3
+ backgroundColor: 'skyblue',
4
+ borderRadius: 4,
5
+ color: 'white',
6
+ font: {
7
+ weight: 'bold'
8
+ },
9
+ padding: 6
10
+ }
11
+ }
1
12
 
2
13
  if params[:data_only].present?
3
14
  json_ui_page json do |page|
@@ -43,7 +54,8 @@ else
43
54
  json.points points.map { |k, v| { x: k, y: v } }
44
55
  end
45
56
  ],
46
- colors: ['#79AC78', '#3085C3'], legend: 'bottom'
57
+ plugins: default_plugins,
58
+ colors: ['#79AC78', '#3085C3'], legend: { display: false }
47
59
 
48
60
  # scroll.spacer height: 20
49
61
  # scroll.h1 text: 'Line chart using remote data'
@@ -79,7 +91,8 @@ else
79
91
  json.points points
80
92
  end
81
93
  ],
82
- colors: ['#b00', '#666', '#E55604'], legend: 'left'
94
+ plugins: default_plugins,
95
+ colors: ['lightgreen', 'whitesmoke', 'skyblue'], legend: { position: 'left' }
83
96
 
84
97
  scroll.h2 text: 'Column chart (Stacked)'
85
98
  scroll.charts_column stacked: true, dataGroups: [
@@ -110,54 +123,42 @@ else
110
123
  }
111
124
  json.points points
112
125
  end
113
- ], legend: 'bottom'
126
+ ], plugins: default_plugins, legend: { position: 'bottom', align: 'start' }
114
127
 
128
+ plugins = default_plugins.deep_dup
129
+ plugins[:datalabels][:formatType] = 'label'
115
130
  scroll.h2 text: 'Pie chart'
116
- scroll.charts_pie dataSeries: [
117
- -> do
118
- json.title 'Straberry'
119
- json.value 25
120
- end,
121
- -> do
122
- json.title 'Banana'
123
- json.value 25
124
- end
125
- ], legend: 'bottom'
131
+ scroll.charts_pie \
132
+ colors: ['#fc5a8d', '#F5E216'],
133
+ plugins: plugins,
134
+ dataPoints: [{ title: 'Strawberry', value: 25 }, { title: 'Banana', value: 75 }], legend: { display: false }
126
135
 
127
136
  scroll.h2 text: 'Donut chart'
128
137
  scroll.charts_pie \
129
138
  styleClasses: ['donut'],
130
- dataSeries: [
131
- -> do
132
- json.title 'Straberry'
133
- json.value 25
134
- end,
135
- -> do
136
- json.title 'Banana'
137
- json.value 25
138
- end
139
- ], legend: 'bottom'
139
+ suffix: '%',
140
+ colors: ['#fc5a8d', '#F5E216'],
141
+ plugins: default_plugins.merge({
142
+ centerLabel: {
143
+ labels: [
144
+ {
145
+ text: 'Fruits',
146
+ font: {
147
+ weigth: 'bold',
148
+ size: 20
149
+ }
150
+ },
151
+ { text: 'You like' }
152
+ ]
153
+ }
154
+ }),
155
+ dataPoints: [{ title: 'Strawberry', value: 25 }, { title: 'Banana', value: 75 }],
156
+ legend: { position: 'right' }
140
157
 
141
158
  scroll.h2 text: 'Area chart'
142
- scroll.charts_area dataSeries: [
143
- -> do
144
- json.title 'Jan'
145
- json.value 25
146
- end,
147
- -> do
148
- json.title 'Feb'
149
- json.value 55
150
- end,
151
- -> do
152
- json.title 'Mar'
153
- json.value 60
154
- end,
155
- -> do
156
- json.title 'June'
157
- json.value 20
158
- end
159
- ],
160
- colors: ['#5B0888']
159
+ scroll.charts_area \
160
+ dataPoints: [{ title: 'Jan', value: 25 }, { title: 'Feb', value: 55 }, { title: 'Mar', value: 60 }, { title: 'Apr', value: 45 }],
161
+ colors: ['#5B0888']
161
162
  end
162
163
  end
163
164
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.3
4
+ version: 3.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''