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 +4 -4
- data/{CHANGELOG → CHANGELOG.md} +41 -1
- data/README.md +3 -11
- data/chartjs-ror.gemspec +1 -0
- data/lib/chartjs/chart_helpers.rb +16 -13
- data/lib/chartjs/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.min.js +11 -8
- metadata +9 -10
- data/vendor/assets/javascripts/Chart.bundle.min.js +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 700db71e8b8ad9159314dce41e15bca80e0b0ac841eef90cfc68f00c546b117c
|
4
|
+
data.tar.gz: 88703af95b762dbc22364c17c302a032b7c3af8be761c2f5bd0f24108ad068e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1534723e0409ffce450d9e21ff17cc00dd07bc74d7f2ff8a2521b7fdbecd30b4d54cea381f6d051a3cb9dfe5726827e6f7636aade16f6ead4bab0d7fd6182ff
|
7
|
+
data.tar.gz: 8bc30bf56d6c1bd201f9e5fa2135f674f3bd0355fe59f04b413ec31323383a0378fbaa058f9f37a4bde18456c8cc9f18f6de68e5ba8260256203433eaa3adcce
|
data/{CHANGELOG → CHANGELOG.md}
RENAMED
@@ -1,7 +1,47 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.7.0 - 2022-04-08
|
3
4
|
|
4
|
-
|
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
|
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
|
-
|
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.
|
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
|
13
|
-
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
|
22
|
-
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 =
|
32
|
-
css_class =
|
33
|
-
width =
|
34
|
-
height =
|
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
|
48
|
+
options: #{to_javascript_string opts},
|
49
|
+
plugins: #{to_javascript_string plugins},
|
47
50
|
});
|
48
51
|
};
|
49
52
|
|
data/lib/chartjs/version.rb
CHANGED