rails_charts 0.0.3 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 460115967715c86a598bf125d23580fc781154445e4a7752623579868009c409
4
- data.tar.gz: 63f5815f0c51083b58fc1036c668b51b7a770f47b09f2734ec90b0e6a31fce94
3
+ metadata.gz: c53d42b8e9c6d5e80a79cb661c49d9d2e62b9ceb391dbc6ade050ca37991584d
4
+ data.tar.gz: ef96a672ec278a563147a3329a680376825cd289fae535c7abc6be6828d6e05e
5
5
  SHA512:
6
- metadata.gz: af2ddf1ae9553126c82522db0f37d81da9856d029b1fb8f4be8afeaa609a250a15cb2aebd4e7b8fe7a3f66ccfbbff95d6b02476caed0a898fa887450d6a00074
7
- data.tar.gz: b0336548ae63cfd514029cd8bc186208981865369c6a68ea99c4aab062a5bfa8743ca7ed33e4590a916e049bbbb8a3bf4719e7221621e171cf60b6e277865f51
6
+ metadata.gz: f70838bdbc3be64442826252e373cb37d3851d7a7782b3b157aa2923170651ba363cd6462f0194b0dab5d4b4753c63340b26c4e6ff893bc076a36ec51b984618
7
+ data.tar.gz: 1e8729d5c90e81236d3be3f0f5832767782865f50d6ac962a5c06c5a5a309424ebdeb03c9e4b617892e44eacedbc881ba4d85ebd49429488e3e24a02f7e16d57
data/README.md CHANGED
@@ -1,32 +1,34 @@
1
1
  # Rails Charts
2
2
 
