chartkick 3.3.0 → 3.4.2
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 +4 -4
- data/CHANGELOG.md +72 -51
- data/LICENSE.txt +1 -1
- data/README.md +43 -18
- data/lib/chartkick.rb +2 -26
- data/lib/chartkick/enumerable.rb +25 -0
- data/lib/chartkick/helper.rb +30 -14
- data/lib/chartkick/version.rb +1 -1
- data/licenses/LICENSE-chart.js.txt +9 -0
- data/licenses/LICENSE-chartkick.js.txt +22 -0
- data/licenses/LICENSE-moment.txt +22 -0
- data/vendor/assets/javascripts/Chart.bundle.js +19321 -17833
- data/vendor/assets/javascripts/chartkick.js +62 -16
- metadata +7 -4
- data/CONTRIBUTING.md +0 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f0229f1e93dc1d2b672317f7147394f8a17e4fb42bb1ab2c979a1ac5b67a0e7
|
|
4
|
+
data.tar.gz: c8229ee28b9bbcfbc61c971a39e67415295cdd8043b25cfac1fa5ef992981cf9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dce86c2e3bcf36e4c1c104e1446076cc7086563cefb12968355f236bece5460034b4e076ed98fc64f9453f6abc10b6c38287caeaef84ba0bd00566f3de0b6fe1
|
|
7
|
+
data.tar.gz: a2774bde5c45e347d532720b14c9ee4ed04136d379796355339e6ba5b56194a98916bee56308a3e16252afdea50110a843e4e63b783db9712d20cfaf502f8113
|
data/CHANGELOG.md
CHANGED
|
@@ -1,37 +1,58 @@
|
|
|
1
|
-
## 3.
|
|
1
|
+
## 3.4.2 (2020-10-20)
|
|
2
|
+
|
|
3
|
+
- Updated Chart.js to 2.9.4
|
|
4
|
+
|
|
5
|
+
## 3.4.1 (2020-10-06)
|
|
6
|
+
|
|
7
|
+
- Relaxed validation for `width` and `height` options
|
|
8
|
+
|
|
9
|
+
## 3.4.0 (2020-08-04)
|
|
10
|
+
|
|
11
|
+
- Fixed CSS injection with `width` and `height` options - [more info](https://github.com/ankane/chartkick/issues/546)
|
|
12
|
+
|
|
13
|
+
## 3.3.2 (2020-07-23)
|
|
14
|
+
|
|
15
|
+
- Updated Chartkick.js to 3.2.1
|
|
16
|
+
|
|
17
|
+
## 3.3.1 (2019-12-26)
|
|
18
|
+
|
|
19
|
+
- Updated Chart.js to 2.9.3
|
|
20
|
+
- Fixed deprecation warnings in Ruby 2.7
|
|
21
|
+
|
|
22
|
+
## 3.3.0 (2019-11-09)
|
|
2
23
|
|
|
3
24
|
- Updated Chartkick.js to 3.2.0
|
|
4
25
|
- Rolled back Chart.js to 2.8.0 due to legend change
|
|
5
26
|
|
|
6
|
-
## 3.2.2
|
|
27
|
+
## 3.2.2 (2019-10-27)
|
|
7
28
|
|
|
8
29
|
- Updated Chartkick.js to 3.1.3
|
|
9
30
|
- Updated Chart.js to 2.9.1
|
|
10
31
|
|
|
11
|
-
## 3.2.1
|
|
32
|
+
## 3.2.1 (2019-07-15)
|
|
12
33
|
|
|
13
34
|
- Updated Chartkick.js to 3.1.1
|
|
14
35
|
|
|
15
|
-
## 3.2.0
|
|
36
|
+
## 3.2.0 (2019-06-04)
|
|
16
37
|
|
|
17
|
-
- Fixed XSS vulnerability -
|
|
38
|
+
- Fixed XSS vulnerability - [more info](https://github.com/ankane/chartkick/issues/488)
|
|
18
39
|
|
|
19
|
-
## 3.1.0
|
|
40
|
+
## 3.1.0 (2019-05-26)
|
|
20
41
|
|
|
21
42
|
- Updated Chartkick.js to 3.1.0
|
|
22
43
|
- Updated Chart.js to 2.8.0
|
|
23
44
|
|
|
24
|
-
## 3.0.2
|
|
45
|
+
## 3.0.2 (2019-01-03)
|
|
25
46
|
|
|
26
47
|
- Fixed error with `nonce` option with Secure Headers and Rails < 5.2
|
|
27
48
|
- Updated Chartkick.js to 3.0.2
|
|
28
49
|
- Updated Chart.js to 2.7.3
|
|
29
50
|
|
|
30
|
-
## 3.0.1
|
|
51
|
+
## 3.0.1 (2018-08-13)
|
|
31
52
|
|
|
32
53
|
- Updated Chartkick.js to 3.0.1
|
|
33
54
|
|
|
34
|
-
## 3.0.0
|
|
55
|
+
## 3.0.0 (2018-08-08)
|
|
35
56
|
|
|
36
57
|
- Updated Chartkick.js to 3.0.0
|
|
37
58
|
- Added `code` option
|
|
@@ -45,55 +66,55 @@ Breaking changes
|
|
|
45
66
|
- Removed `window.Chartkick = {...}` way to set config - use `Chartkick.configure` instead
|
|
46
67
|
- Removed support for the Google Charts jsapi loader - use loader.js instead
|
|
47
68
|
|
|
48
|
-
## 2.3.5
|
|
69
|
+
## 2.3.5 (2018-06-15)
|
|
49
70
|
|
|
50
71
|
- Updated Chartkick.js to 2.3.6
|
|
51
72
|
|
|
52
|
-
## 2.3.4
|
|
73
|
+
## 2.3.4 (2018-04-10)
|
|
53
74
|
|
|
54
75
|
- Updated Chartkick.js to 2.3.5
|
|
55
76
|
- Updated Chart.js to 2.7.2
|
|
56
77
|
|
|
57
|
-
## 2.3.3
|
|
78
|
+
## 2.3.3 (2018-03-25)
|
|
58
79
|
|
|
59
80
|
- Updated Chartkick.js to 2.3.4
|
|
60
81
|
|
|
61
|
-
## 2.3.2
|
|
82
|
+
## 2.3.2 (2018-02-26)
|
|
62
83
|
|
|
63
84
|
- Updated Chartkick.js to 2.3.3
|
|
64
85
|
|
|
65
|
-
## 2.3.1
|
|
86
|
+
## 2.3.1 (2018-02-23)
|
|
66
87
|
|
|
67
88
|
- Updated Chartkick.js to 2.3.1
|
|
68
89
|
|
|
69
|
-
## 2.3.0
|
|
90
|
+
## 2.3.0 (2018-02-21)
|
|
70
91
|
|
|
71
92
|
- Fixed deep merge error for non-Rails apps
|
|
72
93
|
- Updated Chartkick.js to 2.3.0
|
|
73
94
|
|
|
74
|
-
## 2.2.5
|
|
95
|
+
## 2.2.5 (2017-10-28)
|
|
75
96
|
|
|
76
97
|
- Updated Chart.js to 2.7.1
|
|
77
98
|
|
|
78
|
-
## 2.2.4
|
|
99
|
+
## 2.2.4 (2017-05-14)
|
|
79
100
|
|
|
80
101
|
- Added compatibility with Rails API
|
|
81
102
|
- Updated Chartkick.js to 2.2.4
|
|
82
103
|
|
|
83
|
-
## 2.2.3
|
|
104
|
+
## 2.2.3 (2017-02-22)
|
|
84
105
|
|
|
85
106
|
- Updated Chartkick.js to 2.2.3
|
|
86
107
|
- Updated Chart.js to 2.5.0
|
|
87
108
|
|
|
88
|
-
## 2.2.2
|
|
109
|
+
## 2.2.2 (2017-01-07)
|
|
89
110
|
|
|
90
111
|
- Updated Chartkick.js to 2.2.2
|
|
91
112
|
|
|
92
|
-
## 2.2.1
|
|
113
|
+
## 2.2.1 (2016-12-05)
|
|
93
114
|
|
|
94
115
|
- Updated Chartkick.js to 2.2.1
|
|
95
116
|
|
|
96
|
-
## 2.2.0
|
|
117
|
+
## 2.2.0 (2016-12-03)
|
|
97
118
|
|
|
98
119
|
- Updated Chartkick.js to 2.2.0
|
|
99
120
|
- Improved JavaScript API
|
|
@@ -101,59 +122,59 @@ Breaking changes
|
|
|
101
122
|
- Added `refresh` option
|
|
102
123
|
- Added `donut` option to pie chart
|
|
103
124
|
|
|
104
|
-
## 2.1.3
|
|
125
|
+
## 2.1.3 (2016-11-29)
|
|
105
126
|
|
|
106
127
|
- Updated Chartkick.js to 2.1.2 - fixes missing zero values for Chart.js
|
|
107
128
|
|
|
108
|
-
## 2.1.2
|
|
129
|
+
## 2.1.2 (2016-11-28)
|
|
109
130
|
|
|
110
131
|
- Added `defer` option
|
|
111
132
|
- Added `nonce` option
|
|
112
133
|
- Updated Chartkick.js to 2.1.1
|
|
113
134
|
|
|
114
|
-
## 2.1.1
|
|
135
|
+
## 2.1.1 (2016-09-11)
|
|
115
136
|
|
|
116
137
|
- Use custom version of Chart.js to fix label overlap
|
|
117
138
|
|
|
118
|
-
## 2.1.0
|
|
139
|
+
## 2.1.0 (2016-09-10)
|
|
119
140
|
|
|
120
141
|
- Added basic support for new Google Charts loader
|
|
121
142
|
- Added `configure` function
|
|
122
143
|
- Dropped jQuery and Zepto dependencies for AJAX
|
|
123
144
|
- Updated Chart.js to 2.2.2
|
|
124
145
|
|
|
125
|
-
## 2.0.2
|
|
146
|
+
## 2.0.2 (2016-08-11)
|
|
126
147
|
|
|
127
148
|
- Updated Chartkick.js to 2.0.1
|
|
128
149
|
- Updated Chart.js to 2.2.1
|
|
129
150
|
|
|
130
|
-
## 2.0.1
|
|
151
|
+
## 2.0.1 (2016-07-29)
|
|
131
152
|
|
|
132
153
|
- Small Chartkick.js fixes
|
|
133
154
|
- Updated Chart.js to 2.2.0
|
|
134
155
|
|
|
135
|
-
## 2.0.0
|
|
156
|
+
## 2.0.0 (2016-05-30)
|
|
136
157
|
|
|
137
158
|
- Chart.js is now the default adapter - yay open source!
|
|
138
159
|
- Axis types are automatically detected - no need for `discrete: true`
|
|
139
160
|
- Better date support
|
|
140
161
|
- New JavaScript API
|
|
141
162
|
|
|
142
|
-
## 1.5.2
|
|
163
|
+
## 1.5.2 (2016-05-05)
|
|
143
164
|
|
|
144
165
|
- Fixed Sprockets error
|
|
145
166
|
|
|
146
|
-
## 1.5.1
|
|
167
|
+
## 1.5.1 (2016-05-03)
|
|
147
168
|
|
|
148
169
|
- Updated chartkick.js to latest version
|
|
149
170
|
- Included `Chart.bundle.js`
|
|
150
171
|
|
|
151
|
-
## 1.5.0
|
|
172
|
+
## 1.5.0 (2016-05-01)
|
|
152
173
|
|
|
153
174
|
- Added Chart.js adapter **beta**
|
|
154
175
|
- Fixed line height on timeline charts
|
|
155
176
|
|
|
156
|
-
## 1.4.2
|
|
177
|
+
## 1.4.2 (2016-02-29)
|
|
157
178
|
|
|
158
179
|
- Added `width` option
|
|
159
180
|
- Added `label` option
|
|
@@ -162,86 +183,86 @@ Breaking changes
|
|
|
162
183
|
- Better tooltip for dates for Google Charts
|
|
163
184
|
- Fixed asset precompilation issue with Rails 5
|
|
164
185
|
|
|
165
|
-
## 1.4.1
|
|
186
|
+
## 1.4.1 (2015-09-07)
|
|
166
187
|
|
|
167
188
|
- Fixed regression with `min: nil`
|
|
168
189
|
|
|
169
|
-
## 1.4.0
|
|
190
|
+
## 1.4.0 (2015-08-31)
|
|
170
191
|
|
|
171
192
|
- Added scatter chart
|
|
172
193
|
- Added axis titles
|
|
173
194
|
|
|
174
|
-
## 1.3.2
|
|
195
|
+
## 1.3.2 (2014-07-04)
|
|
175
196
|
|
|
176
197
|
- Fixed `except` error when not using Rails
|
|
177
198
|
|
|
178
|
-
## 1.3.1
|
|
199
|
+
## 1.3.1 (2014-06-30)
|
|
179
200
|
|
|
180
201
|
- Fixed blank screen bug
|
|
181
202
|
- Fixed language support
|
|
182
203
|
|
|
183
|
-
## 1.3.0
|
|
204
|
+
## 1.3.0 (2014-06-28)
|
|
184
205
|
|
|
185
206
|
- Added timelines
|
|
186
207
|
|
|
187
|
-
## 1.2.5
|
|
208
|
+
## 1.2.5 (2014-06-12)
|
|
188
209
|
|
|
189
210
|
- Added support for multiple groups
|
|
190
211
|
- Added `html` option
|
|
191
212
|
|
|
192
|
-
## 1.2.4
|
|
213
|
+
## 1.2.4 (2014-03-24)
|
|
193
214
|
|
|
194
215
|
- Added global options
|
|
195
216
|
- Added `colors` option
|
|
196
217
|
|
|
197
|
-
## 1.2.3
|
|
218
|
+
## 1.2.3 (2014-03-23)
|
|
198
219
|
|
|
199
220
|
- Added geo chart
|
|
200
221
|
- Added `discrete` option
|
|
201
222
|
|
|
202
|
-
## 1.2.2
|
|
223
|
+
## 1.2.2 (2014-02-23)
|
|
203
224
|
|
|
204
225
|
- Added global `content_for` option
|
|
205
226
|
- Added `stacked` option
|
|
206
227
|
|
|
207
|
-
## 1.2.1
|
|
228
|
+
## 1.2.1 (2013-12-08)
|
|
208
229
|
|
|
209
230
|
- Added localization for Google Charts
|
|
210
231
|
|
|
211
|
-
## 1.2.0
|
|
232
|
+
## 1.2.0 (2013-07-27)
|
|
212
233
|
|
|
213
234
|
- Added bar chart and area chart
|
|
214
235
|
- Resize Google Charts on window resize
|
|
215
236
|
|
|
216
|
-
## 1.1.3
|
|
237
|
+
## 1.1.3 (2013-06-26)
|
|
217
238
|
|
|
218
239
|
- Added content_for option
|
|
219
240
|
|
|
220
|
-
## 1.1.2
|
|
241
|
+
## 1.1.2 (2013-06-11)
|
|
221
242
|
|
|
222
243
|
- Updated chartkick.js to v1.0.1
|
|
223
244
|
|
|
224
|
-
## 1.1.1
|
|
245
|
+
## 1.1.1 (2013-06-10)
|
|
225
246
|
|
|
226
247
|
- Added support for Sinatra
|
|
227
248
|
|
|
228
|
-
## 1.1.0
|
|
249
|
+
## 1.1.0 (2013-06-03)
|
|
229
250
|
|
|
230
251
|
- Added support for Padrino and Rails 2.3+
|
|
231
252
|
|
|
232
|
-
## 1.0.1
|
|
253
|
+
## 1.0.1 (2013-05-23)
|
|
233
254
|
|
|
234
255
|
- Updated chartkick.js to v1.0.1
|
|
235
256
|
|
|
236
|
-
## 1.0.0
|
|
257
|
+
## 1.0.0 (2013-05-15)
|
|
237
258
|
|
|
238
259
|
- Use semantic versioning (no changes)
|
|
239
260
|
|
|
240
|
-
## 0.0.5
|
|
261
|
+
## 0.0.5 (2013-05-14)
|
|
241
262
|
|
|
242
263
|
- Removed `:min => 0` default for charts with negative values
|
|
243
264
|
- Show legend when data given in `{:name => "", :data => {}}` format
|
|
244
265
|
|
|
245
|
-
## 0.0.4
|
|
266
|
+
## 0.0.4 (2013-05-13)
|
|
246
267
|
|
|
247
268
|
- Fix for `Uncaught ReferenceError: Chartkick is not defined` when chartkick.js is included in the `<head>`
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -4,10 +4,12 @@ Create beautiful JavaScript charts with one line of Ruby. No more fighting with
|
|
|
4
4
|
|
|
5
5
|
[See it in action](https://chartkick.com)
|
|
6
6
|
|
|
7
|
-
:fire: For admin charts and dashboards, check out [Blazer](https://github.com/ankane/blazer/)
|
|
7
|
+
:fire: For admin charts and dashboards, check out [Blazer](https://github.com/ankane/blazer/), and for advanced visualizations, check out [Vega](https://github.com/ankane/vega)
|
|
8
8
|
|
|
9
9
|
:two_hearts: A perfect companion to [Groupdate](https://github.com/ankane/groupdate), [Hightop](https://github.com/ankane/hightop), and [ActiveMedian](https://github.com/ankane/active_median)
|
|
10
10
|
|
|
11
|
+
[](https://travis-ci.org/ankane/chartkick)
|
|
12
|
+
|
|
11
13
|
## Quick Start
|
|
12
14
|
|
|
13
15
|
Add this line to your application's Gemfile:
|
|
@@ -260,7 +262,7 @@ Show insignificant zeros, useful for currency - *Chart.js, Highcharts*
|
|
|
260
262
|
<%= line_chart data, round: 2, zeros: true %>
|
|
261
263
|
```
|
|
262
264
|
|
|
263
|
-
Friendly
|
|
265
|
+
Friendly byte sizes - *Chart.js 2.8+*
|
|
264
266
|
|
|
265
267
|
```erb
|
|
266
268
|
<%= line_chart data, bytes: true %>
|
|
@@ -323,7 +325,7 @@ Then, in your layout, use:
|
|
|
323
325
|
<%= yield :charts_js %>
|
|
324
326
|
```
|
|
325
327
|
|
|
326
|
-
|
|
328
|
+
For Padrino, use `yield_content` instead of `yield`.
|
|
327
329
|
|
|
328
330
|
This is great for including all of your JavaScript at the bottom of the page.
|
|
329
331
|
|
|
@@ -370,9 +372,7 @@ If you want to use the charting library directly, get the code with:
|
|
|
370
372
|
<%= line_chart data, code: true %>
|
|
371
373
|
```
|
|
372
374
|
|
|
373
|
-
The code will be logged to the JavaScript console.
|
|
374
|
-
|
|
375
|
-
> JavaScript functions cannot be logged, so it may not be identical.
|
|
375
|
+
The code will be logged to the JavaScript console. JavaScript functions cannot be logged, so it may not be identical.
|
|
376
376
|
|
|
377
377
|
### Download Charts
|
|
378
378
|
|
|
@@ -384,7 +384,7 @@ Give users the ability to download charts. It all happens in the browser - no se
|
|
|
384
384
|
<%= line_chart data, download: true %>
|
|
385
385
|
```
|
|
386
386
|
|
|
387
|
-
|
|
387
|
+
Safari will open the image in a new window instead of downloading.
|
|
388
388
|
|
|
389
389
|
Set the filename
|
|
390
390
|
|
|
@@ -418,7 +418,7 @@ Next, choose your charting library.
|
|
|
418
418
|
- [Google Charts](#google-charts)
|
|
419
419
|
- [Highcharts](#highcharts)
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
In the instructions below, `application.js` must be included **before** the charts in your views, unless using the `:content_for` option.
|
|
422
422
|
|
|
423
423
|
### Chart.js
|
|
424
424
|
|
|
@@ -505,6 +505,26 @@ Download [chartkick.js](https://raw.githubusercontent.com/ankane/chartkick/maste
|
|
|
505
505
|
<script src="chartkick.js"></script>
|
|
506
506
|
```
|
|
507
507
|
|
|
508
|
+
Then include the charting library.
|
|
509
|
+
|
|
510
|
+
Chart.js - download [Chart.bundle.js](https://unpkg.com/chart.js@2/dist/Chart.bundle.js)
|
|
511
|
+
|
|
512
|
+
```html
|
|
513
|
+
<script src="Chart.bundle.js"></script>
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
Google Charts
|
|
517
|
+
|
|
518
|
+
```html
|
|
519
|
+
<script src="https://www.gstatic.com/charts/loader.js"></script>
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
Highcharts - download [highcharts.js](https://code.highcharts.com/highcharts.js)
|
|
523
|
+
|
|
524
|
+
```html
|
|
525
|
+
<script src="highcharts.js"></script>
|
|
526
|
+
```
|
|
527
|
+
|
|
508
528
|
### Multiple Libraries
|
|
509
529
|
|
|
510
530
|
If more than one charting library is loaded, choose between them with:
|
|
@@ -562,6 +582,12 @@ Redraw the chart with:
|
|
|
562
582
|
chart.redraw()
|
|
563
583
|
```
|
|
564
584
|
|
|
585
|
+
Destroy the chart with:
|
|
586
|
+
|
|
587
|
+
```javascript
|
|
588
|
+
chart.destroy()
|
|
589
|
+
```
|
|
590
|
+
|
|
565
591
|
Loop over charts with:
|
|
566
592
|
|
|
567
593
|
```javascript
|
|
@@ -597,14 +623,6 @@ Breaking changes
|
|
|
597
623
|
- Removed `window.Chartkick = {...}` way to set config - use `Chartkick.configure` instead
|
|
598
624
|
- Removed support for the Google Charts jsapi loader - use loader.js instead
|
|
599
625
|
|
|
600
|
-
### 2.0
|
|
601
|
-
|
|
602
|
-
Breaking changes
|
|
603
|
-
|
|
604
|
-
- Chart.js is now the default adapter if multiple are loaded - yay open source!
|
|
605
|
-
- Axis types are automatically detected - no need for `discrete: true`
|
|
606
|
-
- Better date support - dates are no longer treated as UTC
|
|
607
|
-
|
|
608
626
|
## Credits
|
|
609
627
|
|
|
610
628
|
Chartkick uses [iso8601.js](https://github.com/Do/iso8601.js) to parse dates and times.
|
|
@@ -613,8 +631,6 @@ Chartkick uses [iso8601.js](https://github.com/Do/iso8601.js) to parse dates and
|
|
|
613
631
|
|
|
614
632
|
View the [changelog](https://github.com/ankane/chartkick/blob/master/CHANGELOG.md)
|
|
615
633
|
|
|
616
|
-
Chartkick follows [Semantic Versioning](https://semver.org/)
|
|
617
|
-
|
|
618
634
|
## Contributing
|
|
619
635
|
|
|
620
636
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
|
@@ -623,3 +639,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
|
623
639
|
- Fix bugs and [submit pull requests](https://github.com/ankane/chartkick/pulls)
|
|
624
640
|
- Write, clarify, or fix documentation
|
|
625
641
|
- Suggest or add new features
|
|
642
|
+
|
|
643
|
+
To get started with development:
|
|
644
|
+
|
|
645
|
+
```sh
|
|
646
|
+
git clone https://github.com/ankane/chartkick.git
|
|
647
|
+
cd chartkick
|
|
648
|
+
bundle install
|
|
649
|
+
bundle exec rake test
|
|
650
|
+
```
|