chartkick 4.0.3 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +61 -33
- data/config/importmap.rb +1 -0
- data/lib/chartkick/engine.rb +9 -0
- data/lib/chartkick/helper.rb +1 -0
- data/lib/chartkick/version.rb +1 -1
- data/licenses/LICENSE-date-fns.txt +21 -20
- data/vendor/assets/javascripts/Chart.bundle.js +3647 -2757
- data/vendor/assets/javascripts/chartkick.js +35 -15
- metadata +4 -3
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Chartkick.js
|
|
3
3
|
* Create beautiful charts with one line of JavaScript
|
|
4
4
|
* https://github.com/ankane/chartkick.js
|
|
5
|
-
* v4.
|
|
5
|
+
* v4.1.1
|
|
6
6
|
* MIT License
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -748,17 +748,17 @@
|
|
|
748
748
|
|
|
749
749
|
if (chart.xtype === "datetime") {
|
|
750
750
|
if (notnull(xmin)) {
|
|
751
|
-
options.scales.x.
|
|
751
|
+
options.scales.x.min = toDate(xmin).getTime();
|
|
752
752
|
}
|
|
753
753
|
if (notnull(xmax)) {
|
|
754
|
-
options.scales.x.
|
|
754
|
+
options.scales.x.max = toDate(xmax).getTime();
|
|
755
755
|
}
|
|
756
756
|
} else if (chart.xtype === "number") {
|
|
757
757
|
if (notnull(xmin)) {
|
|
758
|
-
options.scales.x.
|
|
758
|
+
options.scales.x.min = xmin;
|
|
759
759
|
}
|
|
760
760
|
if (notnull(xmax)) {
|
|
761
|
-
options.scales.x.
|
|
761
|
+
options.scales.x.max = xmax;
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
|
|
@@ -816,11 +816,15 @@
|
|
|
816
816
|
}
|
|
817
817
|
|
|
818
818
|
if (step && timeDiff > 0) {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
819
|
+
// width not available for hidden elements
|
|
820
|
+
var width = chart.element.offsetWidth;
|
|
821
|
+
if (width > 0) {
|
|
822
|
+
var unitStepSize = Math.ceil(timeDiff / step / (width / 100.0));
|
|
823
|
+
if (week && step === 1) {
|
|
824
|
+
unitStepSize = Math.ceil(unitStepSize / 7.0) * 7;
|
|
825
|
+
}
|
|
826
|
+
options.scales.x.time.stepSize = unitStepSize;
|
|
822
827
|
}
|
|
823
|
-
options.scales.x.time.stepSize = unitStepSize;
|
|
824
828
|
}
|
|
825
829
|
}
|
|
826
830
|
|
|
@@ -861,8 +865,8 @@
|
|
|
861
865
|
var data = createDataTable(chart, options, chartType || "line");
|
|
862
866
|
|
|
863
867
|
if (chart.xtype === "number") {
|
|
864
|
-
options.scales.x.type = "linear";
|
|
865
|
-
options.scales.x.position = "bottom";
|
|
868
|
+
options.scales.x.type = options.scales.x.type || "linear";
|
|
869
|
+
options.scales.x.position = options.scales.x.position ||"bottom";
|
|
866
870
|
} else {
|
|
867
871
|
options.scales.x.type = chart.xtype === "string" ? "category" : "time";
|
|
868
872
|
}
|
|
@@ -952,8 +956,8 @@
|
|
|
952
956
|
|
|
953
957
|
var data = createDataTable(chart, options, chartType);
|
|
954
958
|
|
|
955
|
-
options.scales.x.type = "linear";
|
|
956
|
-
options.scales.x.position = "bottom";
|
|
959
|
+
options.scales.x.type = options.scales.x.type || "linear";
|
|
960
|
+
options.scales.x.position = options.scales.x.position || "bottom";
|
|
957
961
|
|
|
958
962
|
// prevent grouping hover and tooltips
|
|
959
963
|
if (!("mode" in options.interaction)) {
|
|
@@ -1103,7 +1107,7 @@
|
|
|
1103
1107
|
};
|
|
1104
1108
|
}
|
|
1105
1109
|
|
|
1106
|
-
if (!options.tooltip.pointFormatter) {
|
|
1110
|
+
if (!options.tooltip.pointFormatter && !options.tooltip.pointFormat) {
|
|
1107
1111
|
options.tooltip.pointFormatter = function () {
|
|
1108
1112
|
return '<span style="color:' + this.color + '">\u25CF</span> ' + formatValue(this.series.name + ': <b>', this.y, formatOptions) + '</b><br/>';
|
|
1109
1113
|
};
|
|
@@ -1145,7 +1149,11 @@
|
|
|
1145
1149
|
}
|
|
1146
1150
|
|
|
1147
1151
|
var options = jsOptions$1(chart, chart.options, chartOptions), data, i, j;
|
|
1148
|
-
|
|
1152
|
+
if (chart.xtype === "number") {
|
|
1153
|
+
options.xAxis.type = options.xAxis.type || "linear";
|
|
1154
|
+
} else {
|
|
1155
|
+
options.xAxis.type = chart.xtype === "string" ? "category" : "datetime";
|
|
1156
|
+
}
|
|
1149
1157
|
if (!options.chart.type) {
|
|
1150
1158
|
options.chart.type = chartType;
|
|
1151
1159
|
}
|
|
@@ -1721,6 +1729,7 @@
|
|
|
1721
1729
|
|
|
1722
1730
|
return r;
|
|
1723
1731
|
}
|
|
1732
|
+
|
|
1724
1733
|
function detectXType(series, noDatetime, options) {
|
|
1725
1734
|
if (dataEmpty(series)) {
|
|
1726
1735
|
if ((options.xmin || options.xmax) && (!options.xmin || isDate(options.xmin)) && (!options.xmax || isDate(options.xmax))) {
|
|
@@ -1881,6 +1890,14 @@
|
|
|
1881
1890
|
}
|
|
1882
1891
|
}
|
|
1883
1892
|
|
|
1893
|
+
function removeEvent(elem, event, fn) {
|
|
1894
|
+
if (elem.removeEventListener) {
|
|
1895
|
+
elem.removeEventListener(event, fn, false);
|
|
1896
|
+
} else {
|
|
1897
|
+
elem.detachEvent("on" + event, fn);
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1884
1901
|
// https://gist.github.com/shawnbot/4166283
|
|
1885
1902
|
function childOf(p, c) {
|
|
1886
1903
|
if (p === c) { return false; }
|
|
@@ -2478,6 +2495,9 @@
|
|
|
2478
2495
|
document.addEventListener("turbolinks:before-render", function() {
|
|
2479
2496
|
Chartkick.destroyAll();
|
|
2480
2497
|
});
|
|
2498
|
+
document.addEventListener("turbo:before-render", function() {
|
|
2499
|
+
Chartkick.destroyAll();
|
|
2500
|
+
});
|
|
2481
2501
|
|
|
2482
2502
|
// use setTimeout so charting library can come later in same JS file
|
|
2483
2503
|
setTimeout(function() {
|
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: 4.
|
|
4
|
+
version: 4.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-11-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: andrew@ankane.org
|
|
@@ -19,6 +19,7 @@ files:
|
|
|
19
19
|
- CHANGELOG.md
|
|
20
20
|
- LICENSE.txt
|
|
21
21
|
- README.md
|
|
22
|
+
- config/importmap.rb
|
|
22
23
|
- lib/chartkick.rb
|
|
23
24
|
- lib/chartkick/engine.rb
|
|
24
25
|
- lib/chartkick/enumerable.rb
|
|
@@ -50,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
50
51
|
- !ruby/object:Gem::Version
|
|
51
52
|
version: '0'
|
|
52
53
|
requirements: []
|
|
53
|
-
rubygems_version: 3.2.
|
|
54
|
+
rubygems_version: 3.2.22
|
|
54
55
|
signing_key:
|
|
55
56
|
specification_version: 4
|
|
56
57
|
summary: Create beautiful JavaScript charts with one line of Ruby
|