3
3
  [![RailsJazz](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/my_other.svg?raw=true)](https://www.railsjazz.com)
4
+ [![Listed on OpenSource-Heroes.com](https://opensource-heroes.com/badge-v1.svg)](https://opensource-heroes.com/r/railsjazz/rails_charts)
5
+
4
6
 
5
7
  ![Charts](docs/all.jpg)
6
8
 
7
9
  One more gem to build nice charts for your Ruby on Rails application.
8
10
 
9
- With it you can build various types of charts [Apache eCharts](https://echarts.apache.org/) library (v. 5.3.2). This gem simplifies interface and adding few helpers to start adding charts in your app with just a few lines of code.
11
+ With it you can build various types of charts [Apache eCharts](https://echarts.apache.org/) library (v. 5.4.0). This gem simplifies interface and adding few helpers to start adding charts in your app with just a few lines of code.
10
12
 
11
13
  What you can build with it:
12
14
 
13
- - line chart
14
- - area chart
15
- - bar chart
16
- - donut chart
17
- - pie chart
18
- - radar chart
19
- - calendar chart
20
- - candlestick chart
21
- - funnel chart
22
- - gauge chart
23
- - parallel chart
24
- - sankey chart
25
- - scatter chart
26
- - stacked bar chart
27
- - custom chart
28
-
29
- In most cases with one line of code you can have a nice chart. The idea of this gem was inspired by [Charkick](https://github.com/ankane/chartkick) gem which is great and allows you to build charts very quickly. It works best in cooperation with [groupdate](https://github.com/ankane/groupdate) gem. Unfortunatelly it's missing many needed types of charts or other customization options.
15
+ - [area chart](#area-chart)
16
+ - [line chart](#line-chart)
17
+ - [bar chart](#bar-chart)
18
+ - [donut chart](#donut-chart)
19
+ - [pie chart](#pie-chart)
20
+ - [radar chart](#radar-chart)
21
+ - [calendar chart](#calendar-chart)
22
+ - [candlestick chart](#candlestick-chart)
23
+ - [funnel chart](#funnel-chart)
24
+ - [gauge chart](#gauge-chart)
25
+ - [parallel chart](#parallel-chart)
26
+ - [sankey chart](#sankey-chart)
27
+ - [scatter chart](#scatter-chart)
28
+ - [stacked bar chart](#stacked-bar-chart)
29
+ - [custom chart](#custom-chart)
30
+
31
+ In most cases with one line of code you can have a nice chart. The idea of this gem was inspired by [Chartkick](https://github.com/ankane/chartkick) gem which is great and allows you to build charts very quickly. It works best in cooperation with [groupdate](https://github.com/ankane/groupdate) gem. Unfortunatelly it's missing many needed types of charts or other customization options.
30
32
 
31
33
  This implementation have more options and similar "interface" for building charts.
32
34
 
@@ -66,7 +68,7 @@ or do it manualy
66
68
  <%= line_chart User.group(:age).count %>
67
69
  ```
68
70
 
69
- 4) customize charts if needed. See available options or [official documentation](https://echarts.apache.org/examples/en/index.html).
71
+ 4) customize charts if needed. See available options or [official documentation](https://echarts.apache.org/examples/en/index.html).
70
72
 
71
73
 
72
74
  ### Webpack / esbuild
@@ -102,7 +104,7 @@ window.echarts = echarts;
102
104
  <%= line_chart User.group(:age).count %>
103
105
  ```
104
106
 
105
- 4) customize charts if needed. See available options or [official documentation](https://echarts.apache.org/examples/en/index.html).
107
+ 4) customize charts if needed. See available options or [official documentation](https://echarts.apache.org/examples/en/index.html).
106
108
 
107
109
  ### Importmaps
108
110
 
@@ -113,7 +115,7 @@ pin "echarts", to: "echarts.min.js"
113
115
  pin "echarts/theme/dark", to: "echarts/theme/dark.js"
114
116
  ```
115
117
 
116
- 2) add eCharts in main JS
118
+ 2) add eCharts in main JS
117
119
 
118
120
  ```javascript
119
121
  import "echarts"
@@ -125,7 +127,7 @@ import "echarts/theme/dark"
125
127
  <%= line_chart User.group(:age).count %>
126
128
  ```
127
129
 
128
- 4) customize charts if needed. See available options or [official documentation](https://echarts.apache.org/examples/en/index.html).
130
+ 4) customize charts if needed. See available options or [official documentation](https://echarts.apache.org/examples/en/index.html).
129
131
 
130
132
  ## Options
131
133
 
@@ -185,7 +187,7 @@ Every chart has a built in default configuration for tooltips, or other options
185
187
  ![Line Chart](docs/line_chart.png)
186
188
 
187
189
  ```ruby
188
- <%= line_chart User.group(:age).count, class: 'box',
190
+ <%= line_chart User.group(:age).count, class: 'box',
189
191
  options: {
190
192
  title: {
191
193
  text: "People count by age",
@@ -204,7 +206,7 @@ Every chart has a built in default configuration for tooltips, or other options
204
206
  class: 'box',
205
207
  theme: 'sakura',
206
208
  options: {
207
- series: {
209
+ series: {
208
210
  barWidth: '50%'
209
211
  },
210
212
  tooltip: {
@@ -322,18 +324,18 @@ Every chart has a built in default configuration for tooltips, or other options
322
324
  ![Donut Chart](docs/donut_chart.png)
323
325
 
324
326
  ```ruby
325
- <%= donut_chart User.group(:role).count,
327
+ <%= donut_chart User.group(:role).count,
326
328
  class: 'box',
327
329
  options: {
328
330
  legend: {
329
331
  bottom: '0'
330
332
  },
331
- emphasis: {
333
+ emphasis: {
332
334
  itemStyle: {
333
335
  shadowBlur: 10,
334
336
  shadowOffsetX: 0,
335
337
  shadowColor: 'rgba(0, 0, 0, 0.5)'
336
- }
338
+ }
337
339
  }
338
340
  }
339
341
  %>
@@ -344,7 +346,7 @@ Every chart has a built in default configuration for tooltips, or other options
344
346
  ![Pie Chart](docs/pie_chart.png)
345
347
 
346
348
  ```ruby
347
- <%= pie_chart User.group(:role).count,
349
+ <%= pie_chart User.group(:role).count,
348
350
  class: 'box',
349
351
  options: {
350
352
  legend: { orient: 'vertical', left: 'left' }
@@ -388,12 +390,12 @@ Every chart has a built in default configuration for tooltips, or other options
388
390
  source: 'HTML',
389
391
  target: 'Good',
390
392
  value: 1
391
- },
393
+ },
392
394
  {
393
395
  source: 'JS',
394
396
  target: 'Good',
395
397
  value: 1
396
- },
398
+ },
397
399
  {
398
400
  source: 'CSS',
399
401
  target: 'Good',
@@ -408,7 +410,7 @@ Every chart has a built in default configuration for tooltips, or other options
408
410
  source: 'Good',
409
411
  target: 'Backend',
410
412
  value: 1
411
- },
413
+ },
412
414
  {
413
415
  source: 'Good',
414
416
  target: 'Frontend',
@@ -418,7 +420,7 @@ Every chart has a built in default configuration for tooltips, or other options
418
420
  source: 'Bad',
419
421
  target: 'Backend',
420
422
  value: 1
421
- },
423
+ },
422
424
  ]
423
425
  }, {
424
426
  options: {
@@ -445,7 +447,7 @@ Every chart has a built in default configuration for tooltips, or other options
445
447
  },
446
448
  yAxis: {
447
449
  name: 'Sales'
448
- },
450
+ },
449
451
  legend: {
450
452
  data: [
451
453
  {name: 'John'},
@@ -516,3 +518,6 @@ You are welcome to contributes. Some open tasks:
516
518
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
517
519
 
518
520
  Gem is using https://echarts.apache.org/ to build charts.
521
+
522
+ [<img src="https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true"
523
+ />](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=rails_charts)
@@ -0,0 +1,174 @@
1
+
2
+
3
+ /*
4
+ * Licensed to the Apache Software Foundation (ASF) under one
5
+ * or more contributor license agreements. See the NOTICE file
6
+ * distributed with this work for additional information
7
+ * regarding copyright ownership. The ASF licenses this file
8
+ * to you under the Apache License, Version 2.0 (the
9
+ * "License"); you may not use this file except in compliance
10
+ * with the License. You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing,
15
+ * software distributed under the License is distributed on an
16
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ * KIND, either express or implied. See the License for the
18
+ * specific language governing permissions and limitations
19
+ * under the License.
20
+ */
21
+
22
+
23
+ /**
24
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
25
+ */
26
+ (function(root, factory) {
27
+ if (typeof define === 'function' && define.amd) {
28
+ // AMD. Register as an anonymous module.
29
+ define(['exports'], factory);
30
+ } else if (
31
+ typeof exports === 'object' &&
32
+ typeof exports.nodeName !== 'string'
33
+ ) {
34
+ // CommonJS
35
+ factory(exports);
36
+ } else {
37
+ // Browser globals
38
+ factory({});
39
+ }
40
+ })(this, function(exports) {
41
+
42
+
43
+ /**
44
+ * Language: Ukrainian.
45
+ */
46
+
47
+ var localeObj = {
48
+ time: {
49
+ month: [
50
+ 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень',
51
+ 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
52
+ ],
53
+ monthAbbr: [
54
+ 'Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер',
55
+ 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'
56
+ ],
57
+ dayOfWeek: [
58
+ 'Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'
59
+ ],
60
+ dayOfWeekAbbr: [
61
+ 'нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'
62
+ ]
63
+ },
64
+ legend: {
65
+ selector: {
66
+ all: 'Все',
67
+ inverse: 'Обернути'
68
+ }
69
+ },
70
+ toolbox: {
71
+ brush: {
72
+ title: {
73
+ rect: 'Выділити область',
74
+ polygon: 'Інструмент «Ласо»',
75
+ lineX: 'Горизонтальне виділення',
76
+ lineY: 'Вертикальне виділення',
77
+ keep: 'Залишити обране',
78
+ clear: 'Очистити обране'
79
+ }
80
+ },
81
+ dataView: {
82
+ title: 'Дані',
83
+ lang: ['Дані', 'Закрити', 'Оновити']
84
+ },
85
+ dataZoom: {
86
+ title: {
87
+ zoom: 'Збільшити',
88
+ back: 'Скасувати збільшення'
89
+ }
90
+ },
91
+ magicType: {
92
+ title: {
93
+ line: 'Переключитися на лінійний графік',
94
+ bar: 'Переключитися на стовпчикову діаграму',
95
+ stack: 'Стопка',
96
+ tiled: 'Плитка'
97
+ }
98
+ },
99
+ restore: {
100
+ title: 'Відновити'
101
+ },
102
+ saveAsImage: {
103
+ title: 'Зберегти зображення',
104
+ lang: ['Правий клік, щоб зберегти зображення']
105
+ }
106
+ },
107
+ series: {
108
+ typeNames: {
109
+ pie: 'Кругова діаграма',
110
+ bar: 'Стовпчикова діаграма',
111
+ line: 'Лінійний графік',
112
+ scatter: 'Точкова діаграма',
113
+ effectScatter: 'Точкова діаграма з хвилями',
114
+ radar: 'Пелюсткова діаграма',
115
+ tree: 'Дерево',
116
+ treemap: 'Пласке дерево',
117
+ boxplot: 'Ящик з вусами',
118
+ candlestick: 'Свічний графік',
119
+ k: 'Графік К-ліній',
120
+ heatmap: 'Теплова мапа',
121
+ map: 'Мапа',
122
+ parallel: 'Діаграма паралельних координат',
123
+ lines: 'Лінійний граф',
124
+ graph: 'Граф отношений',
125
+ sankey: 'Діаграма Санкей',
126
+ funnel: 'Воронкообразна діаграма',
127
+ gauge: 'Шкала',
128
+ pictorialBar: 'Стовпчик-картинка',
129
+ themeRiver: 'Тематична ріка',
130
+ sunburst: 'Сонячне проміння'
131
+ }
132
+ },
133
+ aria: {
134
+ general: {
135
+ withTitle: 'Це графік, що відрображує "{title}"',
136
+ withoutTitle: 'Це графік'
137
+ },
138
+ series: {
139
+ single: {
140
+ prefix: '',
141
+ withName: ' з типом {seriesType} та іменем {seriesName}.',
142
+ withoutName: ' з типом {seriesType}.'
143
+ },
144
+ multiple: {
145
+ prefix: '. Він складається з {seriesCount} серій.',
146
+ withName:
147
+ ' Серія {seriesId} має тип {seriesType} та відображає {seriesName}.',
148
+ withoutName: ' Серія {seriesId} має тип {seriesType}.',
149
+ separator: {
150
+ middle: '',
151
+ end: ''
152
+ }
153
+ }
154
+ },
155
+ data: {
156
+ allData: 'Дані такі: ',
157
+ partialData: 'Перші {displayCnt} елементів: ',
158
+ withName: 'значення для {name} — {value}',
159
+ withoutName: '{value}',
160
+ separator: {
161
+ middle: ', ',
162
+ end: '. '
163
+ }
164
+ }
165
+ }
166
+ };
167
+
168
+ for (var key in localeObj) {
169
+ if (localeObj.hasOwnProperty(key)) {
170
+ exports[key] = localeObj[key];
171
+ }
172
+ }
173
+
174
+ });
@@ -0,0 +1,170 @@
1
+
2
+
3
+ /*
4
+ * Licensed to the Apache Software Foundation (ASF) under one
5
+ * or more contributor license agreements. See the NOTICE file
6
+ * distributed with this work for additional information
7
+ * regarding copyright ownership. The ASF licenses this file
8
+ * to you under the Apache License, Version 2.0 (the
9
+ * "License"); you may not use this file except in compliance
10
+ * with the License. You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing,
15
+ * software distributed under the License is distributed on an
16
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ * KIND, either express or implied. See the License for the
18
+ * specific language governing permissions and limitations
19
+ * under the License.
20
+ */
21
+
22
+
23
+ /**
24
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
25
+ */
26
+ (function(root, factory) {
27
+ if (typeof define === 'function' && define.amd) {
28
+ // AMD. Register as an anonymous module.
29
+ define(['exports', 'echarts'], factory);
30
+ } else if (
31
+ typeof exports === 'object' &&
32
+ typeof exports.nodeName !== 'string'
33
+ ) {
34
+ // CommonJS
35
+ factory(exports, require('echarts/lib/echarts'));
36
+ } else {
37
+ // Browser globals
38
+ factory({}, root.echarts);
39
+ }
40
+ })(this, function(exports, echarts) {
41
+
42
+
43
+ /**
44
+ * Language: Ukrainian.
45
+ */
46
+
47
+ var localeObj = {
48
+ time: {
49
+ month: [
50
+ 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень',
51
+ 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
52
+ ],
53
+ monthAbbr: [
54
+ 'Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер',
55
+ 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'
56
+ ],
57
+ dayOfWeek: [
58
+ 'Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'
59
+ ],
60
+ dayOfWeekAbbr: [
61
+ 'нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'
62
+ ]
63
+ },
64
+ legend: {
65
+ selector: {
66
+ all: 'Все',
67
+ inverse: 'Обернути'
68
+ }
69
+ },
70
+ toolbox: {
71
+ brush: {
72
+ title: {
73
+ rect: 'Выділити область',
74
+ polygon: 'Інструмент «Ласо»',
75
+ lineX: 'Горизонтальне виділення',
76
+ lineY: 'Вертикальне виділення',
77
+ keep: 'Залишити обране',
78
+ clear: 'Очистити обране'
79
+ }
80
+ },
81
+ dataView: {
82
+ title: 'Дані',
83
+ lang: ['Дані', 'Закрити', 'Оновити']
84
+ },
85
+ dataZoom: {
86
+ title: {
87
+ zoom: 'Збільшити',
88
+ back: 'Скасувати збільшення'
89
+ }
90
+ },
91
+ magicType: {
92
+ title: {
93
+ line: 'Переключитися на лінійний графік',
94
+ bar: 'Переключитися на стовпчикову діаграму',
95
+ stack: 'Стопка',
96
+ tiled: 'Плитка'
97
+ }
98
+ },
99
+ restore: {
100
+ title: 'Відновити'
101
+ },
102
+ saveAsImage: {
103
+ title: 'Зберегти зображення',
104
+ lang: ['Правий клік, щоб зберегти зображення']
105
+ }
106
+ },
107
+ series: {
108
+ typeNames: {
109
+ pie: 'Кругова діаграма',
110
+ bar: 'Стовпчикова діаграма',
111
+ line: 'Лінійний графік',
112
+ scatter: 'Точкова діаграма',
113
+ effectScatter: 'Точкова діаграма з хвилями',
114
+ radar: 'Пелюсткова діаграма',
115
+ tree: 'Дерево',
116
+ treemap: 'Пласке дерево',
117
+ boxplot: 'Ящик з вусами',
118
+ candlestick: 'Свічний графік',
119
+ k: 'Графік К-ліній',
120
+ heatmap: 'Теплова мапа',
121
+ map: 'Мапа',
122
+ parallel: 'Діаграма паралельних координат',
123
+ lines: 'Лінійний граф',
124
+ graph: 'Граф отношений',
125
+ sankey: 'Діаграма Санкей',
126
+ funnel: 'Воронкообразна діаграма',
127
+ gauge: 'Шкала',
128
+ pictorialBar: 'Стовпчик-картинка',
129
+ themeRiver: 'Тематична ріка',
130
+ sunburst: 'Сонячне проміння'
131
+ }
132
+ },
133
+ aria: {
134
+ general: {
135
+ withTitle: 'Це графік, що відрображує "{title}"',
136
+ withoutTitle: 'Це графік'
137
+ },
138
+ series: {
139
+ single: {
140
+ prefix: '',
141
+ withName: ' з типом {seriesType} та іменем {seriesName}.',
142
+ withoutName: ' з типом {seriesType}.'
143
+ },
144
+ multiple: {
145
+ prefix: '. Він складається з {seriesCount} серій.',
146
+ withName:
147
+ ' Серія {seriesId} має тип {seriesType} та відображає {seriesName}.',
148
+ withoutName: ' Серія {seriesId} має тип {seriesType}.',
149
+ separator: {
150
+ middle: '',
151
+ end: ''
152
+ }
153
+ }
154
+ },
155
+ data: {
156
+ allData: 'Дані такі: ',
157
+ partialData: 'Перші {displayCnt} елементів: ',
158
+ withName: 'значення для {name} — {value}',
159
+ withoutName: '{value}',
160
+ separator: {
161
+ middle: ', ',
162
+ end: '. '
163
+ }
164
+ }
165
+ }
166
+ };
167
+
168
+ echarts.registerLocale('UA', localeObj);
169
+
170
+ });