p1-charts 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/CategoryBarChart-YEJ9VB8h.js +453 -0
- package/dist/CategoryBarChart-YEJ9VB8h.js.map +1 -0
- package/dist/{PolarChart-D_ULWctY.js → PolarChart-BUEhn3CI.js} +135 -83
- package/dist/PolarChart-BUEhn3CI.js.map +1 -0
- package/dist/{TimeSeriesChart-tYmzRNzV.js → TimeSeriesChart-BIwJxgnD.js} +483 -418
- package/dist/TimeSeriesChart-BIwJxgnD.js.map +1 -0
- package/dist/category.d.ts +2 -2
- package/dist/category.d.ts.map +1 -1
- package/dist/category.js +1 -1
- package/dist/charts/CategoryBarChart/index.d.ts +1 -1
- package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
- package/dist/charts/PolarChart/index.d.ts.map +1 -1
- package/dist/charts/ScatterChart/index.d.ts +1 -1
- package/dist/charts/ScatterChart/index.d.ts.map +1 -1
- package/dist/charts/TimeSeriesChart/index.d.ts +1 -1
- package/dist/charts/TimeSeriesChart/index.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/scatter.js +1 -1
- package/dist/series.d.ts +1 -1
- package/dist/series.d.ts.map +1 -1
- package/dist/series.js +1 -1
- package/dist/types/category.d.ts +41 -2
- package/dist/types/category.d.ts.map +1 -1
- package/dist/types/polar.d.ts +7 -1
- package/dist/types/polar.d.ts.map +1 -1
- package/dist/types/scatter.d.ts +13 -0
- package/dist/types/scatter.d.ts.map +1 -1
- package/dist/types/timeSeries.d.ts +31 -0
- package/dist/types/timeSeries.d.ts.map +1 -1
- package/dist/utils/category.utils.d.ts +46 -7
- package/dist/utils/category.utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/category.ts +13 -2
- package/src/charts/CategoryBarChart/index.tsx +301 -50
- package/src/charts/PolarChart/index.tsx +63 -18
- package/src/charts/ScatterChart/index.tsx +51 -7
- package/src/charts/TimeSeriesChart/index.tsx +117 -2
- package/src/index.ts +13 -1
- package/src/series.ts +4 -0
- package/src/types/category.ts +47 -2
- package/src/types/polar.ts +11 -1
- package/src/types/scatter.ts +13 -0
- package/src/types/timeSeries.ts +35 -0
- package/src/utils/category.utils.ts +321 -43
- package/dist/CategoryBarChart-CV58kvIr.js +0 -182
- package/dist/CategoryBarChart-CV58kvIr.js.map +0 -1
- package/dist/PolarChart-D_ULWctY.js.map +0 -1
- package/dist/TimeSeriesChart-tYmzRNzV.js.map +0 -1
|
@@ -40,108 +40,136 @@ function l(e, t, n) {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/charts/ScatterChart/index.tsx
|
|
43
|
-
var u = 640, d = 360
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
var u = 640, d = 360, f = {
|
|
44
|
+
solid: void 0,
|
|
45
|
+
dashed: "5 4",
|
|
46
|
+
dotted: "2 3"
|
|
47
|
+
};
|
|
48
|
+
function p({ series: o, width: s = u, height: c = d, className: p, ariaLabel: m = "Scatter chart", xLabel: h, yLabel: g, onSelect: _, renderTooltip: v, theme: y, unstyled: b }) {
|
|
49
|
+
let x = n({
|
|
50
|
+
theme: y,
|
|
51
|
+
unstyled: b
|
|
52
|
+
}), S = x?.palette.categorical ?? [], C = x?.palette.text, w = x?.palette.grid, T = l(o, s, c), [E, D] = r(0), O = T.points[E], k = o.find((e) => e.id === O?.series);
|
|
49
53
|
return /* @__PURE__ */ a("div", {
|
|
50
|
-
className: t(
|
|
54
|
+
className: t(p),
|
|
51
55
|
style: { position: "relative" },
|
|
52
56
|
children: [/* @__PURE__ */ a("svg", {
|
|
53
57
|
role: "img",
|
|
54
|
-
"aria-label":
|
|
58
|
+
"aria-label": m,
|
|
55
59
|
tabIndex: 0,
|
|
56
|
-
viewBox: `0 0 ${
|
|
60
|
+
viewBox: `0 0 ${s} ${c}`,
|
|
57
61
|
style: e,
|
|
58
62
|
onKeyDown: (e) => {
|
|
59
|
-
(e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(),
|
|
63
|
+
(e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(), D((t) => {
|
|
60
64
|
let n = e.key === "ArrowRight" ? t + 1 : t - 1;
|
|
61
|
-
return Math.max(0, Math.min(
|
|
65
|
+
return Math.max(0, Math.min(T.points.length - 1, n));
|
|
62
66
|
}));
|
|
63
67
|
},
|
|
64
68
|
children: [
|
|
65
|
-
|
|
69
|
+
T.yTicks.map((e) => /* @__PURE__ */ a("g", { children: [/* @__PURE__ */ i("line", {
|
|
66
70
|
"data-part": "grid",
|
|
67
71
|
x1: 40,
|
|
68
|
-
x2:
|
|
69
|
-
y1:
|
|
70
|
-
y2:
|
|
71
|
-
stroke:
|
|
72
|
+
x2: s - 16,
|
|
73
|
+
y1: T.yOf(e),
|
|
74
|
+
y2: T.yOf(e),
|
|
75
|
+
stroke: w
|
|
72
76
|
}), /* @__PURE__ */ i("text", {
|
|
73
77
|
"data-part": "tick",
|
|
74
78
|
x: 36,
|
|
75
|
-
y:
|
|
79
|
+
y: T.yOf(e),
|
|
76
80
|
textAnchor: "end",
|
|
77
|
-
fill:
|
|
81
|
+
fill: C,
|
|
78
82
|
fontSize: 11,
|
|
79
83
|
children: e
|
|
80
84
|
})] }, `y-${e}`)),
|
|
81
|
-
|
|
85
|
+
T.xTicks.map((e) => /* @__PURE__ */ i("text", {
|
|
82
86
|
"data-part": "tick",
|
|
83
|
-
x:
|
|
84
|
-
y:
|
|
87
|
+
x: T.xOf(e),
|
|
88
|
+
y: c - 12,
|
|
85
89
|
textAnchor: "middle",
|
|
86
|
-
fill:
|
|
90
|
+
fill: C,
|
|
87
91
|
fontSize: 11,
|
|
88
92
|
children: e
|
|
89
93
|
}, `x-${e}`)),
|
|
90
|
-
|
|
94
|
+
h && /* @__PURE__ */ i("text", {
|
|
91
95
|
"data-part": "axis-label",
|
|
92
|
-
x:
|
|
93
|
-
y:
|
|
96
|
+
x: s / 2,
|
|
97
|
+
y: c - 1,
|
|
94
98
|
textAnchor: "middle",
|
|
95
|
-
fill:
|
|
99
|
+
fill: C,
|
|
96
100
|
fontSize: 11,
|
|
97
|
-
children:
|
|
101
|
+
children: h
|
|
98
102
|
}),
|
|
99
|
-
|
|
103
|
+
g && /* @__PURE__ */ i("text", {
|
|
100
104
|
"data-part": "axis-label",
|
|
101
105
|
x: 12,
|
|
102
106
|
y: 16,
|
|
103
|
-
fill:
|
|
107
|
+
fill: C,
|
|
104
108
|
fontSize: 11,
|
|
105
|
-
children:
|
|
109
|
+
children: g
|
|
110
|
+
}),
|
|
111
|
+
o.map((e) => {
|
|
112
|
+
if (!e.line) return null;
|
|
113
|
+
let t = T.points.filter((t) => t.series === e.id).sort((e, t) => e.index - t.index);
|
|
114
|
+
if (t.length < 2) return null;
|
|
115
|
+
let n = t.map((e, t) => `${t === 0 ? "M" : "L"} ${e.px} ${e.py}`).join(" ");
|
|
116
|
+
return /* @__PURE__ */ i("path", {
|
|
117
|
+
"data-part": "line",
|
|
118
|
+
"data-series": e.id,
|
|
119
|
+
d: n,
|
|
120
|
+
fill: "none",
|
|
121
|
+
stroke: e.color ?? C,
|
|
122
|
+
strokeDasharray: f[e.lineStyle ?? "solid"]
|
|
123
|
+
}, `line-${e.id}`);
|
|
106
124
|
}),
|
|
107
|
-
|
|
108
|
-
let n = o.findIndex((t) => t.id === e.series), r = o[n]
|
|
125
|
+
T.points.map((e, t) => {
|
|
126
|
+
let n = o.findIndex((t) => t.id === e.series), r = o[n];
|
|
127
|
+
if (r?.markers === !1) return null;
|
|
128
|
+
let a = r?.data[e.index], s = a?.color ?? r?.color ?? S[n % Math.max(1, S.length)];
|
|
109
129
|
return /* @__PURE__ */ i("circle", {
|
|
110
130
|
"data-part": "point",
|
|
111
131
|
"data-series": e.series,
|
|
112
|
-
"data-active": t ===
|
|
132
|
+
"data-active": t === E ? "" : void 0,
|
|
113
133
|
cx: e.px,
|
|
114
134
|
cy: e.py,
|
|
115
|
-
r: t ===
|
|
116
|
-
fill:
|
|
117
|
-
onPointerEnter: () =>
|
|
135
|
+
r: t === E ? 5 : a?.radius ?? 3.5,
|
|
136
|
+
fill: s,
|
|
137
|
+
onPointerEnter: () => D(t),
|
|
138
|
+
onClick: () => {
|
|
139
|
+
let t = o.find((t) => t.id === e.series), n = t?.data[e.index];
|
|
140
|
+
t && n && _?.({
|
|
141
|
+
series: t,
|
|
142
|
+
point: n,
|
|
143
|
+
index: e.index
|
|
144
|
+
});
|
|
145
|
+
}
|
|
118
146
|
}, `${e.series}:${e.index}`);
|
|
119
147
|
})
|
|
120
148
|
]
|
|
121
|
-
}),
|
|
122
|
-
series:
|
|
123
|
-
point:
|
|
124
|
-
index:
|
|
149
|
+
}), O && k && (v?.({
|
|
150
|
+
series: k,
|
|
151
|
+
point: O,
|
|
152
|
+
index: O.index
|
|
125
153
|
}) ?? /* @__PURE__ */ a("div", {
|
|
126
154
|
"data-part": "tooltip",
|
|
127
155
|
children: [
|
|
128
|
-
|
|
156
|
+
k.name,
|
|
129
157
|
" ",
|
|
130
|
-
|
|
158
|
+
O.x,
|
|
131
159
|
", ",
|
|
132
|
-
|
|
160
|
+
O.y
|
|
133
161
|
]
|
|
134
162
|
}))]
|
|
135
163
|
});
|
|
136
164
|
}
|
|
137
165
|
//#endregion
|
|
138
166
|
//#region src/utils/polar.utils.ts
|
|
139
|
-
var
|
|
140
|
-
function
|
|
141
|
-
return [
|
|
167
|
+
var m = Math.PI * 2, h = (e) => Math.round(e * 100) / 100;
|
|
168
|
+
function g(e, t, n, r) {
|
|
169
|
+
return [h(e + n * Math.sin(r)), h(t - n * Math.cos(r))];
|
|
142
170
|
}
|
|
143
|
-
function
|
|
144
|
-
let [o, s] = +(a >= i) == 1 ? [i, a] : [a, i], c = +(Math.abs(s - o) > Math.PI), l =
|
|
171
|
+
function _(e, t, n, r, i, a) {
|
|
172
|
+
let [o, s] = +(a >= i) == 1 ? [i, a] : [a, i], c = +(Math.abs(s - o) > Math.PI), l = g(e, t, r, o), u = g(e, t, r, s), d = g(e, t, n, s), f = g(e, t, n, o);
|
|
145
173
|
return [
|
|
146
174
|
`M ${l[0]} ${l[1]}`,
|
|
147
175
|
`A ${r} ${r} 0 ${c} 1 ${u[0]} ${u[1]}`,
|
|
@@ -150,40 +178,40 @@ function g(e, t, n, r, i, a) {
|
|
|
150
178
|
"Z"
|
|
151
179
|
].join(" ");
|
|
152
180
|
}
|
|
153
|
-
function
|
|
154
|
-
let r =
|
|
181
|
+
function v(e, t, n) {
|
|
182
|
+
let r = m / Math.max(1, t), i = n === "counterclockwise" ? -1 : 1, a = i * e * r;
|
|
155
183
|
return [a, a + i * r];
|
|
156
184
|
}
|
|
157
|
-
function
|
|
185
|
+
function y(e, t, n) {
|
|
158
186
|
return !(t > 0) || !Number.isFinite(e) || e <= 0 ? 0 : e / t * n;
|
|
159
187
|
}
|
|
160
188
|
//#endregion
|
|
161
189
|
//#region src/charts/PolarChart/index.tsx
|
|
162
|
-
var
|
|
163
|
-
function
|
|
190
|
+
var b = 320, x = b / 2, S = 120;
|
|
191
|
+
function C(o) {
|
|
164
192
|
let { className: s, ariaLabel: c = "Polar chart", direction: l = "clockwise", unit: u, renderTooltip: d, theme: f, unstyled: p } = o, m = n({
|
|
165
193
|
theme: f,
|
|
166
194
|
unstyled: p
|
|
167
|
-
}),
|
|
195
|
+
}), h = m?.palette.categorical ?? [], C = m?.palette.text, w = m?.palette.grid, [T, E] = r(0), D = o.mode ?? "bar", O = o.mode === "scatter" ? o : null, k = o.mode === "scatter" ? null : o, A = O ? O.series.reduce((e, t) => e + t.data.length, 0) : k?.categories.length ?? 0, j = O ? Math.max(0, ...O.series.flatMap((e) => e.data.map((e) => e.radius))) : Math.max(0, ...k?.series.flatMap((e) => e.data.filter((e) => Number.isFinite(e))) ?? []), M = (e) => {
|
|
168
196
|
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
169
197
|
e.preventDefault();
|
|
170
198
|
let t = e.key === "ArrowRight" ? 1 : -1;
|
|
171
|
-
E((e) => (e + t + Math.max(
|
|
172
|
-
},
|
|
199
|
+
E((e) => (e + t + Math.max(A, 1)) % Math.max(A, 1));
|
|
200
|
+
}, N = D === "bar" && k ? k.series.flatMap((e, t) => k.categories.flatMap((n, r) => {
|
|
173
201
|
let i = e.data[r];
|
|
174
202
|
if (typeof i != "number" || !(i > 0)) return [];
|
|
175
|
-
let [a,
|
|
203
|
+
let [a, o] = v(r, k.categories.length, l);
|
|
176
204
|
return [{
|
|
177
205
|
key: `${e.id}:${n}`,
|
|
178
206
|
series: e.id,
|
|
179
207
|
label: n,
|
|
180
208
|
value: String(i),
|
|
181
|
-
d:
|
|
182
|
-
color: e.color ??
|
|
209
|
+
d: _(x, x, 0, y(i, j, S), a, o),
|
|
210
|
+
color: e.color ?? h[t % Math.max(1, h.length)],
|
|
183
211
|
index: r
|
|
184
212
|
}];
|
|
185
|
-
})) : [],
|
|
186
|
-
let i = (l === "counterclockwise" ? -1 : 1) * (n.angle * Math.PI) / 180, [a, o] =
|
|
213
|
+
})) : [], P = O ? O.series.flatMap((e, t) => e.data.map((n, r) => {
|
|
214
|
+
let i = (l === "counterclockwise" ? -1 : 1) * (n.angle * Math.PI) / 180, [a, o] = g(x, x, y(n.radius, j, S), i);
|
|
187
215
|
return {
|
|
188
216
|
key: `${e.id}:${r}`,
|
|
189
217
|
series: e.id,
|
|
@@ -191,20 +219,35 @@ function S(o) {
|
|
|
191
219
|
value: String(n.radius),
|
|
192
220
|
x: a,
|
|
193
221
|
y: o,
|
|
194
|
-
color: e.color ??
|
|
222
|
+
color: e.color ?? h[t % Math.max(1, h.length)]
|
|
195
223
|
};
|
|
196
|
-
})),
|
|
224
|
+
})) : [], F = D === "line" && k ? k.series.flatMap((e, t) => {
|
|
225
|
+
let n = k.categories.flatMap((t, n) => {
|
|
226
|
+
let r = e.data[n];
|
|
227
|
+
if (typeof r != "number" || !(r > 0)) return [];
|
|
228
|
+
let [i, a] = v(n, k.categories.length, l), o = (i + a) / 2;
|
|
229
|
+
return [g(x, x, y(r, j, S), o)];
|
|
230
|
+
});
|
|
231
|
+
return n.length < 2 ? [] : [{
|
|
232
|
+
key: e.id,
|
|
233
|
+
series: e.id,
|
|
234
|
+
label: k.categories[T] ?? e.name,
|
|
235
|
+
value: String(e.data[T] ?? ""),
|
|
236
|
+
d: `M ${n.map((e) => e.join(" ")).join(" L ")} Z`,
|
|
237
|
+
color: e.color ?? h[t % Math.max(1, h.length)]
|
|
238
|
+
}];
|
|
239
|
+
}) : [], I = D === "bar" ? N.find((e) => e.index === T) : D === "line" ? F[0] : P[T];
|
|
197
240
|
return /* @__PURE__ */ a("div", {
|
|
198
241
|
className: t(s),
|
|
199
|
-
"data-mode":
|
|
242
|
+
"data-mode": D,
|
|
200
243
|
style: { position: "relative" },
|
|
201
244
|
children: [/* @__PURE__ */ a("svg", {
|
|
202
245
|
role: "img",
|
|
203
246
|
"aria-label": c,
|
|
204
247
|
tabIndex: 0,
|
|
205
|
-
viewBox: `0 0 ${
|
|
248
|
+
viewBox: `0 0 ${b} ${b}`,
|
|
206
249
|
style: e,
|
|
207
|
-
onKeyDown:
|
|
250
|
+
onKeyDown: M,
|
|
208
251
|
children: [
|
|
209
252
|
[
|
|
210
253
|
.25,
|
|
@@ -213,14 +256,14 @@ function S(o) {
|
|
|
213
256
|
1
|
|
214
257
|
].map((e) => /* @__PURE__ */ i("circle", {
|
|
215
258
|
"data-part": "ring",
|
|
216
|
-
cx:
|
|
217
|
-
cy:
|
|
218
|
-
r:
|
|
259
|
+
cx: x,
|
|
260
|
+
cy: x,
|
|
261
|
+
r: S * e,
|
|
219
262
|
fill: "none",
|
|
220
263
|
stroke: w
|
|
221
264
|
}, e)),
|
|
222
|
-
|
|
223
|
-
let [n] =
|
|
265
|
+
k && k.categories.map((e, t) => {
|
|
266
|
+
let [n] = v(t, k.categories.length, l), [r, a] = g(x, x, 136, n + (l === "counterclockwise" ? -1 : 1) * (Math.PI / k.categories.length));
|
|
224
267
|
return /* @__PURE__ */ i("text", {
|
|
225
268
|
"data-part": "tick",
|
|
226
269
|
x: r,
|
|
@@ -233,14 +276,23 @@ function S(o) {
|
|
|
233
276
|
}),
|
|
234
277
|
u && /* @__PURE__ */ i("text", {
|
|
235
278
|
"data-part": "unit",
|
|
236
|
-
x
|
|
279
|
+
x,
|
|
237
280
|
y: 156,
|
|
238
281
|
textAnchor: "middle",
|
|
239
282
|
fill: C,
|
|
240
283
|
fontSize: 11,
|
|
241
284
|
children: u
|
|
242
285
|
}),
|
|
243
|
-
|
|
286
|
+
F.map((e) => /* @__PURE__ */ i("path", {
|
|
287
|
+
"data-part": "line",
|
|
288
|
+
"data-series": e.series,
|
|
289
|
+
d: e.d,
|
|
290
|
+
fill: e.color,
|
|
291
|
+
fillOpacity: .16,
|
|
292
|
+
stroke: e.color,
|
|
293
|
+
strokeWidth: 1.5
|
|
294
|
+
}, e.key)),
|
|
295
|
+
N.map((e) => /* @__PURE__ */ i("path", {
|
|
244
296
|
"data-part": "sector",
|
|
245
297
|
"data-series": e.series,
|
|
246
298
|
"data-active": e.index === T ? "" : void 0,
|
|
@@ -249,7 +301,7 @@ function S(o) {
|
|
|
249
301
|
opacity: .72,
|
|
250
302
|
onPointerEnter: () => E(e.index)
|
|
251
303
|
}, e.key)),
|
|
252
|
-
|
|
304
|
+
P.map((e, t) => /* @__PURE__ */ i("circle", {
|
|
253
305
|
"data-part": "point",
|
|
254
306
|
"data-series": e.series,
|
|
255
307
|
"data-active": t === T ? "" : void 0,
|
|
@@ -260,23 +312,23 @@ function S(o) {
|
|
|
260
312
|
onPointerEnter: () => E(t)
|
|
261
313
|
}, e.key))
|
|
262
314
|
]
|
|
263
|
-
}),
|
|
264
|
-
series:
|
|
265
|
-
label:
|
|
266
|
-
value:
|
|
315
|
+
}), I && (d?.({
|
|
316
|
+
series: I.series,
|
|
317
|
+
label: I.label,
|
|
318
|
+
value: I.value
|
|
267
319
|
}) ?? /* @__PURE__ */ a("div", {
|
|
268
320
|
"data-part": "tooltip",
|
|
269
321
|
children: [
|
|
270
|
-
|
|
322
|
+
I.series,
|
|
271
323
|
" ",
|
|
272
|
-
|
|
324
|
+
I.label,
|
|
273
325
|
" ",
|
|
274
|
-
|
|
326
|
+
I.value
|
|
275
327
|
]
|
|
276
328
|
}))]
|
|
277
329
|
});
|
|
278
330
|
}
|
|
279
331
|
//#endregion
|
|
280
|
-
export { l as i,
|
|
332
|
+
export { l as i, _ as n, p as r, C as t };
|
|
281
333
|
|
|
282
|
-
//# sourceMappingURL=PolarChart-
|
|
334
|
+
//# sourceMappingURL=PolarChart-BUEhn3CI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolarChart-BUEhn3CI.js","names":["HEATMAP_SVG","useChartTheme","PAD","niceStep","span","rough","count","power","error","ticks","step","max","min","start","values","value","scatterLayout","finite","series","item","point","xs","ys","xMin","xMax","yMin","yMax","xSpan","ySpan","plotW","width","plotH","height","xOf","yOf","WIDTH","HEIGHT","DASH","ScatterChart","resolved","categorical","text","grid","frame","active","setActive","useState","spec","classes","className","ariaLabel","event","next","current","tick","xLabel","yLabel","entry","placed","a","b","d","index","seriesIndex","source","color","chosen","onSelect","renderTooltip","TAU","round","polarPoint","cx","radius","angle","cy","sectorPath","from","to","end","large","outerStart","outer","outerEnd","innerEnd","inner","innerStart","wedgeAngles","sign","direction","barRadius","SIZE","CENTER","RADIUS","PolarChart","props","mode","scatter","rose","sum","onKey","sectors","label","dots","turn","x","y","polygons","points","mid","sector","unit","polygon","dot"],"sources":["../src/utils/scatter.utils.ts","../src/charts/ScatterChart/index.tsx","../src/utils/polar.utils.ts","../src/charts/PolarChart/index.tsx"],"sourcesContent":["export interface ScatterDatum {\n x: number;\n y: number;\n}\n\nexport interface ScatterSeriesInput {\n id: string;\n data: readonly ScatterDatum[];\n}\n\nexport interface PlacedScatterPoint {\n series: string;\n index: number;\n x: number;\n y: number;\n px: number;\n py: number;\n}\n\nexport interface ScatterFrame {\n points: PlacedScatterPoint[];\n xTicks: number[];\n yTicks: number[];\n xOf: (value: number) => number;\n yOf: (value: number) => number;\n}\n\nconst PAD = { top: 16, right: 16, bottom: 32, left: 40 };\n\nfunction niceStep(span: number, count: number): number {\n if (!(span > 0)) return 1;\n\n const rough = span / Math.max(1, count);\n const power = 10 ** Math.floor(Math.log10(rough));\n const error = rough / power;\n const nice = error >= 7.5 ? 10 : error >= 3.5 ? 5 : error >= 1.5 ? 2 : 1;\n\n return nice * power;\n}\n\nfunction ticks(min: number, max: number, count: number): number[] {\n const step = niceStep(max - min, count);\n const start = Math.ceil(min / step) * step;\n const values: number[] = [];\n\n for (let value = start; value <= max + step * 1e-6; value += step)\n values.push(Number(value.toPrecision(12)));\n\n return values.length > 0 ? values : [min, max];\n}\n\nexport function scatterLayout(\n series: readonly ScatterSeriesInput[],\n width: number,\n height: number,\n): ScatterFrame {\n const finite = series.flatMap((item) =>\n item.data.filter(\n (point) => Number.isFinite(point.x) && Number.isFinite(point.y),\n ),\n );\n const xs = finite.map((point) => point.x);\n const ys = finite.map((point) => point.y);\n const xMin = xs.length ? Math.min(...xs) : 0;\n const xMax = xs.length ? Math.max(...xs) : 1;\n const yMin = ys.length ? Math.min(...ys) : 0;\n const yMax = ys.length ? Math.max(...ys) : 1;\n const xSpan = xMax - xMin || 1;\n const ySpan = yMax - yMin || 1;\n const plotW = Math.max(0, width - PAD.left - PAD.right);\n const plotH = Math.max(0, height - PAD.top - PAD.bottom);\n const xOf = (value: number) => PAD.left + ((value - xMin) / xSpan) * plotW;\n const yOf = (value: number) => PAD.top + ((yMax - value) / ySpan) * plotH;\n const points = series.flatMap((item) =>\n item.data.flatMap((point, index) =>\n Number.isFinite(point.x) && Number.isFinite(point.y)\n ? [\n {\n series: item.id,\n index,\n x: point.x,\n y: point.y,\n px: xOf(point.x),\n py: yOf(point.y),\n },\n ]\n : [],\n ),\n );\n\n return {\n points,\n xTicks: ticks(xMin, xMax, 4),\n yTicks: ticks(yMin, yMax, 4),\n xOf,\n yOf,\n };\n}\n","import { useState, type KeyboardEvent } from \"react\";\nimport type { ScatterChartProps } from \"../../types/scatter.js\";\nimport { useChartTheme } from \"../../hooks/useChartTheme.js\";\nimport { scatterLayout } from \"../../utils/scatter.utils.js\";\nimport { classes } from \"../../utils/dom.utils.js\";\nimport { HEATMAP_SVG } from \"../../styles/heatmap.js\";\n\nconst WIDTH = 640;\nconst HEIGHT = 360;\n\nconst DASH = { solid: undefined, dashed: \"5 4\", dotted: \"2 3\" } as const;\n\nexport function ScatterChart({\n series,\n width = WIDTH,\n height = HEIGHT,\n className,\n ariaLabel = \"Scatter chart\",\n xLabel,\n yLabel,\n onSelect,\n renderTooltip,\n theme,\n unstyled,\n}: ScatterChartProps) {\n const resolved = useChartTheme({ theme, unstyled });\n const categorical = resolved?.palette.categorical ?? [];\n const text = resolved?.palette.text;\n const grid = resolved?.palette.grid;\n const frame = scatterLayout(series, width, height);\n const [active, setActive] = useState(0);\n const point = frame.points[active];\n const spec = series.find((item) => item.id === point?.series);\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n\n event.preventDefault();\n setActive((current) => {\n const next = event.key === \"ArrowRight\" ? current + 1 : current - 1;\n\n return Math.max(0, Math.min(frame.points.length - 1, next));\n });\n };\n\n return (\n <div className={classes(className)} style={{ position: \"relative\" }}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n tabIndex={0}\n viewBox={`0 0 ${width} ${height}`}\n style={HEATMAP_SVG}\n onKeyDown={onKey}\n >\n {frame.yTicks.map((tick) => (\n <g key={`y-${tick}`}>\n <line data-part=\"grid\" x1={40} x2={width - 16} y1={frame.yOf(tick)} y2={frame.yOf(tick)} stroke={grid} />\n <text data-part=\"tick\" x={36} y={frame.yOf(tick)} textAnchor=\"end\" fill={text} fontSize={11}>\n {tick}\n </text>\n </g>\n ))}\n {frame.xTicks.map((tick) => (\n <text key={`x-${tick}`} data-part=\"tick\" x={frame.xOf(tick)} y={height - 12} textAnchor=\"middle\" fill={text} fontSize={11}>\n {tick}\n </text>\n ))}\n {xLabel && (\n <text data-part=\"axis-label\" x={width / 2} y={height - 1} textAnchor=\"middle\" fill={text} fontSize={11}>\n {xLabel}\n </text>\n )}\n {yLabel && (\n <text data-part=\"axis-label\" x={12} y={16} fill={text} fontSize={11}>\n {yLabel}\n </text>\n )}\n {series.map((entry) => {\n if (!entry.line) return null;\n\n const placed = frame.points\n .filter((item) => item.series === entry.id)\n .sort((a, b) => a.index - b.index);\n\n if (placed.length < 2) return null;\n\n const d = placed\n .map((item, index) => `${index === 0 ? \"M\" : \"L\"} ${item.px} ${item.py}`)\n .join(\" \");\n\n return (\n <path\n key={`line-${entry.id}`}\n data-part=\"line\"\n data-series={entry.id}\n d={d}\n fill=\"none\"\n stroke={entry.color ?? text}\n strokeDasharray={DASH[entry.lineStyle ?? \"solid\"]}\n />\n );\n })}\n {frame.points.map((item, index) => {\n const seriesIndex = series.findIndex((entry) => entry.id === item.series);\n const spec = series[seriesIndex];\n\n if (spec?.markers === false) return null;\n\n const source = spec?.data[item.index];\n const color =\n source?.color ??\n spec?.color ??\n categorical[seriesIndex % Math.max(1, categorical.length)];\n\n return (\n <circle\n key={`${item.series}:${item.index}`}\n data-part=\"point\"\n data-series={item.series}\n data-active={index === active ? \"\" : undefined}\n cx={item.px}\n cy={item.py}\n r={index === active ? 5 : (source?.radius ?? 3.5)}\n fill={color}\n onPointerEnter={() => setActive(index)}\n onClick={() => {\n const chosen = series.find((entry) => entry.id === item.series);\n const point = chosen?.data[item.index];\n\n if (chosen && point) onSelect?.({ series: chosen, point, index: item.index });\n }}\n />\n );\n })}\n </svg>\n {point && spec &&\n (renderTooltip?.({ series: spec, point, index: point.index }) ?? (\n <div data-part=\"tooltip\">\n {spec.name} {point.x}, {point.y}\n </div>\n ))}\n </div>\n );\n}\n","const TAU = Math.PI * 2;\n\nexport type PolarDirection = \"clockwise\" | \"counterclockwise\";\n\nconst round = (value: number) => Math.round(value * 100) / 100;\n\nexport function polarPoint(\n cx: number,\n cy: number,\n radius: number,\n angle: number,\n): [number, number] {\n return [\n round(cx + radius * Math.sin(angle)),\n round(cy - radius * Math.cos(angle)),\n ];\n}\n\n/** Annular wedge. Angle 0 is north. Clockwise matches a wind rose. */\nexport function sectorPath(\n cx: number,\n cy: number,\n inner: number,\n outer: number,\n start: number,\n end: number,\n): string {\n const sweep = end >= start ? 1 : 0;\n const [from, to] = sweep === 1 ? [start, end] : [end, start];\n const large = Math.abs(to - from) > Math.PI ? 1 : 0;\n const outerStart = polarPoint(cx, cy, outer, from);\n const outerEnd = polarPoint(cx, cy, outer, to);\n const innerEnd = polarPoint(cx, cy, inner, to);\n const innerStart = polarPoint(cx, cy, inner, from);\n\n return [\n `M ${outerStart[0]} ${outerStart[1]}`,\n `A ${outer} ${outer} 0 ${large} 1 ${outerEnd[0]} ${outerEnd[1]}`,\n `L ${innerEnd[0]} ${innerEnd[1]}`,\n `A ${inner} ${inner} 0 ${large} 0 ${innerStart[0]} ${innerStart[1]}`,\n \"Z\",\n ].join(\" \");\n}\n\nexport function wedgeAngles(\n index: number,\n count: number,\n direction: PolarDirection,\n): [number, number] {\n const span = TAU / Math.max(1, count);\n const sign = direction === \"counterclockwise\" ? -1 : 1;\n const start = sign * index * span;\n\n return [start, start + sign * span];\n}\n\nexport function barRadius(value: number, max: number, radius: number): number {\n if (!(max > 0) || !Number.isFinite(value) || value <= 0) return 0;\n\n return (value / max) * radius;\n}\n","import { useState, type KeyboardEvent } from \"react\";\nimport type { PolarChartProps } from \"../../types/polar.js\";\nimport { useChartTheme } from \"../../hooks/useChartTheme.js\";\nimport { barRadius, polarPoint, sectorPath, wedgeAngles } from \"../../utils/polar.utils.js\";\nimport { classes } from \"../../utils/dom.utils.js\";\nimport { HEATMAP_SVG } from \"../../styles/heatmap.js\";\n\nconst SIZE = 320;\nconst CENTER = SIZE / 2;\nconst RADIUS = 120;\n\nexport function PolarChart(props: PolarChartProps) {\n const {\n className,\n ariaLabel = \"Polar chart\",\n direction = \"clockwise\",\n unit,\n renderTooltip,\n theme,\n unstyled,\n } = props;\n const resolved = useChartTheme({ theme, unstyled });\n const categorical = resolved?.palette.categorical ?? [];\n const text = resolved?.palette.text;\n const grid = resolved?.palette.grid;\n const [active, setActive] = useState(0);\n const mode = props.mode ?? \"bar\";\n const scatter = props.mode === \"scatter\" ? props : null;\n const rose = props.mode === \"scatter\" ? null : props;\n const count = scatter\n ? scatter.series.reduce((sum, item) => sum + item.data.length, 0)\n : (rose?.categories.length ?? 0);\n const max = scatter\n ? Math.max(0, ...scatter.series.flatMap((item) => item.data.map((point) => point.radius)))\n : Math.max(0, ...(rose?.series.flatMap((item) => item.data.filter((value) => Number.isFinite(value))) ?? []));\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n\n event.preventDefault();\n const step = event.key === \"ArrowRight\" ? 1 : -1;\n\n setActive((current) => (current + step + Math.max(count, 1)) % Math.max(count, 1));\n };\n\n const sectors = mode === \"bar\" && rose\n ? rose.series.flatMap((item, seriesIndex) =>\n rose.categories.flatMap((label, index) => {\n const value = item.data[index];\n\n if (typeof value !== \"number\" || !(value > 0)) return [];\n\n const [start, end] = wedgeAngles(index, rose.categories.length, direction);\n\n return [\n {\n key: `${item.id}:${label}`,\n series: item.id,\n label,\n value: String(value),\n d: sectorPath(CENTER, CENTER, 0, barRadius(value, max, RADIUS), start, end),\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n index,\n },\n ];\n }),\n )\n : [];\n const dots = scatter\n ? scatter.series.flatMap((item, seriesIndex) =>\n item.data.map((point, index) => {\n const turn = (direction === \"counterclockwise\" ? -1 : 1) * (point.angle * Math.PI) / 180;\n const [x, y] = polarPoint(CENTER, CENTER, barRadius(point.radius, max, RADIUS), turn);\n\n return {\n key: `${item.id}:${index}`,\n series: item.id,\n label: `${point.angle}°`,\n value: String(point.radius),\n x,\n y,\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n };\n }),\n )\n : [];\n const polygons = mode === \"line\" && rose\n ? rose.series.flatMap((item, seriesIndex) => {\n const points = rose.categories.flatMap((_label, index) => {\n const value = item.data[index];\n\n if (typeof value !== \"number\" || !(value > 0)) return [];\n\n const [start, end] = wedgeAngles(index, rose.categories.length, direction);\n const mid = (start + end) / 2;\n\n return [polarPoint(CENTER, CENTER, barRadius(value, max, RADIUS), mid)];\n });\n\n if (points.length < 2) return [];\n\n return [\n {\n key: item.id,\n series: item.id,\n label: rose.categories[active] ?? item.name,\n value: String(item.data[active] ?? \"\"),\n d: `M ${points.map((point) => point.join(\" \")).join(\" L \")} Z`,\n color: item.color ?? categorical[seriesIndex % Math.max(1, categorical.length)],\n },\n ];\n })\n : [];\n const current = mode === \"bar\"\n ? sectors.find((sector) => sector.index === active)\n : mode === \"line\"\n ? polygons[0]\n : dots[active];\n\n return (\n <div className={classes(className)} data-mode={mode} style={{ position: \"relative\" }}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n tabIndex={0}\n viewBox={`0 0 ${SIZE} ${SIZE}`}\n style={HEATMAP_SVG}\n onKeyDown={onKey}\n >\n {[0.25, 0.5, 0.75, 1].map((step) => (\n <circle\n key={step}\n data-part=\"ring\"\n cx={CENTER}\n cy={CENTER}\n r={RADIUS * step}\n fill=\"none\"\n stroke={grid}\n />\n ))}\n {rose &&\n rose.categories.map((label, index) => {\n const [start] = wedgeAngles(index, rose.categories.length, direction);\n const [x, y] = polarPoint(CENTER, CENTER, RADIUS + 16, start + (direction === \"counterclockwise\" ? -1 : 1) * (Math.PI / rose.categories.length));\n\n return (\n <text key={label} data-part=\"tick\" x={x} y={y} textAnchor=\"middle\" fill={text} fontSize={11}>\n {label}\n </text>\n );\n })}\n {unit && (\n <text data-part=\"unit\" x={CENTER} y={CENTER - 4} textAnchor=\"middle\" fill={text} fontSize={11}>\n {unit}\n </text>\n )}\n {polygons.map((polygon) => (\n <path\n key={polygon.key}\n data-part=\"line\"\n data-series={polygon.series}\n d={polygon.d}\n fill={polygon.color}\n fillOpacity={0.16}\n stroke={polygon.color}\n strokeWidth={1.5}\n />\n ))}\n {sectors.map((sector) => (\n <path\n key={sector.key}\n data-part=\"sector\"\n data-series={sector.series}\n data-active={sector.index === active ? \"\" : undefined}\n d={sector.d}\n fill={sector.color}\n opacity={0.72}\n onPointerEnter={() => setActive(sector.index)}\n />\n ))}\n {dots.map((dot, index) => (\n <circle\n key={dot.key}\n data-part=\"point\"\n data-series={dot.series}\n data-active={index === active ? \"\" : undefined}\n cx={dot.x}\n cy={dot.y}\n r={4}\n fill={dot.color}\n onPointerEnter={() => setActive(index)}\n />\n ))}\n </svg>\n {current &&\n (renderTooltip?.({ series: current.series, label: current.label, value: current.value }) ?? (\n <div data-part=\"tooltip\">\n {current.series} {current.label} {current.value}\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;AA2BA,IAAME,IAAM;CAAE,KAAK;CAAI,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAG;AAEvD,SAASC,EAAS,GAAc,GAAuB;CACrD,IAAI,EAAEC,IAAO,IAAI,OAAO;CAExB,IAAMC,IAAQD,IAAO,KAAK,IAAI,GAAGE,CAAK,GAChCC,IAAQ,MAAM,KAAK,MAAM,KAAK,MAAMF,CAAK,CAAC,GAC1CG,IAAQH,IAAQE;CAGtB,QAFaC,KAAS,MAAM,KAAKA,KAAS,MAAM,IAAIA,KAAS,MAAM,IAAI,KAEzDD;AAChB;AAEA,SAASE,EAAM,GAAa,GAAa,GAAyB;CAChE,IAAMC,IAAOP,EAASQ,IAAMC,GAAKN,CAAK,GAChCO,IAAQ,KAAK,KAAKD,IAAMF,CAAI,IAAIA,GAChCI,IAAmB,CAAC;CAE1B,KAAK,IAAIC,IAAQF,GAAOE,KAAS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