chartkick 4.1.2 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +71 -59
- data/lib/chartkick/engine.rb +2 -2
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +504 -257
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89ed1824ceea10158a8321a32e75daeb96dcb1eaeea839dc6f4eddd1de97cd88
|
4
|
+
data.tar.gz: 8c4a6ff2477b7314cec55237fbcfafe7e0b95efb4890a50925edb4eb095bb468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f6bedf2f1e49a194cdede42c1fb80d7dbf02a0d26955f0c0248b625736efc52269c966b3c8a50a0f3ba8bc5782bc7ad6843195a123fe6e9211026255305c825
|
7
|
+
data.tar.gz: 341942cf99eaf9a262d13b0abc8ca00898d88a2ac688a269bf932e6d0e365592a1ccca0f46bbc9e4ebca9fffcb9991853a8c4ea82448e73fe04b1847f12d5bd4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 4.1.3 (2022-01-15)
|
2
|
+
|
3
|
+
- Support for `importmap-rails` is no longer experimental
|
4
|
+
- Updated Chart.js to 3.7.0
|
5
|
+
- Fixed asset precompilation error with `importmap-rails`
|
6
|
+
|
1
7
|
## 4.1.2 (2021-11-06)
|
2
8
|
|
3
9
|
- Removed automatic pinning for `importmap-rails` (still experimental)
|
data/README.md
CHANGED
@@ -20,26 +20,17 @@ Add this line to your application’s Gemfile:
|
|
20
20
|
gem "chartkick"
|
21
21
|
```
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
```sh
|
26
|
-
yarn add chartkick chart.js
|
27
|
-
```
|
28
|
-
|
29
|
-
And in `app/javascript/packs/application.js`, add:
|
23
|
+
Then follow the instructions for your framework:
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
- [Rails 7 / Importmap](#rails-7--importmap)
|
26
|
+
- [Rails 6 / Webpacker](#rails-6--webpacker)
|
27
|
+
- [Rails 5 / Sprockets](#rails-5--sprockets)
|
34
28
|
|
35
|
-
|
29
|
+
This sets up Chartkick with [Chart.js](https://www.chartjs.org/). For other charting libraries and frameworks, see [detailed instructions](#installation).
|
36
30
|
|
37
|
-
|
38
|
-
//= require chartkick
|
39
|
-
//= require Chart.bundle
|
40
|
-
```
|
31
|
+
### Rails 7 / Importmap
|
41
32
|
|
42
|
-
|
33
|
+
In `config/importmap.rb`, add:
|
43
34
|
|
44
35
|
```ruby
|
45
36
|
pin "chartkick", to: "chartkick.js"
|
@@ -53,7 +44,28 @@ import "chartkick"
|
|
53
44
|
import "Chart.bundle"
|
54
45
|
```
|
55
46
|
|
56
|
-
|
47
|
+
### Rails 6 / Webpacker
|
48
|
+
|
49
|
+
Run:
|
50
|
+
|
51
|
+
```sh
|
52
|
+
yarn add chartkick chart.js
|
53
|
+
```
|
54
|
+
|
55
|
+
And in `app/javascript/packs/application.js`, add:
|
56
|
+
|
57
|
+
```js
|
58
|
+
import "chartkick/chart.js"
|
59
|
+
```
|
60
|
+
|
61
|
+
### Rails 5 / Sprockets
|
62
|
+
|
63
|
+
In `app/assets/javascripts/application.js`, add:
|
64
|
+
|
65
|
+
```js
|
66
|
+
//= require chartkick
|
67
|
+
//= require Chart.bundle
|
68
|
+
```
|
57
69
|
|
58
70
|
## Charts
|
59
71
|
|
@@ -428,6 +440,20 @@ Next, choose your charting library.
|
|
428
440
|
|
429
441
|
### Chart.js
|
430
442
|
|
443
|
+
For Rails 7 / Importmap, in `config/importmap.rb`, add:
|
444
|
+
|
445
|
+
```ruby
|
446
|
+
pin "chartkick", to: "chartkick.js"
|
447
|
+
pin "Chart.bundle", to: "Chart.bundle.js"
|
448
|
+
```
|
449
|
+
|
450
|
+
And in `app/javascript/application.js`, add:
|
451
|
+
|
452
|
+
```js
|
453
|
+
import "chartkick"
|
454
|
+
import "Chart.bundle"
|
455
|
+
```
|
456
|
+
|
431
457
|
For Rails 6 / Webpacker, run:
|
432
458
|
|
433
459
|
```sh
|
@@ -447,26 +473,24 @@ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
|
|
447
473
|
//= require Chart.bundle
|
448
474
|
```
|
449
475
|
|
450
|
-
|
476
|
+
### Google Charts
|
477
|
+
|
478
|
+
In your layout or views, add:
|
479
|
+
|
480
|
+
```erb
|
481
|
+
<%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
|
482
|
+
```
|
483
|
+
|
484
|
+
For Rails 7 / Importmap, in `config/importmap.rb`, add:
|
451
485
|
|
452
486
|
```ruby
|
453
487
|
pin "chartkick", to: "chartkick.js"
|
454
|
-
pin "Chart.bundle", to: "Chart.bundle.js"
|
455
488
|
```
|
456
489
|
|
457
490
|
And in `app/javascript/application.js`, add:
|
458
491
|
|
459
492
|
```js
|
460
493
|
import "chartkick"
|
461
|
-
import "Chart.bundle"
|
462
|
-
```
|
463
|
-
|
464
|
-
### Google Charts
|
465
|
-
|
466
|
-
In your layout or views, add:
|
467
|
-
|
468
|
-
```erb
|
469
|
-
<%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
|
470
494
|
```
|
471
495
|
|
472
496
|
For Rails 6 / Webpacker, run:
|
@@ -487,18 +511,6 @@ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
|
|
487
511
|
//= require chartkick
|
488
512
|
```
|
489
513
|
|
490
|
-
For Rails 7 / Importmap (experimental), in `config/importmap.rb`, add:
|
491
|
-
|
492
|
-
```ruby
|
493
|
-
pin "chartkick", to: "chartkick.js"
|
494
|
-
```
|
495
|
-
|
496
|
-
And in `app/javascript/application.js`, add:
|
497
|
-
|
498
|
-
```js
|
499
|
-
import "chartkick"
|
500
|
-
```
|
501
|
-
|
502
514
|
To specify a language or Google Maps API key, use:
|
503
515
|
|
504
516
|
```js
|
@@ -509,44 +521,44 @@ before your charts.
|
|
509
521
|
|
510
522
|
### Highcharts
|
511
523
|
|
512
|
-
For Rails
|
524
|
+
For Rails 7 / Importmap, run:
|
513
525
|
|
514
526
|
```sh
|
515
|
-
|
527
|
+
bin/importmap pin highcharts --download
|
516
528
|
```
|
517
529
|
|
518
|
-
And in `
|
530
|
+
And in `config/importmap.rb`, add:
|
519
531
|
|
520
|
-
```
|
521
|
-
|
532
|
+
```ruby
|
533
|
+
pin "chartkick", to: "chartkick.js"
|
522
534
|
```
|
523
535
|
|
524
|
-
|
536
|
+
And in `app/javascript/application.js`, add:
|
525
537
|
|
526
538
|
```js
|
527
|
-
|
528
|
-
|
529
|
-
```
|
530
|
-
|
531
|
-
For Rails 7 / Importmap (experimental), in `config/importmap.rb`, add:
|
539
|
+
import "chartkick"
|
540
|
+
import Highcharts from "highcharts"
|
532
541
|
|
533
|
-
|
534
|
-
pin "chartkick", to: "chartkick.js"
|
542
|
+
window.Highcharts = Highcharts
|
535
543
|
```
|
536
544
|
|
537
|
-
|
545
|
+
For Rails 6 / Webpacker, run:
|
538
546
|
|
539
547
|
```sh
|
540
|
-
|
548
|
+
yarn add chartkick highcharts
|
541
549
|
```
|
542
550
|
|
543
|
-
And in `app/javascript/application.js`, add:
|
551
|
+
And in `app/javascript/packs/application.js`, add:
|
544
552
|
|
545
553
|
```js
|
546
|
-
import "chartkick"
|
547
|
-
|
554
|
+
import "chartkick/highcharts"
|
555
|
+
```
|
548
556
|
|
549
|
-
|
557
|
+
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:
|
558
|
+
|
559
|
+
```js
|
560
|
+
//= require chartkick
|
561
|
+
//= require highcharts
|
550
562
|
```
|
551
563
|
|
552
564
|
### Sinatra and Padrino
|
data/lib/chartkick/engine.rb
CHANGED
@@ -3,8 +3,8 @@ module Chartkick
|
|
3
3
|
# for assets
|
4
4
|
|
5
5
|
# for importmap
|
6
|
-
|
7
|
-
|
6
|
+
initializer "chartkick.importmap" do |app|
|
7
|
+
if defined?(Importmap)
|
8
8
|
app.config.assets.precompile << "chartkick.js"
|
9
9
|
app.config.assets.precompile << "Chart.bundle.js"
|
10
10
|
end
|
data/lib/chartkick/version.rb
CHANGED