chartjs-ror 3.6.2 → 3.7.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: a737cc8f5931d28d8d508f18072574ceae31f0177c8de8fb399384986a0c9326
4
- data.tar.gz: 13094dd3d2f056fc4b93405988354c593c8aa9446ff9cc1d18f17426113ec2b0
3
+ metadata.gz: 700db71e8b8ad9159314dce41e15bca80e0b0ac841eef90cfc68f00c546b117c
4
+ data.tar.gz: 88703af95b762dbc22364c17c302a032b7c3af8be761c2f5bd0f24108ad068e2
5
5
  SHA512:
6
- metadata.gz: 65047ef07ad53bdcc3c05103869557949a2224b8073889a3a33cf177b390f6268c86e641f2588fdd9cdfe0645a4e7e42a7e26b5476e96821ade58d90dd4e5a61
7
- data.tar.gz: 84640ff0ee43a5ade63c6b5c784be122009f24b8e578e5664bdd499b89a1f3af4561516d309ea5b093396675748fc08649d3f3cc6708d909d586ca60241f8fed
6
+ metadata.gz: b1534723e0409ffce450d9e21ff17cc00dd07bc74d7f2ff8a2521b7fdbecd30b4d54cea381f6d051a3cb9dfe5726827e6f7636aade16f6ead4bab0d7fd6182ff
7
+ data.tar.gz: 8bc30bf56d6c1bd201f9e5fa2135f674f3bd0355fe59f04b413ec31323383a0378fbaa058f9f37a4bde18456c8cc9f18f6de68e5ba8260256203433eaa3adcce
@@ -1,7 +1,47 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.7.0 - 2022-04-08
3
4
 
4
- ## Unreleased
5
+ - Use Chart.js v3.7.1.
6
+
7
+ ## 3.6.5 - 2021-11-19
8
+
9
+ - Use Chart.js v3.6.0.
10
+
11
+
12
+ ## 3.6.4 - 2019-02-27
13
+
14
+ - Add argument for plugins.
15
+
16
+
17
+ ## 3.6.3 - 2019-02-14
18
+
19
+ - Use Chart.js v2.7.3.
20
+ - Add CSP nonce to inline JavaScript.
21
+ - Do not modify options.
22
+
23
+
24
+ ## 3.6.2 - 2018-03-14
25
+
26
+ - Use Chart.js v2.7.2.
27
+
28
+
29
+ ## 3.6.1 - 2018-03-14
30
+
31
+ - Use Chart.js v2.7.1.
32
+
33
+
34
+ ## 3.6.0 - 2018-03-14
35
+
36
+ - Use Chart.js v2.7.0.
37
+
38
+
39
+ ## 3.5.0 - 2018-03-14
40
+
41
+ - Use Chart.js v2.6.0.
42
+
43
+
44
+ ## 3.4.0 - 2018-03-14
5
45
 
6
46
  - Use Chart.js v2.5.0.
7
47
 
data/README.md CHANGED
@@ -5,7 +5,7 @@ Simplifies using [Chart.js][] in Rails views.
5
5
 
6
6
  ## Current Chart.js version
7
7
 
8
- This gem includes [Chart.js v2.7.2](https://github.com/chartjs/Chart.js/tree/v2.7.2).
8
+ This gem includes [Chart.js v3.7.1](https://github.com/chartjs/Chart.js/tree/v3.7.1).
9
9
 
10
10
 
11
11
  ## Installation
@@ -18,20 +18,12 @@ And then execute:
18
18
 
19
19
  $ bundle
20
20
 
21
- There are two builds of Chart.js: with or without Moment.js.
21
+ After that require Chart:
22
22
 
23
- Choose the appropriate one in your javascript manifest:
24
-
25
- - Without Moment.js:
26
23
  ```javascript
27
24
  //= require Chart.min
28
25
  ```
29
26
 
30
- - With Moment.js:
31
- ```javascript
32
- //= require Chart.bundle.min
33
- ```
34
-
35
27
  Please note Chart.js [no longer supports IE8 and below](https://github.com/chartjs/Chart.js/issues/2396#issuecomment-215233106).
36
28
 
37
29
 
@@ -170,7 +162,7 @@ You can also use these non-Chart.js settings:
170
162
  //<![CDATA[
171
163
  (function() {
172
164
  var initChart = function() {
173
- var ctx = document.getElemenyById("chart-0");
165
+ var ctx = document.getElementById("chart-0");
174
166
  var chart = new Chart(ctx, {
175
167
  type: "Line",
176
168
  data = { ... };
data/chartjs-ror.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.description = 'Simplifies using Chart.js in Rails'
12
12
  gem.summary = 'Simplifies using Chart.js in Rails'
13
13
  gem.homepage = 'https://github.com/airblade/chartjs-ror'
14
+ gem.license = 'MIT'
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -8,34 +8,36 @@ module Chartjs
8
8
 
9
9
  module Explicit
10
10
  CHART_TYPES.each do |type|
11
- define_method "chartjs_#{type}_chart" do |data, options = {}| # def chartjs_polar_area_chart(data, options = {})
12
- chart type, data, options # chart 'polar_area', data, options
13
- end # end
11
+ define_method "chartjs_#{type}_chart" do |data, options = {}, plugins = {}| # def chartjs_polar_area_chart(data, options = {}, plugins = {})
12
+ chart type, data, options, plugins # chart 'polar_area', data, options, plugins
13
+ end # end
14
14
  end
15
15
  include Chartjs::ChartHelpers
16
16
  end
17
17
 
18
18
  module Implicit
19
19
  CHART_TYPES.each do |type|
20
- define_method "#{type}_chart" do |data, options = {}| # def polar_area_chart(data, options = {})
21
- chart type, data, options # chart 'polar_area', data, options
22
- end # end
20
+ define_method "#{type}_chart" do |data, options = {}, plugins = {}| # def polar_area_chart(data, options = {}, plugins = {})
21
+ chart type, data, options, plugins # chart 'polar_area', data, options, plugins
22
+ end # end
23
23
  end
24
24
  include Chartjs::ChartHelpers
25
25
  end
26
26
 
27
27
  private
28
28
 
29
- def chart(type, data, options)
29
+ def chart(type, data, options, plugins)
30
+ opts = options.dup
31
+
30
32
  @chart_id ||= -1
31
- element_id = options.delete(:id) || "chart-#{@chart_id += 1}"
32
- css_class = options.delete(:class) || 'chart'
33
- width = options.delete(:width) || '400'
34
- height = options.delete(:height) || '400'
33
+ element_id = opts.delete(:id) || "chart-#{@chart_id += 1}"
34
+ css_class = opts.delete(:class) || 'chart'
35
+ width = opts.delete(:width) || '400'
36
+ height = opts.delete(:height) || '400'
35
37
 
36
38
  canvas = content_tag :canvas, '', id: element_id, class: css_class, width: width, height: height
37
39
 
38
- script = javascript_tag do
40
+ script = javascript_tag(nonce: true) do
39
41
  <<-END.squish.html_safe
40
42
  (function() {
41
43
  var initChart = function() {
@@ -43,7 +45,8 @@ module Chartjs
43
45
  var chart = new Chart(ctx, {
44
46
  type: "#{camel_case type}",
45
47
  data: #{to_javascript_string data},
46
- options: #{to_javascript_string options}
48
+ options: #{to_javascript_string opts},
49
+ plugins: #{to_javascript_string plugins},
47
50
  });
48
51
  };
49
52
 
@@ -1,3 +1,3 @@
1
1
  module Chartjs
2
- VERSION = "3.6.2"
2
+ VERSION = "3.7.0"
3
3
  end