@carbon/charts 1.24.0 → 1.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/{angle-utils-BWFhuTnR.mjs → angle-utils-4EO2XuoV.mjs} +2 -2
- package/dist/{angle-utils-BWFhuTnR.mjs.map → angle-utils-4EO2XuoV.mjs.map} +1 -1
- package/dist/{array-4CiuhqlQ.mjs → array-Ctg9nQNq.mjs} +2 -2
- package/dist/{array-4CiuhqlQ.mjs.map → array-Ctg9nQNq.mjs.map} +1 -1
- package/dist/{choropleth-Bz2poHE5.mjs → choropleth-BgycggQG.mjs} +1445 -1429
- package/dist/choropleth-BgycggQG.mjs.map +1 -0
- package/dist/{color-scale-utils-DCBFJmbg.mjs → color-scale-utils-igrenh2d.mjs} +363 -361
- package/dist/{color-scale-utils-DCBFJmbg.mjs.map → color-scale-utils-igrenh2d.mjs.map} +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/configuration.d.ts +5 -0
- package/dist/{index-BILVb6NZ.mjs → index-B-DZT7fS.mjs} +241 -240
- package/dist/{index-BILVb6NZ.mjs.map → index-B-DZT7fS.mjs.map} +1 -1
- package/dist/index.mjs +7 -7
- package/dist/model/index.mjs +2 -2
- package/dist/services/index.mjs +3 -3
- package/dist/services/zoom.d.ts +1 -0
- package/dist/umd/bundle.umd.cjs +10 -10
- package/dist/umd/bundle.umd.cjs.map +1 -1
- package/dist/umd/bundle.umd.js +10 -10
- package/package.json +2 -2
- package/dist/choropleth-Bz2poHE5.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a3 as Lt,
|
|
2
|
-
import { z as ii, A, e as Q, S as O, D as ni, s as
|
|
1
|
+
import { a3 as Lt, aD as Nt, aE as Ct, aF as It, aG as ut, aH as Zt, aI as Ft, aJ as zt, a0 as Vt, aK as Ht, aL as Yt, aM as Xt, aN as Gt, _ as $t, W as Ut, ay as j, aO as Kt, aP as jt, n as q, g as c, F as W, aQ as v, aR as M, aS as E, aT as qt, aU as ft, aV as pt, h as J, as as Wt, ap as Jt, ad as mt, aj as Qt, H as ti } from "./color-scale-utils-igrenh2d.mjs";
|
|
2
|
+
import { z as ii, A, e as Q, S as O, D as ni, s as ei, v as si, x as oi, y as ai, u as ri } from "./angle-utils-4EO2XuoV.mjs";
|
|
3
3
|
import { $ as w, e as _, i as C, S as p } from "./axis-scales-CPuwbFQf.mjs";
|
|
4
4
|
function dt(i) {
|
|
5
5
|
var t = i == null ? 0 : i.length;
|
|
@@ -9,10 +9,10 @@ function hi(i) {
|
|
|
9
9
|
return Nt(Ct(i, void 0, dt), i + "");
|
|
10
10
|
}
|
|
11
11
|
function ci(i, t, n) {
|
|
12
|
-
var
|
|
13
|
-
t < 0 && (t = -t >
|
|
14
|
-
for (var o = Array(
|
|
15
|
-
o[
|
|
12
|
+
var e = -1, s = i.length;
|
|
13
|
+
t < 0 && (t = -t > s ? 0 : s + t), n = n > s ? s : n, n < 0 && (n += s), s = t > n ? 0 : n - t >>> 0, t >>>= 0;
|
|
14
|
+
for (var o = Array(s); ++e < s; )
|
|
15
|
+
o[e] = i[e + t];
|
|
16
16
|
return o;
|
|
17
17
|
}
|
|
18
18
|
function li(i, t) {
|
|
@@ -28,12 +28,12 @@ var fi = 1, pi = 2, mi = 4, di = hi(function(i, t) {
|
|
|
28
28
|
var n = {};
|
|
29
29
|
if (i == null)
|
|
30
30
|
return n;
|
|
31
|
-
var
|
|
31
|
+
var e = !1;
|
|
32
32
|
t = Vt(t, function(o) {
|
|
33
|
-
return o = ut(o, i),
|
|
34
|
-
}), Ht(i, Yt(i), n),
|
|
35
|
-
for (var
|
|
36
|
-
_i(n, t[
|
|
33
|
+
return o = ut(o, i), e || (e = o.length > 1), o;
|
|
34
|
+
}), Ht(i, Yt(i), n), e && (n = Xt(n, fi | pi | mi, ui));
|
|
35
|
+
for (var s = t.length; s--; )
|
|
36
|
+
_i(n, t[s]);
|
|
37
37
|
return n;
|
|
38
38
|
});
|
|
39
39
|
function tt(i) {
|
|
@@ -62,12 +62,12 @@ function nt(i) {
|
|
|
62
62
|
}
|
|
63
63
|
function Di(i) {
|
|
64
64
|
const t = i(tt, it), n = t.domain;
|
|
65
|
-
let
|
|
65
|
+
let e = 10, s, o;
|
|
66
66
|
function a() {
|
|
67
|
-
return
|
|
67
|
+
return s = Ti(e), o = vi(e), n()[0] < 0 ? (s = nt(s), o = nt(o), i(xi, gi)) : i(tt, it), t;
|
|
68
68
|
}
|
|
69
69
|
return t.base = function(r) {
|
|
70
|
-
return arguments.length ? (
|
|
70
|
+
return arguments.length ? (e = +r, a()) : e;
|
|
71
71
|
}, t.domain = function(r) {
|
|
72
72
|
return arguments.length ? (n(r), a()) : n();
|
|
73
73
|
}, t.ticks = (r) => {
|
|
@@ -75,37 +75,37 @@ function Di(i) {
|
|
|
75
75
|
let l = h[0], f = h[h.length - 1];
|
|
76
76
|
const y = f < l;
|
|
77
77
|
y && ([l, f] = [f, l]);
|
|
78
|
-
let d =
|
|
78
|
+
let d = s(l), T = s(f), g, m;
|
|
79
79
|
const D = r == null ? 10 : +r;
|
|
80
80
|
let u = [];
|
|
81
|
-
if (!(
|
|
81
|
+
if (!(e % 1) && T - d < D) {
|
|
82
82
|
if (d = Math.floor(d), T = Math.ceil(T), l > 0) {
|
|
83
83
|
for (; d <= T; ++d)
|
|
84
|
-
for (g = 1; g <
|
|
84
|
+
for (g = 1; g < e; ++g)
|
|
85
85
|
if (m = d < 0 ? g / o(-d) : g * o(d), !(m < l)) {
|
|
86
86
|
if (m > f) break;
|
|
87
87
|
u.push(m);
|
|
88
88
|
}
|
|
89
89
|
} else for (; d <= T; ++d)
|
|
90
|
-
for (g =
|
|
90
|
+
for (g = e - 1; g >= 1; --g)
|
|
91
91
|
if (m = d > 0 ? g / o(-d) : g * o(d), !(m < l)) {
|
|
92
92
|
if (m > f) break;
|
|
93
93
|
u.push(m);
|
|
94
94
|
}
|
|
95
|
-
u.length * 2 < D && (u =
|
|
95
|
+
u.length * 2 < D && (u = j(l, f, D));
|
|
96
96
|
} else
|
|
97
|
-
u =
|
|
97
|
+
u = j(d, T, Math.min(T - d, D)).map(o);
|
|
98
98
|
return y ? u.reverse() : u;
|
|
99
99
|
}, t.tickFormat = (r, h) => {
|
|
100
|
-
if (r == null && (r = 10), h == null && (h =
|
|
101
|
-
const l = Math.max(1,
|
|
100
|
+
if (r == null && (r = 10), h == null && (h = e === 10 ? "s" : ","), typeof h != "function" && (!(e % 1) && (h = Kt(h)).precision == null && (h.trim = !0), h = jt(h)), r === 1 / 0) return h;
|
|
101
|
+
const l = Math.max(1, e * r / t.ticks().length);
|
|
102
102
|
return (f) => {
|
|
103
|
-
let y = f / o(Math.round(
|
|
104
|
-
return y *
|
|
103
|
+
let y = f / o(Math.round(s(f)));
|
|
104
|
+
return y * e < e - 0.5 && (y *= e), y <= l ? h(f) : "";
|
|
105
105
|
};
|
|
106
106
|
}, t.nice = () => n(ii(n(), {
|
|
107
|
-
floor: (r) => o(Math.floor(
|
|
108
|
-
ceil: (r) => o(Math.ceil(
|
|
107
|
+
floor: (r) => o(Math.floor(s(r))),
|
|
108
|
+
ceil: (r) => o(Math.ceil(s(r)))
|
|
109
109
|
})), t;
|
|
110
110
|
}
|
|
111
111
|
function xt() {
|
|
@@ -239,8 +239,8 @@ yt.prototype = {
|
|
|
239
239
|
break;
|
|
240
240
|
case 2:
|
|
241
241
|
this._point = 3;
|
|
242
|
-
var n = (this._x0 + 4 * this._x1 + i) / 6,
|
|
243
|
-
this._line ? this._context.lineTo(n,
|
|
242
|
+
var n = (this._x0 + 4 * this._x1 + i) / 6, e = (this._y0 + 4 * this._y1 + t) / 6;
|
|
243
|
+
this._line ? this._context.lineTo(n, e) : this._context.moveTo(n, e);
|
|
244
244
|
break;
|
|
245
245
|
case 3:
|
|
246
246
|
this._point = 4;
|
|
@@ -265,10 +265,10 @@ vt.prototype = {
|
|
|
265
265
|
lineEnd: function() {
|
|
266
266
|
var i = this._x, t = this._y, n = i.length - 1;
|
|
267
267
|
if (n > 0)
|
|
268
|
-
for (var
|
|
268
|
+
for (var e = i[0], s = t[0], o = i[n] - e, a = t[n] - s, r = -1, h; ++r <= n; )
|
|
269
269
|
h = r / n, this._basis.point(
|
|
270
|
-
this._beta * i[r] + (1 - this._beta) * (
|
|
271
|
-
this._beta * t[r] + (1 - this._beta) * (
|
|
270
|
+
this._beta * i[r] + (1 - this._beta) * (e + h * o),
|
|
271
|
+
this._beta * t[r] + (1 - this._beta) * (s + h * a)
|
|
272
272
|
);
|
|
273
273
|
this._x = this._y = null, this._basis.lineEnd();
|
|
274
274
|
},
|
|
@@ -277,11 +277,11 @@ vt.prototype = {
|
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
279
|
const bi = function i(t) {
|
|
280
|
-
function n(
|
|
281
|
-
return t === 1 ? new L(
|
|
280
|
+
function n(e) {
|
|
281
|
+
return t === 1 ? new L(e) : new vt(e, t);
|
|
282
282
|
}
|
|
283
|
-
return n.beta = function(
|
|
284
|
-
return i(+
|
|
283
|
+
return n.beta = function(e) {
|
|
284
|
+
return i(+e);
|
|
285
285
|
}, n;
|
|
286
286
|
}(0.85);
|
|
287
287
|
function R(i, t, n) {
|
|
@@ -337,11 +337,11 @@ z.prototype = {
|
|
|
337
337
|
}
|
|
338
338
|
};
|
|
339
339
|
const Si = function i(t) {
|
|
340
|
-
function n(
|
|
341
|
-
return new z(
|
|
340
|
+
function n(e) {
|
|
341
|
+
return new z(e, t);
|
|
342
342
|
}
|
|
343
|
-
return n.tension = function(
|
|
344
|
-
return i(+
|
|
343
|
+
return n.tension = function(e) {
|
|
344
|
+
return i(+e);
|
|
345
345
|
}, n;
|
|
346
346
|
}(0);
|
|
347
347
|
function V(i, t) {
|
|
@@ -388,11 +388,11 @@ V.prototype = {
|
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
const Pi = function i(t) {
|
|
391
|
-
function n(
|
|
392
|
-
return new V(
|
|
391
|
+
function n(e) {
|
|
392
|
+
return new V(e, t);
|
|
393
393
|
}
|
|
394
|
-
return n.tension = function(
|
|
395
|
-
return i(+
|
|
394
|
+
return n.tension = function(e) {
|
|
395
|
+
return i(+e);
|
|
396
396
|
}, n;
|
|
397
397
|
}(0);
|
|
398
398
|
function H(i, t) {
|
|
@@ -433,24 +433,24 @@ H.prototype = {
|
|
|
433
433
|
}
|
|
434
434
|
};
|
|
435
435
|
const Ei = function i(t) {
|
|
436
|
-
function n(
|
|
437
|
-
return new H(
|
|
436
|
+
function n(e) {
|
|
437
|
+
return new H(e, t);
|
|
438
438
|
}
|
|
439
|
-
return n.tension = function(
|
|
440
|
-
return i(+
|
|
439
|
+
return n.tension = function(e) {
|
|
440
|
+
return i(+e);
|
|
441
441
|
}, n;
|
|
442
442
|
}(0);
|
|
443
443
|
function Y(i, t, n) {
|
|
444
|
-
var
|
|
444
|
+
var e = i._x1, s = i._y1, o = i._x2, a = i._y2;
|
|
445
445
|
if (i._l01_a > Q) {
|
|
446
446
|
var r = 2 * i._l01_2a + 3 * i._l01_a * i._l12_a + i._l12_2a, h = 3 * i._l01_a * (i._l01_a + i._l12_a);
|
|
447
|
-
|
|
447
|
+
e = (e * r - i._x0 * i._l12_2a + i._x2 * i._l01_2a) / h, s = (s * r - i._y0 * i._l12_2a + i._y2 * i._l01_2a) / h;
|
|
448
448
|
}
|
|
449
449
|
if (i._l23_a > Q) {
|
|
450
450
|
var l = 2 * i._l23_2a + 3 * i._l23_a * i._l12_a + i._l12_2a, f = 3 * i._l23_a * (i._l23_a + i._l12_a);
|
|
451
451
|
o = (o * l + i._x1 * i._l23_2a - t * i._l12_2a) / f, a = (a * l + i._y1 * i._l23_2a - n * i._l12_2a) / f;
|
|
452
452
|
}
|
|
453
|
-
i._context.bezierCurveTo(
|
|
453
|
+
i._context.bezierCurveTo(e, s, o, a, i._x2, i._y2);
|
|
454
454
|
}
|
|
455
455
|
function Tt(i, t) {
|
|
456
456
|
this._context = i, this._alpha = t;
|
|
@@ -478,8 +478,8 @@ Tt.prototype = {
|
|
|
478
478
|
},
|
|
479
479
|
point: function(i, t) {
|
|
480
480
|
if (i = +i, t = +t, this._point) {
|
|
481
|
-
var n = this._x2 - i,
|
|
482
|
-
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n +
|
|
481
|
+
var n = this._x2 - i, e = this._y2 - t;
|
|
482
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
|
|
483
483
|
}
|
|
484
484
|
switch (this._point) {
|
|
485
485
|
case 0:
|
|
@@ -499,11 +499,11 @@ Tt.prototype = {
|
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
501
|
const wi = function i(t) {
|
|
502
|
-
function n(
|
|
503
|
-
return t ? new Tt(
|
|
502
|
+
function n(e) {
|
|
503
|
+
return t ? new Tt(e, t) : new z(e, 0);
|
|
504
504
|
}
|
|
505
|
-
return n.alpha = function(
|
|
506
|
-
return i(+
|
|
505
|
+
return n.alpha = function(e) {
|
|
506
|
+
return i(+e);
|
|
507
507
|
}, n;
|
|
508
508
|
}(0.5);
|
|
509
509
|
function Dt(i, t) {
|
|
@@ -533,8 +533,8 @@ Dt.prototype = {
|
|
|
533
533
|
},
|
|
534
534
|
point: function(i, t) {
|
|
535
535
|
if (i = +i, t = +t, this._point) {
|
|
536
|
-
var n = this._x2 - i,
|
|
537
|
-
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n +
|
|
536
|
+
var n = this._x2 - i, e = this._y2 - t;
|
|
537
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
|
|
538
538
|
}
|
|
539
539
|
switch (this._point) {
|
|
540
540
|
case 0:
|
|
@@ -554,11 +554,11 @@ Dt.prototype = {
|
|
|
554
554
|
}
|
|
555
555
|
};
|
|
556
556
|
const ki = function i(t) {
|
|
557
|
-
function n(
|
|
558
|
-
return t ? new Dt(
|
|
557
|
+
function n(e) {
|
|
558
|
+
return t ? new Dt(e, t) : new V(e, 0);
|
|
559
559
|
}
|
|
560
|
-
return n.alpha = function(
|
|
561
|
-
return i(+
|
|
560
|
+
return n.alpha = function(e) {
|
|
561
|
+
return i(+e);
|
|
562
562
|
}, n;
|
|
563
563
|
}(0.5);
|
|
564
564
|
function Ot(i, t) {
|
|
@@ -579,8 +579,8 @@ Ot.prototype = {
|
|
|
579
579
|
},
|
|
580
580
|
point: function(i, t) {
|
|
581
581
|
if (i = +i, t = +t, this._point) {
|
|
582
|
-
var n = this._x2 - i,
|
|
583
|
-
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n +
|
|
582
|
+
var n = this._x2 - i, e = this._y2 - t;
|
|
583
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
|
|
584
584
|
}
|
|
585
585
|
switch (this._point) {
|
|
586
586
|
case 0:
|
|
@@ -603,27 +603,27 @@ Ot.prototype = {
|
|
|
603
603
|
}
|
|
604
604
|
};
|
|
605
605
|
const Ri = function i(t) {
|
|
606
|
-
function n(
|
|
607
|
-
return t ? new Ot(
|
|
606
|
+
function n(e) {
|
|
607
|
+
return t ? new Ot(e, t) : new H(e, 0);
|
|
608
608
|
}
|
|
609
|
-
return n.alpha = function(
|
|
610
|
-
return i(+
|
|
609
|
+
return n.alpha = function(e) {
|
|
610
|
+
return i(+e);
|
|
611
611
|
}, n;
|
|
612
612
|
}(0.5);
|
|
613
|
-
function
|
|
613
|
+
function et(i) {
|
|
614
614
|
return i < 0 ? -1 : 1;
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
var
|
|
618
|
-
return (
|
|
616
|
+
function st(i, t, n) {
|
|
617
|
+
var e = i._x1 - i._x0, s = t - i._x1, o = (i._y1 - i._y0) / (e || s < 0 && -0), a = (n - i._y1) / (s || e < 0 && -0), r = (o * s + a * e) / (e + s);
|
|
618
|
+
return (et(o) + et(a)) * Math.min(Math.abs(o), Math.abs(a), 0.5 * Math.abs(r)) || 0;
|
|
619
619
|
}
|
|
620
620
|
function ot(i, t) {
|
|
621
621
|
var n = i._x1 - i._x0;
|
|
622
622
|
return n ? (3 * (i._y1 - i._y0) / n - t) / 2 : t;
|
|
623
623
|
}
|
|
624
624
|
function I(i, t, n) {
|
|
625
|
-
var
|
|
626
|
-
i._context.bezierCurveTo(
|
|
625
|
+
var e = i._x0, s = i._y0, o = i._x1, a = i._y1, r = (o - e) / 3;
|
|
626
|
+
i._context.bezierCurveTo(e + r, s + r * t, o - r, a - r * n, o, a);
|
|
627
627
|
}
|
|
628
628
|
function B(i) {
|
|
629
629
|
this._context = i;
|
|
@@ -660,10 +660,10 @@ B.prototype = {
|
|
|
660
660
|
this._point = 2;
|
|
661
661
|
break;
|
|
662
662
|
case 2:
|
|
663
|
-
this._point = 3, I(this, ot(this, n =
|
|
663
|
+
this._point = 3, I(this, ot(this, n = st(this, i, t)), n);
|
|
664
664
|
break;
|
|
665
665
|
default:
|
|
666
|
-
I(this, this._t0, n =
|
|
666
|
+
I(this, this._t0, n = st(this, i, t));
|
|
667
667
|
break;
|
|
668
668
|
}
|
|
669
669
|
this._x0 = this._x1, this._x1 = i, this._y0 = this._y1, this._y1 = t, this._t0 = n;
|
|
@@ -689,8 +689,8 @@ Mt.prototype = {
|
|
|
689
689
|
lineTo: function(i, t) {
|
|
690
690
|
this._context.lineTo(t, i);
|
|
691
691
|
},
|
|
692
|
-
bezierCurveTo: function(i, t, n,
|
|
693
|
-
this._context.bezierCurveTo(t, i,
|
|
692
|
+
bezierCurveTo: function(i, t, n, e, s, o) {
|
|
693
|
+
this._context.bezierCurveTo(t, i, e, n, o, s);
|
|
694
694
|
}
|
|
695
695
|
};
|
|
696
696
|
function Bi(i) {
|
|
@@ -718,8 +718,8 @@ bt.prototype = {
|
|
|
718
718
|
if (this._line ? this._context.lineTo(i[0], t[0]) : this._context.moveTo(i[0], t[0]), n === 2)
|
|
719
719
|
this._context.lineTo(i[1], t[1]);
|
|
720
720
|
else
|
|
721
|
-
for (var
|
|
722
|
-
this._context.bezierCurveTo(
|
|
721
|
+
for (var e = at(i), s = at(t), o = 0, a = 1; a < n; ++o, ++a)
|
|
722
|
+
this._context.bezierCurveTo(e[0][o], s[0][o], e[1][o], s[1][o], i[a], t[a]);
|
|
723
723
|
(this._line || this._line !== 0 && n === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
|
|
724
724
|
},
|
|
725
725
|
point: function(i, t) {
|
|
@@ -727,12 +727,12 @@ bt.prototype = {
|
|
|
727
727
|
}
|
|
728
728
|
};
|
|
729
729
|
function at(i) {
|
|
730
|
-
var t, n = i.length - 1,
|
|
731
|
-
for (
|
|
732
|
-
for (
|
|
733
|
-
for (
|
|
734
|
-
for (o[n - 1] = (i[n] +
|
|
735
|
-
return [
|
|
730
|
+
var t, n = i.length - 1, e, s = new Array(n), o = new Array(n), a = new Array(n);
|
|
731
|
+
for (s[0] = 0, o[0] = 2, a[0] = i[0] + 2 * i[1], t = 1; t < n - 1; ++t) s[t] = 1, o[t] = 4, a[t] = 4 * i[t] + 2 * i[t + 1];
|
|
732
|
+
for (s[n - 1] = 2, o[n - 1] = 7, a[n - 1] = 8 * i[n - 1] + i[n], t = 1; t < n; ++t) e = s[t] / o[t - 1], o[t] -= e, a[t] -= e * a[t - 1];
|
|
733
|
+
for (s[n - 1] = a[n - 1] / o[n - 1], t = n - 2; t >= 0; --t) s[t] = (a[t] - s[t + 1]) / o[t];
|
|
734
|
+
for (o[n - 1] = (i[n] + s[n - 1]) / 2, t = 0; t < n - 1; ++t) o[t] = 2 * i[t + 1] - s[t + 1];
|
|
735
|
+
return [s, o];
|
|
736
736
|
}
|
|
737
737
|
function Ni(i) {
|
|
738
738
|
return new bt(i);
|
|
@@ -783,29 +783,29 @@ function Ii(i) {
|
|
|
783
783
|
function Zi(i) {
|
|
784
784
|
return new N(i, 1);
|
|
785
785
|
}
|
|
786
|
-
class
|
|
786
|
+
class sn extends O {
|
|
787
787
|
/**
|
|
788
788
|
* focal: object to zoom into
|
|
789
789
|
* canvasElements: all the elements to translate and zoom on the chart area
|
|
790
790
|
* zoomSettings: object containing duration, easing and zoomlevel for the zoom behaviours
|
|
791
791
|
* */
|
|
792
|
-
zoomIn(t, n,
|
|
793
|
-
let
|
|
794
|
-
const r =
|
|
795
|
-
t && (
|
|
792
|
+
zoomIn(t, n, e) {
|
|
793
|
+
let s, o, a;
|
|
794
|
+
const r = e || q;
|
|
795
|
+
t && (s = t.x, o = t.y, a = 2);
|
|
796
796
|
const { width: h, height: l } = ni.getSVGElementSize(this.services.domUtils.getHolder(), {
|
|
797
797
|
useClientDimensions: !0
|
|
798
798
|
});
|
|
799
799
|
n.transition().duration(r.duration).ease(r.ease).attr(
|
|
800
800
|
"transform",
|
|
801
|
-
`translate(${h / 2}, ${l / 2}) scale(${a}) translate(${-
|
|
801
|
+
`translate(${h / 2}, ${l / 2}) scale(${a}) translate(${-s},${-o})`
|
|
802
802
|
), this.services.events.dispatchEvent(w.CanvasZoom.CANVAS_ZOOM_IN, {
|
|
803
|
-
element:
|
|
803
|
+
element: ei(t)
|
|
804
804
|
});
|
|
805
805
|
}
|
|
806
806
|
zoomOut(t, n) {
|
|
807
|
-
const
|
|
808
|
-
t.transition().duration(
|
|
807
|
+
const e = n || q;
|
|
808
|
+
t.transition().duration(e.duration).ease(e.ease).attr("transform", ""), this.services.events.dispatchEvent(w.CanvasZoom.CANVAS_ZOOM_OUT);
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
class on extends O {
|
|
@@ -819,10 +819,10 @@ class on extends O {
|
|
|
819
819
|
this.documentFragment.removeEventListener(t, n);
|
|
820
820
|
}
|
|
821
821
|
dispatchEvent(t, n) {
|
|
822
|
-
let
|
|
823
|
-
n ?
|
|
822
|
+
let e;
|
|
823
|
+
n ? e = new CustomEvent(t, {
|
|
824
824
|
detail: n
|
|
825
|
-
}) : (
|
|
825
|
+
}) : (e = document.createEvent("Event"), e.initEvent(t, !1, !0)), this.documentFragment.dispatchEvent(e);
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
class an extends O {
|
|
@@ -830,27 +830,27 @@ class an extends O {
|
|
|
830
830
|
super(t, n);
|
|
831
831
|
}
|
|
832
832
|
downloadCSV(t, n) {
|
|
833
|
-
const
|
|
833
|
+
const e = document.createElement("a"), s = "text/csv;encoding:utf-8";
|
|
834
834
|
if (navigator.msSaveBlob)
|
|
835
835
|
navigator.msSaveBlob(
|
|
836
836
|
new Blob([t], {
|
|
837
|
-
type:
|
|
837
|
+
type: s
|
|
838
838
|
}),
|
|
839
839
|
n
|
|
840
840
|
);
|
|
841
|
-
else if (URL && "download" in
|
|
841
|
+
else if (URL && "download" in e) {
|
|
842
842
|
const o = URL.createObjectURL(
|
|
843
843
|
new Blob([t], {
|
|
844
|
-
type:
|
|
844
|
+
type: s
|
|
845
845
|
})
|
|
846
846
|
);
|
|
847
|
-
|
|
847
|
+
e.href = o, e.setAttribute("download", n), document.body.appendChild(e), e.click(), document.body.removeChild(e), URL.revokeObjectURL(o);
|
|
848
848
|
} else
|
|
849
849
|
location.href = `data:application/octet-stream,${encodeURIComponent(t)}`;
|
|
850
850
|
}
|
|
851
851
|
downloadImage(t, n) {
|
|
852
|
-
const
|
|
853
|
-
|
|
852
|
+
const e = document.createElement("a");
|
|
853
|
+
e.download = n, e.href = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
856
|
class rn extends O {
|
|
@@ -862,10 +862,10 @@ class rn extends O {
|
|
|
862
862
|
this.pendingTransitions = {};
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
|
-
setupTransition({ transition: t, name: n, animate:
|
|
865
|
+
setupTransition({ transition: t, name: n, animate: e }) {
|
|
866
866
|
return this.pendingTransitions[t._id] = t, t.on("end interrupt cancel", () => {
|
|
867
867
|
delete this.pendingTransitions[t._id];
|
|
868
|
-
}), this.model.getOptions().animations === !1 ||
|
|
868
|
+
}), this.model.getOptions().animations === !1 || e === !1 ? t.duration(0) : t.duration(
|
|
869
869
|
c(W, n, "duration") || W.default.duration
|
|
870
870
|
);
|
|
871
871
|
}
|
|
@@ -878,36 +878,36 @@ function S(i, t) {
|
|
|
878
878
|
return n < 0 ? -1 : n > 0 ? 1 : n;
|
|
879
879
|
}
|
|
880
880
|
function Fi(i, t, n) {
|
|
881
|
-
const [
|
|
881
|
+
const [e, s] = M(
|
|
882
882
|
n?.in,
|
|
883
883
|
i,
|
|
884
884
|
t
|
|
885
885
|
);
|
|
886
|
-
return
|
|
886
|
+
return e.getFullYear() - s.getFullYear();
|
|
887
887
|
}
|
|
888
888
|
function zi(i, t, n) {
|
|
889
|
-
const [
|
|
889
|
+
const [e, s] = M(
|
|
890
890
|
n?.in,
|
|
891
891
|
i,
|
|
892
892
|
t
|
|
893
|
-
), o = S(
|
|
894
|
-
|
|
895
|
-
const r = S(
|
|
893
|
+
), o = S(e, s), a = Math.abs(Fi(e, s));
|
|
894
|
+
e.setFullYear(1584), s.setFullYear(1584);
|
|
895
|
+
const r = S(e, s) === -o, h = o * (a - +r);
|
|
896
896
|
return h === 0 ? 0 : h;
|
|
897
897
|
}
|
|
898
898
|
function X(i, t, n) {
|
|
899
|
-
const
|
|
899
|
+
const e = v(i, n?.in);
|
|
900
900
|
if (isNaN(t)) return E(i, NaN);
|
|
901
901
|
if (!t)
|
|
902
|
-
return
|
|
903
|
-
const
|
|
904
|
-
o.setMonth(
|
|
902
|
+
return e;
|
|
903
|
+
const s = e.getDate(), o = E(i, e.getTime());
|
|
904
|
+
o.setMonth(e.getMonth() + t + 1, 0);
|
|
905
905
|
const a = o.getDate();
|
|
906
|
-
return
|
|
906
|
+
return s >= a ? o : (e.setFullYear(
|
|
907
907
|
o.getFullYear(),
|
|
908
908
|
o.getMonth(),
|
|
909
|
-
|
|
910
|
-
),
|
|
909
|
+
s
|
|
910
|
+
), e);
|
|
911
911
|
}
|
|
912
912
|
function St(i, t, n) {
|
|
913
913
|
return X(i, t * 12, n);
|
|
@@ -916,11 +916,11 @@ function Vi(i, t, n) {
|
|
|
916
916
|
return St(i, -t, n);
|
|
917
917
|
}
|
|
918
918
|
function Hi(i, t, n) {
|
|
919
|
-
const [
|
|
919
|
+
const [e, s] = M(
|
|
920
920
|
n?.in,
|
|
921
921
|
i,
|
|
922
922
|
t
|
|
923
|
-
), o =
|
|
923
|
+
), o = e.getFullYear() - s.getFullYear(), a = e.getMonth() - s.getMonth();
|
|
924
924
|
return o * 12 + a;
|
|
925
925
|
}
|
|
926
926
|
function Yi(i, t) {
|
|
@@ -928,26 +928,26 @@ function Yi(i, t) {
|
|
|
928
928
|
return n.setHours(23, 59, 59, 999), n;
|
|
929
929
|
}
|
|
930
930
|
function Xi(i, t) {
|
|
931
|
-
const n = v(i, t?.in),
|
|
932
|
-
return n.setFullYear(n.getFullYear(),
|
|
931
|
+
const n = v(i, t?.in), e = n.getMonth();
|
|
932
|
+
return n.setFullYear(n.getFullYear(), e + 1, 0), n.setHours(23, 59, 59, 999), n;
|
|
933
933
|
}
|
|
934
934
|
function Gi(i, t) {
|
|
935
935
|
const n = v(i, t?.in);
|
|
936
936
|
return +Yi(n, t) == +Xi(n, t);
|
|
937
937
|
}
|
|
938
938
|
function $i(i, t, n) {
|
|
939
|
-
const [
|
|
939
|
+
const [e, s, o] = M(
|
|
940
940
|
n?.in,
|
|
941
941
|
i,
|
|
942
942
|
i,
|
|
943
943
|
t
|
|
944
|
-
), a = S(
|
|
945
|
-
Hi(
|
|
944
|
+
), a = S(s, o), r = Math.abs(
|
|
945
|
+
Hi(s, o)
|
|
946
946
|
);
|
|
947
947
|
if (r < 1) return 0;
|
|
948
|
-
|
|
949
|
-
let h = S(
|
|
950
|
-
Gi(
|
|
948
|
+
s.getMonth() === 1 && s.getDate() > 27 && s.setDate(30), s.setMonth(s.getMonth() - a * r);
|
|
949
|
+
let h = S(s, o) === -a;
|
|
950
|
+
Gi(e) && r === 1 && S(e, o) === 1 && (h = !1);
|
|
951
951
|
const l = a * (r - +h);
|
|
952
952
|
return l === 0 ? 0 : l;
|
|
953
953
|
}
|
|
@@ -955,15 +955,15 @@ function Ui(i, t, n) {
|
|
|
955
955
|
return X(i, -t, n);
|
|
956
956
|
}
|
|
957
957
|
function Ki(i, t, n) {
|
|
958
|
-
const [
|
|
958
|
+
const [e, s] = M(
|
|
959
959
|
n?.in,
|
|
960
960
|
i,
|
|
961
961
|
t
|
|
962
|
-
), o = rt(
|
|
963
|
-
|
|
962
|
+
), o = rt(e, s), a = Math.abs(
|
|
963
|
+
qt(e, s)
|
|
964
964
|
);
|
|
965
|
-
|
|
966
|
-
const r = +(rt(
|
|
965
|
+
e.setDate(e.getDate() - o * a);
|
|
966
|
+
const r = +(rt(e, s) === -o), h = o * (a - r);
|
|
967
967
|
return h === 0 ? 0 : h;
|
|
968
968
|
}
|
|
969
969
|
function rt(i, t) {
|
|
@@ -971,24 +971,24 @@ function rt(i, t) {
|
|
|
971
971
|
return n < 0 ? -1 : n > 0 ? 1 : n;
|
|
972
972
|
}
|
|
973
973
|
function Pt(i, t, n) {
|
|
974
|
-
const
|
|
975
|
-
return isNaN(t) ? E(i, NaN) : (t &&
|
|
974
|
+
const e = v(i, n?.in);
|
|
975
|
+
return isNaN(t) ? E(i, NaN) : (t && e.setDate(e.getDate() + t), e);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function ji(i, t, n) {
|
|
978
978
|
return Pt(i, -t, n);
|
|
979
979
|
}
|
|
980
980
|
function G(i) {
|
|
981
981
|
return (t) => {
|
|
982
|
-
const
|
|
983
|
-
return
|
|
982
|
+
const e = (i ? Math[i] : Math.trunc)(t);
|
|
983
|
+
return e === 0 ? 0 : e;
|
|
984
984
|
};
|
|
985
985
|
}
|
|
986
|
-
function
|
|
987
|
-
const [
|
|
986
|
+
function qi(i, t, n) {
|
|
987
|
+
const [e, s] = M(
|
|
988
988
|
n?.in,
|
|
989
989
|
i,
|
|
990
990
|
t
|
|
991
|
-
), o = (+
|
|
991
|
+
), o = (+e - +s) / ft;
|
|
992
992
|
return G(n?.roundingMethod)(o);
|
|
993
993
|
}
|
|
994
994
|
function Et(i, t, n) {
|
|
@@ -1004,19 +1004,19 @@ function kt(i, t) {
|
|
|
1004
1004
|
return +v(i) - +v(t);
|
|
1005
1005
|
}
|
|
1006
1006
|
function ht(i, t, n) {
|
|
1007
|
-
const
|
|
1008
|
-
return G(n?.roundingMethod)(
|
|
1007
|
+
const e = kt(i, t) / pt;
|
|
1008
|
+
return G(n?.roundingMethod)(e);
|
|
1009
1009
|
}
|
|
1010
1010
|
function Z(i, t, n) {
|
|
1011
|
-
const
|
|
1012
|
-
return
|
|
1011
|
+
const e = v(i, n?.in);
|
|
1012
|
+
return e.setTime(e.getTime() + t * pt), e;
|
|
1013
1013
|
}
|
|
1014
1014
|
function ct(i, t, n) {
|
|
1015
1015
|
return Z(i, -t, n);
|
|
1016
1016
|
}
|
|
1017
1017
|
function lt(i, t, n) {
|
|
1018
|
-
const
|
|
1019
|
-
return G(n?.roundingMethod)(
|
|
1018
|
+
const e = kt(i, t) / 1e3;
|
|
1019
|
+
return G(n?.roundingMethod)(e);
|
|
1020
1020
|
}
|
|
1021
1021
|
function F(i, t, n) {
|
|
1022
1022
|
return Et(i, t * 1e3);
|
|
@@ -1041,17 +1041,17 @@ class hn extends O {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
getDomainAxisPosition({ datum: t = null } = {}) {
|
|
1043
1043
|
if (this.dualAxes && t) {
|
|
1044
|
-
const n = this.model.getOptions(), { groupMapsTo:
|
|
1045
|
-
if (
|
|
1044
|
+
const n = this.model.getOptions(), { groupMapsTo: e } = n.data, s = c(n, "axes", this.secondaryDomainAxisPosition), o = t[e];
|
|
1045
|
+
if (s?.correspondingDatasets && s.correspondingDatasets.includes(o))
|
|
1046
1046
|
return this.secondaryDomainAxisPosition;
|
|
1047
1047
|
}
|
|
1048
1048
|
return this.domainAxisPosition;
|
|
1049
1049
|
}
|
|
1050
1050
|
getRangeAxisPosition({ datum: t = null, groups: n = null } = {}) {
|
|
1051
1051
|
if (this.dualAxes) {
|
|
1052
|
-
const
|
|
1052
|
+
const e = this.model.getOptions(), { groupMapsTo: s } = e.data, o = c(e, "axes", this.secondaryRangeAxisPosition);
|
|
1053
1053
|
let a;
|
|
1054
|
-
if (t !== null ? a = t[
|
|
1054
|
+
if (t !== null ? a = t[s] : n && n.length > 0 && (a = n[0]), o?.correspondingDatasets && o.correspondingDatasets.includes(a))
|
|
1055
1055
|
return this.secondaryRangeAxisPosition;
|
|
1056
1056
|
}
|
|
1057
1057
|
return this.rangeAxisPosition;
|
|
@@ -1068,8 +1068,8 @@ class hn extends O {
|
|
|
1068
1068
|
return this.getAxisOptions(t);
|
|
1069
1069
|
}
|
|
1070
1070
|
getScaleLabel(t) {
|
|
1071
|
-
const
|
|
1072
|
-
return
|
|
1071
|
+
const e = this.getAxisOptions(t).title;
|
|
1072
|
+
return e || (t === _.BOTTOM || t === _.TOP ? "x-value" : "y-value");
|
|
1073
1073
|
}
|
|
1074
1074
|
getDomainLabel() {
|
|
1075
1075
|
return this.getScaleLabel(this.getDomainAxisPosition());
|
|
@@ -1085,11 +1085,11 @@ class hn extends O {
|
|
|
1085
1085
|
});
|
|
1086
1086
|
}
|
|
1087
1087
|
findDomainAndRangeAxes() {
|
|
1088
|
-
const t = this.findVerticalAxesPositions(), n = this.findHorizontalAxesPositions(),
|
|
1088
|
+
const t = this.findVerticalAxesPositions(), n = this.findHorizontalAxesPositions(), e = this.findDomainAndRangeAxesPositions(
|
|
1089
1089
|
t,
|
|
1090
1090
|
n
|
|
1091
1091
|
);
|
|
1092
|
-
this.domainAxisPosition =
|
|
1092
|
+
this.domainAxisPosition = e.primaryDomainAxisPosition, this.rangeAxisPosition = e.primaryRangeAxisPosition, this.isDualAxes() && (this.secondaryDomainAxisPosition = e.secondaryDomainAxisPosition, this.secondaryRangeAxisPosition = e.secondaryRangeAxisPosition);
|
|
1093
1093
|
}
|
|
1094
1094
|
determineOrientation() {
|
|
1095
1095
|
(this.rangeAxisPosition === _.LEFT || this.rangeAxisPosition === _.RIGHT) && (this.domainAxisPosition === _.BOTTOM || this.domainAxisPosition === _.TOP) ? this.orientation = C.VERTICAL : this.orientation = C.HORIZONTAL;
|
|
@@ -1156,8 +1156,8 @@ class hn extends O {
|
|
|
1156
1156
|
getMainYScale() {
|
|
1157
1157
|
return this.scales[this.getMainYAxisPosition()];
|
|
1158
1158
|
}
|
|
1159
|
-
getValueFromScale(t, n,
|
|
1160
|
-
const o = this.model.getOptions(), r = c(o, "axes")[
|
|
1159
|
+
getValueFromScale(t, n, e, s) {
|
|
1160
|
+
const o = this.model.getOptions(), r = c(o, "axes")[e], { mapsTo: h } = r, l = c(s, h) !== null ? s[h] : s;
|
|
1161
1161
|
let f;
|
|
1162
1162
|
switch (n) {
|
|
1163
1163
|
case p.LABELS:
|
|
@@ -1172,19 +1172,19 @@ class hn extends O {
|
|
|
1172
1172
|
return f;
|
|
1173
1173
|
}
|
|
1174
1174
|
getBoundedScaledValues(t) {
|
|
1175
|
-
const { bounds: n } = this.model.getOptions(),
|
|
1175
|
+
const { bounds: n } = this.model.getOptions(), e = this.getRangeAxisPosition({ datum: t }), s = this.scales[e], o = this.model.getOptions(), r = c(o, "axes")[e], { mapsTo: h } = r, l = t[h] !== void 0 ? t[h] : t;
|
|
1176
1176
|
return [
|
|
1177
|
-
|
|
1177
|
+
s(
|
|
1178
1178
|
c(t, n.upperBoundMapsTo) !== null ? t[n.upperBoundMapsTo] : l
|
|
1179
1179
|
),
|
|
1180
|
-
|
|
1180
|
+
s(
|
|
1181
1181
|
c(t, n.lowerBoundMapsTo) !== null ? t[n.lowerBoundMapsTo] : l
|
|
1182
1182
|
)
|
|
1183
1183
|
];
|
|
1184
1184
|
}
|
|
1185
1185
|
getValueThroughAxisPosition(t, n) {
|
|
1186
|
-
const
|
|
1187
|
-
return this.getValueFromScale(
|
|
1186
|
+
const e = this.scaleTypes[t], s = this.scales[t];
|
|
1187
|
+
return this.getValueFromScale(s, e, t, n);
|
|
1188
1188
|
}
|
|
1189
1189
|
getDomainValue(t) {
|
|
1190
1190
|
const n = this.getDomainAxisPosition({ datum: t });
|
|
@@ -1209,29 +1209,29 @@ class hn extends O {
|
|
|
1209
1209
|
return c(n, "axes", this.getRangeAxisPosition({ datum: t }), "mapsTo");
|
|
1210
1210
|
}
|
|
1211
1211
|
extendsDomain(t, n) {
|
|
1212
|
-
const
|
|
1213
|
-
if (
|
|
1214
|
-
const o = c(
|
|
1212
|
+
const e = this.model.getOptions(), s = c(e, "axes", t);
|
|
1213
|
+
if (s.scaleType === p.TIME) {
|
|
1214
|
+
const o = c(e, "timeScale", "addSpaceOnEdges");
|
|
1215
1215
|
return Ji(n, o);
|
|
1216
1216
|
} else
|
|
1217
|
-
return Qi(n, J.paddingRatio,
|
|
1217
|
+
return Qi(n, J.paddingRatio, s.scaleType);
|
|
1218
1218
|
}
|
|
1219
1219
|
findVerticalAxesPositions() {
|
|
1220
|
-
const t = this.model.getOptions(), n = c(t, "axes"),
|
|
1221
|
-
return c(n, _.LEFT) === null && c(n, _.RIGHT) !== null || c(n, _.RIGHT, "main") === !0 ||
|
|
1220
|
+
const t = this.model.getOptions(), n = c(t, "axes"), e = this.isDualAxes();
|
|
1221
|
+
return c(n, _.LEFT) === null && c(n, _.RIGHT) !== null || c(n, _.RIGHT, "main") === !0 || e && c(n, _.LEFT, "correspondingDatasets") ? {
|
|
1222
1222
|
primary: _.RIGHT,
|
|
1223
1223
|
secondary: _.LEFT
|
|
1224
1224
|
} : { primary: _.LEFT, secondary: _.RIGHT };
|
|
1225
1225
|
}
|
|
1226
1226
|
findHorizontalAxesPositions() {
|
|
1227
|
-
const t = this.model.getOptions(), n = c(t, "axes"),
|
|
1228
|
-
return c(n, _.BOTTOM) === null && c(n, _.TOP) !== null || c(n, _.TOP, "main") === !0 ||
|
|
1227
|
+
const t = this.model.getOptions(), n = c(t, "axes"), e = this.isDualAxes();
|
|
1228
|
+
return c(n, _.BOTTOM) === null && c(n, _.TOP) !== null || c(n, _.TOP, "main") === !0 || e && c(n, _.BOTTOM, "correspondingDatasets") ? {
|
|
1229
1229
|
primary: _.TOP,
|
|
1230
1230
|
secondary: _.BOTTOM
|
|
1231
1231
|
} : { primary: _.BOTTOM, secondary: _.TOP };
|
|
1232
1232
|
}
|
|
1233
1233
|
findDomainAndRangeAxesPositions(t, n) {
|
|
1234
|
-
const
|
|
1234
|
+
const e = this.model.getOptions(), s = c(e, "axes", t.primary), o = c(e, "axes", n.primary), a = s.scaleType || p.LINEAR, r = o.scaleType || p.LINEAR, h = {
|
|
1235
1235
|
primaryDomainAxisPosition: null,
|
|
1236
1236
|
secondaryDomainAxisPosition: null,
|
|
1237
1237
|
primaryRangeAxisPosition: null,
|
|
@@ -1240,24 +1240,24 @@ class hn extends O {
|
|
|
1240
1240
|
return h.primaryDomainAxisPosition = n.primary, h.primaryRangeAxisPosition = t.primary, h.secondaryDomainAxisPosition = n.secondary, h.secondaryRangeAxisPosition = t.secondary, (!(r === p.LABELS || r === p.TIME) && a === p.LABELS || a === p.TIME) && (h.primaryDomainAxisPosition = t.primary, h.primaryRangeAxisPosition = n.primary, h.secondaryDomainAxisPosition = t.secondary, h.secondaryRangeAxisPosition = n.secondary), h;
|
|
1241
1241
|
}
|
|
1242
1242
|
getScaleDomain(t) {
|
|
1243
|
-
const n = this.model.getOptions(),
|
|
1243
|
+
const n = this.model.getOptions(), e = c(n, "axes", t), s = c(n, "bounds"), { includeZero: o } = e, a = c(e, "scaleType") || p.LINEAR;
|
|
1244
1244
|
if (this.model.isDataEmpty())
|
|
1245
1245
|
return [];
|
|
1246
|
-
if (
|
|
1246
|
+
if (e.binned) {
|
|
1247
1247
|
const { bins: u } = this.model.getBinConfigurations();
|
|
1248
1248
|
return [0, Wt(u, (x) => x.length)];
|
|
1249
|
-
} else if (
|
|
1249
|
+
} else if (e.limitDomainToBins) {
|
|
1250
1250
|
const { bins: u } = this.model.getBinConfigurations(), x = this.model.getStackKeys({ bins: u });
|
|
1251
1251
|
return [x[0].split(":")[0], x[x.length - 1].split(":")[1]];
|
|
1252
1252
|
}
|
|
1253
|
-
const r = this.model.getDisplayData(), { extendLinearDomainBy: h, mapsTo: l, percentage: f, thresholds: y } =
|
|
1254
|
-
if (
|
|
1255
|
-
return a === p.LABELS ?
|
|
1253
|
+
const r = this.model.getDisplayData(), { extendLinearDomainBy: h, mapsTo: l, percentage: f, thresholds: y } = e, { reference: d, compareTo: T } = J.ratio;
|
|
1254
|
+
if (e.domain)
|
|
1255
|
+
return a === p.LABELS ? e.domain : (a === p.TIME && (e.domain = e.domain.map(
|
|
1256
1256
|
(u) => u.getTime === void 0 ? new Date(u) : u
|
|
1257
|
-
)), this.extendsDomain(t,
|
|
1257
|
+
)), this.extendsDomain(t, e.domain));
|
|
1258
1258
|
if (f)
|
|
1259
1259
|
return [0, 100];
|
|
1260
|
-
if (
|
|
1260
|
+
if (e && a === p.LABELS)
|
|
1261
1261
|
return Jt(r.map((u) => u[l]));
|
|
1262
1262
|
let g, m;
|
|
1263
1263
|
const D = this.model.getDataGroupNames();
|
|
@@ -1265,11 +1265,11 @@ class hn extends O {
|
|
|
1265
1265
|
return r.map((u) => `${u[d]}/${u[T]}`);
|
|
1266
1266
|
if (a === p.TIME)
|
|
1267
1267
|
m = r.map((u) => +new Date(u[l]));
|
|
1268
|
-
else if (
|
|
1268
|
+
else if (s && n.axes)
|
|
1269
1269
|
m = [], r.forEach((u) => {
|
|
1270
|
-
m.push(u[l]), u[
|
|
1270
|
+
m.push(u[l]), u[s.upperBoundMapsTo] && m.push(u[s.upperBoundMapsTo]), u[s.lowerBoundMapsTo] && m.push(u[s.lowerBoundMapsTo]);
|
|
1271
1271
|
});
|
|
1272
|
-
else if (
|
|
1272
|
+
else if (e.stacked === !0 && D && t === this.getRangeAxisPosition()) {
|
|
1273
1273
|
const { groupMapsTo: u } = n.data, x = this.model.getDataValuesGroupedByKeys({
|
|
1274
1274
|
groups: D
|
|
1275
1275
|
}), Rt = r.filter(
|
|
@@ -1296,53 +1296,53 @@ class hn extends O {
|
|
|
1296
1296
|
}), g = mt(m), g = this.extendsDomain(t, g), g;
|
|
1297
1297
|
}
|
|
1298
1298
|
createScale(t) {
|
|
1299
|
-
const n = this.model.getOptions(),
|
|
1300
|
-
if (!
|
|
1299
|
+
const n = this.model.getOptions(), e = c(n, "axes", t);
|
|
1300
|
+
if (!e)
|
|
1301
1301
|
return null;
|
|
1302
|
-
const
|
|
1303
|
-
this.scaleTypes[t] =
|
|
1302
|
+
const s = c(e, "scaleType") || p.LINEAR;
|
|
1303
|
+
this.scaleTypes[t] = s;
|
|
1304
1304
|
let o;
|
|
1305
|
-
return
|
|
1305
|
+
return s === p.TIME ? o = si() : s === p.LOG ? o = xt().base(e.base || 10) : s === p.LABELS || s === p.LABELS_RATIO ? o = oi() : o = Qt(), o.domain(this.getScaleDomain(t)), o;
|
|
1306
1306
|
}
|
|
1307
1307
|
getDomainLowerBound(t) {
|
|
1308
|
-
let n,
|
|
1309
|
-
return this.getOrientation() === C.VERTICAL ? n = this.getMainYScale().domain() : n = this.getMainXScale().domain(), c(this.model.getOptions(), "axes", t, "includeZero") === !1 && n[0] > 0 && n[1] > 0 && (
|
|
1308
|
+
let n, e = 0;
|
|
1309
|
+
return this.getOrientation() === C.VERTICAL ? n = this.getMainYScale().domain() : n = this.getMainXScale().domain(), c(this.model.getOptions(), "axes", t, "includeZero") === !1 && n[0] > 0 && n[1] > 0 && (e = n[0]), e;
|
|
1310
1310
|
}
|
|
1311
1311
|
getHighestDomainThreshold() {
|
|
1312
|
-
const t = c(this.model.getOptions(), "axes"), n = this.getDomainAxisPosition(), { thresholds:
|
|
1313
|
-
if (!Array.isArray(
|
|
1312
|
+
const t = c(this.model.getOptions(), "axes"), n = this.getDomainAxisPosition(), { thresholds: e } = t[n];
|
|
1313
|
+
if (!Array.isArray(e) || Array.isArray(e) && !e.length)
|
|
1314
1314
|
return null;
|
|
1315
|
-
const
|
|
1315
|
+
const s = this.getDomainScale(), o = e.sort((r, h) => h.value - r.value)[0];
|
|
1316
1316
|
return this.getScaleTypeByPosition(n) === p.TIME && (typeof o.value == "string" || o.value.getTime === void 0) && (o.value = new Date(o.value)), {
|
|
1317
1317
|
threshold: o,
|
|
1318
|
-
scaleValue:
|
|
1318
|
+
scaleValue: s(o.value)
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
1321
|
getHighestRangeThreshold() {
|
|
1322
|
-
const t = c(this.model.getOptions(), "axes"), n = this.getRangeAxisPosition(), { thresholds:
|
|
1323
|
-
if (!Array.isArray(
|
|
1322
|
+
const t = c(this.model.getOptions(), "axes"), n = this.getRangeAxisPosition(), { thresholds: e } = t[n];
|
|
1323
|
+
if (!Array.isArray(e) || Array.isArray(e) && !e.length)
|
|
1324
1324
|
return null;
|
|
1325
|
-
const
|
|
1325
|
+
const s = this.getRangeScale(), o = e.sort((a, r) => r.value - a.value)[0];
|
|
1326
1326
|
return {
|
|
1327
1327
|
threshold: o,
|
|
1328
|
-
scaleValue:
|
|
1328
|
+
scaleValue: s(o.value)
|
|
1329
1329
|
};
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
1332
|
function Ji(i, t) {
|
|
1333
|
-
const n = new Date(i[0]),
|
|
1334
|
-
return zi(
|
|
1333
|
+
const n = new Date(i[0]), e = new Date(i[1]);
|
|
1334
|
+
return zi(e, n) > 1 ? [Vi(n, t), St(e, t)] : $i(e, n) > 1 ? [Ui(n, t), X(e, t)] : Ki(e, n) > 1 ? [ji(n, t), Pt(e, t)] : qi(e, n) > 1 ? [Wi(n, t), wt(e, t)] : ht(e, n) > 30 ? [
|
|
1335
1335
|
ct(n, t * 30),
|
|
1336
|
-
Z(
|
|
1337
|
-
] : ht(
|
|
1336
|
+
Z(e, t * 30)
|
|
1337
|
+
] : ht(e, n) > 1 ? [ct(n, t), Z(e, t)] : lt(e, n) > 15 ? [
|
|
1338
1338
|
_t(n, t * 15),
|
|
1339
|
-
F(
|
|
1340
|
-
] : lt(
|
|
1339
|
+
F(e, t * 15)
|
|
1340
|
+
] : lt(e, n) > 1 ? [_t(n, t), F(e, t)] : [n, e];
|
|
1341
1341
|
}
|
|
1342
|
-
function Qi([i, t], n,
|
|
1342
|
+
function Qi([i, t], n, e) {
|
|
1343
1343
|
const o = (t - i) * n, a = t <= 0 && t + o > 0 ? 0 : t + o;
|
|
1344
1344
|
let r = i >= 0 && i - o < 0 ? 0 : i - o;
|
|
1345
|
-
if (
|
|
1345
|
+
if (e === p.LOG && r <= 0) {
|
|
1346
1346
|
if (i <= 0)
|
|
1347
1347
|
throw Error("Data must have values greater than 0 if log scale type is used.");
|
|
1348
1348
|
r = i;
|
|
@@ -1376,10 +1376,10 @@ class cn extends O {
|
|
|
1376
1376
|
let t = "curveLinear";
|
|
1377
1377
|
const n = this.model.getOptions().curve;
|
|
1378
1378
|
if (n && (typeof n == "string" ? t = n : t = n.name), this.curveTypes[t]) {
|
|
1379
|
-
let
|
|
1380
|
-
return n && Object.keys(n).forEach((
|
|
1381
|
-
s
|
|
1382
|
-
}),
|
|
1379
|
+
let e = this.curveTypes[t];
|
|
1380
|
+
return n && Object.keys(n).forEach((s) => {
|
|
1381
|
+
e[s] && (e = e[s](n[s]));
|
|
1382
|
+
}), e;
|
|
1383
1383
|
}
|
|
1384
1384
|
return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`), this.curveTypes.curveLinear;
|
|
1385
1385
|
}
|
|
@@ -1405,20 +1405,21 @@ class ln extends O {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
getDefaultZoomBarDomain(t) {
|
|
1407
1407
|
if (!this.services.zoom) throw new Error("Services zoom not defined");
|
|
1408
|
-
const n = t || this.services.zoom.getZoomBarData(), { cartesianScales:
|
|
1409
|
-
if (!
|
|
1410
|
-
const
|
|
1408
|
+
const n = t || this.services.zoom.getZoomBarData(), { cartesianScales: e } = this.services;
|
|
1409
|
+
if (!e) throw new Error("Services cartesianScales undefined");
|
|
1410
|
+
const s = e.getMainXAxisPosition(), o = e.getDomainIdentifier(), a = c(this.model.getOptions(), "axes", s, "domain");
|
|
1411
1411
|
if (Array.isArray(a) && a.length === 2)
|
|
1412
1412
|
return a;
|
|
1413
|
-
if (!
|
|
1414
|
-
return
|
|
1415
|
-
|
|
1413
|
+
if (!s) throw new Error("Not defined: mainXAxisPosition");
|
|
1414
|
+
return e.extendsDomain(
|
|
1415
|
+
s,
|
|
1416
1416
|
mt(n, (r) => r[o])
|
|
1417
1417
|
);
|
|
1418
1418
|
}
|
|
1419
|
-
handleDomainChange(t, n = { dispatchEvent: !0 }) {
|
|
1419
|
+
handleDomainChange(t, n = { dispatchEvent: !0, type: "manual" }) {
|
|
1420
1420
|
this.model.set({ zoomDomain: t }, { animate: !1 }), n.dispatchEvent && this.services.events?.dispatchEvent(w.ZoomDomain.CHANGE, {
|
|
1421
|
-
newDomain: t
|
|
1421
|
+
newDomain: t,
|
|
1422
|
+
type: n.type
|
|
1422
1423
|
});
|
|
1423
1424
|
}
|
|
1424
1425
|
getZoomRatio() {
|
|
@@ -1427,14 +1428,14 @@ class ln extends O {
|
|
|
1427
1428
|
// filter out data not inside zoom domain
|
|
1428
1429
|
// to get better range value for axis label
|
|
1429
1430
|
filterDataForRangeAxis(t, n) {
|
|
1430
|
-
const
|
|
1431
|
+
const e = this.model.get("zoomDomain"), s = Object.assign(
|
|
1431
1432
|
{ stacked: !1 },
|
|
1432
1433
|
// default configs
|
|
1433
1434
|
n
|
|
1434
1435
|
), o = c(this.model.getOptions(), "zoomBar", "updateRangeAxis");
|
|
1435
|
-
if (this.isZoomBarEnabled() && o &&
|
|
1436
|
-
const a =
|
|
1437
|
-
(h) => new Date(h[a]) >=
|
|
1436
|
+
if (this.isZoomBarEnabled() && o && e) {
|
|
1437
|
+
const a = s.stacked ? "sharedStackKey" : this.services.cartesianScales?.getDomainIdentifier(), r = t.filter(
|
|
1438
|
+
(h) => new Date(h[a]) >= e[0] && new Date(h[a]) <= e[1]
|
|
1438
1439
|
);
|
|
1439
1440
|
if (r.length > 0)
|
|
1440
1441
|
return r;
|
|
@@ -1442,28 +1443,28 @@ class ln extends O {
|
|
|
1442
1443
|
return t;
|
|
1443
1444
|
}
|
|
1444
1445
|
zoomIn(t = this.getZoomRatio()) {
|
|
1445
|
-
const n = this.model.get("zoomDomain"),
|
|
1446
|
-
|
|
1447
|
-
const o =
|
|
1448
|
-
if (a - o <
|
|
1446
|
+
const n = this.model.get("zoomDomain"), e = ti.handleWidth, s = this.services.cartesianScales?.getMainXScale().copy();
|
|
1447
|
+
s.domain(this.getDefaultZoomBarDomain());
|
|
1448
|
+
const o = s(n[0]), a = s(n[1]);
|
|
1449
|
+
if (a - o < e + 1)
|
|
1449
1450
|
return;
|
|
1450
|
-
const r =
|
|
1451
|
+
const r = s.range(), h = a - o, l = Math.min((r[1] - r[0]) / 2 * (t / 2), h / 2);
|
|
1451
1452
|
let f = o + l, y = a - l;
|
|
1452
|
-
f >= y && (f = o + h / 2 -
|
|
1453
|
-
const d = [
|
|
1454
|
-
(n[0].valueOf() !== d[0].valueOf() || n[1].valueOf() !== d[1].valueOf()) && this.handleDomainChange(d);
|
|
1453
|
+
f >= y && (f = o + h / 2 - e / 2, y = a - h / 2 + e / 2);
|
|
1454
|
+
const d = [s.invert(f), s.invert(y)];
|
|
1455
|
+
(n[0].valueOf() !== d[0].valueOf() || n[1].valueOf() !== d[1].valueOf()) && this.handleDomainChange(d, { dispatchEvent: !0, type: "in" });
|
|
1455
1456
|
}
|
|
1456
1457
|
zoomOut(t = this.getZoomRatio()) {
|
|
1457
1458
|
const n = this.model.get("zoomDomain");
|
|
1458
1459
|
if (!this.services.cartesianScales) throw new Error("Services cartesianScales undefined");
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
const
|
|
1462
|
-
(n[0].valueOf() !== f[0].valueOf() || n[1].valueOf() !== f[1].valueOf()) && this.handleDomainChange(f);
|
|
1460
|
+
const e = this.services.cartesianScales.getMainXScale().copy();
|
|
1461
|
+
e.domain(this.getDefaultZoomBarDomain());
|
|
1462
|
+
const s = e(n[0]), o = e(n[1]), a = e.range(), r = (a[1] - a[0]) / 2 * (t / 2), h = Math.max(s - r, a[0]), l = Math.min(o + r, a[1]), f = [e.invert(h), e.invert(l)];
|
|
1463
|
+
(n[0].valueOf() !== f[0].valueOf() || n[1].valueOf() !== f[1].valueOf()) && this.handleDomainChange(f, { dispatchEvent: !0, type: "out" });
|
|
1463
1464
|
}
|
|
1464
1465
|
resetZoomDomain() {
|
|
1465
1466
|
const t = this.model.get("zoomDomain"), n = this.getDefaultZoomBarDomain();
|
|
1466
|
-
(t[0].valueOf() !== n[0].valueOf() || t[1].valueOf() !== n[1].valueOf()) && this.handleDomainChange(n);
|
|
1467
|
+
(t[0].valueOf() !== n[0].valueOf() || t[1].valueOf() !== n[1].valueOf()) && this.handleDomainChange(n, { dispatchEvent: !0, type: "reset" });
|
|
1467
1468
|
}
|
|
1468
1469
|
// check if current zoom domain is already the min zoom domain
|
|
1469
1470
|
// when toolbar is rendered, we don't render chart yet
|
|
@@ -1472,8 +1473,8 @@ class ln extends O {
|
|
|
1472
1473
|
const t = this.model.get("zoomDomain"), n = this.getDefaultZoomBarDomain();
|
|
1473
1474
|
if (!t || !n)
|
|
1474
1475
|
return !1;
|
|
1475
|
-
const
|
|
1476
|
-
return
|
|
1476
|
+
const e = t[1].valueOf() - t[0].valueOf(), s = n[1].valueOf() - n[0].valueOf(), o = c(this.model.getOptions(), "zoomBar", "minZoomRatio");
|
|
1477
|
+
return e / s < o;
|
|
1477
1478
|
}
|
|
1478
1479
|
// check if current zoom domain is already the max zoom domain
|
|
1479
1480
|
isMaxZoomDomain() {
|
|
@@ -1491,7 +1492,7 @@ class ln extends O {
|
|
|
1491
1492
|
}
|
|
1492
1493
|
}
|
|
1493
1494
|
export {
|
|
1494
|
-
|
|
1495
|
+
sn as C,
|
|
1495
1496
|
on as E,
|
|
1496
1497
|
an as F,
|
|
1497
1498
|
rn as T,
|
|
@@ -1501,4 +1502,4 @@ export {
|
|
|
1501
1502
|
hn as c,
|
|
1502
1503
|
dt as f
|
|
1503
1504
|
};
|
|
1504
|
-
//# sourceMappingURL=index-
|
|
1505
|
+
//# sourceMappingURL=index-B-DZT7fS.mjs.map
|