chartkick 2.3.5 → 3.4.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: d37a995b1d870a7e93be5d5eb338d163e1b42653304baab7bad889aff6f655fe
4
- data.tar.gz: 9c5495a74d4e6c03b199a263556d9dcee91ee4e0c87fb7694851971068a817e2
3
+ metadata.gz: 7f0229f1e93dc1d2b672317f7147394f8a17e4fb42bb1ab2c979a1ac5b67a0e7
4
+ data.tar.gz: c8229ee28b9bbcfbc61c971a39e67415295cdd8043b25cfac1fa5ef992981cf9
5
5
  SHA512:
6
- metadata.gz: e2e350cf8f342a7d55bfbc0a6581c92e25b4a59442719ef12aa32400ba9610b137360a10535a96afa049025a739235f28b00ade4299ad1cad5d2f9525ea1517d
7
- data.tar.gz: 3de86761cb1f9e63d71589640827cc8391c668b398f9e49cdf4f4029351850181cc4e8197d8c6c341b6e7d79147ee01d96be6cf72b55ccca1f1395f4504d951e
6
+ metadata.gz: dce86c2e3bcf36e4c1c104e1446076cc7086563cefb12968355f236bece5460034b4e076ed98fc64f9453f6abc10b6c38287caeaef84ba0bd00566f3de0b6fe1
7
+ data.tar.gz: a2774bde5c45e347d532720b14c9ee4ed04136d379796355339e6ba5b56194a98916bee56308a3e16252afdea50110a843e4e63b783db9712d20cfaf502f8113
data/CHANGELOG.md CHANGED
@@ -1,52 +1,120 @@
1
- ## 2.3.5
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)
23
+
24
+ - Updated Chartkick.js to 3.2.0
25
+ - Rolled back Chart.js to 2.8.0 due to legend change
26
+
27
+ ## 3.2.2 (2019-10-27)
28
+
29
+ - Updated Chartkick.js to 3.1.3
30
+ - Updated Chart.js to 2.9.1
31
+
32
+ ## 3.2.1 (2019-07-15)
33
+
34
+ - Updated Chartkick.js to 3.1.1
35
+
36
+ ## 3.2.0 (2019-06-04)
37
+
38
+ - Fixed XSS vulnerability - [more info](https://github.com/ankane/chartkick/issues/488)
39
+
40
+ ## 3.1.0 (2019-05-26)
41
+
42
+ - Updated Chartkick.js to 3.1.0
43
+ - Updated Chart.js to 2.8.0
44
+
45
+ ## 3.0.2 (2019-01-03)
46
+
47
+ - Fixed error with `nonce` option with Secure Headers and Rails < 5.2
48
+ - Updated Chartkick.js to 3.0.2
49
+ - Updated Chart.js to 2.7.3
50
+
51
+ ## 3.0.1 (2018-08-13)
52
+
53
+ - Updated Chartkick.js to 3.0.1
54
+
55
+ ## 3.0.0 (2018-08-08)
56
+
57
+ - Updated Chartkick.js to 3.0.0
58
+ - Added `code` option
59
+ - Added support for `nonce: true`
60
+
61
+ Breaking changes
62
+
63
+ - Removed support for Rails < 4.2
64
+ - Removed chartkick.js from asset precompile (no longer needed)
65
+ - Removed `xtype` option - numeric axes are automatically detected
66
+ - Removed `window.Chartkick = {...}` way to set config - use `Chartkick.configure` instead
67
+ - Removed support for the Google Charts jsapi loader - use loader.js instead
68
+
69
+ ## 2.3.5 (2018-06-15)
2
70
 
3
71
  - Updated Chartkick.js to 2.3.6
4
72
 
5
- ## 2.3.4
73
+ ## 2.3.4 (2018-04-10)
6
74
 
7
75
  - Updated Chartkick.js to 2.3.5
8
76
  - Updated Chart.js to 2.7.2
9
77
 
10
- ## 2.3.3
78
+ ## 2.3.3 (2018-03-25)
11
79
 
12
80
  - Updated Chartkick.js to 2.3.4
13
81
 
14
- ## 2.3.2
82
+ ## 2.3.2 (2018-02-26)
15
83
 
16
84
  - Updated Chartkick.js to 2.3.3
17
85
 
18
- ## 2.3.1
86
+ ## 2.3.1 (2018-02-23)
19
87
 
20
88
  - Updated Chartkick.js to 2.3.1
21
89
 
22
- ## 2.3.0
90
+ ## 2.3.0 (2018-02-21)
23
91
 
24
92
  - Fixed deep merge error for non-Rails apps
25
93
  - Updated Chartkick.js to 2.3.0
26
94
 
27
- ## 2.2.5
95
+ ## 2.2.5 (2017-10-28)
28
96
 
29
97
  - Updated Chart.js to 2.7.1
30
98
 
31
- ## 2.2.4
99
+ ## 2.2.4 (2017-05-14)
32
100
 
33
101
  - Added compatibility with Rails API
34
102
  - Updated Chartkick.js to 2.2.4
35
103
 
36
- ## 2.2.3
104
+ ## 2.2.3 (2017-02-22)
37
105
 
38
106
  - Updated Chartkick.js to 2.2.3
39
107
  - Updated Chart.js to 2.5.0
40
108
 
41
- ## 2.2.2
109
+ ## 2.2.2 (2017-01-07)
42
110
 
43
111
  - Updated Chartkick.js to 2.2.2
44
112
 
45
- ## 2.2.1
113
+ ## 2.2.1 (2016-12-05)
46
114
 
47
115
  - Updated Chartkick.js to 2.2.1
48
116
 
49
- ## 2.2.0
117
+ ## 2.2.0 (2016-12-03)
50
118
 
51
119
  - Updated Chartkick.js to 2.2.0
52
120
  - Improved JavaScript API
@@ -54,59 +122,59 @@
54
122
  - Added `refresh` option
55
123
  - Added `donut` option to pie chart
56
124
 
57
- ## 2.1.3
125
+ ## 2.1.3 (2016-11-29)
58
126
 
59
127
  - Updated Chartkick.js to 2.1.2 - fixes missing zero values for Chart.js
60
128
 
61
- ## 2.1.2
129
+ ## 2.1.2 (2016-11-28)
62
130
 
63
131
  - Added `defer` option
64
132
  - Added `nonce` option
65
133
  - Updated Chartkick.js to 2.1.1
66
134
 
67
- ## 2.1.1
135
+ ## 2.1.1 (2016-09-11)
68
136
 
69
137
  - Use custom version of Chart.js to fix label overlap
70
138
 
71
- ## 2.1.0
139
+ ## 2.1.0 (2016-09-10)
72
140
 
73
141
  - Added basic support for new Google Charts loader
74
142
  - Added `configure` function
75
143
  - Dropped jQuery and Zepto dependencies for AJAX
76
144
  - Updated Chart.js to 2.2.2
77
145
 
78
- ## 2.0.2
146
+ ## 2.0.2 (2016-08-11)
79
147
 
80
148
  - Updated Chartkick.js to 2.0.1
81
149
  - Updated Chart.js to 2.2.1
82
150
 
83
- ## 2.0.1
151
+ ## 2.0.1 (2016-07-29)
84
152
 
85
153
  - Small Chartkick.js fixes
86
154
  - Updated Chart.js to 2.2.0
87
155
 
88
- ## 2.0.0
156
+ ## 2.0.0 (2016-05-30)
89
157
 
90
158
  - Chart.js is now the default adapter - yay open source!
91
159
  - Axis types are automatically detected - no need for `discrete: true`
92
160
  - Better date support
93
161
  - New JavaScript API
94
162
 
95
- ## 1.5.2
163
+ ## 1.5.2 (2016-05-05)
96
164
 
97
165
  - Fixed Sprockets error
98
166
 
99
- ## 1.5.1
167
+ ## 1.5.1 (2016-05-03)
100
168
 
101
169
  - Updated chartkick.js to latest version
102
170
  - Included `Chart.bundle.js`
103
171
 
104
- ## 1.5.0
172
+ ## 1.5.0 (2016-05-01)
105
173
 
106
174
  - Added Chart.js adapter **beta**
107
175
  - Fixed line height on timeline charts
108
176
 
109
- ## 1.4.2
177
+ ## 1.4.2 (2016-02-29)
110
178
 
111
179
  - Added `width` option
112
180
  - Added `label` option
@@ -115,86 +183,86 @@
115
183
  - Better tooltip for dates for Google Charts
116
184
  - Fixed asset precompilation issue with Rails 5
117
185
 
118
- ## 1.4.1
186
+ ## 1.4.1 (2015-09-07)
119
187
 
120
188
  - Fixed regression with `min: nil`
121
189
 
122
- ## 1.4.0
190
+ ## 1.4.0 (2015-08-31)
123
191
 
124
192
  - Added scatter chart
125
193
  - Added axis titles
126
194
 
127
- ## 1.3.2
195
+ ## 1.3.2 (2014-07-04)
128
196
 
129
197
  - Fixed `except` error when not using Rails
130
198
 
131
- ## 1.3.1
199
+ ## 1.3.1 (2014-06-30)
132
200
 
133
201
  - Fixed blank screen bug
134
202
  - Fixed language support
135
203
 
136
- ## 1.3.0
204
+ ## 1.3.0 (2014-06-28)
137
205
 
138
206
  - Added timelines
139
207
 
140
- ## 1.2.5
208
+ ## 1.2.5 (2014-06-12)
141
209
 
142
210
  - Added support for multiple groups
143
211
  - Added `html` option
144
212
 
145
- ## 1.2.4
213
+ ## 1.2.4 (2014-03-24)
146
214
 
147
215
  - Added global options
148
216
  - Added `colors` option
149
217
 
150
- ## 1.2.3
218
+ ## 1.2.3 (2014-03-23)
151
219
 
152
220
  - Added geo chart
153
221
  - Added `discrete` option
154
222
 
155
- ## 1.2.2
223
+ ## 1.2.2 (2014-02-23)
156
224
 
157
225
  - Added global `content_for` option
158
226
  - Added `stacked` option
159
227
 
160
- ## 1.2.1
228
+ ## 1.2.1 (2013-12-08)
161
229
 
162
230
  - Added localization for Google Charts
163
231
 
164
- ## 1.2.0
232
+ ## 1.2.0 (2013-07-27)
165
233
 
166
234
  - Added bar chart and area chart
167
235
  - Resize Google Charts on window resize
168
236
 
169
- ## 1.1.3
237
+ ## 1.1.3 (2013-06-26)
170
238
 
171
239
  - Added content_for option
172
240
 
173
- ## 1.1.2
241
+ ## 1.1.2 (2013-06-11)
174
242
 
175
243
  - Updated chartkick.js to v1.0.1
176
244
 
177
- ## 1.1.1
245
+ ## 1.1.1 (2013-06-10)
178
246
 
179
247
  - Added support for Sinatra
180
248
 
181
- ## 1.1.0
249
+ ## 1.1.0 (2013-06-03)
182
250
 
183
251
  - Added support for Padrino and Rails 2.3+
184
252
 
185
- ## 1.0.1
253
+ ## 1.0.1 (2013-05-23)
186
254
 
187
255
  - Updated chartkick.js to v1.0.1
188
256
 
189
- ## 1.0.0
257
+ ## 1.0.0 (2013-05-15)
190
258
 
191
259
  - Use semantic versioning (no changes)
192
260
 
193
- ## 0.0.5
261
+ ## 0.0.5 (2013-05-14)
194
262
 
195
263
  - Removed `:min => 0` default for charts with negative values
196
264
  - Show legend when data given in `{:name => "", :data => {}}` format
197
265
 
198
- ## 0.0.4
266
+ ## 0.0.4 (2013-05-13)
199
267
 
200
268
  - Fix for `Uncaught ReferenceError: Chartkick is not defined` when chartkick.js is included in the `<head>`
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2018 Andrew Kane
1
+ Copyright (c) 2013-2020 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,12 +2,44 @@
2
2
 
3
3
  Create beautiful JavaScript charts with one line of Ruby. No more fighting with charting libraries!
4
4
 
5
- [See it in action](https://www.chartkick.com)
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
+ [![Build Status](https://travis-ci.org/ankane/chartkick.svg?branch=master)](https://travis-ci.org/ankane/chartkick)
12
+
13
+ ## Quick Start
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem "chartkick"
19
+ ```
20
+
21
+ For Rails 6 / Webpacker, run:
22
+
23
+ ```sh
24
+ yarn add chartkick chart.js
25
+ ```
26
+
27
+ And in `app/javascript/packs/application.js`, add:
28
+
29
+ ```js
30
+ require("chartkick")
31
+ require("chart.js")
32
+ ```
33
+
34
+ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
35
+
36
+ ```js
37
+ //= require chartkick
38
+ //= require Chart.bundle
39
+ ```
40
+
41
+ This sets up Chartkick with Chart.js. For other charting libraries, see [detailed instructions](#installation).
42
+
11
43
  ## Charts
12
44
 
13
45
  Line chart
@@ -116,6 +148,12 @@ Min and max values
116
148
 
117
149
  `min` defaults to 0 for charts with non-negative values. Use `nil` to let the charting library decide.
118
150
 
151
+ Min and max for x-axis - *Chart.js*
152
+
153
+ ```erb
154
+ <%= line_chart data, xmin: "2018-01-01", xmax: "2019-01-01" %>
155
+ ```
156
+
119
157
  Colors
120
158
 
121
159
  ```erb
@@ -206,6 +244,30 @@ Set a decimal separator - *Chart.js, Highcharts*
206
244
  <%= line_chart data, decimal: "," %>
207
245
  ```
208
246
 
247
+ Set significant digits - *Chart.js, Highcharts*
248
+
249
+ ```erb
250
+ <%= line_chart data, precision: 3 %>
251
+ ```
252
+
253
+ Set rounding - *Chart.js, Highcharts*
254
+
255
+ ```erb
256
+ <%= line_chart data, round: 2 %>
257
+ ```
258
+
259
+ Show insignificant zeros, useful for currency - *Chart.js, Highcharts*
260
+
261
+ ```erb
262
+ <%= line_chart data, round: 2, zeros: true %>
263
+ ```
264
+
265
+ Friendly byte sizes - *Chart.js 2.8+*
266
+
267
+ ```erb
268
+ <%= line_chart data, bytes: true %>
269
+ ```
270
+
209
271
  Show a message when data is empty
210
272
 
211
273
  ```erb
@@ -257,18 +319,19 @@ You capture the JavaScript in a content block with:
257
319
  Chartkick.options[:content_for] = :charts_js
258
320
  ```
259
321
 
260
- Then, in your layout:
322
+ Then, in your layout, use:
261
323
 
262
324
  ```erb
263
- <%= yield :charts_js %> <!-- Rails -->
264
- <%= yield_content :charts_js %> <!-- Padrino -->
325
+ <%= yield :charts_js %>
265
326
  ```
266
327
 
328
+ For Padrino, use `yield_content` instead of `yield`.
329
+
267
330
  This is great for including all of your JavaScript at the bottom of the page.
268
331
 
269
332
  ### Data
270
333
 
271
- Pass data as a Hash or Array
334
+ Pass data as a hash or array
272
335
 
273
336
  ```erb
274
337
  <%= pie_chart({"Football" => 10, "Basketball" => 5}) %>
@@ -284,12 +347,33 @@ For multiple series, use the format
284
347
  ] %>
285
348
  ```
286
349
 
287
- Times can be a time, a timestamp, or a string (strings are parsed)
350
+ Times can be a time or a string (strings are parsed)
288
351
 
289
352
  ```erb
290
- <%= line_chart({20.day.ago => 5, 1368174456 => 4, "2013-05-07 00:00:00 UTC" => 7}) %>
353
+ <%= line_chart({20.day.ago => 5, "2013-05-07 00:00:00 UTC" => 7}) %>
291
354
  ```
292
355
 
356
+ ### Multiple Series
357
+
358
+ You can pass a few options with a series:
359
+
360
+ - `name`
361
+ - `data`
362
+ - `color`
363
+ - `dataset` - *Chart.js only*
364
+ - `points` - *Chart.js only*
365
+ - `curve` - *Chart.js only*
366
+
367
+ ### Code
368
+
369
+ If you want to use the charting library directly, get the code with:
370
+
371
+ ```erb
372
+ <%= line_chart data, code: true %>
373
+ ```
374
+
375
+ The code will be logged to the JavaScript console. JavaScript functions cannot be logged, so it may not be identical.
376
+
293
377
  ### Download Charts
294
378
 
295
379
  *Chart.js only*
@@ -300,13 +384,25 @@ Give users the ability to download charts. It all happens in the browser - no se
300
384
  <%= line_chart data, download: true %>
301
385
  ```
302
386
 
387
+ Safari will open the image in a new window instead of downloading.
388
+
303
389
  Set the filename
304
390
 
305
391
  ```erb
306
- <%= line_chart data, download: "boom" %>
392
+ <%= line_chart data, download: {filename: "boom"} %>
307
393
  ```
308
394
 
309
- **Note:** Safari will open the image in a new window instead of downloading.
395
+ Set the background color
396
+
397
+ ```erb
398
+ <%= line_chart data, download: {background: "#ffffff"} %>
399
+ ```
400
+
401
+ Set title
402
+
403
+ ```erb
404
+ <%= line_chart data, title: "Awesome chart" %>
405
+ ```
310
406
 
311
407
  ## Installation
312
408
 
@@ -318,91 +414,116 @@ gem "chartkick"
318
414
 
319
415
  Next, choose your charting library.
320
416
 
321
- ### Charting Libraries
417
+ - [Chart.js](#chart-js)
418
+ - [Google Charts](#google-charts)
419
+ - [Highcharts](#highcharts)
322
420
 
323
- **Note:** In the instructions below, `application.js` must be included **before** the charts in your views, unless using the `:content_for` option.
421
+ In the instructions below, `application.js` must be included **before** the charts in your views, unless using the `:content_for` option.
324
422
 
325
- #### Chart.js
423
+ ### Chart.js
326
424
 
327
- In `application.js`, add:
425
+ For Rails 6 / Webpacker, run:
328
426
 
329
- ```js
330
- //= require Chart.bundle
331
- //= require chartkick
427
+ ```sh
428
+ yarn add chartkick chart.js
332
429
  ```
333
430
 
334
- #### Google Charts
431
+ And in `app/javascript/packs/application.js`, add:
432
+
433
+ ```js
434
+ require("chartkick")
435
+ require("chart.js")
436
+ ```
335
437
 
336
- In `application.js`, add:
438
+ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
337
439
 
338
440
  ```js
339
441
  //= require chartkick
442
+ //= require Chart.bundle
340
443
  ```
341
444
 
342
- In your views, before `application.js`, add:
445
+ ### Google Charts
446
+
447
+ In your layout or views, add:
343
448
 
344
449
  ```erb
345
450
  <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
346
451
  ```
347
452
 
348
- #### Highcharts
453
+ For Rails 6 / Webpacker, run:
349
454
 
350
- Download [highcharts.js](https://code.highcharts.com/highcharts.js) into `vendor/assets/javascripts` (or use `yarn add highcharts` in Rails 5.1+).
455
+ ```sh
456
+ yarn add chartkick
457
+ ```
351
458
 
352
- In `application.js`, add:
459
+ And in `app/javascript/packs/application.js`, add:
353
460
 
354
461
  ```js
355
- //= require highcharts
356
- //= require chartkick
462
+ require("chartkick")
357
463
  ```
358
464
 
359
- Works with Highcharts 2.1+
465
+ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
360
466
 
361
- ### Webpacker
467
+ ```js
468
+ //= require chartkick
469
+ ```
362
470
 
363
- For Webpacker, use Yarn to install the JavaScript libraries:
471
+ To specify a language or Google Maps API key, use:
364
472
 
365
- ```sh
366
- yarn add chartkick chart.js # or highcharts
473
+ ```js
474
+ Chartkick.configure({language: "de", mapsApiKey: "..."})
367
475
  ```
368
476
 
369
- Then include them in your pack.
477
+ before your charts.
478
+
479
+ ### Highcharts
370
480
 
371
- ```es6
372
- import Chartkick from "chartkick";
373
- window.Chartkick = Chartkick;
481
+ For Rails 6 / Webpacker, run:
374
482
 
375
- // for Chart.js
376
- import Chart from "chart.js";
377
- Chartkick.addAdapter(Chart);
483
+ ```sh
484
+ yarn add chartkick highcharts
485
+ ```
378
486
 
379
- // for Highcharts
380
- import Highcharts from "highcharts";
381
- Chartkick.addAdapter(Highcharts);
487
+ And in `app/javascript/packs/application.js`, add:
382
488
 
383
- // for Google Charts
384
- // just include https://www.gstatic.com/charts/loader.js in your views
489
+ ```js
490
+ require("chartkick").use(require("highcharts"))
385
491
  ```
386
492
 
387
- You pack must be included **before** the charts in your views, unless using the `:content_for` option.
493
+ For Rails 5 / Sprockets, download [highcharts.js](https://code.highcharts.com/highcharts.js) into `vendor/assets/javascripts` (or use `yarn add highcharts` in Rails 5.1+), and in `app/assets/javascripts/application.js`, add:
494
+
495
+ ```js
496
+ //= require chartkick
497
+ //= require highcharts
498
+ ```
388
499
 
389
500
  ### Sinatra and Padrino
390
501
 
391
- You must include `chartkick.js` manually. [Download it here](https://raw.githubusercontent.com/ankane/chartkick/master/vendor/assets/javascripts/chartkick.js)
502
+ Download [chartkick.js](https://raw.githubusercontent.com/ankane/chartkick/master/vendor/assets/javascripts/chartkick.js) and include it manually.
392
503
 
393
504
  ```html
394
505
  <script src="chartkick.js"></script>
395
506
  ```
396
507
 
397
- ### Localization
508
+ Then include the charting library.
398
509
 
399
- To specify a language for Google Charts, add:
510
+ Chart.js - download [Chart.bundle.js](https://unpkg.com/chart.js@2/dist/Chart.bundle.js)
400
511
 
401
- ```javascript
402
- Chartkick.configure({language: "de"});
512
+ ```html
513
+ <script src="Chart.bundle.js"></script>
403
514
  ```
404
515
 
405
- after the JavaScript files and before your charts.
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
+ ```
406
527
 
407
528
  ### Multiple Libraries
408
529
 
@@ -461,6 +582,12 @@ Redraw the chart with:
461
582
  chart.redraw()
462
583
  ```
463
584
 
585
+ Destroy the chart with:
586
+
587
+ ```javascript
588
+ chart.destroy()
589
+ ```
590
+
464
591
  Loop over charts with:
465
592
 
466
593
  ```javascript
@@ -469,6 +596,10 @@ Chartkick.eachChart( function(chart) {
469
596
  })
470
597
  ```
471
598
 
599
+ ## Content Security Policy (CSP)
600
+
601
+ Check out [how to configure CSP](https://github.com/ankane/chartkick/blob/master/guides/Content-Security-Policy.md)
602
+
472
603
  ## No Ruby? No Problem
473
604
 
474
605
  Check out [chartkick.js](https://github.com/ankane/chartkick.js)
@@ -476,18 +607,21 @@ Check out [chartkick.js](https://github.com/ankane/chartkick.js)
476
607
  ## Tutorials
477
608
 
478
609
  - [Charts with Chartkick and Groupdate](https://gorails.com/episodes/charts-with-chartkick-and-groupdate)
610
+ - [Creando gráficos en Ruby on Rails con Chartkick y Chart.js](https://www.youtube.com/watch?v=W92AlkwQn3M)
479
611
  - [Make Easy Graphs and Charts on Rails with Chartkick](https://www.sitepoint.com/make-easy-graphs-and-charts-on-rails-with-chartkick/)
480
612
  - [Practical Graphs on Rails: Chartkick in Practice](https://www.sitepoint.com/graphs-on-rails-chartkick-in-practice/)
481
613
 
482
614
  ## Upgrading
483
615
 
484
- ### 2.0
616
+ ### 3.0
485
617
 
486
618
  Breaking changes
487
619
 
488
- - Chart.js is now the default adapter if multiple are loaded - yay open source!
489
- - Axis types are automatically detected - no need for `discrete: true`
490
- - Better date support - dates are no longer treated as UTC
620
+ - Removed support for Rails < 4.2
621
+ - Removed chartkick.js from asset precompile (no longer needed)
622
+ - Removed `xtype` option - numeric axes are automatically detected
623
+ - Removed `window.Chartkick = {...}` way to set config - use `Chartkick.configure` instead
624
+ - Removed support for the Google Charts jsapi loader - use loader.js instead
491
625
 
492
626
  ## Credits
493
627
 
@@ -497,8 +631,6 @@ Chartkick uses [iso8601.js](https://github.com/Do/iso8601.js) to parse dates and
497
631
 
498
632
  View the [changelog](https://github.com/ankane/chartkick/blob/master/CHANGELOG.md)
499
633
 
500
- Chartkick follows [Semantic Versioning](https://semver.org/)
501
-
502
634
  ## Contributing
503
635
 
504
636
  Everyone is encouraged to help improve this project. Here are a few ways you can help:
@@ -507,3 +639,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
507
639
  - Fix bugs and [submit pull requests](https://github.com/ankane/chartkick/pulls)
508
640
  - Write, clarify, or fix documentation
509
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
+ ```