@plotdb/chart 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/bundle.css +59 -0
- package/bundle.js +5644 -0
- package/bundle.min.css +1 -0
- package/bundle.min.js +1 -0
- package/index.js +32 -10
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/utils/anim.js +483 -0
- package/utils/anim.min.js +1 -0
- package/utils/brush.js +306 -0
- package/utils/brush.min.js +1 -0
- package/utils/color.js +37 -0
- package/utils/color.min.js +1 -0
- package/utils/debounce.js +86 -0
- package/utils/debounce.min.js +1 -0
- package/utils/format.js +266 -5
- package/utils/format.min.js +1 -1
- package/utils/scale.js +434 -0
- package/utils/scale.min.js +1 -0
- package/utils/shape.js +799 -0
- package/utils/shape.min.js +1 -0
package/utils/anim.js
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
(function(){
|
|
2
|
+
var svgns, now, ease, reNum, color, interpColor, interpString, interpolate, getV, setV, rmV, anim, join;
|
|
3
|
+
svgns = "http://www.w3.org/2000/svg";
|
|
4
|
+
now = function(){
|
|
5
|
+
if (typeof performance != 'undefined' && performance !== null) {
|
|
6
|
+
return performance.now();
|
|
7
|
+
} else {
|
|
8
|
+
return Date.now();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
ease = {
|
|
12
|
+
linear: function(t){
|
|
13
|
+
return t;
|
|
14
|
+
},
|
|
15
|
+
cubicInOut: function(t){
|
|
16
|
+
t = t * 2;
|
|
17
|
+
if (t <= 1) {
|
|
18
|
+
return t * t * t / 2;
|
|
19
|
+
} else {
|
|
20
|
+
return ((t -= 2) * t * t + 2) / 2;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
cubicOut: function(t){
|
|
24
|
+
return --t * t * t + 1;
|
|
25
|
+
},
|
|
26
|
+
quadInOut: function(t){
|
|
27
|
+
t = t * 2;
|
|
28
|
+
if (t <= 1) {
|
|
29
|
+
return t * t / 2;
|
|
30
|
+
} else {
|
|
31
|
+
return (--t * (2 - t) + 1) / 2;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
reNum = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
|
|
36
|
+
color = function(c){
|
|
37
|
+
var m, v;
|
|
38
|
+
if (typeof c !== 'string') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
c = c.trim();
|
|
42
|
+
if (m = /^#([0-9a-f]{3,4})$/i.exec(c)) {
|
|
43
|
+
v = m[1].split('').map(function(it){
|
|
44
|
+
return parseInt(it + it, 16);
|
|
45
|
+
});
|
|
46
|
+
return [v[0], v[1], v[2], v[3] != null ? v[3] / 255 : 1];
|
|
47
|
+
}
|
|
48
|
+
if (m = /^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(c)) {
|
|
49
|
+
v = [0, 1, 2].map(function(i){
|
|
50
|
+
return parseInt(m[1].substr(i * 2, 2), 16);
|
|
51
|
+
});
|
|
52
|
+
return v.concat([m[2] ? parseInt(m[2], 16) / 255 : 1]);
|
|
53
|
+
}
|
|
54
|
+
if (m = /^rgba?\(([^)]+)\)$/i.exec(c)) {
|
|
55
|
+
v = m[1].split(/[\s,\/]+/).filter(function(it){
|
|
56
|
+
return it;
|
|
57
|
+
}).map(function(it){
|
|
58
|
+
return parseFloat(it);
|
|
59
|
+
});
|
|
60
|
+
if (v.length < 3 || v.slice(0, 3).some(function(it){
|
|
61
|
+
return isNaN(it);
|
|
62
|
+
})) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return [v[0], v[1], v[2], v[3] != null && !isNaN(v[3]) ? v[3] : 1];
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
interpColor = function(a, b){
|
|
70
|
+
return function(t){
|
|
71
|
+
var ref$, r, g, bl, al;
|
|
72
|
+
ref$ = [0, 1, 2, 3].map(function(i){
|
|
73
|
+
return a[i] + (b[i] - a[i]) * t;
|
|
74
|
+
}), r = ref$[0], g = ref$[1], bl = ref$[2], al = ref$[3];
|
|
75
|
+
ref$ = [r, g, bl].map(function(it){
|
|
76
|
+
var ref$, ref1$;
|
|
77
|
+
return (ref$ = (ref1$ = Math.round(it)) > 0 ? ref1$ : 0) < 255 ? ref$ : 255;
|
|
78
|
+
}), r = ref$[0], g = ref$[1], bl = ref$[2];
|
|
79
|
+
al = isNaN(al)
|
|
80
|
+
? 1
|
|
81
|
+
: (ref$ = al > 0 ? al : 0) < 1 ? ref$ : 1;
|
|
82
|
+
if (al === 1) {
|
|
83
|
+
return "rgb(" + r + ", " + g + ", " + bl + ")";
|
|
84
|
+
} else {
|
|
85
|
+
return "rgba(" + r + ", " + g + ", " + bl + ", " + al + ")";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
interpString = function(a, b){
|
|
90
|
+
var an, segs, last, i, m, bv, av;
|
|
91
|
+
a = a + "";
|
|
92
|
+
b = b + "";
|
|
93
|
+
an = a.match(reNum) || [];
|
|
94
|
+
segs = [];
|
|
95
|
+
last = 0;
|
|
96
|
+
i = 0;
|
|
97
|
+
reNum.lastIndex = 0;
|
|
98
|
+
while (m = reNum.exec(b)) {
|
|
99
|
+
if (m.index > last) {
|
|
100
|
+
segs.push(b.slice(last, m.index));
|
|
101
|
+
}
|
|
102
|
+
bv = +m[0];
|
|
103
|
+
av = an[i] != null ? +an[i] : null;
|
|
104
|
+
segs.push(av != null && av !== bv
|
|
105
|
+
? {
|
|
106
|
+
a: av,
|
|
107
|
+
b: bv
|
|
108
|
+
}
|
|
109
|
+
: m[0]);
|
|
110
|
+
last = reNum.lastIndex;
|
|
111
|
+
i++;
|
|
112
|
+
}
|
|
113
|
+
if (last < b.length) {
|
|
114
|
+
segs.push(b.slice(last));
|
|
115
|
+
}
|
|
116
|
+
if (!segs.some(function(it){
|
|
117
|
+
return typeof it === 'object';
|
|
118
|
+
})) {
|
|
119
|
+
return function(){
|
|
120
|
+
return b;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return function(t){
|
|
124
|
+
return segs.map(function(it){
|
|
125
|
+
if (typeof it === 'object') {
|
|
126
|
+
return it.a + (it.b - it.a) * t;
|
|
127
|
+
} else {
|
|
128
|
+
return it;
|
|
129
|
+
}
|
|
130
|
+
}).join('');
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
interpolate = function(a, b){
|
|
134
|
+
var cb, ca;
|
|
135
|
+
if (typeof b === 'number') {
|
|
136
|
+
a = parseFloat(a);
|
|
137
|
+
if (isNaN(a)) {
|
|
138
|
+
a = 0;
|
|
139
|
+
}
|
|
140
|
+
return function(t){
|
|
141
|
+
return a + (b - a) * t;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (!(a != null)) {
|
|
145
|
+
return function(){
|
|
146
|
+
return b;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (cb = color(b)) {
|
|
150
|
+
if (!(ca = color(a))) {
|
|
151
|
+
return function(){
|
|
152
|
+
return b;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return interpColor(ca, cb);
|
|
156
|
+
}
|
|
157
|
+
return interpString(a, b);
|
|
158
|
+
};
|
|
159
|
+
getV = function(node, k){
|
|
160
|
+
if (k.startsWith('style:')) {
|
|
161
|
+
return node.style.getPropertyValue(k.slice(6));
|
|
162
|
+
} else {
|
|
163
|
+
return node.getAttribute(k);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
setV = function(node, k, v){
|
|
167
|
+
if (k.startsWith('style:')) {
|
|
168
|
+
return node.style.setProperty(k.slice(6), v);
|
|
169
|
+
} else {
|
|
170
|
+
return node.setAttribute(k, v);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
rmV = function(node, k){
|
|
174
|
+
if (k.startsWith('style:')) {
|
|
175
|
+
return node.style.removeProperty(k.slice(6));
|
|
176
|
+
} else {
|
|
177
|
+
return node.removeAttribute(k);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
anim = function(opt){
|
|
181
|
+
var this$ = this;
|
|
182
|
+
opt == null && (opt = {});
|
|
183
|
+
this._manual = !!opt.manual;
|
|
184
|
+
this._now = 0;
|
|
185
|
+
this._offset = 0;
|
|
186
|
+
this._raf = null;
|
|
187
|
+
this._list = new Map();
|
|
188
|
+
this.evtHandler = {};
|
|
189
|
+
this._tick = function(t){
|
|
190
|
+
this$._raf = null;
|
|
191
|
+
if (this$._manual) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this$._apply(this$.time());
|
|
195
|
+
if (this$._list.size) {
|
|
196
|
+
return this$._kick();
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
return this;
|
|
200
|
+
};
|
|
201
|
+
anim.prototype = import$(Object.create(Object.prototype), {
|
|
202
|
+
on: function(n, cb){
|
|
203
|
+
var this$ = this;
|
|
204
|
+
return (Array.isArray(n)
|
|
205
|
+
? n
|
|
206
|
+
: [n]).map(function(n){
|
|
207
|
+
var ref$;
|
|
208
|
+
return ((ref$ = this$.evtHandler)[n] || (ref$[n] = [])).push(cb);
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
fire: function(n){
|
|
212
|
+
var v, res$, i$, to$, ref$, len$, cb, results$ = [];
|
|
213
|
+
res$ = [];
|
|
214
|
+
for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
|
|
215
|
+
res$.push(arguments[i$]);
|
|
216
|
+
}
|
|
217
|
+
v = res$;
|
|
218
|
+
for (i$ = 0, len$ = (ref$ = this.evtHandler[n] || []).length; i$ < len$; ++i$) {
|
|
219
|
+
cb = ref$[i$];
|
|
220
|
+
results$.push(cb.apply(this, v));
|
|
221
|
+
}
|
|
222
|
+
return results$;
|
|
223
|
+
},
|
|
224
|
+
time: function(){
|
|
225
|
+
if (this._manual) {
|
|
226
|
+
return this._now;
|
|
227
|
+
} else {
|
|
228
|
+
return now() - this._offset;
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
manual: function(v){
|
|
232
|
+
if (!arguments.length) {
|
|
233
|
+
return this._manual;
|
|
234
|
+
}
|
|
235
|
+
v = !!v;
|
|
236
|
+
if (v === this._manual) {
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
if (v) {
|
|
240
|
+
this._now = this.time();
|
|
241
|
+
this._manual = true;
|
|
242
|
+
if (this._raf) {
|
|
243
|
+
cancelAnimationFrame(this._raf);
|
|
244
|
+
}
|
|
245
|
+
this._raf = null;
|
|
246
|
+
} else {
|
|
247
|
+
this._offset = now() - this._now;
|
|
248
|
+
this._manual = false;
|
|
249
|
+
if (this._list.size) {
|
|
250
|
+
this._kick();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return this;
|
|
254
|
+
},
|
|
255
|
+
step: function(dt){
|
|
256
|
+
dt == null && (dt = 1000 / 60);
|
|
257
|
+
if (!this._manual) {
|
|
258
|
+
this.manual(true);
|
|
259
|
+
}
|
|
260
|
+
this._now += dt;
|
|
261
|
+
this._apply(this._now);
|
|
262
|
+
this.fire('step', this._now, dt);
|
|
263
|
+
return this;
|
|
264
|
+
},
|
|
265
|
+
seek: function(t){
|
|
266
|
+
if (!this._manual) {
|
|
267
|
+
this.manual(true);
|
|
268
|
+
}
|
|
269
|
+
this._now = t;
|
|
270
|
+
this._apply(this._now);
|
|
271
|
+
this.fire('step', this._now, 0);
|
|
272
|
+
return this;
|
|
273
|
+
},
|
|
274
|
+
busy: function(){
|
|
275
|
+
return this._list.size > 0;
|
|
276
|
+
},
|
|
277
|
+
flush: function(){
|
|
278
|
+
this._apply(Infinity);
|
|
279
|
+
return this;
|
|
280
|
+
},
|
|
281
|
+
interrupt: function(node){
|
|
282
|
+
return this._list['delete'](node);
|
|
283
|
+
},
|
|
284
|
+
_kick: function(){
|
|
285
|
+
var this$ = this;
|
|
286
|
+
if (this._manual || this._raf) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (!(typeof requestAnimationFrame != 'undefined' && requestAnimationFrame !== null)) {
|
|
290
|
+
return setTimeout(function(){
|
|
291
|
+
return this$._tick();
|
|
292
|
+
}, 16);
|
|
293
|
+
}
|
|
294
|
+
return this._raf = requestAnimationFrame(this._tick);
|
|
295
|
+
},
|
|
296
|
+
tween: function(node, attrs, opt){
|
|
297
|
+
var dur, delay, ez, immediate, item, start, k, v;
|
|
298
|
+
attrs == null && (attrs = {});
|
|
299
|
+
opt == null && (opt = {});
|
|
300
|
+
dur = opt.duration != null ? opt.duration : 350;
|
|
301
|
+
delay = opt.delay || 0;
|
|
302
|
+
ez = typeof opt.ease === 'function'
|
|
303
|
+
? opt.ease
|
|
304
|
+
: ease[opt.ease || 'cubic-in-out'] || ease.cubicInOut;
|
|
305
|
+
immediate = (dur <= 0 && delay <= 0) || (!this._manual && (typeof document != 'undefined' && document !== null) && document.hidden);
|
|
306
|
+
item = this._list.get(node) || {
|
|
307
|
+
attr: {},
|
|
308
|
+
cb: []
|
|
309
|
+
};
|
|
310
|
+
item.remove = !!opt.remove;
|
|
311
|
+
if (opt.end) {
|
|
312
|
+
item.cb.push(opt.end);
|
|
313
|
+
}
|
|
314
|
+
start = this.time() + delay;
|
|
315
|
+
for (k in attrs) {
|
|
316
|
+
v = attrs[k];
|
|
317
|
+
if (!(v != null)) {
|
|
318
|
+
rmV(node, k);
|
|
319
|
+
delete item.attr[k];
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (immediate) {
|
|
323
|
+
setV(node, k, typeof v === 'function' ? v(1) : v);
|
|
324
|
+
delete item.attr[k];
|
|
325
|
+
} else if (k.startsWith('style:') && !node.style.getPropertyValue(k.slice(6)) && window.getComputedStyle(node).getPropertyValue(k.slice(6)) === v + "") {
|
|
326
|
+
delete item.attr[k];
|
|
327
|
+
} else if (typeof v === 'function') {
|
|
328
|
+
item.attr[k] = {
|
|
329
|
+
fn: v,
|
|
330
|
+
start: start,
|
|
331
|
+
dur: dur > 0 ? dur : 0,
|
|
332
|
+
ease: ez
|
|
333
|
+
};
|
|
334
|
+
} else {
|
|
335
|
+
item.attr[k] = {
|
|
336
|
+
to: v,
|
|
337
|
+
start: start,
|
|
338
|
+
dur: dur > 0 ? dur : 0,
|
|
339
|
+
ease: ez
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
this._list.set(node, item);
|
|
344
|
+
if (immediate && !(function(){
|
|
345
|
+
var results$ = [];
|
|
346
|
+
for (k in item.attr) {
|
|
347
|
+
results$.push(k);
|
|
348
|
+
}
|
|
349
|
+
return results$;
|
|
350
|
+
}()).length) {
|
|
351
|
+
this._done(node, item);
|
|
352
|
+
} else if (!this._manual) {
|
|
353
|
+
this._kick();
|
|
354
|
+
}
|
|
355
|
+
return this;
|
|
356
|
+
},
|
|
357
|
+
_done: function(node, item){
|
|
358
|
+
this._list['delete'](node);
|
|
359
|
+
if (item.remove && node.parentNode) {
|
|
360
|
+
node.parentNode.removeChild(node);
|
|
361
|
+
}
|
|
362
|
+
return item.cb.map(function(it){
|
|
363
|
+
return it.call(node);
|
|
364
|
+
});
|
|
365
|
+
},
|
|
366
|
+
_apply: function(t){
|
|
367
|
+
var i$, ref$, len$, ref1$, node, item, k, a, p, ref2$, results$ = [];
|
|
368
|
+
for (i$ = 0, len$ = (ref$ = Array.from(this._list)).length; i$ < len$; ++i$) {
|
|
369
|
+
ref1$ = ref$[i$], node = ref1$[0], item = ref1$[1];
|
|
370
|
+
if (this._list.get(node) !== item) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
for (k in ref1$ = item.attr) {
|
|
374
|
+
a = ref1$[k];
|
|
375
|
+
if (t < a.start) {
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
if (a.fn) {
|
|
379
|
+
p = a.dur ? (ref2$ = (t - a.start) / a.dur) < 1 ? ref2$ : 1 : 1;
|
|
380
|
+
setV(node, k, a.fn(p >= 1
|
|
381
|
+
? 1
|
|
382
|
+
: a.ease(p)));
|
|
383
|
+
if (p >= 1) {
|
|
384
|
+
delete item.attr[k];
|
|
385
|
+
}
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (!a.interp) {
|
|
389
|
+
a.interp = interpolate(getV(node, k), a.to);
|
|
390
|
+
}
|
|
391
|
+
p = a.dur ? (ref2$ = (t - a.start) / a.dur) < 1 ? ref2$ : 1 : 1;
|
|
392
|
+
if (p >= 1) {
|
|
393
|
+
setV(node, k, a.to);
|
|
394
|
+
delete item.attr[k];
|
|
395
|
+
} else {
|
|
396
|
+
setV(node, k, a.interp(a.ease(p)));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!(fn$()).length) {
|
|
400
|
+
results$.push(this._done(node, item));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return results$;
|
|
404
|
+
function fn$(){
|
|
405
|
+
var results$ = [];
|
|
406
|
+
for (k in item.attr) {
|
|
407
|
+
results$.push(k);
|
|
408
|
+
}
|
|
409
|
+
return results$;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
join = function(arg$){
|
|
414
|
+
var root, tag, ref$, cls, data, key, olds, map, enter, update, nodes, exit, nx, i$, i, n;
|
|
415
|
+
root = arg$.root, tag = (ref$ = arg$.tag) != null ? ref$ : 'g', cls = arg$.cls, data = (ref$ = arg$.data) != null
|
|
416
|
+
? ref$
|
|
417
|
+
: [], key = arg$.key;
|
|
418
|
+
key = key || function(d, i){
|
|
419
|
+
return i;
|
|
420
|
+
};
|
|
421
|
+
olds = Array.from(root.childNodes).filter(function(n){
|
|
422
|
+
return n.nodeType === 1 && n.tagName === tag && (!cls || n.classList.contains(cls));
|
|
423
|
+
});
|
|
424
|
+
map = new Map();
|
|
425
|
+
ref$ = [[], [], [], []], enter = ref$[0], update = ref$[1], nodes = ref$[2], exit = ref$[3];
|
|
426
|
+
olds.map(function(n, i){
|
|
427
|
+
var k;
|
|
428
|
+
k = key(n.__data__, i);
|
|
429
|
+
if (map.has(k)) {
|
|
430
|
+
return exit.push(n);
|
|
431
|
+
} else {
|
|
432
|
+
return map.set(k, n);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
data.map(function(d, i){
|
|
436
|
+
var k, n;
|
|
437
|
+
k = key(d, i);
|
|
438
|
+
if (n = map.get(k)) {
|
|
439
|
+
map['delete'](k);
|
|
440
|
+
update.push(n);
|
|
441
|
+
} else {
|
|
442
|
+
n = document.createElementNS(svgns, tag);
|
|
443
|
+
if (cls) {
|
|
444
|
+
n.setAttribute('class', cls);
|
|
445
|
+
}
|
|
446
|
+
n._entering = true;
|
|
447
|
+
enter.push(n);
|
|
448
|
+
}
|
|
449
|
+
n.__data__ = d;
|
|
450
|
+
return nodes.push(n);
|
|
451
|
+
});
|
|
452
|
+
nx = null;
|
|
453
|
+
for (i$ = nodes.length - 1; i$ >= 0; --i$) {
|
|
454
|
+
i = i$;
|
|
455
|
+
n = nodes[i];
|
|
456
|
+
if (!n._entering) {
|
|
457
|
+
nx = n;
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
delete n._entering;
|
|
461
|
+
root.insertBefore(n, nx);
|
|
462
|
+
nx = n;
|
|
463
|
+
}
|
|
464
|
+
exit = exit.concat(Array.from(map.values()));
|
|
465
|
+
return {
|
|
466
|
+
enter: enter,
|
|
467
|
+
update: update,
|
|
468
|
+
exit: exit,
|
|
469
|
+
nodes: nodes
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
anim.ease = ease;
|
|
473
|
+
anim.interpolate = interpolate;
|
|
474
|
+
anim.join = join;
|
|
475
|
+
if (typeof chart != 'undefined' && chart !== null) {
|
|
476
|
+
(chart.utils || (chart.utils = {})).anim = anim;
|
|
477
|
+
}
|
|
478
|
+
function import$(obj, src){
|
|
479
|
+
var own = {}.hasOwnProperty;
|
|
480
|
+
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|
|
481
|
+
return obj;
|
|
482
|
+
}
|
|
483
|
+
}).call(this);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){var n,f,l,i,u,a,h,p,_,d,t,e;n=function(){return("undefined"!=typeof performance&&null!==performance?performance:Date).now()},f={linear:function(t){return t},cubicInOut:function(t){return(t*=2)<=1?t*t*t/2:((t-=2)*t*t+2)/2},cubicOut:function(t){return--t*t*t+1},quadInOut:function(t){return(t*=2)<=1?t*t/2:(--t*(2-t)+1)/2}},l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,i=function(t){var n,e;return"string"!=typeof t?null:(t=t.trim(),(n=/^#([0-9a-f]{3,4})$/i.exec(t))?[(e=n[1].split("").map(function(t){return parseInt(t+t,16)}))[0],e[1],e[2],null!=e[3]?e[3]/255:1]:(n=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t))?(e=[0,1,2].map(function(t){return parseInt(n[1].substr(2*t,2),16)})).concat([n[2]?parseInt(n[2],16)/255:1]):!(n=/^rgba?\(([^)]+)\)$/i.exec(t))||(e=n[1].split(/[\s,\/]+/).filter(function(t){return t}).map(function(t){return parseFloat(t)})).length<3||e.slice(0,3).some(function(t){return isNaN(t)})?null:[e[0],e[1],e[2],null==e[3]||isNaN(e[3])?1:e[3]])},u=function(a,s){return function(n){var t=[0,1,2,3].map(function(t){return a[t]+(s[t]-a[t])*n}),e=t[0],r=t[1],i=t[2],u=t[3];return e=(t=[e,r,i].map(function(t){return(t=0<(t=Math.round(t))?t:0)<255?t:255}))[0],r=t[1],i=t[2],1===(u=!isNaN(u)&&(t=0<u?u:0)<1?t:1)?"rgb("+e+", "+r+", "+i+")":"rgba("+e+", "+r+", "+i+", "+u+")"}},a=function(t,n){var e,r,i,u,a,s,o;for(n+="",e=(t+="").match(l)||[],r=[],l.lastIndex=u=i=0;a=l.exec(n);)a.index>i&&r.push(n.slice(i,a.index)),s=+a[0],o=null!=e[u]?+e[u]:null,r.push(null!=o&&o!==s?{a:o,b:s}:a[0]),i=l.lastIndex,u++;return i<n.length&&r.push(n.slice(i)),r.some(function(t){return"object"==typeof t})?function(n){return r.map(function(t){return"object"==typeof t?t.a+(t.b-t.a)*n:t}).join("")}:function(){return n}},h=function(n,e){var t,r;return"number"==typeof e?(n=parseFloat(n),isNaN(n)&&(n=0),function(t){return n+(e-n)*t}):null==n?function(){return e}:(t=i(e))?(r=i(n))?u(r,t):function(){return e}:a(n,e)},p=function(t,n){return n.startsWith("style:")?t.style.getPropertyValue(n.slice(6)):t.getAttribute(n)},_=function(t,n,e){return n.startsWith("style:")?t.style.setProperty(n.slice(6),e):t.setAttribute(n,e)},d=function(t,n){return n.startsWith("style:")?t.style.removeProperty(n.slice(6)):t.removeAttribute(n)},(t=function(t){var n=this;return this._manual=!!(t=null==t?{}:t).manual,this._now=0,this._offset=0,this._raf=null,this._list=new Map,this.evtHandler={},this._tick=function(t){if(n._raf=null,!n._manual)return n._apply(n.time()),n._list.size?n._kick():void 0},this}).prototype=((t,n)=>{var e,r={}.hasOwnProperty;for(e in n)r.call(n,e)&&(t[e]=n[e]);return t})(Object.create(Object.prototype),{on:function(t,e){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var n;return((n=r.evtHandler)[t]||(n[t]=[])).push(e)})},fire:function(t){for(var n,e,r,i,u=[],a=[],s=1,o=arguments.length;s<o;++s)a.push(arguments[s]);for(n=a,s=0,r=(e=this.evtHandler[t]||[]).length;s<r;++s)i=e[s],u.push(i.apply(this,n));return u},time:function(){return this._manual?this._now:n()-this._offset},manual:function(t){return arguments.length?((t=!!t)!==this._manual&&(t?(this._now=this.time(),this._manual=!0,this._raf&&cancelAnimationFrame(this._raf),this._raf=null):(this._offset=n()-this._now,this._manual=!1,this._list.size&&this._kick())),this):this._manual},step:function(t){return null==t&&(t=1e3/60),this._manual||this.manual(!0),this._now+=t,this._apply(this._now),this.fire("step",this._now,t),this},seek:function(t){return this._manual||this.manual(!0),this._now=t,this._apply(this._now),this.fire("step",this._now,0),this},busy:function(){return 0<this._list.size},flush:function(){return this._apply(1/0),this},interrupt:function(t){return this._list.delete(t)},_kick:function(){var t=this;if(!this._manual&&!this._raf)return"undefined"==typeof requestAnimationFrame||null===requestAnimationFrame?setTimeout(function(){return t._tick()},16):this._raf=requestAnimationFrame(this._tick)},tween:function(t,n,e){var r,i,u,a,s,o,l,c;for(l in null==n&&(n={}),r=null!=(e=null==e?{}:e).duration?e.duration:350,i=e.delay||0,u="function"==typeof e.ease?e.ease:f[e.ease||"cubic-in-out"]||f.cubicInOut,a=r<=0&&i<=0||!this._manual&&"undefined"!=typeof document&&null!==document&&document.hidden,(s=this._list.get(t)||{attr:{},cb:[]}).remove=!!e.remove,e.end&&s.cb.push(e.end),o=this.time()+i,n)null==(c=n[l])?(d(t,l),delete s.attr[l]):a?(_(t,l,"function"==typeof c?c(1):c),delete s.attr[l]):l.startsWith("style:")&&!t.style.getPropertyValue(l.slice(6))&&window.getComputedStyle(t).getPropertyValue(l.slice(6))===c+""?delete s.attr[l]:s.attr[l]="function"==typeof c?{fn:c,start:o,dur:0<r?r:0,ease:u}:{to:c,start:o,dur:0<r?r:0,ease:u};return this._list.set(t,s),a&&!(()=>{var t=[];for(l in s.attr)t.push(l);return t})().length?this._done(t,s):this._manual||this._kick(),this},_done:function(n,t){return this._list.delete(n),t.remove&&n.parentNode&&n.parentNode.removeChild(n),t.cb.map(function(t){return t.call(n)})},_apply:function(t){for(var n,e,r,i,u,a,s,o,l=[],c=0,f=(n=Array.from(this._list)).length;c<f;++c)if(r=(e=n[c])[0],i=e[1],this._list.get(r)===i){for(u in e=i.attr)t<(a=e[u]).start||(a.fn?(s=a.dur&&(o=(t-a.start)/a.dur)<1?o:1,_(r,u,a.fn(1<=s?1:a.ease(s))),1<=s&&delete i.attr[u]):(a.interp||(a.interp=h(p(r,u),a.to)),1<=(s=a.dur&&(o=(t-a.start)/a.dur)<1?o:1)?(_(r,u,a.to),delete i.attr[u]):_(r,u,a.interp(a.ease(s)))));(()=>{var t=[];for(u in i.attr)t.push(u);return t})().length||l.push(this._done(r,i))}return l}}),e=function(t){var n,r,i,u,a,e,s,o,l,c=t.root,f=null!=(n=t.tag)?n:"g",h=t.cls,p=null!=(n=t.data)?n:[],_=t.key;for(_=_||function(t,n){return n},t=Array.from(c.childNodes).filter(function(t){return 1===t.nodeType&&t.tagName===f&&(!h||t.classList.contains(h))}),r=new Map,i=(n=[[],[],[],[]])[0],u=n[1],a=n[2],e=n[3],t.map(function(t,n){n=_(t.__data__,n);return r.has(n)?e.push(t):r.set(n,t)}),p.map(function(t,n){var e,n=_(t,n);return((e=r.get(n))?(r.delete(n),u):(e=document.createElementNS("http://www.w3.org/2000/svg",f),h&&e.setAttribute("class",h),e._entering=!0,i)).push(e),e.__data__=t,a.push(e)}),s=null,o=a.length-1;0<=o;--o)s=((l=a[o])._entering&&(delete l._entering,c.insertBefore(l,s)),l);return e=e.concat(Array.from(r.values())),{enter:i,update:u,exit:e,nodes:a}},t.ease=f,t.interpolate=h,t.join=e,"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).anim=t)}.call(this);
|