chartkick 4.1.1 → 4.2.0

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: 72d125397684b6a65e9e3982dab00818b1387be38099f45ab340c0d6d78c8911
4
- data.tar.gz: 9465bd9225d1e97ade176c1769d4ed84664a6a069a0e181d0e8e271505711be0
3
+ metadata.gz: f2d2a4efa99cc9de5d1f4bafd419ebc3d56f25fd9ff58abcf6ae4a3bbad8751f
4
+ data.tar.gz: c2c6ce648f0d0bde544ef4a7191396ba499a2bdb9b4d8892a63c19a96152f083
5
5
  SHA512:
6
- metadata.gz: 514165df39581c34f1d6e929cf679475c929b36e9f47fdc9cdb7d415364833ba6bd1134bc272a364f1c11731c3cee68f48a7e0598e6394e95c1c2e0607c58e91
7
- data.tar.gz: 83eec680a359d68461c4258f98cb5f99f387624ae9c7f222f49592f5fc19b2ead5ee83aa69ff5db8a3e58408f2a9bb9887de9059cb91b9dad556c334f8ecebcf
6
+ metadata.gz: 3ddd0b4c49fc2f761937a884440ce3500442f5ff998650a45723371315813f253d9f49f8f2833821f2d550fa879a09d533ca807e5a1bc69bfb552c3aff91f0b7
7
+ data.tar.gz: 38ee5f44d26d5d3b17aa84272493f4fcb4c39eb6ec581813fc30364398db5ab08b85b79fd2320b2bfdb885f3a2880c9b7639f9b27f478ae00da2f82f385586ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 4.2.0 (2022-06-12)
2
+
3
+ - Updated Chartkick.js to 4.2.0
4
+ - Updated Chart.js to 3.8.0
5
+
6
+ ## 4.1.3 (2022-01-15)
7
+
8
+ - Support for `importmap-rails` is no longer experimental
9
+ - Updated Chart.js to 3.7.0
10
+ - Fixed asset precompilation error with `importmap-rails`
11
+
12
+ ## 4.1.2 (2021-11-06)
13
+
14
+ - Removed automatic pinning for `importmap-rails` (still experimental)
15
+
1
16
  ## 4.1.1 (2021-11-06)
2
17
 
3
18
  - Updated Chartkick.js to 4.1.1
data/README.md CHANGED
@@ -4,8 +4,6 @@ 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
- **Chartkick 4.0 was recently released** - see [how to upgrade](#upgrading)
8
-
9
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)
10
8
 
11
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)
@@ -20,33 +18,67 @@ Add this line to your application’s Gemfile:
20
18
  gem "chartkick"
21
19
  ```
22
20
 
23
- For Rails 6 / Webpacker, run:
21
+ Then follow the instructions for your framework:
22
+
23
+ - [Rails 7 / Importmap](#rails-7--importmap)
24
+ - [Rails 7 / esbuild or Webpack](#rails-7--esbuild-or-webpack)
25
+ - [Rails 6 / Webpacker](#rails-6--webpacker)
26
+ - [Rails 5 / Sprockets](#rails-5--sprockets)
27
+
28
+ This sets up Chartkick with [Chart.js](https://www.chartjs.org/). For other charting libraries and frameworks, see [detailed instructions](#installation).
29
+
30
+ ### Rails 7 / Importmap
31
+
32
+ In `config/importmap.rb`, add:
33
+
34
+ ```ruby
35
+ pin "chartkick", to: "chartkick.js"
36
+ pin "Chart.bundle", to: "Chart.bundle.js"
37
+ ```
38
+
39
+ And in `app/javascript/application.js`, add:
40
+
41
+ ```js
42
+ import "chartkick"
43
+ import "Chart.bundle"
44
+ ```
45
+
46
+ ### Rails 7 / esbuild or Webpack
47
+
48
+ Run:
24
49
 
25
50
  ```sh
26
51
  yarn add chartkick chart.js
27
52
  ```
28
53
 
29
- And in `app/javascript/packs/application.js`, add:
54
+ And in `app/javascript/application.js`, add:
30
55
 
31
56
  ```js
32
57
  import "chartkick/chart.js"
33
58
  ```
34
59
 
35
- For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
60
+ ### Rails 6 / Webpacker
36
61
 
37
- ```js
38
- //= require chartkick
39
- //= require Chart.bundle
62
+ Run:
63
+
64
+ ```sh
65
+ yarn add chartkick chart.js
40
66
  ```
41
67
 
42
- For Rails 7 / Importmap (experimental), in `app/javascript/application.js`, add:
68
+ And in `app/javascript/packs/application.js`, add:
43
69
 
44
70
  ```js
45
- import "chartkick"
46
- import "Chart.bundle"
71
+ import "chartkick/chart.js"
47
72
  ```
48
73
 
