chartkick 3.0.2 → 3.1.0
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +88 -54
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +16068 -15742
- data/vendor/assets/javascripts/chartkick.js +47 -9
- metadata +3 -4
@@ -2,15 +2,15 @@
|
|
2
2
|
* Chartkick.js
|
3
3
|
* Create beautiful charts with one line of JavaScript
|
4
4
|
* https://github.com/ankane/chartkick.js
|
5
|
-
* v3.0
|
5
|
+
* v3.1.0
|
6
6
|
* MIT License
|
7
7
|
*/
|
8
8
|
|
9
9
|
(function (global, factory) {
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
11
11
|
typeof define === 'function' && define.amd ? define(factory) :
|
12
|
-
(global.Chartkick = factory());
|
13
|
-
}(this,
|
12
|
+
(global = global || self, global.Chartkick = factory());
|
13
|
+
}(this, function () { 'use strict';
|
14
14
|
|
15
15
|
function isArray(variable) {
|
16
16
|
return Object.prototype.toString.call(variable) === "[object Array]";
|
@@ -21,7 +21,7 @@
|
|
21
21
|
}
|
22
22
|
|
23
23
|
function isPlainObject(variable) {
|
24
|
-
return
|
24
|
+
return Object.prototype.toString.call(variable) === "[object Object]";
|
25
25
|
}
|
26
26
|
|
27
27
|
// https://github.com/madrobby/zepto/blob/master/src/zepto.js
|
@@ -390,6 +390,12 @@
|
|
390
390
|
return result ? "rgba(" + parseInt(result[1], 16) + ", " + parseInt(result[2], 16) + ", " + parseInt(result[3], 16) + ", " + opacity + ")" : hex;
|
391
391
|
};
|
392
392
|
|
393
|
+
// check if not null or undefined
|
394
|
+
// https://stackoverflow.com/a/27757708/1177228
|
395
|
+
var notnull = function(x) {
|
396
|
+
return x != null;
|
397
|
+
};
|
398
|
+
|
393
399
|
var setLabelSize = function (chart, data, options) {
|
394
400
|
var maxLabelSize = Math.ceil(chart.element.offsetWidth / 4.0 / data.labels.length);
|
395
401
|
if (maxLabelSize > 25) {
|
@@ -621,9 +627,29 @@
|
|
621
627
|
datasets.push(dataset);
|
622
628
|
}
|
623
629
|
|
630
|
+
var xmin = chart.options.xmin;
|
631
|
+
var xmax = chart.options.xmax;
|
632
|
+
|
633
|
+
if (chart.xtype === "datetime") {
|
634
|
+
if (notnull(xmin)) {
|
635
|
+
options.scales.xAxes[0].time.min = toDate(xmin).getTime();
|
636
|
+
}
|
637
|
+
if (notnull(xmax)) {
|
638
|
+
options.scales.xAxes[0].time.max = toDate(xmax).getTime();
|
639
|
+
}
|
640
|
+
} else if (chart.xtype === "number") {
|
641
|
+
if (notnull(xmin)) {
|
642
|
+
options.scales.xAxes[0].ticks.min = xmin;
|
643
|
+
}
|
644
|
+
if (notnull(xmax)) {
|
645
|
+
options.scales.xAxes[0].ticks.max = xmax;
|
646
|
+
}
|
647
|
+
}
|
648
|
+
|
624
649
|
if (chart.xtype === "datetime" && labels.length > 0) {
|
625
|
-
var minTime = labels[0].getTime();
|
626
|
-
var maxTime = labels[0].getTime();
|
650
|
+
var minTime = (notnull(xmin) ? toDate(xmin) : labels[0]).getTime();
|
651
|
+
var maxTime = (notnull(xmax) ? toDate(xmax) : labels[0]).getTime();
|
652
|
+
|
627
653
|
for (i = 1; i < labels.length; i++) {
|
628
654
|
var value$1 = labels[i].getTime();
|
629
655
|
if (value$1 < minTime) {
|
@@ -923,7 +949,7 @@
|
|
923
949
|
|
924
950
|
if (!options.tooltip.pointFormatter) {
|
925
951
|
options.tooltip.pointFormatter = function () {
|
926
|
-
return '<span style="color:' + this.color + '>\u25CF</span> ' + formatValue(this.series.name + ': <b>', this.y, formatOptions) + '</b><br/>';
|
952
|
+
return '<span style="color:' + this.color + '">\u25CF</span> ' + formatValue(this.series.name + ': <b>', this.y, formatOptions) + '</b><br/>';
|
927
953
|
};
|
928
954
|
}
|
929
955
|
};
|
@@ -2246,9 +2272,21 @@
|
|
2246
2272
|
config: config,
|
2247
2273
|
options: {},
|
2248
2274
|
adapters: adapters,
|
2249
|
-
addAdapter: addAdapter
|
2275
|
+
addAdapter: addAdapter,
|
2276
|
+
use: function(adapter) {
|
2277
|
+
addAdapter(adapter);
|
2278
|
+
return Chartkick;
|
2279
|
+
}
|
2250
2280
|
};
|
2251
2281
|
|
2282
|
+
// not ideal, but allows for simpler integration
|
2283
|
+
if (typeof window !== "undefined" && !window.Chartkick) {
|
2284
|
+
window.Chartkick = Chartkick;
|
2285
|
+
}
|
2286
|
+
|
2287
|
+
// backwards compatibility for esm require
|
2288
|
+
Chartkick.default = Chartkick;
|
2289
|
+
|
2252
2290
|
return Chartkick;
|
2253
2291
|
|
2254
|
-
}))
|
2292
|
+
}));
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chartkick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
|
92
|
-
rubygems_version: 2.7.6
|
91
|
+
rubygems_version: 3.0.3
|
93
92
|
signing_key:
|
94
93
|
specification_version: 4
|
95
94
|
summary: Create beautiful JavaScript charts with one line of Ruby
|