chartkick 5.0.1 → 5.0.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 +4 -0
- data/README.md +19 -67
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +480 -202
- 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: 728c817d65d8fad4d590b1834d997fb076a4e15c47a9d170f0a6864abef66c4e
|
4
|
+
data.tar.gz: 507134d99ab585e19a0d750ebd3d7827dcca30708cda1b17fb2f4e8b92b2dc5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c955ebaebd247802d0fb65b7a9eeb73a5b18e558c732a943d3dbcb11e9c23146f953474db1510018ba8f3771e58eb6da73e7ff93ae0d62e0f7b312bd33b1165e
|
7
|
+
data.tar.gz: f1f36614e401ecaa62a08fb65b280860a199e9b2396b8815ba71e9de95d01f83b96a68fef83470f788c0defa3c31bdd96e78b30df203f9c2a9642a11835a1767
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -27,7 +27,7 @@ Then follow the instructions for your JavaScript setup:
|
|
27
27
|
- [Webpacker](#webpacker) (Rails 6 default)
|
28
28
|
- [Sprockets](#sprockets)
|
29
29
|
|
30
|
-
This sets up Chartkick with [Chart.js](https://www.chartjs.org/). For other charting libraries and frameworks, see [
|
30
|
+
This sets up Chartkick with [Chart.js](https://www.chartjs.org/). For other charting libraries and frameworks, see [these instructions](#additional-charting-libraries).
|
31
31
|
|
32
32
|
### Importmap
|
33
33
|
|
@@ -441,55 +441,11 @@ Set title
|
|
441
441
|
<%= line_chart data, title: "Awesome chart" %>
|
442
442
|
```
|
443
443
|
|
444
|
-
##
|
444
|
+
## Additional Charting Libraries
|
445
445
|
|
446
|
-
Add this line to your application's Gemfile:
|
447
|
-
|
448
|
-
```ruby
|
449
|
-
gem "chartkick"
|
450
|
-
```
|
451
|
-
|
452
|
-
Next, choose your charting library.
|
453
|
-
|
454
|
-
- [Chart.js](#chartjs)
|
455
446
|
- [Google Charts](#google-charts)
|
456
447
|
- [Highcharts](#highcharts)
|
457
448
|
|
458
|
-
### Chart.js
|
459
|
-
|
460
|
-
For Rails 7 / Importmap, in `config/importmap.rb`, add:
|
461
|
-
|
462
|
-
```ruby
|
463
|
-
pin "chartkick", to: "chartkick.js"
|
464
|
-
pin "Chart.bundle", to: "Chart.bundle.js"
|
465
|
-
```
|
466
|
-
|
467
|
-
And in `app/javascript/application.js`, add:
|
468
|
-
|
469
|
-
```js
|
470
|
-
import "chartkick"
|
471
|
-
import "Chart.bundle"
|
472
|
-
```
|
473
|
-
|
474
|
-
For Rails 6 / Webpacker, run:
|
475
|
-
|
476
|
-
```sh
|
477
|
-
yarn add chartkick chart.js
|
478
|
-
```
|
479
|
-
|
480
|
-
And in `app/javascript/packs/application.js`, add:
|
481
|
-
|
482
|
-
```js
|
483
|
-
import "chartkick/chart.js"
|
484
|
-
```
|
485
|
-
|
486
|
-
For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
|
487
|
-
|
488
|
-
```js
|
489
|
-
//= require chartkick
|
490
|
-
//= require Chart.bundle
|
491
|
-
```
|
492
|
-
|
493
449
|
### Google Charts
|
494
450
|
|
495
451
|
In your layout or views, add:
|
@@ -498,7 +454,7 @@ In your layout or views, add:
|
|
498
454
|
<%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
|
499
455
|
```
|
500
456
|
|
501
|
-
For Rails 7
|
457
|
+
For Importmap (Rails 7 default), in `config/importmap.rb`, add:
|
502
458
|
|
503
459
|
```ruby
|
504
460
|
pin "chartkick", to: "chartkick.js"
|
@@ -510,7 +466,7 @@ And in `app/javascript/application.js`, add:
|
|
510
466
|
import "chartkick"
|
511
467
|
```
|
512
468
|
|
513
|
-
For Rails 6
|
469
|
+
For Webpacker (Rails 6 default), run:
|
514
470
|
|
515
471
|
```sh
|
516
472
|
yarn add chartkick
|
@@ -522,7 +478,7 @@ And in `app/javascript/packs/application.js`, add:
|
|
522
478
|
import "chartkick"
|
523
479
|
```
|
524
480
|
|
525
|
-
For
|
481
|
+
For Sprockets, in `app/assets/javascripts/application.js`, add:
|
526
482
|
|
527
483
|
```js
|
528
484
|
//= require chartkick
|
@@ -538,7 +494,7 @@ before your charts.
|
|
538
494
|
|
539
495
|
### Highcharts
|
540
496
|
|
541
|
-
For Rails 7
|
497
|
+
For Importmap (Rails 7 default), run:
|
542
498
|
|
543
499
|
```sh
|
544
500
|
bin/importmap pin highcharts --download
|
@@ -559,7 +515,7 @@ import Highcharts from "highcharts"
|
|
559
515
|
window.Highcharts = Highcharts
|
560
516
|
```
|
561
517
|
|
562
|
-
For Rails 6
|
518
|
+
For Webpacker (Rails 6 default), run:
|
563
519
|
|
564
520
|
```sh
|
565
521
|
yarn add chartkick highcharts
|
@@ -571,14 +527,22 @@ And in `app/javascript/packs/application.js`, add:
|
|
571
527
|
import "chartkick/highcharts"
|
572
528
|
```
|
573
529
|
|
574
|
-
For
|
530
|
+
For 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:
|
575
531
|
|
576
532
|
```js
|
577
533
|
//= require chartkick
|
578
534
|
//= require highcharts
|
579
535
|
```
|
580
536
|
|
581
|
-
###
|
537
|
+
### Multiple Libraries
|
538
|
+
|
539
|
+
If more than one charting library is loaded, choose between them with:
|
540
|
+
|
541
|
+
```erb
|
542
|
+
<%= line_chart data, adapter: "google" %> <!-- or highcharts or chartjs -->
|
543
|
+
```
|
544
|
+
|
545
|
+
## Sinatra and Padrino
|
582
546
|
|
583
547
|
Download [chartkick.js](https://raw.githubusercontent.com/ankane/chartkick/master/vendor/assets/javascripts/chartkick.js) and include it manually.
|
584
548
|
|
@@ -607,14 +571,6 @@ Highcharts - download [highcharts.js](https://code.highcharts.com/highcharts.js)
|
|
607
571
|
<script src="highcharts.js"></script>
|
608
572
|
```
|
609
573
|
|
610
|
-
### Multiple Libraries
|
611
|
-
|
612
|
-
If more than one charting library is loaded, choose between them with:
|
613
|
-
|
614
|
-
```erb
|
615
|
-
<%= line_chart data, adapter: "google" %> <!-- or highcharts or chartjs -->
|
616
|
-
```
|
617
|
-
|
618
574
|
## JavaScript API
|
619
575
|
|
620
576
|
Access a chart with:
|
@@ -673,7 +629,7 @@ chart.destroy()
|
|
673
629
|
Loop over charts with:
|
674
630
|
|
675
631
|
```javascript
|
676
|
-
Chartkick.eachChart(
|
632
|
+
Chartkick.eachChart(function (chart) {
|
677
633
|
// do something
|
678
634
|
})
|
679
635
|
```
|
@@ -682,10 +638,6 @@ Chartkick.eachChart( function(chart) {
|
|
682
638
|
|
683
639
|
Check out [how to configure CSP](https://github.com/ankane/chartkick/blob/master/guides/Content-Security-Policy.md)
|
684
640
|
|
685
|
-
## No Ruby? No Problem
|
686
|
-
|
687
|
-
Check out [chartkick.js](https://github.com/ankane/chartkick.js)
|
688
|
-
|
689
641
|
## Tutorials
|
690
642
|
|
691
643
|
- [Charts with Chartkick and Groupdate](https://gorails.com/episodes/charts-with-chartkick-and-groupdate)
|
@@ -697,7 +649,7 @@ Check out [chartkick.js](https://github.com/ankane/chartkick.js)
|
|
697
649
|
|
698
650
|
### 5.0
|
699
651
|
|
700
|
-
If you use
|
652
|
+
If you use Importmap or Sprockets, update the gem and you’re good to go!
|
701
653
|
|
702
654
|
If you use esbuild, Webpack, or Webpacker, run:
|
703
655
|
|
data/lib/chartkick/version.rb
CHANGED