chartkick 3.2.0 → 3.3.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chartkick might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b6eb4f5b6f498a122e58ca1dd4cf7e3e1f5d610e19faa5a702291e422549026
4
- data.tar.gz: ec143cc0f819cdd1ccd955f43425d992daa87052aeede53f563beda9bace04a5
3
+ metadata.gz: b462bf7fa745700c8fa561b0e5707c309f6f5cca29e314e550921370b3a9d590
4
+ data.tar.gz: be9169ad2777d6e40846ef058ad981a3366aea965f16aa2e1af44d7c2b81cad4
5
5
  SHA512:
6
- metadata.gz: 1a494948bc4eeb5c1567e82777601982d7f3f90bfeb5c8b8b29335620cc0eaac7659a8b91e72fe9672d29a3b580b2c512fd0524c553be2de9fb57b4dcfa27b7a
7
- data.tar.gz: 9f2e116c8c529e744e078b368ece8aebd7235dec00aa297a0745f309a494e57a2e29b2243dd5873d159a4346be0ee331f1df474f2a4166133a8a9e6159a0e9d7
6
+ metadata.gz: 2eedfd5f334b4e875d88b7b5e9af963a8ad3c4f8fc86eb17b31f0fb41e3b357cb3909a27cc92f8018c709856f56a7c0614ec95ac5ab8747549767e1f95fd7de8
7
+ data.tar.gz: f997c95810273ed9d436f3e307b92b3936fe17736d01adda4979efc90379f45a703d97aeeed3c9a3add187440d0d085c8b3e4635df2dec0720491c9268a80eda
@@ -1,23 +1,46 @@
1
- ## 3.2.0
1
+ ## 3.3.2 (2020-07-23)
2
+
3
+ - Updated Chartkick.js to 3.2.1
4
+
5
+ ## 3.3.1 (2019-12-26)
6
+
7
+ - Updated Chart.js to 2.9.3
8
+ - Fixed deprecating warnings in Ruby 2.7
9
+
10
+ ## 3.3.0 (2019-11-09)
11
+
12
+ - Updated Chartkick.js to 3.2.0
13
+ - Rolled back Chart.js to 2.8.0 due to legend change
14
+
15
+ ## 3.2.2 (2019-10-27)
16
+
17
+ - Updated Chartkick.js to 3.1.3
18
+ - Updated Chart.js to 2.9.1
19
+
20
+ ## 3.2.1 (2019-07-15)
21
+
22
+ - Updated Chartkick.js to 3.1.1
23
+
24
+ ## 3.2.0 (2019-06-04)
2
25
 
