Total Complexity | 873 |
Complexity/F | 1.98 |
Lines of Code | 3193 |
Function Count | 442 |
Duplicated Lines | 3193 |
Ratio | 100 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like demo/hill-chart.umd.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | View Code Duplication | !(function (t, n) { |
|
|
|||
2 | 'object' == typeof exports && 'undefined' != typeof module |
||
3 | ? (module.exports = n()) |
||
4 | : 'function' == typeof define && define.amd |
||
5 | ? define(n) |
||
6 | : ((t = t || self).HillChart = n()); |
||
7 | })(this, function () { |
||
8 | 'use strict'; |
||
9 | function t(t, n) { |
||
10 | for (var e = 0; e < n.length; e++) { |
||
11 | var r = n[e]; |
||
12 | (r.enumerable = r.enumerable || !1), |
||
13 | (r.configurable = !0), |
||
14 | 'value' in r && (r.writable = !0), |
||
15 | Object.defineProperty(t, r.key, r); |
||
16 | } |
||
17 | } |
||
18 | function n(t, n, e) { |
||
19 | return ( |
||
20 | n in t |
||
21 | ? Object.defineProperty(t, n, { |
||
22 | value: e, |
||
23 | enumerable: !0, |
||
24 | configurable: !0, |
||
25 | writable: !0, |
||
26 | }) |
||
27 | : (t[n] = e), |
||
28 | t |
||
29 | ); |
||
30 | } |
||
31 | function e(t, n) { |
||
32 | var e = Object.keys(t); |
||
33 | if (Object.getOwnPropertySymbols) { |
||
34 | var r = Object.getOwnPropertySymbols(t); |
||
35 | n && |
||
36 | (r = r.filter(function (n) { |
||
37 | return Object.getOwnPropertyDescriptor(t, n).enumerable; |
||
38 | })), |
||
39 | e.push.apply(e, r); |
||
40 | } |
||
41 | return e; |
||
42 | } |
||
43 | function r(t) { |
||
44 | for (var r = 1; r < arguments.length; r++) { |
||
45 | var i = null != arguments[r] ? arguments[r] : {}; |
||
46 | r % 2 |
||
47 | ? e(Object(i), !0).forEach(function (e) { |
||
48 | n(t, e, i[e]); |
||
49 | }) |
||
50 | : Object.getOwnPropertyDescriptors |
||
51 | ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) |
||
52 | : e(Object(i)).forEach(function (n) { |
||
53 | Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(i, n)); |
||
54 | }); |
||
55 | } |
||
56 | return t; |
||
57 | } |
||
58 | function i(t) { |
||
59 | return (i = Object.setPrototypeOf |
||
60 | ? Object.getPrototypeOf |
||
61 | : function (t) { |
||
62 | return t.__proto__ || Object.getPrototypeOf(t); |
||
63 | })(t); |
||
64 | } |
||
65 | function o(t, n) { |
||
66 | return (o = |
||
67 | Object.setPrototypeOf || |
||
68 | function (t, n) { |
||
69 | return (t.__proto__ = n), t; |
||
70 | })(t, n); |
||
71 | } |
||
72 | function a(t) { |
||
73 | if (void 0 === t) |
||
74 | throw new ReferenceError( |
||
75 | "this hasn't been initialised - super() hasn't been called" |
||
76 | ); |
||
77 | return t; |
||
78 | } |
||
79 | function u(t, n) { |
||
80 | return !n || ('object' != typeof n && 'function' != typeof n) ? a(t) : n; |
||
81 | } |
||
82 | function s(t) { |
||
83 | var n = (function () { |
||
84 | if ('undefined' == typeof Reflect || !Reflect.construct) return !1; |
||
85 | if (Reflect.construct.sham) return !1; |
||
86 | if ('function' == typeof Proxy) return !0; |
||
87 | try { |
||
88 | return ( |
||
89 | Date.prototype.toString.call( |
||
90 | Reflect.construct(Date, [], function () {}) |
||
91 | ), |
||
92 | !0 |
||
93 | ); |
||
94 | } catch (t) { |
||
95 | return !1; |
||
96 | } |
||
97 | })(); |
||
98 | return function () { |
||
99 | var e, |
||
100 | r = i(t); |
||
101 | if (n) { |
||
102 | var o = i(this).constructor; |
||
103 | e = Reflect.construct(r, arguments, o); |
||
104 | } else e = r.apply(this, arguments); |
||
105 | return u(this, e); |
||
106 | }; |
||
107 | } |
||
108 | var c = (function () { |
||
109 | function t(t, n) { |
||
110 | for (var e = 0; e < n.length; e++) { |
||
111 | var r = n[e]; |
||
112 | (r.enumerable = r.enumerable || !1), |
||
113 | (r.configurable = !0), |
||
114 | 'value' in r && (r.writable = !0), |
||
115 | Object.defineProperty(t, r.key, r); |
||
116 | } |
||
117 | } |
||
118 | return function (n, e, r) { |
||
119 | return e && t(n.prototype, e), r && t(n, r), n; |
||
120 | }; |
||
121 | })(); |
||
122 | function l(t, n) { |
||
123 | if (!(t instanceof n)) |
||
124 | throw new TypeError('Cannot call a class as a function'); |
||
125 | } |
||
126 | var h = { emitDelay: 10, strictMode: !1 }, |
||
127 | f = (function () { |
||
128 | function t() { |
||
129 | var n = |
||
130 | arguments.length <= 0 || void 0 === arguments[0] ? h : arguments[0]; |
||
131 | l(this, t); |
||
132 | var e = void 0, |
||
133 | r = void 0; |
||
134 | (e = n.hasOwnProperty('emitDelay') ? n.emitDelay : h.emitDelay), |
||
135 | (this._emitDelay = e), |
||
136 | (r = n.hasOwnProperty('strictMode') ? n.strictMode : h.strictMode), |
||
137 | (this._strictMode = r), |
||
138 | (this._listeners = {}), |
||
139 | (this.events = []); |
||
140 | } |
||
141 | return ( |
||
142 | c(t, [ |
||
143 | { |
||
144 | key: '_addListenner', |
||
145 | value: function (t, n, e) { |
||
146 | if ('function' != typeof n) |
||
147 | throw TypeError('listener must be a function'); |
||
148 | -1 === this.events.indexOf(t) |
||
149 | ? ((this._listeners[t] = [{ once: e, fn: n }]), |
||
150 | this.events.push(t)) |
||
151 | : this._listeners[t].push({ once: e, fn: n }); |
||
152 | }, |
||
153 | }, |
||
154 | { |
||
155 | key: 'on', |
||
156 | value: function (t, n) { |
||
157 | this._addListenner(t, n, !1); |
||
158 | }, |
||
159 | }, |
||
160 | { |
||
161 | key: 'once', |
||
162 | value: function (t, n) { |
||
163 | this._addListenner(t, n, !0); |
||
164 | }, |
||
165 | }, |
||
166 | { |
||
167 | key: 'off', |
||
168 | value: function (t, n) { |
||
169 | var e, |
||
170 | r, |
||
171 | i = this, |
||
172 | o = this.events.indexOf(t); |
||
173 | t && |
||
174 | -1 !== o && |
||
175 | (n |
||
176 | ? ((e = []), |
||
177 | (r = i._listeners[t]).forEach(function (t, r) { |
||
178 | t.fn === n && e.unshift(r); |
||
179 | }), |
||
180 | e.forEach(function (t) { |
||
181 | r.splice(t, 1); |
||
182 | }), |
||
183 | r.length || (i.events.splice(o, 1), delete i._listeners[t])) |
||
184 | : (delete this._listeners[t], this.events.splice(o, 1))); |
||
185 | }, |
||
186 | }, |
||
187 | { |
||
188 | key: '_applyEvents', |
||
189 | value: function (t, n) { |
||
190 | var e = this._listeners[t]; |
||
191 | if (e && e.length) { |
||
192 | var r = []; |
||
193 | e.forEach(function (t, e) { |
||
194 | t.fn.apply(null, n), t.once && r.unshift(e); |
||
195 | }), |
||
196 | r.forEach(function (t) { |
||
197 | e.splice(t, 1); |
||
198 | }); |
||
199 | } else if (this._strictMode) |
||
200 | throw 'No listeners specified for event: ' + t; |
||
201 | }, |
||
202 | }, |
||
203 | { |
||
204 | key: 'emit', |
||
205 | value: function (t) { |
||
206 | for ( |
||
207 | var n = this, |
||
208 | e = arguments.length, |
||
209 | r = Array(e > 1 ? e - 1 : 0), |
||
210 | i = 1; |
||
211 | i < e; |
||
212 | i++ |
||
213 | ) |
||
214 | r[i - 1] = arguments[i]; |
||
215 | this._emitDelay |
||
216 | ? setTimeout(function () { |
||
217 | n._applyEvents.call(n, t, r); |
||
218 | }, this._emitDelay) |
||
219 | : this._applyEvents(t, r); |
||
220 | }, |
||
221 | }, |
||
222 | { |
||
223 | key: 'emitSync', |
||
224 | value: function (t) { |
||
225 | for ( |
||
226 | var n = arguments.length, e = Array(n > 1 ? n - 1 : 0), r = 1; |
||
227 | r < n; |
||
228 | r++ |
||
229 | ) |
||
230 | e[r - 1] = arguments[r]; |
||
231 | this._applyEvents(t, e); |
||
232 | }, |
||
233 | }, |
||
234 | { |
||
235 | key: 'destroy', |
||
236 | value: function () { |
||
237 | (this._listeners = {}), (this.events = []); |
||
238 | }, |
||
239 | }, |
||
240 | ]), |
||
241 | t |
||
242 | ); |
||
243 | })(), |
||
244 | p = 'http://www.w3.org/1999/xhtml', |
||
245 | d = { |
||
246 | svg: 'http://www.w3.org/2000/svg', |
||
247 | xhtml: p, |
||
248 | xlink: 'http://www.w3.org/1999/xlink', |
||
249 | xml: 'http://www.w3.org/XML/1998/namespace', |
||
250 | xmlns: 'http://www.w3.org/2000/xmlns/', |
||
251 | }; |
||
252 | function g(t) { |
||
253 | var n = (t += ''), |
||
254 | e = n.indexOf(':'); |
||
255 | return ( |
||
256 | e >= 0 && 'xmlns' !== (n = t.slice(0, e)) && (t = t.slice(e + 1)), |
||
257 | d.hasOwnProperty(n) ? { space: d[n], local: t } : t |
||
258 | ); |
||
259 | } |
||
260 | function y(t) { |
||
261 | return function () { |
||
262 | var n = this.ownerDocument, |
||
263 | e = this.namespaceURI; |
||
264 | return e === p && n.documentElement.namespaceURI === p |
||
265 | ? n.createElement(t) |
||
266 | : n.createElementNS(e, t); |
||
267 | }; |
||
268 | } |
||
269 | function v(t) { |
||
270 | return function () { |
||
271 | return this.ownerDocument.createElementNS(t.space, t.local); |
||
272 | }; |
||
273 | } |
||
274 | function m(t) { |
||
275 | var n = g(t); |
||
276 | return (n.local ? v : y)(n); |
||
277 | } |
||
278 | function _() {} |
||
279 | function w(t) { |
||
280 | return null == t |
||
281 | ? _ |
||
282 | : function () { |
||
283 | return this.querySelector(t); |
||
284 | }; |
||
285 | } |
||
286 | function x() { |
||
287 | return []; |
||
288 | } |
||
289 | function b(t) { |
||
290 | return new Array(t.length); |
||
291 | } |
||
292 | function M(t, n) { |
||
293 | (this.ownerDocument = t.ownerDocument), |
||
294 | (this.namespaceURI = t.namespaceURI), |
||
295 | (this._next = null), |
||
296 | (this._parent = t), |
||
297 | (this.__data__ = n); |
||
298 | } |
||
299 | M.prototype = { |
||
300 | constructor: M, |
||
301 | appendChild: function (t) { |
||
302 | return this._parent.insertBefore(t, this._next); |
||
303 | }, |
||
304 | insertBefore: function (t, n) { |
||
305 | return this._parent.insertBefore(t, n); |
||
306 | }, |
||
307 | querySelector: function (t) { |
||
308 | return this._parent.querySelector(t); |
||
309 | }, |
||
310 | querySelectorAll: function (t) { |
||
311 | return this._parent.querySelectorAll(t); |
||
312 | }, |
||
313 | }; |
||
314 | function k(t, n, e, r, i, o) { |
||
315 | for (var a, u = 0, s = n.length, c = o.length; u < c; ++u) |
||
316 | (a = n[u]) ? ((a.__data__ = o[u]), (r[u] = a)) : (e[u] = new M(t, o[u])); |
||
317 | for (; u < s; ++u) (a = n[u]) && (i[u] = a); |
||
318 | } |
||
319 | function N(t, n, e, r, i, o, a) { |
||
320 | var u, |
||
321 | s, |
||
322 | c, |
||
323 | l = {}, |
||
324 | h = n.length, |
||
325 | f = o.length, |
||
326 | p = new Array(h); |
||
327 | for (u = 0; u < h; ++u) |
||
328 | (s = n[u]) && |
||
329 | ((p[u] = c = '$' + a.call(s, s.__data__, u, n)), |
||
330 | c in l ? (i[u] = s) : (l[c] = s)); |
||
331 | for (u = 0; u < f; ++u) |
||
332 | (s = l[(c = '$' + a.call(t, o[u], u, o))]) |
||
333 | ? ((r[u] = s), (s.__data__ = o[u]), (l[c] = null)) |
||
334 | : (e[u] = new M(t, o[u])); |
||
335 | for (u = 0; u < h; ++u) (s = n[u]) && l[p[u]] === s && (i[u] = s); |
||
336 | } |
||
337 | function S(t, n) { |
||
338 | return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN; |
||
339 | } |
||
340 | function A(t) { |
||
341 | return function () { |
||
342 | this.removeAttribute(t); |
||
343 | }; |
||
344 | } |
||
345 | function E(t) { |
||
346 | return function () { |
||
347 | this.removeAttributeNS(t.space, t.local); |
||
348 | }; |
||
349 | } |
||
350 | function P(t, n) { |
||
351 | return function () { |
||
352 | this.setAttribute(t, n); |
||
353 | }; |
||
354 | } |
||
355 | function O(t, n) { |
||
356 | return function () { |
||
357 | this.setAttributeNS(t.space, t.local, n); |
||
358 | }; |
||
359 | } |
||
360 | function j(t, n) { |
||
361 | return function () { |
||
362 | var e = n.apply(this, arguments); |
||
363 | null == e ? this.removeAttribute(t) : this.setAttribute(t, e); |
||
364 | }; |
||
365 | } |
||
366 | function T(t, n) { |
||
367 | return function () { |
||
368 | var e = n.apply(this, arguments); |
||
369 | null == e |
||
370 | ? this.removeAttributeNS(t.space, t.local) |
||
371 | : this.setAttributeNS(t.space, t.local, e); |
||
372 | }; |
||
373 | } |
||
374 | function C(t) { |
||
375 | return ( |
||
376 | (t.ownerDocument && t.ownerDocument.defaultView) || |
||
377 | (t.document && t) || |
||
378 | t.defaultView |
||
379 | ); |
||
380 | } |
||
381 | function L(t) { |
||
382 | return function () { |
||
383 | this.style.removeProperty(t); |
||
384 | }; |
||
385 | } |
||
386 | function z(t, n, e) { |
||
387 | return function () { |
||
388 | this.style.setProperty(t, n, e); |
||
389 | }; |
||
390 | } |
||
391 | function D(t, n, e) { |
||
392 | return function () { |
||
393 | var r = n.apply(this, arguments); |
||
394 | null == r |
||
395 | ? this.style.removeProperty(t) |
||
396 | : this.style.setProperty(t, r, e); |
||
397 | }; |
||
398 | } |
||
399 | function q(t, n) { |
||
400 | return ( |
||
401 | t.style.getPropertyValue(n) || |
||
402 | C(t).getComputedStyle(t, null).getPropertyValue(n) |
||
403 | ); |
||
404 | } |
||
405 | function R(t) { |
||
406 | return function () { |
||
407 | delete this[t]; |
||
408 | }; |
||
409 | } |
||
410 | function H(t, n) { |
||
411 | return function () { |
||
412 | this[t] = n; |
||
413 | }; |
||
414 | } |
||
415 | function I(t, n) { |
||
416 | return function () { |
||
417 | var e = n.apply(this, arguments); |
||
418 | null == e ? delete this[t] : (this[t] = e); |
||
419 | }; |
||
420 | } |
||
421 | function V(t) { |
||
422 | return t.trim().split(/^|\s+/); |
||
423 | } |
||
424 | function $(t) { |
||
425 | return t.classList || new B(t); |
||
426 | } |
||
427 | function B(t) { |
||
428 | (this._node = t), (this._names = V(t.getAttribute('class') || '')); |
||
429 | } |
||
430 | function F(t, n) { |
||
431 | for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.add(n[r]); |
||
432 | } |
||
433 | function U(t, n) { |
||
434 | for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.remove(n[r]); |
||
435 | } |
||
436 | function X(t) { |
||
437 | return function () { |
||
438 | F(this, t); |
||
439 | }; |
||
440 | } |
||
441 | function W(t) { |
||
442 | return function () { |
||
443 | U(this, t); |
||
444 | }; |
||
445 | } |
||
446 | function Y(t, n) { |
||
447 | return function () { |
||
448 | (n.apply(this, arguments) ? F : U)(this, t); |
||
449 | }; |
||
450 | } |
||
451 | function G() { |
||
452 | this.textContent = ''; |
||
453 | } |
||
454 | function Z(t) { |
||
455 | return function () { |
||
456 | this.textContent = t; |
||
457 | }; |
||
458 | } |
||
459 | function K(t) { |
||
460 | return function () { |
||
461 | var n = t.apply(this, arguments); |
||
462 | this.textContent = null == n ? '' : n; |
||
463 | }; |
||
464 | } |
||
465 | function Q() { |
||
466 | this.innerHTML = ''; |
||
467 | } |
||
468 | function J(t) { |
||
469 | return function () { |
||
470 | this.innerHTML = t; |
||
471 | }; |
||
472 | } |
||
473 | function tt(t) { |
||
474 | return function () { |
||
475 | var n = t.apply(this, arguments); |
||
476 | this.innerHTML = null == n ? '' : n; |
||
477 | }; |
||
478 | } |
||
479 | function nt() { |
||
480 | this.nextSibling && this.parentNode.appendChild(this); |
||
481 | } |
||
482 | function et() { |
||
483 | this.previousSibling && |
||
484 | this.parentNode.insertBefore(this, this.parentNode.firstChild); |
||
485 | } |
||
486 | function rt() { |
||
487 | return null; |
||
488 | } |
||
489 | function it() { |
||
490 | var t = this.parentNode; |
||
491 | t && t.removeChild(this); |
||
492 | } |
||
493 | function ot() { |
||
494 | var t = this.cloneNode(!1), |
||
495 | n = this.parentNode; |
||
496 | return n ? n.insertBefore(t, this.nextSibling) : t; |
||
497 | } |
||
498 | function at() { |
||
499 | var t = this.cloneNode(!0), |
||
500 | n = this.parentNode; |
||
501 | return n ? n.insertBefore(t, this.nextSibling) : t; |
||
502 | } |
||
503 | B.prototype = { |
||
504 | add: function (t) { |
||
505 | this._names.indexOf(t) < 0 && |
||
506 | (this._names.push(t), |
||
507 | this._node.setAttribute('class', this._names.join(' '))); |
||
508 | }, |
||
509 | remove: function (t) { |
||
510 | var n = this._names.indexOf(t); |
||
511 | n >= 0 && |
||
512 | (this._names.splice(n, 1), |
||
513 | this._node.setAttribute('class', this._names.join(' '))); |
||
514 | }, |
||
515 | contains: function (t) { |
||
516 | return this._names.indexOf(t) >= 0; |
||
517 | }, |
||
518 | }; |
||
519 | var ut = {}, |
||
520 | st = null; |
||
521 | 'undefined' != typeof document && |
||
522 | ('onmouseenter' in document.documentElement || |
||
523 | (ut = { mouseenter: 'mouseover', mouseleave: 'mouseout' })); |
||
524 | function ct(t, n, e) { |
||
525 | return ( |
||
526 | (t = lt(t, n, e)), |
||
527 | function (n) { |
||
528 | var e = n.relatedTarget; |
||
529 | (e && (e === this || 8 & e.compareDocumentPosition(this))) || |
||
530 | t.call(this, n); |
||
531 | } |
||
532 | ); |
||
533 | } |
||
534 | function lt(t, n, e) { |
||
535 | return function (r) { |
||
536 | var i = st; |
||
537 | st = r; |
||
538 | try { |
||
539 | t.call(this, this.__data__, n, e); |
||
540 | } finally { |
||
541 | st = i; |
||
542 | } |
||
543 | }; |
||
544 | } |
||
545 | function ht(t) { |
||
546 | return t |
||
547 | .trim() |
||
548 | .split(/^|\s+/) |
||
549 | .map(function (t) { |
||
550 | var n = '', |
||
551 | e = t.indexOf('.'); |
||
552 | return ( |
||
553 | e >= 0 && ((n = t.slice(e + 1)), (t = t.slice(0, e))), |
||
554 | { type: t, name: n } |
||
555 | ); |
||
556 | }); |
||
557 | } |
||
558 | function ft(t) { |
||
559 | return function () { |
||
560 | var n = this.__on; |
||
561 | if (n) { |
||
562 | for (var e, r = 0, i = -1, o = n.length; r < o; ++r) |
||
563 | (e = n[r]), |
||
564 | (t.type && e.type !== t.type) || e.name !== t.name |
||
565 | ? (n[++i] = e) |
||
566 | : this.removeEventListener(e.type, e.listener, e.capture); |
||
567 | ++i ? (n.length = i) : delete this.__on; |
||
568 | } |
||
569 | }; |
||
570 | } |
||
571 | function pt(t, n, e) { |
||
572 | var r = ut.hasOwnProperty(t.type) ? ct : lt; |
||
573 | return function (i, o, a) { |
||
574 | var u, |
||
575 | s = this.__on, |
||
576 | c = r(n, o, a); |
||
577 | if (s) |
||
578 | for (var l = 0, h = s.length; l < h; ++l) |
||
579 | if ((u = s[l]).type === t.type && u.name === t.name) |
||
580 | return ( |
||
581 | this.removeEventListener(u.type, u.listener, u.capture), |
||
582 | this.addEventListener(u.type, (u.listener = c), (u.capture = e)), |
||
583 | void (u.value = n) |
||
584 | ); |
||
585 | this.addEventListener(t.type, c, e), |
||
586 | (u = { type: t.type, name: t.name, value: n, listener: c, capture: e }), |
||
587 | s ? s.push(u) : (this.__on = [u]); |
||
588 | }; |
||
589 | } |
||
590 | function dt(t, n, e, r) { |
||
591 | var i = st; |
||
592 | (t.sourceEvent = st), (st = t); |
||
593 | try { |
||
594 | return n.apply(e, r); |
||
595 | } finally { |
||
596 | st = i; |
||
597 | } |
||
598 | } |
||
599 | function gt(t, n, e) { |
||
600 | var r = C(t), |
||
601 | i = r.CustomEvent; |
||
602 | 'function' == typeof i |
||
603 | ? (i = new i(n, e)) |
||
604 | : ((i = r.document.createEvent('Event')), |
||
605 | e |
||
606 | ? (i.initEvent(n, e.bubbles, e.cancelable), (i.detail = e.detail)) |
||
607 | : i.initEvent(n, !1, !1)), |
||
608 | t.dispatchEvent(i); |
||
609 | } |
||
610 | function yt(t, n) { |
||
611 | return function () { |
||
612 | return gt(this, t, n); |
||
613 | }; |
||
614 | } |
||
615 | function vt(t, n) { |
||
616 | return function () { |
||
617 | return gt(this, t, n.apply(this, arguments)); |
||
618 | }; |
||
619 | } |
||
620 | var mt = [null]; |
||
621 | function _t(t, n) { |
||
622 | (this._groups = t), (this._parents = n); |
||
623 | } |
||
624 | function wt(t) { |
||
625 | return 'string' == typeof t |
||
626 | ? new _t([[document.querySelector(t)]], [document.documentElement]) |
||
627 | : new _t([[t]], mt); |
||
628 | } |
||
629 | function xt() { |
||
630 | for (var t, n = st; (t = n.sourceEvent); ) n = t; |
||
631 | return n; |
||
632 | } |
||
633 | function bt(t, n) { |
||
634 | var e = t.ownerSVGElement || t; |
||
635 | if (e.createSVGPoint) { |
||
636 | var r = e.createSVGPoint(); |
||
637 | return ( |
||
638 | (r.x = n.clientX), |
||
639 | (r.y = n.clientY), |
||
640 | [(r = r.matrixTransform(t.getScreenCTM().inverse())).x, r.y] |
||
641 | ); |
||
642 | } |
||
643 | var i = t.getBoundingClientRect(); |
||
644 | return [n.clientX - i.left - t.clientLeft, n.clientY - i.top - t.clientTop]; |
||
645 | } |
||
646 | function Mt(t) { |
||
647 | var n = xt(); |
||
648 | return n.changedTouches && (n = n.changedTouches[0]), bt(t, n); |
||
649 | } |
||
650 | function kt(t, n, e) { |
||
651 | arguments.length < 3 && ((e = n), (n = xt().changedTouches)); |
||
652 | for (var r, i = 0, o = n ? n.length : 0; i < o; ++i) |
||
653 | if ((r = n[i]).identifier === e) return bt(t, r); |
||
654 | return null; |
||
655 | } |
||
656 | function Nt(t, n) { |
||
657 | return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN; |
||
658 | } |
||
659 | _t.prototype = function () { |
||
660 | return new _t([[document.documentElement]], mt); |
||
661 | }.prototype = { |
||
662 | constructor: _t, |
||
663 | select: function (t) { |
||
664 | 'function' != typeof t && (t = w(t)); |
||
665 | for ( |
||
666 | var n = this._groups, e = n.length, r = new Array(e), i = 0; |
||
667 | i < e; |
||
668 | ++i |
||
669 | ) |
||
670 | for ( |
||
671 | var o, a, u = n[i], s = u.length, c = (r[i] = new Array(s)), l = 0; |
||
672 | l < s; |
||
673 | ++l |
||
674 | ) |
||
675 | (o = u[l]) && |
||
676 | (a = t.call(o, o.__data__, l, u)) && |
||
677 | ('__data__' in o && (a.__data__ = o.__data__), (c[l] = a)); |
||
678 | return new _t(r, this._parents); |
||
679 | }, |
||
680 | selectAll: function (t) { |
||
681 | 'function' != typeof t && |
||
682 | (t = (function (t) { |
||
683 | return null == t |
||
684 | ? x |
||
685 | : function () { |
||
686 | return this.querySelectorAll(t); |
||
687 | }; |
||
688 | })(t)); |
||
689 | for ( |
||
690 | var n = this._groups, e = n.length, r = [], i = [], o = 0; |
||
691 | o < e; |
||
692 | ++o |
||
693 | ) |
||
694 | for (var a, u = n[o], s = u.length, c = 0; c < s; ++c) |
||
695 | (a = u[c]) && (r.push(t.call(a, a.__data__, c, u)), i.push(a)); |
||
696 | return new _t(r, i); |
||
697 | }, |
||
698 | filter: function (t) { |
||
699 | 'function' != typeof t && |
||
700 | (t = (function (t) { |
||
701 | return function () { |
||
702 | return this.matches(t); |
||
703 | }; |
||
704 | })(t)); |
||
705 | for ( |
||
706 | var n = this._groups, e = n.length, r = new Array(e), i = 0; |
||
707 | i < e; |
||
708 | ++i |
||
709 | ) |
||
710 | for (var o, a = n[i], u = a.length, s = (r[i] = []), c = 0; c < u; ++c) |
||
711 | (o = a[c]) && t.call(o, o.__data__, c, a) && s.push(o); |
||
712 | return new _t(r, this._parents); |
||
713 | }, |
||
714 | data: function (t, n) { |
||
715 | if (!t) |
||
716 | return ( |
||
717 | (p = new Array(this.size())), |
||
718 | (c = -1), |
||
719 | this.each(function (t) { |
||
720 | p[++c] = t; |
||
721 | }), |
||
722 | p |
||
723 | ); |
||
724 | var e = n ? N : k, |
||
725 | r = this._parents, |
||
726 | i = this._groups; |
||
727 | 'function' != typeof t && |
||
728 | (t = (function (t) { |
||
729 | return function () { |
||
730 | return t; |
||
731 | }; |
||
732 | })(t)); |
||
733 | for ( |
||
734 | var o = i.length, |
||
735 | a = new Array(o), |
||
736 | u = new Array(o), |
||
737 | s = new Array(o), |
||
738 | c = 0; |
||
739 | c < o; |
||
740 | ++c |
||
741 | ) { |
||
742 | var l = r[c], |
||
743 | h = i[c], |
||
744 | f = h.length, |
||
745 | p = t.call(l, l && l.__data__, c, r), |
||
746 | d = p.length, |
||
747 | g = (u[c] = new Array(d)), |
||
748 | y = (a[c] = new Array(d)); |
||
749 | e(l, h, g, y, (s[c] = new Array(f)), p, n); |
||
750 | for (var v, m, _ = 0, w = 0; _ < d; ++_) |
||
751 | if ((v = g[_])) { |
||
752 | for (_ >= w && (w = _ + 1); !(m = y[w]) && ++w < d; ); |
||
753 | v._next = m || null; |
||
754 | } |
||
755 | } |
||
756 | return ((a = new _t(a, r))._enter = u), (a._exit = s), a; |
||
757 | }, |
||
758 | enter: function () { |
||
759 | return new _t(this._enter || this._groups.map(b), this._parents); |
||
760 | }, |
||
761 | exit: function () { |
||
762 | return new _t(this._exit || this._groups.map(b), this._parents); |
||
763 | }, |
||
764 | join: function (t, n, e) { |
||
765 | var r = this.enter(), |
||
766 | i = this, |
||
767 | o = this.exit(); |
||
768 | return ( |
||
769 | (r = 'function' == typeof t ? t(r) : r.append(t + '')), |
||
770 | null != n && (i = n(i)), |
||
771 | null == e ? o.remove() : e(o), |
||
772 | r && i ? r.merge(i).order() : i |
||
773 | ); |
||
774 | }, |
||
775 | merge: function (t) { |
||
776 | for ( |
||
777 | var n = this._groups, |
||
778 | e = t._groups, |
||
779 | r = n.length, |
||
780 | i = e.length, |
||
781 | o = Math.min(r, i), |
||
782 | a = new Array(r), |
||
783 | u = 0; |
||
784 | u < o; |
||
785 | ++u |
||
786 | ) |
||
787 | for ( |
||
788 | var s, |
||
789 | c = n[u], |
||
790 | l = e[u], |
||
791 | h = c.length, |
||
792 | f = (a[u] = new Array(h)), |
||
793 | p = 0; |
||
794 | p < h; |
||
795 | ++p |
||
796 | ) |
||
797 | (s = c[p] || l[p]) && (f[p] = s); |
||
798 | for (; u < r; ++u) a[u] = n[u]; |
||
799 | return new _t(a, this._parents); |
||
800 | }, |
||
801 | order: function () { |
||
802 | for (var t = this._groups, n = -1, e = t.length; ++n < e; ) |
||
803 | for (var r, i = t[n], o = i.length - 1, a = i[o]; --o >= 0; ) |
||
804 | (r = i[o]) && |
||
805 | (a && |
||
806 | 4 ^ r.compareDocumentPosition(a) && |
||
807 | a.parentNode.insertBefore(r, a), |
||
808 | (a = r)); |
||
809 | return this; |
||
810 | }, |
||
811 | sort: function (t) { |
||
812 | function n(n, e) { |
||
813 | return n && e ? t(n.__data__, e.__data__) : !n - !e; |
||
814 | } |
||
815 | t || (t = S); |
||
816 | for ( |
||
817 | var e = this._groups, r = e.length, i = new Array(r), o = 0; |
||
818 | o < r; |
||
819 | ++o |
||
820 | ) { |
||
821 | for ( |
||
822 | var a, u = e[o], s = u.length, c = (i[o] = new Array(s)), l = 0; |
||
823 | l < s; |
||
824 | ++l |
||
825 | ) |
||
826 | (a = u[l]) && (c[l] = a); |
||
827 | c.sort(n); |
||
828 | } |
||
829 | return new _t(i, this._parents).order(); |
||
830 | }, |
||
831 | call: function () { |
||
832 | var t = arguments[0]; |
||
833 | return (arguments[0] = this), t.apply(null, arguments), this; |
||
834 | }, |
||
835 | nodes: function () { |
||
836 | var t = new Array(this.size()), |
||
837 | n = -1; |
||
838 | return ( |
||
839 | this.each(function () { |
||
840 | t[++n] = this; |
||
841 | }), |
||
842 | t |
||
843 | ); |
||
844 | }, |
||
845 | node: function () { |
||
846 | for (var t = this._groups, n = 0, e = t.length; n < e; ++n) |
||
847 | for (var r = t[n], i = 0, o = r.length; i < o; ++i) { |
||
848 | var a = r[i]; |
||
849 | if (a) return a; |
||
850 | } |
||
851 | return null; |
||
852 | }, |
||
853 | size: function () { |
||
854 | var t = 0; |
||
855 | return ( |
||
856 | this.each(function () { |
||
857 | ++t; |
||
858 | }), |
||
859 | t |
||
860 | ); |
||
861 | }, |
||
862 | empty: function () { |
||
863 | return !this.node(); |
||
864 | }, |
||
865 | each: function (t) { |
||
866 | for (var n = this._groups, e = 0, r = n.length; e < r; ++e) |
||
867 | for (var i, o = n[e], a = 0, u = o.length; a < u; ++a) |
||
868 | (i = o[a]) && t.call(i, i.__data__, a, o); |
||
869 | return this; |
||
870 | }, |
||
871 | attr: function (t, n) { |
||
872 | var e = g(t); |
||
873 | if (arguments.length < 2) { |
||
874 | var r = this.node(); |
||
875 | return e.local ? r.getAttributeNS(e.space, e.local) : r.getAttribute(e); |
||
876 | } |
||
877 | return this.each( |
||
878 | (null == n |
||
879 | ? e.local |
||
880 | ? E |
||
881 | : A |
||
882 | : 'function' == typeof n |
||
883 | ? e.local |
||
884 | ? T |
||
885 | : j |
||
886 | : e.local |
||
887 | ? O |
||
888 | : P)(e, n) |
||
889 | ); |
||
890 | }, |
||
891 | style: function (t, n, e) { |
||
892 | return arguments.length > 1 |
||
893 | ? this.each( |
||
894 | (null == n ? L : 'function' == typeof n ? D : z)( |
||
895 | t, |
||
896 | n, |
||
897 | null == e ? '' : e |
||
898 | ) |
||
899 | ) |
||
900 | : q(this.node(), t); |
||
901 | }, |
||
902 | property: function (t, n) { |
||
903 | return arguments.length > 1 |
||
904 | ? this.each((null == n ? R : 'function' == typeof n ? I : H)(t, n)) |
||
905 | : this.node()[t]; |
||
906 | }, |
||
907 | classed: function (t, n) { |
||
908 | var e = V(t + ''); |
||
909 | if (arguments.length < 2) { |
||
910 | for (var r = $(this.node()), i = -1, o = e.length; ++i < o; ) |
||
911 | if (!r.contains(e[i])) return !1; |
||
912 | return !0; |
||
913 | } |
||
914 | return this.each(('function' == typeof n ? Y : n ? X : W)(e, n)); |
||
915 | }, |
||
916 | text: function (t) { |
||
917 | return arguments.length |
||
918 | ? this.each(null == t ? G : ('function' == typeof t ? K : Z)(t)) |
||
919 | : this.node().textContent; |
||
920 | }, |
||
921 | html: function (t) { |
||
922 | return arguments.length |
||
923 | ? this.each(null == t ? Q : ('function' == typeof t ? tt : J)(t)) |
||
924 | : this.node().innerHTML; |
||
925 | }, |
||
926 | raise: function () { |
||
927 | return this.each(nt); |
||
928 | }, |
||
929 | lower: function () { |
||
930 | return this.each(et); |
||
931 | }, |
||
932 | append: function (t) { |
||
933 | var n = 'function' == typeof t ? t : m(t); |
||
934 | return this.select(function () { |
||
935 | return this.appendChild(n.apply(this, arguments)); |
||
936 | }); |
||
937 | }, |
||
938 | insert: function (t, n) { |
||
939 | var e = 'function' == typeof t ? t : m(t), |
||
940 | r = null == n ? rt : 'function' == typeof n ? n : w(n); |
||
941 | return this.select(function () { |
||
942 | return this.insertBefore( |
||
943 | e.apply(this, arguments), |
||
944 | r.apply(this, arguments) || null |
||
945 | ); |
||
946 | }); |
||
947 | }, |
||
948 | remove: function () { |
||
949 | return this.each(it); |
||
950 | }, |
||
951 | clone: function (t) { |
||
952 | return this.select(t ? at : ot); |
||
953 | }, |
||
954 | datum: function (t) { |
||
955 | return arguments.length |
||
956 | ? this.property('__data__', t) |
||
957 | : this.node().__data__; |
||
958 | }, |
||
959 | on: function (t, n, e) { |
||
960 | var r, |
||
961 | i, |
||
962 | o = ht(t + ''), |
||
963 | a = o.length; |
||
964 | if (!(arguments.length < 2)) { |
||
965 | for (u = n ? pt : ft, null == e && (e = !1), r = 0; r < a; ++r) |
||
966 | this.each(u(o[r], n, e)); |
||
967 | return this; |
||
968 | } |
||
969 | var u = this.node().__on; |
||
970 | if (u) |
||
971 | for (var s, c = 0, l = u.length; c < l; ++c) |
||
972 | for (r = 0, s = u[c]; r < a; ++r) |
||
973 | if ((i = o[r]).type === s.type && i.name === s.name) return s.value; |
||
974 | }, |
||
975 | dispatch: function (t, n) { |
||
976 | return this.each(('function' == typeof n ? vt : yt)(t, n)); |
||
977 | }, |
||
978 | }; |
||
979 | var St, |
||
980 | At, |
||
981 | Et = (1 === (St = Nt).length && |
||
982 | ((At = St), |
||
983 | (St = function (t, n) { |
||
984 | return Nt(At(t), n); |
||
985 | })), |
||
986 | { |
||
987 | left: function (t, n, e, r) { |
||
988 | for (null == e && (e = 0), null == r && (r = t.length); e < r; ) { |
||
989 | var i = (e + r) >>> 1; |
||
990 | St(t[i], n) < 0 ? (e = i + 1) : (r = i); |
||
991 | } |
||
992 | return e; |
||
993 | }, |
||
994 | right: function (t, n, e, r) { |
||
995 | for (null == e && (e = 0), null == r && (r = t.length); e < r; ) { |
||
996 | var i = (e + r) >>> 1; |
||
997 | St(t[i], n) > 0 ? (r = i) : (e = i + 1); |
||
998 | } |
||
999 | return e; |
||
1000 | }, |
||
1001 | }).right; |
||
1002 | var Pt = Math.sqrt(50), |
||
1003 | Ot = Math.sqrt(10), |
||
1004 | jt = Math.sqrt(2); |
||
1005 | function Tt(t, n, e) { |
||
1006 | var r = (n - t) / Math.max(0, e), |
||
1007 | i = Math.floor(Math.log(r) / Math.LN10), |
||
1008 | o = r / Math.pow(10, i); |
||
1009 | return i >= 0 |
||
1010 | ? (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1) * Math.pow(10, i) |
||
1011 | : -Math.pow(10, -i) / (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1); |
||
1012 | } |
||
1013 | function Ct(t, n) { |
||
1014 | switch (arguments.length) { |
||
1015 | case 0: |
||
1016 | break; |
||
1017 | case 1: |
||
1018 | this.range(t); |
||
1019 | break; |
||
1020 | default: |
||
1021 | this.range(n).domain(t); |
||
1022 | } |
||
1023 | return this; |
||
1024 | } |
||
1025 | function Lt(t, n, e) { |
||
1026 | (t.prototype = n.prototype = e), (e.constructor = t); |
||
1027 | } |
||
1028 | function zt(t, n) { |
||
1029 | var e = Object.create(t.prototype); |
||
1030 | for (var r in n) e[r] = n[r]; |
||
1031 | return e; |
||
1032 | } |
||
1033 | function Dt() {} |
||
1034 | var qt = '\\s*([+-]?\\d+)\\s*', |
||
1035 | Rt = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*', |
||
1036 | Ht = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*', |
||
1037 | It = /^#([0-9a-f]{3,8})$/, |
||
1038 | Vt = new RegExp('^rgb\\(' + [qt, qt, qt] + '\\)$'), |
||
1039 | $t = new RegExp('^rgb\\(' + [Ht, Ht, Ht] + '\\)$'), |
||
1040 | Bt = new RegExp('^rgba\\(' + [qt, qt, qt, Rt] + '\\)$'), |
||
1041 | Ft = new RegExp('^rgba\\(' + [Ht, Ht, Ht, Rt] + '\\)$'), |
||
1042 | Ut = new RegExp('^hsl\\(' + [Rt, Ht, Ht] + '\\)$'), |
||
1043 | Xt = new RegExp('^hsla\\(' + [Rt, Ht, Ht, Rt] + '\\)$'), |
||
1044 | Wt = { |
||
1045 | aliceblue: 15792383, |
||
1046 | antiquewhite: 16444375, |
||
1047 | aqua: 65535, |
||
1048 | aquamarine: 8388564, |
||
1049 | azure: 15794175, |
||
1050 | beige: 16119260, |
||
1051 | bisque: 16770244, |
||
1052 | black: 0, |
||
1053 | blanchedalmond: 16772045, |
||
1054 | blue: 255, |
||
1055 | blueviolet: 9055202, |
||
1056 | brown: 10824234, |
||
1057 | burlywood: 14596231, |
||
1058 | cadetblue: 6266528, |
||
1059 | chartreuse: 8388352, |
||
1060 | chocolate: 13789470, |
||
1061 | coral: 16744272, |
||
1062 | cornflowerblue: 6591981, |
||
1063 | cornsilk: 16775388, |
||
1064 | crimson: 14423100, |
||
1065 | cyan: 65535, |
||
1066 | darkblue: 139, |
||
1067 | darkcyan: 35723, |
||
1068 | darkgoldenrod: 12092939, |
||
1069 | darkgray: 11119017, |
||
1070 | darkgreen: 25600, |
||
1071 | darkgrey: 11119017, |
||
1072 | darkkhaki: 12433259, |
||
1073 | darkmagenta: 9109643, |
||
1074 | darkolivegreen: 5597999, |
||
1075 | darkorange: 16747520, |
||
1076 | darkorchid: 10040012, |
||
1077 | darkred: 9109504, |
||
1078 | darksalmon: 15308410, |
||
1079 | darkseagreen: 9419919, |
||
1080 | darkslateblue: 4734347, |
||
1081 | darkslategray: 3100495, |
||
1082 | darkslategrey: 3100495, |
||
1083 | darkturquoise: 52945, |
||
1084 | darkviolet: 9699539, |
||
1085 | deeppink: 16716947, |
||
1086 | deepskyblue: 49151, |
||
1087 | dimgray: 6908265, |
||
1088 | dimgrey: 6908265, |
||
1089 | dodgerblue: 2003199, |
||
1090 | firebrick: 11674146, |
||
1091 | floralwhite: 16775920, |
||
1092 | forestgreen: 2263842, |
||
1093 | fuchsia: 16711935, |
||
1094 | gainsboro: 14474460, |
||
1095 | ghostwhite: 16316671, |
||
1096 | gold: 16766720, |
||
1097 | goldenrod: 14329120, |
||
1098 | gray: 8421504, |
||
1099 | green: 32768, |
||
1100 | greenyellow: 11403055, |
||
1101 | grey: 8421504, |
||
1102 | honeydew: 15794160, |
||
1103 | hotpink: 16738740, |
||
1104 | indianred: 13458524, |
||
1105 | indigo: 4915330, |
||
1106 | ivory: 16777200, |
||
1107 | khaki: 15787660, |
||
1108 | lavender: 15132410, |
||
1109 | lavenderblush: 16773365, |
||
1110 | lawngreen: 8190976, |
||
1111 | lemonchiffon: 16775885, |
||
1112 | lightblue: 11393254, |
||
1113 | lightcoral: 15761536, |
||
1114 | lightcyan: 14745599, |
||
1115 | lightgoldenrodyellow: 16448210, |
||
1116 | lightgray: 13882323, |
||
1117 | lightgreen: 9498256, |
||
1118 | lightgrey: 13882323, |
||
1119 | lightpink: 16758465, |
||
1120 | lightsalmon: 16752762, |
||
1121 | lightseagreen: 2142890, |
||
1122 | lightskyblue: 8900346, |
||
1123 | lightslategray: 7833753, |
||
1124 | lightslategrey: 7833753, |
||
1125 | lightsteelblue: 11584734, |
||
1126 | lightyellow: 16777184, |
||
1127 | lime: 65280, |
||
1128 | limegreen: 3329330, |
||
1129 | linen: 16445670, |
||
1130 | magenta: 16711935, |
||
1131 | maroon: 8388608, |
||
1132 | mediumaquamarine: 6737322, |
||
1133 | mediumblue: 205, |
||
1134 | mediumorchid: 12211667, |
||
1135 | mediumpurple: 9662683, |
||
1136 | mediumseagreen: 3978097, |
||
1137 | mediumslateblue: 8087790, |
||
1138 | mediumspringgreen: 64154, |
||
1139 | mediumturquoise: 4772300, |
||
1140 | mediumvioletred: 13047173, |
||
1141 | midnightblue: 1644912, |
||
1142 | mintcream: 16121850, |
||
1143 | mistyrose: 16770273, |
||
1144 | moccasin: 16770229, |
||
1145 | navajowhite: 16768685, |
||
1146 | navy: 128, |
||
1147 | oldlace: 16643558, |
||
1148 | olive: 8421376, |
||
1149 | olivedrab: 7048739, |
||
1150 | orange: 16753920, |
||
1151 | orangered: 16729344, |
||
1152 | orchid: 14315734, |
||
1153 | palegoldenrod: 15657130, |
||
1154 | palegreen: 10025880, |
||
1155 | paleturquoise: 11529966, |
||
1156 | palevioletred: 14381203, |
||
1157 | papayawhip: 16773077, |
||
1158 | peachpuff: 16767673, |
||
1159 | peru: 13468991, |
||
1160 | pink: 16761035, |
||
1161 | plum: 14524637, |
||
1162 | powderblue: 11591910, |
||
1163 | purple: 8388736, |
||
1164 | rebeccapurple: 6697881, |
||
1165 | red: 16711680, |
||
1166 | rosybrown: 12357519, |
||
1167 | royalblue: 4286945, |
||
1168 | saddlebrown: 9127187, |
||
1169 | salmon: 16416882, |
||
1170 | sandybrown: 16032864, |
||
1171 | seagreen: 3050327, |
||
1172 | seashell: 16774638, |
||
1173 | sienna: 10506797, |
||
1174 | silver: 12632256, |
||
1175 | skyblue: 8900331, |
||
1176 | slateblue: 6970061, |
||
1177 | slategray: 7372944, |
||
1178 | slategrey: 7372944, |
||
1179 | snow: 16775930, |
||
1180 | springgreen: 65407, |
||
1181 | steelblue: 4620980, |
||
1182 | tan: 13808780, |
||
1183 | teal: 32896, |
||
1184 | thistle: 14204888, |
||
1185 | tomato: 16737095, |
||
1186 | turquoise: 4251856, |
||
1187 | violet: 15631086, |
||
1188 | wheat: 16113331, |
||
1189 | white: 16777215, |
||
1190 | whitesmoke: 16119285, |
||
1191 | yellow: 16776960, |
||
1192 | yellowgreen: 10145074, |
||
1193 | }; |
||
1194 | function Yt() { |
||
1195 | return this.rgb().formatHex(); |
||
1196 | } |
||
1197 | function Gt() { |
||
1198 | return this.rgb().formatRgb(); |
||
1199 | } |
||
1200 | function Zt(t) { |
||
1201 | var n, e; |
||
1202 | return ( |
||
1203 | (t = (t + '').trim().toLowerCase()), |
||
1204 | (n = It.exec(t)) |
||
1205 | ? ((e = n[1].length), |
||
1206 | (n = parseInt(n[1], 16)), |
||
1207 | 6 === e |
||
1208 | ? Kt(n) |
||
1209 | : 3 === e |
||
1210 | ? new nn( |
||
1211 | ((n >> 8) & 15) | ((n >> 4) & 240), |
||
1212 | ((n >> 4) & 15) | (240 & n), |
||
1213 | ((15 & n) << 4) | (15 & n), |
||
1214 | 1 |
||
1215 | ) |
||
1216 | : 8 === e |
||
1217 | ? Qt( |
||
1218 | (n >> 24) & 255, |
||
1219 | (n >> 16) & 255, |
||
1220 | (n >> 8) & 255, |
||
1221 | (255 & n) / 255 |
||
1222 | ) |
||
1223 | : 4 === e |
||
1224 | ? Qt( |
||
1225 | ((n >> 12) & 15) | ((n >> 8) & 240), |
||
1226 | ((n >> 8) & 15) | ((n >> 4) & 240), |
||
1227 | ((n >> 4) & 15) | (240 & n), |
||
1228 | (((15 & n) << 4) | (15 & n)) / 255 |
||
1229 | ) |
||
1230 | : null) |
||
1231 | : (n = Vt.exec(t)) |
||
1232 | ? new nn(n[1], n[2], n[3], 1) |
||
1233 | : (n = $t.exec(t)) |
||
1234 | ? new nn((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, 1) |
||
1235 | : (n = Bt.exec(t)) |
||
1236 | ? Qt(n[1], n[2], n[3], n[4]) |
||
1237 | : (n = Ft.exec(t)) |
||
1238 | ? Qt((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, n[4]) |
||
1239 | : (n = Ut.exec(t)) |
||
1240 | ? an(n[1], n[2] / 100, n[3] / 100, 1) |
||
1241 | : (n = Xt.exec(t)) |
||
1242 | ? an(n[1], n[2] / 100, n[3] / 100, n[4]) |
||
1243 | : Wt.hasOwnProperty(t) |
||
1244 | ? Kt(Wt[t]) |
||
1245 | : 'transparent' === t |
||
1246 | ? new nn(NaN, NaN, NaN, 0) |
||
1247 | : null |
||
1248 | ); |
||
1249 | } |
||
1250 | function Kt(t) { |
||
1251 | return new nn((t >> 16) & 255, (t >> 8) & 255, 255 & t, 1); |
||
1252 | } |
||
1253 | function Qt(t, n, e, r) { |
||
1254 | return r <= 0 && (t = n = e = NaN), new nn(t, n, e, r); |
||
1255 | } |
||
1256 | function Jt(t) { |
||
1257 | return ( |
||
1258 | t instanceof Dt || (t = Zt(t)), |
||
1259 | t ? new nn((t = t.rgb()).r, t.g, t.b, t.opacity) : new nn() |
||
1260 | ); |
||
1261 | } |
||
1262 | function tn(t, n, e, r) { |
||
1263 | return 1 === arguments.length ? Jt(t) : new nn(t, n, e, null == r ? 1 : r); |
||
1264 | } |
||
1265 | function nn(t, n, e, r) { |
||
1266 | (this.r = +t), (this.g = +n), (this.b = +e), (this.opacity = +r); |
||
1267 | } |
||
1268 | function en() { |
||
1269 | return '#' + on(this.r) + on(this.g) + on(this.b); |
||
1270 | } |
||
1271 | function rn() { |
||
1272 | var t = this.opacity; |
||
1273 | return ( |
||
1274 | (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t))) |
||
1275 | ? 'rgb(' |
||
1276 | : 'rgba(') + |
||
1277 | Math.max(0, Math.min(255, Math.round(this.r) || 0)) + |
||
1278 | ', ' + |
||
1279 | Math.max(0, Math.min(255, Math.round(this.g) || 0)) + |
||
1280 | ', ' + |
||
1281 | Math.max(0, Math.min(255, Math.round(this.b) || 0)) + |
||
1282 | (1 === t ? ')' : ', ' + t + ')') |
||
1283 | ); |
||
1284 | } |
||
1285 | function on(t) { |
||
1286 | return ( |
||
1287 | ((t = Math.max(0, Math.min(255, Math.round(t) || 0))) < 16 ? '0' : '') + |
||
1288 | t.toString(16) |
||
1289 | ); |
||
1290 | } |
||
1291 | function an(t, n, e, r) { |
||
1292 | return ( |
||
1293 | r <= 0 |
||
1294 | ? (t = n = e = NaN) |
||
1295 | : e <= 0 || e >= 1 |
||
1296 | ? (t = n = NaN) |
||
1297 | : n <= 0 && (t = NaN), |
||
1298 | new sn(t, n, e, r) |
||
1299 | ); |
||
1300 | } |
||
1301 | function un(t) { |
||
1302 | if (t instanceof sn) return new sn(t.h, t.s, t.l, t.opacity); |
||
1303 | if ((t instanceof Dt || (t = Zt(t)), !t)) return new sn(); |
||
1304 | if (t instanceof sn) return t; |
||
1305 | var n = (t = t.rgb()).r / 255, |
||
1306 | e = t.g / 255, |
||
1307 | r = t.b / 255, |
||
1308 | i = Math.min(n, e, r), |
||
1309 | o = Math.max(n, e, r), |
||
1310 | a = NaN, |
||
1311 | u = o - i, |
||
1312 | s = (o + i) / 2; |
||
1313 | return ( |
||
1314 | u |
||
1315 | ? ((a = |
||
1316 | n === o |
||
1317 | ? (e - r) / u + 6 * (e < r) |
||
1318 | : e === o |
||
1319 | ? (r - n) / u + 2 |
||
1320 | : (n - e) / u + 4), |
||
1321 | (u /= s < 0.5 ? o + i : 2 - o - i), |
||
1322 | (a *= 60)) |
||
1323 | : (u = s > 0 && s < 1 ? 0 : a), |
||
1324 | new sn(a, u, s, t.opacity) |
||
1325 | ); |
||
1326 | } |
||
1327 | function sn(t, n, e, r) { |
||
1328 | (this.h = +t), (this.s = +n), (this.l = +e), (this.opacity = +r); |
||
1329 | } |
||
1330 | function cn(t, n, e) { |
||
1331 | return ( |
||
1332 | 255 * |
||
1333 | (t < 60 |
||
1334 | ? n + ((e - n) * t) / 60 |
||
1335 | : t < 180 |
||
1336 | ? e |
||
1337 | : t < 240 |
||
1338 | ? n + ((e - n) * (240 - t)) / 60 |
||
1339 | : n) |
||
1340 | ); |
||
1341 | } |
||
1342 | function ln(t) { |
||
1343 | return function () { |
||
1344 | return t; |
||
1345 | }; |
||
1346 | } |
||
1347 | function hn(t) { |
||
1348 | return 1 == (t = +t) |
||
1349 | ? fn |
||
1350 | : function (n, e) { |
||
1351 | return e - n |
||
1352 | ? (function (t, n, e) { |
||
1353 | return ( |
||
1354 | (t = Math.pow(t, e)), |
||
1355 | (n = Math.pow(n, e) - t), |
||
1356 | (e = 1 / e), |
||
1357 | function (r) { |
||
1358 | return Math.pow(t + r * n, e); |
||
1359 | } |
||
1360 | ); |
||
1361 | })(n, e, t) |
||
1362 | : ln(isNaN(n) ? e : n); |
||
1363 | }; |
||
1364 | } |
||
1365 | function fn(t, n) { |
||
1366 | var e = n - t; |
||
1367 | return e |
||
1368 | ? (function (t, n) { |
||
1369 | return function (e) { |
||
1370 | return t + e * n; |
||
1371 | }; |
||
1372 | })(t, e) |
||
1373 | : ln(isNaN(t) ? n : t); |
||
1374 | } |
||
1375 | Lt(Dt, Zt, { |
||
1376 | copy: function (t) { |
||
1377 | return Object.assign(new this.constructor(), this, t); |
||
1378 | }, |
||
1379 | displayable: function () { |
||
1380 | return this.rgb().displayable(); |
||
1381 | }, |
||
1382 | hex: Yt, |
||
1383 | formatHex: Yt, |
||
1384 | formatHsl: function () { |
||
1385 | return un(this).formatHsl(); |
||
1386 | }, |
||
1387 | formatRgb: Gt, |
||
1388 | toString: Gt, |
||
1389 | }), |
||
1390 | Lt( |
||
1391 | nn, |
||
1392 | tn, |
||
1393 | zt(Dt, { |
||
1394 | brighter: function (t) { |
||
1395 | return ( |
||
1396 | (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)), |
||
1397 | new nn(this.r * t, this.g * t, this.b * t, this.opacity) |
||
1398 | ); |
||
1399 | }, |
||
1400 | darker: function (t) { |
||
1401 | return ( |
||
1402 | (t = null == t ? 0.7 : Math.pow(0.7, t)), |
||
1403 | new nn(this.r * t, this.g * t, this.b * t, this.opacity) |
||
1404 | ); |
||
1405 | }, |
||
1406 | rgb: function () { |
||
1407 | return this; |
||
1408 | }, |
||
1409 | displayable: function () { |
||
1410 | return ( |
||
1411 | -0.5 <= this.r && |
||
1412 | this.r < 255.5 && |
||
1413 | -0.5 <= this.g && |
||
1414 | this.g < 255.5 && |
||
1415 | -0.5 <= this.b && |
||
1416 | this.b < 255.5 && |
||
1417 | 0 <= this.opacity && |
||
1418 | this.opacity <= 1 |
||
1419 | ); |
||
1420 | }, |
||
1421 | hex: en, |
||
1422 | formatHex: en, |
||
1423 | formatRgb: rn, |
||
1424 | toString: rn, |
||
1425 | }) |
||
1426 | ), |
||
1427 | Lt( |
||
1428 | sn, |
||
1429 | function (t, n, e, r) { |
||
1430 | return 1 === arguments.length |
||
1431 | ? un(t) |
||
1432 | : new sn(t, n, e, null == r ? 1 : r); |
||
1433 | }, |
||
1434 | zt(Dt, { |
||
1435 | brighter: function (t) { |
||
1436 | return ( |
||
1437 | (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)), |
||
1438 | new sn(this.h, this.s, this.l * t, this.opacity) |
||
1439 | ); |
||
1440 | }, |
||
1441 | darker: function (t) { |
||
1442 | return ( |
||
1443 | (t = null == t ? 0.7 : Math.pow(0.7, t)), |
||
1444 | new sn(this.h, this.s, this.l * t, this.opacity) |
||
1445 | ); |
||
1446 | }, |
||
1447 | rgb: function () { |
||
1448 | var t = (this.h % 360) + 360 * (this.h < 0), |
||
1449 | n = isNaN(t) || isNaN(this.s) ? 0 : this.s, |
||
1450 | e = this.l, |
||
1451 | r = e + (e < 0.5 ? e : 1 - e) * n, |
||
1452 | i = 2 * e - r; |
||
1453 | return new nn( |
||
1454 | cn(t >= 240 ? t - 240 : t + 120, i, r), |
||
1455 | cn(t, i, r), |
||
1456 | cn(t < 120 ? t + 240 : t - 120, i, r), |
||
1457 | this.opacity |
||
1458 | ); |
||
1459 | }, |
||
1460 | displayable: function () { |
||
1461 | return ( |
||
1462 | ((0 <= this.s && this.s <= 1) || isNaN(this.s)) && |
||
1463 | 0 <= this.l && |
||
1464 | this.l <= 1 && |
||
1465 | 0 <= this.opacity && |
||
1466 | this.opacity <= 1 |
||
1467 | ); |
||
1468 | }, |
||
1469 | formatHsl: function () { |
||
1470 | var t = this.opacity; |
||
1471 | return ( |
||
1472 | (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t))) |
||
1473 | ? 'hsl(' |
||
1474 | : 'hsla(') + |
||
1475 | (this.h || 0) + |
||
1476 | ', ' + |
||
1477 | 100 * (this.s || 0) + |
||
1478 | '%, ' + |
||
1479 | 100 * (this.l || 0) + |
||
1480 | '%' + |
||
1481 | (1 === t ? ')' : ', ' + t + ')') |
||
1482 | ); |
||
1483 | }, |
||
1484 | }) |
||
1485 | ); |
||
1486 | var pn = (function t(n) { |
||
1487 | var e = hn(n); |
||
1488 | function r(t, n) { |
||
1489 | var r = e((t = tn(t)).r, (n = tn(n)).r), |
||
1490 | i = e(t.g, n.g), |
||
1491 | o = e(t.b, n.b), |
||
1492 | a = fn(t.opacity, n.opacity); |
||
1493 | return function (n) { |
||
1494 | return ( |
||
1495 | (t.r = r(n)), (t.g = i(n)), (t.b = o(n)), (t.opacity = a(n)), t + '' |
||
1496 | ); |
||
1497 | }; |
||
1498 | } |
||
1499 | return (r.gamma = t), r; |
||
1500 | })(1); |
||
1501 | function dn(t, n) { |
||
1502 | n || (n = []); |
||
1503 | var e, |
||
1504 | r = t ? Math.min(n.length, t.length) : 0, |
||
1505 | i = n.slice(); |
||
1506 | return function (o) { |
||
1507 | for (e = 0; e < r; ++e) i[e] = t[e] * (1 - o) + n[e] * o; |
||
1508 | return i; |
||
1509 | }; |
||
1510 | } |
||
1511 | function gn(t, n) { |
||
1512 | var e, |
||
1513 | r = n ? n.length : 0, |
||
1514 | i = t ? Math.min(r, t.length) : 0, |
||
1515 | o = new Array(i), |
||
1516 | a = new Array(r); |
||
1517 | for (e = 0; e < i; ++e) o[e] = bn(t[e], n[e]); |
||
1518 | for (; e < r; ++e) a[e] = n[e]; |
||
1519 | return function (t) { |
||
1520 | for (e = 0; e < i; ++e) a[e] = o[e](t); |
||
1521 | return a; |
||
1522 | }; |
||
1523 | } |
||
1524 | function yn(t, n) { |
||
1525 | var e = new Date(); |
||
1526 | return ( |
||
1527 | (t = +t), |
||
1528 | (n = +n), |
||
1529 | function (r) { |
||
1530 | return e.setTime(t * (1 - r) + n * r), e; |
||
1531 | } |
||
1532 | ); |
||
1533 | } |
||
1534 | function vn(t, n) { |
||
1535 | return ( |
||
1536 | (t = +t), |
||
1537 | (n = +n), |
||
1538 | function (e) { |
||
1539 | return t * (1 - e) + n * e; |
||
1540 | } |
||
1541 | ); |
||
1542 | } |
||
1543 | function mn(t, n) { |
||
1544 | var e, |
||
1545 | r = {}, |
||
1546 | i = {}; |
||
1547 | for (e in ((null !== t && 'object' == typeof t) || (t = {}), |
||
1548 | (null !== n && 'object' == typeof n) || (n = {}), |
||
1549 | n)) |
||
1550 | e in t ? (r[e] = bn(t[e], n[e])) : (i[e] = n[e]); |
||
1551 | return function (t) { |
||
1552 | for (e in r) i[e] = r[e](t); |
||
1553 | return i; |
||
1554 | }; |
||
1555 | } |
||
1556 | var _n = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, |
||
1557 | wn = new RegExp(_n.source, 'g'); |
||
1558 | function xn(t, n) { |
||
1559 | var e, |
||
1560 | r, |
||
1561 | i, |
||
1562 | o = (_n.lastIndex = wn.lastIndex = 0), |
||
1563 | a = -1, |
||
1564 | u = [], |
||
1565 | s = []; |
||
1566 | for (t += '', n += ''; (e = _n.exec(t)) && (r = wn.exec(n)); ) |
||
1567 | (i = r.index) > o && |
||
1568 | ((i = n.slice(o, i)), u[a] ? (u[a] += i) : (u[++a] = i)), |
||
1569 | (e = e[0]) === (r = r[0]) |
||
1570 | ? u[a] |
||
1571 | ? (u[a] += r) |
||
1572 | : (u[++a] = r) |
||
1573 | : ((u[++a] = null), s.push({ i: a, x: vn(e, r) })), |
||
1574 | (o = wn.lastIndex); |
||
1575 | return ( |
||
1576 | o < n.length && ((i = n.slice(o)), u[a] ? (u[a] += i) : (u[++a] = i)), |
||
1577 | u.length < 2 |
||
1578 | ? s[0] |
||
1579 | ? (function (t) { |
||
1580 | return function (n) { |
||
1581 | return t(n) + ''; |
||
1582 | }; |
||
1583 | })(s[0].x) |
||
1584 | : (function (t) { |
||
1585 | return function () { |
||
1586 | return t; |
||
1587 | }; |
||
1588 | })(n) |
||
1589 | : ((n = s.length), |
||
1590 | function (t) { |
||
1591 | for (var e, r = 0; r < n; ++r) u[(e = s[r]).i] = e.x(t); |
||
1592 | return u.join(''); |
||
1593 | }) |
||
1594 | ); |
||
1595 | } |
||
1596 | function bn(t, n) { |
||
1597 | var e, |
||
1598 | r = typeof n; |
||
1599 | return null == n || 'boolean' === r |
||
1600 | ? ln(n) |
||
1601 | : ('number' === r |
||
1602 | ? vn |
||
1603 | : 'string' === r |
||
1604 | ? (e = Zt(n)) |
||
1605 | ? ((n = e), pn) |
||
1606 | : xn |
||
1607 | : n instanceof Zt |
||
1608 | ? pn |
||
1609 | : n instanceof Date |
||
1610 | ? yn |
||
1611 | : (function (t) { |
||
1612 | return ArrayBuffer.isView(t) && !(t instanceof DataView); |
||
1613 | })(n) |
||
1614 | ? dn |
||
1615 | : Array.isArray(n) |
||
1616 | ? gn |
||
1617 | : ('function' != typeof n.valueOf && |
||
1618 | 'function' != typeof n.toString) || |
||
1619 | isNaN(n) |
||
1620 | ? mn |
||
1621 | : vn)(t, n); |
||
1622 | } |
||
1623 | function Mn(t, n) { |
||
1624 | return ( |
||
1625 | (t = +t), |
||
1626 | (n = +n), |
||
1627 | function (e) { |
||
1628 | return Math.round(t * (1 - e) + n * e); |
||
1629 | } |
||
1630 | ); |
||
1631 | } |
||
1632 | function kn(t) { |
||
1633 | return +t; |
||
1634 | } |
||
1635 | var Nn = [0, 1]; |
||
1636 | function Sn(t) { |
||
1637 | return t; |
||
1638 | } |
||
1639 | function An(t, n) { |
||
1640 | return (n -= t = +t) |
||
1641 | ? function (e) { |
||
1642 | return (e - t) / n; |
||
1643 | } |
||
1644 | : (function (t) { |
||
1645 | return function () { |
||
1646 | return t; |
||
1647 | }; |
||
1648 | })(isNaN(n) ? NaN : 0.5); |
||
1649 | } |
||
1650 | function En(t, n, e) { |
||
1651 | var r = t[0], |
||
1652 | i = t[1], |
||
1653 | o = n[0], |
||
1654 | a = n[1]; |
||
1655 | return ( |
||
1656 | i < r ? ((r = An(i, r)), (o = e(a, o))) : ((r = An(r, i)), (o = e(o, a))), |
||
1657 | function (t) { |
||
1658 | return o(r(t)); |
||
1659 | } |
||
1660 | ); |
||
1661 | } |
||
1662 | function Pn(t, n, e) { |
||
1663 | var r = Math.min(t.length, n.length) - 1, |
||
1664 | i = new Array(r), |
||
1665 | o = new Array(r), |
||
1666 | a = -1; |
||
1667 | for ( |
||
1668 | t[r] < t[0] && ((t = t.slice().reverse()), (n = n.slice().reverse())); |
||
1669 | ++a < r; |
||
1670 | |||
1671 | ) |
||
1672 | (i[a] = An(t[a], t[a + 1])), (o[a] = e(n[a], n[a + 1])); |
||
1673 | return function (n) { |
||
1674 | var e = Et(t, n, 1, r) - 1; |
||
1675 | return o[e](i[e](n)); |
||
1676 | }; |
||
1677 | } |
||
1678 | function On(t, n) { |
||
1679 | return n |
||
1680 | .domain(t.domain()) |
||
1681 | .range(t.range()) |
||
1682 | .interpolate(t.interpolate()) |
||
1683 | .clamp(t.clamp()) |
||
1684 | .unknown(t.unknown()); |
||
1685 | } |
||
1686 | function jn() { |
||
1687 | var t, |
||
1688 | n, |
||
1689 | e, |
||
1690 | r, |
||
1691 | i, |
||
1692 | o, |
||
1693 | a = Nn, |
||
1694 | u = Nn, |
||
1695 | s = bn, |
||
1696 | c = Sn; |
||
1697 | function l() { |
||
1698 | var t, |
||
1699 | n, |
||
1700 | e, |
||
1701 | s = Math.min(a.length, u.length); |
||
1702 | return ( |
||
1703 | c !== Sn && |
||
1704 | ((t = a[0]), |
||
1705 | (n = a[s - 1]), |
||
1706 | t > n && ((e = t), (t = n), (n = e)), |
||
1707 | (c = function (e) { |
||
1708 | return Math.max(t, Math.min(n, e)); |
||
1709 | })), |
||
1710 | (r = s > 2 ? Pn : En), |
||
1711 | (i = o = null), |
||
1712 | h |
||
1713 | ); |
||
1714 | } |
||
1715 | function h(n) { |
||
1716 | return isNaN((n = +n)) ? e : (i || (i = r(a.map(t), u, s)))(t(c(n))); |
||
1717 | } |
||
1718 | return ( |
||
1719 | (h.invert = function (e) { |
||
1720 | return c(n((o || (o = r(u, a.map(t), vn)))(e))); |
||
1721 | }), |
||
1722 | (h.domain = function (t) { |
||
1723 | return arguments.length ? ((a = Array.from(t, kn)), l()) : a.slice(); |
||
1724 | }), |
||
1725 | (h.range = function (t) { |
||
1726 | return arguments.length ? ((u = Array.from(t)), l()) : u.slice(); |
||
1727 | }), |
||
1728 | (h.rangeRound = function (t) { |
||
1729 | return (u = Array.from(t)), (s = Mn), l(); |
||
1730 | }), |
||
1731 | (h.clamp = function (t) { |
||
1732 | return arguments.length ? ((c = !!t || Sn), l()) : c !== Sn; |
||
1733 | }), |
||
1734 | (h.interpolate = function (t) { |
||
1735 | return arguments.length ? ((s = t), l()) : s; |
||
1736 | }), |
||
1737 | (h.unknown = function (t) { |
||
1738 | return arguments.length ? ((e = t), h) : e; |
||
1739 | }), |
||
1740 | function (e, r) { |
||
1741 | return (t = e), (n = r), l(); |
||
1742 | } |
||
1743 | ); |
||
1744 | } |
||
1745 | function Tn() { |
||
1746 | return jn()(Sn, Sn); |
||
1747 | } |
||
1748 | function Cn(t, n) { |
||
1749 | if ( |
||
1750 | (e = (t = n ? t.toExponential(n - 1) : t.toExponential()).indexOf('e')) < |
||
1751 | 0 |
||
1752 | ) |
||
1753 | return null; |
||
1754 | var e, |
||
1755 | r = t.slice(0, e); |
||
1756 | return [r.length > 1 ? r[0] + r.slice(2) : r, +t.slice(e + 1)]; |
||
1757 | } |
||
1758 | function Ln(t) { |
||
1759 | return (t = Cn(Math.abs(t))) ? t[1] : NaN; |
||
1760 | } |
||
1761 | var zn, |
||
1762 | Dn = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; |
||
1763 | function qn(t) { |
||
1764 | if (!(n = Dn.exec(t))) throw new Error('invalid format: ' + t); |
||
1765 | var n; |
||
1766 | return new Rn({ |
||
1767 | fill: n[1], |
||
1768 | align: n[2], |
||
1769 | sign: n[3], |
||
1770 | symbol: n[4], |
||
1771 | zero: n[5], |
||
1772 | width: n[6], |
||
1773 | comma: n[7], |
||
1774 | precision: n[8] && n[8].slice(1), |
||
1775 | trim: n[9], |
||
1776 | type: n[10], |
||
1777 | }); |
||
1778 | } |
||
1779 | function Rn(t) { |
||
1780 | (this.fill = void 0 === t.fill ? ' ' : t.fill + ''), |
||
1781 | (this.align = void 0 === t.align ? '>' : t.align + ''), |
||
1782 | (this.sign = void 0 === t.sign ? '-' : t.sign + ''), |
||
1783 | (this.symbol = void 0 === t.symbol ? '' : t.symbol + ''), |
||
1784 | (this.zero = !!t.zero), |
||
1785 | (this.width = void 0 === t.width ? void 0 : +t.width), |
||
1786 | (this.comma = !!t.comma), |
||
1787 | (this.precision = void 0 === t.precision ? void 0 : +t.precision), |
||
1788 | (this.trim = !!t.trim), |
||
1789 | (this.type = void 0 === t.type ? '' : t.type + ''); |
||
1790 | } |
||
1791 | function Hn(t, n) { |
||
1792 | var e = Cn(t, n); |
||
1793 | if (!e) return t + ''; |
||
1794 | var r = e[0], |
||
1795 | i = e[1]; |
||
1796 | return i < 0 |
||
1797 | ? '0.' + new Array(-i).join('0') + r |
||
1798 | : r.length > i + 1 |
||
1799 | ? r.slice(0, i + 1) + '.' + r.slice(i + 1) |
||
1800 | : r + new Array(i - r.length + 2).join('0'); |
||
1801 | } |
||
1802 | (qn.prototype = Rn.prototype), |
||
1803 | (Rn.prototype.toString = function () { |
||
1804 | return ( |
||
1805 | this.fill + |
||
1806 | this.align + |
||
1807 | this.sign + |
||
1808 | this.symbol + |
||
1809 | (this.zero ? '0' : '') + |
||
1810 | (void 0 === this.width ? '' : Math.max(1, 0 | this.width)) + |
||
1811 | (this.comma ? ',' : '') + |
||
1812 | (void 0 === this.precision |
||
1813 | ? '' |
||
1814 | : '.' + Math.max(0, 0 | this.precision)) + |
||
1815 | (this.trim ? '~' : '') + |
||
1816 | this.type |
||
1817 | ); |
||
1818 | }); |
||
1819 | var In = { |
||
1820 | '%': function (t, n) { |
||
1821 | return (100 * t).toFixed(n); |
||
1822 | }, |
||
1823 | b: function (t) { |
||
1824 | return Math.round(t).toString(2); |
||
1825 | }, |
||
1826 | c: function (t) { |
||
1827 | return t + ''; |
||
1828 | }, |
||
1829 | d: function (t) { |
||
1830 | return Math.round(t).toString(10); |
||
1831 | }, |
||
1832 | e: function (t, n) { |
||
1833 | return t.toExponential(n); |
||
1834 | }, |
||
1835 | f: function (t, n) { |
||
1836 | return t.toFixed(n); |
||
1837 | }, |
||
1838 | g: function (t, n) { |
||
1839 | return t.toPrecision(n); |
||
1840 | }, |
||
1841 | o: function (t) { |
||
1842 | return Math.round(t).toString(8); |
||
1843 | }, |
||
1844 | p: function (t, n) { |
||
1845 | return Hn(100 * t, n); |
||
1846 | }, |
||
1847 | r: Hn, |
||
1848 | s: function (t, n) { |
||
1849 | var e = Cn(t, n); |
||
1850 | if (!e) return t + ''; |
||
1851 | var r = e[0], |
||
1852 | i = e[1], |
||
1853 | o = i - (zn = 3 * Math.max(-8, Math.min(8, Math.floor(i / 3)))) + 1, |
||
1854 | a = r.length; |
||
1855 | return o === a |
||
1856 | ? r |
||
1857 | : o > a |
||
1858 | ? r + new Array(o - a + 1).join('0') |
||
1859 | : o > 0 |
||
1860 | ? r.slice(0, o) + '.' + r.slice(o) |
||
1861 | : '0.' + new Array(1 - o).join('0') + Cn(t, Math.max(0, n + o - 1))[0]; |
||
1862 | }, |
||
1863 | X: function (t) { |
||
1864 | return Math.round(t).toString(16).toUpperCase(); |
||
1865 | }, |
||
1866 | x: function (t) { |
||
1867 | return Math.round(t).toString(16); |
||
1868 | }, |
||
1869 | }; |
||
1870 | function Vn(t) { |
||
1871 | return t; |
||
1872 | } |
||
1873 | var $n, |
||
1874 | Bn, |
||
1875 | Fn, |
||
1876 | Un = Array.prototype.map, |
||
1877 | Xn = [ |
||
1878 | 'y', |
||
1879 | 'z', |
||
1880 | 'a', |
||
1881 | 'f', |
||
1882 | 'p', |
||
1883 | 'n', |
||
1884 | 'µ', |
||
1885 | 'm', |
||
1886 | '', |
||
1887 | 'k', |
||
1888 | 'M', |
||
1889 | 'G', |
||
1890 | 'T', |
||
1891 | 'P', |
||
1892 | 'E', |
||
1893 | 'Z', |
||
1894 | 'Y', |
||
1895 | ]; |
||
1896 | function Wn(t) { |
||
1897 | var n, |
||
1898 | e, |
||
1899 | r = |
||
1900 | void 0 === t.grouping || void 0 === t.thousands |
||
1901 | ? Vn |
||
1902 | : ((n = Un.call(t.grouping, Number)), |
||
1903 | (e = t.thousands + ''), |
||
1904 | function (t, r) { |
||
1905 | for ( |
||
1906 | var i = t.length, o = [], a = 0, u = n[0], s = 0; |
||
1907 | i > 0 && |
||
1908 | u > 0 && |
||
1909 | (s + u + 1 > r && (u = Math.max(1, r - s)), |
||
1910 | o.push(t.substring((i -= u), i + u)), |
||
1911 | !((s += u + 1) > r)); |
||
1912 | |||
1913 | ) |
||
1914 | u = n[(a = (a + 1) % n.length)]; |
||
1915 | return o.reverse().join(e); |
||
1916 | }), |
||
1917 | i = void 0 === t.currency ? '' : t.currency[0] + '', |
||
1918 | o = void 0 === t.currency ? '' : t.currency[1] + '', |
||
1919 | a = void 0 === t.decimal ? '.' : t.decimal + '', |
||
1920 | u = |
||
1921 | void 0 === t.numerals |
||
1922 | ? Vn |
||
1923 | : (function (t) { |
||
1924 | return function (n) { |
||
1925 | return n.replace(/[0-9]/g, function (n) { |
||
1926 | return t[+n]; |
||
1927 | }); |
||
1928 | }; |
||
1929 | })(Un.call(t.numerals, String)), |
||
1930 | s = void 0 === t.percent ? '%' : t.percent + '', |
||
1931 | c = void 0 === t.minus ? '-' : t.minus + '', |
||
1932 | l = void 0 === t.nan ? 'NaN' : t.nan + ''; |
||
1933 | function h(t) { |
||
1934 | var n = (t = qn(t)).fill, |
||
1935 | e = t.align, |
||
1936 | h = t.sign, |
||
1937 | f = t.symbol, |
||
1938 | p = t.zero, |
||
1939 | d = t.width, |
||
1940 | g = t.comma, |
||
1941 | y = t.precision, |
||
1942 | v = t.trim, |
||
1943 | m = t.type; |
||
1944 | 'n' === m |
||
1945 | ? ((g = !0), (m = 'g')) |
||
1946 | : In[m] || (void 0 === y && (y = 12), (v = !0), (m = 'g')), |
||
1947 | (p || ('0' === n && '=' === e)) && ((p = !0), (n = '0'), (e = '=')); |
||
1948 | var _ = |
||
1949 | '$' === f |
||
1950 | ? i |
||
1951 | : '#' === f && /[boxX]/.test(m) |
||
1952 | ? '0' + m.toLowerCase() |
||
1953 | : '', |
||
1954 | w = '$' === f ? o : /[%p]/.test(m) ? s : '', |
||
1955 | x = In[m], |
||
1956 | b = /[defgprs%]/.test(m); |
||
1957 | function M(t) { |
||
1958 | var i, |
||
1959 | o, |
||
1960 | s, |
||
1961 | f = _, |
||
1962 | M = w; |
||
1963 | if ('c' === m) (M = x(t) + M), (t = ''); |
||
1964 | else { |
||
1965 | var k = (t = +t) < 0 || 1 / t < 0; |
||
1966 | if ( |
||
1967 | ((t = isNaN(t) ? l : x(Math.abs(t), y)), |
||
1968 | v && |
||
1969 | (t = (function (t) { |
||
1970 | t: for (var n, e = t.length, r = 1, i = -1; r < e; ++r) |
||
1971 | switch (t[r]) { |
||
1972 | case '.': |
||
1973 | i = n = r; |
||
1974 | break; |
||
1975 | case '0': |
||
1976 | 0 === i && (i = r), (n = r); |
||
1977 | break; |
||
1978 | default: |
||
1979 | if (!+t[r]) break t; |
||
1980 | i > 0 && (i = 0); |
||
1981 | } |
||
1982 | return i > 0 ? t.slice(0, i) + t.slice(n + 1) : t; |
||
1983 | })(t)), |
||
1984 | k && 0 == +t && '+' !== h && (k = !1), |
||
1985 | (f = |
||
1986 | (k ? ('(' === h ? h : c) : '-' === h || '(' === h ? '' : h) + f), |
||
1987 | (M = |
||
1988 | ('s' === m ? Xn[8 + zn / 3] : '') + |
||
1989 | M + |
||
1990 | (k && '(' === h ? ')' : '')), |
||
1991 | b) |
||
1992 | ) |
||
1993 | for (i = -1, o = t.length; ++i < o; ) |
||
1994 | if (48 > (s = t.charCodeAt(i)) || s > 57) { |
||
1995 | (M = (46 === s ? a + t.slice(i + 1) : t.slice(i)) + M), |
||
1996 | (t = t.slice(0, i)); |
||
1997 | break; |
||
1998 | } |
||
1999 | } |
||
2000 | g && !p && (t = r(t, 1 / 0)); |
||
2001 | var N = f.length + t.length + M.length, |
||
2002 | S = N < d ? new Array(d - N + 1).join(n) : ''; |
||
2003 | switch ( |
||
2004 | (g && |
||
2005 | p && |
||
2006 | ((t = r(S + t, S.length ? d - M.length : 1 / 0)), (S = '')), |
||
2007 | e) |
||
2008 | ) { |
||
2009 | case '<': |
||
2010 | t = f + t + M + S; |
||
2011 | break; |
||
2012 | case '=': |
||
2013 | t = f + S + t + M; |
||
2014 | break; |
||
2015 | case '^': |
||
2016 | t = S.slice(0, (N = S.length >> 1)) + f + t + M + S.slice(N); |
||
2017 | break; |
||
2018 | default: |
||
2019 | t = S + f + t + M; |
||
2020 | } |
||
2021 | return u(t); |
||
2022 | } |
||
2023 | return ( |
||
2024 | (y = |
||
2025 | void 0 === y |
||
2026 | ? 6 |
||
2027 | : /[gprs]/.test(m) |
||
2028 | ? Math.max(1, Math.min(21, y)) |
||
2029 | : Math.max(0, Math.min(20, y))), |
||
2030 | (M.toString = function () { |
||
2031 | return t + ''; |
||
2032 | }), |
||
2033 | M |
||
2034 | ); |
||
2035 | } |
||
2036 | return { |
||
2037 | format: h, |
||
2038 | formatPrefix: function (t, n) { |
||
2039 | var e = h((((t = qn(t)).type = 'f'), t)), |
||
2040 | r = 3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))), |
||
2041 | i = Math.pow(10, -r), |
||
2042 | o = Xn[8 + r / 3]; |
||
2043 | return function (t) { |
||
2044 | return e(i * t) + o; |
||
2045 | }; |
||
2046 | }, |
||
2047 | }; |
||
2048 | } |
||
2049 | function Yn(t, n, e, r) { |
||
2050 | var i, |
||
2051 | o = (function (t, n, e) { |
||
2052 | var r = Math.abs(n - t) / Math.max(0, e), |
||
2053 | i = Math.pow(10, Math.floor(Math.log(r) / Math.LN10)), |
||
2054 | o = r / i; |
||
2055 | return ( |
||
2056 | o >= Pt ? (i *= 10) : o >= Ot ? (i *= 5) : o >= jt && (i *= 2), |
||
2057 | n < t ? -i : i |
||
2058 | ); |
||
2059 | })(t, n, e); |
||
2060 | switch ((r = qn(null == r ? ',f' : r)).type) { |
||
2061 | case 's': |
||
2062 | var a = Math.max(Math.abs(t), Math.abs(n)); |
||
2063 | return ( |
||
2064 | null != r.precision || |
||
2065 | isNaN( |
||
2066 | (i = (function (t, n) { |
||
2067 | return Math.max( |
||
2068 | 0, |
||
2069 | 3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))) - |
||
2070 | Ln(Math.abs(t)) |
||
2071 | ); |
||
2072 | })(o, a)) |
||
2073 | ) || |
||
2074 | (r.precision = i), |
||
2075 | Fn(r, a) |
||
2076 | ); |
||
2077 | case '': |
||
2078 | case 'e': |
||
2079 | case 'g': |
||
2080 | case 'p': |
||
2081 | case 'r': |
||
2082 | null != r.precision || |
||
2083 | isNaN( |
||
2084 | (i = (function (t, n) { |
||
2085 | return ( |
||
2086 | (t = Math.abs(t)), |
||
2087 | (n = Math.abs(n) - t), |
||
2088 | Math.max(0, Ln(n) - Ln(t)) + 1 |
||
2089 | ); |
||
2090 | })(o, Math.max(Math.abs(t), Math.abs(n)))) |
||
2091 | ) || |
||
2092 | (r.precision = i - ('e' === r.type)); |
||
2093 | break; |
||
2094 | case 'f': |
||
2095 | case '%': |
||
2096 | null != r.precision || |
||
2097 | isNaN( |
||
2098 | (i = (function (t) { |
||
2099 | return Math.max(0, -Ln(Math.abs(t))); |
||
2100 | })(o)) |
||
2101 | ) || |
||
2102 | (r.precision = i - 2 * ('%' === r.type)); |
||
2103 | } |
||
2104 | return Bn(r); |
||
2105 | } |
||
2106 | function Gn(t) { |
||
2107 | var n = t.domain; |
||
2108 | return ( |
||
2109 | (t.ticks = function (t) { |
||
2110 | var e = n(); |
||
2111 | return (function (t, n, e) { |
||
2112 | var r, |
||
2113 | i, |
||
2114 | o, |
||
2115 | a, |
||
2116 | u = -1; |
||
2117 | if (((e = +e), (t = +t) === (n = +n) && e > 0)) return [t]; |
||
2118 | if ( |
||
2119 | ((r = n < t) && ((i = t), (t = n), (n = i)), |
||
2120 | 0 === (a = Tt(t, n, e)) || !isFinite(a)) |
||
2121 | ) |
||
2122 | return []; |
||
2123 | if (a > 0) |
||
2124 | for ( |
||
2125 | t = Math.ceil(t / a), |
||
2126 | n = Math.floor(n / a), |
||
2127 | o = new Array((i = Math.ceil(n - t + 1))); |
||
2128 | ++u < i; |
||
2129 | |||
2130 | ) |
||
2131 | o[u] = (t + u) * a; |
||
2132 | else |
||
2133 | for ( |
||
2134 | t = Math.floor(t * a), |
||
2135 | n = Math.ceil(n * a), |
||
2136 | o = new Array((i = Math.ceil(t - n + 1))); |
||
2137 | ++u < i; |
||
2138 | |||
2139 | ) |
||
2140 | o[u] = (t - u) / a; |
||
2141 | return r && o.reverse(), o; |
||
2142 | })(e[0], e[e.length - 1], null == t ? 10 : t); |
||
2143 | }), |
||
2144 | (t.tickFormat = function (t, e) { |
||
2145 | var r = n(); |
||
2146 | return Yn(r[0], r[r.length - 1], null == t ? 10 : t, e); |
||
2147 | }), |
||
2148 | (t.nice = function (e) { |
||
2149 | null == e && (e = 10); |
||
2150 | var r, |
||
2151 | i = n(), |
||
2152 | o = 0, |
||
2153 | a = i.length - 1, |
||
2154 | u = i[o], |
||
2155 | s = i[a]; |
||
2156 | return ( |
||
2157 | s < u && ((r = u), (u = s), (s = r), (r = o), (o = a), (a = r)), |
||
2158 | (r = Tt(u, s, e)) > 0 |
||
2159 | ? (r = Tt( |
||
2160 | (u = Math.floor(u / r) * r), |
||
2161 | (s = Math.ceil(s / r) * r), |
||
2162 | e |
||
2163 | )) |
||
2164 | : r < 0 && |
||
2165 | (r = Tt( |
||
2166 | (u = Math.ceil(u * r) / r), |
||
2167 | (s = Math.floor(s * r) / r), |
||
2168 | e |
||
2169 | )), |
||
2170 | r > 0 |
||
2171 | ? ((i[o] = Math.floor(u / r) * r), |
||
2172 | (i[a] = Math.ceil(s / r) * r), |
||
2173 | n(i)) |
||
2174 | : r < 0 && |
||
2175 | ((i[o] = Math.ceil(u * r) / r), |
||
2176 | (i[a] = Math.floor(s * r) / r), |
||
2177 | n(i)), |
||
2178 | t |
||
2179 | ); |
||
2180 | }), |
||
2181 | t |
||
2182 | ); |
||
2183 | } |
||
2184 | function Zn() { |
||
2185 | var t = Tn(); |
||
2186 | return ( |
||
2187 | (t.copy = function () { |
||
2188 | return On(t, Zn()); |
||
2189 | }), |
||
2190 | Ct.apply(t, arguments), |
||
2191 | Gn(t) |
||
2192 | ); |
||
2193 | } |
||
2194 | ($n = Wn({ |
||
2195 | decimal: '.', |
||
2196 | thousands: ',', |
||
2197 | grouping: [3], |
||
2198 | currency: ['$', ''], |
||
2199 | minus: '-', |
||
2200 | })), |
||
2201 | (Bn = $n.format), |
||
2202 | (Fn = $n.formatPrefix); |
||
2203 | var Kn = Array.prototype.slice; |
||
2204 | function Qn(t) { |
||
2205 | return t; |
||
2206 | } |
||
2207 | function Jn(t) { |
||
2208 | return 'translate(' + (t + 0.5) + ',0)'; |
||
2209 | } |
||
2210 | function te(t) { |
||
2211 | return 'translate(0,' + (t + 0.5) + ')'; |
||
2212 | } |
||
2213 | function ne(t) { |
||
2214 | return function (n) { |
||
2215 | return +t(n); |
||
2216 | }; |
||
2217 | } |
||
2218 | function ee(t) { |
||
2219 | var n = Math.max(0, t.bandwidth() - 1) / 2; |
||
2220 | return ( |
||
2221 | t.round() && (n = Math.round(n)), |
||
2222 | function (e) { |
||
2223 | return +t(e) + n; |
||
2224 | } |
||
2225 | ); |
||
2226 | } |
||
2227 | function re() { |
||
2228 | return !this.__axis; |
||
2229 | } |
||
2230 | function ie(t, n) { |
||
2231 | var e = [], |
||
2232 | r = null, |
||
2233 | i = null, |
||
2234 | o = 6, |
||
2235 | a = 6, |
||
2236 | u = 3, |
||
2237 | s = 1 === t || 4 === t ? -1 : 1, |
||
2238 | c = 4 === t || 2 === t ? 'x' : 'y', |
||
2239 | l = 1 === t || 3 === t ? Jn : te; |
||
2240 | function h(h) { |
||
2241 | var f = null == r ? (n.ticks ? n.ticks.apply(n, e) : n.domain()) : r, |
||
2242 | p = null == i ? (n.tickFormat ? n.tickFormat.apply(n, e) : Qn) : i, |
||
2243 | d = Math.max(o, 0) + u, |
||
2244 | g = n.range(), |
||
2245 | y = +g[0] + 0.5, |
||
2246 | v = +g[g.length - 1] + 0.5, |
||
2247 | m = (n.bandwidth ? ee : ne)(n.copy()), |
||
2248 | _ = h.selection ? h.selection() : h, |
||
2249 | w = _.selectAll('.domain').data([null]), |
||
2250 | x = _.selectAll('.tick').data(f, n).order(), |
||
2251 | b = x.exit(), |
||
2252 | M = x.enter().append('g').attr('class', 'tick'), |
||
2253 | k = x.select('line'), |
||
2254 | N = x.select('text'); |
||
2255 | (w = w.merge( |
||
2256 | w |
||
2257 | .enter() |
||
2258 | .insert('path', '.tick') |
||
2259 | .attr('class', 'domain') |
||
2260 | .attr('stroke', 'currentColor') |
||
2261 | )), |
||
2262 | (x = x.merge(M)), |
||
2263 | (k = k.merge( |
||
2264 | M.append('line') |
||
2265 | .attr('stroke', 'currentColor') |
||
2266 | .attr(c + '2', s * o) |
||
2267 | )), |
||
2268 | (N = N.merge( |
||
2269 | M.append('text') |
||
2270 | .attr('fill', 'currentColor') |
||
2271 | .attr(c, s * d) |
||
2272 | .attr('dy', 1 === t ? '0em' : 3 === t ? '0.71em' : '0.32em') |
||
2273 | )), |
||
2274 | h !== _ && |
||
2275 | ((w = w.transition(h)), |
||
2276 | (x = x.transition(h)), |
||
2277 | (k = k.transition(h)), |
||
2278 | (N = N.transition(h)), |
||
2279 | (b = b |
||
2280 | .transition(h) |
||
2281 | .attr('opacity', 1e-6) |
||
2282 | .attr('transform', function (t) { |
||
2283 | return isFinite((t = m(t))) |
||
2284 | ? l(t) |
||
2285 | : this.getAttribute('transform'); |
||
2286 | })), |
||
2287 | M.attr('opacity', 1e-6).attr('transform', function (t) { |
||
2288 | var n = this.parentNode.__axis; |
||
2289 | return l(n && isFinite((n = n(t))) ? n : m(t)); |
||
2290 | })), |
||
2291 | b.remove(), |
||
2292 | w.attr( |
||
2293 | 'd', |
||
2294 | 4 === t || 2 == t |
||
2295 | ? a |
||
2296 | ? 'M' + s * a + ',' + y + 'H0.5V' + v + 'H' + s * a |
||
2297 | : 'M0.5,' + y + 'V' + v |
||
2298 | : a |
||
2299 | ? 'M' + y + ',' + s * a + 'V0.5H' + v + 'V' + s * a |
||
2300 | : 'M' + y + ',0.5H' + v |
||
2301 | ), |
||
2302 | x.attr('opacity', 1).attr('transform', function (t) { |
||
2303 | return l(m(t)); |
||
2304 | }), |
||
2305 | k.attr(c + '2', s * o), |
||
2306 | N.attr(c, s * d).text(p), |
||
2307 | _.filter(re) |
||
2308 | .attr('fill', 'none') |
||
2309 | .attr('font-size', 10) |
||
2310 | .attr('font-family', 'sans-serif') |
||
2311 | .attr('text-anchor', 2 === t ? 'start' : 4 === t ? 'end' : 'middle'), |
||
2312 | _.each(function () { |
||
2313 | this.__axis = m; |
||
2314 | }); |
||
2315 | } |
||
2316 | return ( |
||
2317 | (h.scale = function (t) { |
||
2318 | return arguments.length ? ((n = t), h) : n; |
||
2319 | }), |
||
2320 | (h.ticks = function () { |
||
2321 | return (e = Kn.call(arguments)), h; |
||
2322 | }), |
||
2323 | (h.tickArguments = function (t) { |
||
2324 | return arguments.length |
||
2325 | ? ((e = null == t ? [] : Kn.call(t)), h) |
||
2326 | : e.slice(); |
||
2327 | }), |
||
2328 | (h.tickValues = function (t) { |
||
2329 | return arguments.length |
||
2330 | ? ((r = null == t ? null : Kn.call(t)), h) |
||
2331 | : r && r.slice(); |
||
2332 | }), |
||
2333 | (h.tickFormat = function (t) { |
||
2334 | return arguments.length ? ((i = t), h) : i; |
||
2335 | }), |
||
2336 | (h.tickSize = function (t) { |
||
2337 | return arguments.length ? ((o = a = +t), h) : o; |
||
2338 | }), |
||
2339 | (h.tickSizeInner = function (t) { |
||
2340 | return arguments.length ? ((o = +t), h) : o; |
||
2341 | }), |
||
2342 | (h.tickSizeOuter = function (t) { |
||
2343 | return arguments.length ? ((a = +t), h) : a; |
||
2344 | }), |
||
2345 | (h.tickPadding = function (t) { |
||
2346 | return arguments.length ? ((u = +t), h) : u; |
||
2347 | }), |
||
2348 | h |
||
2349 | ); |
||
2350 | } |
||
2351 | function oe(t) { |
||
2352 | return ie(3, t); |
||
2353 | } |
||
2354 | var ae = Math.PI, |
||
2355 | ue = 2 * ae, |
||
2356 | se = ue - 1e-6; |
||
2357 | function ce() { |
||
2358 | (this._x0 = this._y0 = this._x1 = this._y1 = null), (this._ = ''); |
||
2359 | } |
||
2360 | function le() { |
||
2361 | return new ce(); |
||
2362 | } |
||
2363 | function he(t) { |
||
2364 | return function () { |
||
2365 | return t; |
||
2366 | }; |
||
2367 | } |
||
2368 | function fe(t) { |
||
2369 | this._context = t; |
||
2370 | } |
||
2371 | function pe(t) { |
||
2372 | return new fe(t); |
||
2373 | } |
||
2374 | function de(t) { |
||
2375 | return t[0]; |
||
2376 | } |
||
2377 | function ge(t) { |
||
2378 | return t[1]; |
||
2379 | } |
||
2380 | (ce.prototype = le.prototype = { |
||
2381 | constructor: ce, |
||
2382 | moveTo: function (t, n) { |
||
2383 | this._ += |
||
2384 | 'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +n); |
||
2385 | }, |
||
2386 | closePath: function () { |
||
2387 | null !== this._x1 && |
||
2388 | ((this._x1 = this._x0), (this._y1 = this._y0), (this._ += 'Z')); |
||
2389 | }, |
||
2390 | lineTo: function (t, n) { |
||
2391 | this._ += 'L' + (this._x1 = +t) + ',' + (this._y1 = +n); |
||
2392 | }, |
||
2393 | quadraticCurveTo: function (t, n, e, r) { |
||
2394 | this._ += |
||
2395 | 'Q' + +t + ',' + +n + ',' + (this._x1 = +e) + ',' + (this._y1 = +r); |
||
2396 | }, |
||
2397 | bezierCurveTo: function (t, n, e, r, i, o) { |
||
2398 | this._ += |
||
2399 | 'C' + |
||
2400 | +t + |
||
2401 | ',' + |
||
2402 | +n + |
||
2403 | ',' + |
||
2404 | +e + |
||
2405 | ',' + |
||
2406 | +r + |
||
2407 | ',' + |
||
2408 | (this._x1 = +i) + |
||
2409 | ',' + |
||
2410 | (this._y1 = +o); |
||
2411 | }, |
||
2412 | arcTo: function (t, n, e, r, i) { |
||
2413 | (t = +t), (n = +n), (e = +e), (r = +r), (i = +i); |
||
2414 | var o = this._x1, |
||
2415 | a = this._y1, |
||
2416 | u = e - t, |
||
2417 | s = r - n, |
||
2418 | c = o - t, |
||
2419 | l = a - n, |
||
2420 | h = c * c + l * l; |
||
2421 | if (i < 0) throw new Error('negative radius: ' + i); |
||
2422 | if (null === this._x1) |
||
2423 | this._ += 'M' + (this._x1 = t) + ',' + (this._y1 = n); |
||
2424 | else if (h > 1e-6) |
||
2425 | if (Math.abs(l * u - s * c) > 1e-6 && i) { |
||
2426 | var f = e - o, |
||
2427 | p = r - a, |
||
2428 | d = u * u + s * s, |
||
2429 | g = f * f + p * p, |
||
2430 | y = Math.sqrt(d), |
||
2431 | v = Math.sqrt(h), |
||
2432 | m = i * Math.tan((ae - Math.acos((d + h - g) / (2 * y * v))) / 2), |
||
2433 | _ = m / v, |
||
2434 | w = m / y; |
||
2435 | Math.abs(_ - 1) > 1e-6 && |
||
2436 | (this._ += 'L' + (t + _ * c) + ',' + (n + _ * l)), |
||
2437 | (this._ += |
||
2438 | 'A' + |
||
2439 | i + |
||
2440 | ',' + |
||
2441 | i + |
||
2442 | ',0,0,' + |
||
2443 | +(l * f > c * p) + |
||
2444 | ',' + |
||
2445 | (this._x1 = t + w * u) + |
||
2446 | ',' + |
||
2447 | (this._y1 = n + w * s)); |
||
2448 | } else this._ += 'L' + (this._x1 = t) + ',' + (this._y1 = n); |
||
2449 | else; |
||
2450 | }, |
||
2451 | arc: function (t, n, e, r, i, o) { |
||
2452 | (t = +t), (n = +n), (o = !!o); |
||
2453 | var a = (e = +e) * Math.cos(r), |
||
2454 | u = e * Math.sin(r), |
||
2455 | s = t + a, |
||
2456 | c = n + u, |
||
2457 | l = 1 ^ o, |
||
2458 | h = o ? r - i : i - r; |
||
2459 | if (e < 0) throw new Error('negative radius: ' + e); |
||
2460 | null === this._x1 |
||
2461 | ? (this._ += 'M' + s + ',' + c) |
||
2462 | : (Math.abs(this._x1 - s) > 1e-6 || Math.abs(this._y1 - c) > 1e-6) && |
||
2463 | (this._ += 'L' + s + ',' + c), |
||
2464 | e && |
||
2465 | (h < 0 && (h = (h % ue) + ue), |
||
2466 | h > se |
||
2467 | ? (this._ += |
||
2468 | 'A' + |
||
2469 | e + |
||
2470 | ',' + |
||
2471 | e + |
||
2472 | ',0,1,' + |
||
2473 | l + |
||
2474 | ',' + |
||
2475 | (t - a) + |
||
2476 | ',' + |
||
2477 | (n - u) + |
||
2478 | 'A' + |
||
2479 | e + |
||
2480 | ',' + |
||
2481 | e + |
||
2482 | ',0,1,' + |
||
2483 | l + |
||
2484 | ',' + |
||
2485 | (this._x1 = s) + |
||
2486 | ',' + |
||
2487 | (this._y1 = c)) |
||
2488 | : h > 1e-6 && |
||
2489 | (this._ += |
||
2490 | 'A' + |
||
2491 | e + |
||
2492 | ',' + |
||
2493 | e + |
||
2494 | ',0,' + |
||
2495 | +(h >= ae) + |
||
2496 | ',' + |
||
2497 | l + |
||
2498 | ',' + |
||
2499 | (this._x1 = t + e * Math.cos(i)) + |
||
2500 | ',' + |
||
2501 | (this._y1 = n + e * Math.sin(i)))); |
||
2502 | }, |
||
2503 | rect: function (t, n, e, r) { |
||
2504 | this._ += |
||
2505 | 'M' + |
||
2506 | (this._x0 = this._x1 = +t) + |
||
2507 | ',' + |
||
2508 | (this._y0 = this._y1 = +n) + |
||
2509 | 'h' + |
||
2510 | +e + |
||
2511 | 'v' + |
||
2512 | +r + |
||
2513 | 'h' + |
||
2514 | -e + |
||
2515 | 'Z'; |
||
2516 | }, |
||
2517 | toString: function () { |
||
2518 | return this._; |
||
2519 | }, |
||
2520 | }), |
||
2521 | (fe.prototype = { |
||
2522 | areaStart: function () { |
||
2523 | this._line = 0; |
||
2524 | }, |
||
2525 | areaEnd: function () { |
||
2526 | this._line = NaN; |
||
2527 | }, |
||
2528 | lineStart: function () { |
||
2529 | this._point = 0; |
||
2530 | }, |
||
2531 | lineEnd: function () { |
||
2532 | (this._line || (0 !== this._line && 1 === this._point)) && |
||
2533 | this._context.closePath(), |
||
2534 | (this._line = 1 - this._line); |
||
2535 | }, |
||
2536 | point: function (t, n) { |
||
2537 | switch (((t = +t), (n = +n), this._point)) { |
||
2538 | case 0: |
||
2539 | (this._point = 1), |
||
2540 | this._line |
||
2541 | ? this._context.lineTo(t, n) |
||
2542 | : this._context.moveTo(t, n); |
||
2543 | break; |
||
2544 | case 1: |
||
2545 | this._point = 2; |
||
2546 | default: |
||
2547 | this._context.lineTo(t, n); |
||
2548 | } |
||
2549 | }, |
||
2550 | }); |
||
2551 | var ye = { value: function () {} }; |
||
2552 | function ve() { |
||
2553 | for (var t, n = 0, e = arguments.length, r = {}; n < e; ++n) { |
||
2554 | if (!(t = arguments[n] + '') || t in r || /[\s.]/.test(t)) |
||
2555 | throw new Error('illegal type: ' + t); |
||
2556 | r[t] = []; |
||
2557 | } |
||
2558 | return new me(r); |
||
2559 | } |
||
2560 | function me(t) { |
||
2561 | this._ = t; |
||
2562 | } |
||
2563 | function _e(t, n) { |
||
2564 | return t |
||
2565 | .trim() |
||
2566 | .split(/^|\s+/) |
||
2567 | .map(function (t) { |
||
2568 | var e = '', |
||
2569 | r = t.indexOf('.'); |
||
2570 | if ( |
||
2571 | (r >= 0 && ((e = t.slice(r + 1)), (t = t.slice(0, r))), |
||
2572 | t && !n.hasOwnProperty(t)) |
||
2573 | ) |
||
2574 | throw new Error('unknown type: ' + t); |
||
2575 | return { type: t, name: e }; |
||
2576 | }); |
||
2577 | } |
||
2578 | function we(t, n) { |
||
2579 | for (var e, r = 0, i = t.length; r < i; ++r) |
||
2580 | if ((e = t[r]).name === n) return e.value; |
||
2581 | } |
||
2582 | function xe(t, n, e) { |
||
2583 | for (var r = 0, i = t.length; r < i; ++r) |
||
2584 | if (t[r].name === n) { |
||
2585 | (t[r] = ye), (t = t.slice(0, r).concat(t.slice(r + 1))); |
||
2586 | break; |
||
2587 | } |
||
2588 | return null != e && t.push({ name: n, value: e }), t; |
||
2589 | } |
||
2590 | function be() { |
||
2591 | st.stopImmediatePropagation(); |
||
2592 | } |
||
2593 | function Me() { |
||
2594 | st.preventDefault(), st.stopImmediatePropagation(); |
||
2595 | } |
||
2596 | function ke(t) { |
||
2597 | var n = t.document.documentElement, |
||
2598 | e = wt(t).on('dragstart.drag', Me, !0); |
||
2599 | 'onselectstart' in n |
||
2600 | ? e.on('selectstart.drag', Me, !0) |
||
2601 | : ((n.__noselect = n.style.MozUserSelect), |
||
2602 | (n.style.MozUserSelect = 'none')); |
||
2603 | } |
||
2604 | function Ne(t) { |
||
2605 | return function () { |
||
2606 | return t; |
||
2607 | }; |
||
2608 | } |
||
2609 | function Se(t, n, e, r, i, o, a, u, s, c) { |
||
2610 | (this.target = t), |
||
2611 | (this.type = n), |
||
2612 | (this.subject = e), |
||
2613 | (this.identifier = r), |
||
2614 | (this.active = i), |
||
2615 | (this.x = o), |
||
2616 | (this.y = a), |
||
2617 | (this.dx = u), |
||
2618 | (this.dy = s), |
||
2619 | (this._ = c); |
||
2620 | } |
||
2621 | function Ae() { |
||
2622 | return !st.ctrlKey && !st.button; |
||
2623 | } |
||
2624 | function Ee() { |
||
2625 | return this.parentNode; |
||
2626 | } |
||
2627 | function Pe(t) { |
||
2628 | return null == t ? { x: st.x, y: st.y } : t; |
||
2629 | } |
||
2630 | function Oe() { |
||
2631 | return navigator.maxTouchPoints || 'ontouchstart' in this; |
||
2632 | } |
||
2633 | function je() { |
||
2634 | var t, |
||
2635 | n, |
||
2636 | e, |
||
2637 | r, |
||
2638 | i = Ae, |
||
2639 | o = Ee, |
||
2640 | a = Pe, |
||
2641 | u = Oe, |
||
2642 | s = {}, |
||
2643 | c = ve('start', 'drag', 'end'), |
||
2644 | l = 0, |
||
2645 | h = 0; |
||
2646 | function f(t) { |
||
2647 | t.on('mousedown.drag', p) |
||
2648 | .filter(u) |
||
2649 | .on('touchstart.drag', y) |
||
2650 | .on('touchmove.drag', v) |
||
2651 | .on('touchend.drag touchcancel.drag', m) |
||
2652 | .style('touch-action', 'none') |
||
2653 | .style('-webkit-tap-highlight-color', 'rgba(0,0,0,0)'); |
||
2654 | } |
||
2655 | function p() { |
||
2656 | if (!r && i.apply(this, arguments)) { |
||
2657 | var a = _('mouse', o.apply(this, arguments), Mt, this, arguments); |
||
2658 | a && |
||
2659 | (wt(st.view).on('mousemove.drag', d, !0).on('mouseup.drag', g, !0), |
||
2660 | ke(st.view), |
||
2661 | be(), |
||
2662 | (e = !1), |
||
2663 | (t = st.clientX), |
||
2664 | (n = st.clientY), |
||
2665 | a('start')); |
||
2666 | } |
||
2667 | } |
||
2668 | function d() { |
||
2669 | if ((Me(), !e)) { |
||
2670 | var r = st.clientX - t, |
||
2671 | i = st.clientY - n; |
||
2672 | e = r * r + i * i > h; |
||
2673 | } |
||
2674 | s.mouse('drag'); |
||
2675 | } |
||
2676 | function g() { |
||
2677 | wt(st.view).on('mousemove.drag mouseup.drag', null), |
||
2678 | (function (t, n) { |
||
2679 | var e = t.document.documentElement, |
||
2680 | r = wt(t).on('dragstart.drag', null); |
||
2681 | n && |
||
2682 | (r.on('click.drag', Me, !0), |
||
2683 | setTimeout(function () { |
||
2684 | r.on('click.drag', null); |
||
2685 | }, 0)), |
||
2686 | 'onselectstart' in e |
||
2687 | ? r.on('selectstart.drag', null) |
||
2688 | : ((e.style.MozUserSelect = e.__noselect), delete e.__noselect); |
||
2689 | })(st.view, e), |
||
2690 | Me(), |
||
2691 | s.mouse('end'); |
||
2692 | } |
||
2693 | function y() { |
||
2694 | if (i.apply(this, arguments)) { |
||
2695 | var t, |
||
2696 | n, |
||
2697 | e = st.changedTouches, |
||
2698 | r = o.apply(this, arguments), |
||
2699 | a = e.length; |
||
2700 | for (t = 0; t < a; ++t) |
||
2701 | (n = _(e[t].identifier, r, kt, this, arguments)) && |
||
2702 | (be(), n('start')); |
||
2703 | } |
||
2704 | } |
||
2705 | function v() { |
||
2706 | var t, |
||
2707 | n, |
||
2708 | e = st.changedTouches, |
||
2709 | r = e.length; |
||
2710 | for (t = 0; t < r; ++t) (n = s[e[t].identifier]) && (Me(), n('drag')); |
||
2711 | } |
||
2712 | function m() { |
||
2713 | var t, |
||
2714 | n, |
||
2715 | e = st.changedTouches, |
||
2716 | i = e.length; |
||
2717 | for ( |
||
2718 | r && clearTimeout(r), |
||
2719 | r = setTimeout(function () { |
||
2720 | r = null; |
||
2721 | }, 500), |
||
2722 | t = 0; |
||
2723 | t < i; |
||
2724 | ++t |
||
2725 | ) |
||
2726 | (n = s[e[t].identifier]) && (be(), n('end')); |
||
2727 | } |
||
2728 | function _(t, n, e, r, i) { |
||
2729 | var o, |
||
2730 | u, |
||
2731 | h, |
||
2732 | p = e(n, t), |
||
2733 | d = c.copy(); |
||
2734 | if ( |
||
2735 | dt(new Se(f, 'beforestart', o, t, l, p[0], p[1], 0, 0, d), function () { |
||
2736 | return ( |
||
2737 | null != (st.subject = o = a.apply(r, i)) && |
||
2738 | ((u = o.x - p[0] || 0), (h = o.y - p[1] || 0), !0) |
||
2739 | ); |
||
2740 | }) |
||
2741 | ) |
||
2742 | return function a(c) { |
||
2743 | var g, |
||
2744 | y = p; |
||
2745 | switch (c) { |
||
2746 | case 'start': |
||
2747 | (s[t] = a), (g = l++); |
||
2748 | break; |
||
2749 | case 'end': |
||
2750 | delete s[t], --l; |
||
2751 | case 'drag': |
||
2752 | (p = e(n, t)), (g = l); |
||
2753 | } |
||
2754 | dt( |
||
2755 | new Se( |
||
2756 | f, |
||
2757 | c, |
||
2758 | o, |
||
2759 | t, |
||
2760 | g, |
||
2761 | p[0] + u, |
||
2762 | p[1] + h, |
||
2763 | p[0] - y[0], |
||
2764 | p[1] - y[1], |
||
2765 | d |
||
2766 | ), |
||
2767 | d.apply, |
||
2768 | d, |
||
2769 | [c, r, i] |
||
2770 | ); |
||
2771 | }; |
||
2772 | } |
||
2773 | return ( |
||
2774 | (f.filter = function (t) { |
||
2775 | return arguments.length |
||
2776 | ? ((i = 'function' == typeof t ? t : Ne(!!t)), f) |
||
2777 | : i; |
||
2778 | }), |
||
2779 | (f.container = function (t) { |
||
2780 | return arguments.length |
||
2781 | ? ((o = 'function' == typeof t ? t : Ne(t)), f) |
||
2782 | : o; |
||
2783 | }), |
||
2784 | (f.subject = function (t) { |
||
2785 | return arguments.length |
||
2786 | ? ((a = 'function' == typeof t ? t : Ne(t)), f) |
||
2787 | : a; |
||
2788 | }), |
||
2789 | (f.touchable = function (t) { |
||
2790 | return arguments.length |
||
2791 | ? ((u = 'function' == typeof t ? t : Ne(!!t)), f) |
||
2792 | : u; |
||
2793 | }), |
||
2794 | (f.on = function () { |
||
2795 | var t = c.on.apply(c, arguments); |
||
2796 | return t === c ? f : t; |
||
2797 | }), |
||
2798 | (f.clickDistance = function (t) { |
||
2799 | return arguments.length ? ((h = (t = +t) * t), f) : Math.sqrt(h); |
||
2800 | }), |
||
2801 | f |
||
2802 | ); |
||
2803 | } |
||
2804 | (me.prototype = ve.prototype = { |
||
2805 | constructor: me, |
||
2806 | on: function (t, n) { |
||
2807 | var e, |
||
2808 | r = this._, |
||
2809 | i = _e(t + '', r), |
||
2810 | o = -1, |
||
2811 | a = i.length; |
||
2812 | if (!(arguments.length < 2)) { |
||
2813 | if (null != n && 'function' != typeof n) |
||
2814 | throw new Error('invalid callback: ' + n); |
||
2815 | for (; ++o < a; ) |
||
2816 | if ((e = (t = i[o]).type)) r[e] = xe(r[e], t.name, n); |
||
2817 | else if (null == n) for (e in r) r[e] = xe(r[e], t.name, null); |
||
2818 | return this; |
||
2819 | } |
||
2820 | for (; ++o < a; ) |
||
2821 | if ((e = (t = i[o]).type) && (e = we(r[e], t.name))) return e; |
||
2822 | }, |
||
2823 | copy: function () { |
||
2824 | var t = {}, |
||
2825 | n = this._; |
||
2826 | for (var e in n) t[e] = n[e].slice(); |
||
2827 | return new me(t); |
||
2828 | }, |
||
2829 | call: function (t, n) { |
||
2830 | if ((e = arguments.length - 2) > 0) |
||
2831 | for (var e, r, i = new Array(e), o = 0; o < e; ++o) |
||
2832 | i[o] = arguments[o + 2]; |
||
2833 | if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); |
||
2834 | for (o = 0, e = (r = this._[t]).length; o < e; ++o) |
||
2835 | r[o].value.apply(n, i); |
||
2836 | }, |
||
2837 | apply: function (t, n, e) { |
||
2838 | if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); |
||
2839 | for (var r = this._[t], i = 0, o = r.length; i < o; ++i) |
||
2840 | r[i].value.apply(n, e); |
||
2841 | }, |
||
2842 | }), |
||
2843 | (Se.prototype.on = function () { |
||
2844 | var t = this._.on.apply(this._, arguments); |
||
2845 | return t === this._ ? this : t; |
||
2846 | }); |
||
2847 | var Te = function (t) { |
||
2848 | return 50 * Math.sin((Math.PI / 50) * t - 0.5 * Math.PI) + 50; |
||
2849 | }, |
||
2850 | Ce = function (t) { |
||
2851 | return (25 * (2 * Math.asin((t - 50) / 50) + Math.PI)) / Math.PI; |
||
2852 | }, |
||
2853 | Le = function (t) { |
||
2854 | return t >= 80 && t <= 100; |
||
2855 | }, |
||
2856 | ze = function (t, n) { |
||
2857 | var e = t + 5; |
||
2858 | return Le(n) ? -1 * e : e; |
||
2859 | }, |
||
2860 | De = { |
||
2861 | target: 'svg', |
||
2862 | width: 900, |
||
2863 | height: 300, |
||
2864 | preview: !1, |
||
2865 | margin: { top: 20, right: 20, bottom: 40, left: 20 }, |
||
2866 | }; |
||
2867 | return (function (n) { |
||
2868 | !(function (t, n) { |
||
2869 | if ('function' != typeof n && null !== n) |
||
2870 | throw new TypeError( |
||
2871 | 'Super expression must either be null or a function' |
||
2872 | ); |
||
2873 | (t.prototype = Object.create(n && n.prototype, { |
||
2874 | constructor: { value: t, writable: !0, configurable: !0 }, |
||
2875 | })), |
||
2876 | n && o(t, n); |
||
2877 | })(l, n); |
||
2878 | var e, |
||
2879 | i, |
||
2880 | u, |
||
2881 | c = s(l); |
||
2882 | function l(t, n) { |
||
2883 | var e; |
||
2884 | return ( |
||
2885 | (function (t, n) { |
||
2886 | if (!(t instanceof n)) |
||
2887 | throw new TypeError('Cannot call a class as a function'); |
||
2888 | })(this, l), |
||
2889 | (e = c.call(this)), |
||
2890 | Object.assign(a(e), De, { data: t }, n), |
||
2891 | e.init(), |
||
2892 | e |
||
2893 | ); |
||
2894 | } |
||
2895 | return ( |
||
2896 | (e = l), |
||
2897 | (i = [ |
||
2898 | { |
||
2899 | key: 'init', |
||
2900 | value: function () { |
||
2901 | var t = this.width, |
||
2902 | n = this.height, |
||
2903 | e = this.margin, |
||
2904 | r = this.target; |
||
2905 | (this.chartWidth = t - e.left - e.right), |
||
2906 | (this.chartHeight = n - e.top - e.bottom), |
||
2907 | (this.svg = wt(r) |
||
2908 | .attr('width', t) |
||
2909 | .attr('height', n) |
||
2910 | .append('g') |
||
2911 | .attr( |
||
2912 | 'transform', |
||
2913 | 'translate('.concat(e.left, ', ').concat(e.top, ')') |
||
2914 | )), |
||
2915 | (this.xScale = Zn().domain([0, 100]).range([0, this.chartWidth])), |
||
2916 | (this.yScale = Zn() |
||
2917 | .domain([0, 100]) |
||
2918 | .range([this.chartHeight, 0])), |
||
2919 | this.normalizeData(); |
||
2920 | }, |
||
2921 | }, |
||
2922 | { |
||
2923 | key: 'normalizeData', |
||
2924 | value: function () { |
||
2925 | this.data = this.data.map(function (t) { |
||
2926 | return { |
||
2927 | color: t.color, |
||
2928 | description: t.description, |
||
2929 | link: t.link, |
||
2930 | x: t.x ? t.x : 0, |
||
2931 | y: Te(t.y ? t.y : 0), |
||
2932 | size: t.size ? t.size : 10, |
||
2933 | }; |
||
2934 | }); |
||
2935 | }, |
||
2936 | }, |
||
2937 | { |
||
2938 | key: 'render', |
||
2939 | value: function () { |
||
2940 | var t = this; |
||
2941 | this.renderBottomLine(5), |
||
2942 | this.renderMainCurve(), |
||
2943 | this.renderMiddleLine(), |
||
2944 | this.renderFooterText(); |
||
2945 | var n, |
||
2946 | e = this, |
||
2947 | i = je().on('drag', function (t) { |
||
2948 | var n = st.x; |
||
2949 | n < 0 |
||
2950 | ? ((n = 0), |
||
2951 | e.emit( |
||
2952 | 'home', |
||
2953 | r(r({}, t), {}, { y: Ce(e.yScale.invert(t.y)) }) |
||
2954 | )) |
||
2955 | : n > e.chartWidth && |
||
2956 | ((n = e.chartWidth), |
||
2957 | e.emit( |
||
2958 | 'end', |
||
2959 | r( |
||
2960 | r({}, t), |
||
2961 | {}, |
||
2962 | { |
||
2963 | x: e.xScale.invert(e.chartWidth), |
||
2964 | y: Ce(e.yScale.invert(t.y)), |
||
2965 | } |
||
2966 | ) |
||
2967 | )); |
||
2968 | var i = e.xScale.invert(n); |
||
2969 | (t.x = n), (t.y = e.yScale(Te(i))); |
||
2970 | var o = Ce(e.yScale.invert(t.y)), |
||
2971 | a = { x: i, y: o }; |
||
2972 | wt(this).on('click', function () { |
||
2973 | e.emit('pointClick', r(r({}, t), a)); |
||
2974 | }), |
||
2975 | e.preview || |
||
2976 | (wt(this) |
||
2977 | .attr( |
||
2978 | 'transform', |
||
2979 | 'translate('.concat(t.x, ', ').concat(t.y, ')') |
||
2980 | ) |
||
2981 | .select('text') |
||
2982 | .style('text-anchor', function () { |
||
2983 | return Le(i) ? 'end' : 'start'; |
||
2984 | }) |
||
2985 | .attr('x', function (t) { |
||
2986 | return ze(t.size, i); |
||
2987 | }), |
||
2988 | e.emit('move', i, o), |
||
2989 | e.emit('moved', r(r({}, t), a))); |
||
2990 | }); |
||
2991 | (n = this.preview |
||
2992 | ? this.undraggablePoint() |
||
2993 | : this.svg |
||
2994 | .selectAll('.hill-chart-group') |
||
2995 | .data(this.data) |
||
2996 | .enter() |
||
2997 | .append('g') |
||
2998 | .attr('class', 'hill-chart-group') |
||
2999 | .attr('transform', function (n) { |
||
3000 | return ( |
||
3001 | (n.x = t.xScale(n.x)), |
||
3002 | (n.y = t.yScale(n.y)), |
||
3003 | 'translate('.concat(n.x, ', ').concat(n.y, ')') |
||
3004 | ); |
||
3005 | }) |
||
3006 | .call(i)) |
||
3007 | .append('circle') |
||
3008 | .attr('class', 'hill-chart-circle') |
||
3009 | .attr('fill', function (t) { |
||
3010 | return t.color; |
||
3011 | }) |
||
3012 | .attr('cx', 0) |
||
3013 | .attr('cy', 0) |
||
3014 | .attr('r', function (t) { |
||
3015 | return t.size; |
||
3016 | }), |
||
3017 | n |
||
3018 | .append('text') |
||
3019 | .text(function (t) { |
||
3020 | return t.description; |
||
3021 | }) |
||
3022 | .attr('x', function (n) { |
||
3023 | return ze(n.size, t.xScale.invert(n.x)); |
||
3024 | }) |
||
3025 | .style('text-anchor', function (n) { |
||
3026 | return Le(t.xScale.invert(n.x)) ? 'end' : 'start'; |
||
3027 | }) |
||
3028 | .attr('y', 5); |
||
3029 | }, |
||
3030 | }, |
||
3031 | { |
||
3032 | key: 'undraggablePoint', |
||
3033 | value: function () { |
||
3034 | var t = this; |
||
3035 | return this.svg |
||
3036 | .selectAll('.hill-chart-group') |
||
3037 | .data(this.data) |
||
3038 | .enter() |
||
3039 | .append('a') |
||
3040 | .attr('href', function (t) { |
||
3041 | return t.link ? t.link : '#'; |
||
3042 | }) |
||
3043 | .append('g') |
||
3044 | .attr('class', 'hill-chart-group') |
||
3045 | .style('cursor', 'pointer') |
||
3046 | .attr('transform', function (n) { |
||
3047 | return ( |
||
3048 | (n.x = t.xScale(n.x)), |
||
3049 | (n.y = t.yScale(n.y)), |
||
3050 | 'translate('.concat(n.x, ', ').concat(n.y, ')') |
||
3051 | ); |
||
3052 | }); |
||
3053 | }, |
||
3054 | }, |
||
3055 | { |
||
3056 | key: 'renderMainCurve', |
||
3057 | value: function () { |
||
3058 | var t = this; |
||
3059 | (this.mainLineCurvePoints = (function (t, n, e) { |
||
3060 | (t = +t), |
||
3061 | (n = +n), |
||
3062 | (e = |
||
3063 | (i = arguments.length) < 2 |
||
3064 | ? ((n = t), (t = 0), 1) |
||
3065 | : i < 3 |
||
3066 | ? 1 |
||
3067 | : +e); |
||
3068 | for ( |
||
3069 | var r = -1, |
||
3070 | i = 0 | Math.max(0, Math.ceil((n - t) / e)), |
||
3071 | o = new Array(i); |
||
3072 | ++r < i; |
||
3073 | |||
3074 | ) |
||
3075 | o[r] = t + r * e; |
||
3076 | return o; |
||
3077 | })(0, 100, 0.1).map(function (t) { |
||
3078 | return { x: t, y: Te(t) }; |
||
3079 | })), |
||
3080 | (this.line = (function () { |
||
3081 | var t = de, |
||
3082 | n = ge, |
||
3083 | e = he(!0), |
||
3084 | r = null, |
||
3085 | i = pe, |
||
3086 | o = null; |
||
3087 | function a(a) { |
||
3088 | var u, |
||
3089 | s, |
||
3090 | c, |
||
3091 | l = a.length, |
||
3092 | h = !1; |
||
3093 | for (null == r && (o = i((c = le()))), u = 0; u <= l; ++u) |
||
3094 | !(u < l && e((s = a[u]), u, a)) === h && |
||
3095 | ((h = !h) ? o.lineStart() : o.lineEnd()), |
||
3096 | h && o.point(+t(s, u, a), +n(s, u, a)); |
||
3097 | if (c) return (o = null), c + '' || null; |
||
3098 | } |
||
3099 | return ( |
||
3100 | (a.x = function (n) { |
||
3101 | return arguments.length |
||
3102 | ? ((t = 'function' == typeof n ? n : he(+n)), a) |
||
3103 | : t; |
||
3104 | }), |
||
3105 | (a.y = function (t) { |
||
3106 | return arguments.length |
||
3107 | ? ((n = 'function' == typeof t ? t : he(+t)), a) |
||
3108 | : n; |
||
3109 | }), |
||
3110 | (a.defined = function (t) { |
||
3111 | return arguments.length |
||
3112 | ? ((e = 'function' == typeof t ? t : he(!!t)), a) |
||
3113 | : e; |
||
3114 | }), |
||
3115 | (a.curve = function (t) { |
||
3116 | return arguments.length |
||
3117 | ? ((i = t), null != r && (o = i(r)), a) |
||
3118 | : i; |
||
3119 | }), |
||
3120 | (a.context = function (t) { |
||
3121 | return arguments.length |
||
3122 | ? (null == t ? (r = o = null) : (o = i((r = t))), a) |
||
3123 | : r; |
||
3124 | }), |
||
3125 | a |
||
3126 | ); |
||
3127 | })() |
||
3128 | .x(function (n) { |
||
3129 | return t.xScale(n.x); |
||
3130 | }) |
||
3131 | .y(function (n) { |
||
3132 | return t.yScale(n.y); |
||
3133 | })), |
||
3134 | this.svg |
||
3135 | .append('path') |
||
3136 | .attr('class', 'chart-hill-main-curve') |
||
3137 | .datum(this.mainLineCurvePoints) |
||
3138 | .attr('d', this.line); |
||
3139 | }, |
||
3140 | }, |
||
3141 | { |
||
3142 | key: 'renderBottomLine', |
||
3143 | value: function () { |
||
3144 | var t = |
||
3145 | arguments.length > 0 && void 0 !== arguments[0] |
||
3146 | ? arguments[0] |
||
3147 | : 5; |
||
3148 | (this.bottomLine = oe(this.xScale).ticks(0).tickSize(0)), |
||
3149 | this.svg |
||
3150 | .append('g') |
||
3151 | .attr('class', 'hill-chart-bottom-line') |
||
3152 | .attr( |
||
3153 | 'transform', |
||
3154 | 'translate(0, '.concat(this.chartHeight + t, ')') |
||
3155 | ) |
||
3156 | .call(this.bottomLine); |
||
3157 | }, |
||
3158 | }, |
||
3159 | { |
||
3160 | key: 'renderMiddleLine', |
||
3161 | value: function () { |
||
3162 | this.svg |
||
3163 | .append('line') |
||
3164 | .attr('class', 'hill-chart-middle-line') |
||
3165 | .attr('y1', this.yScale(0)) |
||
3166 | .attr('y2', this.yScale(100)) |
||
3167 | .attr('x2', this.xScale(50)) |
||
3168 | .attr('x1', this.xScale(50)); |
||
3169 | }, |
||
3170 | }, |
||
3171 | { |
||
3172 | key: 'renderFooterText', |
||
3173 | value: function () { |
||
3174 | this.svg |
||
3175 | .append('text') |
||
3176 | .attr('class', 'hill-chart-text') |
||
3177 | .text('Figuring things out') |
||
3178 | .attr('x', this.xScale(25)) |
||
3179 | .attr('y', this.chartHeight + 25), |
||
3180 | this.svg |
||
3181 | .append('text') |
||
3182 | .attr('class', 'hill-chart-text') |
||
3183 | .text('Making it happen') |
||
3184 | .attr('x', this.xScale(75)) |
||
3185 | .attr('y', this.chartHeight + 25); |
||
3186 | }, |
||
3187 | }, |
||
3188 | ]) && t(e.prototype, i), |
||
3189 | u && t(e, u), |
||
3190 | l |
||
3191 | ); |
||
3192 | })(f); |
||
3193 | }); |
||
3194 |