49
- This sets up Chartkick with [Chart.js](https://www.chartjs.org/). For other charting libraries, see [detailed instructions](#installation).
74
+ ### Rails 5 / Sprockets
75
+
76
+ In `app/assets/javascripts/application.js`, add:
77
+
78
+ ```js
79
+ //= require chartkick
80
+ //= require Chart.bundle
81
+ ```
50
82
 
51
83
  ## Charts
52
84
 
@@ -421,6 +453,20 @@ Next, choose your charting library.
421
453
 
422
454
  ### Chart.js
423
455
 
456
+ For Rails 7 / Importmap, in `config/importmap.rb`, add:
457
+
458
+ ```ruby
459
+ pin "chartkick", to: "chartkick.js"
460
+ pin "Chart.bundle", to: "Chart.bundle.js"
461
+ ```
462
+
463
+ And in `app/javascript/application.js`, add:
464
+
465
+ ```js
466
+ import "chartkick"
467
+ import "Chart.bundle"
468
+ ```
469
+
424
470
  For Rails 6 / Webpacker, run:
425
471
 
426
472
  ```sh
@@ -440,13 +486,6 @@ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
440
486
  //= require Chart.bundle
441
487
  ```
442
488
 
443
- For Rails 7 / Importmap (experimental), in `app/javascript/application.js`, add:
444
-
445
- ```js
446
- import "chartkick"
447
- import "Chart.bundle"
448
- ```
449
-
450
489
  ### Google Charts
451
490
 
452
491
  In your layout or views, add:
@@ -455,6 +494,18 @@ In your layout or views, add:
455
494
  <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
456
495
  ```
457
496
 
497
+ For Rails 7 / Importmap, in `config/importmap.rb`, add:
498
+
499
+ ```ruby
500
+ pin "chartkick", to: "chartkick.js"
501
+ ```
502
+
503
+ And in `app/javascript/application.js`, add:
504
+
505
+ ```js
506
+ import "chartkick"
507
+ ```
508
+
458
509
  For Rails 6 / Webpacker, run:
459
510
 
460
511
  ```sh
@@ -473,12 +524,6 @@ For Rails 5 / Sprockets, in `app/assets/javascripts/application.js`, add:
473
524
  //= require chartkick
474
525
  ```
475
526
 
476
- For Rails 7 / Importmap (experimental), in `app/javascript/application.js`, add:
477
-
478
- ```js
479
- import "chartkick"
480
- ```
481
-
482
527
  To specify a language or Google Maps API key, use:
483
528
 
484
529
  ```js
@@ -489,38 +534,44 @@ before your charts.
489
534
 
490
535
  ### Highcharts
491
536
 
492
- For Rails 6 / Webpacker, run:
537
+ For Rails 7 / Importmap, run:
493
538
 
494
539
  ```sh
495
- yarn add chartkick highcharts
540
+ bin/importmap pin highcharts --download
496
541
  ```
497
542
 
498
- And in `app/javascript/packs/application.js`, add:
543
+ And in `config/importmap.rb`, add:
499
544
 
500
- ```js
501
- import "chartkick/highcharts"
545
+ ```ruby
546
+ pin "chartkick", to: "chartkick.js"
502
547
  ```
503
548
 
504
- 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:
549
+ And in `app/javascript/application.js`, add:
505
550
 
506
551
  ```js
507
- //= require chartkick
508
- //= require highcharts
552
+ import "chartkick"
553
+ import Highcharts from "highcharts"
554
+
555
+ window.Highcharts = Highcharts
509
556
  ```
510
557
 
511
- For Rails 7 / Importmap (experimental), run:
558
+ For Rails 6 / Webpacker, run:
512
559
 
513
560
  ```sh
514
- bin/importmap pin highcharts --download
561
+ yarn add chartkick highcharts
515
562
  ```
516
563
 
517
- And in `app/javascript/application.js`, add:
564
+ And in `app/javascript/packs/application.js`, add:
518
565
 
519
566
  ```js
520
- import "chartkick"
521
- import Highcharts from "highcharts"
567
+ import "chartkick/highcharts"
568
+ ```
522
569
 
523
- window.Highcharts = Highcharts
570
+ 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:
571
+
572
+ ```js
573
+ //= require chartkick
574
+ //= require highcharts
524
575
  ```
525
576
 
526
577
  ### Sinatra and Padrino
@@ -3,9 +3,8 @@ module Chartkick
3
3
  # for assets
4
4
 
5
5
  # for importmap
6
- if defined?(Importmap)
7
- initializer "chartkick.importmap", after: "importmap" do |app|
8
- app.importmap.draw(Engine.root.join("config/importmap.rb"))
6
+ initializer "chartkick.importmap" do |app|
7
+ if defined?(Importmap)
9
8
  app.config.assets.precompile << "chartkick.js"
10
9
  app.config.assets.precompile << "Chart.bundle.js"
11
10
  end
@@ -1,3 +1,3 @@
1
1
  module Chartkick
2
- VERSION = "4.1.1"
2
+ VERSION = "4.2.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2021 Chart.js Contributors
3
+ Copyright (c) 2014-2022 Chart.js Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6