@ahmetilhn/hanui 5.3.0 → 5.3.2
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/README.md +6 -3
- package/build/charts.cjs +1 -1
- package/build/charts.cjs.map +1 -1
- package/build/charts.js +971 -949
- package/build/charts.js.map +1 -1
- package/build/chat.cjs.map +1 -1
- package/build/chat.css +1 -1
- package/build/chat.js.map +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.js.map +1 -1
- package/build/scss/_mixins.scss +2 -0
- package/build/styles.css +1 -1
- package/build/types/charts/core/axes.d.ts +3 -0
- package/build/types/charts/core/cartesian.d.ts +4 -3
- package/build/types/charts/core/format.d.ts +12 -2
- package/build/types/chat/Prose/index.d.ts +1 -1
- package/package.json +1 -1
package/build/charts.js
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { useAnnounce as
|
|
5
|
-
const
|
|
6
|
-
axis:
|
|
7
|
-
axis__label:
|
|
8
|
-
axis__grid:
|
|
9
|
-
axis__baseline:
|
|
10
|
-
},
|
|
2
|
+
import { jsx as u, jsxs as X, Fragment as Ft } from "react/jsx-runtime";
|
|
3
|
+
import { useId as yn, useState as Tt, useRef as Pt, useEffect as tn, useCallback as nt, useLayoutEffect as xn, memo as ot, useMemo as L } from "react";
|
|
4
|
+
import { useAnnounce as wn, useHanui as xt } from "@ahmetilhn/hanui";
|
|
5
|
+
const it = (t, o) => Object.assign(t, { displayName: o }), kn = "hanui-axis-AqLAe", Nn = "hanui-axis__label-dHxpo", vn = "hanui-axis__grid-RVxXW", An = "hanui-axis__baseline-jhG2z", rt = {
|
|
6
|
+
axis: kn,
|
|
7
|
+
axis__label: Nn,
|
|
8
|
+
axis__grid: vn,
|
|
9
|
+
axis__baseline: An
|
|
10
|
+
}, vt = (t, o, n) => {
|
|
11
|
+
const e = n(t);
|
|
12
|
+
return t.map((r, i) => ({ position: o(r), label: e[i] }));
|
|
13
|
+
}, gn = 6.4, mt = (t) => t.length * gn, bn = (t, o = 8) => {
|
|
11
14
|
if (t.length < 2) return [...t];
|
|
12
|
-
const n = Math.max(...t.map((
|
|
13
|
-
return t.filter((
|
|
14
|
-
},
|
|
15
|
-
const n = Math.max(1, Math.floor(o /
|
|
15
|
+
const n = Math.max(...t.map((i) => mt(i.label))), e = Math.abs(t[1].position - t[0].position), r = e <= 0 ? 1 : Math.max(1, Math.ceil((n + o) / e));
|
|
16
|
+
return t.filter((i, d) => d % r === 0);
|
|
17
|
+
}, Gt = (t, o) => {
|
|
18
|
+
const n = Math.max(1, Math.floor(o / gn));
|
|
16
19
|
return t.length <= n ? t : `${t.slice(0, Math.max(1, n - 1))}…`;
|
|
17
|
-
},
|
|
18
|
-
(r) => n === "bottom" ? /* @__PURE__ */
|
|
19
|
-
e && /* @__PURE__ */
|
|
20
|
+
}, ft = ({ area: t, ticks: o, side: n, hasGrid: e = !1 }) => /* @__PURE__ */ u("g", { className: rt.axis, "aria-hidden": !0, children: o.map(
|
|
21
|
+
(r) => n === "bottom" ? /* @__PURE__ */ X("g", { children: [
|
|
22
|
+
e && /* @__PURE__ */ u(
|
|
20
23
|
"line",
|
|
21
24
|
{
|
|
22
|
-
className:
|
|
25
|
+
className: rt.axis__grid,
|
|
23
26
|
x1: r.position,
|
|
24
27
|
x2: r.position,
|
|
25
28
|
y1: t.top,
|
|
26
29
|
y2: t.bottom
|
|
27
30
|
}
|
|
28
31
|
),
|
|
29
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ u(
|
|
30
33
|
"text",
|
|
31
34
|
{
|
|
32
|
-
className:
|
|
35
|
+
className: rt.axis__label,
|
|
33
36
|
x: r.position,
|
|
34
37
|
y: t.bottom + 16,
|
|
35
38
|
textAnchor: "middle",
|
|
36
39
|
children: r.label
|
|
37
40
|
}
|
|
38
41
|
)
|
|
39
|
-
] }, `${r.position}-${r.label}`) : /* @__PURE__ */
|
|
40
|
-
e && /* @__PURE__ */
|
|
42
|
+
] }, `${r.position}-${r.label}`) : /* @__PURE__ */ X("g", { children: [
|
|
43
|
+
e && /* @__PURE__ */ u(
|
|
41
44
|
"line",
|
|
42
45
|
{
|
|
43
|
-
className:
|
|
46
|
+
className: rt.axis__grid,
|
|
44
47
|
x1: t.left,
|
|
45
48
|
x2: t.right,
|
|
46
49
|
y1: r.position,
|
|
47
50
|
y2: r.position
|
|
48
51
|
}
|
|
49
52
|
),
|
|
50
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ u(
|
|
51
54
|
"text",
|
|
52
55
|
{
|
|
53
|
-
className:
|
|
56
|
+
className: rt.axis__label,
|
|
54
57
|
x: n === "left" ? t.left - 8 : t.right + 8,
|
|
55
58
|
y: r.position,
|
|
56
59
|
dy: "0.32em",
|
|
@@ -59,21 +62,21 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
59
62
|
}
|
|
60
63
|
)
|
|
61
64
|
] }, `${r.position}-${r.label}`)
|
|
62
|
-
) }),
|
|
63
|
-
/* @__PURE__ */
|
|
65
|
+
) }), Yt = ({ area: t, ticks: o, side: n }) => /* @__PURE__ */ u("g", { className: rt.axis, "aria-hidden": !0, children: n === "bottom" ? /* @__PURE__ */ X(Ft, { children: [
|
|
66
|
+
/* @__PURE__ */ u(
|
|
64
67
|
"line",
|
|
65
68
|
{
|
|
66
|
-
className:
|
|
69
|
+
className: rt.axis__baseline,
|
|
67
70
|
x1: t.left,
|
|
68
71
|
x2: t.right,
|
|
69
72
|
y1: t.bottom,
|
|
70
73
|
y2: t.bottom
|
|
71
74
|
}
|
|
72
75
|
),
|
|
73
|
-
|
|
76
|
+
bn(o).map((e) => /* @__PURE__ */ u(
|
|
74
77
|
"text",
|
|
75
78
|
{
|
|
76
|
-
className:
|
|
79
|
+
className: rt.axis__label,
|
|
77
80
|
x: e.position,
|
|
78
81
|
y: t.bottom + 16,
|
|
79
82
|
textAnchor: "middle",
|
|
@@ -81,119 +84,119 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
81
84
|
},
|
|
82
85
|
`${e.position}-${e.label}`
|
|
83
86
|
))
|
|
84
|
-
] }) : /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
87
|
+
] }) : /* @__PURE__ */ X(Ft, { children: [
|
|
88
|
+
/* @__PURE__ */ u(
|
|
86
89
|
"line",
|
|
87
90
|
{
|
|
88
|
-
className:
|
|
91
|
+
className: rt.axis__baseline,
|
|
89
92
|
x1: t.left,
|
|
90
93
|
x2: t.left,
|
|
91
94
|
y1: t.top,
|
|
92
95
|
y2: t.bottom
|
|
93
96
|
}
|
|
94
97
|
),
|
|
95
|
-
o.map((e) => /* @__PURE__ */
|
|
98
|
+
o.map((e) => /* @__PURE__ */ u(
|
|
96
99
|
"text",
|
|
97
100
|
{
|
|
98
|
-
className:
|
|
101
|
+
className: rt.axis__label,
|
|
99
102
|
x: t.left - 8,
|
|
100
103
|
y: e.position,
|
|
101
104
|
dy: "0.32em",
|
|
102
105
|
textAnchor: "end",
|
|
103
|
-
children:
|
|
106
|
+
children: Gt(e.label, t.left - 12)
|
|
104
107
|
},
|
|
105
108
|
`${e.position}-${e.label}`
|
|
106
109
|
))
|
|
107
|
-
] }) }),
|
|
110
|
+
] }) }), V = (t) => Math.round(t * 100) / 100, Tn = (t) => {
|
|
108
111
|
const o = [];
|
|
109
112
|
let n = [];
|
|
110
113
|
for (const e of t)
|
|
111
114
|
e === null || !Number.isFinite(e.x) || !Number.isFinite(e.y) ? (n.length > 0 && o.push(n), n = []) : n.push(e);
|
|
112
115
|
return n.length > 0 && o.push(n), o;
|
|
113
|
-
},
|
|
116
|
+
}, qt = (t) => t.map((o, n) => `${n === 0 ? "M" : "L"}${V(o.x)},${V(o.y)}`).join(""), _n = (t) => {
|
|
114
117
|
const o = t.length;
|
|
115
|
-
if (o < 3) return
|
|
118
|
+
if (o < 3) return qt(t);
|
|
116
119
|
const n = [], e = [];
|
|
117
|
-
for (let
|
|
118
|
-
const d = t[
|
|
119
|
-
e.push(d === 0 ? 0 : (t[
|
|
120
|
+
for (let i = 0; i < o - 1; i += 1) {
|
|
121
|
+
const d = t[i + 1].x - t[i].x;
|
|
122
|
+
e.push(d === 0 ? 0 : (t[i + 1].y - t[i].y) / d);
|
|
120
123
|
}
|
|
121
124
|
n.push(e[0]);
|
|
122
|
-
for (let
|
|
125
|
+
for (let i = 1; i < o - 1; i += 1)
|
|
123
126
|
n.push(
|
|
124
|
-
e[
|
|
127
|
+
e[i - 1] * e[i] <= 0 ? 0 : (e[i - 1] + e[i]) / 2
|
|
125
128
|
);
|
|
126
129
|
n.push(e[o - 2]);
|
|
127
|
-
for (let
|
|
128
|
-
if (e[
|
|
129
|
-
n[
|
|
130
|
+
for (let i = 0; i < o - 1; i += 1) {
|
|
131
|
+
if (e[i] === 0) {
|
|
132
|
+
n[i] = 0, n[i + 1] = 0;
|
|
130
133
|
continue;
|
|
131
134
|
}
|
|
132
|
-
const d = n[
|
|
135
|
+
const d = n[i] / e[i], m = n[i + 1] / e[i], k = d * d + m * m;
|
|
133
136
|
if (k > 9) {
|
|
134
|
-
const
|
|
135
|
-
n[
|
|
137
|
+
const T = 3 / Math.sqrt(k);
|
|
138
|
+
n[i] = T * d * e[i], n[i + 1] = T * m * e[i];
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
|
-
let r = `M${
|
|
139
|
-
for (let
|
|
140
|
-
const d = t[
|
|
141
|
-
r += `C${
|
|
141
|
+
let r = `M${V(t[0].x)},${V(t[0].y)}`;
|
|
142
|
+
for (let i = 0; i < o - 1; i += 1) {
|
|
143
|
+
const d = t[i], m = t[i + 1], k = (m.x - d.x) / 3;
|
|
144
|
+
r += `C${V(d.x + k)},${V(d.y + n[i] * k)} ${V(m.x - k)},${V(m.y - n[i + 1] * k)} ${V(m.x)},${V(m.y)}`;
|
|
142
145
|
}
|
|
143
146
|
return r;
|
|
144
|
-
},
|
|
147
|
+
}, In = (t, o = "linear") => Tn(t).map((n) => o === "monotone" ? _n(n) : qt(n)).join(""), Cn = (t, o, n = "linear") => {
|
|
145
148
|
const e = [];
|
|
146
|
-
let r = [],
|
|
149
|
+
let r = [], i = [];
|
|
147
150
|
const d = () => {
|
|
148
151
|
if (r.length > 0) {
|
|
149
|
-
const
|
|
150
|
-
e.push(`${
|
|
152
|
+
const m = n === "monotone" ? _n : qt, k = m([...i].reverse()).replace(/^M/, "L");
|
|
153
|
+
e.push(`${m(r)}${k}Z`);
|
|
151
154
|
}
|
|
152
|
-
r = [],
|
|
155
|
+
r = [], i = [];
|
|
153
156
|
};
|
|
154
|
-
return t.forEach((
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
+
return t.forEach((m, k) => {
|
|
158
|
+
const T = o[k];
|
|
159
|
+
m === null || T === null || T === void 0 ? d() : (r.push(m), i.push(T));
|
|
157
160
|
}), d(), e.join("");
|
|
158
161
|
}, et = (t, o, n, e) => ({
|
|
159
162
|
x: t + n * Math.sin(e),
|
|
160
163
|
y: o - n * Math.cos(e)
|
|
161
|
-
}),
|
|
162
|
-
const d =
|
|
164
|
+
}), nn = (t, o, n, e, r, i) => {
|
|
165
|
+
const d = i - r;
|
|
163
166
|
if (d <= 0 || n <= 0) return "";
|
|
164
167
|
if (d >= Math.PI * 2 - 1e-6) {
|
|
165
|
-
const
|
|
166
|
-
return
|
|
168
|
+
const g = (R, z) => `M${V(t)},${V(o - R)}A${R},${R} 0 1 ${z} ${V(t)},${V(o + R)}A${R},${R} 0 1 ${z} ${V(t)},${V(o - R)}Z`;
|
|
169
|
+
return g(n, 1) + (e > 0 ? g(e, 0) : "");
|
|
167
170
|
}
|
|
168
|
-
const
|
|
171
|
+
const m = d > Math.PI ? 1 : 0, k = et(t, o, n, r), T = et(t, o, n, i);
|
|
169
172
|
if (e <= 0)
|
|
170
|
-
return `M${
|
|
171
|
-
const A = et(t, o, e,
|
|
172
|
-
return `M${
|
|
173
|
-
},
|
|
174
|
-
const [n, e] = t, [r,
|
|
175
|
-
return
|
|
173
|
+
return `M${V(t)},${V(o)}L${V(k.x)},${V(k.y)}A${n},${n} 0 ${m} 1 ${V(T.x)},${V(T.y)}Z`;
|
|
174
|
+
const A = et(t, o, e, i), I = et(t, o, e, r);
|
|
175
|
+
return `M${V(k.x)},${V(k.y)}A${n},${n} 0 ${m} 1 ${V(T.x)},${V(T.y)}L${V(A.x)},${V(A.y)}A${e},${e} 0 ${m} 0 ${V(I.x)},${V(I.y)}Z`;
|
|
176
|
+
}, en = (t) => t.length === 0 ? "" : `${qt(t)}Z`, pt = (t, o) => {
|
|
177
|
+
const [n, e] = t, [r, i] = o, d = e - n, m = (k) => d === 0 ? (r + i) / 2 : r + (k - n) / d * (i - r);
|
|
178
|
+
return m.domain = t, m.range = o, m.invert = (k) => i === r ? n : n + (k - r) / (i - r) * d, m;
|
|
176
179
|
}, Dt = (t, o, { paddingInner: n = 0.2, paddingOuter: e = 0.1 } = {}) => {
|
|
177
|
-
const [r,
|
|
178
|
-
const
|
|
179
|
-
return
|
|
180
|
+
const [r, i] = o, d = t.length, m = d === 0 ? 0 : (i - r) / Math.max(1, d - n + e * 2), k = m * (1 - n), T = r + m * e, A = new Map(t.map((g, R) => [g, R])), I = (g) => {
|
|
181
|
+
const R = A.get(g);
|
|
182
|
+
return R === void 0 ? Number.NaN : T + R * m;
|
|
180
183
|
};
|
|
181
|
-
return
|
|
184
|
+
return I.domain = t, I.range = o, I.bandwidth = k, I.step = m, I.indexAt = (g) => d === 0 ? -1 : Math.min(
|
|
182
185
|
d - 1,
|
|
183
186
|
Math.max(
|
|
184
187
|
0,
|
|
185
|
-
Math.floor((
|
|
188
|
+
Math.floor((g - r - m * e + (m - k) / 2) / m)
|
|
186
189
|
)
|
|
187
|
-
),
|
|
188
|
-
},
|
|
190
|
+
), I;
|
|
191
|
+
}, Ut = (t, o, n) => {
|
|
189
192
|
const e = Math.abs(o - t);
|
|
190
193
|
if (e === 0 || !Number.isFinite(e) || n <= 0) return 1;
|
|
191
|
-
const r = e / n,
|
|
192
|
-
return (d >= 7.5 ? 10 : d >= 3.5 ? 5 : d >= 1.5 ? 2 : 1) *
|
|
193
|
-
},
|
|
194
|
+
const r = e / n, i = 10 ** Math.floor(Math.log10(r)), d = r / i;
|
|
195
|
+
return (d >= 7.5 ? 10 : d >= 3.5 ? 5 : d >= 1.5 ? 2 : 1) * i;
|
|
196
|
+
}, Zt = (t, o) => {
|
|
194
197
|
const n = Math.max(0, -Math.floor(Math.log10(o)) + 1);
|
|
195
198
|
return Number(t.toFixed(Math.min(n, 12)));
|
|
196
|
-
},
|
|
199
|
+
}, At = (t, o, n = 5) => {
|
|
197
200
|
if (!Number.isFinite(t) || !Number.isFinite(o)) return [0, 1];
|
|
198
201
|
let e = Math.min(t, o), r = Math.max(t, o);
|
|
199
202
|
if (e === r) {
|
|
@@ -201,16 +204,16 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
201
204
|
const d = Math.abs(e) * 0.5;
|
|
202
205
|
e = e > 0 ? 0 : e - d, r = r < 0 ? 0 : r + d;
|
|
203
206
|
}
|
|
204
|
-
const
|
|
205
|
-
return [
|
|
206
|
-
},
|
|
207
|
+
const i = Ut(e, r, n);
|
|
208
|
+
return [Zt(Math.floor(e / i) * i, i), Zt(Math.ceil(r / i) * i, i)];
|
|
209
|
+
}, ct = (t, o, n = 5) => {
|
|
207
210
|
if (!Number.isFinite(t) || !Number.isFinite(o)) return [];
|
|
208
211
|
if (t === o) return [t];
|
|
209
|
-
const e =
|
|
210
|
-
for (let
|
|
211
|
-
d.push(
|
|
212
|
+
const e = Ut(t, o, n), r = Math.ceil(t / e - 1e-9), i = Math.floor(o / e + 1e-9), d = [];
|
|
213
|
+
for (let m = r; m <= i && d.length < 1e3; m += 1)
|
|
214
|
+
d.push(Zt(m * e, e));
|
|
212
215
|
return d;
|
|
213
|
-
},
|
|
216
|
+
}, Fn = (t, o) => {
|
|
214
217
|
if (t.length === 0) return -1;
|
|
215
218
|
let n = 0, e = t.length - 1;
|
|
216
219
|
for (; n < e; ) {
|
|
@@ -218,277 +221,278 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
218
221
|
t[r] < o ? n = r + 1 : e = r;
|
|
219
222
|
}
|
|
220
223
|
return n > 0 && Math.abs(t[n - 1] - o) <= Math.abs(t[n] - o) ? n - 1 : n;
|
|
221
|
-
},
|
|
224
|
+
}, Ot = (t) => t.filter((o) => typeof o == "number" && Number.isFinite(o)), yt = (t) => {
|
|
222
225
|
if (t.length === 0) return [0, 0];
|
|
223
226
|
let o = t[0], n = t[0];
|
|
224
227
|
for (const e of t)
|
|
225
228
|
e < o && (o = e), e > n && (n = e);
|
|
226
229
|
return [o, n];
|
|
227
|
-
},
|
|
230
|
+
}, Wt = (t, o) => {
|
|
228
231
|
if (t.length === 0) return Number.NaN;
|
|
229
232
|
if (t.length === 1) return t[0];
|
|
230
233
|
const n = (t.length - 1) * Math.min(1, Math.max(0, o)), e = Math.floor(n), r = n - e;
|
|
231
234
|
return e + 1 < t.length ? t[e] + (t[e + 1] - t[e]) * r : t[e];
|
|
232
|
-
},
|
|
233
|
-
const o =
|
|
235
|
+
}, Rn = (t) => {
|
|
236
|
+
const o = Ot(t).sort((d, m) => d - m);
|
|
234
237
|
if (o.length === 0) return null;
|
|
235
|
-
const n =
|
|
238
|
+
const n = Wt(o, 0.25), e = Wt(o, 0.75), r = (e - n) * 1.5, i = o.filter((d) => d >= n - r && d <= e + r);
|
|
236
239
|
return {
|
|
237
240
|
count: o.length,
|
|
238
241
|
min: o[0],
|
|
239
242
|
q1: n,
|
|
240
|
-
median:
|
|
243
|
+
median: Wt(o, 0.5),
|
|
241
244
|
q3: e,
|
|
242
245
|
max: o[o.length - 1],
|
|
243
|
-
whiskerLow:
|
|
244
|
-
whiskerHigh:
|
|
246
|
+
whiskerLow: i[0] ?? n,
|
|
247
|
+
whiskerHigh: i[i.length - 1] ?? e,
|
|
245
248
|
outliers: o.filter((d) => d < n - r || d > e + r)
|
|
246
249
|
};
|
|
247
|
-
},
|
|
248
|
-
const n =
|
|
250
|
+
}, Sn = (t, o) => {
|
|
251
|
+
const n = Ot(t);
|
|
249
252
|
if (n.length === 0) return [];
|
|
250
253
|
const [e, r] = yt(n);
|
|
251
254
|
if (e === r) return [{ from: e, to: e + 1, count: n.length }];
|
|
252
|
-
const
|
|
253
|
-
from:
|
|
254
|
-
to:
|
|
255
|
+
const i = o ?? Math.ceil(Math.log2(n.length)) + 1, d = Ut(e, r, Math.max(1, i)), m = Math.floor(e / d) * d, k = Math.max(1, Math.ceil((r - m) / d - 1e-9)), T = Array.from({ length: k }, (A, I) => ({
|
|
256
|
+
from: m + I * d,
|
|
257
|
+
to: m + (I + 1) * d,
|
|
255
258
|
count: 0
|
|
256
259
|
}));
|
|
257
260
|
for (const A of n) {
|
|
258
|
-
const
|
|
259
|
-
I
|
|
261
|
+
const I = Math.min(T.length - 1, Math.floor((A - m) / d));
|
|
262
|
+
T[I].count += 1;
|
|
260
263
|
}
|
|
261
|
-
return
|
|
262
|
-
}, Nt = (t) => typeof t == "number" && Number.isFinite(t) ? t : null,
|
|
264
|
+
return T;
|
|
265
|
+
}, Nt = (t) => typeof t == "number" && Number.isFinite(t) ? t : null, lt = { top: 12, right: 16, bottom: 28, minLeft: 32 }, Hn = (t, o) => {
|
|
263
266
|
const n = t.map(() => 0), e = t.map(() => 0), r = {};
|
|
264
|
-
for (const
|
|
265
|
-
r[
|
|
266
|
-
const k = Nt(d[
|
|
267
|
+
for (const i of o)
|
|
268
|
+
r[i] = t.map((d, m) => {
|
|
269
|
+
const k = Nt(d[i]) ?? 0;
|
|
267
270
|
if (k >= 0) {
|
|
268
|
-
const A = n[
|
|
269
|
-
return n[
|
|
271
|
+
const A = n[m];
|
|
272
|
+
return n[m] += k, { base: A, top: n[m] };
|
|
270
273
|
}
|
|
271
|
-
const
|
|
272
|
-
return e[
|
|
274
|
+
const T = e[m];
|
|
275
|
+
return e[m] += k, { base: T, top: e[m] };
|
|
273
276
|
});
|
|
274
277
|
return r;
|
|
275
|
-
},
|
|
276
|
-
const { rows: o, xKey: n, series: e, width: r, height:
|
|
278
|
+
}, Ln = (t) => {
|
|
279
|
+
const { rows: o, xKey: n, series: e, width: r, height: i, isStacked: d, curve: m, formatX: k } = t, T = e.some((v) => v.type === "bar"), I = (T && e.every((v) => v.type === "bar") ? t.orientation : "vertical") === "horizontal", g = o.map((v) => v[n]), R = !T && !I && g.length > 1 && g.every((v) => Nt(v) !== null), z = {};
|
|
277
280
|
if (d)
|
|
278
281
|
for (const v of ["left", "right"])
|
|
279
282
|
for (const B of ["bar", "area"]) {
|
|
280
|
-
const W = e.filter((
|
|
281
|
-
Object.assign(
|
|
283
|
+
const W = e.filter((Q) => (Q.axis ?? "left") === v && Q.type === B).map((Q) => Q.key);
|
|
284
|
+
Object.assign(z, Hn(o, W));
|
|
282
285
|
}
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
286
|
+
const S = (v, B) => {
|
|
287
|
+
if (z[v]) return z[v][B];
|
|
285
288
|
const W = Nt(o[B][v]);
|
|
286
289
|
return W === null ? null : { base: 0, top: W };
|
|
287
290
|
}, q = (v) => {
|
|
288
291
|
const B = e.filter((dt) => (dt.axis ?? "left") === v);
|
|
289
292
|
if (B.length === 0) return null;
|
|
290
|
-
let W = Number.POSITIVE_INFINITY,
|
|
293
|
+
let W = Number.POSITIVE_INFINITY, Q = Number.NEGATIVE_INFINITY;
|
|
291
294
|
for (const dt of B)
|
|
292
295
|
for (let Mt = 0; Mt < o.length; Mt += 1) {
|
|
293
|
-
const
|
|
294
|
-
|
|
296
|
+
const ut = S(dt.key, Mt);
|
|
297
|
+
ut && (W = Math.min(W, ut.top, ut.base), Q = Math.max(Q, ut.top, ut.base));
|
|
295
298
|
}
|
|
296
|
-
if (B.some((dt) => dt.type !== "line") && (W = Math.min(W, 0),
|
|
297
|
-
const [at, K] = v === "left" ? t.domain ?? [void 0, void 0] : [void 0, void 0], tt =
|
|
299
|
+
if (B.some((dt) => dt.type !== "line") && (W = Math.min(W, 0), Q = Math.max(Q, 0)), !Number.isFinite(W) || !Number.isFinite(Q)) return [0, 1];
|
|
300
|
+
const [at, K] = v === "left" ? t.domain ?? [void 0, void 0] : [void 0, void 0], tt = At(at ?? W, K ?? Q);
|
|
298
301
|
return [at ?? tt[0], K ?? tt[1]];
|
|
299
|
-
},
|
|
300
|
-
left:
|
|
301
|
-
top:
|
|
302
|
-
right: Math.max(
|
|
303
|
-
bottom: Math.max(
|
|
304
|
-
width: Math.max(1, r -
|
|
305
|
-
height: Math.max(1,
|
|
306
|
-
}, l =
|
|
307
|
-
let
|
|
308
|
-
if (
|
|
309
|
-
const v =
|
|
310
|
-
|
|
302
|
+
}, D = q("left") ?? [0, 1], N = q("right"), C = N !== null && !I, P = t.formatLeft(ct(D[0], D[1], 5)), M = N ? t.formatRight(ct(N[0], N[1], 5)) : [], w = o.map((v) => k(v[n])), h = I ? Math.min(r * 0.4, Math.max(lt.minLeft, ...w.map(mt)) + 12) : Math.max(lt.minLeft, ...P.map(mt)) + 10, p = C ? Math.max(lt.minLeft, ...M.map(mt)) + 10 : lt.right, s = {
|
|
303
|
+
left: h,
|
|
304
|
+
top: lt.top,
|
|
305
|
+
right: Math.max(h + 1, r - p),
|
|
306
|
+
bottom: Math.max(lt.top + 1, i - lt.bottom),
|
|
307
|
+
width: Math.max(1, r - p - h),
|
|
308
|
+
height: Math.max(1, i - lt.bottom - lt.top)
|
|
309
|
+
}, l = I ? [s.top, s.bottom] : [s.left, s.right], c = I ? [s.left, s.right] : [s.bottom, s.top], a = pt(D, c), f = N ? pt(N, c) : a, b = (v) => (v.axis ?? "left") === "right" && N ? f : a;
|
|
310
|
+
let $, y = 0, _ = null;
|
|
311
|
+
if (R) {
|
|
312
|
+
const v = g.map((B) => Nt(B));
|
|
313
|
+
_ = pt(yt(v), l), $ = v.map(_);
|
|
311
314
|
} else {
|
|
312
315
|
const v = Dt(
|
|
313
316
|
o.map((B, W) => String(W)),
|
|
314
317
|
l,
|
|
315
|
-
|
|
318
|
+
T ? { paddingInner: 0.24, paddingOuter: 0.12 } : { paddingInner: 0, paddingOuter: 0 }
|
|
316
319
|
);
|
|
317
|
-
|
|
320
|
+
y = v.bandwidth, $ = o.map((B, W) => v(String(W)) + v.bandwidth / 2);
|
|
318
321
|
}
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
const W =
|
|
322
|
+
const G = (v, B) => I ? { x: B, y: v } : { x: v, y: B }, H = [], j = e.filter((v) => v.type === "bar"), Y = d ? 1 : Math.max(1, j.length), O = Y > 1 ? Math.min(2, y * 0.04) : 0, x = Math.max(1, (y - O * (Y - 1)) / Y);
|
|
323
|
+
j.forEach((v, B) => {
|
|
324
|
+
const W = b(v), Q = d ? 0 : B;
|
|
322
325
|
o.forEach((at, K) => {
|
|
323
|
-
const tt =
|
|
326
|
+
const tt = S(v.key, K);
|
|
324
327
|
if (!tt || tt.top === tt.base) return;
|
|
325
|
-
const dt =
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
const dt = $[K] - y / 2 + Q * (x + O), Mt = W(tt.base), ut = W(tt.top), Jt = Math.min(Mt, ut), Kt = Math.max(1, Math.abs(ut - Mt));
|
|
329
|
+
H.push(
|
|
330
|
+
I ? {
|
|
328
331
|
key: v.key,
|
|
329
332
|
index: K,
|
|
330
333
|
tone: v.tone,
|
|
331
|
-
x:
|
|
334
|
+
x: Jt,
|
|
332
335
|
y: dt,
|
|
333
|
-
width:
|
|
334
|
-
height:
|
|
336
|
+
width: Kt,
|
|
337
|
+
height: x
|
|
335
338
|
} : {
|
|
336
339
|
key: v.key,
|
|
337
340
|
index: K,
|
|
338
341
|
tone: v.tone,
|
|
339
342
|
x: dt,
|
|
340
|
-
y:
|
|
341
|
-
width:
|
|
342
|
-
height:
|
|
343
|
+
y: Jt,
|
|
344
|
+
width: x,
|
|
345
|
+
height: Kt
|
|
343
346
|
}
|
|
344
347
|
);
|
|
345
348
|
});
|
|
346
349
|
});
|
|
347
|
-
const F = {},
|
|
350
|
+
const F = {}, E = [], Z = [];
|
|
348
351
|
for (const v of e) {
|
|
349
352
|
if (v.type === "bar") continue;
|
|
350
|
-
const B =
|
|
351
|
-
const K =
|
|
352
|
-
return K ?
|
|
353
|
+
const B = b(v), W = o.map((Q, at) => {
|
|
354
|
+
const K = S(v.key, at);
|
|
355
|
+
return K ? G($[at], B(K.top)) : null;
|
|
353
356
|
});
|
|
354
357
|
if (F[v.key] = W, v.type === "area") {
|
|
355
|
-
const
|
|
356
|
-
const tt =
|
|
357
|
-
return tt ?
|
|
358
|
+
const Q = o.map((at, K) => {
|
|
359
|
+
const tt = S(v.key, K);
|
|
360
|
+
return tt ? G($[K], B(tt.base)) : null;
|
|
358
361
|
});
|
|
359
|
-
|
|
362
|
+
Z.push({ key: v.key, tone: v.tone, d: Cn(W, Q, m) });
|
|
360
363
|
}
|
|
361
|
-
|
|
364
|
+
E.push({ key: v.key, tone: v.tone, d: In(W, m) });
|
|
362
365
|
}
|
|
363
366
|
const ht = o.map((v, B) => {
|
|
364
367
|
let W = null;
|
|
365
368
|
for (const at of e) {
|
|
366
|
-
const K =
|
|
369
|
+
const K = S(at.key, B);
|
|
367
370
|
if (!K) continue;
|
|
368
|
-
const tt =
|
|
369
|
-
W = W === null ? tt :
|
|
371
|
+
const tt = b(at)(K.top);
|
|
372
|
+
W = W === null ? tt : I ? Math.max(W, tt) : Math.min(W, tt);
|
|
370
373
|
}
|
|
371
|
-
const
|
|
372
|
-
return
|
|
373
|
-
}),
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
374
|
+
const Q = I ? s.left : s.bottom;
|
|
375
|
+
return G($[B], W ?? Q);
|
|
376
|
+
}), It = (v, B, W) => vt(
|
|
377
|
+
ct(
|
|
378
|
+
B[0],
|
|
379
|
+
B[1],
|
|
380
|
+
I ? Math.max(2, Math.floor(s.width / 90)) : Math.max(2, Math.floor(s.height / 48))
|
|
381
|
+
),
|
|
382
|
+
v,
|
|
383
|
+
W
|
|
384
|
+
), $n = _ ? ct(_.domain[0], _.domain[1], Math.max(2, Math.floor(s.width / 90))).map(
|
|
381
385
|
(v) => ({
|
|
382
|
-
position:
|
|
386
|
+
position: _(v),
|
|
383
387
|
label: k(v)
|
|
384
388
|
})
|
|
385
389
|
) : o.map((v, B) => ({
|
|
386
|
-
position:
|
|
387
|
-
label:
|
|
390
|
+
position: $[B],
|
|
391
|
+
label: I ? Gt(w[B], h - 12) : w[B]
|
|
388
392
|
}));
|
|
389
393
|
return {
|
|
390
|
-
zero:
|
|
394
|
+
zero: D[0] < 0 && D[1] > 0 ? a(0) : null,
|
|
391
395
|
area: s,
|
|
392
|
-
centers:
|
|
393
|
-
bandwidth:
|
|
394
|
-
isContinuous:
|
|
395
|
-
categoryTicks:
|
|
396
|
-
leftTicks:
|
|
397
|
-
rightTicks:
|
|
398
|
-
hasRightAxis:
|
|
399
|
-
lines:
|
|
400
|
-
areas:
|
|
401
|
-
bars:
|
|
396
|
+
centers: $,
|
|
397
|
+
bandwidth: y,
|
|
398
|
+
isContinuous: R,
|
|
399
|
+
categoryTicks: $n,
|
|
400
|
+
leftTicks: It(a, D, t.formatLeft),
|
|
401
|
+
rightTicks: C && N ? It(f, N, t.formatRight) : [],
|
|
402
|
+
hasRightAxis: C,
|
|
403
|
+
lines: E,
|
|
404
|
+
areas: Z,
|
|
405
|
+
bars: H,
|
|
402
406
|
points: F,
|
|
403
407
|
anchors: ht
|
|
404
408
|
};
|
|
405
|
-
},
|
|
409
|
+
}, on = (...t) => {
|
|
406
410
|
let o = "";
|
|
407
411
|
for (const n of t)
|
|
408
412
|
n && (o = o === "" ? n : `${o} ${n}`);
|
|
409
413
|
return o;
|
|
410
|
-
},
|
|
414
|
+
}, an = [
|
|
411
415
|
"cat-1",
|
|
412
416
|
"cat-2",
|
|
413
417
|
"cat-3",
|
|
414
418
|
"cat-4",
|
|
415
419
|
"cat-5",
|
|
416
420
|
"series-2"
|
|
417
|
-
],
|
|
418
|
-
chart:
|
|
419
|
-
chart__canvas:
|
|
420
|
-
chart__svg:
|
|
421
|
-
chart__overlay:
|
|
422
|
-
chart__tooltip:
|
|
423
|
-
chart__tooltipTitle:
|
|
424
|
-
chart__tooltipRow:
|
|
425
|
-
chart__tooltipLabel:
|
|
426
|
-
chart__tooltipValue:
|
|
427
|
-
chart__swatch:
|
|
428
|
-
chart__legend:
|
|
429
|
-
chart__legendItem:
|
|
421
|
+
], St = (t, o) => o ?? an[t % an.length], U = (t) => t === "muted" ? "var(--hanui-text-3)" : `var(--hanui-${t})`, En = "hanui-chart-iR-5u", zn = "hanui-chart__canvas-4wf8o", Pn = "hanui-chart__svg-yC5iw", Dn = "hanui-chart__overlay-kbXEv", Gn = "hanui-chart__tooltip-wbhLY", qn = "hanui-chart__tooltipTitle-j-1Nw", On = "hanui-chart__tooltipRow-phors", Bn = "hanui-chart__tooltipLabel-72x80", Wn = "hanui-chart__tooltipValue-caeby", Vn = "hanui-chart__swatch--mk77", jn = "hanui-chart__legend-EhXcQ", Xn = "hanui-chart__legendItem--AaGe", Yn = "hanui-chart__srOnly-Oyem2", J = {
|
|
422
|
+
chart: En,
|
|
423
|
+
chart__canvas: zn,
|
|
424
|
+
chart__svg: Pn,
|
|
425
|
+
chart__overlay: Dn,
|
|
426
|
+
chart__tooltip: Gn,
|
|
427
|
+
chart__tooltipTitle: qn,
|
|
428
|
+
chart__tooltipRow: On,
|
|
429
|
+
chart__tooltipLabel: Bn,
|
|
430
|
+
chart__tooltipValue: Wn,
|
|
431
|
+
chart__swatch: Vn,
|
|
432
|
+
chart__legend: jn,
|
|
433
|
+
chart__legendItem: Xn,
|
|
430
434
|
"chart__legendItem--hidden": "hanui-chart__legendItem--hidden-D3li8",
|
|
431
|
-
chart__srOnly:
|
|
432
|
-
},
|
|
435
|
+
chart__srOnly: Yn
|
|
436
|
+
}, sn = 12, gt = ({
|
|
433
437
|
label: t,
|
|
434
438
|
description: o,
|
|
435
439
|
containerRef: n,
|
|
436
440
|
width: e,
|
|
437
441
|
height: r,
|
|
438
|
-
plot:
|
|
442
|
+
plot: i,
|
|
439
443
|
overlay: d,
|
|
440
|
-
underlay:
|
|
444
|
+
underlay: m,
|
|
441
445
|
itemCount: k,
|
|
442
|
-
columns:
|
|
446
|
+
columns: T,
|
|
443
447
|
pick: A,
|
|
444
|
-
tooltip:
|
|
445
|
-
anchor:
|
|
446
|
-
tooltipSide:
|
|
447
|
-
announce:
|
|
448
|
-
table:
|
|
448
|
+
tooltip: I,
|
|
449
|
+
anchor: g,
|
|
450
|
+
tooltipSide: R = "inward",
|
|
451
|
+
announce: z,
|
|
452
|
+
table: S,
|
|
449
453
|
legend: q,
|
|
450
|
-
className:
|
|
454
|
+
className: D,
|
|
451
455
|
testId: N
|
|
452
456
|
}) => {
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
M !== null && M >= k &&
|
|
456
|
-
}, [M, k]),
|
|
457
|
+
const C = yn(), P = wn(), [M, w] = Tt(null), h = Pt(null), p = Pt(null), s = Pt(null);
|
|
458
|
+
tn(() => {
|
|
459
|
+
M !== null && M >= k && w(k > 0 ? k - 1 : null);
|
|
460
|
+
}, [M, k]), tn(
|
|
457
461
|
() => () => {
|
|
458
|
-
|
|
462
|
+
h.current !== null && cancelAnimationFrame(h.current);
|
|
459
463
|
},
|
|
460
464
|
[]
|
|
461
465
|
);
|
|
462
466
|
const l = nt(
|
|
463
|
-
(
|
|
464
|
-
const
|
|
465
|
-
s.current = { x:
|
|
466
|
-
|
|
467
|
-
const
|
|
468
|
-
|
|
467
|
+
(y) => {
|
|
468
|
+
const _ = y.currentTarget.getBoundingClientRect();
|
|
469
|
+
s.current = { x: y.clientX - _.left, y: y.clientY - _.top }, h.current === null && (h.current = requestAnimationFrame(() => {
|
|
470
|
+
h.current = null;
|
|
471
|
+
const G = s.current;
|
|
472
|
+
G && w(A(G.x, G.y));
|
|
469
473
|
}));
|
|
470
474
|
},
|
|
471
475
|
[A]
|
|
472
|
-
), c = (
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
}, a = (
|
|
476
|
+
), c = (y) => {
|
|
477
|
+
const _ = Math.min(k - 1, Math.max(0, y));
|
|
478
|
+
w(_), P(z(_));
|
|
479
|
+
}, a = (y) => {
|
|
476
480
|
if (k === 0) return;
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
479
|
-
|
|
481
|
+
const _ = M ?? -1, G = T ?? 1, H = y.key === "ArrowRight" ? _ + 1 : y.key === "ArrowLeft" ? Math.max(0, _ - 1) : y.key === "ArrowDown" ? _ < 0 ? 0 : _ + G : y.key === "ArrowUp" ? Math.max(0, _ - G) : y.key === "Home" ? 0 : y.key === "End" ? k - 1 : null;
|
|
482
|
+
if (y.key === "Escape" && M !== null) {
|
|
483
|
+
y.preventDefault(), w(null);
|
|
480
484
|
return;
|
|
481
485
|
}
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
return
|
|
485
|
-
const
|
|
486
|
-
if (!
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
}, [M,
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
/* @__PURE__ */
|
|
486
|
+
H !== null && (y.preventDefault(), c(H));
|
|
487
|
+
}, f = M === null ? null : I(M), b = M === null ? null : g(M), $ = b == null ? void 0 : b.x;
|
|
488
|
+
return xn(() => {
|
|
489
|
+
const y = p.current;
|
|
490
|
+
if (!y || $ === void 0) return;
|
|
491
|
+
const _ = y.offsetWidth, G = $ > e / 2, H = R === "outward" ? !G : G, j = $ - sn - _, Y = $ + sn, O = j >= 0, x = Y + _ <= e, F = R === "outward" ? H ? j : Y : H ? O || !x ? j : Y : x || !O ? Y : j;
|
|
492
|
+
y.style.left = `${Math.min(Math.max(0, F), Math.max(0, e - _))}px`;
|
|
493
|
+
}, [M, $, e, R]), /* @__PURE__ */ X("figure", { className: on(J.chart, D), "data-testid": N, children: [
|
|
494
|
+
/* @__PURE__ */ X("div", { ref: n, className: J.chart__canvas, style: { blockSize: r }, children: [
|
|
495
|
+
/* @__PURE__ */ X(
|
|
492
496
|
"svg",
|
|
493
497
|
{
|
|
494
498
|
className: J.chart__svg,
|
|
@@ -497,223 +501,247 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
497
501
|
viewBox: `0 0 ${e} ${r}`,
|
|
498
502
|
role: "img",
|
|
499
503
|
"aria-label": t,
|
|
500
|
-
"aria-describedby": o ?
|
|
504
|
+
"aria-describedby": o ? C : void 0,
|
|
501
505
|
tabIndex: k > 0 ? 0 : void 0,
|
|
502
506
|
onPointerMove: l,
|
|
503
507
|
onPointerDown: l,
|
|
504
|
-
onPointerLeave: () =>
|
|
508
|
+
onPointerLeave: () => w(null),
|
|
505
509
|
onKeyDown: a,
|
|
506
|
-
onBlur: () =>
|
|
510
|
+
onBlur: () => w(null),
|
|
507
511
|
children: [
|
|
508
|
-
M !== null &&
|
|
509
|
-
|
|
510
|
-
M !== null && /* @__PURE__ */
|
|
512
|
+
M !== null && m && /* @__PURE__ */ u("g", { className: J.chart__overlay, children: m(M) }),
|
|
513
|
+
i,
|
|
514
|
+
M !== null && /* @__PURE__ */ u("g", { className: J.chart__overlay, children: d(M) })
|
|
511
515
|
]
|
|
512
516
|
}
|
|
513
517
|
),
|
|
514
|
-
|
|
515
|
-
/* @__PURE__ */
|
|
518
|
+
f && b && /* Okunan karşılığı duyuru ve tablo; ipucu yalnızca görsel. */
|
|
519
|
+
/* @__PURE__ */ X(
|
|
516
520
|
"div",
|
|
517
521
|
{
|
|
518
|
-
ref:
|
|
522
|
+
ref: p,
|
|
519
523
|
"aria-hidden": !0,
|
|
520
524
|
className: J.chart__tooltip,
|
|
521
|
-
style: { insetBlockStart: Math.max(24, Math.min(
|
|
525
|
+
style: { insetBlockStart: Math.max(24, Math.min(b.y, r - 24)) },
|
|
522
526
|
children: [
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
527
|
+
f.title && /* @__PURE__ */ u("span", { className: J.chart__tooltipTitle, children: f.title }),
|
|
528
|
+
f.rows.map((y) => /* @__PURE__ */ X("span", { className: J.chart__tooltipRow, children: [
|
|
529
|
+
y.tone && /* @__PURE__ */ u(
|
|
526
530
|
"span",
|
|
527
531
|
{
|
|
528
532
|
className: J.chart__swatch,
|
|
529
|
-
style: { backgroundColor:
|
|
533
|
+
style: { backgroundColor: U(y.tone) }
|
|
530
534
|
}
|
|
531
535
|
),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
] },
|
|
536
|
+
/* @__PURE__ */ u("span", { className: J.chart__tooltipLabel, children: y.label }),
|
|
537
|
+
/* @__PURE__ */ u("span", { className: J.chart__tooltipValue, children: y.value })
|
|
538
|
+
] }, y.id))
|
|
535
539
|
]
|
|
536
540
|
}
|
|
537
541
|
)
|
|
538
542
|
] }),
|
|
539
|
-
q && q.entries.length > 1 && /* @__PURE__ */
|
|
540
|
-
const
|
|
541
|
-
return /* @__PURE__ */
|
|
543
|
+
q && q.entries.length > 1 && /* @__PURE__ */ u("ul", { className: J.chart__legend, children: q.entries.map((y) => {
|
|
544
|
+
const _ = q.hidden.has(y.id);
|
|
545
|
+
return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ X(
|
|
542
546
|
"button",
|
|
543
547
|
{
|
|
544
548
|
type: "button",
|
|
545
|
-
className:
|
|
549
|
+
className: on(
|
|
546
550
|
J.chart__legendItem,
|
|
547
|
-
|
|
551
|
+
_ && J["chart__legendItem--hidden"]
|
|
548
552
|
),
|
|
549
|
-
"aria-pressed": !
|
|
550
|
-
onClick: () => q.onToggle(
|
|
553
|
+
"aria-pressed": !_,
|
|
554
|
+
onClick: () => q.onToggle(y.id),
|
|
551
555
|
children: [
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
|
|
556
|
+
/* @__PURE__ */ u(Zn, { tone: y.tone, isHidden: _ }),
|
|
557
|
+
y.label
|
|
554
558
|
]
|
|
555
559
|
}
|
|
556
|
-
) },
|
|
560
|
+
) }, y.id);
|
|
557
561
|
}) }),
|
|
558
|
-
o && /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
(
|
|
564
|
-
) },
|
|
562
|
+
o && /* @__PURE__ */ u("p", { id: C, className: J.chart__srOnly, children: o }),
|
|
563
|
+
/* @__PURE__ */ u("div", { className: J.chart__srOnly, children: /* @__PURE__ */ X("table", { children: [
|
|
564
|
+
/* @__PURE__ */ u("caption", { children: t }),
|
|
565
|
+
/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: S.columns.map((y, _) => /* @__PURE__ */ u("th", { scope: "col", children: y }, _)) }) }),
|
|
566
|
+
/* @__PURE__ */ u("tbody", { children: S.rows.map((y, _) => /* @__PURE__ */ u("tr", { children: y.map(
|
|
567
|
+
(G, H) => H === 0 ? /* @__PURE__ */ u("th", { scope: "row", children: G }, H) : /* @__PURE__ */ u("td", { children: G }, H)
|
|
568
|
+
) }, _)) })
|
|
565
569
|
] }) })
|
|
566
570
|
] });
|
|
567
|
-
},
|
|
571
|
+
}, Zn = ({ tone: t, isHidden: o }) => /* @__PURE__ */ u(
|
|
568
572
|
"span",
|
|
569
573
|
{
|
|
570
574
|
"aria-hidden": !0,
|
|
571
575
|
className: J.chart__swatch,
|
|
572
|
-
style: o ? { backgroundColor: "transparent", boxShadow: `inset 0 0 0 2px ${
|
|
576
|
+
style: o ? { backgroundColor: "transparent", boxShadow: `inset 0 0 0 2px ${U(t)}` } : { backgroundColor: U(t) }
|
|
573
577
|
}
|
|
574
|
-
),
|
|
578
|
+
), rn = /* @__PURE__ */ new Map(), Mn = (t, o) => {
|
|
575
579
|
const n = `${t ?? ""}|${JSON.stringify(o)}`;
|
|
576
|
-
let e =
|
|
577
|
-
return e || (e = new Intl.NumberFormat(t, o),
|
|
578
|
-
},
|
|
579
|
-
|
|
580
|
-
const o =
|
|
581
|
-
return
|
|
580
|
+
let e = rn.get(n);
|
|
581
|
+
return e || (e = new Intl.NumberFormat(t, o), rn.set(n, e)), e;
|
|
582
|
+
}, cn = (t) => {
|
|
583
|
+
if (t === 0 || !Number.isFinite(t)) return null;
|
|
584
|
+
const [o, n] = Math.abs(t).toExponential(9).split("e"), e = Number(n);
|
|
585
|
+
return { first: e, last: e - (o.replace(".", "").replace(/0+$/, "").length - 1) };
|
|
586
|
+
}, Ht = (t) => (o) => {
|
|
587
|
+
const n = o.reduce(
|
|
588
|
+
(e, r) => {
|
|
589
|
+
var i;
|
|
590
|
+
return Math.min(e, ((i = cn(r)) == null ? void 0 : i.last) ?? e);
|
|
591
|
+
},
|
|
592
|
+
Number.POSITIVE_INFINITY
|
|
593
|
+
);
|
|
594
|
+
return o.map(
|
|
595
|
+
(e) => {
|
|
596
|
+
var r;
|
|
597
|
+
return Mn(t, {
|
|
598
|
+
notation: "compact",
|
|
599
|
+
maximumSignificantDigits: Math.min(
|
|
600
|
+
21,
|
|
601
|
+
Math.max(1, (((r = cn(e)) == null ? void 0 : r.first) ?? 0) - n + 1)
|
|
602
|
+
)
|
|
603
|
+
}).format(e);
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
}, bt = (t) => (o) => Mn(t, { maximumFractionDigits: 2 }).format(o), Un = 640, Qn = typeof window > "u" ? () => {
|
|
607
|
+
} : xn, _t = (t) => {
|
|
608
|
+
const o = Pt(null), [n, e] = Tt(t ?? Un);
|
|
609
|
+
return Qn(() => {
|
|
582
610
|
if (t !== void 0) {
|
|
583
611
|
e(t);
|
|
584
612
|
return;
|
|
585
613
|
}
|
|
586
614
|
const r = o.current;
|
|
587
615
|
if (!r) return;
|
|
588
|
-
const
|
|
589
|
-
const k = Math.floor(
|
|
590
|
-
k > 0 && e((
|
|
616
|
+
const i = (m) => {
|
|
617
|
+
const k = Math.floor(m);
|
|
618
|
+
k > 0 && e((T) => T === k ? T : k);
|
|
591
619
|
};
|
|
592
|
-
if (
|
|
593
|
-
const d = new ResizeObserver(([
|
|
620
|
+
if (i(r.clientWidth), typeof ResizeObserver > "u") return;
|
|
621
|
+
const d = new ResizeObserver(([m]) => i(m.contentRect.width));
|
|
594
622
|
return d.observe(r), () => d.disconnect();
|
|
595
623
|
}, [t]), [o, n];
|
|
596
|
-
},
|
|
597
|
-
line:
|
|
598
|
-
area:
|
|
599
|
-
bar:
|
|
600
|
-
point:
|
|
601
|
-
marker:
|
|
602
|
-
crosshair:
|
|
603
|
-
band:
|
|
604
|
-
zero:
|
|
605
|
-
},
|
|
624
|
+
}, Jn = "hanui-line-CLpqU", Kn = "hanui-area-LkWXB", te = "hanui-bar-260Bd", ne = "hanui-point-Vc-kX", ee = "hanui-marker-G-xZb", oe = "hanui-crosshair-nV-xX", ae = "hanui-band-jnG7s", se = "hanui-zero-GpHvw", st = {
|
|
625
|
+
line: Jn,
|
|
626
|
+
area: Kn,
|
|
627
|
+
bar: te,
|
|
628
|
+
point: ne,
|
|
629
|
+
marker: ee,
|
|
630
|
+
crosshair: oe,
|
|
631
|
+
band: ae,
|
|
632
|
+
zero: se
|
|
633
|
+
}, re = 280, ln = "—", ce = ({
|
|
606
634
|
label: t,
|
|
607
635
|
description: o,
|
|
608
636
|
data: n,
|
|
609
637
|
xKey: e,
|
|
610
638
|
xLabel: r,
|
|
611
|
-
series:
|
|
612
|
-
height: d =
|
|
613
|
-
width:
|
|
639
|
+
series: i,
|
|
640
|
+
height: d = re,
|
|
641
|
+
width: m,
|
|
614
642
|
isStacked: k = !1,
|
|
615
|
-
orientation:
|
|
643
|
+
orientation: T = "vertical",
|
|
616
644
|
curve: A = "monotone",
|
|
617
|
-
hasPoints:
|
|
618
|
-
formatX:
|
|
619
|
-
formatValue:
|
|
620
|
-
domain:
|
|
621
|
-
className:
|
|
645
|
+
hasPoints: I = !1,
|
|
646
|
+
formatX: g = String,
|
|
647
|
+
formatValue: R,
|
|
648
|
+
domain: z,
|
|
649
|
+
className: S,
|
|
622
650
|
testId: q
|
|
623
651
|
}) => {
|
|
624
|
-
const { labels:
|
|
625
|
-
(
|
|
626
|
-
[
|
|
652
|
+
const { labels: D } = xt(), N = D == null ? void 0 : D.locale, [C, P] = _t(m), [M, w] = Tt(() => /* @__PURE__ */ new Set()), h = L(() => R ?? bt(N), [R, N]), p = L(() => Ht(N), [N]), s = nt(
|
|
653
|
+
(x) => x == null ? "" : g(x),
|
|
654
|
+
[g]
|
|
627
655
|
), l = L(
|
|
628
|
-
() =>
|
|
629
|
-
[
|
|
630
|
-
), c = L(() => l.filter((
|
|
631
|
-
() =>
|
|
656
|
+
() => i.map((x, F) => ({ ...x, tone: St(F, x.tone) })),
|
|
657
|
+
[i]
|
|
658
|
+
), c = L(() => l.filter((x) => !M.has(x.key)), [l, M]), a = L(
|
|
659
|
+
() => Ln({
|
|
632
660
|
rows: n,
|
|
633
661
|
xKey: e,
|
|
634
662
|
series: c,
|
|
635
|
-
width:
|
|
663
|
+
width: P,
|
|
636
664
|
height: d,
|
|
637
665
|
isStacked: k,
|
|
638
|
-
orientation:
|
|
666
|
+
orientation: T,
|
|
639
667
|
curve: A,
|
|
640
668
|
formatX: s,
|
|
641
|
-
formatLeft:
|
|
642
|
-
formatRight:
|
|
643
|
-
domain:
|
|
669
|
+
formatLeft: p,
|
|
670
|
+
formatRight: p,
|
|
671
|
+
domain: z
|
|
644
672
|
}),
|
|
645
673
|
[
|
|
646
674
|
n,
|
|
647
675
|
e,
|
|
648
676
|
c,
|
|
649
|
-
|
|
677
|
+
P,
|
|
650
678
|
d,
|
|
651
679
|
k,
|
|
652
|
-
|
|
680
|
+
T,
|
|
653
681
|
A,
|
|
654
682
|
s,
|
|
655
|
-
|
|
656
|
-
|
|
683
|
+
p,
|
|
684
|
+
z
|
|
657
685
|
]
|
|
658
|
-
),
|
|
659
|
-
const
|
|
660
|
-
return { centers:
|
|
661
|
-
}, [a.centers]),
|
|
662
|
-
(
|
|
663
|
-
const { area:
|
|
664
|
-
if (
|
|
686
|
+
), f = T === "horizontal" && c.length > 0 && c.every((x) => x.type === "bar"), b = c.some((x) => x.type === "bar"), $ = L(() => {
|
|
687
|
+
const x = a.centers.map((F, E) => ({ center: F, index: E })).sort((F, E) => F.center - E.center);
|
|
688
|
+
return { centers: x.map((F) => F.center), indices: x.map((F) => F.index) };
|
|
689
|
+
}, [a.centers]), y = nt(
|
|
690
|
+
(x, F) => {
|
|
691
|
+
const { area: E } = a;
|
|
692
|
+
if (x < E.left - 4 || x > E.right + 4 || F < E.top - 4 || F > E.bottom + 4)
|
|
665
693
|
return null;
|
|
666
|
-
const
|
|
667
|
-
return
|
|
694
|
+
const Z = Fn($.centers, f ? F : x);
|
|
695
|
+
return Z < 0 ? null : $.indices[Z];
|
|
668
696
|
},
|
|
669
|
-
[a,
|
|
670
|
-
),
|
|
671
|
-
(
|
|
697
|
+
[a, $, f]
|
|
698
|
+
), _ = nt(
|
|
699
|
+
(x) => {
|
|
672
700
|
var F;
|
|
673
701
|
return {
|
|
674
|
-
title: s((F = n[
|
|
675
|
-
rows: c.map((
|
|
702
|
+
title: s((F = n[x]) == null ? void 0 : F[e]),
|
|
703
|
+
rows: c.map((E) => {
|
|
676
704
|
var ht;
|
|
677
|
-
const
|
|
705
|
+
const Z = Nt((ht = n[x]) == null ? void 0 : ht[E.key]);
|
|
678
706
|
return {
|
|
679
|
-
id:
|
|
680
|
-
label:
|
|
681
|
-
tone:
|
|
682
|
-
value:
|
|
707
|
+
id: E.key,
|
|
708
|
+
label: E.label,
|
|
709
|
+
tone: E.tone,
|
|
710
|
+
value: Z === null ? ln : (E.format ?? h)(Z)
|
|
683
711
|
};
|
|
684
712
|
})
|
|
685
713
|
};
|
|
686
714
|
},
|
|
687
|
-
[n, e, c,
|
|
688
|
-
),
|
|
689
|
-
(
|
|
690
|
-
const F =
|
|
691
|
-
return `${F.title}: ${F.rows.map((
|
|
715
|
+
[n, e, c, h, s]
|
|
716
|
+
), G = nt(
|
|
717
|
+
(x) => {
|
|
718
|
+
const F = _(x);
|
|
719
|
+
return `${F.title}: ${F.rows.map((E) => `${E.label} ${E.value}`).join(", ")}`;
|
|
692
720
|
},
|
|
693
|
-
[
|
|
694
|
-
),
|
|
721
|
+
[_]
|
|
722
|
+
), H = L(
|
|
695
723
|
() => ({
|
|
696
|
-
columns: [r ?? e, ...l.map((
|
|
697
|
-
rows: n.map((
|
|
698
|
-
s(
|
|
724
|
+
columns: [r ?? e, ...l.map((x) => x.label)],
|
|
725
|
+
rows: n.map((x) => [
|
|
726
|
+
s(x[e]),
|
|
699
727
|
...l.map((F) => {
|
|
700
|
-
const
|
|
701
|
-
return
|
|
728
|
+
const E = Nt(x[F.key]);
|
|
729
|
+
return E === null ? ln : (F.format ?? h)(E);
|
|
702
730
|
})
|
|
703
731
|
])
|
|
704
732
|
}),
|
|
705
|
-
[n, e, r, l,
|
|
706
|
-
),
|
|
707
|
-
() => /* @__PURE__ */
|
|
708
|
-
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
] }) : /* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
a.hasRightAxis && /* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
733
|
+
[n, e, r, l, h, s]
|
|
734
|
+
), j = L(
|
|
735
|
+
() => /* @__PURE__ */ X("g", { children: [
|
|
736
|
+
f ? /* @__PURE__ */ X(Ft, { children: [
|
|
737
|
+
/* @__PURE__ */ u(ft, { area: a.area, ticks: a.leftTicks, side: "bottom", hasGrid: !0 }),
|
|
738
|
+
/* @__PURE__ */ u(Yt, { area: a.area, ticks: a.categoryTicks, side: "left" })
|
|
739
|
+
] }) : /* @__PURE__ */ X(Ft, { children: [
|
|
740
|
+
/* @__PURE__ */ u(ft, { area: a.area, ticks: a.leftTicks, side: "left", hasGrid: !0 }),
|
|
741
|
+
a.hasRightAxis && /* @__PURE__ */ u(ft, { area: a.area, ticks: a.rightTicks, side: "right" }),
|
|
742
|
+
/* @__PURE__ */ u(Yt, { area: a.area, ticks: a.categoryTicks, side: "bottom" })
|
|
715
743
|
] }),
|
|
716
|
-
a.zero !== null && (
|
|
744
|
+
a.zero !== null && (f ? /* @__PURE__ */ u(
|
|
717
745
|
"line",
|
|
718
746
|
{
|
|
719
747
|
className: st.zero,
|
|
@@ -722,7 +750,7 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
722
750
|
y1: a.area.top,
|
|
723
751
|
y2: a.area.bottom
|
|
724
752
|
}
|
|
725
|
-
) : /* @__PURE__ */
|
|
753
|
+
) : /* @__PURE__ */ u(
|
|
726
754
|
"line",
|
|
727
755
|
{
|
|
728
756
|
className: st.zero,
|
|
@@ -732,589 +760,586 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
732
760
|
y2: a.zero
|
|
733
761
|
}
|
|
734
762
|
)),
|
|
735
|
-
a.areas.map((
|
|
763
|
+
a.areas.map((x) => /* @__PURE__ */ u(
|
|
736
764
|
"path",
|
|
737
765
|
{
|
|
738
|
-
d:
|
|
766
|
+
d: x.d,
|
|
739
767
|
className: st.area,
|
|
740
|
-
style: { fill: `color-mix(in srgb, ${
|
|
768
|
+
style: { fill: `color-mix(in srgb, ${U(x.tone)} 18%, transparent)` }
|
|
741
769
|
},
|
|
742
|
-
`area-${
|
|
770
|
+
`area-${x.key}`
|
|
743
771
|
)),
|
|
744
|
-
a.bars.map((
|
|
772
|
+
a.bars.map((x) => /* @__PURE__ */ u(
|
|
745
773
|
"rect",
|
|
746
774
|
{
|
|
747
775
|
className: st.bar,
|
|
748
|
-
x:
|
|
749
|
-
y:
|
|
750
|
-
width:
|
|
751
|
-
height:
|
|
752
|
-
rx: Math.min(3,
|
|
753
|
-
style: { fill:
|
|
776
|
+
x: x.x,
|
|
777
|
+
y: x.y,
|
|
778
|
+
width: x.width,
|
|
779
|
+
height: x.height,
|
|
780
|
+
rx: Math.min(3, x.width / 4, x.height / 4),
|
|
781
|
+
style: { fill: U(x.tone) }
|
|
754
782
|
},
|
|
755
|
-
`bar-${
|
|
783
|
+
`bar-${x.key}-${x.index}`
|
|
756
784
|
)),
|
|
757
|
-
a.lines.map((
|
|
785
|
+
a.lines.map((x) => /* @__PURE__ */ u(
|
|
758
786
|
"path",
|
|
759
787
|
{
|
|
760
|
-
d:
|
|
788
|
+
d: x.d,
|
|
761
789
|
className: st.line,
|
|
762
|
-
style: { stroke:
|
|
790
|
+
style: { stroke: U(x.tone) }
|
|
763
791
|
},
|
|
764
|
-
`line-${
|
|
792
|
+
`line-${x.key}`
|
|
765
793
|
)),
|
|
766
|
-
c.filter((
|
|
767
|
-
(
|
|
768
|
-
(F,
|
|
794
|
+
c.filter((x) => x.type !== "bar").flatMap(
|
|
795
|
+
(x) => (a.points[x.key] ?? []).map(
|
|
796
|
+
(F, E, Z) => F && (I || !Z[E - 1] && !Z[E + 1]) ? /* @__PURE__ */ u(
|
|
769
797
|
"circle",
|
|
770
798
|
{
|
|
771
799
|
className: st.point,
|
|
772
800
|
cx: F.x,
|
|
773
801
|
cy: F.y,
|
|
774
802
|
r: 3,
|
|
775
|
-
style: { fill:
|
|
803
|
+
style: { fill: U(x.tone) }
|
|
776
804
|
},
|
|
777
|
-
`point-${
|
|
805
|
+
`point-${x.key}-${E}`
|
|
778
806
|
) : null
|
|
779
807
|
)
|
|
780
808
|
)
|
|
781
809
|
] }),
|
|
782
|
-
[a,
|
|
783
|
-
),
|
|
784
|
-
(
|
|
785
|
-
if (!
|
|
786
|
-
const { area: F } = a,
|
|
787
|
-
return
|
|
810
|
+
[a, I, f, c]
|
|
811
|
+
), Y = nt(
|
|
812
|
+
(x) => {
|
|
813
|
+
if (!b || a.bandwidth <= 0) return null;
|
|
814
|
+
const { area: F } = a, E = a.centers[x], Z = a.bandwidth * 0.12;
|
|
815
|
+
return f ? /* @__PURE__ */ u(
|
|
788
816
|
"rect",
|
|
789
817
|
{
|
|
790
818
|
className: st.band,
|
|
791
819
|
x: F.left,
|
|
792
820
|
width: F.width,
|
|
793
|
-
y:
|
|
794
|
-
height: a.bandwidth +
|
|
821
|
+
y: E - a.bandwidth / 2 - Z,
|
|
822
|
+
height: a.bandwidth + Z * 2
|
|
795
823
|
}
|
|
796
|
-
) : /* @__PURE__ */
|
|
824
|
+
) : /* @__PURE__ */ u(
|
|
797
825
|
"rect",
|
|
798
826
|
{
|
|
799
827
|
className: st.band,
|
|
800
828
|
y: F.top,
|
|
801
829
|
height: F.height,
|
|
802
|
-
x:
|
|
803
|
-
width: a.bandwidth +
|
|
830
|
+
x: E - a.bandwidth / 2 - Z,
|
|
831
|
+
width: a.bandwidth + Z * 2
|
|
804
832
|
}
|
|
805
833
|
);
|
|
806
834
|
},
|
|
807
|
-
[a,
|
|
808
|
-
),
|
|
809
|
-
(
|
|
810
|
-
const { area: F } = a,
|
|
811
|
-
return /* @__PURE__ */
|
|
812
|
-
!
|
|
835
|
+
[a, f, b]
|
|
836
|
+
), O = nt(
|
|
837
|
+
(x) => {
|
|
838
|
+
const { area: F } = a, E = a.centers[x];
|
|
839
|
+
return /* @__PURE__ */ X(Ft, { children: [
|
|
840
|
+
!b && /* @__PURE__ */ u(
|
|
813
841
|
"line",
|
|
814
842
|
{
|
|
815
843
|
className: st.crosshair,
|
|
816
|
-
x1:
|
|
817
|
-
x2:
|
|
844
|
+
x1: E,
|
|
845
|
+
x2: E,
|
|
818
846
|
y1: F.top,
|
|
819
847
|
y2: F.bottom
|
|
820
848
|
}
|
|
821
849
|
),
|
|
822
|
-
c.filter((
|
|
823
|
-
var
|
|
824
|
-
const ht = (
|
|
825
|
-
return ht ? /* @__PURE__ */
|
|
850
|
+
c.filter((Z) => Z.type !== "bar").map((Z) => {
|
|
851
|
+
var It;
|
|
852
|
+
const ht = (It = a.points[Z.key]) == null ? void 0 : It[x];
|
|
853
|
+
return ht ? /* @__PURE__ */ u(
|
|
826
854
|
"circle",
|
|
827
855
|
{
|
|
828
856
|
className: st.marker,
|
|
829
857
|
cx: ht.x,
|
|
830
858
|
cy: ht.y,
|
|
831
859
|
r: 4.5,
|
|
832
|
-
style: { fill:
|
|
860
|
+
style: { fill: U(Z.tone) }
|
|
833
861
|
},
|
|
834
|
-
|
|
862
|
+
Z.key
|
|
835
863
|
) : null;
|
|
836
864
|
})
|
|
837
865
|
] });
|
|
838
866
|
},
|
|
839
|
-
[a, c,
|
|
867
|
+
[a, c, b]
|
|
840
868
|
);
|
|
841
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ u(
|
|
842
870
|
gt,
|
|
843
871
|
{
|
|
844
872
|
label: t,
|
|
845
873
|
description: o,
|
|
846
|
-
containerRef:
|
|
847
|
-
width:
|
|
874
|
+
containerRef: C,
|
|
875
|
+
width: P,
|
|
848
876
|
height: d,
|
|
849
|
-
plot:
|
|
850
|
-
overlay:
|
|
851
|
-
underlay:
|
|
877
|
+
plot: j,
|
|
878
|
+
overlay: O,
|
|
879
|
+
underlay: Y,
|
|
852
880
|
itemCount: n.length,
|
|
853
|
-
pick:
|
|
854
|
-
tooltip:
|
|
855
|
-
anchor: (
|
|
856
|
-
announce:
|
|
857
|
-
table:
|
|
881
|
+
pick: y,
|
|
882
|
+
tooltip: _,
|
|
883
|
+
anchor: (x) => a.anchors[x] ?? { x: 0, y: 0 },
|
|
884
|
+
announce: G,
|
|
885
|
+
table: H,
|
|
858
886
|
legend: {
|
|
859
|
-
entries: l.map((
|
|
887
|
+
entries: l.map((x) => ({ id: x.key, label: x.label, tone: x.tone })),
|
|
860
888
|
hidden: M,
|
|
861
|
-
onToggle: (
|
|
862
|
-
const
|
|
863
|
-
return
|
|
889
|
+
onToggle: (x) => w((F) => {
|
|
890
|
+
const E = new Set(F);
|
|
891
|
+
return E.has(x) ? E.delete(x) : l.length - F.size > 1 && E.add(x), E;
|
|
864
892
|
})
|
|
865
893
|
},
|
|
866
|
-
className:
|
|
894
|
+
className: S,
|
|
867
895
|
testId: q
|
|
868
896
|
}
|
|
869
897
|
);
|
|
870
|
-
},
|
|
898
|
+
}, Bt = ot(ce), ie = ({ series: t, ...o }) => {
|
|
871
899
|
const n = L(() => t.map((e) => ({ ...e, type: "line" })), [t]);
|
|
872
|
-
return /* @__PURE__ */
|
|
873
|
-
},
|
|
900
|
+
return /* @__PURE__ */ u(Bt, { ...o, series: n });
|
|
901
|
+
}, je = /* @__PURE__ */ ot(/* @__PURE__ */ it(ie, "LineChart")), le = ({ series: t, ...o }) => {
|
|
874
902
|
const n = L(() => t.map((e) => ({ ...e, type: "area" })), [t]);
|
|
875
|
-
return /* @__PURE__ */
|
|
876
|
-
},
|
|
903
|
+
return /* @__PURE__ */ u(Bt, { ...o, series: n });
|
|
904
|
+
}, Xe = /* @__PURE__ */ ot(/* @__PURE__ */ it(le, "AreaChart")), he = ({ series: t, ...o }) => {
|
|
877
905
|
const n = L(() => t.map((e) => ({ ...e, type: "bar" })), [t]);
|
|
878
|
-
return /* @__PURE__ */
|
|
879
|
-
},
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
),
|
|
882
|
-
slice:
|
|
883
|
-
center__value:
|
|
884
|
-
center__label:
|
|
885
|
-
},
|
|
906
|
+
return /* @__PURE__ */ u(Bt, { ...o, series: n });
|
|
907
|
+
}, Ye = /* @__PURE__ */ ot(/* @__PURE__ */ it(he, "BarChart")), de = (t) => /* @__PURE__ */ u(Bt, { ...t }), Ze = /* @__PURE__ */ ot(
|
|
908
|
+
/* @__PURE__ */ it(de, "ComposedChart")
|
|
909
|
+
), ue = "hanui-slice-dFWuh", me = "hanui-center__value-GnqKe", fe = "hanui-center__label-DsgTV", Ct = {
|
|
910
|
+
slice: ue,
|
|
911
|
+
center__value: me,
|
|
912
|
+
center__label: fe
|
|
913
|
+
}, Lt = 6, hn = 1.5, pe = ({
|
|
886
914
|
label: t,
|
|
887
915
|
description: o,
|
|
888
916
|
data: n,
|
|
889
917
|
variant: e = "donut",
|
|
890
918
|
centerValue: r,
|
|
891
|
-
centerLabel:
|
|
919
|
+
centerLabel: i,
|
|
892
920
|
valueLabel: d,
|
|
893
|
-
height:
|
|
921
|
+
height: m = 260,
|
|
894
922
|
width: k,
|
|
895
|
-
formatValue:
|
|
923
|
+
formatValue: T,
|
|
896
924
|
className: A,
|
|
897
|
-
testId:
|
|
925
|
+
testId: I
|
|
898
926
|
}) => {
|
|
899
|
-
const { labels:
|
|
900
|
-
() => n.map((s, l) => ({ ...s, tone:
|
|
927
|
+
const { labels: g } = xt(), [R, z] = _t(k), [S, q] = Tt(() => /* @__PURE__ */ new Set()), D = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), N = T ?? D, C = L(
|
|
928
|
+
() => n.map((s, l) => ({ ...s, tone: St(l, s.tone) })),
|
|
901
929
|
[n]
|
|
902
|
-
),
|
|
903
|
-
const s =
|
|
904
|
-
(
|
|
905
|
-
), l = s.reduce((
|
|
906
|
-
let
|
|
907
|
-
const
|
|
908
|
-
const
|
|
909
|
-
return
|
|
930
|
+
), P = L(() => {
|
|
931
|
+
const s = C.filter(
|
|
932
|
+
(_) => !S.has(_.id) && Number.isFinite(_.value) && _.value > 0
|
|
933
|
+
), l = s.reduce((_, G) => _ + G.value, 0), c = z / 2, a = m / 2, f = Math.max(8, Math.min(z, m) / 2 - Lt - 4), b = e === "donut" ? f * 0.62 : 0;
|
|
934
|
+
let $ = 0;
|
|
935
|
+
const y = s.map((_) => {
|
|
936
|
+
const G = l > 0 ? _.value / l * Math.PI * 2 : 0, H = $;
|
|
937
|
+
return $ += G, { ..._, start: H, end: $, share: l > 0 ? _.value / l : 0 };
|
|
910
938
|
});
|
|
911
|
-
return { cx: c, cy: a, outer:
|
|
912
|
-
}, [
|
|
913
|
-
const s = new Intl.NumberFormat(
|
|
939
|
+
return { cx: c, cy: a, outer: f, inner: b, total: l, slices: y };
|
|
940
|
+
}, [C, S, z, m, e]), M = L(() => {
|
|
941
|
+
const s = new Intl.NumberFormat(g == null ? void 0 : g.locale, {
|
|
914
942
|
style: "percent",
|
|
915
943
|
maximumFractionDigits: 1
|
|
916
944
|
});
|
|
917
945
|
return (l) => s.format(l);
|
|
918
|
-
}, [
|
|
919
|
-
const { cx: s, cy: l, outer: c, inner: a, slices:
|
|
920
|
-
return /* @__PURE__ */
|
|
921
|
-
|
|
946
|
+
}, [g == null ? void 0 : g.locale]), w = L(() => {
|
|
947
|
+
const { cx: s, cy: l, outer: c, inner: a, slices: f, total: b } = P;
|
|
948
|
+
return /* @__PURE__ */ X("g", { children: [
|
|
949
|
+
f.map(($) => /* @__PURE__ */ u(
|
|
922
950
|
"path",
|
|
923
951
|
{
|
|
924
|
-
className:
|
|
925
|
-
d:
|
|
926
|
-
style: { fill:
|
|
952
|
+
className: Ct.slice,
|
|
953
|
+
d: nn(s, l, c, a, $.start, $.end),
|
|
954
|
+
style: { fill: U($.tone), strokeWidth: f.length > 1 ? hn : 0 }
|
|
927
955
|
},
|
|
928
|
-
|
|
956
|
+
$.id
|
|
929
957
|
)),
|
|
930
|
-
e === "donut" && /* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
958
|
+
e === "donut" && /* @__PURE__ */ X("g", { "aria-hidden": !0, className: Ct.center, children: [
|
|
959
|
+
/* @__PURE__ */ u(
|
|
932
960
|
"text",
|
|
933
961
|
{
|
|
934
|
-
className:
|
|
962
|
+
className: Ct.center__value,
|
|
935
963
|
x: s,
|
|
936
|
-
y:
|
|
964
|
+
y: i ? l - 4 : l,
|
|
937
965
|
dy: "0.32em",
|
|
938
966
|
textAnchor: "middle",
|
|
939
|
-
children: r ?? N(
|
|
967
|
+
children: r ?? N(b)
|
|
940
968
|
}
|
|
941
969
|
),
|
|
942
|
-
|
|
970
|
+
i && /* @__PURE__ */ u(
|
|
943
971
|
"text",
|
|
944
972
|
{
|
|
945
|
-
className:
|
|
973
|
+
className: Ct.center__label,
|
|
946
974
|
x: s,
|
|
947
975
|
y: l + 16,
|
|
948
976
|
dy: "0.32em",
|
|
949
977
|
textAnchor: "middle",
|
|
950
|
-
children:
|
|
978
|
+
children: i
|
|
951
979
|
}
|
|
952
980
|
)
|
|
953
981
|
] })
|
|
954
982
|
] });
|
|
955
|
-
}, [
|
|
983
|
+
}, [P, e, r, i, N]), h = nt(
|
|
956
984
|
(s, l) => {
|
|
957
|
-
const { cx: c, cy: a, outer:
|
|
958
|
-
if (
|
|
959
|
-
let
|
|
960
|
-
|
|
961
|
-
const
|
|
962
|
-
return
|
|
985
|
+
const { cx: c, cy: a, outer: f, inner: b, slices: $ } = P, y = Math.hypot(s - c, l - a);
|
|
986
|
+
if (y > f + Lt || y < b) return null;
|
|
987
|
+
let _ = Math.atan2(s - c, -(l - a));
|
|
988
|
+
_ < 0 && (_ += Math.PI * 2);
|
|
989
|
+
const G = $.findIndex((H) => _ >= H.start && _ < H.end);
|
|
990
|
+
return G < 0 ? null : G;
|
|
963
991
|
},
|
|
964
|
-
[
|
|
965
|
-
),
|
|
966
|
-
const l =
|
|
992
|
+
[P]
|
|
993
|
+
), p = (s) => {
|
|
994
|
+
const l = P.slices[s];
|
|
967
995
|
return `${N(l.value)} (${M(l.share)})`;
|
|
968
996
|
};
|
|
969
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ u(
|
|
970
998
|
gt,
|
|
971
999
|
{
|
|
972
1000
|
label: t,
|
|
973
1001
|
description: o,
|
|
974
|
-
containerRef:
|
|
975
|
-
width:
|
|
976
|
-
height:
|
|
977
|
-
plot:
|
|
1002
|
+
containerRef: R,
|
|
1003
|
+
width: z,
|
|
1004
|
+
height: m,
|
|
1005
|
+
plot: w,
|
|
978
1006
|
overlay: (s) => {
|
|
979
|
-
const { cx: l, cy: c, outer: a, inner:
|
|
980
|
-
return /* @__PURE__ */
|
|
1007
|
+
const { cx: l, cy: c, outer: a, inner: f, slices: b } = P, $ = b[s], y = ($.start + $.end) / 2, _ = et(0, 0, Lt, y);
|
|
1008
|
+
return /* @__PURE__ */ u(
|
|
981
1009
|
"path",
|
|
982
1010
|
{
|
|
983
|
-
className:
|
|
984
|
-
d:
|
|
985
|
-
style: { fill:
|
|
1011
|
+
className: Ct.slice,
|
|
1012
|
+
d: nn(l + _.x, c + _.y, a, f, $.start, $.end),
|
|
1013
|
+
style: { fill: U($.tone), strokeWidth: hn }
|
|
986
1014
|
}
|
|
987
1015
|
);
|
|
988
1016
|
},
|
|
989
|
-
itemCount:
|
|
990
|
-
pick:
|
|
1017
|
+
itemCount: P.slices.length,
|
|
1018
|
+
pick: h,
|
|
991
1019
|
tooltip: (s) => {
|
|
992
|
-
const l =
|
|
1020
|
+
const l = P.slices[s];
|
|
993
1021
|
return {
|
|
994
|
-
rows: [{ id: l.id, label: l.label, value:
|
|
1022
|
+
rows: [{ id: l.id, label: l.label, value: p(s), tone: l.tone }]
|
|
995
1023
|
};
|
|
996
1024
|
},
|
|
997
1025
|
anchor: (s) => {
|
|
998
|
-
const { cx: l, cy: c, outer: a, slices:
|
|
999
|
-
return et(l, c, a +
|
|
1026
|
+
const { cx: l, cy: c, outer: a, slices: f } = P, b = f[s];
|
|
1027
|
+
return et(l, c, a + Lt, (b.start + b.end) / 2);
|
|
1000
1028
|
},
|
|
1001
1029
|
tooltipSide: "outward",
|
|
1002
|
-
announce: (s) => `${
|
|
1030
|
+
announce: (s) => `${P.slices[s].label}: ${p(s)}`,
|
|
1003
1031
|
table: {
|
|
1004
1032
|
columns: [t, d],
|
|
1005
|
-
rows:
|
|
1033
|
+
rows: C.map((s) => [
|
|
1006
1034
|
s.label,
|
|
1007
1035
|
Number.isFinite(s.value) ? N(s.value) : "—"
|
|
1008
1036
|
])
|
|
1009
1037
|
},
|
|
1010
1038
|
legend: {
|
|
1011
|
-
entries:
|
|
1012
|
-
hidden:
|
|
1039
|
+
entries: C.map((s) => ({ id: s.id, label: s.label, tone: s.tone })),
|
|
1040
|
+
hidden: S,
|
|
1013
1041
|
onToggle: (s) => q((l) => {
|
|
1014
1042
|
const c = new Set(l);
|
|
1015
|
-
return c.has(s) ? c.delete(s) :
|
|
1043
|
+
return c.has(s) ? c.delete(s) : C.length - l.size > 1 && c.add(s), c;
|
|
1016
1044
|
})
|
|
1017
1045
|
},
|
|
1018
1046
|
className: A,
|
|
1019
|
-
testId:
|
|
1047
|
+
testId: I
|
|
1020
1048
|
}
|
|
1021
1049
|
);
|
|
1022
|
-
},
|
|
1023
|
-
const d = Math.max(32, ...n.map(
|
|
1050
|
+
}, Ue = /* @__PURE__ */ ot(/* @__PURE__ */ it(pe, "PieChart")), Qt = (t, o, n, { top: e = 12, right: r = 16, bottom: i = 28 } = {}) => {
|
|
1051
|
+
const d = Math.max(32, ...n.map(mt)) + 10;
|
|
1024
1052
|
return {
|
|
1025
1053
|
left: d,
|
|
1026
1054
|
top: e,
|
|
1027
1055
|
right: Math.max(d + 1, t - r),
|
|
1028
|
-
bottom: Math.max(e + 1, o -
|
|
1056
|
+
bottom: Math.max(e + 1, o - i),
|
|
1029
1057
|
width: Math.max(1, t - r - d),
|
|
1030
|
-
height: Math.max(1, o - e -
|
|
1058
|
+
height: Math.max(1, o - e - i)
|
|
1031
1059
|
};
|
|
1032
|
-
}, Rt = (t, o) => Math.max(2, Math.floor(t / (o ? 90 : 48))),
|
|
1033
|
-
const n = /* @__PURE__ */ new Map(), e = (r,
|
|
1034
|
-
return t.forEach((r,
|
|
1060
|
+
}, Rt = (t, o) => Math.max(2, Math.floor(t / (o ? 90 : 48))), ye = (t, o = 24) => {
|
|
1061
|
+
const n = /* @__PURE__ */ new Map(), e = (r, i) => `${r}:${i}`;
|
|
1062
|
+
return t.forEach((r, i) => {
|
|
1035
1063
|
if (!Number.isFinite(r.x) || !Number.isFinite(r.y)) return;
|
|
1036
|
-
const d = e(Math.floor(r.x / o), Math.floor(r.y / o)),
|
|
1037
|
-
|
|
1064
|
+
const d = e(Math.floor(r.x / o), Math.floor(r.y / o)), m = n.get(d);
|
|
1065
|
+
m ? m.push(i) : n.set(d, [i]);
|
|
1038
1066
|
}), {
|
|
1039
|
-
nearest: (r,
|
|
1040
|
-
const
|
|
1041
|
-
let A = null,
|
|
1042
|
-
for (let
|
|
1043
|
-
for (let
|
|
1044
|
-
for (const
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1067
|
+
nearest: (r, i, d) => {
|
|
1068
|
+
const m = Math.ceil(d / o), k = Math.floor(r / o), T = Math.floor(i / o);
|
|
1069
|
+
let A = null, I = d * d;
|
|
1070
|
+
for (let g = -m; g <= m; g += 1)
|
|
1071
|
+
for (let R = -m; R <= m; R += 1)
|
|
1072
|
+
for (const z of n.get(e(k + g, T + R)) ?? []) {
|
|
1073
|
+
const S = (t[z].x - r) ** 2 + (t[z].y - i) ** 2;
|
|
1074
|
+
S <= I && (I = S, A = z);
|
|
1047
1075
|
}
|
|
1048
1076
|
return A;
|
|
1049
1077
|
}
|
|
1050
1078
|
};
|
|
1051
|
-
},
|
|
1052
|
-
point:
|
|
1053
|
-
marker:
|
|
1054
|
-
},
|
|
1079
|
+
}, xe = "hanui-point-YKyMm", ge = "hanui-marker-ToO1T", dn = {
|
|
1080
|
+
point: xe,
|
|
1081
|
+
marker: ge
|
|
1082
|
+
}, $t = { plain: 4, min: 3, max: 16 }, be = 22, _e = ({
|
|
1055
1083
|
label: t,
|
|
1056
1084
|
description: o,
|
|
1057
1085
|
series: n,
|
|
1058
1086
|
xLabel: e,
|
|
1059
1087
|
yLabel: r,
|
|
1060
|
-
sizeLabel:
|
|
1088
|
+
sizeLabel: i,
|
|
1061
1089
|
height: d = 300,
|
|
1062
|
-
width:
|
|
1090
|
+
width: m,
|
|
1063
1091
|
formatX: k,
|
|
1064
|
-
formatY:
|
|
1092
|
+
formatY: T,
|
|
1065
1093
|
className: A,
|
|
1066
|
-
testId:
|
|
1094
|
+
testId: I
|
|
1067
1095
|
}) => {
|
|
1068
|
-
const { labels:
|
|
1069
|
-
() => n.map((c, a) => ({ ...c, tone:
|
|
1096
|
+
const { labels: g } = xt(), [R, z] = _t(m), [S, q] = Tt(() => /* @__PURE__ */ new Set()), D = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), N = L(() => Ht(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), C = k ?? D, P = T ?? D, M = L(
|
|
1097
|
+
() => n.map((c, a) => ({ ...c, tone: St(a, c.tone) })),
|
|
1070
1098
|
[n]
|
|
1071
|
-
),
|
|
1072
|
-
() => M.filter((c) => !
|
|
1099
|
+
), w = L(
|
|
1100
|
+
() => M.filter((c) => !S.has(c.id)).flatMap(
|
|
1073
1101
|
(c) => c.data.filter((a) => Number.isFinite(a.x) && Number.isFinite(a.y)).map((a) => ({ ...a, series: c }))
|
|
1074
1102
|
).sort((c, a) => c.x - a.x || c.y - a.y),
|
|
1075
|
-
[M,
|
|
1076
|
-
),
|
|
1077
|
-
const c =
|
|
1078
|
-
|
|
1079
|
-
),
|
|
1080
|
-
...
|
|
1081
|
-
cx:
|
|
1082
|
-
cy:
|
|
1083
|
-
r:
|
|
1103
|
+
[M, S]
|
|
1104
|
+
), h = L(() => {
|
|
1105
|
+
const c = At(...yt(w.map((O) => O.x))), a = At(...yt(w.map((O) => O.y))), f = ct(a[0], a[1], Rt(d, !1)), b = Qt(z, d, N(f), { right: 20 }), $ = pt(c, [b.left, b.right]), y = pt(a, [b.bottom, b.top]), _ = Ot(w.map((O) => O.size)), [G, H] = yt(_), j = (O) => O === void 0 || !Number.isFinite(O) || _.length === 0 ? $t.plain : H === G ? ($t.min + $t.max) / 2 : Math.sqrt(
|
|
1106
|
+
$t.min ** 2 + (O - G) / (H - G) * ($t.max ** 2 - $t.min ** 2)
|
|
1107
|
+
), Y = w.map((O) => ({
|
|
1108
|
+
...O,
|
|
1109
|
+
cx: $(O.x),
|
|
1110
|
+
cy: y(O.y),
|
|
1111
|
+
r: j(O.size)
|
|
1084
1112
|
}));
|
|
1085
1113
|
return {
|
|
1086
|
-
area:
|
|
1087
|
-
placed:
|
|
1088
|
-
index:
|
|
1089
|
-
xTicks:
|
|
1090
|
-
|
|
1091
|
-
label: N(G)
|
|
1092
|
-
})),
|
|
1093
|
-
yTicks: p.map((G) => ({ position: x(G), label: N(G) }))
|
|
1114
|
+
area: b,
|
|
1115
|
+
placed: Y,
|
|
1116
|
+
index: ye(Y.map((O) => ({ x: O.cx, y: O.cy }))),
|
|
1117
|
+
xTicks: vt(ct(c[0], c[1], Rt(b.width, !0)), $, N),
|
|
1118
|
+
yTicks: vt(f, y, N)
|
|
1094
1119
|
};
|
|
1095
|
-
}, [
|
|
1096
|
-
() => /* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
|
|
1120
|
+
}, [w, z, d, N]), p = L(
|
|
1121
|
+
() => /* @__PURE__ */ X("g", { children: [
|
|
1122
|
+
/* @__PURE__ */ u(ft, { area: h.area, ticks: h.yTicks, side: "left", hasGrid: !0 }),
|
|
1123
|
+
/* @__PURE__ */ u(ft, { area: h.area, ticks: h.xTicks, side: "bottom", hasGrid: !0 }),
|
|
1124
|
+
h.placed.map((c, a) => /* @__PURE__ */ u(
|
|
1100
1125
|
"circle",
|
|
1101
1126
|
{
|
|
1102
|
-
className:
|
|
1127
|
+
className: dn.point,
|
|
1103
1128
|
cx: c.cx,
|
|
1104
1129
|
cy: c.cy,
|
|
1105
1130
|
r: c.r,
|
|
1106
1131
|
style: {
|
|
1107
|
-
fill: `color-mix(in srgb, ${
|
|
1108
|
-
stroke:
|
|
1132
|
+
fill: `color-mix(in srgb, ${U(c.series.tone)} 72%, transparent)`,
|
|
1133
|
+
stroke: U(c.series.tone)
|
|
1109
1134
|
}
|
|
1110
1135
|
},
|
|
1111
1136
|
a
|
|
1112
1137
|
))
|
|
1113
1138
|
] }),
|
|
1114
|
-
[
|
|
1139
|
+
[h]
|
|
1115
1140
|
), s = nt(
|
|
1116
|
-
(c, a) =>
|
|
1117
|
-
[
|
|
1141
|
+
(c, a) => h.index.nearest(c, a, be),
|
|
1142
|
+
[h]
|
|
1118
1143
|
), l = (c) => {
|
|
1119
|
-
const a =
|
|
1144
|
+
const a = h.placed[c];
|
|
1120
1145
|
return {
|
|
1121
1146
|
title: a.label ?? a.series.label,
|
|
1122
1147
|
rows: [
|
|
1123
1148
|
{ id: "series", label: a.series.label, value: "", tone: a.series.tone },
|
|
1124
|
-
{ id: "x", label: e, value:
|
|
1125
|
-
{ id: "y", label: r, value:
|
|
1126
|
-
...a.size !== void 0 &&
|
|
1149
|
+
{ id: "x", label: e, value: C(a.x) },
|
|
1150
|
+
{ id: "y", label: r, value: P(a.y) },
|
|
1151
|
+
...a.size !== void 0 && i ? [{ id: "size", label: i, value: D(a.size) }] : []
|
|
1127
1152
|
]
|
|
1128
1153
|
};
|
|
1129
1154
|
};
|
|
1130
|
-
return /* @__PURE__ */
|
|
1155
|
+
return /* @__PURE__ */ u(
|
|
1131
1156
|
gt,
|
|
1132
1157
|
{
|
|
1133
1158
|
label: t,
|
|
1134
1159
|
description: o,
|
|
1135
|
-
containerRef:
|
|
1136
|
-
width:
|
|
1160
|
+
containerRef: R,
|
|
1161
|
+
width: z,
|
|
1137
1162
|
height: d,
|
|
1138
|
-
plot:
|
|
1163
|
+
plot: p,
|
|
1139
1164
|
overlay: (c) => {
|
|
1140
|
-
const a =
|
|
1141
|
-
return /* @__PURE__ */
|
|
1165
|
+
const a = h.placed[c];
|
|
1166
|
+
return /* @__PURE__ */ u(
|
|
1142
1167
|
"circle",
|
|
1143
1168
|
{
|
|
1144
|
-
className:
|
|
1169
|
+
className: dn.marker,
|
|
1145
1170
|
cx: a.cx,
|
|
1146
1171
|
cy: a.cy,
|
|
1147
1172
|
r: a.r + 3,
|
|
1148
|
-
style: { stroke:
|
|
1173
|
+
style: { stroke: U(a.series.tone) }
|
|
1149
1174
|
}
|
|
1150
1175
|
);
|
|
1151
1176
|
},
|
|
1152
|
-
itemCount:
|
|
1177
|
+
itemCount: h.placed.length,
|
|
1153
1178
|
pick: s,
|
|
1154
1179
|
tooltip: l,
|
|
1155
|
-
anchor: (c) => ({ x:
|
|
1180
|
+
anchor: (c) => ({ x: h.placed[c].cx, y: h.placed[c].cy }),
|
|
1156
1181
|
announce: (c) => {
|
|
1157
|
-
const a =
|
|
1158
|
-
return `${a.label ? `${a.label}, ` : ""}${a.series.label}: ${e} ${
|
|
1182
|
+
const a = h.placed[c];
|
|
1183
|
+
return `${a.label ? `${a.label}, ` : ""}${a.series.label}: ${e} ${C(a.x)}, ${r} ${P(a.y)}`;
|
|
1159
1184
|
},
|
|
1160
1185
|
table: {
|
|
1161
1186
|
columns: [t, e, r],
|
|
1162
|
-
rows:
|
|
1187
|
+
rows: w.map((c) => [c.label ?? c.series.label, C(c.x), P(c.y)])
|
|
1163
1188
|
},
|
|
1164
1189
|
legend: {
|
|
1165
1190
|
entries: M.map((c) => ({ id: c.id, label: c.label, tone: c.tone })),
|
|
1166
|
-
hidden:
|
|
1191
|
+
hidden: S,
|
|
1167
1192
|
onToggle: (c) => q((a) => {
|
|
1168
|
-
const
|
|
1169
|
-
return
|
|
1193
|
+
const f = new Set(a);
|
|
1194
|
+
return f.has(c) ? f.delete(c) : M.length - a.size > 1 && f.add(c), f;
|
|
1170
1195
|
})
|
|
1171
1196
|
},
|
|
1172
1197
|
className: A,
|
|
1173
|
-
testId:
|
|
1198
|
+
testId: I
|
|
1174
1199
|
}
|
|
1175
1200
|
);
|
|
1176
|
-
},
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
),
|
|
1179
|
-
labels:
|
|
1180
|
-
empty:
|
|
1181
|
-
focus:
|
|
1182
|
-
},
|
|
1201
|
+
}, Qe = /* @__PURE__ */ ot(
|
|
1202
|
+
/* @__PURE__ */ it(_e, "ScatterPlot")
|
|
1203
|
+
), Me = "hanui-labels-MJWYF", $e = "hanui-empty-AW7c9", we = "hanui-focus-hLQdB", Et = {
|
|
1204
|
+
labels: Me,
|
|
1205
|
+
empty: $e,
|
|
1206
|
+
focus: we
|
|
1207
|
+
}, Vt = 8, ke = 28, jt = 140, un = (t, o, n) => {
|
|
1183
1208
|
var r;
|
|
1184
1209
|
const e = (r = t[o]) == null ? void 0 : r[n];
|
|
1185
1210
|
return typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
1186
|
-
},
|
|
1211
|
+
}, mn = (t) => t.map((o, n) => String(n)), Ne = ({
|
|
1187
1212
|
label: t,
|
|
1188
1213
|
description: o,
|
|
1189
1214
|
columns: n,
|
|
1190
1215
|
rows: e,
|
|
1191
1216
|
values: r,
|
|
1192
|
-
valueLabel:
|
|
1217
|
+
valueLabel: i,
|
|
1193
1218
|
tone: d = "cat-1",
|
|
1194
|
-
height:
|
|
1219
|
+
height: m = 280,
|
|
1195
1220
|
width: k,
|
|
1196
|
-
formatValue:
|
|
1221
|
+
formatValue: T,
|
|
1197
1222
|
className: A,
|
|
1198
|
-
testId:
|
|
1223
|
+
testId: I
|
|
1199
1224
|
}) => {
|
|
1200
|
-
const { labels:
|
|
1201
|
-
const
|
|
1225
|
+
const { labels: g } = xt(), [R, z] = _t(k), S = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), q = T ?? S, D = `hanui-heat-${yn().replace(/:/g, "")}`, N = L(() => {
|
|
1226
|
+
const p = { left: Math.min(z * 0.3, Math.max(32, ...e.map(mt)) + 12), top: 8, right: z - 8, bottom: m - 28 - ke }, s = Dt(mn(n), [p.left, p.right], {
|
|
1202
1227
|
paddingInner: 0.06,
|
|
1203
1228
|
paddingOuter: 0
|
|
1204
|
-
}), l = Dt(
|
|
1229
|
+
}), l = Dt(mn(e), [p.top, p.bottom], {
|
|
1205
1230
|
paddingInner: 0.06,
|
|
1206
1231
|
paddingOuter: 0
|
|
1207
|
-
}), [c, a] = yt(
|
|
1208
|
-
(
|
|
1209
|
-
const
|
|
1232
|
+
}), [c, a] = yt(Ot(r.flat())), f = ($) => $ === null ? null : a === c ? 60 : Vt + ($ - c) / (a - c) * (100 - Vt), b = e.flatMap(
|
|
1233
|
+
($, y) => n.map((_, G) => {
|
|
1234
|
+
const H = un(r, y, G);
|
|
1210
1235
|
return {
|
|
1211
|
-
row:
|
|
1212
|
-
column:
|
|
1213
|
-
key: `${
|
|
1214
|
-
value:
|
|
1215
|
-
x: s(String(
|
|
1216
|
-
y: l(String(
|
|
1236
|
+
row: $,
|
|
1237
|
+
column: _,
|
|
1238
|
+
key: `${y}:${G}`,
|
|
1239
|
+
value: H,
|
|
1240
|
+
x: s(String(G)),
|
|
1241
|
+
y: l(String(y)),
|
|
1217
1242
|
width: s.bandwidth,
|
|
1218
1243
|
height: l.bandwidth,
|
|
1219
|
-
mix:
|
|
1244
|
+
mix: f(H)
|
|
1220
1245
|
};
|
|
1221
1246
|
})
|
|
1222
1247
|
);
|
|
1223
|
-
return { area:
|
|
1224
|
-
}, [n, e, r,
|
|
1225
|
-
const { area:
|
|
1226
|
-
n.map((
|
|
1227
|
-
position:
|
|
1228
|
-
label:
|
|
1248
|
+
return { area: p, x: s, y: l, cells: b, min: c, max: a };
|
|
1249
|
+
}, [n, e, r, z, m]), C = U(d), P = L(() => {
|
|
1250
|
+
const { area: h, x: p, y: s, cells: l } = N, c = q(N.max), a = h.right - mt(c) - 8, f = bn(
|
|
1251
|
+
n.map((b, $) => ({
|
|
1252
|
+
position: p(String($)) + p.bandwidth / 2,
|
|
1253
|
+
label: b
|
|
1229
1254
|
}))
|
|
1230
1255
|
);
|
|
1231
|
-
return /* @__PURE__ */
|
|
1232
|
-
l.map((
|
|
1256
|
+
return /* @__PURE__ */ X("g", { children: [
|
|
1257
|
+
l.map((b) => /* @__PURE__ */ u(
|
|
1233
1258
|
"rect",
|
|
1234
1259
|
{
|
|
1235
|
-
className:
|
|
1236
|
-
x:
|
|
1237
|
-
y:
|
|
1238
|
-
width:
|
|
1239
|
-
height:
|
|
1260
|
+
className: b.mix === null ? Et.empty : void 0,
|
|
1261
|
+
x: b.x,
|
|
1262
|
+
y: b.y,
|
|
1263
|
+
width: b.width,
|
|
1264
|
+
height: b.height,
|
|
1240
1265
|
rx: 2,
|
|
1241
|
-
style:
|
|
1266
|
+
style: b.mix === null ? void 0 : { fill: `color-mix(in srgb, ${C} ${b.mix}%, var(--hanui-surface))` }
|
|
1242
1267
|
},
|
|
1243
|
-
|
|
1268
|
+
b.key
|
|
1244
1269
|
)),
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
e.map((
|
|
1270
|
+
/* @__PURE__ */ X("g", { "aria-hidden": !0, className: Et.labels, children: [
|
|
1271
|
+
e.map((b, $) => /* @__PURE__ */ u(
|
|
1247
1272
|
"text",
|
|
1248
1273
|
{
|
|
1249
|
-
x:
|
|
1250
|
-
y: s(String(
|
|
1274
|
+
x: h.left - 8,
|
|
1275
|
+
y: s(String($)) + s.bandwidth / 2,
|
|
1251
1276
|
dy: "0.32em",
|
|
1252
1277
|
textAnchor: "end",
|
|
1253
|
-
children:
|
|
1278
|
+
children: Gt(b, h.left - 12)
|
|
1254
1279
|
},
|
|
1255
|
-
|
|
1280
|
+
$
|
|
1256
1281
|
)),
|
|
1257
|
-
|
|
1282
|
+
f.map((b) => /* @__PURE__ */ u("text", { x: b.position, y: h.bottom + 16, textAnchor: "middle", children: b.label }, b.position))
|
|
1258
1283
|
] }),
|
|
1259
|
-
/* @__PURE__ */
|
|
1260
|
-
/* @__PURE__ */
|
|
1284
|
+
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ X("linearGradient", { id: D, children: [
|
|
1285
|
+
/* @__PURE__ */ u(
|
|
1261
1286
|
"stop",
|
|
1262
1287
|
{
|
|
1263
1288
|
offset: "0%",
|
|
1264
1289
|
style: {
|
|
1265
|
-
stopColor: `color-mix(in srgb, ${
|
|
1290
|
+
stopColor: `color-mix(in srgb, ${C} ${Vt}%, var(--hanui-surface))`
|
|
1266
1291
|
}
|
|
1267
1292
|
}
|
|
1268
1293
|
),
|
|
1269
|
-
/* @__PURE__ */
|
|
1294
|
+
/* @__PURE__ */ u("stop", { offset: "100%", style: { stopColor: C } })
|
|
1270
1295
|
] }) }),
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1296
|
+
/* @__PURE__ */ X("g", { "aria-hidden": !0, className: Et.labels, children: [
|
|
1297
|
+
/* @__PURE__ */ u(
|
|
1273
1298
|
"rect",
|
|
1274
1299
|
{
|
|
1275
1300
|
x: a - jt,
|
|
1276
|
-
y:
|
|
1301
|
+
y: m - 18,
|
|
1277
1302
|
width: jt,
|
|
1278
1303
|
height: 8,
|
|
1279
1304
|
rx: 4,
|
|
1280
|
-
style: { fill: `url(#${
|
|
1305
|
+
style: { fill: `url(#${D})` }
|
|
1281
1306
|
}
|
|
1282
1307
|
),
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1308
|
+
/* @__PURE__ */ u("text", { x: a - jt - 8, y: m - 14, dy: "0.32em", textAnchor: "end", children: q(N.min) }),
|
|
1309
|
+
/* @__PURE__ */ u("text", { x: h.right, y: m - 14, dy: "0.32em", textAnchor: "end", children: c })
|
|
1285
1310
|
] })
|
|
1286
1311
|
] });
|
|
1287
|
-
}, [N, n, e,
|
|
1288
|
-
(
|
|
1312
|
+
}, [N, n, e, C, D, m, q]), M = nt(
|
|
1313
|
+
(h, p) => {
|
|
1289
1314
|
const { area: s, x: l, y: c } = N;
|
|
1290
|
-
if (
|
|
1291
|
-
const a = l.indexAt(
|
|
1292
|
-
return a < 0 ||
|
|
1315
|
+
if (h < s.left || h > s.right || p < s.top || p > s.bottom) return null;
|
|
1316
|
+
const a = l.indexAt(h), f = c.indexAt(p);
|
|
1317
|
+
return a < 0 || f < 0 ? null : f * n.length + a;
|
|
1293
1318
|
},
|
|
1294
1319
|
[N, n.length]
|
|
1295
|
-
),
|
|
1296
|
-
const
|
|
1297
|
-
return { cell:
|
|
1320
|
+
), w = (h) => {
|
|
1321
|
+
const p = N.cells[h];
|
|
1322
|
+
return { cell: p, value: p.value === null ? "—" : q(p.value) };
|
|
1298
1323
|
};
|
|
1299
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ u(
|
|
1300
1325
|
gt,
|
|
1301
1326
|
{
|
|
1302
1327
|
label: t,
|
|
1303
1328
|
description: o,
|
|
1304
|
-
containerRef:
|
|
1305
|
-
width:
|
|
1306
|
-
height:
|
|
1307
|
-
plot:
|
|
1308
|
-
overlay: (
|
|
1309
|
-
const
|
|
1310
|
-
return /* @__PURE__ */
|
|
1329
|
+
containerRef: R,
|
|
1330
|
+
width: z,
|
|
1331
|
+
height: m,
|
|
1332
|
+
plot: P,
|
|
1333
|
+
overlay: (h) => {
|
|
1334
|
+
const p = N.cells[h];
|
|
1335
|
+
return /* @__PURE__ */ u(
|
|
1311
1336
|
"rect",
|
|
1312
1337
|
{
|
|
1313
|
-
className:
|
|
1314
|
-
x:
|
|
1315
|
-
y:
|
|
1316
|
-
width:
|
|
1317
|
-
height:
|
|
1338
|
+
className: Et.focus,
|
|
1339
|
+
x: p.x - 1,
|
|
1340
|
+
y: p.y - 1,
|
|
1341
|
+
width: p.width + 2,
|
|
1342
|
+
height: p.height + 2,
|
|
1318
1343
|
rx: 3
|
|
1319
1344
|
}
|
|
1320
1345
|
);
|
|
@@ -1322,192 +1347,192 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
1322
1347
|
itemCount: N.cells.length,
|
|
1323
1348
|
columns: n.length,
|
|
1324
1349
|
pick: M,
|
|
1325
|
-
tooltip: (
|
|
1326
|
-
const { cell:
|
|
1350
|
+
tooltip: (h) => {
|
|
1351
|
+
const { cell: p, value: s } = w(h);
|
|
1327
1352
|
return {
|
|
1328
|
-
title: `${
|
|
1329
|
-
rows: [{ id: "value", label:
|
|
1353
|
+
title: `${p.row} · ${p.column}`,
|
|
1354
|
+
rows: [{ id: "value", label: i, value: s, tone: d }]
|
|
1330
1355
|
};
|
|
1331
1356
|
},
|
|
1332
|
-
anchor: (
|
|
1333
|
-
const
|
|
1334
|
-
return { x:
|
|
1357
|
+
anchor: (h) => {
|
|
1358
|
+
const p = N.cells[h];
|
|
1359
|
+
return { x: p.x + p.width / 2, y: p.y + p.height / 2 };
|
|
1335
1360
|
},
|
|
1336
|
-
announce: (
|
|
1337
|
-
const { cell:
|
|
1338
|
-
return `${
|
|
1361
|
+
announce: (h) => {
|
|
1362
|
+
const { cell: p, value: s } = w(h);
|
|
1363
|
+
return `${p.row}, ${p.column}: ${i} ${s}`;
|
|
1339
1364
|
},
|
|
1340
1365
|
table: {
|
|
1341
1366
|
columns: [t, ...n],
|
|
1342
|
-
rows: e.map((
|
|
1343
|
-
|
|
1367
|
+
rows: e.map((h, p) => [
|
|
1368
|
+
h,
|
|
1344
1369
|
...n.map((s, l) => {
|
|
1345
|
-
const c =
|
|
1370
|
+
const c = un(r, p, l);
|
|
1346
1371
|
return c === null ? "—" : q(c);
|
|
1347
1372
|
})
|
|
1348
1373
|
])
|
|
1349
1374
|
},
|
|
1350
1375
|
className: A,
|
|
1351
|
-
testId:
|
|
1376
|
+
testId: I
|
|
1352
1377
|
}
|
|
1353
1378
|
);
|
|
1354
|
-
},
|
|
1355
|
-
box:
|
|
1356
|
-
median:
|
|
1357
|
-
outlier:
|
|
1358
|
-
band:
|
|
1359
|
-
},
|
|
1379
|
+
}, Je = /* @__PURE__ */ ot(/* @__PURE__ */ it(Ne, "Heatmap")), ve = "hanui-box-7zEQ-", Ae = "hanui-median-J5g6o", Te = "hanui-outlier-M0VN-", Ie = "hanui-band-kK09D", zt = {
|
|
1380
|
+
box: ve,
|
|
1381
|
+
median: Ae,
|
|
1382
|
+
outlier: Te,
|
|
1383
|
+
band: Ie
|
|
1384
|
+
}, Ce = ({
|
|
1360
1385
|
label: t,
|
|
1361
1386
|
description: o,
|
|
1362
1387
|
groups: n,
|
|
1363
1388
|
groupLabel: e,
|
|
1364
1389
|
labels: r,
|
|
1365
|
-
height:
|
|
1390
|
+
height: i = 280,
|
|
1366
1391
|
width: d,
|
|
1367
|
-
formatValue:
|
|
1392
|
+
formatValue: m,
|
|
1368
1393
|
className: k,
|
|
1369
|
-
testId:
|
|
1394
|
+
testId: T
|
|
1370
1395
|
}) => {
|
|
1371
|
-
const { labels: A } = xt(), [
|
|
1372
|
-
() => n.map((M,
|
|
1396
|
+
const { labels: A } = xt(), [I, g] = _t(d), R = L(() => bt(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), z = L(() => Ht(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), S = m ?? R, q = L(
|
|
1397
|
+
() => n.map((M, w) => ({
|
|
1373
1398
|
group: M,
|
|
1374
|
-
tone:
|
|
1375
|
-
stats:
|
|
1399
|
+
tone: St(w, M.tone),
|
|
1400
|
+
stats: Rn(M.values)
|
|
1376
1401
|
})),
|
|
1377
1402
|
[n]
|
|
1378
|
-
),
|
|
1379
|
-
const M = q.flatMap((
|
|
1380
|
-
n.map((
|
|
1403
|
+
), D = L(() => {
|
|
1404
|
+
const M = q.flatMap((f) => f.stats ? [f.stats.min, f.stats.max] : []), [w, h] = M.length ? yt(M) : [0, 1], p = At(w, h), s = ct(p[0], p[1], Rt(i, !1)), l = Qt(g, i, z(s)), c = Dt(
|
|
1405
|
+
n.map((f) => f.id),
|
|
1381
1406
|
[l.left, l.right],
|
|
1382
1407
|
{ paddingInner: 0.4, paddingOuter: 0.2 }
|
|
1383
|
-
), a =
|
|
1408
|
+
), a = pt(p, [l.bottom, l.top]);
|
|
1384
1409
|
return {
|
|
1385
1410
|
area: l,
|
|
1386
1411
|
band: c,
|
|
1387
1412
|
y: a,
|
|
1388
|
-
yTicks: s
|
|
1389
|
-
groupTicks: n.map((
|
|
1390
|
-
position: c(
|
|
1391
|
-
label:
|
|
1413
|
+
yTicks: vt(s, a, z),
|
|
1414
|
+
groupTicks: n.map((f) => ({
|
|
1415
|
+
position: c(f.id) + c.bandwidth / 2,
|
|
1416
|
+
label: f.label
|
|
1392
1417
|
}))
|
|
1393
1418
|
};
|
|
1394
|
-
}, [q, n,
|
|
1395
|
-
{ id: "max", label: r.max, value:
|
|
1396
|
-
{ id: "q3", label: r.q3, value:
|
|
1397
|
-
{ id: "median", label: r.median, value:
|
|
1398
|
-
{ id: "q1", label: r.q1, value:
|
|
1399
|
-
{ id: "min", label: r.min, value:
|
|
1400
|
-
...M.outliers.length > 0 ? [{ id: "outliers", label: r.outliers, value:
|
|
1401
|
-
{ id: "count", label: r.count, value:
|
|
1402
|
-
],
|
|
1403
|
-
const { area: M, band:
|
|
1404
|
-
return /* @__PURE__ */
|
|
1405
|
-
/* @__PURE__ */
|
|
1406
|
-
/* @__PURE__ */
|
|
1407
|
-
q.map(({ group:
|
|
1419
|
+
}, [q, n, g, i, z]), N = (M) => [
|
|
1420
|
+
{ id: "max", label: r.max, value: S(M.whiskerHigh) },
|
|
1421
|
+
{ id: "q3", label: r.q3, value: S(M.q3) },
|
|
1422
|
+
{ id: "median", label: r.median, value: S(M.median) },
|
|
1423
|
+
{ id: "q1", label: r.q1, value: S(M.q1) },
|
|
1424
|
+
{ id: "min", label: r.min, value: S(M.whiskerLow) },
|
|
1425
|
+
...M.outliers.length > 0 ? [{ id: "outliers", label: r.outliers, value: R(M.outliers.length) }] : [],
|
|
1426
|
+
{ id: "count", label: r.count, value: R(M.count) }
|
|
1427
|
+
], C = L(() => {
|
|
1428
|
+
const { area: M, band: w, y: h } = D;
|
|
1429
|
+
return /* @__PURE__ */ X("g", { children: [
|
|
1430
|
+
/* @__PURE__ */ u(ft, { area: M, ticks: D.yTicks, side: "left", hasGrid: !0 }),
|
|
1431
|
+
/* @__PURE__ */ u(Yt, { area: M, ticks: D.groupTicks, side: "bottom" }),
|
|
1432
|
+
q.map(({ group: p, tone: s, stats: l }) => {
|
|
1408
1433
|
if (!l) return null;
|
|
1409
|
-
const c =
|
|
1410
|
-
return /* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */
|
|
1412
|
-
/* @__PURE__ */
|
|
1413
|
-
/* @__PURE__ */
|
|
1434
|
+
const c = w(p.id), a = c + w.bandwidth / 2, f = w.bandwidth * 0.3, b = U(s);
|
|
1435
|
+
return /* @__PURE__ */ X("g", { style: { stroke: b }, className: zt.box, children: [
|
|
1436
|
+
/* @__PURE__ */ u("line", { x1: a, x2: a, y1: h(l.whiskerHigh), y2: h(l.q3) }),
|
|
1437
|
+
/* @__PURE__ */ u("line", { x1: a, x2: a, y1: h(l.q1), y2: h(l.whiskerLow) }),
|
|
1438
|
+
/* @__PURE__ */ u(
|
|
1414
1439
|
"line",
|
|
1415
1440
|
{
|
|
1416
|
-
x1: a -
|
|
1417
|
-
x2: a +
|
|
1418
|
-
y1:
|
|
1419
|
-
y2:
|
|
1441
|
+
x1: a - f,
|
|
1442
|
+
x2: a + f,
|
|
1443
|
+
y1: h(l.whiskerHigh),
|
|
1444
|
+
y2: h(l.whiskerHigh)
|
|
1420
1445
|
}
|
|
1421
1446
|
),
|
|
1422
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ u(
|
|
1423
1448
|
"line",
|
|
1424
1449
|
{
|
|
1425
|
-
x1: a -
|
|
1426
|
-
x2: a +
|
|
1427
|
-
y1:
|
|
1428
|
-
y2:
|
|
1450
|
+
x1: a - f,
|
|
1451
|
+
x2: a + f,
|
|
1452
|
+
y1: h(l.whiskerLow),
|
|
1453
|
+
y2: h(l.whiskerLow)
|
|
1429
1454
|
}
|
|
1430
1455
|
),
|
|
1431
|
-
/* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ u(
|
|
1432
1457
|
"rect",
|
|
1433
1458
|
{
|
|
1434
1459
|
x: c,
|
|
1435
|
-
width:
|
|
1436
|
-
y:
|
|
1437
|
-
height: Math.max(1,
|
|
1460
|
+
width: w.bandwidth,
|
|
1461
|
+
y: h(l.q3),
|
|
1462
|
+
height: Math.max(1, h(l.q1) - h(l.q3)),
|
|
1438
1463
|
rx: 2,
|
|
1439
|
-
style: { fill: `color-mix(in srgb, ${
|
|
1464
|
+
style: { fill: `color-mix(in srgb, ${b} 22%, transparent)` }
|
|
1440
1465
|
}
|
|
1441
1466
|
),
|
|
1442
|
-
/* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ u(
|
|
1443
1468
|
"line",
|
|
1444
1469
|
{
|
|
1445
1470
|
className: zt.median,
|
|
1446
1471
|
x1: c,
|
|
1447
|
-
x2: c +
|
|
1448
|
-
y1:
|
|
1449
|
-
y2:
|
|
1472
|
+
x2: c + w.bandwidth,
|
|
1473
|
+
y1: h(l.median),
|
|
1474
|
+
y2: h(l.median)
|
|
1450
1475
|
}
|
|
1451
1476
|
),
|
|
1452
|
-
l.outliers.map((
|
|
1453
|
-
] },
|
|
1477
|
+
l.outliers.map(($, y) => /* @__PURE__ */ u("circle", { className: zt.outlier, cx: a, cy: h($), r: 3 }, y))
|
|
1478
|
+
] }, p.id);
|
|
1454
1479
|
})
|
|
1455
1480
|
] });
|
|
1456
|
-
}, [
|
|
1457
|
-
(M,
|
|
1458
|
-
const { area:
|
|
1459
|
-
if (M <
|
|
1481
|
+
}, [D, q]), P = nt(
|
|
1482
|
+
(M, w) => {
|
|
1483
|
+
const { area: h, band: p } = D;
|
|
1484
|
+
if (M < h.left || M > h.right || w < h.top - 4 || w > h.bottom + 4)
|
|
1460
1485
|
return null;
|
|
1461
|
-
const s =
|
|
1486
|
+
const s = p.indexAt(M);
|
|
1462
1487
|
return s < 0 ? null : s;
|
|
1463
1488
|
},
|
|
1464
|
-
[
|
|
1489
|
+
[D]
|
|
1465
1490
|
);
|
|
1466
|
-
return /* @__PURE__ */
|
|
1491
|
+
return /* @__PURE__ */ u(
|
|
1467
1492
|
gt,
|
|
1468
1493
|
{
|
|
1469
1494
|
label: t,
|
|
1470
1495
|
description: o,
|
|
1471
|
-
containerRef:
|
|
1472
|
-
width:
|
|
1473
|
-
height:
|
|
1474
|
-
plot:
|
|
1496
|
+
containerRef: I,
|
|
1497
|
+
width: g,
|
|
1498
|
+
height: i,
|
|
1499
|
+
plot: C,
|
|
1475
1500
|
underlay: (M) => {
|
|
1476
|
-
const { area:
|
|
1477
|
-
return /* @__PURE__ */
|
|
1501
|
+
const { area: w, band: h } = D, p = h.step * 0.2;
|
|
1502
|
+
return /* @__PURE__ */ u(
|
|
1478
1503
|
"rect",
|
|
1479
1504
|
{
|
|
1480
1505
|
className: zt.band,
|
|
1481
|
-
x:
|
|
1482
|
-
width:
|
|
1483
|
-
y:
|
|
1484
|
-
height:
|
|
1506
|
+
x: h(n[M].id) - p,
|
|
1507
|
+
width: h.bandwidth + p * 2,
|
|
1508
|
+
y: w.top,
|
|
1509
|
+
height: w.height
|
|
1485
1510
|
}
|
|
1486
1511
|
);
|
|
1487
1512
|
},
|
|
1488
1513
|
overlay: () => null,
|
|
1489
1514
|
itemCount: n.length,
|
|
1490
|
-
pick:
|
|
1515
|
+
pick: P,
|
|
1491
1516
|
tooltip: (M) => {
|
|
1492
|
-
const
|
|
1517
|
+
const w = q[M];
|
|
1493
1518
|
return {
|
|
1494
|
-
title:
|
|
1495
|
-
rows:
|
|
1496
|
-
...
|
|
1497
|
-
tone:
|
|
1519
|
+
title: w.group.label,
|
|
1520
|
+
rows: w.stats ? N(w.stats).map((h) => ({
|
|
1521
|
+
...h,
|
|
1522
|
+
tone: h.id === "median" ? w.tone : void 0
|
|
1498
1523
|
})) : []
|
|
1499
1524
|
};
|
|
1500
1525
|
},
|
|
1501
1526
|
anchor: (M) => {
|
|
1502
|
-
const
|
|
1527
|
+
const w = q[M], { band: h, y: p } = D;
|
|
1503
1528
|
return {
|
|
1504
|
-
x:
|
|
1505
|
-
y:
|
|
1529
|
+
x: h(w.group.id) + h.bandwidth / 2,
|
|
1530
|
+
y: w.stats ? p(w.stats.q3) : D.area.bottom
|
|
1506
1531
|
};
|
|
1507
1532
|
},
|
|
1508
1533
|
announce: (M) => {
|
|
1509
|
-
const
|
|
1510
|
-
return
|
|
1534
|
+
const w = q[M];
|
|
1535
|
+
return w.stats ? `${w.group.label}: ${N(w.stats).map((h) => `${h.label} ${h.value}`).join(", ")}` : w.group.label;
|
|
1511
1536
|
},
|
|
1512
1537
|
table: {
|
|
1513
1538
|
columns: [
|
|
@@ -1520,324 +1545,321 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
|
|
|
1520
1545
|
r.count
|
|
1521
1546
|
],
|
|
1522
1547
|
rows: q.map(
|
|
1523
|
-
({ group: M, stats:
|
|
1548
|
+
({ group: M, stats: w }) => w ? [
|
|
1524
1549
|
M.label,
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1550
|
+
S(w.whiskerLow),
|
|
1551
|
+
S(w.q1),
|
|
1552
|
+
S(w.median),
|
|
1553
|
+
S(w.q3),
|
|
1554
|
+
S(w.whiskerHigh),
|
|
1555
|
+
R(w.count)
|
|
1531
1556
|
] : [M.label, "—", "—", "—", "—", "—", "0"]
|
|
1532
1557
|
)
|
|
1533
1558
|
},
|
|
1534
1559
|
className: k,
|
|
1535
|
-
testId:
|
|
1560
|
+
testId: T
|
|
1536
1561
|
}
|
|
1537
1562
|
);
|
|
1538
|
-
},
|
|
1539
|
-
baseline:
|
|
1540
|
-
band:
|
|
1541
|
-
},
|
|
1563
|
+
}, Ke = /* @__PURE__ */ ot(/* @__PURE__ */ it(Ce, "BoxPlot")), Fe = "hanui-baseline-wWs7h", Re = "hanui-band-xvYtL", fn = {
|
|
1564
|
+
baseline: Fe,
|
|
1565
|
+
band: Re
|
|
1566
|
+
}, wt = 1, Se = ({
|
|
1542
1567
|
label: t,
|
|
1543
1568
|
description: o,
|
|
1544
1569
|
values: n,
|
|
1545
1570
|
bins: e,
|
|
1546
1571
|
valueLabel: r,
|
|
1547
|
-
countLabel:
|
|
1572
|
+
countLabel: i,
|
|
1548
1573
|
tone: d = "cat-1",
|
|
1549
|
-
height:
|
|
1574
|
+
height: m = 260,
|
|
1550
1575
|
width: k,
|
|
1551
|
-
formatValue:
|
|
1576
|
+
formatValue: T,
|
|
1552
1577
|
className: A,
|
|
1553
|
-
testId:
|
|
1578
|
+
testId: I
|
|
1554
1579
|
}) => {
|
|
1555
|
-
const { labels:
|
|
1556
|
-
var
|
|
1557
|
-
const
|
|
1580
|
+
const { labels: g } = xt(), [R, z] = _t(k), S = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), q = L(() => Ht(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), D = T ?? S, N = L(() => Sn(n, e), [n, e]), C = L(() => {
|
|
1581
|
+
var $, y;
|
|
1582
|
+
const h = Math.max(1, ...N.map((_) => _.count)), p = At(0, h), s = ct(0, p[1], Rt(m, !1)).filter(Number.isInteger), l = Qt(z, m, q(s)), c = (($ = N[0]) == null ? void 0 : $.from) ?? 0, a = ((y = N[N.length - 1]) == null ? void 0 : y.to) ?? 1, f = pt([c, a], [l.left, l.right]), b = pt(p, [l.bottom, l.top]);
|
|
1558
1583
|
return {
|
|
1559
1584
|
area: l,
|
|
1560
|
-
columns: N.map((
|
|
1561
|
-
x:
|
|
1562
|
-
width: Math.max(1,
|
|
1563
|
-
y: _
|
|
1564
|
-
height: Math.max(0, l.bottom - _
|
|
1565
|
-
center: (
|
|
1566
|
-
})),
|
|
1567
|
-
xTicks: rt(c, a, Rt(l.width, !0)).map((f) => ({
|
|
1568
|
-
position: p(f),
|
|
1569
|
-
label: q(f)
|
|
1585
|
+
columns: N.map((_) => ({
|
|
1586
|
+
x: f(_.from) + wt / 2,
|
|
1587
|
+
width: Math.max(1, f(_.to) - f(_.from) - wt),
|
|
1588
|
+
y: b(_.count),
|
|
1589
|
+
height: Math.max(0, l.bottom - b(_.count)),
|
|
1590
|
+
center: (f(_.from) + f(_.to)) / 2
|
|
1570
1591
|
})),
|
|
1571
|
-
|
|
1592
|
+
xTicks: vt(ct(c, a, Rt(l.width, !0)), f, q),
|
|
1593
|
+
yTicks: vt(s, b, q)
|
|
1572
1594
|
};
|
|
1573
|
-
}, [N,
|
|
1574
|
-
() => /* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1595
|
+
}, [N, z, m, q]), P = (h) => `${D(N[h].from)} – ${D(N[h].to)}`, M = L(
|
|
1596
|
+
() => /* @__PURE__ */ X("g", { children: [
|
|
1597
|
+
/* @__PURE__ */ u(ft, { area: C.area, ticks: C.yTicks, side: "left", hasGrid: !0 }),
|
|
1598
|
+
/* @__PURE__ */ u(ft, { area: C.area, ticks: C.xTicks, side: "bottom" }),
|
|
1599
|
+
/* @__PURE__ */ u(
|
|
1578
1600
|
"line",
|
|
1579
1601
|
{
|
|
1580
|
-
className:
|
|
1581
|
-
x1:
|
|
1582
|
-
x2:
|
|
1583
|
-
y1:
|
|
1584
|
-
y2:
|
|
1602
|
+
className: fn.baseline,
|
|
1603
|
+
x1: C.area.left,
|
|
1604
|
+
x2: C.area.right,
|
|
1605
|
+
y1: C.area.bottom,
|
|
1606
|
+
y2: C.area.bottom
|
|
1585
1607
|
}
|
|
1586
1608
|
),
|
|
1587
|
-
|
|
1588
|
-
(
|
|
1609
|
+
C.columns.map(
|
|
1610
|
+
(h, p) => h.height > 0 ? /* @__PURE__ */ u(
|
|
1589
1611
|
"rect",
|
|
1590
1612
|
{
|
|
1591
|
-
x:
|
|
1592
|
-
y:
|
|
1593
|
-
width:
|
|
1594
|
-
height:
|
|
1595
|
-
style: { fill:
|
|
1613
|
+
x: h.x,
|
|
1614
|
+
y: h.y,
|
|
1615
|
+
width: h.width,
|
|
1616
|
+
height: h.height,
|
|
1617
|
+
style: { fill: U(d) }
|
|
1596
1618
|
},
|
|
1597
|
-
|
|
1619
|
+
p
|
|
1598
1620
|
) : null
|
|
1599
1621
|
)
|
|
1600
1622
|
] }),
|
|
1601
|
-
[
|
|
1602
|
-
),
|
|
1603
|
-
(
|
|
1604
|
-
const { area: s, columns: l } =
|
|
1605
|
-
if (
|
|
1623
|
+
[C, d]
|
|
1624
|
+
), w = nt(
|
|
1625
|
+
(h, p) => {
|
|
1626
|
+
const { area: s, columns: l } = C;
|
|
1627
|
+
if (h < s.left || h > s.right || p < s.top - 4 || p > s.bottom + 4)
|
|
1606
1628
|
return null;
|
|
1607
1629
|
const c = l.findIndex(
|
|
1608
|
-
(a) =>
|
|
1630
|
+
(a) => h >= a.x - wt && h <= a.x + a.width + wt
|
|
1609
1631
|
);
|
|
1610
1632
|
return c < 0 ? null : c;
|
|
1611
1633
|
},
|
|
1612
|
-
[
|
|
1634
|
+
[C]
|
|
1613
1635
|
);
|
|
1614
|
-
return /* @__PURE__ */
|
|
1636
|
+
return /* @__PURE__ */ u(
|
|
1615
1637
|
gt,
|
|
1616
1638
|
{
|
|
1617
1639
|
label: t,
|
|
1618
1640
|
description: o,
|
|
1619
|
-
containerRef:
|
|
1620
|
-
width:
|
|
1621
|
-
height:
|
|
1641
|
+
containerRef: R,
|
|
1642
|
+
width: z,
|
|
1643
|
+
height: m,
|
|
1622
1644
|
plot: M,
|
|
1623
|
-
underlay: (
|
|
1624
|
-
const
|
|
1625
|
-
return /* @__PURE__ */
|
|
1645
|
+
underlay: (h) => {
|
|
1646
|
+
const p = C.columns[h];
|
|
1647
|
+
return /* @__PURE__ */ u(
|
|
1626
1648
|
"rect",
|
|
1627
1649
|
{
|
|
1628
|
-
className:
|
|
1629
|
-
x:
|
|
1630
|
-
width:
|
|
1631
|
-
y:
|
|
1632
|
-
height:
|
|
1650
|
+
className: fn.band,
|
|
1651
|
+
x: p.x - wt / 2,
|
|
1652
|
+
width: p.width + wt,
|
|
1653
|
+
y: C.area.top,
|
|
1654
|
+
height: C.area.height
|
|
1633
1655
|
}
|
|
1634
1656
|
);
|
|
1635
1657
|
},
|
|
1636
1658
|
overlay: () => null,
|
|
1637
1659
|
itemCount: N.length,
|
|
1638
|
-
pick:
|
|
1639
|
-
tooltip: (
|
|
1640
|
-
title:
|
|
1641
|
-
rows: [{ id: "count", label:
|
|
1660
|
+
pick: w,
|
|
1661
|
+
tooltip: (h) => ({
|
|
1662
|
+
title: P(h),
|
|
1663
|
+
rows: [{ id: "count", label: i, value: S(N[h].count), tone: d }]
|
|
1642
1664
|
}),
|
|
1643
|
-
anchor: (
|
|
1644
|
-
announce: (
|
|
1665
|
+
anchor: (h) => ({ x: C.columns[h].center, y: C.columns[h].y }),
|
|
1666
|
+
announce: (h) => `${r} ${P(h)}: ${i} ${S(N[h].count)}`,
|
|
1645
1667
|
table: {
|
|
1646
|
-
columns: [r,
|
|
1647
|
-
rows: N.map((
|
|
1668
|
+
columns: [r, i],
|
|
1669
|
+
rows: N.map((h, p) => [P(p), S(h.count)])
|
|
1648
1670
|
},
|
|
1649
1671
|
className: A,
|
|
1650
|
-
testId:
|
|
1672
|
+
testId: I
|
|
1651
1673
|
}
|
|
1652
1674
|
);
|
|
1653
|
-
},
|
|
1654
|
-
grid:
|
|
1655
|
-
shape:
|
|
1656
|
-
labels:
|
|
1657
|
-
axisLabel:
|
|
1658
|
-
spoke:
|
|
1659
|
-
marker:
|
|
1660
|
-
},
|
|
1675
|
+
}, to = /* @__PURE__ */ ot(/* @__PURE__ */ it(Se, "Histogram")), He = "hanui-grid-fHioN", Le = "hanui-shape-Vbb9D", Ee = "hanui-labels-nRfEk", ze = "hanui-axisLabel-UOZQ7", Pe = "hanui-spoke-P-6cp", De = "hanui-marker-xzn9h", kt = {
|
|
1676
|
+
grid: He,
|
|
1677
|
+
shape: Le,
|
|
1678
|
+
labels: Ee,
|
|
1679
|
+
axisLabel: ze,
|
|
1680
|
+
spoke: Pe,
|
|
1681
|
+
marker: De
|
|
1682
|
+
}, pn = 10, Ge = 16, qe = 28, Xt = (t, o) => {
|
|
1661
1683
|
const n = t.values[o];
|
|
1662
1684
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
1663
|
-
},
|
|
1685
|
+
}, Oe = ({
|
|
1664
1686
|
label: t,
|
|
1665
1687
|
description: o,
|
|
1666
1688
|
axes: n,
|
|
1667
1689
|
series: e,
|
|
1668
1690
|
max: r,
|
|
1669
|
-
height:
|
|
1691
|
+
height: i = 320,
|
|
1670
1692
|
width: d,
|
|
1671
|
-
formatValue:
|
|
1693
|
+
formatValue: m,
|
|
1672
1694
|
className: k,
|
|
1673
|
-
testId:
|
|
1695
|
+
testId: T
|
|
1674
1696
|
}) => {
|
|
1675
|
-
const { labels: A } = xt(), [
|
|
1676
|
-
() => e.map((s, l) => ({ ...s, tone:
|
|
1697
|
+
const { labels: A } = xt(), [I, g] = _t(d), [R, z] = Tt(() => /* @__PURE__ */ new Set()), S = L(() => Ht(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), q = L(() => bt(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), D = m ?? q, N = L(
|
|
1698
|
+
() => e.map((s, l) => ({ ...s, tone: St(l, s.tone) })),
|
|
1677
1699
|
[e]
|
|
1678
|
-
),
|
|
1679
|
-
const s = n.length, l = s > 0 ? Math.PI * 2 / s : 0, c = n.map((
|
|
1680
|
-
let
|
|
1681
|
-
for (const
|
|
1682
|
-
for (const
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1700
|
+
), C = L(() => N.filter((s) => !R.has(s.id)), [N, R]), P = L(() => {
|
|
1701
|
+
const s = n.length, l = s > 0 ? Math.PI * 2 / s : 0, c = n.map((j, Y) => Y * l), a = Math.min(g * 0.22, Math.max(0, ...n.map((j) => mt(j.label)))), f = Math.max(24, Math.min(i / 2 - 24, g / 2 - a - pn - 4)), b = g / 2, $ = i / 2;
|
|
1702
|
+
let y = 0;
|
|
1703
|
+
for (const j of e)
|
|
1704
|
+
for (const Y of n) {
|
|
1705
|
+
const O = Xt(j, Y.key);
|
|
1706
|
+
O !== null && O > y && (y = O);
|
|
1685
1707
|
}
|
|
1686
|
-
const
|
|
1687
|
-
return { cx:
|
|
1688
|
-
}, [n, e, r,
|
|
1689
|
-
const { cx: s, cy: l, angles: c, scale: a } =
|
|
1690
|
-
return
|
|
1691
|
-
...
|
|
1692
|
-
points: n.map((
|
|
1693
|
-
const
|
|
1694
|
-
return { ...et(s, l, a(
|
|
1708
|
+
const _ = r !== void 0 && r > 0 ? r : At(0, y, 4)[1], G = ct(0, _, 4).filter((j) => j > 0);
|
|
1709
|
+
return { cx: b, cy: $, radius: f, angles: c, step: l, top: _, rings: G, scale: (j) => Math.min(Math.max(j, 0), _) / _ * f, labelRoom: a };
|
|
1710
|
+
}, [n, e, r, g, i]), M = L(() => {
|
|
1711
|
+
const { cx: s, cy: l, angles: c, scale: a } = P;
|
|
1712
|
+
return C.map((f) => ({
|
|
1713
|
+
...f,
|
|
1714
|
+
points: n.map((b, $) => {
|
|
1715
|
+
const y = Xt(f, b.key);
|
|
1716
|
+
return { ...et(s, l, a(y ?? 0), c[$]), value: y };
|
|
1695
1717
|
})
|
|
1696
1718
|
}));
|
|
1697
|
-
}, [
|
|
1698
|
-
const { cx: s, cy: l, radius: c, angles: a, rings:
|
|
1699
|
-
return /* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
|
|
1719
|
+
}, [P, C, n]), w = L(() => {
|
|
1720
|
+
const { cx: s, cy: l, radius: c, angles: a, rings: f, scale: b, labelRoom: $ } = P, y = f.length > 0 ? b(f[0]) : c, _ = Math.max(1, Math.ceil(Ge / Math.max(1, y))), G = S(f);
|
|
1721
|
+
return /* @__PURE__ */ X("g", { children: [
|
|
1722
|
+
/* @__PURE__ */ X("g", { "aria-hidden": !0, className: kt.grid, children: [
|
|
1723
|
+
f.map((H) => /* @__PURE__ */ u(
|
|
1702
1724
|
"path",
|
|
1703
1725
|
{
|
|
1704
|
-
d:
|
|
1726
|
+
d: en(a.map((j) => et(s, l, b(H), j)))
|
|
1705
1727
|
},
|
|
1706
|
-
|
|
1728
|
+
H
|
|
1707
1729
|
)),
|
|
1708
|
-
a.map((
|
|
1709
|
-
const
|
|
1710
|
-
return /* @__PURE__ */
|
|
1730
|
+
a.map((H, j) => {
|
|
1731
|
+
const Y = et(s, l, c, H);
|
|
1732
|
+
return /* @__PURE__ */ u("line", { x1: s, y1: l, x2: Y.x, y2: Y.y }, n[j].key);
|
|
1711
1733
|
})
|
|
1712
1734
|
] }),
|
|
1713
|
-
M.map((
|
|
1735
|
+
M.map((H) => /* @__PURE__ */ u(
|
|
1714
1736
|
"path",
|
|
1715
1737
|
{
|
|
1716
1738
|
className: kt.shape,
|
|
1717
|
-
d:
|
|
1739
|
+
d: en(H.points),
|
|
1718
1740
|
style: {
|
|
1719
|
-
fill: `color-mix(in srgb, ${
|
|
1720
|
-
stroke:
|
|
1741
|
+
fill: `color-mix(in srgb, ${U(H.tone)} 14%, transparent)`,
|
|
1742
|
+
stroke: U(H.tone)
|
|
1721
1743
|
}
|
|
1722
1744
|
},
|
|
1723
|
-
|
|
1745
|
+
H.id
|
|
1724
1746
|
)),
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
|
|
1727
|
-
(
|
|
1747
|
+
/* @__PURE__ */ X("g", { "aria-hidden": !0, className: kt.labels, children: [
|
|
1748
|
+
f.map(
|
|
1749
|
+
(H, j) => (f.length - 1 - j) % _ === 0 ? /* @__PURE__ */ u("text", { x: s + 4, y: l - b(H), dy: "1.1em", children: G[j] }, H) : null
|
|
1728
1750
|
),
|
|
1729
|
-
n.map((
|
|
1730
|
-
const
|
|
1731
|
-
return /* @__PURE__ */
|
|
1751
|
+
n.map((H, j) => {
|
|
1752
|
+
const Y = a[j], O = et(s, l, c + pn, Y), x = Math.sin(Y), F = Math.cos(Y), E = x > 0.3 ? "start" : x < -0.3 ? "end" : "middle", Z = F > 0.3 ? "-0.2em" : F < -0.3 ? "0.9em" : "0.32em";
|
|
1753
|
+
return /* @__PURE__ */ u(
|
|
1732
1754
|
"text",
|
|
1733
1755
|
{
|
|
1734
1756
|
className: kt.axisLabel,
|
|
1735
|
-
x:
|
|
1736
|
-
y:
|
|
1737
|
-
dy:
|
|
1738
|
-
textAnchor:
|
|
1739
|
-
children:
|
|
1757
|
+
x: O.x,
|
|
1758
|
+
y: O.y,
|
|
1759
|
+
dy: Z,
|
|
1760
|
+
textAnchor: E,
|
|
1761
|
+
children: Gt(H.label, E === "middle" ? c * 1.4 : $)
|
|
1740
1762
|
},
|
|
1741
|
-
|
|
1763
|
+
H.key
|
|
1742
1764
|
);
|
|
1743
1765
|
})
|
|
1744
1766
|
] })
|
|
1745
1767
|
] });
|
|
1746
|
-
}, [
|
|
1768
|
+
}, [P, M, n, S]), h = nt(
|
|
1747
1769
|
(s, l) => {
|
|
1748
|
-
const { cx: c, cy: a, radius:
|
|
1749
|
-
if (n.length === 0 || Math.hypot(s - c, l - a) >
|
|
1750
|
-
let
|
|
1751
|
-
return
|
|
1770
|
+
const { cx: c, cy: a, radius: f, step: b } = P;
|
|
1771
|
+
if (n.length === 0 || Math.hypot(s - c, l - a) > f + qe) return null;
|
|
1772
|
+
let $ = Math.atan2(s - c, -(l - a));
|
|
1773
|
+
return $ < 0 && ($ += Math.PI * 2), Math.round($ / b) % n.length;
|
|
1752
1774
|
},
|
|
1753
|
-
[
|
|
1754
|
-
),
|
|
1775
|
+
[P, n.length]
|
|
1776
|
+
), p = (s) => M.map((l) => {
|
|
1755
1777
|
const c = l.points[s].value;
|
|
1756
1778
|
return {
|
|
1757
1779
|
id: l.id,
|
|
1758
1780
|
label: l.label,
|
|
1759
|
-
value: c === null ? "—" :
|
|
1781
|
+
value: c === null ? "—" : D(c),
|
|
1760
1782
|
tone: l.tone
|
|
1761
1783
|
};
|
|
1762
1784
|
});
|
|
1763
|
-
return /* @__PURE__ */
|
|
1785
|
+
return /* @__PURE__ */ u(
|
|
1764
1786
|
gt,
|
|
1765
1787
|
{
|
|
1766
1788
|
label: t,
|
|
1767
1789
|
description: o,
|
|
1768
|
-
containerRef:
|
|
1769
|
-
width:
|
|
1770
|
-
height:
|
|
1771
|
-
plot:
|
|
1790
|
+
containerRef: I,
|
|
1791
|
+
width: g,
|
|
1792
|
+
height: i,
|
|
1793
|
+
plot: w,
|
|
1772
1794
|
overlay: (s) => {
|
|
1773
|
-
const { cx: l, cy: c, radius: a, angles:
|
|
1774
|
-
return /* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
M.map((
|
|
1777
|
-
const
|
|
1778
|
-
return
|
|
1795
|
+
const { cx: l, cy: c, radius: a, angles: f } = P, b = et(l, c, a, f[s]);
|
|
1796
|
+
return /* @__PURE__ */ X("g", { children: [
|
|
1797
|
+
/* @__PURE__ */ u("line", { className: kt.spoke, x1: l, y1: c, x2: b.x, y2: b.y }),
|
|
1798
|
+
M.map(($) => {
|
|
1799
|
+
const y = $.points[s];
|
|
1800
|
+
return y.value === null ? null : /* @__PURE__ */ u(
|
|
1779
1801
|
"circle",
|
|
1780
1802
|
{
|
|
1781
1803
|
className: kt.marker,
|
|
1782
|
-
cx:
|
|
1783
|
-
cy:
|
|
1804
|
+
cx: y.x,
|
|
1805
|
+
cy: y.y,
|
|
1784
1806
|
r: 4.5,
|
|
1785
|
-
style: { fill:
|
|
1807
|
+
style: { fill: U($.tone) }
|
|
1786
1808
|
},
|
|
1787
|
-
|
|
1809
|
+
$.id
|
|
1788
1810
|
);
|
|
1789
1811
|
})
|
|
1790
1812
|
] });
|
|
1791
1813
|
},
|
|
1792
1814
|
itemCount: n.length,
|
|
1793
|
-
pick:
|
|
1794
|
-
tooltip: (s) => ({ title: n[s].label, rows:
|
|
1815
|
+
pick: h,
|
|
1816
|
+
tooltip: (s) => ({ title: n[s].label, rows: p(s) }),
|
|
1795
1817
|
anchor: (s) => {
|
|
1796
|
-
const { cx: l, cy: c, radius: a, angles:
|
|
1797
|
-
let
|
|
1798
|
-
for (const
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1818
|
+
const { cx: l, cy: c, radius: a, angles: f } = P;
|
|
1819
|
+
let b = 0;
|
|
1820
|
+
for (const $ of M) {
|
|
1821
|
+
const y = $.points[s];
|
|
1822
|
+
b = Math.max(b, Math.hypot(y.x - l, y.y - c));
|
|
1801
1823
|
}
|
|
1802
|
-
return et(l, c, Math.min(a,
|
|
1824
|
+
return et(l, c, Math.min(a, b), f[s]);
|
|
1803
1825
|
},
|
|
1804
1826
|
tooltipSide: "outward",
|
|
1805
|
-
announce: (s) => `${n[s].label}: ${
|
|
1827
|
+
announce: (s) => `${n[s].label}: ${p(s).map((l) => `${l.label} ${l.value}`).join(", ")}`,
|
|
1806
1828
|
table: {
|
|
1807
1829
|
columns: [t, ...N.map((s) => s.label)],
|
|
1808
1830
|
rows: n.map((s) => [
|
|
1809
1831
|
s.label,
|
|
1810
1832
|
...N.map((l) => {
|
|
1811
|
-
const c =
|
|
1812
|
-
return c === null ? "—" :
|
|
1833
|
+
const c = Xt(l, s.key);
|
|
1834
|
+
return c === null ? "—" : D(c);
|
|
1813
1835
|
})
|
|
1814
1836
|
])
|
|
1815
1837
|
},
|
|
1816
1838
|
legend: N.length > 1 ? {
|
|
1817
1839
|
entries: N.map((s) => ({ id: s.id, label: s.label, tone: s.tone })),
|
|
1818
|
-
hidden:
|
|
1819
|
-
onToggle: (s) =>
|
|
1840
|
+
hidden: R,
|
|
1841
|
+
onToggle: (s) => z((l) => {
|
|
1820
1842
|
const c = new Set(l);
|
|
1821
1843
|
return c.has(s) ? c.delete(s) : N.length - l.size > 1 && c.add(s), c;
|
|
1822
1844
|
})
|
|
1823
1845
|
} : void 0,
|
|
1824
1846
|
className: k,
|
|
1825
|
-
testId:
|
|
1847
|
+
testId: T
|
|
1826
1848
|
}
|
|
1827
1849
|
);
|
|
1828
|
-
},
|
|
1829
|
-
/* @__PURE__ */
|
|
1850
|
+
}, no = /* @__PURE__ */ ot(
|
|
1851
|
+
/* @__PURE__ */ it(Oe, "RadarChart")
|
|
1830
1852
|
);
|
|
1831
1853
|
export {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1854
|
+
Xe as AreaChart,
|
|
1855
|
+
Ye as BarChart,
|
|
1856
|
+
Ke as BoxPlot,
|
|
1857
|
+
Ze as ComposedChart,
|
|
1858
|
+
Je as Heatmap,
|
|
1859
|
+
to as Histogram,
|
|
1860
|
+
je as LineChart,
|
|
1861
|
+
Ue as PieChart,
|
|
1862
|
+
no as RadarChart,
|
|
1863
|
+
Qe as ScatterPlot
|
|
1842
1864
|
};
|
|
1843
1865
|
//# sourceMappingURL=charts.js.map
|