3
26
  - Fixed XSS vulnerability - see [#488](https://github.com/ankane/chartkick/issues/488)
4
27
 
5
- ## 3.1.0
28
+ ## 3.1.0 (2019-05-26)
6
29
 
7
30
  - Updated Chartkick.js to 3.1.0
8
31
  - Updated Chart.js to 2.8.0
9
32
 
10
- ## 3.0.2
33
+ ## 3.0.2 (2019-01-03)
11
34
 
12
35
  - Fixed error with `nonce` option with Secure Headers and Rails < 5.2
13
36
  - Updated Chartkick.js to 3.0.2
14
37
  - Updated Chart.js to 2.7.3
15
38
 
16
- ## 3.0.1
39
+ ## 3.0.1 (2018-08-13)
17
40
 
18
41
  - Updated Chartkick.js to 3.0.1
19
42
 
20
- ## 3.0.0
43
+ ## 3.0.0 (2018-08-08)
21
44
 
22
45
  - Updated Chartkick.js to 3.0.0
23
46
  - Added `code` option
@@ -31,55 +54,55 @@ Breaking changes
31
54
  - Removed `window.Chartkick = {...}` way to set config - use `Chartkick.configure` instead
32
55
  - Removed support for the Google Charts jsapi loader - use loader.js instead
33
56
 
34
- ## 2.3.5
57
+ ## 2.3.5 (2018-06-15)
35
58
 
36
59
  - Updated Chartkick.js to 2.3.6
37
60
 
38
- ## 2.3.4
61
+ ## 2.3.4 (2018-04-10)
39
62
 
40
63
  - Updated Chartkick.js to 2.3.5
41
64
  - Updated Chart.js to 2.7.2
42
65
 
43
- ## 2.3.3
66
+ ## 2.3.3 (2018-03-25)
44
67
 
45
68
  - Updated Chartkick.js to 2.3.4
46
69
 
47
- ## 2.3.2
70
+ ## 2.3.2 (2018-02-26)
48
71
 
49
72
  - Updated Chartkick.js to 2.3.3
50
73
 
51
- ## 2.3.1
74
+ ## 2.3.1 (2018-02-23)
52
75
 
53
76
  - Updated Chartkick.js to 2.3.1
54
77
 
55
- ## 2.3.0
78
+ ## 2.3.0 (2018-02-21)
56
79
 
57
80
  - Fixed deep merge error for non-Rails apps
58
81
  - Updated Chartkick.js to 2.3.0
59
82
 
60
- ## 2.2.5
83
+ ## 2.2.5 (2017-10-28)
61
84
 
62
85
  - Updated Chart.js to 2.7.1
63
86
 
64
- ## 2.2.4
87
+ ## 2.2.4 (2017-05-14)
65
88
 
66
89
  - Added compatibility with Rails API
67
90
  - Updated Chartkick.js to 2.2.4
68
91
 
69
- ## 2.2.3
92
+ ## 2.2.3 (2017-02-22)
70
93
 
71
94
  - Updated Chartkick.js to 2.2.3
72
95
  - Updated Chart.js to 2.5.0
73
96
 
74
- ## 2.2.2
97
+ ## 2.2.2 (2017-01-07)
75
98
 
76
99
  - Updated Chartkick.js to 2.2.2
77
100
 
78
- ## 2.2.1
101
+ ## 2.2.1 (2016-12-05)
79
102
 
80
103
  - Updated Chartkick.js to 2.2.1
81
104
 
82
- ## 2.2.0
105
+ ## 2.2.0 (2016-12-03)
83
106
 
84
107
  - Updated Chartkick.js to 2.2.0
85
108
  - Improved JavaScript API
@@ -87,59 +110,59 @@ Breaking changes
87
110
  - Added `refresh` option
88
111
  - Added `donut` option to pie chart
89
112
 
90
- ## 2.1.3
113
+ ## 2.1.3 (2016-11-29)
91
114
 
92
115
  - Updated Chartkick.js to 2.1.2 - fixes missing zero values for Chart.js
93
116
 
94
- ## 2.1.2
117
+ ## 2.1.2 (2016-11-28)
95
118
 
96
119
  - Added `defer` option
97
120
  - Added `nonce` option
98
121
  - Updated Chartkick.js to 2.1.1
99
122
 
100
- ## 2.1.1
123
+ ## 2.1.1 (2016-09-11)
101
124
 
102
125
  - Use custom version of Chart.js to fix label overlap
103
126
 
104
- ## 2.1.0
127
+ ## 2.1.0 (2016-09-10)
105
128
 
106
129
  - Added basic support for new Google Charts loader
107
130
  - Added `configure` function
108
131
  - Dropped jQuery and Zepto dependencies for AJAX
109
132
  - Updated Chart.js to 2.2.2
110
133
 
111
- ## 2.0.2
134
+ ## 2.0.2 (2016-08-11)
112
135
 
113
136
  - Updated Chartkick.js to 2.0.1
114
137
  - Updated Chart.js to 2.2.1
115
138
 
116
- ## 2.0.1
139
+ ## 2.0.1 (2016-07-29)
117
140
 
118
141
  - Small Chartkick.js fixes
119
142
  - Updated Chart.js to 2.2.0
120
143
 
121
- ## 2.0.0
144
+ ## 2.0.0 (2016-05-30)
122
145
 
123
146
  - Chart.js is now the default adapter - yay open source!
124
147
  - Axis types are automatically detected - no need for `discrete: true`
125
148
  - Better date support
126
149
  - New JavaScript API
127
150
 
128
- ## 1.5.2
151
+ ## 1.5.2 (2016-05-05)
129
152
 
130
153
  - Fixed Sprockets error
131
154
 
132
- ## 1.5.1
155
+ ## 1.5.1 (2016-05-03)
133
156
 
134
157
  - Updated chartkick.js to latest version
135
158
  - Included `Chart.bundle.js`
136
159
 
137
- ## 1.5.0
160
+ ## 1.5.0 (2016-05-01)
138
161
 
139
162
  - Added Chart.js adapter **beta**
140
163
  - Fixed line height on timeline charts
141
164
 
142
- ## 1.4.2
165
+ ## 1.4.2 (2016-02-29)
143
166
 
144
167
  - Added `width` option
145
168
  - Added `label` option
@@ -148,86 +171,86 @@ Breaking changes
148
171
  - Better tooltip for dates for Google Charts
149
172
  - Fixed asset precompilation issue with Rails 5
150
173
 
151
- ## 1.4.1
174
+ ## 1.4.1 (2015-09-07)
152
175
 
153
176
  - Fixed regression with `min: nil`
154
177
 
155
- ## 1.4.0
178
+ ## 1.4.0 (2015-08-31)
156
179
 
157
180
  - Added scatter chart
158
181
  - Added axis titles
159
182
 
160
- ## 1.3.2
183
+ ## 1.3.2 (2014-07-04)
161
184
 
162
185
  - Fixed `except` error when not using Rails
163
186
 
164
- ## 1.3.1
187
+ ## 1.3.1 (2014-06-30)
165
188
 
166
189
  - Fixed blank screen bug
167
190
  - Fixed language support
168
191
 
169
- ## 1.3.0
192
+ ## 1.3.0 (2014-06-28)
170
193
 
171
194
  - Added timelines
172
195
 
173
- ## 1.2.5
196
+ ## 1.2.5 (2014-06-12)
174
197
 
175
198
  - Added support for multiple groups
176
199
  - Added `html` option
177
200
 
178
- ## 1.2.4
201
+ ## 1.2.4 (2014-03-24)
179
202
 
180
203
  - Added global options
181
204
  - Added `colors` option
182
205
 
183
- ## 1.2.3
206
+ ## 1.2.3 (2014-03-23)
184
207
 
185
208
  - Added geo chart
186
209
  - Added `discrete` option
187
210
 
188
- ## 1.2.2
211
+ ## 1.2.2 (2014-02-23)
189
212
 
190
213
  - Added global `content_for` option
191
214
  - Added `stacked` option
192
215
 
193
- ## 1.2.1
216
+ ## 1.2.1 (2013-12-08)
194
217
 
195
218
  - Added localization for Google Charts
196
219
 
197
- ## 1.2.0
220
+ ## 1.2.0 (2013-07-27)
198
221
 
199
222
  - Added bar chart and area chart
200
223
  - Resize Google Charts on window resize
201
224
 
202
- ## 1.1.3
225
+ ## 1.1.3 (2013-06-26)
203
226
 
204
227
  - Added content_for option
205
228
 
206
- ## 1.1.2
229
+ ## 1.1.2 (2013-06-11)
207
230
 
208
231
  - Updated chartkick.js to v1.0.1
209
232
 
210
- ## 1.1.1
233
+ ## 1.1.1 (2013-06-10)
211
234
 
212
235
  - Added support for Sinatra
213
236
 
214
- ## 1.1.0
237
+ ## 1.1.0 (2013-06-03)
215
238
 
216
239
  - Added support for Padrino and Rails 2.3+
217
240
 
218
- ## 1.0.1
241
+ ## 1.0.1 (2013-05-23)
219
242
 
220
243
  - Updated chartkick.js to v1.0.1
221
244
 
222
- ## 1.0.0
245
+ ## 1.0.0 (2013-05-15)
223
246
 
224
247
  - Use semantic versioning (no changes)
225
248
 
226
- ## 0.0.5
249
+ ## 0.0.5 (2013-05-14)
227
250
 
228
251
  - Removed `:min => 0` default for charts with negative values
229
252
  - Show legend when data given in `{:name => "", :data => {}}` format
230
253
 
231
- ## 0.0.4
254
+ ## 0.0.4 (2013-05-13)
232
255
 
233
256
  - Fix for `Uncaught ReferenceError: Chartkick is not defined` when chartkick.js is included in the `<head>`
data/README.md CHANGED
@@ -8,6 +8,8 @@ Create beautiful JavaScript charts with one line of Ruby. No more fighting with
8
8
 
9
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)
10
10
 
