@carbon/charts 1.16.6 → 1.16.7
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 +13 -0
- package/README.md +3 -4
- package/dist/angle-utils-BSzg7qin.mjs +1681 -0
- package/dist/angle-utils-BSzg7qin.mjs.map +1 -0
- package/dist/array-BRmw0x1E.mjs +32 -0
- package/dist/array-BRmw0x1E.mjs.map +1 -0
- package/dist/choropleth-BwaUZYh6.mjs +11722 -0
- package/dist/choropleth-BwaUZYh6.mjs.map +1 -0
- package/dist/color-scale-utils-DAbXVtf-.mjs +5722 -0
- package/dist/color-scale-utils-DAbXVtf-.mjs.map +1 -0
- package/dist/components/essentials/geo-projection.d.ts +7 -5
- package/dist/components/essentials/highlights.d.ts +1 -1
- package/dist/components/essentials/threshold.d.ts +1 -1
- package/dist/components/essentials/tooltip.d.ts +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/demo/index.mjs +244 -264
- package/dist/demo/index.mjs.map +1 -1
- package/dist/enums-DwsxZqjR.mjs.map +1 -1
- package/dist/index-DnyOi0rJ.mjs +1477 -0
- package/dist/index-DnyOi0rJ.mjs.map +1 -0
- package/dist/index.mjs +35 -35
- package/dist/interfaces/axis-scales.d.ts +3 -3
- package/dist/interfaces/charts.d.ts +5 -3
- package/dist/interfaces/components.d.ts +4 -3
- package/dist/interfaces/model.d.ts +30 -6
- package/dist/model/index.mjs +1321 -17
- package/dist/model/index.mjs.map +1 -1
- package/dist/services/index.mjs +16 -16
- package/dist/umd/bundle.umd.js +11 -11
- package/dist/umd/bundle.umd.js.map +1 -1
- package/package.json +2 -15
- package/dist/_baseEach-Bp7pBkX8.mjs +0 -20
- package/dist/_baseEach-Bp7pBkX8.mjs.map +0 -1
- package/dist/angle-utils-BCx3SRS2.mjs +0 -849
- package/dist/angle-utils-BCx3SRS2.mjs.map +0 -1
- package/dist/choropleth-B7eXF9sA.mjs +0 -8662
- package/dist/choropleth-B7eXF9sA.mjs.map +0 -1
- package/dist/color-scale-utils-BaTmNvWt.mjs +0 -3467
- package/dist/color-scale-utils-BaTmNvWt.mjs.map +0 -1
- package/dist/wordcloud-BsEQRUwL.mjs +0 -1169
- package/dist/wordcloud-BsEQRUwL.mjs.map +0 -1
- package/dist/zoom-E2POxw6n.mjs +0 -739
- package/dist/zoom-E2POxw6n.mjs.map +0 -1
|
@@ -0,0 +1,1477 @@
|
|
|
1
|
+
import { a3 as Bt, aC as Lt, aD as Nt, aE as Ct, aF as ft, aG as It, aH as Zt, aI as Ft, a2 as zt, aJ as Vt, aK as Yt, aL as Ht, aM as Xt, _ as Gt, W as $t, ax as j, aN as Ut, aO as Kt, n as W, g as c, F as J, aP as x, aQ as P, aR as qt, aS as mt, aT as dt, h as Q, ar as jt, ao as Wt, ad as pt, ai as Jt, H as Qt } from "./color-scale-utils-DAbXVtf-.mjs";
|
|
2
|
+
import { z as ti, A as O, g as tt, S as A, D as ii, s as ni, v as ei, x as si, u as oi, y as ai } from "./angle-utils-BSzg7qin.mjs";
|
|
3
|
+
import { _ as E, e as _, i as N, S as m } from "./enums-DwsxZqjR.mjs";
|
|
4
|
+
function xt(i) {
|
|
5
|
+
var t = i == null ? 0 : i.length;
|
|
6
|
+
return t ? Bt(i, 1) : [];
|
|
7
|
+
}
|
|
8
|
+
function ri(i) {
|
|
9
|
+
return Lt(Nt(i, void 0, xt), i + "");
|
|
10
|
+
}
|
|
11
|
+
function hi(i, t, n) {
|
|
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
|
+
return o;
|
|
17
|
+
}
|
|
18
|
+
function ci(i, t) {
|
|
19
|
+
return t.length < 2 ? i : Ct(i, hi(t, 0, -1));
|
|
20
|
+
}
|
|
21
|
+
function li(i, t) {
|
|
22
|
+
return t = ft(t, i), i = ci(i, t), i == null || delete i[It(Zt(t))];
|
|
23
|
+
}
|
|
24
|
+
function _i(i) {
|
|
25
|
+
return Ft(i) ? void 0 : i;
|
|
26
|
+
}
|
|
27
|
+
var ui = 1, fi = 2, mi = 4, di = ri(function(i, t) {
|
|
28
|
+
var n = {};
|
|
29
|
+
if (i == null)
|
|
30
|
+
return n;
|
|
31
|
+
var e = !1;
|
|
32
|
+
t = zt(t, function(o) {
|
|
33
|
+
return o = ft(o, i), e || (e = o.length > 1), o;
|
|
34
|
+
}), Vt(i, Yt(i), n), e && (n = Ht(n, ui | fi | mi, _i));
|
|
35
|
+
for (var s = t.length; s--; )
|
|
36
|
+
li(n, t[s]);
|
|
37
|
+
return n;
|
|
38
|
+
});
|
|
39
|
+
function it(i) {
|
|
40
|
+
return Math.log(i);
|
|
41
|
+
}
|
|
42
|
+
function nt(i) {
|
|
43
|
+
return Math.exp(i);
|
|
44
|
+
}
|
|
45
|
+
function pi(i) {
|
|
46
|
+
return -Math.log(-i);
|
|
47
|
+
}
|
|
48
|
+
function xi(i) {
|
|
49
|
+
return -Math.exp(-i);
|
|
50
|
+
}
|
|
51
|
+
function gi(i) {
|
|
52
|
+
return isFinite(i) ? +("1e" + i) : i < 0 ? 0 : i;
|
|
53
|
+
}
|
|
54
|
+
function yi(i) {
|
|
55
|
+
return i === 10 ? gi : i === Math.E ? Math.exp : (t) => Math.pow(i, t);
|
|
56
|
+
}
|
|
57
|
+
function vi(i) {
|
|
58
|
+
return i === Math.E ? Math.log : i === 10 && Math.log10 || i === 2 && Math.log2 || (i = Math.log(i), (t) => Math.log(t) / i);
|
|
59
|
+
}
|
|
60
|
+
function et(i) {
|
|
61
|
+
return (t, n) => -i(-t, n);
|
|
62
|
+
}
|
|
63
|
+
function Ti(i) {
|
|
64
|
+
const t = i(it, nt), n = t.domain;
|
|
65
|
+
let e = 10, s, o;
|
|
66
|
+
function a() {
|
|
67
|
+
return s = vi(e), o = yi(e), n()[0] < 0 ? (s = et(s), o = et(o), i(pi, xi)) : i(it, nt), t;
|
|
68
|
+
}
|
|
69
|
+
return t.base = function(r) {
|
|
70
|
+
return arguments.length ? (e = +r, a()) : e;
|
|
71
|
+
}, t.domain = function(r) {
|
|
72
|
+
return arguments.length ? (n(r), a()) : n();
|
|
73
|
+
}, t.ticks = (r) => {
|
|
74
|
+
const h = n();
|
|
75
|
+
let l = h[0], f = h[h.length - 1];
|
|
76
|
+
const v = f < l;
|
|
77
|
+
v && ([l, f] = [f, l]);
|
|
78
|
+
let p = s(l), T = s(f), y, d;
|
|
79
|
+
const D = r == null ? 10 : +r;
|
|
80
|
+
let u = [];
|
|
81
|
+
if (!(e % 1) && T - p < D) {
|
|
82
|
+
if (p = Math.floor(p), T = Math.ceil(T), l > 0) {
|
|
83
|
+
for (; p <= T; ++p)
|
|
84
|
+
for (y = 1; y < e; ++y)
|
|
85
|
+
if (d = p < 0 ? y / o(-p) : y * o(p), !(d < l)) {
|
|
86
|
+
if (d > f) break;
|
|
87
|
+
u.push(d);
|
|
88
|
+
}
|
|
89
|
+
} else for (; p <= T; ++p)
|
|
90
|
+
for (y = e - 1; y >= 1; --y)
|
|
91
|
+
if (d = p > 0 ? y / o(-p) : y * o(p), !(d < l)) {
|
|
92
|
+
if (d > f) break;
|
|
93
|
+
u.push(d);
|
|
94
|
+
}
|
|
95
|
+
u.length * 2 < D && (u = j(l, f, D));
|
|
96
|
+
} else
|
|
97
|
+
u = j(p, T, Math.min(T - p, D)).map(o);
|
|
98
|
+
return v ? u.reverse() : u;
|
|
99
|
+
}, t.tickFormat = (r, h) => {
|
|
100
|
+
if (r == null && (r = 10), h == null && (h = e === 10 ? "s" : ","), typeof h != "function" && (!(e % 1) && (h = Ut(h)).precision == null && (h.trim = !0), h = Kt(h)), r === 1 / 0) return h;
|
|
101
|
+
const l = Math.max(1, e * r / t.ticks().length);
|
|
102
|
+
return (f) => {
|
|
103
|
+
let v = f / o(Math.round(s(f)));
|
|
104
|
+
return v * e < e - 0.5 && (v *= e), v <= l ? h(f) : "";
|
|
105
|
+
};
|
|
106
|
+
}, t.nice = () => n(ti(n(), {
|
|
107
|
+
floor: (r) => o(Math.floor(s(r))),
|
|
108
|
+
ceil: (r) => o(Math.ceil(s(r)))
|
|
109
|
+
})), t;
|
|
110
|
+
}
|
|
111
|
+
function gt() {
|
|
112
|
+
const i = Ti(Xt()).domain([1, 10]);
|
|
113
|
+
return i.copy = () => Gt(i, gt()).base(i.base()), $t.apply(i, arguments), i;
|
|
114
|
+
}
|
|
115
|
+
function w(i, t, n) {
|
|
116
|
+
i._context.bezierCurveTo(
|
|
117
|
+
(2 * i._x0 + i._x1) / 3,
|
|
118
|
+
(2 * i._y0 + i._y1) / 3,
|
|
119
|
+
(i._x0 + 2 * i._x1) / 3,
|
|
120
|
+
(i._y0 + 2 * i._y1) / 3,
|
|
121
|
+
(i._x0 + 4 * i._x1 + t) / 6,
|
|
122
|
+
(i._y0 + 4 * i._y1 + n) / 6
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
function B(i) {
|
|
126
|
+
this._context = i;
|
|
127
|
+
}
|
|
128
|
+
B.prototype = {
|
|
129
|
+
areaStart: function() {
|
|
130
|
+
this._line = 0;
|
|
131
|
+
},
|
|
132
|
+
areaEnd: function() {
|
|
133
|
+
this._line = NaN;
|
|
134
|
+
},
|
|
135
|
+
lineStart: function() {
|
|
136
|
+
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
|
|
137
|
+
},
|
|
138
|
+
lineEnd: function() {
|
|
139
|
+
switch (this._point) {
|
|
140
|
+
case 3:
|
|
141
|
+
w(this, this._x1, this._y1);
|
|
142
|
+
case 2:
|
|
143
|
+
this._context.lineTo(this._x1, this._y1);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
147
|
+
},
|
|
148
|
+
point: function(i, t) {
|
|
149
|
+
switch (i = +i, t = +t, this._point) {
|
|
150
|
+
case 0:
|
|
151
|
+
this._point = 1, this._line ? this._context.lineTo(i, t) : this._context.moveTo(i, t);
|
|
152
|
+
break;
|
|
153
|
+
case 1:
|
|
154
|
+
this._point = 2;
|
|
155
|
+
break;
|
|
156
|
+
case 2:
|
|
157
|
+
this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
|
|
158
|
+
default:
|
|
159
|
+
w(this, i, t);
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
this._x0 = this._x1, this._x1 = i, this._y0 = this._y1, this._y1 = t;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
function Di(i) {
|
|
166
|
+
return new B(i);
|
|
167
|
+
}
|
|
168
|
+
function yt(i) {
|
|
169
|
+
this._context = i;
|
|
170
|
+
}
|
|
171
|
+
yt.prototype = {
|
|
172
|
+
areaStart: O,
|
|
173
|
+
areaEnd: O,
|
|
174
|
+
lineStart: function() {
|
|
175
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN, this._point = 0;
|
|
176
|
+
},
|
|
177
|
+
lineEnd: function() {
|
|
178
|
+
switch (this._point) {
|
|
179
|
+
case 1: {
|
|
180
|
+
this._context.moveTo(this._x2, this._y2), this._context.closePath();
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case 2: {
|
|
184
|
+
this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3), this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3), this._context.closePath();
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case 3: {
|
|
188
|
+
this.point(this._x2, this._y2), this.point(this._x3, this._y3), this.point(this._x4, this._y4);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
point: function(i, t) {
|
|
194
|
+
switch (i = +i, t = +t, this._point) {
|
|
195
|
+
case 0:
|
|
196
|
+
this._point = 1, this._x2 = i, this._y2 = t;
|
|
197
|
+
break;
|
|
198
|
+
case 1:
|
|
199
|
+
this._point = 2, this._x3 = i, this._y3 = t;
|
|
200
|
+
break;
|
|
201
|
+
case 2:
|
|
202
|
+
this._point = 3, this._x4 = i, this._y4 = t, this._context.moveTo((this._x0 + 4 * this._x1 + i) / 6, (this._y0 + 4 * this._y1 + t) / 6);
|
|
203
|
+
break;
|
|
204
|
+
default:
|
|
205
|
+
w(this, i, t);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
this._x0 = this._x1, this._x1 = i, this._y0 = this._y1, this._y1 = t;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
function Ai(i) {
|
|
212
|
+
return new yt(i);
|
|
213
|
+
}
|
|
214
|
+
function vt(i) {
|
|
215
|
+
this._context = i;
|
|
216
|
+
}
|
|
217
|
+
vt.prototype = {
|
|
218
|
+
areaStart: function() {
|
|
219
|
+
this._line = 0;
|
|
220
|
+
},
|
|
221
|
+
areaEnd: function() {
|
|
222
|
+
this._line = NaN;
|
|
223
|
+
},
|
|
224
|
+
lineStart: function() {
|
|
225
|
+
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
|
|
226
|
+
},
|
|
227
|
+
lineEnd: function() {
|
|
228
|
+
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
|
|
229
|
+
},
|
|
230
|
+
point: function(i, t) {
|
|
231
|
+
switch (i = +i, t = +t, this._point) {
|
|
232
|
+
case 0:
|
|
233
|
+
this._point = 1;
|
|
234
|
+
break;
|
|
235
|
+
case 1:
|
|
236
|
+
this._point = 2;
|
|
237
|
+
break;
|
|
238
|
+
case 2:
|
|
239
|
+
this._point = 3;
|
|
240
|
+
var n = (this._x0 + 4 * this._x1 + i) / 6, e = (this._y0 + 4 * this._y1 + t) / 6;
|
|
241
|
+
this._line ? this._context.lineTo(n, e) : this._context.moveTo(n, e);
|
|
242
|
+
break;
|
|
243
|
+
case 3:
|
|
244
|
+
this._point = 4;
|
|
245
|
+
default:
|
|
246
|
+
w(this, i, t);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
this._x0 = this._x1, this._x1 = i, this._y0 = this._y1, this._y1 = t;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
function Oi(i) {
|
|
253
|
+
return new vt(i);
|
|
254
|
+
}
|
|
255
|
+
function Tt(i, t) {
|
|
256
|
+
this._basis = new B(i), this._beta = t;
|
|
257
|
+
}
|
|
258
|
+
Tt.prototype = {
|
|
259
|
+
lineStart: function() {
|
|
260
|
+
this._x = [], this._y = [], this._basis.lineStart();
|
|
261
|
+
},
|
|
262
|
+
lineEnd: function() {
|
|
263
|
+
var i = this._x, t = this._y, n = i.length - 1;
|
|
264
|
+
if (n > 0)
|
|
265
|
+
for (var e = i[0], s = t[0], o = i[n] - e, a = t[n] - s, r = -1, h; ++r <= n; )
|
|
266
|
+
h = r / n, this._basis.point(
|
|
267
|
+
this._beta * i[r] + (1 - this._beta) * (e + h * o),
|
|
268
|
+
this._beta * t[r] + (1 - this._beta) * (s + h * a)
|
|
269
|
+
);
|
|
270
|
+
this._x = this._y = null, this._basis.lineEnd();
|
|
271
|
+
},
|
|
272
|
+
point: function(i, t) {
|
|
273
|
+
this._x.push(+i), this._y.push(+t);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const Mi = function i(t) {
|
|
277
|
+
function n(e) {
|
|
278
|
+
return t === 1 ? new B(e) : new Tt(e, t);
|
|
279
|
+
}
|
|
280
|
+
return n.beta = function(e) {
|
|
281
|
+
return i(+e);
|
|
282
|
+
}, n;
|
|
283
|
+
}(0.85);
|
|
284
|
+
function k(i, t, n) {
|
|
285
|
+
i._context.bezierCurveTo(
|
|
286
|
+
i._x1 + i._k * (i._x2 - i._x0),
|
|
287
|
+
i._y1 + i._k * (i._y2 - i._y0),
|
|
288
|
+
i._x2 + i._k * (i._x1 - t),
|
|
289
|
+
i._y2 + i._k * (i._y1 - n),
|
|
290
|
+
i._x2,
|
|
291
|
+
i._y2
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
function F(i, t) {
|
|
295
|
+
this._context = i, this._k = (1 - t) / 6;
|
|
296
|
+
}
|
|
297
|
+
F.prototype = {
|
|
298
|
+
areaStart: function() {
|
|
299
|
+
this._line = 0;
|
|
300
|
+
},
|
|
301
|
+
areaEnd: function() {
|
|
302
|
+
this._line = NaN;
|
|
303
|
+
},
|
|
304
|
+
lineStart: function() {
|
|
305
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
|
|
306
|
+
},
|
|
307
|
+
lineEnd: function() {
|
|
308
|
+
switch (this._point) {
|
|
309
|
+
case 2:
|
|
310
|
+
this._context.lineTo(this._x2, this._y2);
|
|
311
|
+
break;
|
|
312
|
+
case 3:
|
|
313
|
+
k(this, this._x1, this._y1);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
317
|
+
},
|
|
318
|
+
point: function(i, t) {
|
|
319
|
+
switch (i = +i, t = +t, this._point) {
|
|
320
|
+
case 0:
|
|
321
|
+
this._point = 1, this._line ? this._context.lineTo(i, t) : this._context.moveTo(i, t);
|
|
322
|
+
break;
|
|
323
|
+
case 1:
|
|
324
|
+
this._point = 2, this._x1 = i, this._y1 = t;
|
|
325
|
+
break;
|
|
326
|
+
case 2:
|
|
327
|
+
this._point = 3;
|
|
328
|
+
default:
|
|
329
|
+
k(this, i, t);
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = i, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const bi = function i(t) {
|
|
336
|
+
function n(e) {
|
|
337
|
+
return new F(e, t);
|
|
338
|
+
}
|
|
339
|
+
return n.tension = function(e) {
|
|
340
|
+
return i(+e);
|
|
341
|
+
}, n;
|
|
342
|
+
}(0);
|
|
343
|
+
function z(i, t) {
|
|
344
|
+
this._context = i, this._k = (1 - t) / 6;
|
|
345
|
+
}
|
|
346
|
+
z.prototype = {
|
|
347
|
+
areaStart: O,
|
|
348
|
+
areaEnd: O,
|
|
349
|
+
lineStart: function() {
|
|
350
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._point = 0;
|
|
351
|
+
},
|
|
352
|
+
lineEnd: function() {
|
|
353
|
+
switch (this._point) {
|
|
354
|
+
case 1: {
|
|
355
|
+
this._context.moveTo(this._x3, this._y3), this._context.closePath();
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
case 2: {
|
|
359
|
+
this._context.lineTo(this._x3, this._y3), this._context.closePath();
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
case 3: {
|
|
363
|
+
this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
point: function(i, t) {
|
|
369
|
+
switch (i = +i, t = +t, this._point) {
|
|
370
|
+
case 0:
|
|
371
|
+
this._point = 1, this._x3 = i, this._y3 = t;
|
|
372
|
+
break;
|
|
373
|
+
case 1:
|
|
374
|
+
this._point = 2, this._context.moveTo(this._x4 = i, this._y4 = t);
|
|
375
|
+
break;
|
|
376
|
+
case 2:
|
|
377
|
+
this._point = 3, this._x5 = i, this._y5 = t;
|
|
378
|
+
break;
|
|
379
|
+
default:
|
|
380
|
+
k(this, i, t);
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = i, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const Si = function i(t) {
|
|
387
|
+
function n(e) {
|
|
388
|
+
return new z(e, t);
|
|
389
|
+
}
|
|
390
|
+
return n.tension = function(e) {
|
|
391
|
+
return i(+e);
|
|
392
|
+
}, n;
|
|
393
|
+
}(0);
|
|
394
|
+
function V(i, t) {
|
|
395
|
+
this._context = i, this._k = (1 - t) / 6;
|
|
396
|
+
}
|
|
397
|
+
V.prototype = {
|
|
398
|
+
areaStart: function() {
|
|
399
|
+
this._line = 0;
|
|
400
|
+
},
|
|
401
|
+
areaEnd: function() {
|
|
402
|
+
this._line = NaN;
|
|
403
|
+
},
|
|
404
|
+
lineStart: function() {
|
|
405
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
|
|
406
|
+
},
|
|
407
|
+
lineEnd: function() {
|
|
408
|
+
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
|
|
409
|
+
},
|
|
410
|
+
point: function(i, t) {
|
|
411
|
+
switch (i = +i, t = +t, this._point) {
|
|
412
|
+
case 0:
|
|
413
|
+
this._point = 1;
|
|
414
|
+
break;
|
|
415
|
+
case 1:
|
|
416
|
+
this._point = 2;
|
|
417
|
+
break;
|
|
418
|
+
case 2:
|
|
419
|
+
this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
420
|
+
break;
|
|
421
|
+
case 3:
|
|
422
|
+
this._point = 4;
|
|
423
|
+
default:
|
|
424
|
+
k(this, i, t);
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = i, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
const Pi = function i(t) {
|
|
431
|
+
function n(e) {
|
|
432
|
+
return new V(e, t);
|
|
433
|
+
}
|
|
434
|
+
return n.tension = function(e) {
|
|
435
|
+
return i(+e);
|
|
436
|
+
}, n;
|
|
437
|
+
}(0);
|
|
438
|
+
function Y(i, t, n) {
|
|
439
|
+
var e = i._x1, s = i._y1, o = i._x2, a = i._y2;
|
|
440
|
+
if (i._l01_a > tt) {
|
|
441
|
+
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);
|
|
442
|
+
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;
|
|
443
|
+
}
|
|
444
|
+
if (i._l23_a > tt) {
|
|
445
|
+
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);
|
|
446
|
+
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;
|
|
447
|
+
}
|
|
448
|
+
i._context.bezierCurveTo(e, s, o, a, i._x2, i._y2);
|
|
449
|
+
}
|
|
450
|
+
function Dt(i, t) {
|
|
451
|
+
this._context = i, this._alpha = t;
|
|
452
|
+
}
|
|
453
|
+
Dt.prototype = {
|
|
454
|
+
areaStart: function() {
|
|
455
|
+
this._line = 0;
|
|
456
|
+
},
|
|
457
|
+
areaEnd: function() {
|
|
458
|
+
this._line = NaN;
|
|
459
|
+
},
|
|
460
|
+
lineStart: function() {
|
|
461
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
462
|
+
},
|
|
463
|
+
lineEnd: function() {
|
|
464
|
+
switch (this._point) {
|
|
465
|
+
case 2:
|
|
466
|
+
this._context.lineTo(this._x2, this._y2);
|
|
467
|
+
break;
|
|
468
|
+
case 3:
|
|
469
|
+
this.point(this._x2, this._y2);
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
473
|
+
},
|
|
474
|
+
point: function(i, t) {
|
|
475
|
+
if (i = +i, t = +t, this._point) {
|
|
476
|
+
var n = this._x2 - i, e = this._y2 - t;
|
|
477
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
|
|
478
|
+
}
|
|
479
|
+
switch (this._point) {
|
|
480
|
+
case 0:
|
|
481
|
+
this._point = 1, this._line ? this._context.lineTo(i, t) : this._context.moveTo(i, t);
|
|
482
|
+
break;
|
|
483
|
+
case 1:
|
|
484
|
+
this._point = 2;
|
|
485
|
+
break;
|
|
486
|
+
case 2:
|
|
487
|
+
this._point = 3;
|
|
488
|
+
default:
|
|
489
|
+
Y(this, i, t);
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = i, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
const Ei = function i(t) {
|
|
496
|
+
function n(e) {
|
|
497
|
+
return t ? new Dt(e, t) : new F(e, 0);
|
|
498
|
+
}
|
|
499
|
+
return n.alpha = function(e) {
|
|
500
|
+
return i(+e);
|
|
501
|
+
}, n;
|
|
502
|
+
}(0.5);
|
|
503
|
+
function At(i, t) {
|
|
504
|
+
this._context = i, this._alpha = t;
|
|
505
|
+
}
|
|
506
|
+
At.prototype = {
|
|
507
|
+
areaStart: O,
|
|
508
|
+
areaEnd: O,
|
|
509
|
+
lineStart: function() {
|
|
510
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
511
|
+
},
|
|
512
|
+
lineEnd: function() {
|
|
513
|
+
switch (this._point) {
|
|
514
|
+
case 1: {
|
|
515
|
+
this._context.moveTo(this._x3, this._y3), this._context.closePath();
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
case 2: {
|
|
519
|
+
this._context.lineTo(this._x3, this._y3), this._context.closePath();
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
case 3: {
|
|
523
|
+
this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
point: function(i, t) {
|
|
529
|
+
if (i = +i, t = +t, this._point) {
|
|
530
|
+
var n = this._x2 - i, e = this._y2 - t;
|
|
531
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
|
|
532
|
+
}
|
|
533
|
+
switch (this._point) {
|
|
534
|
+
case 0:
|
|
535
|
+
this._point = 1, this._x3 = i, this._y3 = t;
|
|
536
|
+
break;
|
|
537
|
+
case 1:
|
|
538
|
+
this._point = 2, this._context.moveTo(this._x4 = i, this._y4 = t);
|
|
539
|
+
break;
|
|
540
|
+
case 2:
|
|
541
|
+
this._point = 3, this._x5 = i, this._y5 = t;
|
|
542
|
+
break;
|
|
543
|
+
default:
|
|
544
|
+
Y(this, i, t);
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = i, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
const wi = function i(t) {
|
|
551
|
+
function n(e) {
|
|
552
|
+
return t ? new At(e, t) : new z(e, 0);
|
|
553
|
+
}
|
|
554
|
+
return n.alpha = function(e) {
|
|
555
|
+
return i(+e);
|
|
556
|
+
}, n;
|
|
557
|
+
}(0.5);
|
|
558
|
+
function Ot(i, t) {
|
|
559
|
+
this._context = i, this._alpha = t;
|
|
560
|
+
}
|
|
561
|
+
Ot.prototype = {
|
|
562
|
+
areaStart: function() {
|
|
563
|
+
this._line = 0;
|
|
564
|
+
},
|
|
565
|
+
areaEnd: function() {
|
|
566
|
+
this._line = NaN;
|
|
567
|
+
},
|
|
568
|
+
lineStart: function() {
|
|
569
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
570
|
+
},
|
|
571
|
+
lineEnd: function() {
|
|
572
|
+
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
|
|
573
|
+
},
|
|
574
|
+
point: function(i, t) {
|
|
575
|
+
if (i = +i, t = +t, this._point) {
|
|
576
|
+
var n = this._x2 - i, e = this._y2 - t;
|
|
577
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
|
|
578
|
+
}
|
|
579
|
+
switch (this._point) {
|
|
580
|
+
case 0:
|
|
581
|
+
this._point = 1;
|
|
582
|
+
break;
|
|
583
|
+
case 1:
|
|
584
|
+
this._point = 2;
|
|
585
|
+
break;
|
|
586
|
+
case 2:
|
|
587
|
+
this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
|
588
|
+
break;
|
|
589
|
+
case 3:
|
|
590
|
+
this._point = 4;
|
|
591
|
+
default:
|
|
592
|
+
Y(this, i, t);
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = i, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
const ki = function i(t) {
|
|
599
|
+
function n(e) {
|
|
600
|
+
return t ? new Ot(e, t) : new V(e, 0);
|
|
601
|
+
}
|
|
602
|
+
return n.alpha = function(e) {
|
|
603
|
+
return i(+e);
|
|
604
|
+
}, n;
|
|
605
|
+
}(0.5);
|
|
606
|
+
function st(i) {
|
|
607
|
+
return i < 0 ? -1 : 1;
|
|
608
|
+
}
|
|
609
|
+
function ot(i, t, n) {
|
|
610
|
+
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);
|
|
611
|
+
return (st(o) + st(a)) * Math.min(Math.abs(o), Math.abs(a), 0.5 * Math.abs(r)) || 0;
|
|
612
|
+
}
|
|
613
|
+
function at(i, t) {
|
|
614
|
+
var n = i._x1 - i._x0;
|
|
615
|
+
return n ? (3 * (i._y1 - i._y0) / n - t) / 2 : t;
|
|
616
|
+
}
|
|
617
|
+
function C(i, t, n) {
|
|
618
|
+
var e = i._x0, s = i._y0, o = i._x1, a = i._y1, r = (o - e) / 3;
|
|
619
|
+
i._context.bezierCurveTo(e + r, s + r * t, o - r, a - r * n, o, a);
|
|
620
|
+
}
|
|
621
|
+
function R(i) {
|
|
622
|
+
this._context = i;
|
|
623
|
+
}
|
|
624
|
+
R.prototype = {
|
|
625
|
+
areaStart: function() {
|
|
626
|
+
this._line = 0;
|
|
627
|
+
},
|
|
628
|
+
areaEnd: function() {
|
|
629
|
+
this._line = NaN;
|
|
630
|
+
},
|
|
631
|
+
lineStart: function() {
|
|
632
|
+
this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
|
|
633
|
+
},
|
|
634
|
+
lineEnd: function() {
|
|
635
|
+
switch (this._point) {
|
|
636
|
+
case 2:
|
|
637
|
+
this._context.lineTo(this._x1, this._y1);
|
|
638
|
+
break;
|
|
639
|
+
case 3:
|
|
640
|
+
C(this, this._t0, at(this, this._t0));
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
644
|
+
},
|
|
645
|
+
point: function(i, t) {
|
|
646
|
+
var n = NaN;
|
|
647
|
+
if (i = +i, t = +t, !(i === this._x1 && t === this._y1)) {
|
|
648
|
+
switch (this._point) {
|
|
649
|
+
case 0:
|
|
650
|
+
this._point = 1, this._line ? this._context.lineTo(i, t) : this._context.moveTo(i, t);
|
|
651
|
+
break;
|
|
652
|
+
case 1:
|
|
653
|
+
this._point = 2;
|
|
654
|
+
break;
|
|
655
|
+
case 2:
|
|
656
|
+
this._point = 3, C(this, at(this, n = ot(this, i, t)), n);
|
|
657
|
+
break;
|
|
658
|
+
default:
|
|
659
|
+
C(this, this._t0, n = ot(this, i, t));
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
this._x0 = this._x1, this._x1 = i, this._y0 = this._y1, this._y1 = t, this._t0 = n;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
function Mt(i) {
|
|
667
|
+
this._context = new bt(i);
|
|
668
|
+
}
|
|
669
|
+
(Mt.prototype = Object.create(R.prototype)).point = function(i, t) {
|
|
670
|
+
R.prototype.point.call(this, t, i);
|
|
671
|
+
};
|
|
672
|
+
function bt(i) {
|
|
673
|
+
this._context = i;
|
|
674
|
+
}
|
|
675
|
+
bt.prototype = {
|
|
676
|
+
moveTo: function(i, t) {
|
|
677
|
+
this._context.moveTo(t, i);
|
|
678
|
+
},
|
|
679
|
+
closePath: function() {
|
|
680
|
+
this._context.closePath();
|
|
681
|
+
},
|
|
682
|
+
lineTo: function(i, t) {
|
|
683
|
+
this._context.lineTo(t, i);
|
|
684
|
+
},
|
|
685
|
+
bezierCurveTo: function(i, t, n, e, s, o) {
|
|
686
|
+
this._context.bezierCurveTo(t, i, e, n, o, s);
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
function Ri(i) {
|
|
690
|
+
return new R(i);
|
|
691
|
+
}
|
|
692
|
+
function Bi(i) {
|
|
693
|
+
return new Mt(i);
|
|
694
|
+
}
|
|
695
|
+
function St(i) {
|
|
696
|
+
this._context = i;
|
|
697
|
+
}
|
|
698
|
+
St.prototype = {
|
|
699
|
+
areaStart: function() {
|
|
700
|
+
this._line = 0;
|
|
701
|
+
},
|
|
702
|
+
areaEnd: function() {
|
|
703
|
+
this._line = NaN;
|
|
704
|
+
},
|
|
705
|
+
lineStart: function() {
|
|
706
|
+
this._x = [], this._y = [];
|
|
707
|
+
},
|
|
708
|
+
lineEnd: function() {
|
|
709
|
+
var i = this._x, t = this._y, n = i.length;
|
|
710
|
+
if (n)
|
|
711
|
+
if (this._line ? this._context.lineTo(i[0], t[0]) : this._context.moveTo(i[0], t[0]), n === 2)
|
|
712
|
+
this._context.lineTo(i[1], t[1]);
|
|
713
|
+
else
|
|
714
|
+
for (var e = rt(i), s = rt(t), o = 0, a = 1; a < n; ++o, ++a)
|
|
715
|
+
this._context.bezierCurveTo(e[0][o], s[0][o], e[1][o], s[1][o], i[a], t[a]);
|
|
716
|
+
(this._line || this._line !== 0 && n === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
|
|
717
|
+
},
|
|
718
|
+
point: function(i, t) {
|
|
719
|
+
this._x.push(+i), this._y.push(+t);
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
function rt(i) {
|
|
723
|
+
var t, n = i.length - 1, e, s = new Array(n), o = new Array(n), a = new Array(n);
|
|
724
|
+
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];
|
|
725
|
+
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];
|
|
726
|
+
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];
|
|
727
|
+
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];
|
|
728
|
+
return [s, o];
|
|
729
|
+
}
|
|
730
|
+
function Li(i) {
|
|
731
|
+
return new St(i);
|
|
732
|
+
}
|
|
733
|
+
function L(i, t) {
|
|
734
|
+
this._context = i, this._t = t;
|
|
735
|
+
}
|
|
736
|
+
L.prototype = {
|
|
737
|
+
areaStart: function() {
|
|
738
|
+
this._line = 0;
|
|
739
|
+
},
|
|
740
|
+
areaEnd: function() {
|
|
741
|
+
this._line = NaN;
|
|
742
|
+
},
|
|
743
|
+
lineStart: function() {
|
|
744
|
+
this._x = this._y = NaN, this._point = 0;
|
|
745
|
+
},
|
|
746
|
+
lineEnd: function() {
|
|
747
|
+
0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
|
|
748
|
+
},
|
|
749
|
+
point: function(i, t) {
|
|
750
|
+
switch (i = +i, t = +t, this._point) {
|
|
751
|
+
case 0:
|
|
752
|
+
this._point = 1, this._line ? this._context.lineTo(i, t) : this._context.moveTo(i, t);
|
|
753
|
+
break;
|
|
754
|
+
case 1:
|
|
755
|
+
this._point = 2;
|
|
756
|
+
default: {
|
|
757
|
+
if (this._t <= 0)
|
|
758
|
+
this._context.lineTo(this._x, t), this._context.lineTo(i, t);
|
|
759
|
+
else {
|
|
760
|
+
var n = this._x * (1 - this._t) + i * this._t;
|
|
761
|
+
this._context.lineTo(n, this._y), this._context.lineTo(n, t);
|
|
762
|
+
}
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
this._x = i, this._y = t;
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
function Ni(i) {
|
|
770
|
+
return new L(i, 0.5);
|
|
771
|
+
}
|
|
772
|
+
function Ci(i) {
|
|
773
|
+
return new L(i, 0);
|
|
774
|
+
}
|
|
775
|
+
function Ii(i) {
|
|
776
|
+
return new L(i, 1);
|
|
777
|
+
}
|
|
778
|
+
class en extends A {
|
|
779
|
+
/**
|
|
780
|
+
* focal: object to zoom into
|
|
781
|
+
* canvasElements: all the elements to translate and zoom on the chart area
|
|
782
|
+
* zoomSettings: object containing duration, easing and zoomlevel for the zoom behaviours
|
|
783
|
+
* */
|
|
784
|
+
zoomIn(t, n, e) {
|
|
785
|
+
let s, o, a;
|
|
786
|
+
const r = e || W;
|
|
787
|
+
t && (s = t.x, o = t.y, a = 2);
|
|
788
|
+
const { width: h, height: l } = ii.getSVGElementSize(this.services.domUtils.getHolder(), {
|
|
789
|
+
useClientDimensions: !0
|
|
790
|
+
});
|
|
791
|
+
n.transition().duration(r.duration).ease(r.ease).attr(
|
|
792
|
+
"transform",
|
|
793
|
+
`translate(${h / 2}, ${l / 2}) scale(${a}) translate(${-s},${-o})`
|
|
794
|
+
), this.services.events.dispatchEvent(E.CanvasZoom.CANVAS_ZOOM_IN, {
|
|
795
|
+
element: ni(t)
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
zoomOut(t, n) {
|
|
799
|
+
const e = n || W;
|
|
800
|
+
t.transition().duration(e.duration).ease(e.ease).attr("transform", ""), this.services.events.dispatchEvent(E.CanvasZoom.CANVAS_ZOOM_OUT);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
class sn extends A {
|
|
804
|
+
init() {
|
|
805
|
+
this.documentFragment = document.createDocumentFragment();
|
|
806
|
+
}
|
|
807
|
+
addEventListener(t, n) {
|
|
808
|
+
this.documentFragment.addEventListener(t, n);
|
|
809
|
+
}
|
|
810
|
+
removeEventListener(t, n) {
|
|
811
|
+
this.documentFragment.removeEventListener(t, n);
|
|
812
|
+
}
|
|
813
|
+
dispatchEvent(t, n) {
|
|
814
|
+
let e;
|
|
815
|
+
n ? e = new CustomEvent(t, {
|
|
816
|
+
detail: n
|
|
817
|
+
}) : (e = document.createEvent("Event"), e.initEvent(t, !1, !0)), this.documentFragment.dispatchEvent(e);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
class on extends A {
|
|
821
|
+
constructor(t, n) {
|
|
822
|
+
super(t, n);
|
|
823
|
+
}
|
|
824
|
+
downloadCSV(t, n) {
|
|
825
|
+
const e = document.createElement("a"), s = "text/csv;encoding:utf-8";
|
|
826
|
+
if (navigator.msSaveBlob)
|
|
827
|
+
navigator.msSaveBlob(
|
|
828
|
+
new Blob([t], {
|
|
829
|
+
type: s
|
|
830
|
+
}),
|
|
831
|
+
n
|
|
832
|
+
);
|
|
833
|
+
else if (URL && "download" in e) {
|
|
834
|
+
const o = URL.createObjectURL(
|
|
835
|
+
new Blob([t], {
|
|
836
|
+
type: s
|
|
837
|
+
})
|
|
838
|
+
);
|
|
839
|
+
e.href = o, e.setAttribute("download", n), document.body.appendChild(e), e.click(), document.body.removeChild(e), URL.revokeObjectURL(o);
|
|
840
|
+
} else
|
|
841
|
+
location.href = `data:application/octet-stream,${encodeURIComponent(t)}`;
|
|
842
|
+
}
|
|
843
|
+
downloadImage(t, n) {
|
|
844
|
+
const e = document.createElement("a");
|
|
845
|
+
e.download = n, e.href = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
class an extends A {
|
|
849
|
+
constructor() {
|
|
850
|
+
super(...arguments), this.pendingTransitions = {};
|
|
851
|
+
}
|
|
852
|
+
init() {
|
|
853
|
+
var t;
|
|
854
|
+
(t = this.services.events) == null || t.addEventListener(E.Model.UPDATE, () => {
|
|
855
|
+
this.pendingTransitions = {};
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
setupTransition({ transition: t, name: n, animate: e }) {
|
|
859
|
+
return this.pendingTransitions[t._id] = t, t.on("end interrupt cancel", () => {
|
|
860
|
+
delete this.pendingTransitions[t._id];
|
|
861
|
+
}), this.model.getOptions().animations === !1 || e === !1 ? t.duration(0) : t.duration(
|
|
862
|
+
c(J, n, "duration") || J.default.duration
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
getPendingTransitions() {
|
|
866
|
+
return this.pendingTransitions;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
function b(i, t) {
|
|
870
|
+
const n = x(i), e = x(t), s = n.getTime() - e.getTime();
|
|
871
|
+
return s < 0 ? -1 : s > 0 ? 1 : s;
|
|
872
|
+
}
|
|
873
|
+
function Zi(i, t) {
|
|
874
|
+
const n = x(i), e = x(t);
|
|
875
|
+
return n.getFullYear() - e.getFullYear();
|
|
876
|
+
}
|
|
877
|
+
function Fi(i, t) {
|
|
878
|
+
const n = x(i), e = x(t), s = b(n, e), o = Math.abs(Zi(n, e));
|
|
879
|
+
n.setFullYear(1584), e.setFullYear(1584);
|
|
880
|
+
const a = b(n, e) === -s, r = s * (o - +a);
|
|
881
|
+
return r === 0 ? 0 : r;
|
|
882
|
+
}
|
|
883
|
+
function H(i, t) {
|
|
884
|
+
const n = x(i);
|
|
885
|
+
if (isNaN(t)) return P(i, NaN);
|
|
886
|
+
if (!t)
|
|
887
|
+
return n;
|
|
888
|
+
const e = n.getDate(), s = P(i, n.getTime());
|
|
889
|
+
s.setMonth(n.getMonth() + t + 1, 0);
|
|
890
|
+
const o = s.getDate();
|
|
891
|
+
return e >= o ? s : (n.setFullYear(
|
|
892
|
+
s.getFullYear(),
|
|
893
|
+
s.getMonth(),
|
|
894
|
+
e
|
|
895
|
+
), n);
|
|
896
|
+
}
|
|
897
|
+
function Pt(i, t) {
|
|
898
|
+
return H(i, t * 12);
|
|
899
|
+
}
|
|
900
|
+
function zi(i, t) {
|
|
901
|
+
return Pt(i, -t);
|
|
902
|
+
}
|
|
903
|
+
function Vi(i, t) {
|
|
904
|
+
const n = x(i), e = x(t), s = n.getFullYear() - e.getFullYear(), o = n.getMonth() - e.getMonth();
|
|
905
|
+
return s * 12 + o;
|
|
906
|
+
}
|
|
907
|
+
function Yi(i) {
|
|
908
|
+
const t = x(i);
|
|
909
|
+
return t.setHours(23, 59, 59, 999), t;
|
|
910
|
+
}
|
|
911
|
+
function Hi(i) {
|
|
912
|
+
const t = x(i), n = t.getMonth();
|
|
913
|
+
return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t;
|
|
914
|
+
}
|
|
915
|
+
function Xi(i) {
|
|
916
|
+
const t = x(i);
|
|
917
|
+
return +Yi(t) == +Hi(t);
|
|
918
|
+
}
|
|
919
|
+
function Gi(i, t) {
|
|
920
|
+
const n = x(i), e = x(t), s = b(n, e), o = Math.abs(
|
|
921
|
+
Vi(n, e)
|
|
922
|
+
);
|
|
923
|
+
let a;
|
|
924
|
+
if (o < 1)
|
|
925
|
+
a = 0;
|
|
926
|
+
else {
|
|
927
|
+
n.getMonth() === 1 && n.getDate() > 27 && n.setDate(30), n.setMonth(n.getMonth() - s * o);
|
|
928
|
+
let r = b(n, e) === -s;
|
|
929
|
+
Xi(x(i)) && o === 1 && b(i, e) === 1 && (r = !1), a = s * (o - Number(r));
|
|
930
|
+
}
|
|
931
|
+
return a === 0 ? 0 : a;
|
|
932
|
+
}
|
|
933
|
+
function $i(i, t) {
|
|
934
|
+
return H(i, -t);
|
|
935
|
+
}
|
|
936
|
+
function Ui(i, t) {
|
|
937
|
+
const n = x(i), e = x(t), s = ht(n, e), o = Math.abs(qt(n, e));
|
|
938
|
+
n.setDate(n.getDate() - s * o);
|
|
939
|
+
const a = +(ht(n, e) === -s), r = s * (o - a);
|
|
940
|
+
return r === 0 ? 0 : r;
|
|
941
|
+
}
|
|
942
|
+
function ht(i, t) {
|
|
943
|
+
const n = i.getFullYear() - t.getFullYear() || i.getMonth() - t.getMonth() || i.getDate() - t.getDate() || i.getHours() - t.getHours() || i.getMinutes() - t.getMinutes() || i.getSeconds() - t.getSeconds() || i.getMilliseconds() - t.getMilliseconds();
|
|
944
|
+
return n < 0 ? -1 : n > 0 ? 1 : n;
|
|
945
|
+
}
|
|
946
|
+
function Et(i, t) {
|
|
947
|
+
const n = x(i);
|
|
948
|
+
return isNaN(t) ? P(i, NaN) : (t && n.setDate(n.getDate() + t), n);
|
|
949
|
+
}
|
|
950
|
+
function Ki(i, t) {
|
|
951
|
+
return Et(i, -t);
|
|
952
|
+
}
|
|
953
|
+
function X(i) {
|
|
954
|
+
return (t) => {
|
|
955
|
+
const e = (i ? Math[i] : Math.trunc)(t);
|
|
956
|
+
return e === 0 ? 0 : e;
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
function G(i, t) {
|
|
960
|
+
return +x(i) - +x(t);
|
|
961
|
+
}
|
|
962
|
+
function qi(i, t, n) {
|
|
963
|
+
const e = G(i, t) / mt;
|
|
964
|
+
return X(n == null ? void 0 : n.roundingMethod)(e);
|
|
965
|
+
}
|
|
966
|
+
function $(i, t) {
|
|
967
|
+
const n = +x(i);
|
|
968
|
+
return P(i, n + t);
|
|
969
|
+
}
|
|
970
|
+
function wt(i, t) {
|
|
971
|
+
return $(i, t * mt);
|
|
972
|
+
}
|
|
973
|
+
function ji(i, t) {
|
|
974
|
+
return wt(i, -t);
|
|
975
|
+
}
|
|
976
|
+
function ct(i, t, n) {
|
|
977
|
+
const e = G(i, t) / dt;
|
|
978
|
+
return X(n == null ? void 0 : n.roundingMethod)(e);
|
|
979
|
+
}
|
|
980
|
+
function I(i, t) {
|
|
981
|
+
return $(i, t * dt);
|
|
982
|
+
}
|
|
983
|
+
function lt(i, t) {
|
|
984
|
+
return I(i, -t);
|
|
985
|
+
}
|
|
986
|
+
function _t(i, t, n) {
|
|
987
|
+
const e = G(i, t) / 1e3;
|
|
988
|
+
return X(n == null ? void 0 : n.roundingMethod)(e);
|
|
989
|
+
}
|
|
990
|
+
function Z(i, t) {
|
|
991
|
+
return $(i, t * 1e3);
|
|
992
|
+
}
|
|
993
|
+
function ut(i, t) {
|
|
994
|
+
return Z(i, -t);
|
|
995
|
+
}
|
|
996
|
+
class rn extends A {
|
|
997
|
+
constructor() {
|
|
998
|
+
super(...arguments), this.scaleTypes = {
|
|
999
|
+
top: null,
|
|
1000
|
+
right: null,
|
|
1001
|
+
bottom: null,
|
|
1002
|
+
left: null
|
|
1003
|
+
}, this.scales = {
|
|
1004
|
+
// null or function
|
|
1005
|
+
top: null,
|
|
1006
|
+
right: null,
|
|
1007
|
+
bottom: null,
|
|
1008
|
+
left: null
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
getDomainAxisPosition({ datum: t = null } = {}) {
|
|
1012
|
+
if (this.dualAxes && t) {
|
|
1013
|
+
const n = this.model.getOptions(), { groupMapsTo: e } = n.data, s = c(n, "axes", this.secondaryDomainAxisPosition), o = t[e];
|
|
1014
|
+
if (s != null && s.correspondingDatasets && s.correspondingDatasets.includes(o))
|
|
1015
|
+
return this.secondaryDomainAxisPosition;
|
|
1016
|
+
}
|
|
1017
|
+
return this.domainAxisPosition;
|
|
1018
|
+
}
|
|
1019
|
+
getRangeAxisPosition({ datum: t = null, groups: n = null } = {}) {
|
|
1020
|
+
if (this.dualAxes) {
|
|
1021
|
+
const e = this.model.getOptions(), { groupMapsTo: s } = e.data, o = c(e, "axes", this.secondaryRangeAxisPosition);
|
|
1022
|
+
let a;
|
|
1023
|
+
if (t !== null ? a = t[s] : n && n.length > 0 && (a = n[0]), o != null && o.correspondingDatasets && o.correspondingDatasets.includes(a))
|
|
1024
|
+
return this.secondaryRangeAxisPosition;
|
|
1025
|
+
}
|
|
1026
|
+
return this.rangeAxisPosition;
|
|
1027
|
+
}
|
|
1028
|
+
getAxisOptions(t) {
|
|
1029
|
+
return c(this.model.getOptions(), "axes", t);
|
|
1030
|
+
}
|
|
1031
|
+
getDomainAxisOptions() {
|
|
1032
|
+
const t = this.getDomainAxisPosition();
|
|
1033
|
+
return this.getAxisOptions(t);
|
|
1034
|
+
}
|
|
1035
|
+
getRangeAxisOptions() {
|
|
1036
|
+
const t = this.getRangeAxisPosition();
|
|
1037
|
+
return this.getAxisOptions(t);
|
|
1038
|
+
}
|
|
1039
|
+
getScaleLabel(t) {
|
|
1040
|
+
const e = this.getAxisOptions(t).title;
|
|
1041
|
+
return e || (t === _.BOTTOM || t === _.TOP ? "x-value" : "y-value");
|
|
1042
|
+
}
|
|
1043
|
+
getDomainLabel() {
|
|
1044
|
+
return this.getScaleLabel(this.getDomainAxisPosition());
|
|
1045
|
+
}
|
|
1046
|
+
getRangeLabel() {
|
|
1047
|
+
return this.getScaleLabel(this.getRangeAxisPosition());
|
|
1048
|
+
}
|
|
1049
|
+
update() {
|
|
1050
|
+
this.determineAxisDuality(), this.findDomainAndRangeAxes(), this.determineOrientation(), Object.keys(_).map(
|
|
1051
|
+
(n) => _[n]
|
|
1052
|
+
).forEach((n) => {
|
|
1053
|
+
this.scales[n] = this.createScale(n);
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
findDomainAndRangeAxes() {
|
|
1057
|
+
const t = this.findVerticalAxesPositions(), n = this.findHorizontalAxesPositions(), e = this.findDomainAndRangeAxesPositions(
|
|
1058
|
+
t,
|
|
1059
|
+
n
|
|
1060
|
+
);
|
|
1061
|
+
this.domainAxisPosition = e.primaryDomainAxisPosition, this.rangeAxisPosition = e.primaryRangeAxisPosition, this.isDualAxes() && (this.secondaryDomainAxisPosition = e.secondaryDomainAxisPosition, this.secondaryRangeAxisPosition = e.secondaryRangeAxisPosition);
|
|
1062
|
+
}
|
|
1063
|
+
determineOrientation() {
|
|
1064
|
+
(this.rangeAxisPosition === _.LEFT || this.rangeAxisPosition === _.RIGHT) && (this.domainAxisPosition === _.BOTTOM || this.domainAxisPosition === _.TOP) ? this.orientation = N.VERTICAL : this.orientation = N.HORIZONTAL;
|
|
1065
|
+
}
|
|
1066
|
+
isDualAxes() {
|
|
1067
|
+
return this.dualAxes;
|
|
1068
|
+
}
|
|
1069
|
+
// if any of the axes objects have correspondingDatasets [] asserted we flag the chart as dual axes
|
|
1070
|
+
// it does not count as dual axes if it just has another axis turned on but is not actually using it to map a dataset
|
|
1071
|
+
determineAxisDuality() {
|
|
1072
|
+
var e, s, o, a;
|
|
1073
|
+
const t = this.model.getOptions(), n = c(t, "axes");
|
|
1074
|
+
((e = n[_.LEFT]) != null && e.correspondingDatasets && n[_.RIGHT] || (s = n[_.RIGHT]) != null && s.correspondingDatasets && n[_.LEFT] || (o = n[_.TOP]) != null && o.correspondingDatasets && n[_.BOTTOM] || (a = n[_.BOTTOM]) != null && a.correspondingDatasets && n[_.TOP]) && (this.dualAxes = !0);
|
|
1075
|
+
}
|
|
1076
|
+
getCustomDomainValuesByposition(t) {
|
|
1077
|
+
const n = c(this.model.getOptions(), "axes", t, "domain");
|
|
1078
|
+
if (n && !Array.isArray(n))
|
|
1079
|
+
throw new Error(`Domain in ${t} axis is not a valid array`);
|
|
1080
|
+
if (Array.isArray(n) && (this.scaleTypes[t] === m.LINEAR || this.scaleTypes[t] === m.TIME) && n.length !== 2)
|
|
1081
|
+
throw new Error(
|
|
1082
|
+
`There can only be 2 elements in domain for scale type: ${this.scaleTypes[t]}`
|
|
1083
|
+
);
|
|
1084
|
+
return n;
|
|
1085
|
+
}
|
|
1086
|
+
getOrientation() {
|
|
1087
|
+
return this.orientation;
|
|
1088
|
+
}
|
|
1089
|
+
getScaleByPosition(t) {
|
|
1090
|
+
return this.scales[t];
|
|
1091
|
+
}
|
|
1092
|
+
getScaleTypeByPosition(t) {
|
|
1093
|
+
return this.scaleTypes[t];
|
|
1094
|
+
}
|
|
1095
|
+
getDomainAxisScaleType() {
|
|
1096
|
+
const t = this.getDomainAxisPosition();
|
|
1097
|
+
return this.getScaleTypeByPosition(t);
|
|
1098
|
+
}
|
|
1099
|
+
getRangeAxisScaleType() {
|
|
1100
|
+
const t = this.getRangeAxisPosition();
|
|
1101
|
+
return this.getScaleTypeByPosition(t);
|
|
1102
|
+
}
|
|
1103
|
+
getDomainScale() {
|
|
1104
|
+
return this.scales[this.domainAxisPosition];
|
|
1105
|
+
}
|
|
1106
|
+
getRangeScale() {
|
|
1107
|
+
return this.scales[this.rangeAxisPosition];
|
|
1108
|
+
}
|
|
1109
|
+
// Find the main x-axis out of the 2 x-axis on the chart (when 2D axis is used)
|
|
1110
|
+
getMainXAxisPosition() {
|
|
1111
|
+
const t = [_.BOTTOM, _.TOP];
|
|
1112
|
+
return [this.domainAxisPosition, this.rangeAxisPosition].find(
|
|
1113
|
+
(n) => t.indexOf(n) > -1
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
// Find the main y-axis out of the 2 y-axis on the chart (when 2D axis is used)
|
|
1117
|
+
getMainYAxisPosition() {
|
|
1118
|
+
const t = [_.LEFT, _.RIGHT];
|
|
1119
|
+
return [this.domainAxisPosition, this.rangeAxisPosition].find(
|
|
1120
|
+
(n) => t.indexOf(n) > -1
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
getMainXScale() {
|
|
1124
|
+
return this.scales[this.getMainXAxisPosition()];
|
|
1125
|
+
}
|
|
1126
|
+
getMainYScale() {
|
|
1127
|
+
return this.scales[this.getMainYAxisPosition()];
|
|
1128
|
+
}
|
|
1129
|
+
getValueFromScale(t, n, e, s) {
|
|
1130
|
+
const o = this.model.getOptions(), r = c(o, "axes")[e], { mapsTo: h } = r, l = c(s, h) !== null ? s[h] : s;
|
|
1131
|
+
let f;
|
|
1132
|
+
switch (n) {
|
|
1133
|
+
case m.LABELS:
|
|
1134
|
+
f = t(l) + t.step() / 2;
|
|
1135
|
+
break;
|
|
1136
|
+
case m.TIME:
|
|
1137
|
+
f = t(new Date(l));
|
|
1138
|
+
break;
|
|
1139
|
+
default:
|
|
1140
|
+
f = t(l);
|
|
1141
|
+
}
|
|
1142
|
+
return f;
|
|
1143
|
+
}
|
|
1144
|
+
getBoundedScaledValues(t) {
|
|
1145
|
+
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;
|
|
1146
|
+
return [
|
|
1147
|
+
s(
|
|
1148
|
+
c(t, n.upperBoundMapsTo) !== null ? t[n.upperBoundMapsTo] : l
|
|
1149
|
+
),
|
|
1150
|
+
s(
|
|
1151
|
+
c(t, n.lowerBoundMapsTo) !== null ? t[n.lowerBoundMapsTo] : l
|
|
1152
|
+
)
|
|
1153
|
+
];
|
|
1154
|
+
}
|
|
1155
|
+
getValueThroughAxisPosition(t, n) {
|
|
1156
|
+
const e = this.scaleTypes[t], s = this.scales[t];
|
|
1157
|
+
return this.getValueFromScale(s, e, t, n);
|
|
1158
|
+
}
|
|
1159
|
+
getDomainValue(t) {
|
|
1160
|
+
const n = this.getDomainAxisPosition({ datum: t });
|
|
1161
|
+
return this.getValueThroughAxisPosition(n, t);
|
|
1162
|
+
}
|
|
1163
|
+
getRangeValue(t) {
|
|
1164
|
+
const n = this.getRangeAxisPosition({ datum: t });
|
|
1165
|
+
return this.getValueThroughAxisPosition(n, t);
|
|
1166
|
+
}
|
|
1167
|
+
getMainXScaleType() {
|
|
1168
|
+
return this.getScaleTypeByPosition(this.getMainXAxisPosition());
|
|
1169
|
+
}
|
|
1170
|
+
getMainYScaleType() {
|
|
1171
|
+
return this.getScaleTypeByPosition(this.getMainYAxisPosition());
|
|
1172
|
+
}
|
|
1173
|
+
getDomainIdentifier(t) {
|
|
1174
|
+
const n = this.model.getOptions();
|
|
1175
|
+
return c(n, "axes", this.getDomainAxisPosition({ datum: t }), "mapsTo");
|
|
1176
|
+
}
|
|
1177
|
+
getRangeIdentifier(t) {
|
|
1178
|
+
const n = this.model.getOptions();
|
|
1179
|
+
return c(n, "axes", this.getRangeAxisPosition({ datum: t }), "mapsTo");
|
|
1180
|
+
}
|
|
1181
|
+
extendsDomain(t, n) {
|
|
1182
|
+
const e = this.model.getOptions(), s = c(e, "axes", t);
|
|
1183
|
+
if (s.scaleType === m.TIME) {
|
|
1184
|
+
const o = c(e, "timeScale", "addSpaceOnEdges");
|
|
1185
|
+
return Wi(n, o);
|
|
1186
|
+
} else
|
|
1187
|
+
return Ji(n, Q.paddingRatio, s.scaleType);
|
|
1188
|
+
}
|
|
1189
|
+
findVerticalAxesPositions() {
|
|
1190
|
+
const t = this.model.getOptions(), n = c(t, "axes"), e = this.isDualAxes();
|
|
1191
|
+
return c(n, _.LEFT) === null && c(n, _.RIGHT) !== null || c(n, _.RIGHT, "main") === !0 || e && c(n, _.LEFT, "correspondingDatasets") ? {
|
|
1192
|
+
primary: _.RIGHT,
|
|
1193
|
+
secondary: _.LEFT
|
|
1194
|
+
} : { primary: _.LEFT, secondary: _.RIGHT };
|
|
1195
|
+
}
|
|
1196
|
+
findHorizontalAxesPositions() {
|
|
1197
|
+
const t = this.model.getOptions(), n = c(t, "axes"), e = this.isDualAxes();
|
|
1198
|
+
return c(n, _.BOTTOM) === null && c(n, _.TOP) !== null || c(n, _.TOP, "main") === !0 || e && c(n, _.BOTTOM, "correspondingDatasets") ? {
|
|
1199
|
+
primary: _.TOP,
|
|
1200
|
+
secondary: _.BOTTOM
|
|
1201
|
+
} : { primary: _.BOTTOM, secondary: _.TOP };
|
|
1202
|
+
}
|
|
1203
|
+
findDomainAndRangeAxesPositions(t, n) {
|
|
1204
|
+
const e = this.model.getOptions(), s = c(e, "axes", t.primary), o = c(e, "axes", n.primary), a = s.scaleType || m.LINEAR, r = o.scaleType || m.LINEAR, h = {
|
|
1205
|
+
primaryDomainAxisPosition: null,
|
|
1206
|
+
secondaryDomainAxisPosition: null,
|
|
1207
|
+
primaryRangeAxisPosition: null,
|
|
1208
|
+
secondaryRangeAxisPosition: null
|
|
1209
|
+
};
|
|
1210
|
+
return h.primaryDomainAxisPosition = n.primary, h.primaryRangeAxisPosition = t.primary, h.secondaryDomainAxisPosition = n.secondary, h.secondaryRangeAxisPosition = t.secondary, (!(r === m.LABELS || r === m.TIME) && a === m.LABELS || a === m.TIME) && (h.primaryDomainAxisPosition = t.primary, h.primaryRangeAxisPosition = n.primary, h.secondaryDomainAxisPosition = t.secondary, h.secondaryRangeAxisPosition = n.secondary), h;
|
|
1211
|
+
}
|
|
1212
|
+
getScaleDomain(t) {
|
|
1213
|
+
const n = this.model.getOptions(), e = c(n, "axes", t), s = c(n, "bounds"), { includeZero: o } = e, a = c(e, "scaleType") || m.LINEAR;
|
|
1214
|
+
if (this.model.isDataEmpty())
|
|
1215
|
+
return [];
|
|
1216
|
+
if (e.binned) {
|
|
1217
|
+
const { bins: u } = this.model.getBinConfigurations();
|
|
1218
|
+
return [0, jt(u, (g) => g.length)];
|
|
1219
|
+
} else if (e.limitDomainToBins) {
|
|
1220
|
+
const { bins: u } = this.model.getBinConfigurations(), g = this.model.getStackKeys({ bins: u });
|
|
1221
|
+
return [g[0].split(":")[0], g[g.length - 1].split(":")[1]];
|
|
1222
|
+
}
|
|
1223
|
+
const r = this.model.getDisplayData(), { extendLinearDomainBy: h, mapsTo: l, percentage: f, thresholds: v } = e, { reference: p, compareTo: T } = Q.ratio;
|
|
1224
|
+
if (e.domain)
|
|
1225
|
+
return a === m.LABELS ? e.domain : (a === m.TIME && (e.domain = e.domain.map(
|
|
1226
|
+
(u) => u.getTime === void 0 ? new Date(u) : u
|
|
1227
|
+
)), this.extendsDomain(t, e.domain));
|
|
1228
|
+
if (f)
|
|
1229
|
+
return [0, 100];
|
|
1230
|
+
if (e && a === m.LABELS)
|
|
1231
|
+
return Wt(r.map((u) => u[l]));
|
|
1232
|
+
let y, d;
|
|
1233
|
+
const D = this.model.getDataGroupNames();
|
|
1234
|
+
if (a === m.LABELS_RATIO)
|
|
1235
|
+
return r.map((u) => `${u[p]}/${u[T]}`);
|
|
1236
|
+
if (a === m.TIME)
|
|
1237
|
+
d = r.map((u) => +new Date(u[l]));
|
|
1238
|
+
else if (s && n.axes)
|
|
1239
|
+
d = [], r.forEach((u) => {
|
|
1240
|
+
d.push(u[l]), u[s.upperBoundMapsTo] && d.push(u[s.upperBoundMapsTo]), u[s.lowerBoundMapsTo] && d.push(u[s.lowerBoundMapsTo]);
|
|
1241
|
+
});
|
|
1242
|
+
else if (e.stacked === !0 && D && t === this.getRangeAxisPosition()) {
|
|
1243
|
+
const { groupMapsTo: u } = n.data, g = this.model.getDataValuesGroupedByKeys({
|
|
1244
|
+
groups: D
|
|
1245
|
+
}), kt = r.filter(
|
|
1246
|
+
(M) => !D.includes(M[u])
|
|
1247
|
+
), U = [];
|
|
1248
|
+
g.forEach((M) => {
|
|
1249
|
+
const { ...Rt } = M;
|
|
1250
|
+
let K = 0, q = 0;
|
|
1251
|
+
Object.values(di(Rt, "sharedStackKey")).forEach((S) => {
|
|
1252
|
+
isNaN(S) || (S < 0 ? q += S : K += S);
|
|
1253
|
+
}), U.push([q, K]);
|
|
1254
|
+
}), d = [
|
|
1255
|
+
...xt(U),
|
|
1256
|
+
...kt.map((M) => M[l])
|
|
1257
|
+
];
|
|
1258
|
+
} else
|
|
1259
|
+
d = [], r.forEach((u) => {
|
|
1260
|
+
const g = u[l];
|
|
1261
|
+
Array.isArray(g) && g.length === 2 ? (d.push(g[0]), d.push(g[1])) : (h && d.push(Math.max(u[l], u[h])), d.push(g));
|
|
1262
|
+
});
|
|
1263
|
+
return a !== m.TIME && a !== m.LOG && o && d.push(0), v && v.length > 0 && v.forEach((u) => {
|
|
1264
|
+
const g = c(u, "value");
|
|
1265
|
+
g !== null && d.push(g);
|
|
1266
|
+
}), y = pt(d), y = this.extendsDomain(t, y), y;
|
|
1267
|
+
}
|
|
1268
|
+
createScale(t) {
|
|
1269
|
+
const n = this.model.getOptions(), e = c(n, "axes", t);
|
|
1270
|
+
if (!e)
|
|
1271
|
+
return null;
|
|
1272
|
+
const s = c(e, "scaleType") || m.LINEAR;
|
|
1273
|
+
this.scaleTypes[t] = s;
|
|
1274
|
+
let o;
|
|
1275
|
+
return s === m.TIME ? o = ei() : s === m.LOG ? o = gt().base(e.base || 10) : s === m.LABELS || s === m.LABELS_RATIO ? o = si() : o = Jt(), o.domain(this.getScaleDomain(t)), o;
|
|
1276
|
+
}
|
|
1277
|
+
getDomainLowerBound(t) {
|
|
1278
|
+
let n, e = 0;
|
|
1279
|
+
return this.getOrientation() === N.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;
|
|
1280
|
+
}
|
|
1281
|
+
getHighestDomainThreshold() {
|
|
1282
|
+
const t = c(this.model.getOptions(), "axes"), n = this.getDomainAxisPosition(), { thresholds: e } = t[n];
|
|
1283
|
+
if (!Array.isArray(e) || Array.isArray(e) && !e.length)
|
|
1284
|
+
return null;
|
|
1285
|
+
const s = this.getDomainScale(), o = e.sort((r, h) => h.value - r.value)[0];
|
|
1286
|
+
return this.getScaleTypeByPosition(n) === m.TIME && (typeof o.value == "string" || o.value.getTime === void 0) && (o.value = new Date(o.value)), {
|
|
1287
|
+
threshold: o,
|
|
1288
|
+
scaleValue: s(o.value)
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
getHighestRangeThreshold() {
|
|
1292
|
+
const t = c(this.model.getOptions(), "axes"), n = this.getRangeAxisPosition(), { thresholds: e } = t[n];
|
|
1293
|
+
if (!Array.isArray(e) || Array.isArray(e) && !e.length)
|
|
1294
|
+
return null;
|
|
1295
|
+
const s = this.getRangeScale(), o = e.sort((a, r) => r.value - a.value)[0];
|
|
1296
|
+
return {
|
|
1297
|
+
threshold: o,
|
|
1298
|
+
scaleValue: s(o.value)
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
function Wi(i, t) {
|
|
1303
|
+
const n = new Date(i[0]), e = new Date(i[1]);
|
|
1304
|
+
return Fi(e, n) > 1 ? [zi(n, t), Pt(e, t)] : Gi(e, n) > 1 ? [$i(n, t), H(e, t)] : Ui(e, n) > 1 ? [Ki(n, t), Et(e, t)] : qi(e, n) > 1 ? [ji(n, t), wt(e, t)] : ct(e, n) > 30 ? [
|
|
1305
|
+
lt(n, t * 30),
|
|
1306
|
+
I(e, t * 30)
|
|
1307
|
+
] : ct(e, n) > 1 ? [lt(n, t), I(e, t)] : _t(e, n) > 15 ? [
|
|
1308
|
+
ut(n, t * 15),
|
|
1309
|
+
Z(e, t * 15)
|
|
1310
|
+
] : _t(e, n) > 1 ? [ut(n, t), Z(e, t)] : [n, e];
|
|
1311
|
+
}
|
|
1312
|
+
function Ji([i, t], n, e) {
|
|
1313
|
+
const o = (t - i) * n, a = t <= 0 && t + o > 0 ? 0 : t + o;
|
|
1314
|
+
let r = i >= 0 && i - o < 0 ? 0 : i - o;
|
|
1315
|
+
if (e === m.LOG && r <= 0) {
|
|
1316
|
+
if (i <= 0)
|
|
1317
|
+
throw Error("Data must have values greater than 0 if log scale type is used.");
|
|
1318
|
+
r = i;
|
|
1319
|
+
}
|
|
1320
|
+
return [r, a];
|
|
1321
|
+
}
|
|
1322
|
+
class hn extends A {
|
|
1323
|
+
constructor() {
|
|
1324
|
+
super(...arguments), this.curveTypes = {
|
|
1325
|
+
curveLinear: oi,
|
|
1326
|
+
curveLinearClosed: ai,
|
|
1327
|
+
curveBasis: Di,
|
|
1328
|
+
curveBasisClosed: Ai,
|
|
1329
|
+
curveBasisOpen: Oi,
|
|
1330
|
+
curveBundle: Mi,
|
|
1331
|
+
curveCardinal: bi,
|
|
1332
|
+
curveCardinalClosed: Si,
|
|
1333
|
+
curveCardinalOpen: Pi,
|
|
1334
|
+
curveCatmullRom: Ei,
|
|
1335
|
+
curveCatmullRomClosed: wi,
|
|
1336
|
+
curveCatmullRomOpen: ki,
|
|
1337
|
+
curveMonotoneX: Ri,
|
|
1338
|
+
curveMonotoneY: Bi,
|
|
1339
|
+
curveNatural: Li,
|
|
1340
|
+
curveStep: Ni,
|
|
1341
|
+
curveStepAfter: Ii,
|
|
1342
|
+
curveStepBefore: Ci
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
getD3Curve() {
|
|
1346
|
+
let t = "curveLinear";
|
|
1347
|
+
const n = this.model.getOptions().curve;
|
|
1348
|
+
if (n && (typeof n == "string" ? t = n : t = n.name), this.curveTypes[t]) {
|
|
1349
|
+
let e = this.curveTypes[t];
|
|
1350
|
+
return n && Object.keys(n).forEach((s) => {
|
|
1351
|
+
e[s] && (e = e[s](n[s]));
|
|
1352
|
+
}), e;
|
|
1353
|
+
}
|
|
1354
|
+
return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`), this.curveTypes.curveLinear;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
class cn extends A {
|
|
1358
|
+
isZoomBarEnabled() {
|
|
1359
|
+
if (!this.services.cartesianScales || !c(this.model.getOptions(), "zoomBar", "top", "enabled"))
|
|
1360
|
+
return !1;
|
|
1361
|
+
this.services.cartesianScales.findDomainAndRangeAxes();
|
|
1362
|
+
const t = this.services.cartesianScales.getMainXAxisPosition(), n = c(
|
|
1363
|
+
this.model.getOptions(),
|
|
1364
|
+
"axes",
|
|
1365
|
+
t,
|
|
1366
|
+
"scaleType"
|
|
1367
|
+
);
|
|
1368
|
+
return t === _.BOTTOM && n === m.TIME;
|
|
1369
|
+
}
|
|
1370
|
+
// get display data for zoom bar
|
|
1371
|
+
// basically it's sum of value grouped by time
|
|
1372
|
+
getZoomBarData() {
|
|
1373
|
+
const t = this.model.getZoomBarData();
|
|
1374
|
+
return t && t.length > 1 ? t : this.model.getDisplayData();
|
|
1375
|
+
}
|
|
1376
|
+
getDefaultZoomBarDomain(t) {
|
|
1377
|
+
if (!this.services.zoom) throw new Error("Services zoom not defined");
|
|
1378
|
+
const n = t || this.services.zoom.getZoomBarData(), { cartesianScales: e } = this.services;
|
|
1379
|
+
if (!e) throw new Error("Services cartesianScales undefined");
|
|
1380
|
+
const s = e.getMainXAxisPosition(), o = e.getDomainIdentifier(), a = c(this.model.getOptions(), "axes", s, "domain");
|
|
1381
|
+
if (Array.isArray(a) && a.length === 2)
|
|
1382
|
+
return a;
|
|
1383
|
+
if (!s) throw new Error("Not defined: mainXAxisPosition");
|
|
1384
|
+
return e.extendsDomain(
|
|
1385
|
+
s,
|
|
1386
|
+
pt(n, (r) => r[o])
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
handleDomainChange(t, n = { dispatchEvent: !0 }) {
|
|
1390
|
+
var e;
|
|
1391
|
+
this.model.set({ zoomDomain: t }, { animate: !1 }), n.dispatchEvent && ((e = this.services.events) == null || e.dispatchEvent(E.ZoomDomain.CHANGE, {
|
|
1392
|
+
newDomain: t
|
|
1393
|
+
}));
|
|
1394
|
+
}
|
|
1395
|
+
getZoomRatio() {
|
|
1396
|
+
return c(this.model.getOptions(), "zoomBar", "zoomRatio");
|
|
1397
|
+
}
|
|
1398
|
+
// filter out data not inside zoom domain
|
|
1399
|
+
// to get better range value for axis label
|
|
1400
|
+
filterDataForRangeAxis(t, n) {
|
|
1401
|
+
var a;
|
|
1402
|
+
const e = this.model.get("zoomDomain"), s = Object.assign(
|
|
1403
|
+
{ stacked: !1 },
|
|
1404
|
+
// default configs
|
|
1405
|
+
n
|
|
1406
|
+
), o = c(this.model.getOptions(), "zoomBar", "updateRangeAxis");
|
|
1407
|
+
if (this.isZoomBarEnabled() && o && e) {
|
|
1408
|
+
const r = s.stacked ? "sharedStackKey" : (a = this.services.cartesianScales) == null ? void 0 : a.getDomainIdentifier(), h = t.filter(
|
|
1409
|
+
(l) => new Date(l[r]) >= e[0] && new Date(l[r]) <= e[1]
|
|
1410
|
+
);
|
|
1411
|
+
if (h.length > 0)
|
|
1412
|
+
return h;
|
|
1413
|
+
}
|
|
1414
|
+
return t;
|
|
1415
|
+
}
|
|
1416
|
+
zoomIn(t = this.getZoomRatio()) {
|
|
1417
|
+
var T;
|
|
1418
|
+
const n = this.model.get("zoomDomain"), e = Qt.handleWidth, s = (T = this.services.cartesianScales) == null ? void 0 : T.getMainXScale().copy();
|
|
1419
|
+
s.domain(this.getDefaultZoomBarDomain());
|
|
1420
|
+
const o = s(n[0]), a = s(n[1]);
|
|
1421
|
+
if (a - o < e + 1)
|
|
1422
|
+
return;
|
|
1423
|
+
const r = s.range(), h = a - o, l = Math.min((r[1] - r[0]) / 2 * (t / 2), h / 2);
|
|
1424
|
+
let f = o + l, v = a - l;
|
|
1425
|
+
f >= v && (f = o + h / 2 - e / 2, v = a - h / 2 + e / 2);
|
|
1426
|
+
const p = [s.invert(f), s.invert(v)];
|
|
1427
|
+
(n[0].valueOf() !== p[0].valueOf() || n[1].valueOf() !== p[1].valueOf()) && this.handleDomainChange(p);
|
|
1428
|
+
}
|
|
1429
|
+
zoomOut(t = this.getZoomRatio()) {
|
|
1430
|
+
const n = this.model.get("zoomDomain");
|
|
1431
|
+
if (!this.services.cartesianScales) throw new Error("Services cartesianScales undefined");
|
|
1432
|
+
const e = this.services.cartesianScales.getMainXScale().copy();
|
|
1433
|
+
e.domain(this.getDefaultZoomBarDomain());
|
|
1434
|
+
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)];
|
|
1435
|
+
(n[0].valueOf() !== f[0].valueOf() || n[1].valueOf() !== f[1].valueOf()) && this.handleDomainChange(f);
|
|
1436
|
+
}
|
|
1437
|
+
resetZoomDomain() {
|
|
1438
|
+
const t = this.model.get("zoomDomain"), n = this.getDefaultZoomBarDomain();
|
|
1439
|
+
(t[0].valueOf() !== n[0].valueOf() || t[1].valueOf() !== n[1].valueOf()) && this.handleDomainChange(n);
|
|
1440
|
+
}
|
|
1441
|
+
// check if current zoom domain is already the min zoom domain
|
|
1442
|
+
// when toolbar is rendered, we don't render chart yet
|
|
1443
|
+
// don't depend on scale range
|
|
1444
|
+
isMinZoomDomain() {
|
|
1445
|
+
const t = this.model.get("zoomDomain"), n = this.getDefaultZoomBarDomain();
|
|
1446
|
+
if (!t || !n)
|
|
1447
|
+
return !1;
|
|
1448
|
+
const e = t[1].valueOf() - t[0].valueOf(), s = n[1].valueOf() - n[0].valueOf(), o = c(this.model.getOptions(), "zoomBar", "minZoomRatio");
|
|
1449
|
+
return e / s < o;
|
|
1450
|
+
}
|
|
1451
|
+
// check if current zoom domain is already the max zoom domain
|
|
1452
|
+
isMaxZoomDomain() {
|
|
1453
|
+
const t = this.model.get("zoomDomain"), n = this.getDefaultZoomBarDomain();
|
|
1454
|
+
return !!(t && n && t[0].valueOf() === n[0].valueOf() && t[1].valueOf() === n[1].valueOf());
|
|
1455
|
+
}
|
|
1456
|
+
isEmptyState() {
|
|
1457
|
+
return this.getZoomBarData().length === 0;
|
|
1458
|
+
}
|
|
1459
|
+
isZoomBarLoading(t) {
|
|
1460
|
+
return c(this.model.getOptions(), "zoomBar", t, "loading");
|
|
1461
|
+
}
|
|
1462
|
+
isZoomBarLocked(t) {
|
|
1463
|
+
return c(this.model.getOptions(), "zoomBar", t, "locked");
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
export {
|
|
1467
|
+
en as C,
|
|
1468
|
+
sn as E,
|
|
1469
|
+
on as F,
|
|
1470
|
+
an as T,
|
|
1471
|
+
cn as Z,
|
|
1472
|
+
rn as a,
|
|
1473
|
+
hi as b,
|
|
1474
|
+
hn as c,
|
|
1475
|
+
xt as f
|
|
1476
|
+
};
|
|
1477
|
+
//# sourceMappingURL=index-DnyOi0rJ.mjs.map
|