@carbon/charts 1.13.34 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/{_baseEach-fBb6x0bv.mjs → _baseEach-1x0l4fXu.mjs} +2 -2
- package/dist/{_baseEach-fBb6x0bv.mjs.map → _baseEach-1x0l4fXu.mjs.map} +1 -1
- package/dist/{angle-utils-uYSg57eT.mjs → angle-utils-Ss5LscUK.mjs} +2 -2
- package/dist/{angle-utils-uYSg57eT.mjs.map → angle-utils-Ss5LscUK.mjs.map} +1 -1
- package/dist/{choropleth-QJfTyxqo.mjs → choropleth-bo0SVD2j.mjs} +1843 -1818
- package/dist/choropleth-bo0SVD2j.mjs.map +1 -0
- package/dist/{color-scale-utils-k_4IkKRj.mjs → color-scale-utils-eeC25Jjh.mjs} +1263 -1078
- package/dist/color-scale-utils-eeC25Jjh.mjs.map +1 -0
- package/dist/components/index.mjs +1 -1
- package/dist/demo/charts/bar.d.ts +75 -0
- package/dist/demo/index.mjs +1394 -1294
- package/dist/demo/index.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -8
- package/dist/interfaces/charts.d.ts +5 -1
- package/dist/interfaces/components.d.ts +65 -0
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/model/index.mjs +1 -1
- package/dist/services/index.mjs +3 -3
- package/dist/services/time-series.d.ts +2 -1
- package/dist/umd/bundle.umd.js +25 -24
- package/dist/umd/bundle.umd.js.map +1 -1
- package/dist/{wordcloud-a6lxyv6s.mjs → wordcloud-UWOp6fZX.mjs} +381 -350
- package/dist/wordcloud-UWOp6fZX.mjs.map +1 -0
- package/dist/{zoom-PYRfEo-q.mjs → zoom-LcHlmSqj.mjs} +135 -135
- package/dist/zoom-LcHlmSqj.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/choropleth-QJfTyxqo.mjs.map +0 -1
- package/dist/color-scale-utils-k_4IkKRj.mjs.map +0 -1
- package/dist/wordcloud-a6lxyv6s.mjs.map +0 -1
- package/dist/zoom-PYRfEo-q.mjs.map +0 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { S as f, _ as B, d as
|
|
4
|
-
import { b as
|
|
5
|
-
function
|
|
6
|
-
for (var a = -1,
|
|
7
|
-
var
|
|
8
|
-
t(s,
|
|
1
|
+
import { o as w, p as z, q as j, m as u, s as O, t as G, u as U, v as M, f as N, w as F, x as _, y as V, z as b, g as L, A as C } from "./color-scale-utils-eeC25Jjh.mjs";
|
|
2
|
+
import { bin as K, stack as S, stackOffsetDiverging as H, scaleOrdinal as R, quantile as E, ascending as Z, min as P, max as k, extent as Q, scaleLinear as W, scaleQuantize as X } from "d3";
|
|
3
|
+
import { S as f, _ as B, d as $, e as A, s as Y } from "./enums-lWSDG4ik.mjs";
|
|
4
|
+
import { b as J } from "./_baseEach-1x0l4fXu.mjs";
|
|
5
|
+
function tt(d, t, e, s) {
|
|
6
|
+
for (var a = -1, o = d == null ? 0 : d.length; ++a < o; ) {
|
|
7
|
+
var r = d[a];
|
|
8
|
+
t(s, r, e(r), d);
|
|
9
9
|
}
|
|
10
10
|
return s;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
t(s, a, e(a),
|
|
12
|
+
function et(d, t, e, s) {
|
|
13
|
+
return J(d, function(a, o, r) {
|
|
14
|
+
t(s, a, e(a), r);
|
|
15
15
|
}), s;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function st(d, t) {
|
|
18
18
|
return function(e, s) {
|
|
19
|
-
var a =
|
|
20
|
-
return a(e,
|
|
19
|
+
var a = w(e) ? tt : et, o = t ? t() : {};
|
|
20
|
+
return a(e, d, z(s), o);
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
for (var t = -1, e =
|
|
25
|
-
var a =
|
|
23
|
+
function at(d) {
|
|
24
|
+
for (var t = -1, e = d == null ? 0 : d.length, s = {}; ++t < e; ) {
|
|
25
|
+
var a = d[t];
|
|
26
26
|
s[a[0]] = a[1];
|
|
27
27
|
}
|
|
28
28
|
return s;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
rt.call(
|
|
30
|
+
var ot = Object.prototype, rt = ot.hasOwnProperty, nt = st(function(d, t, e) {
|
|
31
|
+
rt.call(d, e) ? d[e].push(t) : j(d, e, [t]);
|
|
32
32
|
});
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
const t =
|
|
33
|
+
const it = nt;
|
|
34
|
+
function lt(d) {
|
|
35
|
+
const t = d.trim();
|
|
36
36
|
return ["=", "+", "-", "@", " ", "\r"].includes(t.charAt(0)) ? ` ${t}` : /[,\"\n]/.test(t) ? `"${t}"` : t;
|
|
37
37
|
}
|
|
38
38
|
class D {
|
|
@@ -42,11 +42,22 @@ class D {
|
|
|
42
42
|
}, this.colorScale = {}, this.colorClassNames = {}, this.services = t;
|
|
43
43
|
}
|
|
44
44
|
formatTable({ headers: t, cells: e }) {
|
|
45
|
-
const s = this.getOptions(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const s = this.getOptions(), {
|
|
46
|
+
code: a,
|
|
47
|
+
date: o,
|
|
48
|
+
number: r
|
|
49
|
+
} = u(s, "locale"), i = u(s, "tabularRepModal", "tableHeadingFormatter"), n = u(s, "tabularRepModal", "tableCellFormatter"), { cartesianScales: c } = this.services, l = c == null ? void 0 : c.getDomainAxisScaleType();
|
|
50
|
+
let p;
|
|
51
|
+
return l === f.TIME && (p = (g) => o(g, a, { month: "short", day: "numeric", year: "numeric" })), [
|
|
52
|
+
typeof i == "function" ? i(t) : t,
|
|
53
|
+
...typeof n == "function" ? n(e) : e.map((g) => {
|
|
54
|
+
p && (g[1] = p(g[1]));
|
|
55
|
+
for (let m in g) {
|
|
56
|
+
let y = g[m];
|
|
57
|
+
typeof y == "number" && (g[m] = r(y, a));
|
|
58
|
+
}
|
|
59
|
+
return g;
|
|
60
|
+
})
|
|
50
61
|
];
|
|
51
62
|
}
|
|
52
63
|
getAllDataFromDomain(t) {
|
|
@@ -54,24 +65,24 @@ class D {
|
|
|
54
65
|
return null;
|
|
55
66
|
const e = this.getOptions();
|
|
56
67
|
let s = this.getData();
|
|
57
|
-
const a = this.getDataGroups(), { groupMapsTo:
|
|
58
|
-
return t && (s = s.filter((i) => t.includes(i[
|
|
59
|
-
const
|
|
68
|
+
const a = this.getDataGroups(), { groupMapsTo: o } = u(e, "data"), r = u(e, "axes");
|
|
69
|
+
return t && (s = s.filter((i) => t.includes(i[o]))), r && Object.keys(r).forEach((i) => {
|
|
70
|
+
const n = r[i].mapsTo, c = r[i].scaleType;
|
|
60
71
|
if ((c === f.LINEAR || c === f.LOG) && (s = s.map((l) => ({
|
|
61
72
|
...l,
|
|
62
|
-
[
|
|
63
|
-
}))),
|
|
73
|
+
[n]: l[n] === null ? l[n] : Number(l[n])
|
|
74
|
+
}))), n && r[i].domain)
|
|
64
75
|
if (c === f.LABELS)
|
|
65
76
|
s = s.filter(
|
|
66
|
-
(l) =>
|
|
77
|
+
(l) => r[i].domain.includes(l[n])
|
|
67
78
|
);
|
|
68
79
|
else {
|
|
69
|
-
const [l, p] =
|
|
80
|
+
const [l, p] = r[i].domain;
|
|
70
81
|
s = s.filter(
|
|
71
|
-
(
|
|
82
|
+
(h) => !(n in h) || h[n] >= l && h[n] <= p
|
|
72
83
|
);
|
|
73
84
|
}
|
|
74
|
-
}), s.filter((i) => a.find((
|
|
85
|
+
}), s.filter((i) => a.find((n) => n.name === i[o]));
|
|
75
86
|
}
|
|
76
87
|
/**
|
|
77
88
|
* Charts that have group configs passed into them, only want to retrieve the display data relevant to that chart
|
|
@@ -81,8 +92,8 @@ class D {
|
|
|
81
92
|
if (!this.get("data"))
|
|
82
93
|
return null;
|
|
83
94
|
const { ACTIVE: e } = O.items.status, s = this.getDataGroups(t), { groupMapsTo: a } = this.getOptions().data;
|
|
84
|
-
return this.getAllDataFromDomain(t).filter((
|
|
85
|
-
(i) => i.name ===
|
|
95
|
+
return this.getAllDataFromDomain(t).filter((r) => s.find(
|
|
96
|
+
(i) => i.name === r[a] && i.status === e
|
|
86
97
|
));
|
|
87
98
|
}
|
|
88
99
|
getData() {
|
|
@@ -96,7 +107,7 @@ class D {
|
|
|
96
107
|
* @param newData The new raw data to be set
|
|
97
108
|
*/
|
|
98
109
|
setData(t) {
|
|
99
|
-
const e = this.sanitize(
|
|
110
|
+
const e = this.sanitize(G(t)), s = this.generateDataGroups(e);
|
|
100
111
|
return this.set({
|
|
101
112
|
data: e,
|
|
102
113
|
dataGroups: s
|
|
@@ -116,24 +127,24 @@ class D {
|
|
|
116
127
|
return this.getActiveDataGroups(t).map((s) => s.name);
|
|
117
128
|
}
|
|
118
129
|
aggregateBinDataByGroup(t) {
|
|
119
|
-
return
|
|
130
|
+
return it(t, "group");
|
|
120
131
|
}
|
|
121
132
|
getBinConfigurations() {
|
|
122
|
-
const t = this.getDisplayData(), e = this.getOptions(), s = this.services.cartesianScales.getMainXAxisPosition(), a = this.services.cartesianScales.getDomainIdentifier(),
|
|
123
|
-
if (
|
|
133
|
+
const t = this.getDisplayData(), e = this.getOptions(), s = this.services.cartesianScales.getMainXAxisPosition(), a = this.services.cartesianScales.getDomainIdentifier(), o = e.axes[s], { groupMapsTo: r } = e.data, { bins: i = U.defaultBins } = o, n = Array.isArray(i), c = K().value((g) => g[a]).thresholds(i)(t);
|
|
134
|
+
if (n)
|
|
124
135
|
c[c.length - 1].x1 = i[i.length - 1];
|
|
125
136
|
else {
|
|
126
137
|
const g = c[0].x1 - c[0].x0;
|
|
127
138
|
c[c.length - 1].x1 = +c[c.length - 1].x0 + g;
|
|
128
139
|
}
|
|
129
|
-
const l =
|
|
140
|
+
const l = n ? [i[0], i[i.length - 1]] : [c[0].x0, c[c.length - 1].x1], p = Array.from(new Set(t.map((g) => g[r]))), h = [];
|
|
130
141
|
return c.forEach((g) => {
|
|
131
|
-
const m = `${g.x0}-${g.x1}`,
|
|
142
|
+
const m = `${g.x0}-${g.x1}`, y = this.aggregateBinDataByGroup(g);
|
|
132
143
|
p.forEach((x) => {
|
|
133
|
-
|
|
144
|
+
h.push({
|
|
134
145
|
group: x,
|
|
135
146
|
key: m,
|
|
136
|
-
value:
|
|
147
|
+
value: y[x] || 0,
|
|
137
148
|
bin: g.x0
|
|
138
149
|
});
|
|
139
150
|
});
|
|
@@ -143,79 +154,79 @@ class D {
|
|
|
143
154
|
};
|
|
144
155
|
}
|
|
145
156
|
getBinnedStackedData() {
|
|
146
|
-
const t = this.getOptions(), { groupMapsTo: e } = t.data, s = this.getActiveDataGroupNames(), { bins: a } = this.getBinConfigurations(),
|
|
157
|
+
const t = this.getOptions(), { groupMapsTo: e } = t.data, s = this.getActiveDataGroupNames(), { bins: a } = this.getBinConfigurations(), o = this.getDataValuesGroupedByKeys({
|
|
147
158
|
bins: a
|
|
148
159
|
});
|
|
149
|
-
return
|
|
150
|
-
const c =
|
|
160
|
+
return S().keys(s)(o).map((r, i) => Object.keys(r).filter((n) => !isNaN(n)).map((n) => {
|
|
161
|
+
const c = r[n];
|
|
151
162
|
return c[e] = s[i], c;
|
|
152
163
|
}));
|
|
153
164
|
}
|
|
154
165
|
getGroupedData(t) {
|
|
155
166
|
const e = this.getDisplayData(t), s = {}, { groupMapsTo: a } = this.getOptions().data;
|
|
156
|
-
return e.map((
|
|
157
|
-
const
|
|
158
|
-
s[
|
|
159
|
-
}), Object.keys(s).map((
|
|
160
|
-
name:
|
|
161
|
-
data: s[
|
|
167
|
+
return e.map((o) => {
|
|
168
|
+
const r = o[a];
|
|
169
|
+
s[r] !== null && s[r] !== void 0 ? s[r].push(o) : s[r] = [o];
|
|
170
|
+
}), Object.keys(s).map((o) => ({
|
|
171
|
+
name: o,
|
|
172
|
+
data: s[o]
|
|
162
173
|
}));
|
|
163
174
|
}
|
|
164
175
|
getStackKeys({ bins: t = null, groups: e = null } = { bins: null, groups: null }) {
|
|
165
176
|
const s = this.getOptions(), a = this.getDisplayData(e);
|
|
166
|
-
let
|
|
167
|
-
t ?
|
|
168
|
-
a.map((
|
|
169
|
-
const c = this.services.cartesianScales.getDomainIdentifier(
|
|
170
|
-
return
|
|
177
|
+
let o;
|
|
178
|
+
t ? o = t.map((n) => `${n.x0}:${n.x1}`) : o = M(
|
|
179
|
+
a.map((n) => {
|
|
180
|
+
const c = this.services.cartesianScales.getDomainIdentifier(n);
|
|
181
|
+
return n[c] instanceof Date ? N(n[c]) : n[c] && typeof n[c].toString == "function" ? n[c].toString() : n[c];
|
|
171
182
|
})
|
|
172
183
|
);
|
|
173
|
-
const
|
|
174
|
-
return i === f.TIME ?
|
|
175
|
-
const l = new Date(
|
|
184
|
+
const r = this.services.cartesianScales.domainAxisPosition, i = s.axes[r].scaleType;
|
|
185
|
+
return i === f.TIME ? o.sort((n, c) => {
|
|
186
|
+
const l = new Date(n), p = new Date(c);
|
|
176
187
|
return l - p;
|
|
177
|
-
}) : (i === f.LOG || i === f.LINEAR) &&
|
|
188
|
+
}) : (i === f.LOG || i === f.LINEAR) && o.sort((n, c) => n - c), o;
|
|
178
189
|
}
|
|
179
190
|
getDataValuesGroupedByKeys({ bins: t = null, groups: e = null }) {
|
|
180
|
-
const s = this.getOptions(), { groupMapsTo: a } = s.data,
|
|
181
|
-
return t ? i.map((
|
|
182
|
-
const [c, l] =
|
|
183
|
-
return
|
|
184
|
-
p[g] =
|
|
191
|
+
const s = this.getOptions(), { groupMapsTo: a } = s.data, o = this.getDisplayData(e), r = this.getDataGroupNames(), i = this.getStackKeys({ bins: t, groups: e });
|
|
192
|
+
return t ? i.map((n) => {
|
|
193
|
+
const [c, l] = n.split(":"), p = { x0: c, x1: l }, h = t.find((g) => g.x0.toString() === c.toString());
|
|
194
|
+
return r.forEach((g) => {
|
|
195
|
+
p[g] = h.filter(
|
|
185
196
|
(m) => m[a] === g
|
|
186
197
|
).length;
|
|
187
198
|
}), p;
|
|
188
|
-
}) : i.map((
|
|
189
|
-
const c = { sharedStackKey:
|
|
190
|
-
return
|
|
191
|
-
const p =
|
|
199
|
+
}) : i.map((n) => {
|
|
200
|
+
const c = { sharedStackKey: n };
|
|
201
|
+
return r.forEach((l) => {
|
|
202
|
+
const p = o.find((g) => {
|
|
192
203
|
const m = this.services.cartesianScales.getDomainIdentifier(g);
|
|
193
|
-
return g[a] === l && Object.prototype.hasOwnProperty.call(g, m) && (g[m] instanceof Date ? N(g[m]) ===
|
|
194
|
-
}),
|
|
195
|
-
c[l] = p ? p[
|
|
204
|
+
return g[a] === l && Object.prototype.hasOwnProperty.call(g, m) && (g[m] instanceof Date ? N(g[m]) === n : g[m].toString() === n);
|
|
205
|
+
}), h = this.services.cartesianScales.getRangeIdentifier(c);
|
|
206
|
+
c[l] = p ? p[h] : null;
|
|
196
207
|
}), c;
|
|
197
208
|
});
|
|
198
209
|
}
|
|
199
210
|
getStackedData({ percentage: t = !1, groups: e = null, divergent: s = !1 }) {
|
|
200
|
-
const a = this.getOptions(), { groupMapsTo:
|
|
211
|
+
const a = this.getOptions(), { groupMapsTo: o } = a.data, r = this.getActiveDataGroupNames(e), i = this.getDataValuesGroupedByKeys({
|
|
201
212
|
groups: e
|
|
202
213
|
});
|
|
203
214
|
if (t) {
|
|
204
|
-
const c =
|
|
215
|
+
const c = at(i.map((l) => [l.sharedStackKey, 0]));
|
|
205
216
|
i.forEach((l) => {
|
|
206
|
-
|
|
217
|
+
r.forEach((p) => {
|
|
207
218
|
c[l.sharedStackKey] += l[p];
|
|
208
219
|
});
|
|
209
220
|
}), i.forEach((l) => {
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
c[l.sharedStackKey] ? l[p] = l[p] /
|
|
221
|
+
r.forEach((p) => {
|
|
222
|
+
const h = c[l.sharedStackKey];
|
|
223
|
+
c[l.sharedStackKey] ? l[p] = l[p] / h * 100 : l[p] = 0;
|
|
213
224
|
});
|
|
214
225
|
});
|
|
215
226
|
}
|
|
216
|
-
return (s ?
|
|
217
|
-
const
|
|
218
|
-
return
|
|
227
|
+
return (s ? S().offset(H) : S()).keys(r)(i).map((c, l) => Object.keys(c).filter((p) => !isNaN(p)).map((p) => {
|
|
228
|
+
const h = c[p];
|
|
229
|
+
return h[o] = r[l], h;
|
|
219
230
|
}));
|
|
220
231
|
}
|
|
221
232
|
/**
|
|
@@ -242,7 +253,7 @@ class D {
|
|
|
242
253
|
*/
|
|
243
254
|
setOptions(t) {
|
|
244
255
|
const e = this.getOptions();
|
|
245
|
-
|
|
256
|
+
F(e, t), this.set({
|
|
246
257
|
options: _(e, t)
|
|
247
258
|
});
|
|
248
259
|
}
|
|
@@ -258,9 +269,9 @@ class D {
|
|
|
258
269
|
* Data labels
|
|
259
270
|
*/
|
|
260
271
|
toggleDataLabel(t) {
|
|
261
|
-
const { ACTIVE: e, DISABLED: s } = O.items.status, a = this.getDataGroups(),
|
|
262
|
-
if (
|
|
263
|
-
if (
|
|
272
|
+
const { ACTIVE: e, DISABLED: s } = O.items.status, a = this.getDataGroups(), o = a.some((l) => l.status === s), r = a.filter((l) => l.status === e);
|
|
273
|
+
if (o)
|
|
274
|
+
if (r.length === 1 && r[0].name === t)
|
|
264
275
|
a.forEach((l, p) => {
|
|
265
276
|
a[p].status = e;
|
|
266
277
|
});
|
|
@@ -272,8 +283,8 @@ class D {
|
|
|
272
283
|
a.forEach((l, p) => {
|
|
273
284
|
a[p].status = l.name === t ? e : s;
|
|
274
285
|
});
|
|
275
|
-
const i = a.filter((l) => l.status === e),
|
|
276
|
-
a.some((l) => l.status === s) ?
|
|
286
|
+
const i = a.filter((l) => l.status === e), n = this.getOptions();
|
|
287
|
+
a.some((l) => l.status === s) ? n.data.selectedGroups = i.map((l) => l.name) : n.data.selectedGroups = [], this.services.events.dispatchEvent(B.Legend.ITEMS_UPDATE, {
|
|
277
288
|
dataGroups: a
|
|
278
289
|
}), this.set({
|
|
279
290
|
dataGroups: a
|
|
@@ -287,16 +298,16 @@ class D {
|
|
|
287
298
|
* @param defaultFilled the default for this chart
|
|
288
299
|
*/
|
|
289
300
|
getIsFilled(t, e, s, a) {
|
|
290
|
-
const
|
|
291
|
-
return
|
|
301
|
+
const o = this.getOptions();
|
|
302
|
+
return o.getIsFilled ? o.getIsFilled(t, e, s, a) : a;
|
|
292
303
|
}
|
|
293
304
|
getFillColor(t, e, s) {
|
|
294
|
-
const a = this.getOptions(),
|
|
295
|
-
return a.getFillColor ? a.getFillColor(t, e, s,
|
|
305
|
+
const a = this.getOptions(), o = u(this.colorScale, t);
|
|
306
|
+
return a.getFillColor ? a.getFillColor(t, e, s, o) : o;
|
|
296
307
|
}
|
|
297
308
|
getStrokeColor(t, e, s) {
|
|
298
|
-
const a = this.getOptions(),
|
|
299
|
-
return a.getStrokeColor ? a.getStrokeColor(t, e, s,
|
|
309
|
+
const a = this.getOptions(), o = u(this.colorScale, t);
|
|
310
|
+
return a.getStrokeColor ? a.getStrokeColor(t, e, s, o) : o;
|
|
300
311
|
}
|
|
301
312
|
isUserProvidedColorScaleValid() {
|
|
302
313
|
const t = u(this.getOptions(), "color", "scale"), e = this.getDataGroups();
|
|
@@ -329,20 +340,20 @@ class D {
|
|
|
329
340
|
"We've updated the charting data format to be tabular by default. The current format you're using is deprecated and will be removed in v1.0, read more here https://charts.carbondesignsystem.com/?path=/story/docs-tutorials--tabular-data-format"
|
|
330
341
|
);
|
|
331
342
|
const e = [], { datasets: s, labels: a } = t;
|
|
332
|
-
return s.forEach((
|
|
333
|
-
|
|
334
|
-
let
|
|
335
|
-
const c = u(
|
|
343
|
+
return s.forEach((o) => {
|
|
344
|
+
o.data.forEach((r, i) => {
|
|
345
|
+
let n;
|
|
346
|
+
const c = u(o, "label");
|
|
336
347
|
if (c === null) {
|
|
337
348
|
const p = u(a, i);
|
|
338
|
-
p ?
|
|
349
|
+
p ? n = p : n = "Ungrouped";
|
|
339
350
|
} else
|
|
340
|
-
|
|
351
|
+
n = c;
|
|
341
352
|
const l = {
|
|
342
|
-
group:
|
|
353
|
+
group: n,
|
|
343
354
|
key: a[i]
|
|
344
355
|
};
|
|
345
|
-
isNaN(
|
|
356
|
+
isNaN(r) ? (l.value = r.value, l.date = r.date) : l.value = r, e.push(l);
|
|
346
357
|
});
|
|
347
358
|
}), e;
|
|
348
359
|
}
|
|
@@ -351,12 +362,12 @@ class D {
|
|
|
351
362
|
}
|
|
352
363
|
exportToCSV() {
|
|
353
364
|
const e = this.getTabularDataArray().map(
|
|
354
|
-
(
|
|
355
|
-
).map((
|
|
365
|
+
(r) => r.map((i) => `"${(i === "–" ? "–" : i).split(/[,;'"`]/).map((l) => lt(l)).join("")}"`)
|
|
366
|
+
).map((r) => r.join(",")).join(`
|
|
356
367
|
`), s = this.getOptions();
|
|
357
368
|
let a = "myChart";
|
|
358
|
-
const
|
|
359
|
-
typeof
|
|
369
|
+
const o = u(s, "fileDownload", "fileName");
|
|
370
|
+
typeof o == "function" ? a = o("csv") : typeof o == "string" && (a = o), this.services.files.downloadCSV(e, `${a}.csv`);
|
|
360
371
|
}
|
|
361
372
|
getTabularData(t) {
|
|
362
373
|
return Array.isArray(t) ? t : this.transformToTabularData(t);
|
|
@@ -373,14 +384,14 @@ class D {
|
|
|
373
384
|
}) : this.allDataGroups = this.getDataGroupNames();
|
|
374
385
|
}
|
|
375
386
|
generateDataGroups(t) {
|
|
376
|
-
const { groupMapsTo: e } = this.getOptions().data, { ACTIVE: s, DISABLED: a } = O.items.status,
|
|
377
|
-
|
|
378
|
-
(c) =>
|
|
379
|
-
) || (
|
|
380
|
-
const i = (
|
|
381
|
-
return
|
|
382
|
-
name:
|
|
383
|
-
status: i(
|
|
387
|
+
const { groupMapsTo: e } = this.getOptions().data, { ACTIVE: s, DISABLED: a } = O.items.status, o = this.getOptions(), r = M(t.map((n) => n[e]));
|
|
388
|
+
o.data.selectedGroups.length && (o.data.selectedGroups.every(
|
|
389
|
+
(c) => r.includes(c)
|
|
390
|
+
) || (o.data.selectedGroups = []));
|
|
391
|
+
const i = (n) => !o.data.selectedGroups.length || o.data.selectedGroups.includes(n) ? s : a;
|
|
392
|
+
return r.map((n) => ({
|
|
393
|
+
name: n,
|
|
394
|
+
status: i(n)
|
|
384
395
|
}));
|
|
385
396
|
}
|
|
386
397
|
/*
|
|
@@ -404,18 +415,18 @@ class D {
|
|
|
404
415
|
let e = u(t, "numberOfVariants");
|
|
405
416
|
(!e || e < this.allDataGroups.length) && (e = this.allDataGroups.length);
|
|
406
417
|
let s = u(t, "option");
|
|
407
|
-
const a =
|
|
408
|
-
s = s <= a[
|
|
418
|
+
const a = V.pairingOptions, o = e > 5 ? 14 : e, r = `${o}-color`;
|
|
419
|
+
s = s <= a[r] ? s : 1;
|
|
409
420
|
const i = this.allDataGroups.map(
|
|
410
|
-
(
|
|
421
|
+
(n, c) => `${o}-${s}-${c % 14 + 1}`
|
|
411
422
|
);
|
|
412
|
-
this.colorClassNames =
|
|
423
|
+
this.colorClassNames = R().range(i).domain(this.allDataGroups);
|
|
413
424
|
}
|
|
414
425
|
}
|
|
415
426
|
class T extends D {
|
|
416
427
|
// can't be protected as it's used by two-dimensional-axes.ts
|
|
417
428
|
constructor(t) {
|
|
418
|
-
super(t), this.axisFlavor =
|
|
429
|
+
super(t), this.axisFlavor = $.DEFAULT;
|
|
419
430
|
}
|
|
420
431
|
// get the scales information
|
|
421
432
|
// needed for getTabularArray()
|
|
@@ -427,43 +438,43 @@ class T extends D {
|
|
|
427
438
|
secondaryRange: null
|
|
428
439
|
};
|
|
429
440
|
return s && (a.secondaryDomain = t.secondaryDomainAxisPosition, a.secondaryRange = t.secondaryRangeAxisPosition), Object.keys(a).forEach(
|
|
430
|
-
(
|
|
431
|
-
const
|
|
432
|
-
t.scales[
|
|
433
|
-
position:
|
|
434
|
-
label: t.getScaleLabel(
|
|
435
|
-
identifier: u(e, "axes",
|
|
436
|
-
} : a[
|
|
441
|
+
(o) => {
|
|
442
|
+
const r = a[o];
|
|
443
|
+
t.scales[r] ? a[o] = {
|
|
444
|
+
position: r,
|
|
445
|
+
label: t.getScaleLabel(r),
|
|
446
|
+
identifier: u(e, "axes", r, "mapsTo")
|
|
447
|
+
} : a[o] = null;
|
|
437
448
|
}
|
|
438
449
|
), a;
|
|
439
450
|
}
|
|
440
451
|
getTabularDataArray() {
|
|
441
|
-
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, { primaryDomain: a, primaryRange:
|
|
452
|
+
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, { primaryDomain: a, primaryRange: o, secondaryDomain: r, secondaryRange: i } = this.assignRangeAndDomains(), { number: n, code: c } = u(this.getOptions(), "locale"), l = [
|
|
442
453
|
"Group",
|
|
443
454
|
a.label,
|
|
444
|
-
|
|
445
|
-
...
|
|
455
|
+
o.label,
|
|
456
|
+
...r ? [r.label] : [],
|
|
446
457
|
...i ? [i.label] : []
|
|
447
|
-
],
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
...
|
|
452
|
-
|
|
458
|
+
], p = t.map((h) => [
|
|
459
|
+
h[s],
|
|
460
|
+
h[a.identifier] === null ? "–" : h[a.identifier],
|
|
461
|
+
h[o.identifier] === null || isNaN(h[o.identifier]) ? "–" : n(h[o.identifier], c),
|
|
462
|
+
...r ? [
|
|
463
|
+
h[r.identifier] === null ? "–" : h[r.identifier]
|
|
453
464
|
] : [],
|
|
454
465
|
...i ? [
|
|
455
|
-
|
|
466
|
+
h[i.identifier] === null || isNaN(h[i.identifier]) ? "–" : h[i.identifier]
|
|
456
467
|
] : []
|
|
457
468
|
]);
|
|
458
|
-
return super.formatTable({ headers:
|
|
469
|
+
return super.formatTable({ headers: l, cells: p });
|
|
459
470
|
}
|
|
460
471
|
setData(t) {
|
|
461
472
|
let e;
|
|
462
|
-
if (t && (e = super.setData(t), u(this.getOptions(), "zoomBar",
|
|
473
|
+
if (t && (e = super.setData(t), u(this.getOptions(), "zoomBar", A.TOP, "enabled"))) {
|
|
463
474
|
const s = u(
|
|
464
475
|
this.getOptions(),
|
|
465
476
|
"zoomBar",
|
|
466
|
-
|
|
477
|
+
A.TOP,
|
|
467
478
|
"data"
|
|
468
479
|
);
|
|
469
480
|
this.setZoomBarData(s);
|
|
@@ -474,18 +485,18 @@ class T extends D {
|
|
|
474
485
|
* @param zoomBarData any special zoom bar data to use instead of the model data
|
|
475
486
|
*/
|
|
476
487
|
setZoomBarData(t) {
|
|
477
|
-
const e = t ? this.sanitize(
|
|
488
|
+
const e = t ? this.sanitize(G(t)) : this.getDisplayData();
|
|
478
489
|
let s = e;
|
|
479
490
|
const { cartesianScales: a } = this.services;
|
|
480
491
|
if (e && a.domainAxisPosition && a.rangeAxisPosition) {
|
|
481
|
-
const
|
|
482
|
-
let i = e.map((
|
|
483
|
-
i =
|
|
492
|
+
const o = a.getDomainIdentifier(), r = a.getRangeIdentifier();
|
|
493
|
+
let i = e.map((n) => n[o].getTime());
|
|
494
|
+
i = M(i).sort(), s = i.map((n) => {
|
|
484
495
|
let c = 0;
|
|
485
496
|
const l = {};
|
|
486
497
|
return e.forEach((p) => {
|
|
487
|
-
p[
|
|
488
|
-
}), l[
|
|
498
|
+
p[o].getTime() === n && (c += p[r]);
|
|
499
|
+
}), l[o] = new Date(n), l[r] = c, l;
|
|
489
500
|
});
|
|
490
501
|
}
|
|
491
502
|
this.set({ zoomBarData: s });
|
|
@@ -498,15 +509,15 @@ class T extends D {
|
|
|
498
509
|
if (!e.axes)
|
|
499
510
|
return t;
|
|
500
511
|
const s = [];
|
|
501
|
-
return Object.keys(
|
|
502
|
-
const
|
|
503
|
-
if (
|
|
504
|
-
const i =
|
|
512
|
+
return Object.keys(A).forEach((a) => {
|
|
513
|
+
const o = A[a], r = e.axes[o];
|
|
514
|
+
if (r && r.scaleType === f.TIME) {
|
|
515
|
+
const i = r.mapsTo;
|
|
505
516
|
(i !== null || i !== void 0) && s.push(i);
|
|
506
517
|
}
|
|
507
518
|
}), s.length > 0 && t.forEach((a) => {
|
|
508
|
-
s.forEach((
|
|
509
|
-
u(a,
|
|
519
|
+
s.forEach((o) => {
|
|
520
|
+
u(a, o, "getTime") === null && (a[o] = new Date(a[o]));
|
|
510
521
|
});
|
|
511
522
|
}), t;
|
|
512
523
|
}
|
|
@@ -514,43 +525,47 @@ class T extends D {
|
|
|
514
525
|
return t = super.sanitize(t), t = this.sanitizeDateValues(t), t;
|
|
515
526
|
}
|
|
516
527
|
}
|
|
517
|
-
class
|
|
528
|
+
class gt extends T {
|
|
518
529
|
constructor(t) {
|
|
519
530
|
super(t);
|
|
520
531
|
}
|
|
521
532
|
getTabularDataArray() {
|
|
522
|
-
const t = this.getDisplayData();
|
|
523
|
-
t.sort((
|
|
524
|
-
const
|
|
525
|
-
...t.map((
|
|
533
|
+
const t = this.getDisplayData(), { number: e, code: s } = u(this.getOptions(), "locale");
|
|
534
|
+
t.sort((r, i) => r.source.localeCompare(i.source));
|
|
535
|
+
const a = ["Source", "Target", "Value"], o = [
|
|
536
|
+
...t.map((r) => [
|
|
537
|
+
r.source,
|
|
538
|
+
r.target,
|
|
539
|
+
e(r.value, s)
|
|
540
|
+
])
|
|
526
541
|
];
|
|
527
|
-
return super.formatTable({ headers:
|
|
542
|
+
return super.formatTable({ headers: a, cells: o });
|
|
528
543
|
}
|
|
529
544
|
}
|
|
530
|
-
class
|
|
545
|
+
class dt extends T {
|
|
531
546
|
constructor(t) {
|
|
532
547
|
super(t);
|
|
533
548
|
}
|
|
534
549
|
getBoxQuartiles(t) {
|
|
535
550
|
return {
|
|
536
|
-
q_25:
|
|
537
|
-
q_50:
|
|
538
|
-
q_75:
|
|
551
|
+
q_25: E(t, 0.25),
|
|
552
|
+
q_50: E(t, 0.5),
|
|
553
|
+
q_75: E(t, 0.75)
|
|
539
554
|
};
|
|
540
555
|
}
|
|
541
556
|
getBoxplotData() {
|
|
542
557
|
const t = this.getOptions(), { groupMapsTo: e } = t.data, s = this.getGroupedData(), a = [];
|
|
543
|
-
for (const { name:
|
|
544
|
-
const i = this.services.cartesianScales.getRangeIdentifier(),
|
|
545
|
-
[e]:
|
|
546
|
-
counts:
|
|
547
|
-
quartiles: this.getBoxQuartiles(
|
|
558
|
+
for (const { name: o, data: r } of s) {
|
|
559
|
+
const i = this.services.cartesianScales.getRangeIdentifier(), n = r.map((v) => v[i]).sort(Z), c = {
|
|
560
|
+
[e]: o,
|
|
561
|
+
counts: n,
|
|
562
|
+
quartiles: this.getBoxQuartiles(n),
|
|
548
563
|
outliers: null,
|
|
549
564
|
whiskers: null
|
|
550
|
-
}, l = c.quartiles.q_25, p = c.quartiles.q_75,
|
|
551
|
-
for (const v of
|
|
552
|
-
v < g || v > m ?
|
|
553
|
-
c.outliers =
|
|
565
|
+
}, l = c.quartiles.q_25, p = c.quartiles.q_75, h = (p - l) * 1.5, g = l - h, m = p + h, y = [], x = [];
|
|
566
|
+
for (const v of n)
|
|
567
|
+
v < g || v > m ? y.push(v) : x.push(v);
|
|
568
|
+
c.outliers = y;
|
|
554
569
|
const q = P(x), I = k(x);
|
|
555
570
|
c.whiskers = {
|
|
556
571
|
min: q || P([c.quartiles.q_25, c.quartiles.q_50, c.quartiles.q_75]),
|
|
@@ -560,30 +575,32 @@ class ft extends T {
|
|
|
560
575
|
return a;
|
|
561
576
|
}
|
|
562
577
|
getTabularDataArray() {
|
|
563
|
-
const t = this.getOptions(), { groupMapsTo: e } = t.data, s = this.getBoxplotData(), a = ["Group", "Minimum", "Q1", "Median", "Q3", "Maximum", "IQR", "Outlier(s)"],
|
|
564
|
-
...s.map((
|
|
565
|
-
let
|
|
566
|
-
return (
|
|
567
|
-
|
|
568
|
-
u(
|
|
569
|
-
u(
|
|
570
|
-
u(
|
|
571
|
-
u(
|
|
572
|
-
u(
|
|
573
|
-
u(
|
|
574
|
-
|
|
578
|
+
const t = this.getOptions(), { groupMapsTo: e } = t.data, s = this.getBoxplotData(), { number: a, code: o } = u(t, "locale"), r = ["Group", "Minimum", "Q1", "Median", "Q3", "Maximum", "IQR", "Outlier(s)"], i = [
|
|
579
|
+
...s.map((n) => {
|
|
580
|
+
let c = u(n, "outliers");
|
|
581
|
+
return (c === null || c.length === 0) && (c = ["–"]), [
|
|
582
|
+
n[e],
|
|
583
|
+
u(n, "whiskers", "min") !== null ? a(u(n, "whiskers", "min"), o) : "–",
|
|
584
|
+
u(n, "quartiles", "q_25") !== null ? a(u(n, "quartiles", "q_25"), o) : "–",
|
|
585
|
+
u(n, "quartiles", "q_50") !== null ? a(u(n, "quartiles", "q_50"), o) : "–",
|
|
586
|
+
u(n, "quartiles", "q_75") !== null ? a(u(n, "quartiles", "q_75"), o) : "–",
|
|
587
|
+
u(n, "whiskers", "max") !== null ? a(u(n, "whiskers", "max"), o) : "–",
|
|
588
|
+
u(n, "quartiles", "q_75") !== null && u(n, "quartiles", "q_25") !== null ? (a(
|
|
589
|
+
u(n, "quartiles", "q_75") - u(n, "quartiles", "q_25")
|
|
590
|
+
), o) : "–",
|
|
591
|
+
c.map((l) => a(l, o)).join(",")
|
|
575
592
|
];
|
|
576
593
|
})
|
|
577
594
|
];
|
|
578
|
-
return super.formatTable({ headers:
|
|
595
|
+
return super.formatTable({ headers: r, cells: i });
|
|
579
596
|
}
|
|
580
597
|
setColorClassNames() {
|
|
581
598
|
const e = u(this.getOptions(), "color", "pairing");
|
|
582
599
|
let s = u(e, "option");
|
|
583
|
-
const a =
|
|
600
|
+
const a = V.pairingOptions;
|
|
584
601
|
s = s <= a["1-color"] ? s : 1;
|
|
585
|
-
const
|
|
586
|
-
this.colorClassNames =
|
|
602
|
+
const o = this.allDataGroups.map(() => `1-${s}-1`);
|
|
603
|
+
this.colorClassNames = R().range(o).domain(this.allDataGroups);
|
|
587
604
|
}
|
|
588
605
|
}
|
|
589
606
|
class mt extends T {
|
|
@@ -605,20 +622,20 @@ class mt extends T {
|
|
|
605
622
|
return 0;
|
|
606
623
|
}
|
|
607
624
|
getTabularDataArray() {
|
|
608
|
-
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = this.services.cartesianScales.getRangeIdentifier(),
|
|
609
|
-
...t.map((
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
u(
|
|
614
|
-
u(
|
|
615
|
-
|
|
625
|
+
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = this.services.cartesianScales.getRangeIdentifier(), { number: o, code: r } = u(e, "locale"), i = u(e, "bullet", "performanceAreaTitles"), n = ["Title", "Group", "Value", "Target", "Percentage", "Performance"], c = [
|
|
626
|
+
...t.map((l) => [
|
|
627
|
+
l.title,
|
|
628
|
+
l[s],
|
|
629
|
+
l.value === null ? "–" : o(l.value, r),
|
|
630
|
+
u(l, "marker") === null ? "–" : o(l.marker, r),
|
|
631
|
+
u(l, "marker") === null ? "–" : `${o(Math.floor(l[a] / l.marker * 100), r)}%`,
|
|
632
|
+
i[this.getMatchingRangeIndexForDatapoint(l)]
|
|
616
633
|
])
|
|
617
634
|
];
|
|
618
|
-
return super.formatTable({ headers:
|
|
635
|
+
return super.formatTable({ headers: n, cells: c });
|
|
619
636
|
}
|
|
620
637
|
}
|
|
621
|
-
class
|
|
638
|
+
class ft extends D {
|
|
622
639
|
constructor(t) {
|
|
623
640
|
super(t), this._colorScale = void 0, this._matrix = {};
|
|
624
641
|
}
|
|
@@ -634,9 +651,9 @@ class Dt extends D {
|
|
|
634
651
|
* Helper function that will generate a dictionary
|
|
635
652
|
*/
|
|
636
653
|
getCombinedData() {
|
|
637
|
-
if (
|
|
654
|
+
if (b(this._matrix)) {
|
|
638
655
|
const t = this.getOptions(), e = this.getDisplayData();
|
|
639
|
-
!
|
|
656
|
+
!b(e) && !b(t.geoData.objects.countries) && (t.geoData.objects.countries.geometries.forEach((s) => {
|
|
640
657
|
this._matrix[s.properties.NAME] = s;
|
|
641
658
|
}), e.forEach((s) => {
|
|
642
659
|
this._matrix[s.name] ? this._matrix[s.name].value = s.value || null : console.warn(`Data point ${s} is missing geographical data.`);
|
|
@@ -649,14 +666,14 @@ class Dt extends D {
|
|
|
649
666
|
* @returns Array<Object>
|
|
650
667
|
*/
|
|
651
668
|
getTabularDataArray() {
|
|
652
|
-
const t = this.getDisplayData(), e = ["Country ID", "Country Name", "Value"],
|
|
653
|
-
...t.map((
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
669
|
+
const t = this.getDisplayData(), { number: e, code: s } = u(this.getOptions(), "locale"), a = ["Country ID", "Country Name", "Value"], o = [
|
|
670
|
+
...t.map((r) => [
|
|
671
|
+
r.id === null ? "–" : r.id,
|
|
672
|
+
r.name,
|
|
673
|
+
e(r.value, s)
|
|
657
674
|
])
|
|
658
675
|
];
|
|
659
|
-
return super.formatTable({ headers:
|
|
676
|
+
return super.formatTable({ headers: a, cells: o });
|
|
660
677
|
}
|
|
661
678
|
// Uses quantize scale to return class names
|
|
662
679
|
getColorClassName(t) {
|
|
@@ -664,10 +681,10 @@ class Dt extends D {
|
|
|
664
681
|
}
|
|
665
682
|
setColorClassNames() {
|
|
666
683
|
const t = u(this.getOptions(), "color");
|
|
667
|
-
this._colorScale =
|
|
684
|
+
this._colorScale = L(this.getDisplayData(), t);
|
|
668
685
|
}
|
|
669
686
|
}
|
|
670
|
-
class
|
|
687
|
+
class Dt extends D {
|
|
671
688
|
constructor(t) {
|
|
672
689
|
super(t), this.parentNode = !1, this.set({ depth: 2 }, { skipUpdate: !0 });
|
|
673
690
|
}
|
|
@@ -676,26 +693,26 @@ class yt extends D {
|
|
|
676
693
|
}
|
|
677
694
|
setOptions(t) {
|
|
678
695
|
const e = this.getOptions(), s = _({}, t, this.getZoomOptions(t));
|
|
679
|
-
|
|
680
|
-
const a = this.getHierarchyLevel(),
|
|
696
|
+
F(e, s);
|
|
697
|
+
const a = this.getHierarchyLevel(), o = u(e, "circlePack", "hierarchyLevel");
|
|
681
698
|
this.set({
|
|
682
699
|
options: _(e, s),
|
|
683
|
-
depth:
|
|
700
|
+
depth: o && o < 4 ? o : a
|
|
684
701
|
});
|
|
685
702
|
}
|
|
686
703
|
getZoomOptions(t) {
|
|
687
704
|
if (!this.getDisplayData())
|
|
688
705
|
return {};
|
|
689
706
|
const e = this.getDisplayData(), s = t || this.getOptions(), a = e.length === 1 && u(e, 0, "children") ? u(e, 0, "children") : e;
|
|
690
|
-
let
|
|
691
|
-
return a.some((
|
|
692
|
-
if (
|
|
693
|
-
return
|
|
694
|
-
}), u(s, "canvasZoom", "enabled") === !0 &&
|
|
707
|
+
let o = this.getHierarchyLevel();
|
|
708
|
+
return a.some((r) => {
|
|
709
|
+
if (r.children && r.children.some((i) => i.children))
|
|
710
|
+
return o = 3, !1;
|
|
711
|
+
}), u(s, "canvasZoom", "enabled") === !0 && o > 2 ? {
|
|
695
712
|
legend: {
|
|
696
713
|
additionalItems: [
|
|
697
714
|
{
|
|
698
|
-
type:
|
|
715
|
+
type: Y.ZOOM,
|
|
699
716
|
name: "Click to zoom"
|
|
700
717
|
}
|
|
701
718
|
]
|
|
@@ -717,9 +734,9 @@ class yt extends D {
|
|
|
717
734
|
}
|
|
718
735
|
// set the datagroup name on the items that are it's children
|
|
719
736
|
setDataGroups() {
|
|
720
|
-
const t = this.getData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = t.map((
|
|
721
|
-
const
|
|
722
|
-
return this.setChildrenDataGroup(
|
|
737
|
+
const t = this.getData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = t.map((o) => {
|
|
738
|
+
const r = o[s];
|
|
739
|
+
return this.setChildrenDataGroup(o, r);
|
|
723
740
|
});
|
|
724
741
|
this.set(
|
|
725
742
|
{
|
|
@@ -737,11 +754,11 @@ class yt extends D {
|
|
|
737
754
|
} : { ...t, dataGroupName: e };
|
|
738
755
|
}
|
|
739
756
|
getTabularDataArray() {
|
|
740
|
-
const t = this.getDisplayData(), e = ["Child", "Parent", "Value"],
|
|
741
|
-
return t.forEach((
|
|
742
|
-
let
|
|
743
|
-
|
|
744
|
-
}), super.formatTable({ headers:
|
|
757
|
+
const t = this.getDisplayData(), { number: e, code: s } = u(this.getOptions(), "locale"), a = ["Child", "Parent", "Value"], o = [];
|
|
758
|
+
return t.forEach((r) => {
|
|
759
|
+
let i = r.value ? r.value : 0;
|
|
760
|
+
r.children && (i += this.getChildrenDatums(r.children, r.name, o, 0)), o.push(["–", r.name, e(i, s)]);
|
|
761
|
+
}), super.formatTable({ headers: a, cells: o });
|
|
745
762
|
}
|
|
746
763
|
/**
|
|
747
764
|
* Recursively determine the relationship between all the nested elements in the child
|
|
@@ -752,20 +769,20 @@ class yt extends D {
|
|
|
752
769
|
* @returns: number
|
|
753
770
|
*/
|
|
754
771
|
getChildrenDatums(t, e, s = [], a = 0) {
|
|
755
|
-
const
|
|
756
|
-
return t.forEach((
|
|
757
|
-
const
|
|
758
|
-
let
|
|
759
|
-
if (
|
|
760
|
-
|
|
772
|
+
const o = e, { number: r, code: i } = u(this.getOptions(), "locale");
|
|
773
|
+
return t.forEach((n) => {
|
|
774
|
+
const c = n.name;
|
|
775
|
+
let l = 0;
|
|
776
|
+
if (n.children)
|
|
777
|
+
n.children.length > 0 && (typeof n.value == "number" && (a += n.value), l += this.getChildrenDatums(n.children, c, s, l), s.push([c, o, r(l, i)]), a += l);
|
|
761
778
|
else {
|
|
762
|
-
let
|
|
763
|
-
typeof
|
|
779
|
+
let p = 0;
|
|
780
|
+
typeof n.value == "number" && (p = n.value, a += n.value), s.push([n.name, o, r(p, i)]);
|
|
764
781
|
}
|
|
765
782
|
}), a;
|
|
766
783
|
}
|
|
767
784
|
}
|
|
768
|
-
class
|
|
785
|
+
class yt extends D {
|
|
769
786
|
constructor(t) {
|
|
770
787
|
super(t);
|
|
771
788
|
}
|
|
@@ -776,13 +793,13 @@ class vt extends D {
|
|
|
776
793
|
}), e;
|
|
777
794
|
}
|
|
778
795
|
getTabularDataArray() {
|
|
779
|
-
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, { valueMapsTo: a } = e.pie,
|
|
780
|
-
...t.map((
|
|
781
|
-
|
|
782
|
-
|
|
796
|
+
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, { valueMapsTo: a } = e.pie, { number: o, code: r } = u(e, "locale"), i = ["Group", "Value"], n = [
|
|
797
|
+
...t.map((c) => [
|
|
798
|
+
c[s],
|
|
799
|
+
c[a] === null ? "–" : o(c[a], r)
|
|
783
800
|
])
|
|
784
801
|
];
|
|
785
|
-
return super.formatTable({ headers:
|
|
802
|
+
return super.formatTable({ headers: i, cells: n });
|
|
786
803
|
}
|
|
787
804
|
sanitize(t) {
|
|
788
805
|
return this.getTabularData(t).sort((s, a) => a.value - s.value);
|
|
@@ -796,18 +813,18 @@ class bt extends D {
|
|
|
796
813
|
return super.getDataGroups().filter((t) => t.name !== "delta");
|
|
797
814
|
}
|
|
798
815
|
getTabularDataArray() {
|
|
799
|
-
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = ["Group", "Value"],
|
|
800
|
-
...t.map((
|
|
801
|
-
|
|
802
|
-
|
|
816
|
+
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, { number: a, code: o } = u(this.getOptions(), "locale"), r = ["Group", "Value"], i = [
|
|
817
|
+
...t.map((n) => [
|
|
818
|
+
n[s],
|
|
819
|
+
n.value === null ? "–" : a(n.value, o)
|
|
803
820
|
])
|
|
804
821
|
];
|
|
805
|
-
return super.formatTable({ headers:
|
|
822
|
+
return super.formatTable({ headers: r, cells: i });
|
|
806
823
|
}
|
|
807
824
|
}
|
|
808
|
-
class
|
|
825
|
+
class vt extends T {
|
|
809
826
|
constructor(t) {
|
|
810
|
-
super(t), this.axisFlavor =
|
|
827
|
+
super(t), this.axisFlavor = $.HOVERABLE, this._colorScale = void 0, this._domains = [], this._ranges = [], this._matrix = {};
|
|
811
828
|
const e = u(this.getOptions(), "axes");
|
|
812
829
|
if (u(e, "left", "scaleType") && u(e, "left", "scaleType") !== f.LABELS || u(e, "right", "scaleType") && u(e, "right", "scaleType") !== f.LABELS || u(e, "top", "scaleType") && u(e, "top", "scaleType") !== f.LABELS || u(e, "bottom", "scaleType") && u(e, "bottom", "scaleType") !== f.LABELS)
|
|
813
830
|
throw Error("Heatmap only supports label scaletypes.");
|
|
@@ -817,7 +834,7 @@ class xt extends T {
|
|
|
817
834
|
* @returns Array consisting of smallest and largest values in data
|
|
818
835
|
*/
|
|
819
836
|
getValueDomain() {
|
|
820
|
-
const t =
|
|
837
|
+
const t = Q(this.getDisplayData(), (s) => s.value), e = W().domain(t).nice().domain();
|
|
821
838
|
if (e[0] > 0)
|
|
822
839
|
e[0] = 0;
|
|
823
840
|
else if (e[0] === 0 && e[1] === 0)
|
|
@@ -837,13 +854,13 @@ class xt extends T {
|
|
|
837
854
|
* @returns String[]
|
|
838
855
|
*/
|
|
839
856
|
getUniqueDomain() {
|
|
840
|
-
if (
|
|
841
|
-
const t = this.getDisplayData(), { cartesianScales: e } = this.services, s = e.getDomainIdentifier(), a = e.getMainXAxisPosition(),
|
|
842
|
-
if (
|
|
843
|
-
return
|
|
857
|
+
if (b(this._domains)) {
|
|
858
|
+
const t = this.getDisplayData(), { cartesianScales: e } = this.services, s = e.getDomainIdentifier(), a = e.getMainXAxisPosition(), o = e.getCustomDomainValuesByposition(a);
|
|
859
|
+
if (o)
|
|
860
|
+
return o;
|
|
844
861
|
this._domains = Array.from(
|
|
845
862
|
new Set(
|
|
846
|
-
t.map((
|
|
863
|
+
t.map((r) => r[s])
|
|
847
864
|
)
|
|
848
865
|
);
|
|
849
866
|
}
|
|
@@ -854,13 +871,13 @@ class xt extends T {
|
|
|
854
871
|
* @returns String[]
|
|
855
872
|
*/
|
|
856
873
|
getUniqueRanges() {
|
|
857
|
-
if (
|
|
858
|
-
const t = this.getDisplayData(), { cartesianScales: e } = this.services, s = e.getRangeIdentifier(), a = e.getMainYAxisPosition(),
|
|
859
|
-
if (
|
|
860
|
-
return
|
|
874
|
+
if (b(this._ranges)) {
|
|
875
|
+
const t = this.getDisplayData(), { cartesianScales: e } = this.services, s = e.getRangeIdentifier(), a = e.getMainYAxisPosition(), o = e.getCustomDomainValuesByposition(a);
|
|
876
|
+
if (o)
|
|
877
|
+
return o;
|
|
861
878
|
this._ranges = Array.from(
|
|
862
879
|
new Set(
|
|
863
|
-
t.map((
|
|
880
|
+
t.map((r) => r[s])
|
|
864
881
|
)
|
|
865
882
|
);
|
|
866
883
|
}
|
|
@@ -871,18 +888,18 @@ class xt extends T {
|
|
|
871
888
|
* @returns Object
|
|
872
889
|
*/
|
|
873
890
|
getMatrix() {
|
|
874
|
-
if (
|
|
875
|
-
const t = this.getUniqueDomain(), e = this.getUniqueRanges(), s = this.services.cartesianScales.getDomainIdentifier(), a = this.services.cartesianScales.getRangeIdentifier(),
|
|
876
|
-
e.forEach((
|
|
877
|
-
|
|
891
|
+
if (b(this._matrix)) {
|
|
892
|
+
const t = this.getUniqueDomain(), e = this.getUniqueRanges(), s = this.services.cartesianScales.getDomainIdentifier(), a = this.services.cartesianScales.getRangeIdentifier(), o = {};
|
|
893
|
+
e.forEach((r) => {
|
|
894
|
+
o[r] = {
|
|
878
895
|
value: null,
|
|
879
896
|
index: -1
|
|
880
897
|
};
|
|
881
|
-
}), t.forEach((
|
|
882
|
-
this._matrix[
|
|
883
|
-
}), this.getDisplayData().forEach((
|
|
884
|
-
this._matrix[
|
|
885
|
-
value:
|
|
898
|
+
}), t.forEach((r) => {
|
|
899
|
+
this._matrix[r] = G(o);
|
|
900
|
+
}), this.getDisplayData().forEach((r, i) => {
|
|
901
|
+
this._matrix[r[s]][r[a]] = {
|
|
902
|
+
value: r.value,
|
|
886
903
|
index: i
|
|
887
904
|
};
|
|
888
905
|
});
|
|
@@ -894,7 +911,7 @@ class xt extends T {
|
|
|
894
911
|
* @param newData The new raw data to be set
|
|
895
912
|
*/
|
|
896
913
|
setData(t) {
|
|
897
|
-
const e = this.sanitize(
|
|
914
|
+
const e = this.sanitize(G(t)), s = this.generateDataGroups(e);
|
|
898
915
|
return this.set({
|
|
899
916
|
data: e,
|
|
900
917
|
dataGroups: s
|
|
@@ -905,67 +922,72 @@ class xt extends T {
|
|
|
905
922
|
* @returns object[]
|
|
906
923
|
*/
|
|
907
924
|
getMatrixAsArray() {
|
|
908
|
-
|
|
909
|
-
const t = this.getUniqueDomain(), e = this.getUniqueRanges(), s = this.services.cartesianScales.getDomainIdentifier(), a = this.services.cartesianScales.getRangeIdentifier(),
|
|
910
|
-
return t.forEach((
|
|
925
|
+
b(this._matrix) && this.getMatrix();
|
|
926
|
+
const t = this.getUniqueDomain(), e = this.getUniqueRanges(), s = this.services.cartesianScales.getDomainIdentifier(), a = this.services.cartesianScales.getRangeIdentifier(), o = [];
|
|
927
|
+
return t.forEach((r) => {
|
|
911
928
|
e.forEach((i) => {
|
|
912
|
-
const
|
|
913
|
-
value: this._matrix[
|
|
914
|
-
index: this._matrix[
|
|
929
|
+
const n = {
|
|
930
|
+
value: this._matrix[r][i].value,
|
|
931
|
+
index: this._matrix[r][i].index
|
|
915
932
|
};
|
|
916
|
-
|
|
933
|
+
n[s] = r, n[a] = i, o.push(n);
|
|
917
934
|
});
|
|
918
|
-
}),
|
|
935
|
+
}), o;
|
|
919
936
|
}
|
|
920
937
|
/**
|
|
921
938
|
* Generate tabular data from display data
|
|
922
939
|
* @returns Array<Object>
|
|
923
940
|
*/
|
|
924
941
|
getTabularDataArray() {
|
|
925
|
-
const t = this.getDisplayData(), { primaryDomain: e, primaryRange: s } = this.assignRangeAndDomains(), a = [e.label, s.label, "Value"],
|
|
926
|
-
...t.map((
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
942
|
+
const t = this.getDisplayData(), { primaryDomain: e, primaryRange: s } = this.assignRangeAndDomains(), { number: a, code: o } = u(this.getOptions(), "locale"), r = [e.label, s.label, "Value"], i = [
|
|
943
|
+
...t.map((n) => [
|
|
944
|
+
n[e.identifier] === null ? "–" : n[e.identifier],
|
|
945
|
+
n[s.identifier] === null ? "–" : n[s.identifier],
|
|
946
|
+
a(n.value, o)
|
|
930
947
|
])
|
|
931
948
|
];
|
|
932
|
-
return super.formatTable({ headers:
|
|
949
|
+
return super.formatTable({ headers: r, cells: i });
|
|
933
950
|
}
|
|
934
951
|
// Uses quantize scale to return class names
|
|
935
952
|
getColorClassName(t) {
|
|
936
953
|
return `${t.originalClassName} ${this._colorScale(t.value)}`;
|
|
937
954
|
}
|
|
938
955
|
setColorClassNames() {
|
|
939
|
-
const t = this.getOptions(), e = u(t, "color", "gradient", "colors"), s = !
|
|
956
|
+
const t = this.getOptions(), e = u(t, "color", "gradient", "colors"), s = !b(e);
|
|
940
957
|
let a = u(t, "color", "pairing", "option");
|
|
941
|
-
const
|
|
942
|
-
(a < 1 && a > 4 &&
|
|
958
|
+
const o = this.getValueDomain(), r = o[0] < 0 && o[1] > 0 ? "diverge" : "mono";
|
|
959
|
+
(a < 1 && a > 4 && r === "mono" || a < 1 && a > 2 && r === "diverge") && (a = 1);
|
|
943
960
|
const i = s ? e : [];
|
|
944
961
|
if (!s) {
|
|
945
|
-
const c =
|
|
962
|
+
const c = r === "diverge" ? 17 : 11;
|
|
946
963
|
for (let l = 1; l < c + 1; l++)
|
|
947
|
-
i.push(`fill-${
|
|
964
|
+
i.push(`fill-${r}-${a}-${l}`);
|
|
948
965
|
}
|
|
949
|
-
this._colorScale =
|
|
950
|
-
const
|
|
951
|
-
this._colorScale =
|
|
966
|
+
this._colorScale = X().domain(o).range(i);
|
|
967
|
+
const n = u(this.getOptions(), "color");
|
|
968
|
+
this._colorScale = L(this.getDisplayData(), n);
|
|
952
969
|
}
|
|
953
970
|
}
|
|
954
|
-
class
|
|
971
|
+
class Ct extends T {
|
|
955
972
|
getTabularDataArray() {
|
|
956
|
-
const t = this.getOptions(), { groupMapsTo: e } = t.data, s = this.getBinnedStackedData(),
|
|
957
|
-
|
|
958
|
-
...
|
|
959
|
-
],
|
|
960
|
-
...
|
|
961
|
-
`${
|
|
962
|
-
|
|
973
|
+
const t = this.getOptions(), { groupMapsTo: e } = t.data, { number: s, code: a } = u(this.getOptions(), "locale"), o = this.getBinnedStackedData(), r = [
|
|
974
|
+
C(t, "bins.rangeLabel") || "Range",
|
|
975
|
+
...o.map((n) => C(n, `0.${e}`))
|
|
976
|
+
], i = [
|
|
977
|
+
...C(o, 0).map((n, c) => [
|
|
978
|
+
`${s(Number(C(n, "data.x0")), a)} – ${s(
|
|
979
|
+
Number(C(n, "data.x1")),
|
|
980
|
+
a
|
|
981
|
+
)}`,
|
|
982
|
+
...o.map(
|
|
983
|
+
(l) => s(C(l[c], `data.${C(l[c], e)}`), a)
|
|
984
|
+
)
|
|
963
985
|
])
|
|
964
986
|
];
|
|
965
|
-
return super.formatTable({ headers:
|
|
987
|
+
return super.formatTable({ headers: r, cells: i });
|
|
966
988
|
}
|
|
967
989
|
}
|
|
968
|
-
class
|
|
990
|
+
class xt extends D {
|
|
969
991
|
constructor(t) {
|
|
970
992
|
super(t);
|
|
971
993
|
}
|
|
@@ -985,53 +1007,62 @@ class Ct extends D {
|
|
|
985
1007
|
* Get the associated status for the data by checking the ranges
|
|
986
1008
|
*/
|
|
987
1009
|
getStatus() {
|
|
988
|
-
const t = this.getOptions(), e = u(this.getDisplayData()), s = (e == null ? void 0 : e.reduce((
|
|
989
|
-
if (
|
|
990
|
-
const
|
|
1010
|
+
const t = this.getOptions(), e = u(this.getDisplayData()), s = (e == null ? void 0 : e.reduce((r, i) => r + i.value, 0)) ?? 0, a = u(t, "meter", "proportional") ? s : s > 100 ? 100 : s, o = u(t, "meter", "status", "ranges");
|
|
1011
|
+
if (o) {
|
|
1012
|
+
const r = o.filter(
|
|
991
1013
|
(i) => i.range[0] <= a && a <= i.range[1]
|
|
992
1014
|
);
|
|
993
|
-
if (
|
|
994
|
-
return
|
|
1015
|
+
if (r.length > 0)
|
|
1016
|
+
return r[0].status;
|
|
995
1017
|
}
|
|
996
1018
|
return null;
|
|
997
1019
|
}
|
|
998
1020
|
getTabularDataArray() {
|
|
999
|
-
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = this.getStatus(),
|
|
1000
|
-
let
|
|
1001
|
-
if (
|
|
1002
|
-
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1021
|
+
const t = this.getDisplayData(), e = this.getOptions(), { groupMapsTo: s } = e.data, a = this.getStatus(), o = u(e, "meter", "proportional"), { number: r, code: i } = u(this.getOptions(), "locale");
|
|
1022
|
+
let n = [], c = [], l;
|
|
1023
|
+
if (o === null) {
|
|
1024
|
+
l = 100;
|
|
1025
|
+
const p = t[0];
|
|
1026
|
+
n = ["Group", "Value", ...a ? ["Status"] : []], c = [
|
|
1027
|
+
[
|
|
1028
|
+
p[s],
|
|
1029
|
+
r(p.value, i),
|
|
1030
|
+
...a ? [a] : []
|
|
1031
|
+
]
|
|
1032
|
+
];
|
|
1005
1033
|
} else {
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
...t.map((
|
|
1009
|
-
l
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1034
|
+
const p = u(o, "total");
|
|
1035
|
+
l = p || this.getMaximumDomain(t), n = ["Group", "Value", "Percentage of total"], c = [
|
|
1036
|
+
...t.map((h) => {
|
|
1037
|
+
const g = h.value, m = Number((h.value / l * 100).toFixed(2));
|
|
1038
|
+
return [
|
|
1039
|
+
h[s],
|
|
1040
|
+
r(g, i),
|
|
1041
|
+
r(m, i) + " %"
|
|
1042
|
+
];
|
|
1043
|
+
})
|
|
1013
1044
|
];
|
|
1014
1045
|
}
|
|
1015
|
-
return super.formatTable({ headers:
|
|
1046
|
+
return super.formatTable({ headers: n, cells: c });
|
|
1016
1047
|
}
|
|
1017
1048
|
}
|
|
1018
|
-
class
|
|
1049
|
+
class Tt extends T {
|
|
1019
1050
|
constructor(t) {
|
|
1020
1051
|
super(t);
|
|
1021
1052
|
}
|
|
1022
1053
|
getTabularDataArray() {
|
|
1023
|
-
const t = this.getOptions(), e = this.getGroupedData(), { angle: s, value: a } = u(t, "radar", "axes"),
|
|
1024
|
-
...e.map((
|
|
1025
|
-
|
|
1026
|
-
...
|
|
1027
|
-
(
|
|
1054
|
+
const t = this.getOptions(), e = this.getGroupedData(), { angle: s, value: a } = u(t, "radar", "axes"), { number: o, code: r } = u(t, "locale"), i = u(e, "0", "data").map((l) => l[s]), n = ["Group", ...i], c = [
|
|
1055
|
+
...e.map((l) => [
|
|
1056
|
+
l.name,
|
|
1057
|
+
...i.map(
|
|
1058
|
+
(p, h) => u(l, "data", h, a) !== null ? o(u(l, "data", h, a), r) : "–"
|
|
1028
1059
|
)
|
|
1029
1060
|
])
|
|
1030
1061
|
];
|
|
1031
|
-
return super.formatTable({ headers:
|
|
1062
|
+
return super.formatTable({ headers: n, cells: c });
|
|
1032
1063
|
}
|
|
1033
1064
|
}
|
|
1034
|
-
class
|
|
1065
|
+
class Ot extends D {
|
|
1035
1066
|
constructor(t) {
|
|
1036
1067
|
super(t);
|
|
1037
1068
|
}
|
|
@@ -1057,12 +1088,12 @@ class At extends D {
|
|
|
1057
1088
|
super(t);
|
|
1058
1089
|
}
|
|
1059
1090
|
getTabularDataArray() {
|
|
1060
|
-
const t = this.getDisplayData(), e = ["Child", "Group", "Value"],
|
|
1061
|
-
return t.forEach((
|
|
1062
|
-
Array.isArray(
|
|
1063
|
-
|
|
1064
|
-
}) : u(
|
|
1065
|
-
}), super.formatTable({ headers:
|
|
1091
|
+
const t = this.getDisplayData(), { number: e, code: s } = u(this.getOptions(), "locale"), a = ["Child", "Group", "Value"], o = [];
|
|
1092
|
+
return t.forEach((r) => {
|
|
1093
|
+
Array.isArray(r.children) ? r.children.forEach((i) => {
|
|
1094
|
+
o.push([i.name, r.name, e(i.value, s)]);
|
|
1095
|
+
}) : u(r.name) !== null && u(r.value) && o.push(["–", r.name, e(r.value, s)]);
|
|
1096
|
+
}), super.formatTable({ headers: a, cells: o });
|
|
1066
1097
|
}
|
|
1067
1098
|
}
|
|
1068
1099
|
class Gt extends D {
|
|
@@ -1070,32 +1101,32 @@ class Gt extends D {
|
|
|
1070
1101
|
super(t);
|
|
1071
1102
|
}
|
|
1072
1103
|
getTabularDataArray() {
|
|
1073
|
-
const t = this.getDisplayData(), e = this.getOptions(), { fontSizeMapsTo: s, wordMapsTo: a } = e.wordCloud, { groupMapsTo:
|
|
1074
|
-
...t.map((
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1104
|
+
const t = this.getDisplayData(), e = this.getOptions(), { fontSizeMapsTo: s, wordMapsTo: a } = e.wordCloud, { groupMapsTo: o } = e.data, { code: r, number: i } = u(e, "locale"), n = [e.tooltip.wordLabel, "Group", e.tooltip.valueLabel], c = [
|
|
1105
|
+
...t.map((l) => [
|
|
1106
|
+
l[a],
|
|
1107
|
+
l[o],
|
|
1108
|
+
i(l[s], r)
|
|
1078
1109
|
])
|
|
1079
1110
|
];
|
|
1080
|
-
return super.formatTable({ headers:
|
|
1111
|
+
return super.formatTable({ headers: n, cells: c });
|
|
1081
1112
|
}
|
|
1082
1113
|
}
|
|
1083
1114
|
export {
|
|
1084
|
-
|
|
1085
|
-
|
|
1115
|
+
gt as A,
|
|
1116
|
+
dt as B,
|
|
1086
1117
|
D as C,
|
|
1087
1118
|
bt as G,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1119
|
+
vt as H,
|
|
1120
|
+
xt as M,
|
|
1121
|
+
yt as P,
|
|
1122
|
+
Tt as R,
|
|
1123
|
+
Ot as T,
|
|
1093
1124
|
Gt as W,
|
|
1094
1125
|
mt as a,
|
|
1095
|
-
|
|
1126
|
+
Ct as b,
|
|
1096
1127
|
T as c,
|
|
1097
|
-
|
|
1098
|
-
|
|
1128
|
+
ft as d,
|
|
1129
|
+
Dt as e,
|
|
1099
1130
|
At as f
|
|
1100
1131
|
};
|
|
1101
|
-
//# sourceMappingURL=wordcloud-
|
|
1132
|
+
//# sourceMappingURL=wordcloud-UWOp6fZX.mjs.map
|