11
+ [![Build Status](https://travis-ci.org/ankane/chartkick.svg?branch=master)](https://travis-ci.org/ankane/chartkick)
12
+
11
13
  ## Quick Start
12
14
 
13
15
  Add this line to your application's Gemfile:
@@ -242,6 +244,30 @@ Set a decimal separator - *Chart.js, Highcharts*
242
244
  <%= line_chart data, decimal: "," %>
243
245
  ```
244
246
 
247
+ Set significant digits - *Chart.js, Highcharts*
248
+
249
+ ```erb
250
+ <%= line_chart data, precision: 3 %>
251
+ ```
252
+
253
+ Set rounding - *Chart.js, Highcharts*
254
+
255
+ ```erb
256
+ <%= line_chart data, round: 2 %>
257
+ ```
258
+
259
+ Show insignificant zeros, useful for currency - *Chart.js, Highcharts*
260
+
261
+ ```erb
262
+ <%= line_chart data, round: 2, zeros: true %>
263
+ ```
264
+
265
+ Friendly byte sizes - *Chart.js 2.8+*
266
+
267
+ ```erb
268
+ <%= line_chart data, bytes: true %>
269
+ ```
270
+
245
271
  Show a message when data is empty
246
272
 
247
273
  ```erb
@@ -299,7 +325,7 @@ Then, in your layout, use:
299
325
  <%= yield :charts_js %>
300
326
  ```
301
327
 
302
- > For Padrino, use `yield_content` instead of `yield`
328
+ For Padrino, use `yield_content` instead of `yield`.
303
329
 
304
330
  This is great for including all of your JavaScript at the bottom of the page.
305
331
 
@@ -346,9 +372,7 @@ If you want to use the charting library directly, get the code with:
346
372
  <%= line_chart data, code: true %>
347
373
  ```
348
374
 
349
- The code will be logged to the JavaScript console.
350
-
351
- > JavaScript functions cannot be logged, so it may not be identical.
375
+ The code will be logged to the JavaScript console. JavaScript functions cannot be logged, so it may not be identical.
352
376
 
353
377
  ### Download Charts
354
378
 
@@ -360,7 +384,7 @@ Give users the ability to download charts. It all happens in the browser - no se
360
384
  <%= line_chart data, download: true %>
361
385
  ```
362
386
 
363
- > Safari will open the image in a new window instead of downloading.
387
+ Safari will open the image in a new window instead of downloading.
364
388
 
365
389
  Set the filename
366
390
 
@@ -394,7 +418,7 @@ Next, choose your charting library.
394
418
  - [Google Charts](#google-charts)
395
419
  - [Highcharts](#highcharts)
396
420
 
397
- > In the instructions below, `application.js` must be included **before** the charts in your views, unless using the `:content_for` option.
421
+ In the instructions below, `application.js` must be included **before** the charts in your views, unless using the `:content_for` option.
398
422
 
399
423
  ### Chart.js
400
424
 
@@ -538,6 +562,12 @@ Redraw the chart with:
538
562
  chart.redraw()
539
563
  ```
540
564
 
565
+ Destroy the chart with:
566
+
567
+ ```javascript
568
+ chart.destroy()
569
+ ```
570
+
541
571
  Loop over charts with:
542
572
 
543
573
  ```javascript
@@ -573,14 +603,6 @@ Breaking changes
573
603
  - Removed `window.Chartkick = {...}` way to set config - use `Chartkick.configure` instead
574
604
  - Removed support for the Google Charts jsapi loader - use loader.js instead
575
605
 
576
- ### 2.0
577
-
578
- Breaking changes
579
-
580
- - Chart.js is now the default adapter if multiple are loaded - yay open source!
581
- - Axis types are automatically detected - no need for `discrete: true`
582
- - Better date support - dates are no longer treated as UTC
583
-
584
606
  ## Credits
585
607
 
586
608
  Chartkick uses [iso8601.js](https://github.com/Do/iso8601.js) to parse dates and times.
@@ -589,8 +611,6 @@ Chartkick uses [iso8601.js](https://github.com/Do/iso8601.js) to parse dates and
589
611
 
590
612
  View the [changelog](https://github.com/ankane/chartkick/blob/master/CHANGELOG.md)
591
613
 
592
- Chartkick follows [Semantic Versioning](https://semver.org/)
593
-
594
614
  ## Contributing
595
615
 
596
616
  Everyone is encouraged to help improve this project. Here are a few ways you can help:
@@ -599,3 +619,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
599
619
  - Fix bugs and [submit pull requests](https://github.com/ankane/chartkick/pulls)
600
620
  - Write, clarify, or fix documentation
601
621
  - Suggest or add new features
622
+
623
+ To get started with development:
624
+
625
+ ```sh
626
+ git clone https://github.com/ankane/chartkick.git
627
+ cd chartkick
628
+ bundle install
629
+ bundle exec rake test
630
+ ```
@@ -4,35 +4,35 @@ require "erb"
4
4
  module Chartkick
5
5
  module Helper
6
6
  def line_chart(data_source, **options)
7
- chartkick_chart "LineChart", data_source, options
7
+ chartkick_chart "LineChart", data_source, **options
8
8
  end
9
9
 
10
10
  def pie_chart(data_source, **options)
11
- chartkick_chart "PieChart", data_source, options
11
+ chartkick_chart "PieChart", data_source, **options
12
12
  end
13
13
 
14
14
  def column_chart(data_source, **options)
15
- chartkick_chart "ColumnChart", data_source, options
15
+ chartkick_chart "ColumnChart", data_source, **options
16
16
  end
17
17
 
18
18
  def bar_chart(data_source, **options)
19
- chartkick_chart "BarChart", data_source, options
19
+ chartkick_chart "BarChart", data_source, **options
20
20
  end
21
21
 
22
22
  def area_chart(data_source, **options)
23
- chartkick_chart "AreaChart", data_source, options
23
+ chartkick_chart "AreaChart", data_source, **options
24
24
  end
25
25
 
26
26
  def scatter_chart(data_source, **options)
27
- chartkick_chart "ScatterChart", data_source, options
27
+ chartkick_chart "ScatterChart", data_source, **options
28
28
  end
29
29
 
30
30
  def geo_chart(data_source, **options)
31
- chartkick_chart "GeoChart", data_source, options
31
+ chartkick_chart "GeoChart", data_source, **options
32
32
  end
33
33
 
34
34
  def timeline(data_source, **options)
35
- chartkick_chart "Timeline", data_source, options
35
+ chartkick_chart "Timeline", data_source, **options
36
36
  end
37
37
 
38
38
  private
@@ -74,7 +74,7 @@ module Chartkick
74
74
 
75
75
  # js vars
76
76
  js_vars = {
77
- type: klass, # don't convert to JSON, but still escape
77
+ type: klass.to_json,
78
78
  id: element_id.to_json,
79
79
  data: data_source.respond_to?(:chart_json) ? data_source.chart_json : data_source.to_json,
80
80
  options: options.to_json
@@ -82,9 +82,10 @@ module Chartkick
82
82
  js_vars.each_key do |k|
83
83
  js_vars[k] = chartkick_json_escape(js_vars[k])
84
84
  end
85
- createjs = "new Chartkick.%{type}(%{id}, %{data}, %{options});" % js_vars
85
+ createjs = "new Chartkick[%{type}](%{id}, %{data}, %{options});" % js_vars
86
86
 
87
87
  if defer
88
+ # TODO remove type in 4.0
88
89
  js = <<JS
89
90
  <script type="text/javascript"#{nonce_html}>
90
91
  (function() {
@@ -100,6 +101,7 @@ module Chartkick
100
101
  </script>
101
102
  JS
102
103
  else
104
+ # TODO remove type in 4.0
103
105
  js = <<JS
104
106
  <script type="text/javascript"#{nonce_html}>
105
107
  #{createjs}