chartkick 4.1.3 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +15 -2
- data/lib/chartkick/version.rb +1 -1
- data/licenses/LICENSE-chart.js.txt +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +1326 -1129
- data/vendor/assets/javascripts/chartkick.js +39 -34
- metadata +3 -3
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* Chart.js v3.
|
2
|
+
* Chart.js v3.8.0
|
3
3
|
* https://www.chartjs.org
|
4
|
-
* (c)
|
4
|
+
* (c) 2022 Chart.js Contributors
|
5
5
|
* Released under the MIT License
|
6
6
|
*
|
7
7
|
* chartjs-adapter-date-fns v2.0.0
|
@@ -9,7 +9,7 @@
|
|
9
9
|
* (c) 2021 chartjs-adapter-date-fns Contributors
|
10
10
|
* Released under the MIT license
|
11
11
|
*
|
12
|
-
* date-fns v2.
|
12
|
+
* date-fns v2.28.0
|
13
13
|
* https://date-fns.org
|
14
14
|
* (c) 2021 Sasha Koss and Lesha Koss
|
15
15
|
* Released under the MIT License
|
@@ -19,22 +19,42 @@
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
20
20
|
typeof define === 'function' && define.amd ? define(factory) :
|
21
21
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Chart = factory());
|
22
|
-
}(this, (function () { 'use strict';
|
22
|
+
})(this, (function () { 'use strict';
|
23
23
|
|
24
|
-
function
|
25
|
-
|
24
|
+
function ownKeys(object, enumerableOnly) {
|
25
|
+
var keys = Object.keys(object);
|
26
26
|
|
27
|
-
if (
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
if (Object.getOwnPropertySymbols) {
|
28
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
29
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
30
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
31
|
+
})), keys.push.apply(keys, symbols);
|
32
|
+
}
|
33
|
+
|
34
|
+
return keys;
|
35
|
+
}
|
36
|
+
|
37
|
+
function _objectSpread2(target) {
|
38
|
+
for (var i = 1; i < arguments.length; i++) {
|
39
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
40
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
41
|
+
_defineProperty(target, key, source[key]);
|
42
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
43
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
44
|
+
});
|
35
45
|
}
|
36
46
|
|
37
|
-
return
|
47
|
+
return target;
|
48
|
+
}
|
49
|
+
|
50
|
+
function _typeof(obj) {
|
51
|
+
"@babel/helpers - typeof";
|
52
|
+
|
53
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
54
|
+
return typeof obj;
|
55
|
+
} : function (obj) {
|
56
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
57
|
+
}, _typeof(obj);
|
38
58
|
}
|
39
59
|
|
40
60
|
function _classCallCheck(instance, Constructor) {
|
@@ -56,6 +76,9 @@
|
|
56
76
|
function _createClass(Constructor, protoProps, staticProps) {
|
57
77
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
58
78
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
79
|
+
Object.defineProperty(Constructor, "prototype", {
|
80
|
+
writable: false
|
81
|
+
});
|
59
82
|
return Constructor;
|
60
83
|
}
|
61
84
|
|
@@ -74,40 +97,6 @@
|
|
74
97
|
return obj;
|
75
98
|
}
|
76
99
|
|
77
|
-
function ownKeys(object, enumerableOnly) {
|
78
|
-
var keys = Object.keys(object);
|
79
|
-
|
80
|
-
if (Object.getOwnPropertySymbols) {
|
81
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
82
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
83
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
84
|
-
});
|
85
|
-
keys.push.apply(keys, symbols);
|
86
|
-
}
|
87
|
-
|
88
|
-
return keys;
|
89
|
-
}
|
90
|
-
|
91
|
-
function _objectSpread2(target) {
|
92
|
-
for (var i = 1; i < arguments.length; i++) {
|
93
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
94
|
-
|
95
|
-
if (i % 2) {
|
96
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
97
|
-
_defineProperty(target, key, source[key]);
|
98
|
-
});
|
99
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
100
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
101
|
-
} else {
|
102
|
-
ownKeys(Object(source)).forEach(function (key) {
|
103
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
104
|
-
});
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
return target;
|
109
|
-
}
|
110
|
-
|
111
100
|
function _inherits(subClass, superClass) {
|
112
101
|
if (typeof superClass !== "function" && superClass !== null) {
|
113
102
|
throw new TypeError("Super expression must either be null or a function");
|
@@ -120,22 +109,24 @@
|
|
120
109
|
configurable: true
|
121
110
|
}
|
122
111
|
});
|
112
|
+
Object.defineProperty(subClass, "prototype", {
|
113
|
+
writable: false
|
114
|
+
});
|
123
115
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
124
116
|
}
|
125
117
|
|
126
118
|
function _getPrototypeOf(o) {
|
127
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
119
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
128
120
|
return o.__proto__ || Object.getPrototypeOf(o);
|
129
121
|
};
|
130
122
|
return _getPrototypeOf(o);
|
131
123
|
}
|
132
124
|
|
133
125
|
function _setPrototypeOf(o, p) {
|
134
|
-
_setPrototypeOf = Object.setPrototypeOf
|
126
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
135
127
|
o.__proto__ = p;
|
136
128
|
return o;
|
137
129
|
};
|
138
|
-
|
139
130
|
return _setPrototypeOf(o, p);
|
140
131
|
}
|
141
132
|
|
@@ -163,6 +154,8 @@
|
|
163
154
|
function _possibleConstructorReturn(self, call) {
|
164
155
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
165
156
|
return call;
|
157
|
+
} else if (call !== void 0) {
|
158
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
166
159
|
}
|
167
160
|
|
168
161
|
return _assertThisInitialized(self);
|
@@ -196,9 +189,9 @@
|
|
196
189
|
return object;
|
197
190
|
}
|
198
191
|
|
199
|
-
function _get(
|
192
|
+
function _get() {
|
200
193
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
201
|
-
_get = Reflect.get;
|
194
|
+
_get = Reflect.get.bind();
|
202
195
|
} else {
|
203
196
|
_get = function _get(target, property, receiver) {
|
204
197
|
var base = _superPropBase(target, property);
|
@@ -207,14 +200,14 @@
|
|
207
200
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
208
201
|
|
209
202
|
if (desc.get) {
|
210
|
-
return desc.get.call(receiver);
|
203
|
+
return desc.get.call(arguments.length < 3 ? target : receiver);
|
211
204
|
}
|
212
205
|
|
213
206
|
return desc.value;
|
214
207
|
};
|
215
208
|
}
|
216
209
|
|
217
|
-
return _get(
|
210
|
+
return _get.apply(this, arguments);
|
218
211
|
}
|
219
212
|
|
220
213
|
function _slicedToArray(arr, i) {
|
@@ -234,18 +227,21 @@
|
|
234
227
|
}
|
235
228
|
|
236
229
|
function _iterableToArray(iter) {
|
237
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator
|
230
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
238
231
|
}
|
239
232
|
|
240
233
|
function _iterableToArrayLimit(arr, i) {
|
241
|
-
|
234
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
235
|
+
|
236
|
+
if (_i == null) return;
|
242
237
|
var _arr = [];
|
243
238
|
var _n = true;
|
244
239
|
var _d = false;
|
245
|
-
|
240
|
+
|
241
|
+
var _s, _e;
|
246
242
|
|
247
243
|
try {
|
248
|
-
for (
|
244
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
249
245
|
_arr.push(_s.value);
|
250
246
|
|
251
247
|
if (i && _arr.length === i) break;
|
@@ -290,9 +286,9 @@
|
|
290
286
|
}
|
291
287
|
|
292
288
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
293
|
-
var it;
|
289
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
294
290
|
|
295
|
-
if (
|
291
|
+
if (!it) {
|
296
292
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
297
293
|
if (it) o = it;
|
298
294
|
var i = 0;
|
@@ -325,7 +321,7 @@
|
|
325
321
|
err;
|
326
322
|
return {
|
327
323
|
s: function () {
|
328
|
-
it =
|
324
|
+
it = it.call(o);
|
329
325
|
},
|
330
326
|
n: function () {
|
331
327
|
var step = it.next();
|
@@ -431,7 +427,7 @@
|
|
431
427
|
|
432
428
|
var type = Object.prototype.toString.call(value);
|
433
429
|
|
434
|
-
if (type.
|
430
|
+
if (type.slice(0, 7) === '[object' && type.slice(-6) === 'Array]') {
|
435
431
|
return true;
|
436
432
|
}
|
437
433
|
|
@@ -618,7 +614,7 @@
|
|
618
614
|
var idx = indexOfDotOrLength(key, pos);
|
619
615
|
|
620
616
|
while (obj && idx > pos) {
|
621
|
-
obj = obj[key.
|
617
|
+
obj = obj[key.slice(pos, idx)];
|
622
618
|
pos = idx + 1;
|
623
619
|
idx = indexOfDotOrLength(key, pos);
|
624
620
|
}
|
@@ -951,12 +947,36 @@
|
|
951
947
|
}
|
952
948
|
};
|
953
949
|
/*!
|
954
|
-
* @kurkle/color v0.1
|
950
|
+
* @kurkle/color v0.2.1
|
955
951
|
* https://github.com/kurkle/color#readme
|
956
|
-
* (c)
|
952
|
+
* (c) 2022 Jukka Kurkela
|
957
953
|
* Released under the MIT License
|
958
954
|
*/
|
959
955
|
|
956
|
+
function round(v) {
|
957
|
+
return v + 0.5 | 0;
|
958
|
+
}
|
959
|
+
|
960
|
+
var lim = function lim(v, l, h) {
|
961
|
+
return Math.max(Math.min(v, h), l);
|
962
|
+
};
|
963
|
+
|
964
|
+
function p2b(v) {
|
965
|
+
return lim(round(v * 2.55), 0, 255);
|
966
|
+
}
|
967
|
+
|
968
|
+
function n2b(v) {
|
969
|
+
return lim(round(v * 255), 0, 255);
|
970
|
+
}
|
971
|
+
|
972
|
+
function b2n(v) {
|
973
|
+
return lim(round(v / 2.55) / 100, 0, 1);
|
974
|
+
}
|
975
|
+
|
976
|
+
function n2p(v) {
|
977
|
+
return lim(round(v * 100), 0, 100);
|
978
|
+
}
|
979
|
+
|
960
980
|
var map$1 = {
|
961
981
|
0: 0,
|
962
982
|
1: 1,
|
@@ -981,7 +1001,8 @@
|
|
981
1001
|
e: 14,
|
982
1002
|
f: 15
|
983
1003
|
};
|
984
|
-
|
1004
|
+
|
1005
|
+
var hex = _toConsumableArray('0123456789ABCDEF');
|
985
1006
|
|
986
1007
|
var h1 = function h1(b) {
|
987
1008
|
return hex[b & 0xF];
|
@@ -995,9 +1016,9 @@
|
|
995
1016
|
return (b & 0xF0) >> 4 === (b & 0xF);
|
996
1017
|
};
|
997
1018
|
|
998
|
-
function isShort(v) {
|
1019
|
+
var isShort = function isShort(v) {
|
999
1020
|
return eq(v.r) && eq(v.g) && eq(v.b) && eq(v.a);
|
1000
|
-
}
|
1021
|
+
};
|
1001
1022
|
|
1002
1023
|
function hexParse(str) {
|
1003
1024
|
var len = str.length;
|
@@ -1024,67 +1045,13 @@
|
|
1024
1045
|
return ret;
|
1025
1046
|
}
|
1026
1047
|
|
1027
|
-
function
|
1028
|
-
|
1029
|
-
return v ? '#' + f(v.r) + f(v.g) + f(v.b) + (v.a < 255 ? f(v.a) : '') : v;
|
1030
|
-
}
|
1031
|
-
|
1032
|
-
function round(v) {
|
1033
|
-
return v + 0.5 | 0;
|
1034
|
-
}
|
1035
|
-
|
1036
|
-
var lim = function lim(v, l, h) {
|
1037
|
-
return Math.max(Math.min(v, h), l);
|
1048
|
+
var alpha = function alpha(a, f) {
|
1049
|
+
return a < 255 ? f(a) : '';
|
1038
1050
|
};
|
1039
1051
|
|
1040
|
-
function
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
function n2b(v) {
|
1045
|
-
return lim(round(v * 255), 0, 255);
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
function b2n(v) {
|
1049
|
-
return lim(round(v / 2.55) / 100, 0, 1);
|
1050
|
-
}
|
1051
|
-
|
1052
|
-
function n2p(v) {
|
1053
|
-
return lim(round(v * 100), 0, 100);
|
1054
|
-
}
|
1055
|
-
|
1056
|
-
var RGB_RE = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
|
1057
|
-
|
1058
|
-
function rgbParse(str) {
|
1059
|
-
var m = RGB_RE.exec(str);
|
1060
|
-
var a = 255;
|
1061
|
-
var r, g, b;
|
1062
|
-
|
1063
|
-
if (!m) {
|
1064
|
-
return;
|
1065
|
-
}
|
1066
|
-
|
1067
|
-
if (m[7] !== r) {
|
1068
|
-
var v = +m[7];
|
1069
|
-
a = 255 & (m[8] ? p2b(v) : v * 255);
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
r = +m[1];
|
1073
|
-
g = +m[3];
|
1074
|
-
b = +m[5];
|
1075
|
-
r = 255 & (m[2] ? p2b(r) : r);
|
1076
|
-
g = 255 & (m[4] ? p2b(g) : g);
|
1077
|
-
b = 255 & (m[6] ? p2b(b) : b);
|
1078
|
-
return {
|
1079
|
-
r: r,
|
1080
|
-
g: g,
|
1081
|
-
b: b,
|
1082
|
-
a: a
|
1083
|
-
};
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
function _rgbString(v) {
|
1087
|
-
return v && (v.a < 255 ? "rgba(".concat(v.r, ", ").concat(v.g, ", ").concat(v.b, ", ").concat(b2n(v.a), ")") : "rgb(".concat(v.r, ", ").concat(v.g, ", ").concat(v.b, ")"));
|
1052
|
+
function _hexString(v) {
|
1053
|
+
var f = isShort(v) ? h1 : h2;
|
1054
|
+
return v ? '#' + f(v.r) + f(v.g) + f(v.b) + alpha(v.a, f) : undefined;
|
1088
1055
|
}
|
1089
1056
|
|
1090
1057
|
var HUE_RE = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;
|
@@ -1127,6 +1094,18 @@
|
|
1127
1094
|
return rgb;
|
1128
1095
|
}
|
1129
1096
|
|
1097
|
+
function hueValue(r, g, b, d, max) {
|
1098
|
+
if (r === max) {
|
1099
|
+
return (g - b) / d + (g < b ? 6 : 0);
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
if (g === max) {
|
1103
|
+
return (b - r) / d + 2;
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
return (r - g) / d + 4;
|
1107
|
+
}
|
1108
|
+
|
1130
1109
|
function rgb2hsl(v) {
|
1131
1110
|
var range = 255;
|
1132
1111
|
var r = v.r / range;
|
@@ -1140,7 +1119,7 @@
|
|
1140
1119
|
if (max !== min) {
|
1141
1120
|
d = max - min;
|
1142
1121
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
1143
|
-
h =
|
1122
|
+
h = hueValue(r, g, b, d, max);
|
1144
1123
|
h = h * 60 + 0.5;
|
1145
1124
|
}
|
1146
1125
|
|
@@ -1221,7 +1200,7 @@
|
|
1221
1200
|
return v.a < 255 ? "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(b2n(v.a), ")") : "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)");
|
1222
1201
|
}
|
1223
1202
|
|
1224
|
-
var map$
|
1203
|
+
var map$2 = {
|
1225
1204
|
x: 'dark',
|
1226
1205
|
Z: 'light',
|
1227
1206
|
Y: 're',
|
@@ -1250,7 +1229,7 @@
|
|
1250
1229
|
I: 'ightg',
|
1251
1230
|
J: 'wh'
|
1252
1231
|
};
|
1253
|
-
var names = {
|
1232
|
+
var names$1 = {
|
1254
1233
|
OiceXe: 'f0f8ff',
|
1255
1234
|
antiquewEte: 'faebd7',
|
1256
1235
|
aqua: 'ffff',
|
@@ -1403,8 +1382,8 @@
|
|
1403
1382
|
|
1404
1383
|
function unpack() {
|
1405
1384
|
var unpacked = {};
|
1406
|
-
var keys = Object.keys(names);
|
1407
|
-
var tkeys = Object.keys(map$
|
1385
|
+
var keys = Object.keys(names$1);
|
1386
|
+
var tkeys = Object.keys(map$2);
|
1408
1387
|
var i, j, k, ok, nk;
|
1409
1388
|
|
1410
1389
|
for (i = 0; i < keys.length; i++) {
|
@@ -1412,25 +1391,25 @@
|
|
1412
1391
|
|
1413
1392
|
for (j = 0; j < tkeys.length; j++) {
|
1414
1393
|
k = tkeys[j];
|
1415
|
-
nk = nk.replace(k, map$
|
1394
|
+
nk = nk.replace(k, map$2[k]);
|
1416
1395
|
}
|
1417
1396
|
|
1418
|
-
k = parseInt(names[ok], 16);
|
1397
|
+
k = parseInt(names$1[ok], 16);
|
1419
1398
|
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];
|
1420
1399
|
}
|
1421
1400
|
|
1422
1401
|
return unpacked;
|
1423
1402
|
}
|
1424
1403
|
|
1425
|
-
var names
|
1404
|
+
var names;
|
1426
1405
|
|
1427
1406
|
function nameParse(str) {
|
1428
|
-
if (!names
|
1429
|
-
names
|
1430
|
-
names
|
1407
|
+
if (!names) {
|
1408
|
+
names = unpack();
|
1409
|
+
names.transparent = [0, 0, 0, 0];
|
1431
1410
|
}
|
1432
1411
|
|
1433
|
-
var a = names
|
1412
|
+
var a = names[str.toLowerCase()];
|
1434
1413
|
return a && {
|
1435
1414
|
r: a[0],
|
1436
1415
|
g: a[1],
|
@@ -1439,6 +1418,60 @@
|
|
1439
1418
|
};
|
1440
1419
|
}
|
1441
1420
|
|
1421
|
+
var RGB_RE = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
|
1422
|
+
|
1423
|
+
function rgbParse(str) {
|
1424
|
+
var m = RGB_RE.exec(str);
|
1425
|
+
var a = 255;
|
1426
|
+
var r, g, b;
|
1427
|
+
|
1428
|
+
if (!m) {
|
1429
|
+
return;
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
if (m[7] !== r) {
|
1433
|
+
var v = +m[7];
|
1434
|
+
a = m[8] ? p2b(v) : lim(v * 255, 0, 255);
|
1435
|
+
}
|
1436
|
+
|
1437
|
+
r = +m[1];
|
1438
|
+
g = +m[3];
|
1439
|
+
b = +m[5];
|
1440
|
+
r = 255 & (m[2] ? p2b(r) : lim(r, 0, 255));
|
1441
|
+
g = 255 & (m[4] ? p2b(g) : lim(g, 0, 255));
|
1442
|
+
b = 255 & (m[6] ? p2b(b) : lim(b, 0, 255));
|
1443
|
+
return {
|
1444
|
+
r: r,
|
1445
|
+
g: g,
|
1446
|
+
b: b,
|
1447
|
+
a: a
|
1448
|
+
};
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
function _rgbString(v) {
|
1452
|
+
return v && (v.a < 255 ? "rgba(".concat(v.r, ", ").concat(v.g, ", ").concat(v.b, ", ").concat(b2n(v.a), ")") : "rgb(".concat(v.r, ", ").concat(v.g, ", ").concat(v.b, ")"));
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
var to = function to(v) {
|
1456
|
+
return v <= 0.0031308 ? v * 12.92 : Math.pow(v, 1.0 / 2.4) * 1.055 - 0.055;
|
1457
|
+
};
|
1458
|
+
|
1459
|
+
var from = function from(v) {
|
1460
|
+
return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
1461
|
+
};
|
1462
|
+
|
1463
|
+
function _interpolate(rgb1, rgb2, t) {
|
1464
|
+
var r = from(b2n(rgb1.r));
|
1465
|
+
var g = from(b2n(rgb1.g));
|
1466
|
+
var b = from(b2n(rgb1.b));
|
1467
|
+
return {
|
1468
|
+
r: n2b(to(r + t * (from(b2n(rgb2.r)) - r))),
|
1469
|
+
g: n2b(to(g + t * (from(b2n(rgb2.g)) - g))),
|
1470
|
+
b: n2b(to(b + t * (from(b2n(rgb2.b)) - b))),
|
1471
|
+
a: rgb1.a + t * (rgb2.a - rgb1.a)
|
1472
|
+
};
|
1473
|
+
}
|
1474
|
+
|
1442
1475
|
function modHSL(v, i, ratio) {
|
1443
1476
|
if (v) {
|
1444
1477
|
var tmp = rgb2hsl(v);
|
@@ -1540,25 +1573,23 @@
|
|
1540
1573
|
}, {
|
1541
1574
|
key: "rgbString",
|
1542
1575
|
value: function rgbString() {
|
1543
|
-
return this._valid ? _rgbString(this._rgb) :
|
1576
|
+
return this._valid ? _rgbString(this._rgb) : undefined;
|
1544
1577
|
}
|
1545
1578
|
}, {
|
1546
1579
|
key: "hexString",
|
1547
1580
|
value: function hexString() {
|
1548
|
-
return this._valid ? _hexString(this._rgb) :
|
1581
|
+
return this._valid ? _hexString(this._rgb) : undefined;
|
1549
1582
|
}
|
1550
1583
|
}, {
|
1551
1584
|
key: "hslString",
|
1552
1585
|
value: function hslString() {
|
1553
|
-
return this._valid ? _hslString(this._rgb) :
|
1586
|
+
return this._valid ? _hslString(this._rgb) : undefined;
|
1554
1587
|
}
|
1555
1588
|
}, {
|
1556
1589
|
key: "mix",
|
1557
1590
|
value: function mix(color, weight) {
|
1558
|
-
var me = this;
|
1559
|
-
|
1560
1591
|
if (color) {
|
1561
|
-
var c1 =
|
1592
|
+
var c1 = this.rgb;
|
1562
1593
|
var c2 = color.rgb;
|
1563
1594
|
var w2;
|
1564
1595
|
var p = weight === w2 ? 0.5 : weight;
|
@@ -1570,10 +1601,19 @@
|
|
1570
1601
|
c1.g = 0xFF & w1 * c1.g + w2 * c2.g + 0.5;
|
1571
1602
|
c1.b = 0xFF & w1 * c1.b + w2 * c2.b + 0.5;
|
1572
1603
|
c1.a = p * c1.a + (1 - p) * c2.a;
|
1573
|
-
|
1604
|
+
this.rgb = c1;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
return this;
|
1608
|
+
}
|
1609
|
+
}, {
|
1610
|
+
key: "interpolate",
|
1611
|
+
value: function interpolate(color, t) {
|
1612
|
+
if (color) {
|
1613
|
+
this._rgb = _interpolate(this._rgb, color._rgb, t);
|
1574
1614
|
}
|
1575
1615
|
|
1576
|
-
return
|
1616
|
+
return this;
|
1577
1617
|
}
|
1578
1618
|
}, {
|
1579
1619
|
key: "clone",
|
@@ -1657,9 +1697,14 @@
|
|
1657
1697
|
return new Color(input);
|
1658
1698
|
}
|
1659
1699
|
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1700
|
+
function isPatternOrGradient(value) {
|
1701
|
+
if (value && _typeof(value) === 'object') {
|
1702
|
+
var type = value.toString();
|
1703
|
+
return type === '[object CanvasPattern]' || type === '[object CanvasGradient]';
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
return false;
|
1707
|
+
}
|
1663
1708
|
|
1664
1709
|
function color(value) {
|
1665
1710
|
return isPatternOrGradient(value) ? value : index_esm(value);
|
@@ -1735,7 +1780,8 @@
|
|
1735
1780
|
this.indexAxis = 'x';
|
1736
1781
|
this.interaction = {
|
1737
1782
|
mode: 'nearest',
|
1738
|
-
intersect: true
|
1783
|
+
intersect: true,
|
1784
|
+
includeInvisible: false
|
1739
1785
|
};
|
1740
1786
|
this.maintainAspectRatio = true;
|
1741
1787
|
this.onHover = null;
|
@@ -2842,6 +2888,24 @@
|
|
2842
2888
|
return Array.from(set);
|
2843
2889
|
}
|
2844
2890
|
|
2891
|
+
function _parseObjectDataRadialScale(meta, data, start, count) {
|
2892
|
+
var iScale = meta.iScale;
|
2893
|
+
var _this$_parsing$key = this._parsing.key,
|
2894
|
+
key = _this$_parsing$key === void 0 ? 'r' : _this$_parsing$key;
|
2895
|
+
var parsed = new Array(count);
|
2896
|
+
var i, ilen, index, item;
|
2897
|
+
|
2898
|
+
for (i = 0, ilen = count; i < ilen; ++i) {
|
2899
|
+
index = i + start;
|
2900
|
+
item = data[index];
|
2901
|
+
parsed[i] = {
|
2902
|
+
r: iScale.parse(resolveObjectKey(item, key), index)
|
2903
|
+
};
|
2904
|
+
}
|
2905
|
+
|
2906
|
+
return parsed;
|
2907
|
+
}
|
2908
|
+
|
2845
2909
|
var EPSILON = Number.EPSILON || 1e-14;
|
2846
2910
|
|
2847
2911
|
var getPoint = function getPoint(points, i) {
|
@@ -3091,8 +3155,7 @@
|
|
3091
3155
|
return (x > 0 || y > 0) && (!target || !target.shadowRoot);
|
3092
3156
|
};
|
3093
3157
|
|
3094
|
-
function getCanvasPosition(
|
3095
|
-
var e = evt.native || evt;
|
3158
|
+
function getCanvasPosition(e, canvas) {
|
3096
3159
|
var touches = e.touches;
|
3097
3160
|
var source = touches && touches.length ? touches[0] : e;
|
3098
3161
|
var offsetX = source.offsetX,
|
@@ -3117,7 +3180,11 @@
|
|
3117
3180
|
};
|
3118
3181
|
}
|
3119
3182
|
|
3120
|
-
function getRelativePosition
|
3183
|
+
function getRelativePosition(evt, chart) {
|
3184
|
+
if ('native' in evt) {
|
3185
|
+
return evt;
|
3186
|
+
}
|
3187
|
+
|
3121
3188
|
var canvas = chart.canvas,
|
3122
3189
|
currentDevicePixelRatio = chart.currentDevicePixelRatio;
|
3123
3190
|
var style = getComputedStyle(canvas);
|
@@ -4512,10 +4579,10 @@
|
|
4512
4579
|
|
4513
4580
|
for (var i = 0; i < ilen; ++i) {
|
4514
4581
|
var item = parsed[i];
|
4515
|
-
var
|
4582
|
+
var _index = item[iAxis],
|
4516
4583
|
value = item[vAxis];
|
4517
4584
|
var itemStacks = item._stacks || (item._stacks = {});
|
4518
|
-
stack = itemStacks[vAxis] = getOrCreateStack(stacks, key,
|
4585
|
+
stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, _index);
|
4519
4586
|
stack[datasetIndex] = value;
|
4520
4587
|
stack._top = getLastIndexInStack(stack, vScale, true, meta.type);
|
4521
4588
|
stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);
|
@@ -4617,6 +4684,7 @@
|
|
4617
4684
|
this._drawStart = undefined;
|
4618
4685
|
this._drawCount = undefined;
|
4619
4686
|
this.enableOptionSharing = false;
|
4687
|
+
this.supportsDecimation = false;
|
4620
4688
|
this.$context = undefined;
|
4621
4689
|
this._syncList = [];
|
4622
4690
|
this.initialize();
|
@@ -5891,6 +5959,11 @@
|
|
5891
5959
|
base -= size / 2;
|
5892
5960
|
}
|
5893
5961
|
|
5962
|
+
var startPixel = vScale.getPixelForDecimal(0);
|
5963
|
+
var endPixel = vScale.getPixelForDecimal(1);
|
5964
|
+
var min = Math.min(startPixel, endPixel);
|
5965
|
+
var max = Math.max(startPixel, endPixel);
|
5966
|
+
base = Math.max(Math.min(base, max), min);
|
5894
5967
|
head = base + size;
|
5895
5968
|
}
|
5896
5969
|
|
@@ -6603,6 +6676,7 @@
|
|
6603
6676
|
key: "initialize",
|
6604
6677
|
value: function initialize() {
|
6605
6678
|
this.enableOptionSharing = true;
|
6679
|
+
this.supportsDecimation = true;
|
6606
6680
|
|
6607
6681
|
_get(_getPrototypeOf(LineController.prototype), "initialize", this).call(this);
|
6608
6682
|
}
|
@@ -6674,7 +6748,7 @@
|
|
6674
6748
|
var iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);
|
6675
6749
|
var vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);
|
6676
6750
|
properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;
|
6677
|
-
properties.stop = i > 0 && parsed[iAxis] - prevParsed[iAxis] > maxGapLength;
|
6751
|
+
properties.stop = i > 0 && Math.abs(parsed[iAxis] - prevParsed[iAxis]) > maxGapLength;
|
6678
6752
|
|
6679
6753
|
if (segment) {
|
6680
6754
|
properties.parsed = parsed;
|
@@ -6823,6 +6897,11 @@
|
|
6823
6897
|
value: value
|
6824
6898
|
};
|
6825
6899
|
}
|
6900
|
+
}, {
|
6901
|
+
key: "parseObjectData",
|
6902
|
+
value: function parseObjectData(meta, data, start, count) {
|
6903
|
+
return _parseObjectDataRadialScale.bind(this)(meta, data, start, count);
|
6904
|
+
}
|
6826
6905
|
}, {
|
6827
6906
|
key: "update",
|
6828
6907
|
value: function update(mode) {
|
@@ -6832,6 +6911,31 @@
|
|
6832
6911
|
|
6833
6912
|
this.updateElements(arcs, 0, arcs.length, mode);
|
6834
6913
|
}
|
6914
|
+
}, {
|
6915
|
+
key: "getMinMax",
|
6916
|
+
value: function getMinMax() {
|
6917
|
+
var _this6 = this;
|
6918
|
+
|
6919
|
+
var meta = this._cachedMeta;
|
6920
|
+
var range = {
|
6921
|
+
min: Number.POSITIVE_INFINITY,
|
6922
|
+
max: Number.NEGATIVE_INFINITY
|
6923
|
+
};
|
6924
|
+
meta.data.forEach(function (element, index) {
|
6925
|
+
var parsed = _this6.getParsed(index).r;
|
6926
|
+
|
6927
|
+
if (!isNaN(parsed) && _this6.chart.getDataVisibility(index)) {
|
6928
|
+
if (parsed < range.min) {
|
6929
|
+
range.min = parsed;
|
6930
|
+
}
|
6931
|
+
|
6932
|
+
if (parsed > range.max) {
|
6933
|
+
range.max = parsed;
|
6934
|
+
}
|
6935
|
+
}
|
6936
|
+
});
|
6937
|
+
return range;
|
6938
|
+
}
|
6835
6939
|
}, {
|
6836
6940
|
key: "_updateRadius",
|
6837
6941
|
value: function _updateRadius() {
|
@@ -6850,7 +6954,6 @@
|
|
6850
6954
|
value: function updateElements(arcs, start, count, mode) {
|
6851
6955
|
var reset = mode === 'reset';
|
6852
6956
|
var chart = this.chart;
|
6853
|
-
var dataset = this.getDataset();
|
6854
6957
|
var opts = chart.options;
|
6855
6958
|
var animationOpts = opts.animation;
|
6856
6959
|
var scale = this._cachedMeta.rScale;
|
@@ -6871,7 +6974,7 @@
|
|
6871
6974
|
|
6872
6975
|
var endAngle = angle + this._computeAngle(i, mode, defaultAngle);
|
6873
6976
|
|
6874
|
-
var outerRadius = chart.getDataVisibility(i) ? scale.getDistanceFromCenterForValue(
|
6977
|
+
var outerRadius = chart.getDataVisibility(i) ? scale.getDistanceFromCenterForValue(this.getParsed(i).r) : 0;
|
6875
6978
|
angle = endAngle;
|
6876
6979
|
|
6877
6980
|
if (reset) {
|
@@ -6899,13 +7002,12 @@
|
|
6899
7002
|
}, {
|
6900
7003
|
key: "countVisibleElements",
|
6901
7004
|
value: function countVisibleElements() {
|
6902
|
-
var
|
7005
|
+
var _this7 = this;
|
6903
7006
|
|
6904
|
-
var dataset = this.getDataset();
|
6905
7007
|
var meta = this._cachedMeta;
|
6906
7008
|
var count = 0;
|
6907
7009
|
meta.data.forEach(function (element, index) {
|
6908
|
-
if (!isNaN(
|
7010
|
+
if (!isNaN(_this7.getParsed(index).r) && _this7.chart.getDataVisibility(index)) {
|
6909
7011
|
count++;
|
6910
7012
|
}
|
6911
7013
|
});
|
@@ -7010,7 +7112,7 @@
|
|
7010
7112
|
return _super6.apply(this, arguments);
|
7011
7113
|
}
|
7012
7114
|
|
7013
|
-
return PieController;
|
7115
|
+
return _createClass(PieController);
|
7014
7116
|
}(DoughnutController);
|
7015
7117
|
|
7016
7118
|
PieController.id = 'pie';
|
@@ -7042,6 +7144,11 @@
|
|
7042
7144
|
value: '' + vScale.getLabelForValue(parsed[vScale.axis])
|
7043
7145
|
};
|
7044
7146
|
}
|
7147
|
+
}, {
|
7148
|
+
key: "parseObjectData",
|
7149
|
+
value: function parseObjectData(meta, data, start, count) {
|
7150
|
+
return _parseObjectDataRadialScale.bind(this)(meta, data, start, count);
|
7151
|
+
}
|
7045
7152
|
}, {
|
7046
7153
|
key: "update",
|
7047
7154
|
value: function update(mode) {
|
@@ -7071,14 +7178,13 @@
|
|
7071
7178
|
}, {
|
7072
7179
|
key: "updateElements",
|
7073
7180
|
value: function updateElements(points, start, count, mode) {
|
7074
|
-
var dataset = this.getDataset();
|
7075
7181
|
var scale = this._cachedMeta.rScale;
|
7076
7182
|
var reset = mode === 'reset';
|
7077
7183
|
|
7078
7184
|
for (var i = start; i < start + count; i++) {
|
7079
7185
|
var point = points[i];
|
7080
7186
|
var options = this.resolveDataElementOptions(i, point.active ? 'active' : mode);
|
7081
|
-
var pointPosition = scale.getPointPositionForValue(i,
|
7187
|
+
var pointPosition = scale.getPointPositionForValue(i, this.getParsed(i).r);
|
7082
7188
|
var x = reset ? scale.xCenter : pointPosition.x;
|
7083
7189
|
var y = reset ? scale.yCenter : pointPosition.y;
|
7084
7190
|
var properties = {
|
@@ -7128,7 +7234,7 @@
|
|
7128
7234
|
return _super8.apply(this, arguments);
|
7129
7235
|
}
|
7130
7236
|
|
7131
|
-
return ScatterController;
|
7237
|
+
return _createClass(ScatterController);
|
7132
7238
|
}(LineController);
|
7133
7239
|
|
7134
7240
|
ScatterController.id = 'scatter';
|
@@ -7232,36 +7338,6 @@
|
|
7232
7338
|
_date: DateAdapter
|
7233
7339
|
};
|
7234
7340
|
|
7235
|
-
function getRelativePosition(e, chart) {
|
7236
|
-
if ('native' in e) {
|
7237
|
-
return {
|
7238
|
-
x: e.x,
|
7239
|
-
y: e.y
|
7240
|
-
};
|
7241
|
-
}
|
7242
|
-
|
7243
|
-
return getRelativePosition$1(e, chart);
|
7244
|
-
}
|
7245
|
-
|
7246
|
-
function evaluateAllVisibleItems(chart, handler) {
|
7247
|
-
var metasets = chart.getSortedVisibleDatasetMetas();
|
7248
|
-
var index, data, element;
|
7249
|
-
|
7250
|
-
for (var i = 0, ilen = metasets.length; i < ilen; ++i) {
|
7251
|
-
var _metasets$i = metasets[i];
|
7252
|
-
index = _metasets$i.index;
|
7253
|
-
data = _metasets$i.data;
|
7254
|
-
|
7255
|
-
for (var j = 0, jlen = data.length; j < jlen; ++j) {
|
7256
|
-
element = data[j];
|
7257
|
-
|
7258
|
-
if (!element.skip) {
|
7259
|
-
handler(element, index, j);
|
7260
|
-
}
|
7261
|
-
}
|
7262
|
-
}
|
7263
|
-
}
|
7264
|
-
|
7265
7341
|
function binarySearch(metaset, axis, value, intersect) {
|
7266
7342
|
var controller = metaset.controller,
|
7267
7343
|
data = metaset.data,
|
@@ -7294,14 +7370,14 @@
|
|
7294
7370
|
};
|
7295
7371
|
}
|
7296
7372
|
|
7297
|
-
function
|
7373
|
+
function evaluateInteractionItems(chart, axis, position, handler, intersect) {
|
7298
7374
|
var metasets = chart.getSortedVisibleDatasetMetas();
|
7299
7375
|
var value = position[axis];
|
7300
7376
|
|
7301
7377
|
for (var i = 0, ilen = metasets.length; i < ilen; ++i) {
|
7302
|
-
var _metasets$
|
7303
|
-
|
7304
|
-
data = _metasets$
|
7378
|
+
var _metasets$i = metasets[i],
|
7379
|
+
_index2 = _metasets$i.index,
|
7380
|
+
data = _metasets$i.data;
|
7305
7381
|
|
7306
7382
|
var _binarySearch = binarySearch(metasets[i], axis, value, intersect),
|
7307
7383
|
lo = _binarySearch.lo,
|
@@ -7311,7 +7387,7 @@
|
|
7311
7387
|
var element = data[j];
|
7312
7388
|
|
7313
7389
|
if (!element.skip) {
|
7314
|
-
handler(element,
|
7390
|
+
handler(element, _index2, j);
|
7315
7391
|
}
|
7316
7392
|
}
|
7317
7393
|
}
|
@@ -7327,14 +7403,18 @@
|
|
7327
7403
|
};
|
7328
7404
|
}
|
7329
7405
|
|
7330
|
-
function getIntersectItems(chart, position, axis, useFinalPosition) {
|
7406
|
+
function getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) {
|
7331
7407
|
var items = [];
|
7332
7408
|
|
7333
|
-
if (!
|
7409
|
+
if (!includeInvisible && !chart.isPointInArea(position)) {
|
7334
7410
|
return items;
|
7335
7411
|
}
|
7336
7412
|
|
7337
7413
|
var evaluationFunc = function evaluationFunc(element, datasetIndex, index) {
|
7414
|
+
if (!includeInvisible && !_isPointInArea(element, chart.chartArea, 0)) {
|
7415
|
+
return;
|
7416
|
+
}
|
7417
|
+
|
7338
7418
|
if (element.inRange(position.x, position.y, useFinalPosition)) {
|
7339
7419
|
items.push({
|
7340
7420
|
element: element,
|
@@ -7344,7 +7424,7 @@
|
|
7344
7424
|
}
|
7345
7425
|
};
|
7346
7426
|
|
7347
|
-
|
7427
|
+
evaluateInteractionItems(chart, axis, position, evaluationFunc, true);
|
7348
7428
|
return items;
|
7349
7429
|
}
|
7350
7430
|
|
@@ -7371,11 +7451,11 @@
|
|
7371
7451
|
}
|
7372
7452
|
}
|
7373
7453
|
|
7374
|
-
|
7454
|
+
evaluateInteractionItems(chart, axis, position, evaluationFunc);
|
7375
7455
|
return items;
|
7376
7456
|
}
|
7377
7457
|
|
7378
|
-
function getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition) {
|
7458
|
+
function getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {
|
7379
7459
|
var items = [];
|
7380
7460
|
var distanceMetric = getDistanceMetricForAxis(axis);
|
7381
7461
|
var minDistance = Number.POSITIVE_INFINITY;
|
@@ -7388,8 +7468,7 @@
|
|
7388
7468
|
}
|
7389
7469
|
|
7390
7470
|
var center = element.getCenterPoint(useFinalPosition);
|
7391
|
-
|
7392
|
-
var pointInArea = _isPointInArea(center, chart.chartArea, chart._minPadding);
|
7471
|
+
var pointInArea = !!includeInvisible || chart.isPointInArea(center);
|
7393
7472
|
|
7394
7473
|
if (!pointInArea && !inRange) {
|
7395
7474
|
return;
|
@@ -7413,39 +7492,34 @@
|
|
7413
7492
|
}
|
7414
7493
|
}
|
7415
7494
|
|
7416
|
-
|
7495
|
+
evaluateInteractionItems(chart, axis, position, evaluationFunc);
|
7417
7496
|
return items;
|
7418
7497
|
}
|
7419
7498
|
|
7420
|
-
function getNearestItems(chart, position, axis, intersect, useFinalPosition) {
|
7421
|
-
if (!
|
7499
|
+
function getNearestItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {
|
7500
|
+
if (!includeInvisible && !chart.isPointInArea(position)) {
|
7422
7501
|
return [];
|
7423
7502
|
}
|
7424
7503
|
|
7425
|
-
return axis === 'r' && !intersect ? getNearestRadialItems(chart, position, axis, useFinalPosition) : getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition);
|
7504
|
+
return axis === 'r' && !intersect ? getNearestRadialItems(chart, position, axis, useFinalPosition) : getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible);
|
7426
7505
|
}
|
7427
7506
|
|
7428
|
-
function getAxisItems(chart,
|
7429
|
-
var position = getRelativePosition(e, chart);
|
7507
|
+
function getAxisItems(chart, position, axis, intersect, useFinalPosition) {
|
7430
7508
|
var items = [];
|
7431
|
-
var axis = options.axis;
|
7432
7509
|
var rangeMethod = axis === 'x' ? 'inXRange' : 'inYRange';
|
7433
7510
|
var intersectsItem = false;
|
7434
|
-
|
7511
|
+
evaluateInteractionItems(chart, axis, position, function (element, datasetIndex, index) {
|
7435
7512
|
if (element[rangeMethod](position[axis], useFinalPosition)) {
|
7436
7513
|
items.push({
|
7437
7514
|
element: element,
|
7438
7515
|
datasetIndex: datasetIndex,
|
7439
7516
|
index: index
|
7440
7517
|
});
|
7518
|
+
intersectsItem = intersectsItem || element.inRange(position.x, position.y, useFinalPosition);
|
7441
7519
|
}
|
7520
|
+
});
|
7442
7521
|
|
7443
|
-
|
7444
|
-
intersectsItem = true;
|
7445
|
-
}
|
7446
|
-
});
|
7447
|
-
|
7448
|
-
if (options.intersect && !intersectsItem) {
|
7522
|
+
if (intersect && !intersectsItem) {
|
7449
7523
|
return [];
|
7450
7524
|
}
|
7451
7525
|
|
@@ -7453,11 +7527,13 @@
|
|
7453
7527
|
}
|
7454
7528
|
|
7455
7529
|
var Interaction = {
|
7530
|
+
evaluateInteractionItems: evaluateInteractionItems,
|
7456
7531
|
modes: {
|
7457
7532
|
index: function index(chart, e, options, useFinalPosition) {
|
7458
7533
|
var position = getRelativePosition(e, chart);
|
7459
7534
|
var axis = options.axis || 'x';
|
7460
|
-
var
|
7535
|
+
var includeInvisible = options.includeInvisible || false;
|
7536
|
+
var items = options.intersect ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) : getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible);
|
7461
7537
|
var elements = [];
|
7462
7538
|
|
7463
7539
|
if (!items.length) {
|
@@ -7481,7 +7557,8 @@
|
|
7481
7557
|
dataset: function dataset(chart, e, options, useFinalPosition) {
|
7482
7558
|
var position = getRelativePosition(e, chart);
|
7483
7559
|
var axis = options.axis || 'xy';
|
7484
|
-
var
|
7560
|
+
var includeInvisible = options.includeInvisible || false;
|
7561
|
+
var items = options.intersect ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) : getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible);
|
7485
7562
|
|
7486
7563
|
if (items.length > 0) {
|
7487
7564
|
var datasetIndex = items[0].datasetIndex;
|
@@ -7502,24 +7579,22 @@
|
|
7502
7579
|
point: function point(chart, e, options, useFinalPosition) {
|
7503
7580
|
var position = getRelativePosition(e, chart);
|
7504
7581
|
var axis = options.axis || 'xy';
|
7505
|
-
|
7582
|
+
var includeInvisible = options.includeInvisible || false;
|
7583
|
+
return getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible);
|
7506
7584
|
},
|
7507
7585
|
nearest: function nearest(chart, e, options, useFinalPosition) {
|
7508
7586
|
var position = getRelativePosition(e, chart);
|
7509
7587
|
var axis = options.axis || 'xy';
|
7510
|
-
|
7588
|
+
var includeInvisible = options.includeInvisible || false;
|
7589
|
+
return getNearestItems(chart, position, axis, options.intersect, useFinalPosition, includeInvisible);
|
7511
7590
|
},
|
7512
7591
|
x: function x(chart, e, options, useFinalPosition) {
|
7513
|
-
|
7514
|
-
|
7515
|
-
intersect: options.intersect
|
7516
|
-
}, useFinalPosition);
|
7592
|
+
var position = getRelativePosition(e, chart);
|
7593
|
+
return getAxisItems(chart, position, 'x', options.intersect, useFinalPosition);
|
7517
7594
|
},
|
7518
7595
|
y: function y(chart, e, options, useFinalPosition) {
|
7519
|
-
|
7520
|
-
|
7521
|
-
intersect: options.intersect
|
7522
|
-
}, useFinalPosition);
|
7596
|
+
var position = getRelativePosition(e, chart);
|
7597
|
+
return getAxisItems(chart, position, 'y', options.intersect, useFinalPosition);
|
7523
7598
|
}
|
7524
7599
|
}
|
7525
7600
|
};
|
@@ -8093,9 +8168,9 @@
|
|
8093
8168
|
function fromNativeEvent(event, chart) {
|
8094
8169
|
var type = EVENT_TYPES[event.type] || event.type;
|
8095
8170
|
|
8096
|
-
var _getRelativePosition
|
8097
|
-
x = _getRelativePosition
|
8098
|
-
y = _getRelativePosition
|
8171
|
+
var _getRelativePosition = getRelativePosition(event, chart),
|
8172
|
+
x = _getRelativePosition.x,
|
8173
|
+
y = _getRelativePosition.y;
|
8099
8174
|
|
8100
8175
|
return {
|
8101
8176
|
type: type,
|
@@ -8421,7 +8496,7 @@
|
|
8421
8496
|
}, {
|
8422
8497
|
key: "getProps",
|
8423
8498
|
value: function getProps(props, final) {
|
8424
|
-
var
|
8499
|
+
var _this8 = this;
|
8425
8500
|
|
8426
8501
|
var anims = this.$animations;
|
8427
8502
|
|
@@ -8431,7 +8506,7 @@
|
|
8431
8506
|
|
8432
8507
|
var ret = {};
|
8433
8508
|
props.forEach(function (prop) {
|
8434
|
-
ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to :
|
8509
|
+
ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : _this8[prop];
|
8435
8510
|
});
|
8436
8511
|
return ret;
|
8437
8512
|
}
|
@@ -8442,7 +8517,7 @@
|
|
8442
8517
|
|
8443
8518
|
Element.defaults = {};
|
8444
8519
|
Element.defaultRoutes = undefined;
|
8445
|
-
var formatters$
|
8520
|
+
var formatters$4 = {
|
8446
8521
|
values: function values(value) {
|
8447
8522
|
return isArray(value) ? value : '' + value;
|
8448
8523
|
},
|
@@ -8483,7 +8558,7 @@
|
|
8483
8558
|
var remain = tickValue / Math.pow(10, Math.floor(log10(tickValue)));
|
8484
8559
|
|
8485
8560
|
if (remain === 1 || remain === 2 || remain === 5) {
|
8486
|
-
return formatters$
|
8561
|
+
return formatters$4.numeric.call(this, tickValue, index, ticks);
|
8487
8562
|
}
|
8488
8563
|
|
8489
8564
|
return '';
|
@@ -8501,7 +8576,7 @@
|
|
8501
8576
|
}
|
8502
8577
|
|
8503
8578
|
var Ticks = {
|
8504
|
-
formatters: formatters$
|
8579
|
+
formatters: formatters$4
|
8505
8580
|
};
|
8506
8581
|
defaults.set('scale', {
|
8507
8582
|
display: true,
|
@@ -8880,59 +8955,59 @@
|
|
8880
8955
|
var _super11 = _createSuper(Scale);
|
8881
8956
|
|
8882
8957
|
function Scale(cfg) {
|
8883
|
-
var
|
8958
|
+
var _this9;
|
8884
8959
|
|
8885
8960
|
_classCallCheck(this, Scale);
|
8886
8961
|
|
8887
|
-
|
8888
|
-
|
8889
|
-
|
8890
|
-
|
8891
|
-
|
8892
|
-
|
8893
|
-
|
8894
|
-
|
8895
|
-
|
8896
|
-
|
8897
|
-
|
8898
|
-
|
8899
|
-
|
8962
|
+
_this9 = _super11.call(this);
|
8963
|
+
_this9.id = cfg.id;
|
8964
|
+
_this9.type = cfg.type;
|
8965
|
+
_this9.options = undefined;
|
8966
|
+
_this9.ctx = cfg.ctx;
|
8967
|
+
_this9.chart = cfg.chart;
|
8968
|
+
_this9.top = undefined;
|
8969
|
+
_this9.bottom = undefined;
|
8970
|
+
_this9.left = undefined;
|
8971
|
+
_this9.right = undefined;
|
8972
|
+
_this9.width = undefined;
|
8973
|
+
_this9.height = undefined;
|
8974
|
+
_this9._margins = {
|
8900
8975
|
left: 0,
|
8901
8976
|
right: 0,
|
8902
8977
|
top: 0,
|
8903
8978
|
bottom: 0
|
8904
8979
|
};
|
8905
|
-
|
8906
|
-
|
8907
|
-
|
8908
|
-
|
8909
|
-
|
8910
|
-
|
8911
|
-
|
8912
|
-
|
8913
|
-
|
8914
|
-
|
8915
|
-
|
8916
|
-
|
8917
|
-
|
8918
|
-
|
8919
|
-
|
8920
|
-
|
8921
|
-
|
8922
|
-
|
8923
|
-
|
8924
|
-
|
8925
|
-
|
8926
|
-
|
8927
|
-
|
8928
|
-
|
8929
|
-
|
8930
|
-
|
8931
|
-
|
8932
|
-
|
8933
|
-
|
8934
|
-
|
8935
|
-
return
|
8980
|
+
_this9.maxWidth = undefined;
|
8981
|
+
_this9.maxHeight = undefined;
|
8982
|
+
_this9.paddingTop = undefined;
|
8983
|
+
_this9.paddingBottom = undefined;
|
8984
|
+
_this9.paddingLeft = undefined;
|
8985
|
+
_this9.paddingRight = undefined;
|
8986
|
+
_this9.axis = undefined;
|
8987
|
+
_this9.labelRotation = undefined;
|
8988
|
+
_this9.min = undefined;
|
8989
|
+
_this9.max = undefined;
|
8990
|
+
_this9._range = undefined;
|
8991
|
+
_this9.ticks = [];
|
8992
|
+
_this9._gridLineItems = null;
|
8993
|
+
_this9._labelItems = null;
|
8994
|
+
_this9._labelSizes = null;
|
8995
|
+
_this9._length = 0;
|
8996
|
+
_this9._maxLength = 0;
|
8997
|
+
_this9._longestTextCache = {};
|
8998
|
+
_this9._startPixel = undefined;
|
8999
|
+
_this9._endPixel = undefined;
|
9000
|
+
_this9._reversePixels = false;
|
9001
|
+
_this9._userMax = undefined;
|
9002
|
+
_this9._userMin = undefined;
|
9003
|
+
_this9._suggestedMax = undefined;
|
9004
|
+
_this9._suggestedMin = undefined;
|
9005
|
+
_this9._ticksLength = 0;
|
9006
|
+
_this9._borderValue = 0;
|
9007
|
+
_this9._cache = {};
|
9008
|
+
_this9._dataLimitsCached = false;
|
9009
|
+
_this9.$context = undefined;
|
9010
|
+
return _this9;
|
8936
9011
|
}
|
8937
9012
|
|
8938
9013
|
_createClass(Scale, [{
|
@@ -9088,6 +9163,7 @@
|
|
9088
9163
|
if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto')) {
|
9089
9164
|
this.ticks = autoSkip(this, this.ticks);
|
9090
9165
|
this._labelSizes = null;
|
9166
|
+
this.afterAutoSkip();
|
9091
9167
|
}
|
9092
9168
|
|
9093
9169
|
if (samplingEnabled) {
|
@@ -9253,6 +9329,9 @@
|
|
9253
9329
|
value: function afterCalculateLabelRotation() {
|
9254
9330
|
callback(this.options.afterCalculateLabelRotation, [this]);
|
9255
9331
|
}
|
9332
|
+
}, {
|
9333
|
+
key: "afterAutoSkip",
|
9334
|
+
value: function afterAutoSkip() {}
|
9256
9335
|
}, {
|
9257
9336
|
key: "beforeFit",
|
9258
9337
|
value: function beforeFit() {
|
@@ -9349,7 +9428,7 @@
|
|
9349
9428
|
paddingRight = last.width;
|
9350
9429
|
} else if (align === 'end') {
|
9351
9430
|
paddingLeft = first.width;
|
9352
|
-
} else {
|
9431
|
+
} else if (align !== 'inner') {
|
9353
9432
|
paddingLeft = first.width / 2;
|
9354
9433
|
paddingRight = last.width / 2;
|
9355
9434
|
}
|
@@ -9796,10 +9875,21 @@
|
|
9796
9875
|
var color = optsAtIndex.color;
|
9797
9876
|
var strokeColor = optsAtIndex.textStrokeColor;
|
9798
9877
|
var strokeWidth = optsAtIndex.textStrokeWidth;
|
9878
|
+
var tickTextAlign = textAlign;
|
9799
9879
|
|
9800
9880
|
if (isHorizontal) {
|
9801
9881
|
x = pixel;
|
9802
9882
|
|
9883
|
+
if (textAlign === 'inner') {
|
9884
|
+
if (i === ilen - 1) {
|
9885
|
+
tickTextAlign = !this.options.reverse ? 'right' : 'left';
|
9886
|
+
} else if (i === 0) {
|
9887
|
+
tickTextAlign = !this.options.reverse ? 'left' : 'right';
|
9888
|
+
} else {
|
9889
|
+
tickTextAlign = 'center';
|
9890
|
+
}
|
9891
|
+
}
|
9892
|
+
|
9803
9893
|
if (position === 'top') {
|
9804
9894
|
if (crossAlign === 'near' || rotation !== 0) {
|
9805
9895
|
textOffset = -lineCount * lineHeight + lineHeight / 2;
|
@@ -9872,7 +9962,7 @@
|
|
9872
9962
|
strokeColor: strokeColor,
|
9873
9963
|
strokeWidth: strokeWidth,
|
9874
9964
|
textOffset: textOffset,
|
9875
|
-
textAlign:
|
9965
|
+
textAlign: tickTextAlign,
|
9876
9966
|
textBaseline: textBaseline,
|
9877
9967
|
translation: [x, y],
|
9878
9968
|
backdrop: backdrop
|
@@ -9899,6 +9989,8 @@
|
|
9899
9989
|
align = 'left';
|
9900
9990
|
} else if (ticks.align === 'end') {
|
9901
9991
|
align = 'right';
|
9992
|
+
} else if (ticks.align === 'inner') {
|
9993
|
+
align = 'inner';
|
9902
9994
|
}
|
9903
9995
|
|
9904
9996
|
return align;
|
@@ -10239,7 +10331,7 @@
|
|
10239
10331
|
}, {
|
10240
10332
|
key: "_layers",
|
10241
10333
|
value: function _layers() {
|
10242
|
-
var
|
10334
|
+
var _this10 = this;
|
10243
10335
|
|
10244
10336
|
var opts = this.options;
|
10245
10337
|
var tz = opts.ticks && opts.ticks.z || 0;
|
@@ -10249,7 +10341,7 @@
|
|
10249
10341
|
return [{
|
10250
10342
|
z: tz,
|
10251
10343
|
draw: function draw(chartArea) {
|
10252
|
-
|
10344
|
+
_this10.draw(chartArea);
|
10253
10345
|
}
|
10254
10346
|
}];
|
10255
10347
|
}
|
@@ -10257,21 +10349,21 @@
|
|
10257
10349
|
return [{
|
10258
10350
|
z: gz,
|
10259
10351
|
draw: function draw(chartArea) {
|
10260
|
-
|
10352
|
+
_this10.drawBackground();
|
10261
10353
|
|
10262
|
-
|
10354
|
+
_this10.drawGrid(chartArea);
|
10263
10355
|
|
10264
|
-
|
10356
|
+
_this10.drawTitle();
|
10265
10357
|
}
|
10266
10358
|
}, {
|
10267
10359
|
z: gz + 1,
|
10268
10360
|
draw: function draw() {
|
10269
|
-
|
10361
|
+
_this10.drawBorder();
|
10270
10362
|
}
|
10271
10363
|
}, {
|
10272
10364
|
z: tz,
|
10273
10365
|
draw: function draw(chartArea) {
|
10274
|
-
|
10366
|
+
_this10.drawLabels(chartArea);
|
10275
10367
|
}
|
10276
10368
|
}];
|
10277
10369
|
}
|
@@ -10539,18 +10631,18 @@
|
|
10539
10631
|
}, {
|
10540
10632
|
key: "_each",
|
10541
10633
|
value: function _each(method, args, typedRegistry) {
|
10542
|
-
var
|
10634
|
+
var _this11 = this;
|
10543
10635
|
|
10544
10636
|
_toConsumableArray(args).forEach(function (arg) {
|
10545
|
-
var reg = typedRegistry ||
|
10637
|
+
var reg = typedRegistry || _this11._getRegistryForType(arg);
|
10546
10638
|
|
10547
|
-
if (typedRegistry || reg.isForType(arg) || reg ===
|
10548
|
-
|
10639
|
+
if (typedRegistry || reg.isForType(arg) || reg === _this11.plugins && arg.id) {
|
10640
|
+
_this11._exec(method, reg, arg);
|
10549
10641
|
} else {
|
10550
10642
|
each(arg, function (item) {
|
10551
|
-
var itemReg = typedRegistry ||
|
10643
|
+
var itemReg = typedRegistry || _this11._getRegistryForType(item);
|
10552
10644
|
|
10553
|
-
|
10645
|
+
_this11._exec(method, itemReg, item);
|
10554
10646
|
});
|
10555
10647
|
}
|
10556
10648
|
});
|
@@ -11170,7 +11262,7 @@
|
|
11170
11262
|
return false;
|
11171
11263
|
}
|
11172
11264
|
|
11173
|
-
var version = "3.
|
11265
|
+
var version = "3.8.0";
|
11174
11266
|
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
11175
11267
|
|
11176
11268
|
function positionIsHorizontal(position, axis) {
|
@@ -11251,7 +11343,7 @@
|
|
11251
11343
|
|
11252
11344
|
var Chart = /*#__PURE__*/function () {
|
11253
11345
|
function Chart(item, userConfig) {
|
11254
|
-
var
|
11346
|
+
var _this12 = this;
|
11255
11347
|
|
11256
11348
|
_classCallCheck(this, Chart);
|
11257
11349
|
|
@@ -11296,7 +11388,7 @@
|
|
11296
11388
|
this._animationsDisabled = undefined;
|
11297
11389
|
this.$context = undefined;
|
11298
11390
|
this._doResize = debounce(function (mode) {
|
11299
|
-
return
|
11391
|
+
return _this12.update(mode);
|
11300
11392
|
}, options.resizeDelay || 0);
|
11301
11393
|
this._dataChanges = [];
|
11302
11394
|
instances[this.id] = this;
|
@@ -11431,7 +11523,7 @@
|
|
11431
11523
|
}, {
|
11432
11524
|
key: "buildOrUpdateScales",
|
11433
11525
|
value: function buildOrUpdateScales() {
|
11434
|
-
var
|
11526
|
+
var _this13 = this;
|
11435
11527
|
|
11436
11528
|
var options = this.options;
|
11437
11529
|
var scaleOpts = options.scales;
|
@@ -11476,8 +11568,8 @@
|
|
11476
11568
|
scale = new scaleClass({
|
11477
11569
|
id: id,
|
11478
11570
|
type: scaleType,
|
11479
|
-
ctx:
|
11480
|
-
chart:
|
11571
|
+
ctx: _this13.ctx,
|
11572
|
+
chart: _this13
|
11481
11573
|
});
|
11482
11574
|
scales[scale.id] = scale;
|
11483
11575
|
}
|
@@ -11490,8 +11582,8 @@
|
|
11490
11582
|
}
|
11491
11583
|
});
|
11492
11584
|
each(scales, function (scale) {
|
11493
|
-
layouts.configure(
|
11494
|
-
layouts.addBox(
|
11585
|
+
layouts.configure(_this13, scale, scale.options);
|
11586
|
+
layouts.addBox(_this13, scale);
|
11495
11587
|
});
|
11496
11588
|
}
|
11497
11589
|
}, {
|
@@ -11517,7 +11609,7 @@
|
|
11517
11609
|
}, {
|
11518
11610
|
key: "_removeUnreferencedMetasets",
|
11519
11611
|
value: function _removeUnreferencedMetasets() {
|
11520
|
-
var
|
11612
|
+
var _this14 = this;
|
11521
11613
|
|
11522
11614
|
var metasets = this._metasets,
|
11523
11615
|
datasets = this.data.datasets;
|
@@ -11530,7 +11622,7 @@
|
|
11530
11622
|
if (datasets.filter(function (x) {
|
11531
11623
|
return x === meta._dataset;
|
11532
11624
|
}).length === 0) {
|
11533
|
-
|
11625
|
+
_this14._destroyDatasetMeta(index);
|
11534
11626
|
}
|
11535
11627
|
});
|
11536
11628
|
}
|
@@ -11585,10 +11677,10 @@
|
|
11585
11677
|
}, {
|
11586
11678
|
key: "_resetElements",
|
11587
11679
|
value: function _resetElements() {
|
11588
|
-
var
|
11680
|
+
var _this15 = this;
|
11589
11681
|
|
11590
11682
|
each(this.data.datasets, function (dataset, datasetIndex) {
|
11591
|
-
|
11683
|
+
_this15.getDatasetMeta(datasetIndex).controller.reset();
|
11592
11684
|
}, this);
|
11593
11685
|
}
|
11594
11686
|
}, {
|
@@ -11666,10 +11758,10 @@
|
|
11666
11758
|
}, {
|
11667
11759
|
key: "_updateScales",
|
11668
11760
|
value: function _updateScales() {
|
11669
|
-
var
|
11761
|
+
var _this16 = this;
|
11670
11762
|
|
11671
11763
|
each(this.scales, function (scale) {
|
11672
|
-
layouts.removeBox(
|
11764
|
+
layouts.removeBox(_this16, scale);
|
11673
11765
|
});
|
11674
11766
|
this.ensureScalesHaveIDs();
|
11675
11767
|
this.buildOrUpdateScales();
|
@@ -11751,7 +11843,7 @@
|
|
11751
11843
|
}, {
|
11752
11844
|
key: "_updateLayout",
|
11753
11845
|
value: function _updateLayout(minPadding) {
|
11754
|
-
var
|
11846
|
+
var _this17 = this;
|
11755
11847
|
|
11756
11848
|
if (this.notifyPlugins('beforeLayout', {
|
11757
11849
|
cancelable: true
|
@@ -11764,7 +11856,7 @@
|
|
11764
11856
|
var noArea = area.width <= 0 || area.height <= 0;
|
11765
11857
|
this._layers = [];
|
11766
11858
|
each(this.boxes, function (box) {
|
11767
|
-
var
|
11859
|
+
var _this17$_layers;
|
11768
11860
|
|
11769
11861
|
if (noArea && box.position === 'chartArea') {
|
11770
11862
|
return;
|
@@ -11774,7 +11866,7 @@
|
|
11774
11866
|
box.configure();
|
11775
11867
|
}
|
11776
11868
|
|
11777
|
-
(
|
11869
|
+
(_this17$_layers = _this17._layers).push.apply(_this17$_layers, _toConsumableArray(box._layers()));
|
11778
11870
|
}, this);
|
11779
11871
|
|
11780
11872
|
this._layers.forEach(function (item, index) {
|
@@ -11962,6 +12054,11 @@
|
|
11962
12054
|
args.cancelable = false;
|
11963
12055
|
this.notifyPlugins('afterDatasetDraw', args);
|
11964
12056
|
}
|
12057
|
+
}, {
|
12058
|
+
key: "isPointInArea",
|
12059
|
+
value: function isPointInArea(point) {
|
12060
|
+
return _isPointInArea(point, this.chartArea, this._minPadding);
|
12061
|
+
}
|
11965
12062
|
}, {
|
11966
12063
|
key: "getElementsAtEventForMode",
|
11967
12064
|
value: function getElementsAtEventForMode(e, mode, options, useFinalPosition) {
|
@@ -12140,13 +12237,13 @@
|
|
12140
12237
|
}, {
|
12141
12238
|
key: "bindUserEvents",
|
12142
12239
|
value: function bindUserEvents() {
|
12143
|
-
var
|
12240
|
+
var _this18 = this;
|
12144
12241
|
|
12145
12242
|
var listeners = this._listeners;
|
12146
12243
|
var platform = this.platform;
|
12147
12244
|
|
12148
12245
|
var _add = function _add(type, listener) {
|
12149
|
-
platform.addEventListener(
|
12246
|
+
platform.addEventListener(_this18, type, listener);
|
12150
12247
|
listeners[type] = listener;
|
12151
12248
|
};
|
12152
12249
|
|
@@ -12154,7 +12251,7 @@
|
|
12154
12251
|
e.offsetX = x;
|
12155
12252
|
e.offsetY = y;
|
12156
12253
|
|
12157
|
-
|
12254
|
+
_this18._eventHandler(e);
|
12158
12255
|
};
|
12159
12256
|
|
12160
12257
|
each(this.options.events, function (type) {
|
@@ -12164,7 +12261,7 @@
|
|
12164
12261
|
}, {
|
12165
12262
|
key: "bindResponsiveEvents",
|
12166
12263
|
value: function bindResponsiveEvents() {
|
12167
|
-
var
|
12264
|
+
var _this19 = this;
|
12168
12265
|
|
12169
12266
|
if (!this._responsiveListeners) {
|
12170
12267
|
this._responsiveListeners = {};
|
@@ -12174,20 +12271,20 @@
|
|
12174
12271
|
var platform = this.platform;
|
12175
12272
|
|
12176
12273
|
var _add = function _add(type, listener) {
|
12177
|
-
platform.addEventListener(
|
12274
|
+
platform.addEventListener(_this19, type, listener);
|
12178
12275
|
listeners[type] = listener;
|
12179
12276
|
};
|
12180
12277
|
|
12181
12278
|
var _remove = function _remove(type, listener) {
|
12182
12279
|
if (listeners[type]) {
|
12183
|
-
platform.removeEventListener(
|
12280
|
+
platform.removeEventListener(_this19, type, listener);
|
12184
12281
|
delete listeners[type];
|
12185
12282
|
}
|
12186
12283
|
};
|
12187
12284
|
|
12188
12285
|
var listener = function listener(width, height) {
|
12189
|
-
if (
|
12190
|
-
|
12286
|
+
if (_this19.canvas) {
|
12287
|
+
_this19.resize(width, height);
|
12191
12288
|
}
|
12192
12289
|
};
|
12193
12290
|
|
@@ -12196,9 +12293,9 @@
|
|
12196
12293
|
var attached = function attached() {
|
12197
12294
|
_remove('attach', attached);
|
12198
12295
|
|
12199
|
-
|
12296
|
+
_this19.attached = true;
|
12200
12297
|
|
12201
|
-
|
12298
|
+
_this19.resize();
|
12202
12299
|
|
12203
12300
|
_add('resize', listener);
|
12204
12301
|
|
@@ -12206,13 +12303,13 @@
|
|
12206
12303
|
};
|
12207
12304
|
|
12208
12305
|
detached = function detached() {
|
12209
|
-
|
12306
|
+
_this19.attached = false;
|
12210
12307
|
|
12211
12308
|
_remove('resize', listener);
|
12212
12309
|
|
12213
|
-
|
12310
|
+
_this19._stop();
|
12214
12311
|
|
12215
|
-
|
12312
|
+
_this19._resize(0, 0);
|
12216
12313
|
|
12217
12314
|
_add('attach', attached);
|
12218
12315
|
};
|
@@ -12226,14 +12323,14 @@
|
|
12226
12323
|
}, {
|
12227
12324
|
key: "unbindEvents",
|
12228
12325
|
value: function unbindEvents() {
|
12229
|
-
var
|
12326
|
+
var _this20 = this;
|
12230
12327
|
|
12231
12328
|
each(this._listeners, function (listener, type) {
|
12232
|
-
|
12329
|
+
_this20.platform.removeEventListener(_this20, type, listener);
|
12233
12330
|
});
|
12234
12331
|
this._listeners = {};
|
12235
12332
|
each(this._responsiveListeners, function (listener, type) {
|
12236
|
-
|
12333
|
+
_this20.platform.removeEventListener(_this20, type, listener);
|
12237
12334
|
});
|
12238
12335
|
this._responsiveListeners = undefined;
|
12239
12336
|
}
|
@@ -12265,14 +12362,14 @@
|
|
12265
12362
|
}, {
|
12266
12363
|
key: "setActiveElements",
|
12267
12364
|
value: function setActiveElements(activeElements) {
|
12268
|
-
var
|
12365
|
+
var _this21 = this;
|
12269
12366
|
|
12270
12367
|
var lastActive = this._active || [];
|
12271
12368
|
var active = activeElements.map(function (_ref2) {
|
12272
12369
|
var datasetIndex = _ref2.datasetIndex,
|
12273
12370
|
index = _ref2.index;
|
12274
12371
|
|
12275
|
-
var meta =
|
12372
|
+
var meta = _this21.getDatasetMeta(datasetIndex);
|
12276
12373
|
|
12277
12374
|
if (!meta) {
|
12278
12375
|
throw new Error('No dataset found at index ' + datasetIndex);
|
@@ -12325,17 +12422,17 @@
|
|
12325
12422
|
}, {
|
12326
12423
|
key: "_eventHandler",
|
12327
12424
|
value: function _eventHandler(e, replay) {
|
12328
|
-
var
|
12425
|
+
var _this22 = this;
|
12329
12426
|
|
12330
12427
|
var args = {
|
12331
12428
|
event: e,
|
12332
12429
|
replay: replay,
|
12333
12430
|
cancelable: true,
|
12334
|
-
inChartArea:
|
12431
|
+
inChartArea: this.isPointInArea(e)
|
12335
12432
|
};
|
12336
12433
|
|
12337
12434
|
var eventFilter = function eventFilter(plugin) {
|
12338
|
-
return (plugin.options.events ||
|
12435
|
+
return (plugin.options.events || _this22.options.events).includes(e.native.type);
|
12339
12436
|
};
|
12340
12437
|
|
12341
12438
|
if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {
|
@@ -12672,25 +12769,25 @@
|
|
12672
12769
|
var _super12 = _createSuper(ArcElement);
|
12673
12770
|
|
12674
12771
|
function ArcElement(cfg) {
|
12675
|
-
var
|
12772
|
+
var _this23;
|
12676
12773
|
|
12677
12774
|
_classCallCheck(this, ArcElement);
|
12678
12775
|
|
12679
|
-
|
12680
|
-
|
12681
|
-
|
12682
|
-
|
12683
|
-
|
12684
|
-
|
12685
|
-
|
12686
|
-
|
12687
|
-
|
12776
|
+
_this23 = _super12.call(this);
|
12777
|
+
_this23.options = undefined;
|
12778
|
+
_this23.circumference = undefined;
|
12779
|
+
_this23.startAngle = undefined;
|
12780
|
+
_this23.endAngle = undefined;
|
12781
|
+
_this23.innerRadius = undefined;
|
12782
|
+
_this23.outerRadius = undefined;
|
12783
|
+
_this23.pixelMargin = 0;
|
12784
|
+
_this23.fullCircles = 0;
|
12688
12785
|
|
12689
12786
|
if (cfg) {
|
12690
|
-
Object.assign(_assertThisInitialized(
|
12787
|
+
Object.assign(_assertThisInitialized(_this23), cfg);
|
12691
12788
|
}
|
12692
12789
|
|
12693
|
-
return
|
12790
|
+
return _this23;
|
12694
12791
|
}
|
12695
12792
|
|
12696
12793
|
_createClass(ArcElement, [{
|
@@ -13037,28 +13134,28 @@
|
|
13037
13134
|
var _super13 = _createSuper(LineElement);
|
13038
13135
|
|
13039
13136
|
function LineElement(cfg) {
|
13040
|
-
var
|
13137
|
+
var _this24;
|
13041
13138
|
|
13042
13139
|
_classCallCheck(this, LineElement);
|
13043
13140
|
|
13044
|
-
|
13045
|
-
|
13046
|
-
|
13047
|
-
|
13048
|
-
|
13049
|
-
|
13050
|
-
|
13051
|
-
|
13052
|
-
|
13053
|
-
|
13054
|
-
|
13055
|
-
|
13141
|
+
_this24 = _super13.call(this);
|
13142
|
+
_this24.animated = true;
|
13143
|
+
_this24.options = undefined;
|
13144
|
+
_this24._chart = undefined;
|
13145
|
+
_this24._loop = undefined;
|
13146
|
+
_this24._fullLoop = undefined;
|
13147
|
+
_this24._path = undefined;
|
13148
|
+
_this24._points = undefined;
|
13149
|
+
_this24._segments = undefined;
|
13150
|
+
_this24._decimated = false;
|
13151
|
+
_this24._pointsUpdated = false;
|
13152
|
+
_this24._datasetIndex = undefined;
|
13056
13153
|
|
13057
13154
|
if (cfg) {
|
13058
|
-
Object.assign(_assertThisInitialized(
|
13155
|
+
Object.assign(_assertThisInitialized(_this24), cfg);
|
13059
13156
|
}
|
13060
13157
|
|
13061
|
-
return
|
13158
|
+
return _this24;
|
13062
13159
|
}
|
13063
13160
|
|
13064
13161
|
_createClass(LineElement, [{
|
@@ -13251,21 +13348,21 @@
|
|
13251
13348
|
var _super14 = _createSuper(PointElement);
|
13252
13349
|
|
13253
13350
|
function PointElement(cfg) {
|
13254
|
-
var
|
13351
|
+
var _this25;
|
13255
13352
|
|
13256
13353
|
_classCallCheck(this, PointElement);
|
13257
13354
|
|
13258
|
-
|
13259
|
-
|
13260
|
-
|
13261
|
-
|
13262
|
-
|
13355
|
+
_this25 = _super14.call(this);
|
13356
|
+
_this25.options = undefined;
|
13357
|
+
_this25.parsed = undefined;
|
13358
|
+
_this25.skip = undefined;
|
13359
|
+
_this25.stop = undefined;
|
13263
13360
|
|
13264
13361
|
if (cfg) {
|
13265
|
-
Object.assign(_assertThisInitialized(
|
13362
|
+
Object.assign(_assertThisInitialized(_this25), cfg);
|
13266
13363
|
}
|
13267
13364
|
|
13268
|
-
return
|
13365
|
+
return _this25;
|
13269
13366
|
}
|
13270
13367
|
|
13271
13368
|
_createClass(PointElement, [{
|
@@ -13481,23 +13578,23 @@
|
|
13481
13578
|
var _super15 = _createSuper(BarElement);
|
13482
13579
|
|
13483
13580
|
function BarElement(cfg) {
|
13484
|
-
var
|
13581
|
+
var _this26;
|
13485
13582
|
|
13486
13583
|
_classCallCheck(this, BarElement);
|
13487
13584
|
|
13488
|
-
|
13489
|
-
|
13490
|
-
|
13491
|
-
|
13492
|
-
|
13493
|
-
|
13494
|
-
|
13585
|
+
_this26 = _super15.call(this);
|
13586
|
+
_this26.options = undefined;
|
13587
|
+
_this26.horizontal = undefined;
|
13588
|
+
_this26.base = undefined;
|
13589
|
+
_this26.width = undefined;
|
13590
|
+
_this26.height = undefined;
|
13591
|
+
_this26.inflateAmount = undefined;
|
13495
13592
|
|
13496
13593
|
if (cfg) {
|
13497
|
-
Object.assign(_assertThisInitialized(
|
13594
|
+
Object.assign(_assertThisInitialized(_this26), cfg);
|
13498
13595
|
}
|
13499
13596
|
|
13500
|
-
return
|
13597
|
+
return _this26;
|
13501
13598
|
}
|
13502
13599
|
|
13503
13600
|
_createClass(BarElement, [{
|
@@ -13773,7 +13870,7 @@
|
|
13773
13870
|
return;
|
13774
13871
|
}
|
13775
13872
|
|
13776
|
-
if (meta.
|
13873
|
+
if (!meta.controller.supportsDecimation) {
|
13777
13874
|
return;
|
13778
13875
|
}
|
13779
13876
|
|
@@ -13836,222 +13933,294 @@
|
|
13836
13933
|
}
|
13837
13934
|
};
|
13838
13935
|
|
13839
|
-
function
|
13840
|
-
var
|
13841
|
-
var
|
13842
|
-
|
13843
|
-
|
13936
|
+
function _segments(line, target, property) {
|
13937
|
+
var segments = line.segments;
|
13938
|
+
var points = line.points;
|
13939
|
+
var tpoints = target.points;
|
13940
|
+
var parts = [];
|
13844
13941
|
|
13845
|
-
|
13846
|
-
|
13847
|
-
var fillOption = options.fill;
|
13848
|
-
var fill = valueOrDefault(fillOption && fillOption.target, fillOption);
|
13942
|
+
var _iterator16 = _createForOfIteratorHelper(segments),
|
13943
|
+
_step16;
|
13849
13944
|
|
13850
|
-
|
13851
|
-
|
13852
|
-
|
13945
|
+
try {
|
13946
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
13947
|
+
var segment = _step16.value;
|
13948
|
+
var start = segment.start,
|
13949
|
+
end = segment.end;
|
13950
|
+
end = _findSegmentEnd(start, end, points);
|
13853
13951
|
|
13854
|
-
|
13855
|
-
return false;
|
13856
|
-
}
|
13952
|
+
var bounds = _getBounds(property, points[start], points[end], segment.loop);
|
13857
13953
|
|
13858
|
-
|
13859
|
-
|
13860
|
-
|
13954
|
+
if (!target.segments) {
|
13955
|
+
parts.push({
|
13956
|
+
source: segment,
|
13957
|
+
target: bounds,
|
13958
|
+
start: points[start],
|
13959
|
+
end: points[end]
|
13960
|
+
});
|
13961
|
+
continue;
|
13962
|
+
}
|
13861
13963
|
|
13862
|
-
|
13863
|
-
}
|
13964
|
+
var targetSegments = _boundSegments(target, bounds);
|
13864
13965
|
|
13865
|
-
|
13866
|
-
|
13966
|
+
var _iterator17 = _createForOfIteratorHelper(targetSegments),
|
13967
|
+
_step17;
|
13867
13968
|
|
13868
|
-
|
13869
|
-
|
13870
|
-
|
13969
|
+
try {
|
13970
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
13971
|
+
var tgt = _step17.value;
|
13871
13972
|
|
13872
|
-
|
13973
|
+
var subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
13873
13974
|
|
13874
|
-
|
13875
|
-
if (fill[0] === '-' || fill[0] === '+') {
|
13876
|
-
target = index + target;
|
13877
|
-
}
|
13975
|
+
var fillSources = _boundSegment(segment, points, subBounds);
|
13878
13976
|
|
13879
|
-
|
13880
|
-
|
13881
|
-
}
|
13977
|
+
var _iterator18 = _createForOfIteratorHelper(fillSources),
|
13978
|
+
_step18;
|
13882
13979
|
|
13883
|
-
|
13980
|
+
try {
|
13981
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
13982
|
+
var fillSource = _step18.value;
|
13983
|
+
parts.push({
|
13984
|
+
source: fillSource,
|
13985
|
+
target: tgt,
|
13986
|
+
start: _defineProperty({}, property, _getEdge(bounds, subBounds, 'start', Math.max)),
|
13987
|
+
end: _defineProperty({}, property, _getEdge(bounds, subBounds, 'end', Math.min))
|
13988
|
+
});
|
13989
|
+
}
|
13990
|
+
} catch (err) {
|
13991
|
+
_iterator18.e(err);
|
13992
|
+
} finally {
|
13993
|
+
_iterator18.f();
|
13994
|
+
}
|
13995
|
+
}
|
13996
|
+
} catch (err) {
|
13997
|
+
_iterator17.e(err);
|
13998
|
+
} finally {
|
13999
|
+
_iterator17.f();
|
14000
|
+
}
|
14001
|
+
}
|
14002
|
+
} catch (err) {
|
14003
|
+
_iterator16.e(err);
|
14004
|
+
} finally {
|
14005
|
+
_iterator16.f();
|
13884
14006
|
}
|
13885
14007
|
|
13886
|
-
return
|
14008
|
+
return parts;
|
13887
14009
|
}
|
13888
14010
|
|
13889
|
-
function
|
13890
|
-
|
13891
|
-
|
13892
|
-
fill = source.fill;
|
13893
|
-
var target = null;
|
13894
|
-
var horizontal;
|
13895
|
-
|
13896
|
-
if (fill === 'start') {
|
13897
|
-
target = scale.bottom;
|
13898
|
-
} else if (fill === 'end') {
|
13899
|
-
target = scale.top;
|
13900
|
-
} else if (isObject(fill)) {
|
13901
|
-
target = scale.getPixelForValue(fill.value);
|
13902
|
-
} else if (scale.getBasePixel) {
|
13903
|
-
target = scale.getBasePixel();
|
14011
|
+
function _getBounds(property, first, last, loop) {
|
14012
|
+
if (loop) {
|
14013
|
+
return;
|
13904
14014
|
}
|
13905
14015
|
|
13906
|
-
|
13907
|
-
|
13908
|
-
|
13909
|
-
|
13910
|
-
|
13911
|
-
|
14016
|
+
var start = first[property];
|
14017
|
+
var end = last[property];
|
14018
|
+
|
14019
|
+
if (property === 'angle') {
|
14020
|
+
start = _normalizeAngle(start);
|
14021
|
+
end = _normalizeAngle(end);
|
13912
14022
|
}
|
13913
14023
|
|
13914
|
-
return
|
14024
|
+
return {
|
14025
|
+
property: property,
|
14026
|
+
start: start,
|
14027
|
+
end: end
|
14028
|
+
};
|
13915
14029
|
}
|
13916
14030
|
|
13917
|
-
|
13918
|
-
|
13919
|
-
|
14031
|
+
function _pointsFromSegments(boundary, line) {
|
14032
|
+
var _ref5 = boundary || {},
|
14033
|
+
_ref5$x = _ref5.x,
|
14034
|
+
x = _ref5$x === void 0 ? null : _ref5$x,
|
14035
|
+
_ref5$y = _ref5.y,
|
14036
|
+
y = _ref5$y === void 0 ? null : _ref5$y;
|
13920
14037
|
|
13921
|
-
|
13922
|
-
|
13923
|
-
|
13924
|
-
|
14038
|
+
var linePoints = line.points;
|
14039
|
+
var points = [];
|
14040
|
+
line.segments.forEach(function (_ref6) {
|
14041
|
+
var start = _ref6.start,
|
14042
|
+
end = _ref6.end;
|
14043
|
+
end = _findSegmentEnd(start, end, linePoints);
|
14044
|
+
var first = linePoints[start];
|
14045
|
+
var last = linePoints[end];
|
13925
14046
|
|
13926
|
-
|
13927
|
-
|
13928
|
-
|
13929
|
-
|
13930
|
-
|
13931
|
-
|
13932
|
-
|
13933
|
-
|
13934
|
-
|
13935
|
-
|
13936
|
-
|
13937
|
-
|
14047
|
+
if (y !== null) {
|
14048
|
+
points.push({
|
14049
|
+
x: first.x,
|
14050
|
+
y: y
|
14051
|
+
});
|
14052
|
+
points.push({
|
14053
|
+
x: last.x,
|
14054
|
+
y: y
|
14055
|
+
});
|
14056
|
+
} else if (x !== null) {
|
14057
|
+
points.push({
|
14058
|
+
x: x,
|
14059
|
+
y: first.y
|
14060
|
+
});
|
14061
|
+
points.push({
|
14062
|
+
x: x,
|
14063
|
+
y: last.y
|
14064
|
+
});
|
13938
14065
|
}
|
13939
|
-
}
|
13940
|
-
|
13941
|
-
|
13942
|
-
|
13943
|
-
|
13944
|
-
|
13945
|
-
|
13946
|
-
|
13947
|
-
|
13948
|
-
|
13949
|
-
angle: angle
|
13950
|
-
};
|
14066
|
+
});
|
14067
|
+
return points;
|
14068
|
+
}
|
14069
|
+
|
14070
|
+
function _findSegmentEnd(start, end, points) {
|
14071
|
+
for (; end > start; end--) {
|
14072
|
+
var point = points[end];
|
14073
|
+
|
14074
|
+
if (!isNaN(point.x) && !isNaN(point.y)) {
|
14075
|
+
break;
|
13951
14076
|
}
|
13952
|
-
}
|
14077
|
+
}
|
13953
14078
|
|
13954
|
-
return
|
13955
|
-
}
|
14079
|
+
return end;
|
14080
|
+
}
|
13956
14081
|
|
13957
|
-
function
|
13958
|
-
|
13959
|
-
|
13960
|
-
|
13961
|
-
var length = scale.getLabels().length;
|
13962
|
-
var target = [];
|
13963
|
-
var start = options.reverse ? scale.max : scale.min;
|
13964
|
-
var end = options.reverse ? scale.min : scale.max;
|
13965
|
-
var i, center, value;
|
14082
|
+
function _getEdge(a, b, prop, fn) {
|
14083
|
+
if (a && b) {
|
14084
|
+
return fn(a[prop], b[prop]);
|
14085
|
+
}
|
13966
14086
|
|
13967
|
-
|
13968
|
-
|
13969
|
-
|
13970
|
-
|
13971
|
-
|
13972
|
-
|
14087
|
+
return a ? a[prop] : b ? b[prop] : 0;
|
14088
|
+
}
|
14089
|
+
|
14090
|
+
function _createBoundaryLine(boundary, line) {
|
14091
|
+
var points = [];
|
14092
|
+
var _loop = false;
|
14093
|
+
|
14094
|
+
if (isArray(boundary)) {
|
14095
|
+
_loop = true;
|
14096
|
+
points = boundary;
|
13973
14097
|
} else {
|
13974
|
-
|
14098
|
+
points = _pointsFromSegments(boundary, line);
|
13975
14099
|
}
|
13976
14100
|
|
13977
|
-
|
13978
|
-
|
13979
|
-
|
13980
|
-
|
13981
|
-
|
13982
|
-
|
13983
|
-
|
14101
|
+
return points.length ? new LineElement({
|
14102
|
+
points: points,
|
14103
|
+
options: {
|
14104
|
+
tension: 0
|
14105
|
+
},
|
14106
|
+
_loop: _loop,
|
14107
|
+
_fullLoop: _loop
|
14108
|
+
}) : null;
|
14109
|
+
}
|
14110
|
+
|
14111
|
+
function _resolveTarget(sources, index, propagate) {
|
14112
|
+
var source = sources[index];
|
14113
|
+
var fill = source.fill;
|
14114
|
+
var visited = [index];
|
14115
|
+
var target;
|
14116
|
+
|
14117
|
+
if (!propagate) {
|
14118
|
+
return fill;
|
13984
14119
|
}
|
13985
14120
|
|
13986
|
-
|
13987
|
-
|
14121
|
+
while (fill !== false && visited.indexOf(fill) === -1) {
|
14122
|
+
if (!isNumberFinite(fill)) {
|
14123
|
+
return fill;
|
14124
|
+
}
|
14125
|
+
|
14126
|
+
target = sources[fill];
|
14127
|
+
|
14128
|
+
if (!target) {
|
14129
|
+
return false;
|
14130
|
+
}
|
14131
|
+
|
14132
|
+
if (target.visible) {
|
14133
|
+
return fill;
|
14134
|
+
}
|
14135
|
+
|
14136
|
+
visited.push(fill);
|
14137
|
+
fill = target.fill;
|
14138
|
+
}
|
14139
|
+
|
14140
|
+
return false;
|
14141
|
+
}
|
14142
|
+
|
14143
|
+
function _decodeFill(line, index, count) {
|
14144
|
+
var fill = parseFillOption(line);
|
14145
|
+
|
14146
|
+
if (isObject(fill)) {
|
14147
|
+
return isNaN(fill.value) ? false : fill;
|
14148
|
+
}
|
14149
|
+
|
14150
|
+
var target = parseFloat(fill);
|
14151
|
+
|
14152
|
+
if (isNumberFinite(target) && Math.floor(target) === target) {
|
14153
|
+
return decodeTargetIndex(fill[0], index, target, count);
|
14154
|
+
}
|
14155
|
+
|
14156
|
+
return ['origin', 'start', 'end', 'stack', 'shape'].indexOf(fill) >= 0 && fill;
|
14157
|
+
}
|
14158
|
+
|
14159
|
+
function decodeTargetIndex(firstCh, index, target, count) {
|
14160
|
+
if (firstCh === '-' || firstCh === '+') {
|
14161
|
+
target = index + target;
|
14162
|
+
}
|
14163
|
+
|
14164
|
+
if (target === index || target < 0 || target >= count) {
|
14165
|
+
return false;
|
13988
14166
|
}
|
13989
14167
|
|
13990
14168
|
return target;
|
13991
14169
|
}
|
13992
14170
|
|
13993
|
-
function
|
13994
|
-
var
|
14171
|
+
function _getTargetPixel(fill, scale) {
|
14172
|
+
var pixel = null;
|
13995
14173
|
|
13996
|
-
if (
|
13997
|
-
|
14174
|
+
if (fill === 'start') {
|
14175
|
+
pixel = scale.bottom;
|
14176
|
+
} else if (fill === 'end') {
|
14177
|
+
pixel = scale.top;
|
14178
|
+
} else if (isObject(fill)) {
|
14179
|
+
pixel = scale.getPixelForValue(fill.value);
|
14180
|
+
} else if (scale.getBasePixel) {
|
14181
|
+
pixel = scale.getBasePixel();
|
13998
14182
|
}
|
13999
14183
|
|
14000
|
-
return
|
14184
|
+
return pixel;
|
14001
14185
|
}
|
14002
14186
|
|
14003
|
-
function
|
14004
|
-
|
14005
|
-
var point = points[end];
|
14187
|
+
function _getTargetValue(fill, scale, startValue) {
|
14188
|
+
var value;
|
14006
14189
|
|
14007
|
-
|
14008
|
-
|
14009
|
-
|
14190
|
+
if (fill === 'start') {
|
14191
|
+
value = startValue;
|
14192
|
+
} else if (fill === 'end') {
|
14193
|
+
value = scale.options.reverse ? scale.min : scale.max;
|
14194
|
+
} else if (isObject(fill)) {
|
14195
|
+
value = fill.value;
|
14196
|
+
} else {
|
14197
|
+
value = scale.getBaseValue();
|
14010
14198
|
}
|
14011
14199
|
|
14012
|
-
return
|
14200
|
+
return value;
|
14013
14201
|
}
|
14014
14202
|
|
14015
|
-
function
|
14016
|
-
var
|
14017
|
-
|
14018
|
-
|
14019
|
-
_ref5$y = _ref5.y,
|
14020
|
-
y = _ref5$y === void 0 ? null : _ref5$y;
|
14203
|
+
function parseFillOption(line) {
|
14204
|
+
var options = line.options;
|
14205
|
+
var fillOption = options.fill;
|
14206
|
+
var fill = valueOrDefault(fillOption && fillOption.target, fillOption);
|
14021
14207
|
|
14022
|
-
|
14023
|
-
|
14024
|
-
|
14025
|
-
var start = _ref6.start,
|
14026
|
-
end = _ref6.end;
|
14027
|
-
end = findSegmentEnd(start, end, linePoints);
|
14028
|
-
var first = linePoints[start];
|
14029
|
-
var last = linePoints[end];
|
14208
|
+
if (fill === undefined) {
|
14209
|
+
fill = !!options.backgroundColor;
|
14210
|
+
}
|
14030
14211
|
|
14031
|
-
|
14032
|
-
|
14033
|
-
|
14034
|
-
|
14035
|
-
|
14036
|
-
|
14037
|
-
|
14038
|
-
|
14039
|
-
|
14040
|
-
} else if (x !== null) {
|
14041
|
-
points.push({
|
14042
|
-
x: x,
|
14043
|
-
y: first.y
|
14044
|
-
});
|
14045
|
-
points.push({
|
14046
|
-
x: x,
|
14047
|
-
y: last.y
|
14048
|
-
});
|
14049
|
-
}
|
14050
|
-
});
|
14051
|
-
return points;
|
14212
|
+
if (fill === false || fill === null) {
|
14213
|
+
return false;
|
14214
|
+
}
|
14215
|
+
|
14216
|
+
if (fill === true) {
|
14217
|
+
return 'origin';
|
14218
|
+
}
|
14219
|
+
|
14220
|
+
return fill;
|
14052
14221
|
}
|
14053
14222
|
|
14054
|
-
function
|
14223
|
+
function _buildStackLine(source) {
|
14055
14224
|
var scale = source.scale,
|
14056
14225
|
index = source.index,
|
14057
14226
|
line = source.line;
|
@@ -14059,7 +14228,7 @@
|
|
14059
14228
|
var segments = line.segments;
|
14060
14229
|
var sourcePoints = line.points;
|
14061
14230
|
var linesBelow = getLinesBelow(scale, index);
|
14062
|
-
linesBelow.push(
|
14231
|
+
linesBelow.push(_createBoundaryLine({
|
14063
14232
|
x: null,
|
14064
14233
|
y: scale.bottom
|
14065
14234
|
}, line));
|
@@ -14158,7 +14327,47 @@
|
|
14158
14327
|
};
|
14159
14328
|
}
|
14160
14329
|
|
14161
|
-
function
|
14330
|
+
var simpleArc = /*#__PURE__*/function () {
|
14331
|
+
function simpleArc(opts) {
|
14332
|
+
_classCallCheck(this, simpleArc);
|
14333
|
+
|
14334
|
+
this.x = opts.x;
|
14335
|
+
this.y = opts.y;
|
14336
|
+
this.radius = opts.radius;
|
14337
|
+
}
|
14338
|
+
|
14339
|
+
_createClass(simpleArc, [{
|
14340
|
+
key: "pathSegment",
|
14341
|
+
value: function pathSegment(ctx, bounds, opts) {
|
14342
|
+
var x = this.x,
|
14343
|
+
y = this.y,
|
14344
|
+
radius = this.radius;
|
14345
|
+
bounds = bounds || {
|
14346
|
+
start: 0,
|
14347
|
+
end: TAU
|
14348
|
+
};
|
14349
|
+
ctx.arc(x, y, radius, bounds.end, bounds.start, true);
|
14350
|
+
return !opts.bounds;
|
14351
|
+
}
|
14352
|
+
}, {
|
14353
|
+
key: "interpolate",
|
14354
|
+
value: function interpolate(point) {
|
14355
|
+
var x = this.x,
|
14356
|
+
y = this.y,
|
14357
|
+
radius = this.radius;
|
14358
|
+
var angle = point.angle;
|
14359
|
+
return {
|
14360
|
+
x: x + Math.cos(angle) * radius,
|
14361
|
+
y: y + Math.sin(angle) * radius,
|
14362
|
+
angle: angle
|
14363
|
+
};
|
14364
|
+
}
|
14365
|
+
}]);
|
14366
|
+
|
14367
|
+
return simpleArc;
|
14368
|
+
}();
|
14369
|
+
|
14370
|
+
function _getTarget(source) {
|
14162
14371
|
var chart = source.chart,
|
14163
14372
|
fill = source.fill,
|
14164
14373
|
line = source.line;
|
@@ -14168,7 +14377,7 @@
|
|
14168
14377
|
}
|
14169
14378
|
|
14170
14379
|
if (fill === 'stack') {
|
14171
|
-
return
|
14380
|
+
return _buildStackLine(source);
|
14172
14381
|
}
|
14173
14382
|
|
14174
14383
|
if (fill === 'shape') {
|
@@ -14181,198 +14390,184 @@
|
|
14181
14390
|
return boundary;
|
14182
14391
|
}
|
14183
14392
|
|
14184
|
-
return
|
14393
|
+
return _createBoundaryLine(boundary, line);
|
14185
14394
|
}
|
14186
14395
|
|
14187
|
-
function
|
14188
|
-
var
|
14189
|
-
var
|
14396
|
+
function getLineByIndex(chart, index) {
|
14397
|
+
var meta = chart.getDatasetMeta(index);
|
14398
|
+
var visible = meta && chart.isDatasetVisible(index);
|
14399
|
+
return visible ? meta.dataset : null;
|
14400
|
+
}
|
14190
14401
|
|
14191
|
-
|
14192
|
-
|
14193
|
-
|
14194
|
-
|
14195
|
-
|
14402
|
+
function computeBoundary(source) {
|
14403
|
+
var scale = source.scale || {};
|
14404
|
+
|
14405
|
+
if (scale.getPointPositionForValue) {
|
14406
|
+
return computeCircularBoundary(source);
|
14196
14407
|
}
|
14197
14408
|
|
14198
|
-
return
|
14199
|
-
points: points,
|
14200
|
-
options: {
|
14201
|
-
tension: 0
|
14202
|
-
},
|
14203
|
-
_loop: _loop,
|
14204
|
-
_fullLoop: _loop
|
14205
|
-
}) : null;
|
14409
|
+
return computeLinearBoundary(source);
|
14206
14410
|
}
|
14207
14411
|
|
14208
|
-
function
|
14209
|
-
var
|
14210
|
-
|
14211
|
-
|
14212
|
-
var target;
|
14412
|
+
function computeLinearBoundary(source) {
|
14413
|
+
var _source$scale = source.scale,
|
14414
|
+
scale = _source$scale === void 0 ? {} : _source$scale,
|
14415
|
+
fill = source.fill;
|
14213
14416
|
|
14214
|
-
|
14215
|
-
|
14417
|
+
var pixel = _getTargetPixel(fill, scale);
|
14418
|
+
|
14419
|
+
if (isNumberFinite(pixel)) {
|
14420
|
+
var horizontal = scale.isHorizontal();
|
14421
|
+
return {
|
14422
|
+
x: horizontal ? pixel : null,
|
14423
|
+
y: horizontal ? null : pixel
|
14424
|
+
};
|
14216
14425
|
}
|
14217
14426
|
|
14218
|
-
|
14219
|
-
|
14220
|
-
return fill;
|
14221
|
-
}
|
14427
|
+
return null;
|
14428
|
+
}
|
14222
14429
|
|
14223
|
-
|
14430
|
+
function computeCircularBoundary(source) {
|
14431
|
+
var scale = source.scale,
|
14432
|
+
fill = source.fill;
|
14433
|
+
var options = scale.options;
|
14434
|
+
var length = scale.getLabels().length;
|
14435
|
+
var start = options.reverse ? scale.max : scale.min;
|
14224
14436
|
|
14225
|
-
|
14226
|
-
return false;
|
14227
|
-
}
|
14437
|
+
var value = _getTargetValue(fill, scale, start);
|
14228
14438
|
|
14229
|
-
|
14230
|
-
return fill;
|
14231
|
-
}
|
14439
|
+
var target = [];
|
14232
14440
|
|
14233
|
-
|
14234
|
-
|
14441
|
+
if (options.grid.circular) {
|
14442
|
+
var center = scale.getPointPositionForValue(0, start);
|
14443
|
+
return new simpleArc({
|
14444
|
+
x: center.x,
|
14445
|
+
y: center.y,
|
14446
|
+
radius: scale.getDistanceFromCenterForValue(value)
|
14447
|
+
});
|
14235
14448
|
}
|
14236
14449
|
|
14237
|
-
|
14238
|
-
|
14450
|
+
for (var i = 0; i < length; ++i) {
|
14451
|
+
target.push(scale.getPointPositionForValue(i, value));
|
14452
|
+
}
|
14239
14453
|
|
14240
|
-
|
14241
|
-
ctx.beginPath();
|
14242
|
-
target.path(ctx);
|
14243
|
-
ctx.lineTo(target.last().x, clipY);
|
14244
|
-
ctx.lineTo(target.first().x, clipY);
|
14245
|
-
ctx.closePath();
|
14246
|
-
ctx.clip();
|
14454
|
+
return target;
|
14247
14455
|
}
|
14248
14456
|
|
14249
|
-
function
|
14250
|
-
|
14251
|
-
return;
|
14252
|
-
}
|
14253
|
-
|
14254
|
-
var start = first[property];
|
14255
|
-
var end = last[property];
|
14457
|
+
function _drawfill(ctx, source, area) {
|
14458
|
+
var target = _getTarget(source);
|
14256
14459
|
|
14257
|
-
|
14258
|
-
|
14259
|
-
|
14260
|
-
|
14460
|
+
var line = source.line,
|
14461
|
+
scale = source.scale,
|
14462
|
+
axis = source.axis;
|
14463
|
+
var lineOpts = line.options;
|
14464
|
+
var fillOption = lineOpts.fill;
|
14465
|
+
var color = lineOpts.backgroundColor;
|
14261
14466
|
|
14262
|
-
|
14263
|
-
|
14264
|
-
|
14265
|
-
|
14266
|
-
|
14467
|
+
var _ref7 = fillOption || {},
|
14468
|
+
_ref7$above = _ref7.above,
|
14469
|
+
above = _ref7$above === void 0 ? color : _ref7$above,
|
14470
|
+
_ref7$below = _ref7.below,
|
14471
|
+
below = _ref7$below === void 0 ? color : _ref7$below;
|
14472
|
+
|
14473
|
+
if (target && line.points.length) {
|
14474
|
+
clipArea(ctx, area);
|
14475
|
+
doFill(ctx, {
|
14476
|
+
line: line,
|
14477
|
+
target: target,
|
14478
|
+
above: above,
|
14479
|
+
below: below,
|
14480
|
+
area: area,
|
14481
|
+
scale: scale,
|
14482
|
+
axis: axis
|
14483
|
+
});
|
14484
|
+
unclipArea(ctx);
|
14485
|
+
}
|
14267
14486
|
}
|
14268
14487
|
|
14269
|
-
function
|
14270
|
-
|
14271
|
-
|
14488
|
+
function doFill(ctx, cfg) {
|
14489
|
+
var line = cfg.line,
|
14490
|
+
target = cfg.target,
|
14491
|
+
above = cfg.above,
|
14492
|
+
below = cfg.below,
|
14493
|
+
area = cfg.area,
|
14494
|
+
scale = cfg.scale;
|
14495
|
+
var property = line._loop ? 'angle' : cfg.axis;
|
14496
|
+
ctx.save();
|
14497
|
+
|
14498
|
+
if (property === 'x' && below !== above) {
|
14499
|
+
clipVertical(ctx, target, area.top);
|
14500
|
+
fill(ctx, {
|
14501
|
+
line: line,
|
14502
|
+
target: target,
|
14503
|
+
color: above,
|
14504
|
+
scale: scale,
|
14505
|
+
property: property
|
14506
|
+
});
|
14507
|
+
ctx.restore();
|
14508
|
+
ctx.save();
|
14509
|
+
clipVertical(ctx, target, area.bottom);
|
14272
14510
|
}
|
14273
14511
|
|
14274
|
-
|
14512
|
+
fill(ctx, {
|
14513
|
+
line: line,
|
14514
|
+
target: target,
|
14515
|
+
color: below,
|
14516
|
+
scale: scale,
|
14517
|
+
property: property
|
14518
|
+
});
|
14519
|
+
ctx.restore();
|
14275
14520
|
}
|
14276
14521
|
|
14277
|
-
function
|
14278
|
-
var segments =
|
14279
|
-
|
14280
|
-
var
|
14281
|
-
var
|
14522
|
+
function clipVertical(ctx, target, clipY) {
|
14523
|
+
var segments = target.segments,
|
14524
|
+
points = target.points;
|
14525
|
+
var first = true;
|
14526
|
+
var lineLoop = false;
|
14527
|
+
ctx.beginPath();
|
14282
14528
|
|
14283
|
-
var
|
14284
|
-
|
14529
|
+
var _iterator19 = _createForOfIteratorHelper(segments),
|
14530
|
+
_step19;
|
14285
14531
|
|
14286
14532
|
try {
|
14287
|
-
for (
|
14288
|
-
var segment =
|
14533
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
14534
|
+
var segment = _step19.value;
|
14289
14535
|
var start = segment.start,
|
14290
14536
|
end = segment.end;
|
14291
|
-
|
14292
|
-
var bounds = getBounds(property, points[start], points[end], segment.loop);
|
14293
|
-
|
14294
|
-
if (!target.segments) {
|
14295
|
-
parts.push({
|
14296
|
-
source: segment,
|
14297
|
-
target: bounds,
|
14298
|
-
start: points[start],
|
14299
|
-
end: points[end]
|
14300
|
-
});
|
14301
|
-
continue;
|
14302
|
-
}
|
14303
|
-
|
14304
|
-
var targetSegments = _boundSegments(target, bounds);
|
14305
|
-
|
14306
|
-
var _iterator17 = _createForOfIteratorHelper(targetSegments),
|
14307
|
-
_step17;
|
14537
|
+
var firstPoint = points[start];
|
14308
14538
|
|
14309
|
-
|
14310
|
-
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
14311
|
-
var tgt = _step17.value;
|
14312
|
-
var subBounds = getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
14539
|
+
var lastPoint = points[_findSegmentEnd(start, end, points)];
|
14313
14540
|
|
14314
|
-
|
14541
|
+
if (first) {
|
14542
|
+
ctx.moveTo(firstPoint.x, firstPoint.y);
|
14543
|
+
first = false;
|
14544
|
+
} else {
|
14545
|
+
ctx.lineTo(firstPoint.x, clipY);
|
14546
|
+
ctx.lineTo(firstPoint.x, firstPoint.y);
|
14547
|
+
}
|
14315
14548
|
|
14316
|
-
|
14317
|
-
|
14549
|
+
lineLoop = !!target.pathSegment(ctx, segment, {
|
14550
|
+
move: lineLoop
|
14551
|
+
});
|
14318
14552
|
|
14319
|
-
|
14320
|
-
|
14321
|
-
|
14322
|
-
|
14323
|
-
source: fillSource,
|
14324
|
-
target: tgt,
|
14325
|
-
start: _defineProperty({}, property, _getEdge(bounds, subBounds, 'start', Math.max)),
|
14326
|
-
end: _defineProperty({}, property, _getEdge(bounds, subBounds, 'end', Math.min))
|
14327
|
-
});
|
14328
|
-
}
|
14329
|
-
} catch (err) {
|
14330
|
-
_iterator18.e(err);
|
14331
|
-
} finally {
|
14332
|
-
_iterator18.f();
|
14333
|
-
}
|
14334
|
-
}
|
14335
|
-
} catch (err) {
|
14336
|
-
_iterator17.e(err);
|
14337
|
-
} finally {
|
14338
|
-
_iterator17.f();
|
14553
|
+
if (lineLoop) {
|
14554
|
+
ctx.closePath();
|
14555
|
+
} else {
|
14556
|
+
ctx.lineTo(lastPoint.x, clipY);
|
14339
14557
|
}
|
14340
14558
|
}
|
14341
14559
|
} catch (err) {
|
14342
|
-
|
14560
|
+
_iterator19.e(err);
|
14343
14561
|
} finally {
|
14344
|
-
|
14345
|
-
}
|
14346
|
-
|
14347
|
-
return parts;
|
14348
|
-
}
|
14349
|
-
|
14350
|
-
function clipBounds(ctx, scale, bounds) {
|
14351
|
-
var _scale$chart$chartAre = scale.chart.chartArea,
|
14352
|
-
top = _scale$chart$chartAre.top,
|
14353
|
-
bottom = _scale$chart$chartAre.bottom;
|
14354
|
-
|
14355
|
-
var _ref7 = bounds || {},
|
14356
|
-
property = _ref7.property,
|
14357
|
-
start = _ref7.start,
|
14358
|
-
end = _ref7.end;
|
14359
|
-
|
14360
|
-
if (property === 'x') {
|
14361
|
-
ctx.beginPath();
|
14362
|
-
ctx.rect(start, top, end - start, bottom - top);
|
14363
|
-
ctx.clip();
|
14562
|
+
_iterator19.f();
|
14364
14563
|
}
|
14365
|
-
}
|
14366
|
-
|
14367
|
-
function interpolatedLineTo(ctx, target, point, property) {
|
14368
|
-
var interpolatedPoint = target.interpolate(point, property);
|
14369
14564
|
|
14370
|
-
|
14371
|
-
|
14372
|
-
|
14565
|
+
ctx.lineTo(target.first().x, clipY);
|
14566
|
+
ctx.closePath();
|
14567
|
+
ctx.clip();
|
14373
14568
|
}
|
14374
14569
|
|
14375
|
-
function
|
14570
|
+
function fill(ctx, cfg) {
|
14376
14571
|
var line = cfg.line,
|
14377
14572
|
target = cfg.target,
|
14378
14573
|
property = cfg.property,
|
@@ -14381,16 +14576,16 @@
|
|
14381
14576
|
|
14382
14577
|
var segments = _segments(line, target, property);
|
14383
14578
|
|
14384
|
-
var
|
14385
|
-
|
14579
|
+
var _iterator20 = _createForOfIteratorHelper(segments),
|
14580
|
+
_step20;
|
14386
14581
|
|
14387
14582
|
try {
|
14388
|
-
for (
|
14389
|
-
var
|
14390
|
-
src =
|
14391
|
-
tgt =
|
14392
|
-
start =
|
14393
|
-
end =
|
14583
|
+
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
14584
|
+
var _step20$value = _step20.value,
|
14585
|
+
src = _step20$value.source,
|
14586
|
+
tgt = _step20$value.target,
|
14587
|
+
start = _step20$value.start,
|
14588
|
+
end = _step20$value.end;
|
14394
14589
|
var _src$style = src.style;
|
14395
14590
|
_src$style = _src$style === void 0 ? {} : _src$style;
|
14396
14591
|
var _src$style$background = _src$style.backgroundColor,
|
@@ -14398,7 +14593,7 @@
|
|
14398
14593
|
var notShape = target !== true;
|
14399
14594
|
ctx.save();
|
14400
14595
|
ctx.fillStyle = backgroundColor;
|
14401
|
-
clipBounds(ctx, scale, notShape &&
|
14596
|
+
clipBounds(ctx, scale, notShape && _getBounds(property, start, end));
|
14402
14597
|
ctx.beginPath();
|
14403
14598
|
var lineLoop = !!line.pathSegment(ctx, src);
|
14404
14599
|
var loop = void 0;
|
@@ -14426,81 +14621,38 @@
|
|
14426
14621
|
ctx.restore();
|
14427
14622
|
}
|
14428
14623
|
} catch (err) {
|
14429
|
-
|
14624
|
+
_iterator20.e(err);
|
14430
14625
|
} finally {
|
14431
|
-
|
14626
|
+
_iterator20.f();
|
14432
14627
|
}
|
14433
14628
|
}
|
14434
14629
|
|
14435
|
-
function
|
14436
|
-
var
|
14437
|
-
|
14438
|
-
|
14439
|
-
below = cfg.below,
|
14440
|
-
area = cfg.area,
|
14441
|
-
scale = cfg.scale;
|
14442
|
-
var property = line._loop ? 'angle' : cfg.axis;
|
14443
|
-
ctx.save();
|
14444
|
-
|
14445
|
-
if (property === 'x' && below !== above) {
|
14446
|
-
_clip(ctx, target, area.top);
|
14447
|
-
|
14448
|
-
_fill(ctx, {
|
14449
|
-
line: line,
|
14450
|
-
target: target,
|
14451
|
-
color: above,
|
14452
|
-
scale: scale,
|
14453
|
-
property: property
|
14454
|
-
});
|
14630
|
+
function clipBounds(ctx, scale, bounds) {
|
14631
|
+
var _scale$chart$chartAre = scale.chart.chartArea,
|
14632
|
+
top = _scale$chart$chartAre.top,
|
14633
|
+
bottom = _scale$chart$chartAre.bottom;
|
14455
14634
|
|
14456
|
-
|
14457
|
-
|
14635
|
+
var _ref8 = bounds || {},
|
14636
|
+
property = _ref8.property,
|
14637
|
+
start = _ref8.start,
|
14638
|
+
end = _ref8.end;
|
14458
14639
|
|
14459
|
-
|
14640
|
+
if (property === 'x') {
|
14641
|
+
ctx.beginPath();
|
14642
|
+
ctx.rect(start, top, end - start, bottom - top);
|
14643
|
+
ctx.clip();
|
14460
14644
|
}
|
14461
|
-
|
14462
|
-
_fill(ctx, {
|
14463
|
-
line: line,
|
14464
|
-
target: target,
|
14465
|
-
color: below,
|
14466
|
-
scale: scale,
|
14467
|
-
property: property
|
14468
|
-
});
|
14469
|
-
|
14470
|
-
ctx.restore();
|
14471
14645
|
}
|
14472
14646
|
|
14473
|
-
function
|
14474
|
-
var
|
14475
|
-
var line = source.line,
|
14476
|
-
scale = source.scale,
|
14477
|
-
axis = source.axis;
|
14478
|
-
var lineOpts = line.options;
|
14479
|
-
var fillOption = lineOpts.fill;
|
14480
|
-
var color = lineOpts.backgroundColor;
|
14481
|
-
|
14482
|
-
var _ref8 = fillOption || {},
|
14483
|
-
_ref8$above = _ref8.above,
|
14484
|
-
above = _ref8$above === void 0 ? color : _ref8$above,
|
14485
|
-
_ref8$below = _ref8.below,
|
14486
|
-
below = _ref8$below === void 0 ? color : _ref8$below;
|
14647
|
+
function interpolatedLineTo(ctx, target, point, property) {
|
14648
|
+
var interpolatedPoint = target.interpolate(point, property);
|
14487
14649
|
|
14488
|
-
if (
|
14489
|
-
|
14490
|
-
doFill(ctx, {
|
14491
|
-
line: line,
|
14492
|
-
target: target,
|
14493
|
-
above: above,
|
14494
|
-
below: below,
|
14495
|
-
area: area,
|
14496
|
-
scale: scale,
|
14497
|
-
axis: axis
|
14498
|
-
});
|
14499
|
-
unclipArea(ctx);
|
14650
|
+
if (interpolatedPoint) {
|
14651
|
+
ctx.lineTo(interpolatedPoint.x, interpolatedPoint.y);
|
14500
14652
|
}
|
14501
14653
|
}
|
14502
14654
|
|
14503
|
-
var
|
14655
|
+
var index = {
|
14504
14656
|
id: 'filler',
|
14505
14657
|
afterDatasetsUpdate: function afterDatasetsUpdate(chart, _args, options) {
|
14506
14658
|
var count = (chart.data.datasets || []).length;
|
@@ -14516,7 +14668,7 @@
|
|
14516
14668
|
source = {
|
14517
14669
|
visible: chart.isDatasetVisible(i),
|
14518
14670
|
index: i,
|
14519
|
-
fill:
|
14671
|
+
fill: _decodeFill(line, i, count),
|
14520
14672
|
chart: chart,
|
14521
14673
|
axis: meta.controller.options.indexAxis,
|
14522
14674
|
scale: meta.vScale,
|
@@ -14535,7 +14687,7 @@
|
|
14535
14687
|
continue;
|
14536
14688
|
}
|
14537
14689
|
|
14538
|
-
source.fill =
|
14690
|
+
source.fill = _resolveTarget(sources, i, options.propagate);
|
14539
14691
|
}
|
14540
14692
|
},
|
14541
14693
|
beforeDraw: function beforeDraw(chart, _args, options) {
|
@@ -14553,7 +14705,7 @@
|
|
14553
14705
|
source.line.updateControlPoints(area, source.axis);
|
14554
14706
|
|
14555
14707
|
if (draw) {
|
14556
|
-
|
14708
|
+
_drawfill(chart.ctx, source, area);
|
14557
14709
|
}
|
14558
14710
|
}
|
14559
14711
|
},
|
@@ -14568,7 +14720,7 @@
|
|
14568
14720
|
var source = metasets[i].$filler;
|
14569
14721
|
|
14570
14722
|
if (source) {
|
14571
|
-
|
14723
|
+
_drawfill(chart.ctx, source, chart.chartArea);
|
14572
14724
|
}
|
14573
14725
|
}
|
14574
14726
|
},
|
@@ -14579,7 +14731,7 @@
|
|
14579
14731
|
return;
|
14580
14732
|
}
|
14581
14733
|
|
14582
|
-
|
14734
|
+
_drawfill(chart.ctx, source, chart.chartArea);
|
14583
14735
|
},
|
14584
14736
|
defaults: {
|
14585
14737
|
propagate: true,
|
@@ -14615,34 +14767,34 @@
|
|
14615
14767
|
var _super16 = _createSuper(Legend);
|
14616
14768
|
|
14617
14769
|
function Legend(config) {
|
14618
|
-
var
|
14770
|
+
var _this27;
|
14619
14771
|
|
14620
14772
|
_classCallCheck(this, Legend);
|
14621
14773
|
|
14622
|
-
|
14623
|
-
|
14624
|
-
|
14625
|
-
|
14626
|
-
|
14627
|
-
|
14628
|
-
|
14629
|
-
|
14630
|
-
|
14631
|
-
|
14632
|
-
|
14633
|
-
|
14634
|
-
|
14635
|
-
|
14636
|
-
|
14637
|
-
|
14638
|
-
|
14639
|
-
|
14640
|
-
|
14641
|
-
|
14642
|
-
|
14643
|
-
|
14644
|
-
|
14645
|
-
return
|
14774
|
+
_this27 = _super16.call(this);
|
14775
|
+
_this27._added = false;
|
14776
|
+
_this27.legendHitBoxes = [];
|
14777
|
+
_this27._hoveredItem = null;
|
14778
|
+
_this27.doughnutMode = false;
|
14779
|
+
_this27.chart = config.chart;
|
14780
|
+
_this27.options = config.options;
|
14781
|
+
_this27.ctx = config.ctx;
|
14782
|
+
_this27.legendItems = undefined;
|
14783
|
+
_this27.columnSizes = undefined;
|
14784
|
+
_this27.lineWidths = undefined;
|
14785
|
+
_this27.maxHeight = undefined;
|
14786
|
+
_this27.maxWidth = undefined;
|
14787
|
+
_this27.top = undefined;
|
14788
|
+
_this27.bottom = undefined;
|
14789
|
+
_this27.left = undefined;
|
14790
|
+
_this27.right = undefined;
|
14791
|
+
_this27.height = undefined;
|
14792
|
+
_this27.width = undefined;
|
14793
|
+
_this27._margins = undefined;
|
14794
|
+
_this27.position = undefined;
|
14795
|
+
_this27.weight = undefined;
|
14796
|
+
_this27.fullSize = undefined;
|
14797
|
+
return _this27;
|
14646
14798
|
}
|
14647
14799
|
|
14648
14800
|
_createClass(Legend, [{
|
@@ -14671,20 +14823,20 @@
|
|
14671
14823
|
}, {
|
14672
14824
|
key: "buildLabels",
|
14673
14825
|
value: function buildLabels() {
|
14674
|
-
var
|
14826
|
+
var _this28 = this;
|
14675
14827
|
|
14676
14828
|
var labelOpts = this.options.labels || {};
|
14677
14829
|
var legendItems = callback(labelOpts.generateLabels, [this.chart], this) || [];
|
14678
14830
|
|
14679
14831
|
if (labelOpts.filter) {
|
14680
14832
|
legendItems = legendItems.filter(function (item) {
|
14681
|
-
return labelOpts.filter(item,
|
14833
|
+
return labelOpts.filter(item, _this28.chart.data);
|
14682
14834
|
});
|
14683
14835
|
}
|
14684
14836
|
|
14685
14837
|
if (labelOpts.sort) {
|
14686
14838
|
legendItems = legendItems.sort(function (a, b) {
|
14687
|
-
return labelOpts.sort(a, b,
|
14839
|
+
return labelOpts.sort(a, b, _this28.chart.data);
|
14688
14840
|
});
|
14689
14841
|
}
|
14690
14842
|
|
@@ -14830,12 +14982,12 @@
|
|
14830
14982
|
|
14831
14983
|
var left = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);
|
14832
14984
|
|
14833
|
-
var
|
14834
|
-
|
14985
|
+
var _iterator21 = _createForOfIteratorHelper(hitboxes),
|
14986
|
+
_step21;
|
14835
14987
|
|
14836
14988
|
try {
|
14837
|
-
for (
|
14838
|
-
var hitbox =
|
14989
|
+
for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
|
14990
|
+
var hitbox = _step21.value;
|
14839
14991
|
|
14840
14992
|
if (row !== hitbox.row) {
|
14841
14993
|
row = hitbox.row;
|
@@ -14847,21 +14999,21 @@
|
|
14847
14999
|
left += hitbox.width + padding;
|
14848
15000
|
}
|
14849
15001
|
} catch (err) {
|
14850
|
-
|
15002
|
+
_iterator21.e(err);
|
14851
15003
|
} finally {
|
14852
|
-
|
15004
|
+
_iterator21.f();
|
14853
15005
|
}
|
14854
15006
|
} else {
|
14855
15007
|
var col = 0;
|
14856
15008
|
|
14857
15009
|
var top = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);
|
14858
15010
|
|
14859
|
-
var
|
14860
|
-
|
15011
|
+
var _iterator22 = _createForOfIteratorHelper(hitboxes),
|
15012
|
+
_step22;
|
14861
15013
|
|
14862
15014
|
try {
|
14863
|
-
for (
|
14864
|
-
var _hitbox =
|
15015
|
+
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
15016
|
+
var _hitbox = _step22.value;
|
14865
15017
|
|
14866
15018
|
if (_hitbox.col !== col) {
|
14867
15019
|
col = _hitbox.col;
|
@@ -14874,9 +15026,9 @@
|
|
14874
15026
|
top += _hitbox.height + padding;
|
14875
15027
|
}
|
14876
15028
|
} catch (err) {
|
14877
|
-
|
15029
|
+
_iterator22.e(err);
|
14878
15030
|
} finally {
|
14879
|
-
|
15031
|
+
_iterator22.f();
|
14880
15032
|
}
|
14881
15033
|
}
|
14882
15034
|
}
|
@@ -14900,7 +15052,7 @@
|
|
14900
15052
|
}, {
|
14901
15053
|
key: "_draw",
|
14902
15054
|
value: function _draw() {
|
14903
|
-
var
|
15055
|
+
var _this29 = this;
|
14904
15056
|
|
14905
15057
|
var opts = this.options,
|
14906
15058
|
columnSizes = this.columnSizes,
|
@@ -15017,23 +15169,23 @@
|
|
15017
15169
|
var width = boxWidth + halfFontSize + textWidth;
|
15018
15170
|
var x = cursor.x;
|
15019
15171
|
var y = cursor.y;
|
15020
|
-
rtlHelper.setWidth(
|
15172
|
+
rtlHelper.setWidth(_this29.width);
|
15021
15173
|
|
15022
15174
|
if (isHorizontal) {
|
15023
|
-
if (i > 0 && x + width + padding >
|
15175
|
+
if (i > 0 && x + width + padding > _this29.right) {
|
15024
15176
|
y = cursor.y += lineHeight;
|
15025
15177
|
cursor.line++;
|
15026
|
-
x = cursor.x = _alignStartEnd(align,
|
15178
|
+
x = cursor.x = _alignStartEnd(align, _this29.left + padding, _this29.right - lineWidths[cursor.line]);
|
15027
15179
|
}
|
15028
|
-
} else if (i > 0 && y + lineHeight >
|
15180
|
+
} else if (i > 0 && y + lineHeight > _this29.bottom) {
|
15029
15181
|
x = cursor.x = x + columnSizes[cursor.line].width + padding;
|
15030
15182
|
cursor.line++;
|
15031
|
-
y = cursor.y = _alignStartEnd(align,
|
15183
|
+
y = cursor.y = _alignStartEnd(align, _this29.top + titleHeight + padding, _this29.bottom - columnSizes[cursor.line].height);
|
15032
15184
|
}
|
15033
15185
|
|
15034
15186
|
var realX = rtlHelper.x(x);
|
15035
15187
|
drawLegendBox(realX, y, legendItem);
|
15036
|
-
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width :
|
15188
|
+
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : _this29.right, opts.rtl);
|
15037
15189
|
fillText(rtlHelper.x(x), y, legendItem);
|
15038
15190
|
|
15039
15191
|
if (isHorizontal) {
|
@@ -15123,7 +15275,7 @@
|
|
15123
15275
|
|
15124
15276
|
var hoveredItem = this._getLegendItemAt(e.x, e.y);
|
15125
15277
|
|
15126
|
-
if (e.type === 'mousemove') {
|
15278
|
+
if (e.type === 'mousemove' || e.type === 'mouseout') {
|
15127
15279
|
var previous = this._hoveredItem;
|
15128
15280
|
var sameItem = itemsEqual(previous, hoveredItem);
|
15129
15281
|
|
@@ -15146,7 +15298,7 @@
|
|
15146
15298
|
}(Element);
|
15147
15299
|
|
15148
15300
|
function isListened(type, opts) {
|
15149
|
-
if (type === 'mousemove' && (opts.onHover || opts.onLeave)) {
|
15301
|
+
if ((type === 'mousemove' || type === 'mouseout') && (opts.onHover || opts.onLeave)) {
|
15150
15302
|
return true;
|
15151
15303
|
}
|
15152
15304
|
|
@@ -15272,25 +15424,25 @@
|
|
15272
15424
|
var _super17 = _createSuper(Title);
|
15273
15425
|
|
15274
15426
|
function Title(config) {
|
15275
|
-
var
|
15427
|
+
var _this30;
|
15276
15428
|
|
15277
15429
|
_classCallCheck(this, Title);
|
15278
15430
|
|
15279
|
-
|
15280
|
-
|
15281
|
-
|
15282
|
-
|
15283
|
-
|
15284
|
-
|
15285
|
-
|
15286
|
-
|
15287
|
-
|
15288
|
-
|
15289
|
-
|
15290
|
-
|
15291
|
-
|
15292
|
-
|
15293
|
-
return
|
15431
|
+
_this30 = _super17.call(this);
|
15432
|
+
_this30.chart = config.chart;
|
15433
|
+
_this30.options = config.options;
|
15434
|
+
_this30.ctx = config.ctx;
|
15435
|
+
_this30._padding = undefined;
|
15436
|
+
_this30.top = undefined;
|
15437
|
+
_this30.bottom = undefined;
|
15438
|
+
_this30.left = undefined;
|
15439
|
+
_this30.right = undefined;
|
15440
|
+
_this30.width = undefined;
|
15441
|
+
_this30.height = undefined;
|
15442
|
+
_this30.position = undefined;
|
15443
|
+
_this30.weight = undefined;
|
15444
|
+
_this30.fullSize = undefined;
|
15445
|
+
return _this30;
|
15294
15446
|
}
|
15295
15447
|
|
15296
15448
|
_createClass(Title, [{
|
@@ -15803,40 +15955,40 @@
|
|
15803
15955
|
var _super18 = _createSuper(Tooltip);
|
15804
15956
|
|
15805
15957
|
function Tooltip(config) {
|
15806
|
-
var
|
15958
|
+
var _this31;
|
15807
15959
|
|
15808
15960
|
_classCallCheck(this, Tooltip);
|
15809
15961
|
|
15810
|
-
|
15811
|
-
|
15812
|
-
|
15813
|
-
|
15814
|
-
|
15815
|
-
|
15816
|
-
|
15817
|
-
|
15818
|
-
|
15819
|
-
|
15820
|
-
|
15821
|
-
|
15822
|
-
|
15823
|
-
|
15824
|
-
|
15825
|
-
|
15826
|
-
|
15827
|
-
|
15828
|
-
|
15829
|
-
|
15830
|
-
|
15831
|
-
|
15832
|
-
|
15833
|
-
|
15834
|
-
|
15835
|
-
|
15836
|
-
|
15837
|
-
|
15838
|
-
|
15839
|
-
return
|
15962
|
+
_this31 = _super18.call(this);
|
15963
|
+
_this31.opacity = 0;
|
15964
|
+
_this31._active = [];
|
15965
|
+
_this31._eventPosition = undefined;
|
15966
|
+
_this31._size = undefined;
|
15967
|
+
_this31._cachedAnimations = undefined;
|
15968
|
+
_this31._tooltipItems = [];
|
15969
|
+
_this31.$animations = undefined;
|
15970
|
+
_this31.$context = undefined;
|
15971
|
+
_this31.chart = config.chart || config._chart;
|
15972
|
+
_this31._chart = _this31.chart;
|
15973
|
+
_this31.options = config.options;
|
15974
|
+
_this31.dataPoints = undefined;
|
15975
|
+
_this31.title = undefined;
|
15976
|
+
_this31.beforeBody = undefined;
|
15977
|
+
_this31.body = undefined;
|
15978
|
+
_this31.afterBody = undefined;
|
15979
|
+
_this31.footer = undefined;
|
15980
|
+
_this31.xAlign = undefined;
|
15981
|
+
_this31.yAlign = undefined;
|
15982
|
+
_this31.x = undefined;
|
15983
|
+
_this31.y = undefined;
|
15984
|
+
_this31.height = undefined;
|
15985
|
+
_this31.width = undefined;
|
15986
|
+
_this31.caretX = undefined;
|
15987
|
+
_this31.caretY = undefined;
|
15988
|
+
_this31.labelColors = undefined;
|
15989
|
+
_this31.labelPointStyles = undefined;
|
15990
|
+
_this31.labelTextColors = undefined;
|
15991
|
+
return _this31;
|
15840
15992
|
}
|
15841
15993
|
|
15842
15994
|
_createClass(Tooltip, [{
|
@@ -15892,7 +16044,7 @@
|
|
15892
16044
|
}, {
|
15893
16045
|
key: "getBody",
|
15894
16046
|
value: function getBody(tooltipItems, options) {
|
15895
|
-
var
|
16047
|
+
var _this32 = this;
|
15896
16048
|
|
15897
16049
|
var callbacks = options.callbacks;
|
15898
16050
|
var bodyItems = [];
|
@@ -15903,9 +16055,9 @@
|
|
15903
16055
|
after: []
|
15904
16056
|
};
|
15905
16057
|
var scoped = overrideCallbacks(callbacks, context);
|
15906
|
-
pushOrConcat(bodyItem.before, splitNewlines(scoped.beforeLabel.call(
|
15907
|
-
pushOrConcat(bodyItem.lines, scoped.label.call(
|
15908
|
-
pushOrConcat(bodyItem.after, splitNewlines(scoped.afterLabel.call(
|
16058
|
+
pushOrConcat(bodyItem.before, splitNewlines(scoped.beforeLabel.call(_this32, context)));
|
16059
|
+
pushOrConcat(bodyItem.lines, scoped.label.call(_this32, context));
|
16060
|
+
pushOrConcat(bodyItem.after, splitNewlines(scoped.afterLabel.call(_this32, context)));
|
15909
16061
|
bodyItems.push(bodyItem);
|
15910
16062
|
});
|
15911
16063
|
return bodyItems;
|
@@ -15931,7 +16083,7 @@
|
|
15931
16083
|
}, {
|
15932
16084
|
key: "_createItems",
|
15933
16085
|
value: function _createItems(options) {
|
15934
|
-
var
|
16086
|
+
var _this33 = this;
|
15935
16087
|
|
15936
16088
|
var active = this._active;
|
15937
16089
|
var data = this.chart.data;
|
@@ -15959,9 +16111,9 @@
|
|
15959
16111
|
|
15960
16112
|
each(tooltipItems, function (context) {
|
15961
16113
|
var scoped = overrideCallbacks(options.callbacks, context);
|
15962
|
-
labelColors.push(scoped.labelColor.call(
|
15963
|
-
labelPointStyles.push(scoped.labelPointStyle.call(
|
15964
|
-
labelTextColors.push(scoped.labelTextColor.call(
|
16114
|
+
labelColors.push(scoped.labelColor.call(_this33, context));
|
16115
|
+
labelPointStyles.push(scoped.labelPointStyle.call(_this33, context));
|
16116
|
+
labelTextColors.push(scoped.labelTextColor.call(_this33, context));
|
15965
16117
|
});
|
15966
16118
|
this.labelColors = labelColors;
|
15967
16119
|
this.labelPointStyles = labelPointStyles;
|
@@ -16367,6 +16519,11 @@
|
|
16367
16519
|
}
|
16368
16520
|
}
|
16369
16521
|
}
|
16522
|
+
}, {
|
16523
|
+
key: "_willRender",
|
16524
|
+
value: function _willRender() {
|
16525
|
+
return !!this.opacity;
|
16526
|
+
}
|
16370
16527
|
}, {
|
16371
16528
|
key: "draw",
|
16372
16529
|
value: function draw(ctx) {
|
@@ -16412,14 +16569,14 @@
|
|
16412
16569
|
}, {
|
16413
16570
|
key: "setActiveElements",
|
16414
16571
|
value: function setActiveElements(activeElements, eventPosition) {
|
16415
|
-
var
|
16572
|
+
var _this34 = this;
|
16416
16573
|
|
16417
16574
|
var lastActive = this._active;
|
16418
16575
|
var active = activeElements.map(function (_ref9) {
|
16419
16576
|
var datasetIndex = _ref9.datasetIndex,
|
16420
16577
|
index = _ref9.index;
|
16421
16578
|
|
16422
|
-
var meta =
|
16579
|
+
var meta = _this34.chart.getDatasetMeta(datasetIndex);
|
16423
16580
|
|
16424
16581
|
if (!meta) {
|
16425
16582
|
throw new Error('Cannot find a dataset at index ' + datasetIndex);
|
@@ -16535,19 +16692,19 @@
|
|
16535
16692
|
},
|
16536
16693
|
afterDraw: function afterDraw(chart) {
|
16537
16694
|
var tooltip = chart.tooltip;
|
16538
|
-
var args = {
|
16539
|
-
tooltip: tooltip
|
16540
|
-
};
|
16541
16695
|
|
16542
|
-
if (
|
16543
|
-
|
16544
|
-
|
16696
|
+
if (tooltip && tooltip._willRender()) {
|
16697
|
+
var args = {
|
16698
|
+
tooltip: tooltip
|
16699
|
+
};
|
16700
|
+
|
16701
|
+
if (chart.notifyPlugins('beforeTooltipDraw', args) === false) {
|
16702
|
+
return;
|
16703
|
+
}
|
16545
16704
|
|
16546
|
-
if (tooltip) {
|
16547
16705
|
tooltip.draw(chart.ctx);
|
16706
|
+
chart.notifyPlugins('afterTooltipDraw', args);
|
16548
16707
|
}
|
16549
|
-
|
16550
|
-
chart.notifyPlugins('afterTooltipDraw', args);
|
16551
16708
|
},
|
16552
16709
|
afterEvent: function afterEvent(chart, args) {
|
16553
16710
|
if (chart.tooltip) {
|
@@ -16707,7 +16864,7 @@
|
|
16707
16864
|
var plugins = /*#__PURE__*/Object.freeze({
|
16708
16865
|
__proto__: null,
|
16709
16866
|
Decimation: plugin_decimation,
|
16710
|
-
Filler:
|
16867
|
+
Filler: index,
|
16711
16868
|
Legend: plugin_legend,
|
16712
16869
|
SubTitle: plugin_subtitle,
|
16713
16870
|
Title: plugin_title,
|
@@ -16749,15 +16906,15 @@
|
|
16749
16906
|
var _super19 = _createSuper(CategoryScale);
|
16750
16907
|
|
16751
16908
|
function CategoryScale(cfg) {
|
16752
|
-
var
|
16909
|
+
var _this35;
|
16753
16910
|
|
16754
16911
|
_classCallCheck(this, CategoryScale);
|
16755
16912
|
|
16756
|
-
|
16757
|
-
|
16758
|
-
|
16759
|
-
|
16760
|
-
return
|
16913
|
+
_this35 = _super19.call(this, cfg);
|
16914
|
+
_this35._startValue = undefined;
|
16915
|
+
_this35._valueRange = 0;
|
16916
|
+
_this35._addedLabels = [];
|
16917
|
+
return _this35;
|
16761
16918
|
}
|
16762
16919
|
|
16763
16920
|
_createClass(CategoryScale, [{
|
@@ -16768,23 +16925,23 @@
|
|
16768
16925
|
if (added.length) {
|
16769
16926
|
var labels = this.getLabels();
|
16770
16927
|
|
16771
|
-
var
|
16772
|
-
|
16928
|
+
var _iterator23 = _createForOfIteratorHelper(added),
|
16929
|
+
_step23;
|
16773
16930
|
|
16774
16931
|
try {
|
16775
|
-
for (
|
16776
|
-
var
|
16777
|
-
|
16778
|
-
label =
|
16932
|
+
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
16933
|
+
var _step23$value = _step23.value,
|
16934
|
+
_index3 = _step23$value.index,
|
16935
|
+
label = _step23$value.label;
|
16779
16936
|
|
16780
|
-
if (labels[
|
16781
|
-
labels.splice(
|
16937
|
+
if (labels[_index3] === label) {
|
16938
|
+
labels.splice(_index3, 1);
|
16782
16939
|
}
|
16783
16940
|
}
|
16784
16941
|
} catch (err) {
|
16785
|
-
|
16942
|
+
_iterator23.e(err);
|
16786
16943
|
} finally {
|
16787
|
-
|
16944
|
+
_iterator23.f();
|
16788
16945
|
}
|
16789
16946
|
|
16790
16947
|
this._addedLabels = [];
|
@@ -17041,17 +17198,17 @@
|
|
17041
17198
|
var _super20 = _createSuper(LinearScaleBase);
|
17042
17199
|
|
17043
17200
|
function LinearScaleBase(cfg) {
|
17044
|
-
var
|
17201
|
+
var _this36;
|
17045
17202
|
|
17046
17203
|
_classCallCheck(this, LinearScaleBase);
|
17047
17204
|
|
17048
|
-
|
17049
|
-
|
17050
|
-
|
17051
|
-
|
17052
|
-
|
17053
|
-
|
17054
|
-
return
|
17205
|
+
_this36 = _super20.call(this, cfg);
|
17206
|
+
_this36.start = undefined;
|
17207
|
+
_this36.end = undefined;
|
17208
|
+
_this36._startValue = undefined;
|
17209
|
+
_this36._endValue = undefined;
|
17210
|
+
_this36._valueRange = 0;
|
17211
|
+
return _this36;
|
17055
17212
|
}
|
17056
17213
|
|
17057
17214
|
_createClass(LinearScaleBase, [{
|
@@ -17313,16 +17470,16 @@
|
|
17313
17470
|
var _super22 = _createSuper(LogarithmicScale);
|
17314
17471
|
|
17315
17472
|
function LogarithmicScale(cfg) {
|
17316
|
-
var
|
17473
|
+
var _this37;
|
17317
17474
|
|
17318
17475
|
_classCallCheck(this, LogarithmicScale);
|
17319
17476
|
|
17320
|
-
|
17321
|
-
|
17322
|
-
|
17323
|
-
|
17324
|
-
|
17325
|
-
return
|
17477
|
+
_this37 = _super22.call(this, cfg);
|
17478
|
+
_this37.start = undefined;
|
17479
|
+
_this37.end = undefined;
|
17480
|
+
_this37._startValue = undefined;
|
17481
|
+
_this37._valueRange = 0;
|
17482
|
+
return _this37;
|
17326
17483
|
}
|
17327
17484
|
|
17328
17485
|
_createClass(LogarithmicScale, [{
|
@@ -17646,9 +17803,29 @@
|
|
17646
17803
|
var backdropColor = optsAtIndex.backdropColor;
|
17647
17804
|
|
17648
17805
|
if (!isNullOrUndef(backdropColor)) {
|
17806
|
+
var borderRadius = toTRBLCorners(optsAtIndex.borderRadius);
|
17649
17807
|
var padding = toPadding(optsAtIndex.backdropPadding);
|
17650
17808
|
ctx.fillStyle = backdropColor;
|
17651
|
-
|
17809
|
+
var backdropLeft = left - padding.left;
|
17810
|
+
var backdropTop = top - padding.top;
|
17811
|
+
var backdropWidth = right - left + padding.width;
|
17812
|
+
var backdropHeight = bottom - top + padding.height;
|
17813
|
+
|
17814
|
+
if (Object.values(borderRadius).some(function (v) {
|
17815
|
+
return v !== 0;
|
17816
|
+
})) {
|
17817
|
+
ctx.beginPath();
|
17818
|
+
addRoundedRectPath(ctx, {
|
17819
|
+
x: backdropLeft,
|
17820
|
+
y: backdropTop,
|
17821
|
+
w: backdropWidth,
|
17822
|
+
h: backdropHeight,
|
17823
|
+
radius: borderRadius
|
17824
|
+
});
|
17825
|
+
ctx.fill();
|
17826
|
+
} else {
|
17827
|
+
ctx.fillRect(backdropLeft, backdropTop, backdropWidth, backdropHeight);
|
17828
|
+
}
|
17652
17829
|
}
|
17653
17830
|
|
17654
17831
|
renderText(ctx, scale._pointLabels[i], x, y + plFont.lineHeight / 2, plFont, {
|
@@ -17711,17 +17888,17 @@
|
|
17711
17888
|
var _super23 = _createSuper(RadialLinearScale);
|
17712
17889
|
|
17713
17890
|
function RadialLinearScale(cfg) {
|
17714
|
-
var
|
17891
|
+
var _this38;
|
17715
17892
|
|
17716
17893
|
_classCallCheck(this, RadialLinearScale);
|
17717
17894
|
|
17718
|
-
|
17719
|
-
|
17720
|
-
|
17721
|
-
|
17722
|
-
|
17723
|
-
|
17724
|
-
return
|
17895
|
+
_this38 = _super23.call(this, cfg);
|
17896
|
+
_this38.xCenter = undefined;
|
17897
|
+
_this38.yCenter = undefined;
|
17898
|
+
_this38.drawingArea = undefined;
|
17899
|
+
_this38._pointLabels = [];
|
17900
|
+
_this38._pointLabelItems = [];
|
17901
|
+
return _this38;
|
17725
17902
|
}
|
17726
17903
|
|
17727
17904
|
_createClass(RadialLinearScale, [{
|
@@ -17753,14 +17930,14 @@
|
|
17753
17930
|
}, {
|
17754
17931
|
key: "generateTickLabels",
|
17755
17932
|
value: function generateTickLabels(ticks) {
|
17756
|
-
var
|
17933
|
+
var _this39 = this;
|
17757
17934
|
|
17758
17935
|
LinearScaleBase.prototype.generateTickLabels.call(this, ticks);
|
17759
17936
|
this._pointLabels = this.getLabels().map(function (value, index) {
|
17760
|
-
var label = callback(
|
17937
|
+
var label = callback(_this39.options.pointLabels.callback, [value, index], _this39);
|
17761
17938
|
return label || label === 0 ? label : '';
|
17762
17939
|
}).filter(function (v, i) {
|
17763
|
-
return
|
17940
|
+
return _this39.chart.getDataVisibility(i);
|
17764
17941
|
});
|
17765
17942
|
}
|
17766
17943
|
}, {
|
@@ -17880,7 +18057,7 @@
|
|
17880
18057
|
}, {
|
17881
18058
|
key: "drawGrid",
|
17882
18059
|
value: function drawGrid() {
|
17883
|
-
var
|
18060
|
+
var _this40 = this;
|
17884
18061
|
|
17885
18062
|
var ctx = this.ctx;
|
17886
18063
|
var opts = this.options;
|
@@ -17896,9 +18073,9 @@
|
|
17896
18073
|
if (grid.display) {
|
17897
18074
|
this.ticks.forEach(function (tick, index) {
|
17898
18075
|
if (index !== 0) {
|
17899
|
-
offset =
|
17900
|
-
var optsAtIndex = grid.setContext(
|
17901
|
-
drawRadiusLine(
|
18076
|
+
offset = _this40.getDistanceFromCenterForValue(tick.value);
|
18077
|
+
var optsAtIndex = grid.setContext(_this40.getContext(index - 1));
|
18078
|
+
drawRadiusLine(_this40, optsAtIndex, offset, labelCount);
|
17902
18079
|
}
|
17903
18080
|
});
|
17904
18081
|
}
|
@@ -17936,7 +18113,7 @@
|
|
17936
18113
|
}, {
|
17937
18114
|
key: "drawLabels",
|
17938
18115
|
value: function drawLabels() {
|
17939
|
-
var
|
18116
|
+
var _this41 = this;
|
17940
18117
|
|
17941
18118
|
var ctx = this.ctx;
|
17942
18119
|
var opts = this.options;
|
@@ -17958,9 +18135,9 @@
|
|
17958
18135
|
return;
|
17959
18136
|
}
|
17960
18137
|
|
17961
|
-
var optsAtIndex = tickOpts.setContext(
|
18138
|
+
var optsAtIndex = tickOpts.setContext(_this41.getContext(index));
|
17962
18139
|
var tickFont = toFont(optsAtIndex.font);
|
17963
|
-
offset =
|
18140
|
+
offset = _this41.getDistanceFromCenterForValue(_this41.ticks[index].value);
|
17964
18141
|
|
17965
18142
|
if (optsAtIndex.showLabelBackdrop) {
|
17966
18143
|
ctx.font = tickFont.string;
|
@@ -18199,22 +18376,22 @@
|
|
18199
18376
|
var _super24 = _createSuper(TimeScale);
|
18200
18377
|
|
18201
18378
|
function TimeScale(props) {
|
18202
|
-
var
|
18379
|
+
var _this42;
|
18203
18380
|
|
18204
18381
|
_classCallCheck(this, TimeScale);
|
18205
18382
|
|
18206
|
-
|
18207
|
-
|
18383
|
+
_this42 = _super24.call(this, props);
|
18384
|
+
_this42._cache = {
|
18208
18385
|
data: [],
|
18209
18386
|
labels: [],
|
18210
18387
|
all: []
|
18211
18388
|
};
|
18212
|
-
|
18213
|
-
|
18214
|
-
|
18215
|
-
|
18216
|
-
|
18217
|
-
return
|
18389
|
+
_this42._unit = 'day';
|
18390
|
+
_this42._majorUnit = undefined;
|
18391
|
+
_this42._offsets = {};
|
18392
|
+
_this42._normalized = false;
|
18393
|
+
_this42._parseOpts = undefined;
|
18394
|
+
return _this42;
|
18218
18395
|
}
|
18219
18396
|
|
18220
18397
|
_createClass(TimeScale, [{
|
@@ -18334,6 +18511,15 @@
|
|
18334
18511
|
|
18335
18512
|
return ticksFromTimestamps(this, ticks, this._majorUnit);
|
18336
18513
|
}
|
18514
|
+
}, {
|
18515
|
+
key: "afterAutoSkip",
|
18516
|
+
value: function afterAutoSkip() {
|
18517
|
+
if (this.options.offsetAfterAutoskip) {
|
18518
|
+
this.initOffsets(this.ticks.map(function (tick) {
|
18519
|
+
return +tick.value;
|
18520
|
+
}));
|
18521
|
+
}
|
18522
|
+
}
|
18337
18523
|
}, {
|
18338
18524
|
key: "initOffsets",
|
18339
18525
|
value: function initOffsets(timestamps) {
|
@@ -18613,15 +18799,15 @@
|
|
18613
18799
|
var _super25 = _createSuper(TimeSeriesScale);
|
18614
18800
|
|
18615
18801
|
function TimeSeriesScale(props) {
|
18616
|
-
var
|
18802
|
+
var _this43;
|
18617
18803
|
|
18618
18804
|
_classCallCheck(this, TimeSeriesScale);
|
18619
18805
|
|
18620
|
-
|
18621
|
-
|
18622
|
-
|
18623
|
-
|
18624
|
-
return
|
18806
|
+
_this43 = _super25.call(this, props);
|
18807
|
+
_this43._table = [];
|
18808
|
+
_this43._minPos = undefined;
|
18809
|
+
_this43._tableRange = undefined;
|
18810
|
+
return _this43;
|
18625
18811
|
}
|
18626
18812
|
|
18627
18813
|
_createClass(TimeSeriesScale, [{
|
@@ -18940,7 +19126,7 @@
|
|
18940
19126
|
return new Date(timestamp + amount);
|
18941
19127
|
}
|
18942
19128
|
|
18943
|
-
var MILLISECONDS_IN_HOUR$
|
19129
|
+
var MILLISECONDS_IN_HOUR$1 = 3600000;
|
18944
19130
|
/**
|
18945
19131
|
* @name addHours
|
18946
19132
|
* @category Hour Helpers
|
@@ -18967,7 +19153,7 @@
|
|
18967
19153
|
function addHours(dirtyDate, dirtyAmount) {
|
18968
19154
|
requiredArgs(2, arguments);
|
18969
19155
|
var amount = toInteger(dirtyAmount);
|
18970
|
-
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR$
|
19156
|
+
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR$1);
|
18971
19157
|
}
|
18972
19158
|
|
18973
19159
|
/**
|
@@ -19117,7 +19303,7 @@
|
|
19117
19303
|
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY$1);
|
19118
19304
|
}
|
19119
19305
|
|
19120
|
-
var MILLISECONDS_IN_MINUTE$
|
19306
|
+
var MILLISECONDS_IN_MINUTE$1 = 60000;
|
19121
19307
|
/**
|
19122
19308
|
* @name addMinutes
|
19123
19309
|
* @category Minute Helpers
|
@@ -19144,7 +19330,7 @@
|
|
19144
19330
|
function addMinutes(dirtyDate, dirtyAmount) {
|
19145
19331
|
requiredArgs(2, arguments);
|
19146
19332
|
var amount = toInteger(dirtyAmount);
|
19147
|
-
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE$
|
19333
|
+
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE$1);
|
19148
19334
|
}
|
19149
19335
|
|
19150
19336
|
/**
|
@@ -20457,6 +20643,8 @@
|
|
20457
20643
|
return result;
|
20458
20644
|
};
|
20459
20645
|
|
20646
|
+
var formatDistance$1 = formatDistance;
|
20647
|
+
|
20460
20648
|
function buildFormatLongFn(args) {
|
20461
20649
|
return function () {
|
20462
20650
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // TODO: Remove String()
|
@@ -20499,6 +20687,7 @@
|
|
20499
20687
|
defaultWidth: 'full'
|
20500
20688
|
})
|
20501
20689
|
};
|
20690
|
+
var formatLong$1 = formatLong;
|
20502
20691
|
|
20503
20692
|
var formatRelativeLocale = {
|
20504
20693
|
lastWeek: "'last' eeee 'at' p",
|
@@ -20513,6 +20702,8 @@
|
|
20513
20702
|
return formatRelativeLocale[token];
|
20514
20703
|
};
|
20515
20704
|
|
20705
|
+
var formatRelative$1 = formatRelative;
|
20706
|
+
|
20516
20707
|
function buildLocalizeFn(args) {
|
20517
20708
|
return function (dirtyIndex, dirtyOptions) {
|
20518
20709
|
var options = dirtyOptions || {};
|
@@ -20531,7 +20722,7 @@
|
|
20531
20722
|
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
20532
20723
|
}
|
20533
20724
|
|
20534
|
-
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I
|
20725
|
+
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
20535
20726
|
|
20536
20727
|
return valuesArray[index];
|
20537
20728
|
};
|
@@ -20681,6 +20872,7 @@
|
|
20681
20872
|
defaultFormattingWidth: 'wide'
|
20682
20873
|
})
|
20683
20874
|
};
|
20875
|
+
var localize$1 = localize;
|
20684
20876
|
|
20685
20877
|
function buildMatchFn(args) {
|
20686
20878
|
return function (string) {
|
@@ -20844,6 +21036,7 @@
|
|
20844
21036
|
defaultParseWidth: 'any'
|
20845
21037
|
})
|
20846
21038
|
};
|
21039
|
+
var match$1 = match;
|
20847
21040
|
|
20848
21041
|
/**
|
20849
21042
|
* @type {Locale}
|
@@ -20857,11 +21050,11 @@
|
|
20857
21050
|
|
20858
21051
|
var locale = {
|
20859
21052
|
code: 'en-US',
|
20860
|
-
formatDistance: formatDistance,
|
20861
|
-
formatLong: formatLong,
|
20862
|
-
formatRelative: formatRelative,
|
20863
|
-
localize: localize,
|
20864
|
-
match: match,
|
21053
|
+
formatDistance: formatDistance$1,
|
21054
|
+
formatLong: formatLong$1,
|
21055
|
+
formatRelative: formatRelative$1,
|
21056
|
+
localize: localize$1,
|
21057
|
+
match: match$1,
|
20865
21058
|
options: {
|
20866
21059
|
weekStartsOn: 0
|
20867
21060
|
/* Sunday */
|
@@ -20869,6 +21062,7 @@
|
|
20869
21062
|
firstWeekContainsDate: 1
|
20870
21063
|
}
|
20871
21064
|
};
|
21065
|
+
var defaultLocale = locale;
|
20872
21066
|
|
20873
21067
|
/**
|
20874
21068
|
* @name subMilliseconds
|
@@ -20899,100 +21093,6 @@
|
|
20899
21093
|
return addMilliseconds(dirtyDate, -amount);
|
20900
21094
|
}
|
20901
21095
|
|
20902
|
-
function addLeadingZeros(number, targetLength) {
|
20903
|
-
var sign = number < 0 ? '-' : '';
|
20904
|
-
var output = Math.abs(number).toString();
|
20905
|
-
|
20906
|
-
while (output.length < targetLength) {
|
20907
|
-
output = '0' + output;
|
20908
|
-
}
|
20909
|
-
|
20910
|
-
return sign + output;
|
20911
|
-
}
|
20912
|
-
|
20913
|
-
/*
|
20914
|
-
* | | Unit | | Unit |
|
20915
|
-
* |-----|--------------------------------|-----|--------------------------------|
|
20916
|
-
* | a | AM, PM | A* | |
|
20917
|
-
* | d | Day of month | D | |
|
20918
|
-
* | h | Hour [1-12] | H | Hour [0-23] |
|
20919
|
-
* | m | Minute | M | Month |
|
20920
|
-
* | s | Second | S | Fraction of second |
|
20921
|
-
* | y | Year (abs) | Y | |
|
20922
|
-
*
|
20923
|
-
* Letters marked by * are not implemented but reserved by Unicode standard.
|
20924
|
-
*/
|
20925
|
-
|
20926
|
-
var formatters$1 = {
|
20927
|
-
// Year
|
20928
|
-
y: function y(date, token) {
|
20929
|
-
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
20930
|
-
// | Year | y | yy | yyy | yyyy | yyyyy |
|
20931
|
-
// |----------|-------|----|-------|-------|-------|
|
20932
|
-
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
20933
|
-
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
20934
|
-
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
20935
|
-
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
20936
|
-
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
20937
|
-
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
20938
|
-
|
20939
|
-
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
20940
|
-
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
20941
|
-
},
|
20942
|
-
// Month
|
20943
|
-
M: function M(date, token) {
|
20944
|
-
var month = date.getUTCMonth();
|
20945
|
-
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
20946
|
-
},
|
20947
|
-
// Day of the month
|
20948
|
-
d: function d(date, token) {
|
20949
|
-
return addLeadingZeros(date.getUTCDate(), token.length);
|
20950
|
-
},
|
20951
|
-
// AM or PM
|
20952
|
-
a: function a(date, token) {
|
20953
|
-
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
20954
|
-
|
20955
|
-
switch (token) {
|
20956
|
-
case 'a':
|
20957
|
-
case 'aa':
|
20958
|
-
return dayPeriodEnumValue.toUpperCase();
|
20959
|
-
|
20960
|
-
case 'aaa':
|
20961
|
-
return dayPeriodEnumValue;
|
20962
|
-
|
20963
|
-
case 'aaaaa':
|
20964
|
-
return dayPeriodEnumValue[0];
|
20965
|
-
|
20966
|
-
case 'aaaa':
|
20967
|
-
default:
|
20968
|
-
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
20969
|
-
}
|
20970
|
-
},
|
20971
|
-
// Hour [1-12]
|
20972
|
-
h: function h(date, token) {
|
20973
|
-
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
20974
|
-
},
|
20975
|
-
// Hour [0-23]
|
20976
|
-
H: function H(date, token) {
|
20977
|
-
return addLeadingZeros(date.getUTCHours(), token.length);
|
20978
|
-
},
|
20979
|
-
// Minute
|
20980
|
-
m: function m(date, token) {
|
20981
|
-
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
20982
|
-
},
|
20983
|
-
// Second
|
20984
|
-
s: function s(date, token) {
|
20985
|
-
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
20986
|
-
},
|
20987
|
-
// Fraction of second
|
20988
|
-
S: function S(date, token) {
|
20989
|
-
var numberOfDigits = token.length;
|
20990
|
-
var milliseconds = date.getUTCMilliseconds();
|
20991
|
-
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
20992
|
-
return addLeadingZeros(fractionalSeconds, token.length);
|
20993
|
-
}
|
20994
|
-
};
|
20995
|
-
|
20996
21096
|
var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
|
20997
21097
|
// See issue: https://github.com/date-fns/date-fns/issues/376
|
20998
21098
|
|
@@ -21095,7 +21195,7 @@
|
|
21095
21195
|
|
21096
21196
|
function getUTCWeekYear(dirtyDate, dirtyOptions) {
|
21097
21197
|
requiredArgs(1, arguments);
|
21098
|
-
var date = toDate(dirtyDate
|
21198
|
+
var date = toDate(dirtyDate);
|
21099
21199
|
var year = date.getUTCFullYear();
|
21100
21200
|
var options = dirtyOptions || {};
|
21101
21201
|
var locale = options.locale;
|
@@ -21155,6 +21255,101 @@
|
|
21155
21255
|
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
21156
21256
|
}
|
21157
21257
|
|
21258
|
+
function addLeadingZeros(number, targetLength) {
|
21259
|
+
var sign = number < 0 ? '-' : '';
|
21260
|
+
var output = Math.abs(number).toString();
|
21261
|
+
|
21262
|
+
while (output.length < targetLength) {
|
21263
|
+
output = '0' + output;
|
21264
|
+
}
|
21265
|
+
|
21266
|
+
return sign + output;
|
21267
|
+
}
|
21268
|
+
|
21269
|
+
/*
|
21270
|
+
* | | Unit | | Unit |
|
21271
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
21272
|
+
* | a | AM, PM | A* | |
|
21273
|
+
* | d | Day of month | D | |
|
21274
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
21275
|
+
* | m | Minute | M | Month |
|
21276
|
+
* | s | Second | S | Fraction of second |
|
21277
|
+
* | y | Year (abs) | Y | |
|
21278
|
+
*
|
21279
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
21280
|
+
*/
|
21281
|
+
|
21282
|
+
var formatters$2 = {
|
21283
|
+
// Year
|
21284
|
+
y: function y(date, token) {
|
21285
|
+
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
21286
|
+
// | Year | y | yy | yyy | yyyy | yyyyy |
|
21287
|
+
// |----------|-------|----|-------|-------|-------|
|
21288
|
+
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
21289
|
+
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
21290
|
+
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
21291
|
+
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
21292
|
+
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
21293
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
21294
|
+
|
21295
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
21296
|
+
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
21297
|
+
},
|
21298
|
+
// Month
|
21299
|
+
M: function M(date, token) {
|
21300
|
+
var month = date.getUTCMonth();
|
21301
|
+
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
21302
|
+
},
|
21303
|
+
// Day of the month
|
21304
|
+
d: function d(date, token) {
|
21305
|
+
return addLeadingZeros(date.getUTCDate(), token.length);
|
21306
|
+
},
|
21307
|
+
// AM or PM
|
21308
|
+
a: function a(date, token) {
|
21309
|
+
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
21310
|
+
|
21311
|
+
switch (token) {
|
21312
|
+
case 'a':
|
21313
|
+
case 'aa':
|
21314
|
+
return dayPeriodEnumValue.toUpperCase();
|
21315
|
+
|
21316
|
+
case 'aaa':
|
21317
|
+
return dayPeriodEnumValue;
|
21318
|
+
|
21319
|
+
case 'aaaaa':
|
21320
|
+
return dayPeriodEnumValue[0];
|
21321
|
+
|
21322
|
+
case 'aaaa':
|
21323
|
+
default:
|
21324
|
+
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
21325
|
+
}
|
21326
|
+
},
|
21327
|
+
// Hour [1-12]
|
21328
|
+
h: function h(date, token) {
|
21329
|
+
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
21330
|
+
},
|
21331
|
+
// Hour [0-23]
|
21332
|
+
H: function H(date, token) {
|
21333
|
+
return addLeadingZeros(date.getUTCHours(), token.length);
|
21334
|
+
},
|
21335
|
+
// Minute
|
21336
|
+
m: function m(date, token) {
|
21337
|
+
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
21338
|
+
},
|
21339
|
+
// Second
|
21340
|
+
s: function s(date, token) {
|
21341
|
+
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
21342
|
+
},
|
21343
|
+
// Fraction of second
|
21344
|
+
S: function S(date, token) {
|
21345
|
+
var numberOfDigits = token.length;
|
21346
|
+
var milliseconds = date.getUTCMilliseconds();
|
21347
|
+
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
21348
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
21349
|
+
}
|
21350
|
+
};
|
21351
|
+
var formatters$3 = formatters$2;
|
21352
|
+
|
21158
21353
|
var dayPeriodEnum = {
|
21159
21354
|
am: 'am',
|
21160
21355
|
pm: 'pm',
|
@@ -21251,7 +21446,7 @@
|
|
21251
21446
|
});
|
21252
21447
|
}
|
21253
21448
|
|
21254
|
-
return formatters$
|
21449
|
+
return formatters$3.y(date, token);
|
21255
21450
|
},
|
21256
21451
|
// Local week-numbering year
|
21257
21452
|
Y: function Y(date, token, localize, options) {
|
@@ -21384,7 +21579,7 @@
|
|
21384
21579
|
switch (token) {
|
21385
21580
|
case 'M':
|
21386
21581
|
case 'MM':
|
21387
|
-
return formatters$
|
21582
|
+
return formatters$3.M(date, token);
|
21388
21583
|
// 1st, 2nd, ..., 12th
|
21389
21584
|
|
21390
21585
|
case 'Mo':
|
@@ -21489,7 +21684,7 @@
|
|
21489
21684
|
});
|
21490
21685
|
}
|
21491
21686
|
|
21492
|
-
return formatters$
|
21687
|
+
return formatters$3.d(date, token);
|
21493
21688
|
},
|
21494
21689
|
// Day of year
|
21495
21690
|
D: function D(date, token, localize) {
|
@@ -21810,7 +22005,7 @@
|
|
21810
22005
|
});
|
21811
22006
|
}
|
21812
22007
|
|
21813
|
-
return formatters$
|
22008
|
+
return formatters$3.h(date, token);
|
21814
22009
|
},
|
21815
22010
|
// Hour [0-23]
|
21816
22011
|
H: function H(date, token, localize) {
|
@@ -21820,7 +22015,7 @@
|
|
21820
22015
|
});
|
21821
22016
|
}
|
21822
22017
|
|
21823
|
-
return formatters$
|
22018
|
+
return formatters$3.H(date, token);
|
21824
22019
|
},
|
21825
22020
|
// Hour [0-11]
|
21826
22021
|
K: function K(date, token, localize) {
|
@@ -21855,7 +22050,7 @@
|
|
21855
22050
|
});
|
21856
22051
|
}
|
21857
22052
|
|
21858
|
-
return formatters$
|
22053
|
+
return formatters$3.m(date, token);
|
21859
22054
|
},
|
21860
22055
|
// Second
|
21861
22056
|
s: function s(date, token, localize) {
|
@@ -21865,11 +22060,11 @@
|
|
21865
22060
|
});
|
21866
22061
|
}
|
21867
22062
|
|
21868
|
-
return formatters$
|
22063
|
+
return formatters$3.s(date, token);
|
21869
22064
|
},
|
21870
22065
|
// Fraction of second
|
21871
22066
|
S: function S(date, token) {
|
21872
|
-
return formatters$
|
22067
|
+
return formatters$3.S(date, token);
|
21873
22068
|
},
|
21874
22069
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
21875
22070
|
X: function X(date, token, _localize, options) {
|
@@ -22013,6 +22208,8 @@
|
|
22013
22208
|
return sign + hours + delimiter + minutes;
|
22014
22209
|
}
|
22015
22210
|
|
22211
|
+
var formatters$1 = formatters;
|
22212
|
+
|
22016
22213
|
function dateLongFormatter(pattern, formatLong) {
|
22017
22214
|
switch (pattern) {
|
22018
22215
|
case 'P':
|
@@ -22064,7 +22261,7 @@
|
|
22064
22261
|
}
|
22065
22262
|
|
22066
22263
|
function dateTimeLongFormatter(pattern, formatLong) {
|
22067
|
-
var matchResult = pattern.match(/(P+)(p+)?/);
|
22264
|
+
var matchResult = pattern.match(/(P+)(p+)?/) || [];
|
22068
22265
|
var datePattern = matchResult[1];
|
22069
22266
|
var timePattern = matchResult[2];
|
22070
22267
|
|
@@ -22108,6 +22305,7 @@
|
|
22108
22305
|
p: timeLongFormatter,
|
22109
22306
|
P: dateTimeLongFormatter
|
22110
22307
|
};
|
22308
|
+
var longFormatters$1 = longFormatters;
|
22111
22309
|
|
22112
22310
|
var protectedDayOfYearTokens = ['D', 'DD'];
|
22113
22311
|
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
@@ -22394,7 +22592,7 @@
|
|
22394
22592
|
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
22395
22593
|
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
|
22396
22594
|
*
|
22397
|
-
* 9. `D` and `DD` tokens represent days of the year but they are
|
22595
|
+
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
22398
22596
|
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
|
22399
22597
|
*
|
22400
22598
|
* ### v2.0.0 breaking changes:
|
@@ -22463,8 +22661,8 @@
|
|
22463
22661
|
requiredArgs(2, arguments);
|
22464
22662
|
var formatStr = String(dirtyFormatStr);
|
22465
22663
|
var options = dirtyOptions || {};
|
22466
|
-
var locale
|
22467
|
-
var localeFirstWeekContainsDate = locale
|
22664
|
+
var locale = options.locale || defaultLocale;
|
22665
|
+
var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
|
22468
22666
|
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
22469
22667
|
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
22470
22668
|
|
@@ -22472,7 +22670,7 @@
|
|
22472
22670
|
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
22473
22671
|
}
|
22474
22672
|
|
22475
|
-
var localeWeekStartsOn = locale
|
22673
|
+
var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
|
22476
22674
|
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
22477
22675
|
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
22478
22676
|
|
@@ -22480,11 +22678,11 @@
|
|
22480
22678
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
22481
22679
|
}
|
22482
22680
|
|
22483
|
-
if (!locale
|
22681
|
+
if (!locale.localize) {
|
22484
22682
|
throw new RangeError('locale must contain localize property');
|
22485
22683
|
}
|
22486
22684
|
|
22487
|
-
if (!locale
|
22685
|
+
if (!locale.formatLong) {
|
22488
22686
|
throw new RangeError('locale must contain formatLong property');
|
22489
22687
|
}
|
22490
22688
|
|
@@ -22502,15 +22700,15 @@
|
|
22502
22700
|
var formatterOptions = {
|
22503
22701
|
firstWeekContainsDate: firstWeekContainsDate,
|
22504
22702
|
weekStartsOn: weekStartsOn,
|
22505
|
-
locale: locale
|
22703
|
+
locale: locale,
|
22506
22704
|
_originalDate: originalDate
|
22507
22705
|
};
|
22508
22706
|
var result = formatStr.match(longFormattingTokensRegExp$1).map(function (substring) {
|
22509
22707
|
var firstCharacter = substring[0];
|
22510
22708
|
|
22511
22709
|
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
22512
|
-
var longFormatter = longFormatters[firstCharacter];
|
22513
|
-
return longFormatter(substring, locale
|
22710
|
+
var longFormatter = longFormatters$1[firstCharacter];
|
22711
|
+
return longFormatter(substring, locale.formatLong, formatterOptions);
|
22514
22712
|
}
|
22515
22713
|
|
22516
22714
|
return substring;
|
@@ -22526,7 +22724,7 @@
|
|
22526
22724
|
return cleanEscapedString$1(substring);
|
22527
22725
|
}
|
22528
22726
|
|
22529
|
-
var formatter = formatters[firstCharacter];
|
22727
|
+
var formatter = formatters$1[firstCharacter];
|
22530
22728
|
|
22531
22729
|
if (formatter) {
|
22532
22730
|
if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
|
@@ -22537,7 +22735,7 @@
|
|
22537
22735
|
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
22538
22736
|
}
|
22539
22737
|
|
22540
|
-
return formatter(utcDate, substring, locale
|
22738
|
+
return formatter(utcDate, substring, locale.localize, formatterOptions);
|
22541
22739
|
}
|
22542
22740
|
|
22543
22741
|
if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) {
|
@@ -22635,8 +22833,8 @@
|
|
22635
22833
|
return date;
|
22636
22834
|
}
|
22637
22835
|
|
22638
|
-
var MILLISECONDS_IN_HOUR
|
22639
|
-
var MILLISECONDS_IN_MINUTE
|
22836
|
+
var MILLISECONDS_IN_HOUR = 3600000;
|
22837
|
+
var MILLISECONDS_IN_MINUTE = 60000;
|
22640
22838
|
var MILLISECONDS_IN_SECOND = 1000;
|
22641
22839
|
var numericPatterns = {
|
22642
22840
|
month: /^(1[0-2]|0?\d)/,
|
@@ -22719,7 +22917,7 @@
|
|
22719
22917
|
var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
22720
22918
|
var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
22721
22919
|
return {
|
22722
|
-
value: sign * (hours * MILLISECONDS_IN_HOUR
|
22920
|
+
value: sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * MILLISECONDS_IN_SECOND),
|
22723
22921
|
rest: string.slice(matchResult[0].length)
|
22724
22922
|
};
|
22725
22923
|
}
|
@@ -23766,7 +23964,7 @@
|
|
23766
23964
|
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
23767
23965
|
return date;
|
23768
23966
|
},
|
23769
|
-
incompatibleTokens: ['b', 'B', 'H', '
|
23967
|
+
incompatibleTokens: ['b', 'B', 'H', 'k', 't', 'T']
|
23770
23968
|
},
|
23771
23969
|
// AM, PM, midnight
|
23772
23970
|
b: {
|
@@ -23808,7 +24006,7 @@
|
|
23808
24006
|
date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
23809
24007
|
return date;
|
23810
24008
|
},
|
23811
|
-
incompatibleTokens: ['a', 'B', 'H', '
|
24009
|
+
incompatibleTokens: ['a', 'B', 'H', 'k', 't', 'T']
|
23812
24010
|
},
|
23813
24011
|
// in the morning, in the afternoon, in the evening, at night
|
23814
24012
|
B: {
|
@@ -23944,7 +24142,7 @@
|
|
23944
24142
|
|
23945
24143
|
return date;
|
23946
24144
|
},
|
23947
|
-
incompatibleTokens: ['
|
24145
|
+
incompatibleTokens: ['h', 'H', 'k', 't', 'T']
|
23948
24146
|
},
|
23949
24147
|
// Hour [1-24]
|
23950
24148
|
k: {
|
@@ -24130,6 +24328,7 @@
|
|
24130
24328
|
incompatibleTokens: '*'
|
24131
24329
|
}
|
24132
24330
|
};
|
24331
|
+
var parsers$1 = parsers;
|
24133
24332
|
|
24134
24333
|
var TIMEZONE_UNIT_PRIORITY = 10; // This RegExp consists of three parts separated by `|`:
|
24135
24334
|
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
@@ -24301,7 +24500,7 @@
|
|
24301
24500
|
* | | | tt | ... | 2 |
|
24302
24501
|
* | Fraction of second | 30 | S | 0, 1, ..., 9 | |
|
24303
24502
|
* | | | SS | 00, 01, ..., 99 | |
|
24304
|
-
* | | | SSS | 000,
|
24503
|
+
* | | | SSS | 000, 001, ..., 999 | |
|
24305
24504
|
* | | | SSSS | ... | 2 |
|
24306
24505
|
* | Milliseconds timestamp | 20 | T | 512969520900 | |
|
24307
24506
|
* | | | TT | ... | 2 |
|
@@ -24475,13 +24674,13 @@
|
|
24475
24674
|
var dateString = String(dirtyDateString);
|
24476
24675
|
var formatString = String(dirtyFormatString);
|
24477
24676
|
var options = dirtyOptions || {};
|
24478
|
-
var locale
|
24677
|
+
var locale = options.locale || defaultLocale;
|
24479
24678
|
|
24480
|
-
if (!locale
|
24679
|
+
if (!locale.match) {
|
24481
24680
|
throw new RangeError('locale must contain match property');
|
24482
24681
|
}
|
24483
24682
|
|
24484
|
-
var localeFirstWeekContainsDate = locale
|
24683
|
+
var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
|
24485
24684
|
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
24486
24685
|
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
24487
24686
|
|
@@ -24489,7 +24688,7 @@
|
|
24489
24688
|
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
24490
24689
|
}
|
24491
24690
|
|
24492
|
-
var localeWeekStartsOn = locale
|
24691
|
+
var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
|
24493
24692
|
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
24494
24693
|
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
24495
24694
|
|
@@ -24508,7 +24707,7 @@
|
|
24508
24707
|
var subFnOptions = {
|
24509
24708
|
firstWeekContainsDate: firstWeekContainsDate,
|
24510
24709
|
weekStartsOn: weekStartsOn,
|
24511
|
-
locale: locale
|
24710
|
+
locale: locale
|
24512
24711
|
}; // If timezone isn't specified, it will be set to the system timezone
|
24513
24712
|
|
24514
24713
|
var setters = [{
|
@@ -24522,8 +24721,8 @@
|
|
24522
24721
|
var firstCharacter = substring[0];
|
24523
24722
|
|
24524
24723
|
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
24525
|
-
var longFormatter = longFormatters[firstCharacter];
|
24526
|
-
return longFormatter(substring, locale
|
24724
|
+
var longFormatter = longFormatters$1[firstCharacter];
|
24725
|
+
return longFormatter(substring, locale.formatLong, subFnOptions);
|
24527
24726
|
}
|
24528
24727
|
|
24529
24728
|
return substring;
|
@@ -24542,7 +24741,7 @@
|
|
24542
24741
|
}
|
24543
24742
|
|
24544
24743
|
var firstCharacter = token[0];
|
24545
|
-
var parser = parsers[firstCharacter];
|
24744
|
+
var parser = parsers$1[firstCharacter];
|
24546
24745
|
|
24547
24746
|
if (parser) {
|
24548
24747
|
var incompatibleTokens = parser.incompatibleTokens;
|
@@ -24570,7 +24769,7 @@
|
|
24570
24769
|
token: firstCharacter,
|
24571
24770
|
fullToken: token
|
24572
24771
|
});
|
24573
|
-
var parseResult = parser.parse(dateString, token, locale
|
24772
|
+
var parseResult = parser.parse(dateString, token, locale.match, subFnOptions);
|
24574
24773
|
|
24575
24774
|
if (!parseResult) {
|
24576
24775
|
return new Date(NaN);
|
@@ -24733,17 +24932,6 @@
|
|
24733
24932
|
return date;
|
24734
24933
|
}
|
24735
24934
|
|
24736
|
-
var MILLISECONDS_IN_HOUR = 3600000;
|
24737
|
-
var MILLISECONDS_IN_MINUTE = 60000;
|
24738
|
-
var DEFAULT_ADDITIONAL_DIGITS = 2;
|
24739
|
-
var patterns = {
|
24740
|
-
dateTimeDelimiter: /[T ]/,
|
24741
|
-
timeZoneDelimiter: /[Z ]/i,
|
24742
|
-
timezone: /([Z+-].*)$/
|
24743
|
-
};
|
24744
|
-
var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
24745
|
-
var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
24746
|
-
var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
24747
24935
|
/**
|
24748
24936
|
* @name parseISO
|
24749
24937
|
* @category Common Helpers
|
@@ -24792,20 +24980,20 @@
|
|
24792
24980
|
*
|
24793
24981
|
* @example
|
24794
24982
|
* // Convert string '2014-02-11T11:30:30' to date:
|
24795
|
-
*
|
24983
|
+
* const result = parseISO('2014-02-11T11:30:30')
|
24796
24984
|
* //=> Tue Feb 11 2014 11:30:30
|
24797
24985
|
*
|
24798
24986
|
* @example
|
24799
24987
|
* // Convert string '+02014101' to date,
|
24800
24988
|
* // if the additional number of digits in the extended year format is 1:
|
24801
|
-
*
|
24989
|
+
* const result = parseISO('+02014101', { additionalDigits: 1 })
|
24802
24990
|
* //=> Fri Apr 11 2014 00:00:00
|
24803
24991
|
*/
|
24804
24992
|
|
24805
24993
|
function parseISO(argument, dirtyOptions) {
|
24806
24994
|
requiredArgs(1, arguments);
|
24807
24995
|
var options = dirtyOptions || {};
|
24808
|
-
var additionalDigits = options.additionalDigits == null ?
|
24996
|
+
var additionalDigits = options.additionalDigits == null ? 2 : toInteger(options.additionalDigits);
|
24809
24997
|
|
24810
24998
|
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
|
24811
24999
|
throw new RangeError('additionalDigits must be 0, 1 or 2');
|
@@ -24823,7 +25011,7 @@
|
|
24823
25011
|
date = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
24824
25012
|
}
|
24825
25013
|
|
24826
|
-
if (
|
25014
|
+
if (!date || isNaN(date.getTime())) {
|
24827
25015
|
return new Date(NaN);
|
24828
25016
|
}
|
24829
25017
|
|
@@ -24834,7 +25022,7 @@
|
|
24834
25022
|
if (dateStrings.time) {
|
24835
25023
|
time = parseTime(dateStrings.time);
|
24836
25024
|
|
24837
|
-
if (isNaN(time)
|
25025
|
+
if (isNaN(time)) {
|
24838
25026
|
return new Date(NaN);
|
24839
25027
|
}
|
24840
25028
|
}
|
@@ -24860,6 +25048,14 @@
|
|
24860
25048
|
|
24861
25049
|
return new Date(timestamp + time + offset);
|
24862
25050
|
}
|
25051
|
+
var patterns = {
|
25052
|
+
dateTimeDelimiter: /[T ]/,
|
25053
|
+
timeZoneDelimiter: /[Z ]/i,
|
25054
|
+
timezone: /([Z+-].*)$/
|
25055
|
+
};
|
25056
|
+
var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
25057
|
+
var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
25058
|
+
var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
24863
25059
|
|
24864
25060
|
function splitDateString(dateString) {
|
24865
25061
|
var dateStrings = {};
|
@@ -24872,7 +25068,6 @@
|
|
24872
25068
|
}
|
24873
25069
|
|
24874
25070
|
if (/:/.test(array[0])) {
|
24875
|
-
dateStrings.date = null;
|
24876
25071
|
timeString = array[0];
|
24877
25072
|
} else {
|
24878
25073
|
dateStrings.date = array[0];
|
@@ -24903,22 +25098,24 @@
|
|
24903
25098
|
var captures = dateString.match(regex); // Invalid ISO-formatted year
|
24904
25099
|
|
24905
25100
|
if (!captures) return {
|
24906
|
-
year:
|
25101
|
+
year: NaN,
|
25102
|
+
restDateString: ''
|
24907
25103
|
};
|
24908
|
-
var year = captures[1]
|
24909
|
-
var century = captures[2]
|
25104
|
+
var year = captures[1] ? parseInt(captures[1]) : null;
|
25105
|
+
var century = captures[2] ? parseInt(captures[2]) : null; // either year or century is null, not both
|
25106
|
+
|
24910
25107
|
return {
|
24911
|
-
year: century
|
25108
|
+
year: century === null ? year : century * 100,
|
24912
25109
|
restDateString: dateString.slice((captures[1] || captures[2]).length)
|
24913
25110
|
};
|
24914
25111
|
}
|
24915
25112
|
|
24916
25113
|
function parseDate(dateString, year) {
|
24917
25114
|
// Invalid ISO-formatted year
|
24918
|
-
if (year === null) return
|
25115
|
+
if (year === null) return new Date(NaN);
|
24919
25116
|
var captures = dateString.match(dateRegex); // Invalid ISO-formatted string
|
24920
25117
|
|
24921
|
-
if (!captures) return
|
25118
|
+
if (!captures) return new Date(NaN);
|
24922
25119
|
var isWeekDate = !!captures[4];
|
24923
25120
|
var dayOfYear = parseDateUnit(captures[1]);
|
24924
25121
|
var month = parseDateUnit(captures[2]) - 1;
|
@@ -24950,7 +25147,7 @@
|
|
24950
25147
|
|
24951
25148
|
function parseTime(timeString) {
|
24952
25149
|
var captures = timeString.match(timeRegex);
|
24953
|
-
if (!captures) return
|
25150
|
+
if (!captures) return NaN; // Invalid ISO-formatted time
|
24954
25151
|
|
24955
25152
|
var hours = parseTimeUnit(captures[1]);
|
24956
25153
|
var minutes = parseTimeUnit(captures[2]);
|
@@ -24960,7 +25157,7 @@
|
|
24960
25157
|
return NaN;
|
24961
25158
|
}
|
24962
25159
|
|
24963
|
-
return hours *
|
25160
|
+
return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
|
24964
25161
|
}
|
24965
25162
|
|
24966
25163
|
function parseTimeUnit(value) {
|
@@ -24979,7 +25176,7 @@
|
|
24979
25176
|
return NaN;
|
24980
25177
|
}
|
24981
25178
|
|
24982
|
-
return sign * (hours *
|
25179
|
+
return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
|
24983
25180
|
}
|
24984
25181
|
|
24985
25182
|
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
@@ -24996,7 +25193,7 @@
|
|
24996
25193
|
var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
24997
25194
|
|
24998
25195
|
function isLeapYearIndex(year) {
|
24999
|
-
return year % 400 === 0 || year % 4 === 0 && year % 100;
|
25196
|
+
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
25000
25197
|
}
|
25001
25198
|
|
25002
25199
|
function validateDate(year, month, date) {
|
@@ -25199,4 +25396,4 @@
|
|
25199
25396
|
|
25200
25397
|
return Chart;
|
25201
25398
|
|
25202
|
-
}))
|
25399
|
+
}));
|