p1-charts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +100 -2
- package/dist/CategoryBarChart-1Kn3Vozc.js +580 -0
- package/dist/CategoryBarChart-1Kn3Vozc.js.map +1 -0
- package/dist/ChartFrame-B1bVFM2E.js +403 -0
- package/dist/ChartFrame-B1bVFM2E.js.map +1 -0
- package/dist/{Heatmap-C1XcTUg1.js → Heatmap-CFC753mV.js} +278 -272
- package/dist/Heatmap-CFC753mV.js.map +1 -0
- package/dist/{PieLegend-BZsv9IbF.js → PieLegend-CbpjaOJH.js} +94 -111
- package/dist/PieLegend-CbpjaOJH.js.map +1 -0
- package/dist/PolarChart-hcNTWKfJ.js +450 -0
- package/dist/PolarChart-hcNTWKfJ.js.map +1 -0
- package/dist/Sparkline-BApLVWfg.js +110 -0
- package/dist/Sparkline-BApLVWfg.js.map +1 -0
- package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BzeHEtQl.js} +120 -119
- package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BzeHEtQl.js.map} +1 -1
- package/dist/category.d.ts +1 -1
- 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/Heatmap/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/Sparkline/index.d.ts +5 -2
- package/dist/charts/Sparkline/index.d.ts.map +1 -1
- package/dist/components/ChartFrame/index.d.ts +7 -0
- package/dist/components/ChartFrame/index.d.ts.map +1 -0
- package/dist/components/ChartStory/index.d.ts +7 -0
- package/dist/components/ChartStory/index.d.ts.map +1 -0
- package/dist/components/HeatmapCells/index.d.ts +1 -1
- package/dist/components/HeatmapCells/index.d.ts.map +1 -1
- package/dist/{css-C-rsk7-l.js → css-BtFQ2bM4.js} +2 -2
- package/dist/{css-C-rsk7-l.js.map → css-BtFQ2bM4.js.map} +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/hooks/useMarkMemory.d.ts +9 -0
- package/dist/hooks/useMarkMemory.d.ts.map +1 -0
- package/dist/hooks/usePieTween.d.ts.map +1 -1
- package/dist/hooks/useSteps.d.ts +4 -0
- package/dist/hooks/useSteps.d.ts.map +1 -0
- package/dist/hooks/useTween.d.ts +12 -0
- package/dist/hooks/useTween.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -118
- package/dist/index.js.map +1 -1
- package/dist/motion.utils-DFoqptDi.js +55 -0
- package/dist/motion.utils-DFoqptDi.js.map +1 -0
- package/dist/pie.js +1 -1
- package/dist/scatter.js +1 -1
- package/dist/series.js +1 -1
- package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
- package/dist/shared-C1pGJV4T.js.map +1 -0
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.d.ts.map +1 -1
- package/dist/sparkline.js +2 -2
- package/dist/story.d.ts +11 -0
- package/dist/story.d.ts.map +1 -0
- package/dist/story.js +7 -0
- package/dist/theme.js +3 -3
- package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DgmWROoe.js} +40 -20
- package/dist/theme.utils-DgmWROoe.js.map +1 -0
- package/dist/tooltip.utils-CXD_NapA.js +9 -0
- package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
- package/dist/types/category.d.ts +10 -0
- package/dist/types/category.d.ts.map +1 -1
- package/dist/types/heatmap.d.ts +3 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmapParts.d.ts +2 -0
- package/dist/types/heatmapParts.d.ts.map +1 -1
- package/dist/types/motion.d.ts +31 -0
- package/dist/types/motion.d.ts.map +1 -0
- package/dist/types/pie.d.ts +3 -4
- package/dist/types/pie.d.ts.map +1 -1
- package/dist/types/polar.d.ts +3 -0
- package/dist/types/polar.d.ts.map +1 -1
- package/dist/types/scatter.d.ts +3 -0
- package/dist/types/scatter.d.ts.map +1 -1
- package/dist/types/sparkline.d.ts +3 -0
- package/dist/types/sparkline.d.ts.map +1 -1
- package/dist/types/story.d.ts +73 -0
- package/dist/types/story.d.ts.map +1 -0
- package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-KKtc1C4K.js} +2 -2
- package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-KKtc1C4K.js.map} +1 -1
- package/dist/useControllable-Crsr0byh.js +11 -0
- package/dist/useControllable-Crsr0byh.js.map +1 -0
- package/dist/useMarkMemory-CLNY6TtT.js +15 -0
- package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
- package/dist/useTween-B0G0CcvM.js +46 -0
- package/dist/useTween-B0G0CcvM.js.map +1 -0
- package/dist/utils/category.utils.d.ts +2 -0
- package/dist/utils/category.utils.d.ts.map +1 -1
- package/dist/utils/color.utils.d.ts +9 -0
- package/dist/utils/color.utils.d.ts.map +1 -1
- package/dist/utils/csv.utils.d.ts +6 -0
- package/dist/utils/csv.utils.d.ts.map +1 -0
- package/dist/utils/motion.utils.d.ts +25 -0
- package/dist/utils/motion.utils.d.ts.map +1 -1
- package/dist/utils/pieTween.utils.d.ts +1 -1
- package/dist/utils/pieTween.utils.d.ts.map +1 -1
- package/dist/utils/sparkline.utils.d.ts +15 -0
- package/dist/utils/sparkline.utils.d.ts.map +1 -1
- package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
- package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
- package/package.json +10 -3
- package/src/category.ts +1 -0
- package/src/charts/CategoryBarChart/index.tsx +203 -44
- package/src/charts/Heatmap/index.tsx +4 -0
- package/src/charts/PolarChart/index.tsx +98 -5
- package/src/charts/ScatterChart/index.tsx +96 -13
- package/src/charts/Sparkline/index.tsx +54 -7
- package/src/components/ChartFrame/index.tsx +180 -0
- package/src/components/ChartStory/index.tsx +184 -0
- package/src/components/HeatmapCells/index.tsx +5 -2
- package/src/hooks/useMarkMemory.ts +29 -0
- package/src/hooks/usePieTween.ts +9 -44
- package/src/hooks/useSteps.ts +77 -0
- package/src/hooks/useTween.ts +112 -0
- package/src/index.ts +19 -0
- package/src/sparkline.ts +1 -1
- package/src/story.ts +19 -0
- package/src/types/category.ts +11 -0
- package/src/types/heatmap.ts +3 -0
- package/src/types/heatmapParts.ts +2 -0
- package/src/types/motion.ts +35 -0
- package/src/types/pie.ts +3 -3
- package/src/types/polar.ts +3 -0
- package/src/types/scatter.ts +3 -0
- package/src/types/sparkline.ts +3 -0
- package/src/types/story.ts +103 -0
- package/src/utils/category.utils.ts +22 -0
- package/src/utils/color.utils.ts +48 -0
- package/src/utils/csv.utils.ts +28 -0
- package/src/utils/motion.utils.ts +124 -0
- package/src/utils/pieTween.utils.ts +1 -2
- package/src/utils/sparkline.utils.ts +69 -0
- package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
- package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
- package/dist/Heatmap-C1XcTUg1.js.map +0 -1
- package/dist/PieLegend-BZsv9IbF.js.map +0 -1
- package/dist/PolarChart-BUEhn3CI.js +0 -334
- package/dist/PolarChart-BUEhn3CI.js.map +0 -1
- package/dist/Sparkline-DtNhxGVo.js +0 -67
- package/dist/Sparkline-DtNhxGVo.js.map +0 -1
- package/dist/motion.utils-C1eaZJdQ.js +0 -9
- package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
- package/dist/theme.utils-CP1XtGIe.js.map +0 -1
- package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
- package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { n as e } from "./heatmap-CIBukkjS.js";
|
|
3
|
-
import { t } from "./dom.utils-CKMWLto-.js";
|
|
4
|
-
import { t as n } from "./useChartTheme-B06p_jvu.js";
|
|
5
|
-
import { useState as r } from "react";
|
|
6
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
//#region src/utils/category.utils.ts
|
|
8
|
-
var o = {
|
|
9
|
-
top: 16,
|
|
10
|
-
right: 12,
|
|
11
|
-
bottom: 28,
|
|
12
|
-
left: 36
|
|
13
|
-
}, s = {
|
|
14
|
-
top: 12,
|
|
15
|
-
right: 56,
|
|
16
|
-
bottom: 28,
|
|
17
|
-
left: 96
|
|
18
|
-
};
|
|
19
|
-
function c(e) {
|
|
20
|
-
return e.scale ?? "left";
|
|
21
|
-
}
|
|
22
|
-
function l(e, t, n, r, i, a) {
|
|
23
|
-
let o = t.filter((e) => c(e) === r);
|
|
24
|
-
if (o.length === 0) return null;
|
|
25
|
-
let s = 0, l = 0;
|
|
26
|
-
for (let t = 0; t < n; t += 1) {
|
|
27
|
-
let n = 0, r = 0;
|
|
28
|
-
for (let i of o) {
|
|
29
|
-
let a = i.data[t];
|
|
30
|
-
typeof a == "number" && Number.isFinite(a) && (e === "stack" ? a >= 0 ? n += a : r += a : (s = Math.min(s, a), l = Math.max(l, a)));
|
|
31
|
-
}
|
|
32
|
-
e === "stack" && (s = Math.min(s, r), l = Math.max(l, n));
|
|
33
|
-
}
|
|
34
|
-
for (let e of a ?? []) Number.isFinite(e) && (s = Math.min(s, e), l = Math.max(l, e));
|
|
35
|
-
let u = {
|
|
36
|
-
min: i?.min ?? s,
|
|
37
|
-
max: i?.max ?? l
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
min: u.min,
|
|
41
|
-
max: u.max === u.min ? u.max + 1 : u.max
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function u(e, t) {
|
|
45
|
-
return e.flatMap((e) => {
|
|
46
|
-
let n = e.data[t];
|
|
47
|
-
return typeof n == "number" && Number.isFinite(n) ? [{
|
|
48
|
-
id: e.id,
|
|
49
|
-
value: n,
|
|
50
|
-
scale: c(e)
|
|
51
|
-
}] : [];
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function d(e, t, n, r) {
|
|
55
|
-
let { mode: i, series: a, categories: o, width: s, height: c } = e, l = Math.max(0, c - t.top - t.bottom), d = Math.max(0, s - t.left - t.right), f = (e) => {
|
|
56
|
-
let i = e === "right" && r ? r : n, a = i.max - i.min || 1;
|
|
57
|
-
return (e) => t.top + (i.max - e) / a * l;
|
|
58
|
-
}, p = d / o, m = [];
|
|
59
|
-
for (let e = 0; e < o; e += 1) {
|
|
60
|
-
let n = u(a, e);
|
|
61
|
-
if (n.length === 0) continue;
|
|
62
|
-
let r = p * .72, o = t.left + e * p + (p - r) / 2;
|
|
63
|
-
if (i === "group") {
|
|
64
|
-
let t = n.length > 1 ? 2 : 0, i = (r - t * (n.length - 1)) / n.length;
|
|
65
|
-
n.forEach((n, r) => {
|
|
66
|
-
let a = f(n.scale), s = Math.min(a(n.value), a(0));
|
|
67
|
-
m.push({
|
|
68
|
-
series: n.id,
|
|
69
|
-
category: e,
|
|
70
|
-
x: o + r * (i + t),
|
|
71
|
-
y: s,
|
|
72
|
-
width: i,
|
|
73
|
-
height: Math.abs(a(n.value) - a(0)),
|
|
74
|
-
value: n.value
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (i === "overlay") {
|
|
80
|
-
n.forEach((t) => {
|
|
81
|
-
let n = f(t.scale), i = Math.min(n(t.value), n(0));
|
|
82
|
-
m.push({
|
|
83
|
-
series: t.id,
|
|
84
|
-
category: e,
|
|
85
|
-
x: o,
|
|
86
|
-
y: i,
|
|
87
|
-
width: r,
|
|
88
|
-
height: Math.abs(n(t.value) - n(0)),
|
|
89
|
-
value: t.value
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
for (let t of ["left", "right"]) {
|
|
95
|
-
let i = 0, a = 0, s = f(t);
|
|
96
|
-
for (let c of n) {
|
|
97
|
-
if (c.scale !== t) continue;
|
|
98
|
-
let n = c.value >= 0 ? i : a, l = n + c.value;
|
|
99
|
-
c.value >= 0 ? i = l : a = l;
|
|
100
|
-
let u = Math.min(s(n), s(l));
|
|
101
|
-
m.push({
|
|
102
|
-
series: c.id,
|
|
103
|
-
category: e,
|
|
104
|
-
x: o,
|
|
105
|
-
y: u,
|
|
106
|
-
width: r,
|
|
107
|
-
height: Math.abs(s(l) - s(n)),
|
|
108
|
-
value: c.value
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return m;
|
|
114
|
-
}
|
|
115
|
-
function f(e, t, n, r) {
|
|
116
|
-
let { mode: i, series: a, categories: o, width: s, height: c } = e, l = Math.max(0, s - t.left - t.right), d = Math.max(0, c - t.top - t.bottom), f = (e) => {
|
|
117
|
-
let i = e === "right" && r ? r : n, a = i.max - i.min || 1;
|
|
118
|
-
return (e) => t.left + (e - i.min) / a * l;
|
|
119
|
-
}, p = d / o, m = [];
|
|
120
|
-
for (let e = 0; e < o; e += 1) {
|
|
121
|
-
let n = u(a, e);
|
|
122
|
-
if (n.length === 0) continue;
|
|
123
|
-
let r = p * .72, o = t.top + e * p + (p - r) / 2;
|
|
124
|
-
if (i === "group") {
|
|
125
|
-
let t = n.length > 1 ? 2 : 0, i = (r - t * (n.length - 1)) / n.length;
|
|
126
|
-
n.forEach((n, r) => {
|
|
127
|
-
let a = f(n.scale), s = Math.min(a(n.value), a(0));
|
|
128
|
-
m.push({
|
|
129
|
-
series: n.id,
|
|
130
|
-
category: e,
|
|
131
|
-
x: s,
|
|
132
|
-
y: o + r * (i + t),
|
|
133
|
-
width: Math.abs(a(n.value) - a(0)),
|
|
134
|
-
height: i,
|
|
135
|
-
value: n.value
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
if (i === "overlay") {
|
|
141
|
-
n.forEach((t) => {
|
|
142
|
-
let n = f(t.scale), i = Math.min(n(t.value), n(0));
|
|
143
|
-
m.push({
|
|
144
|
-
series: t.id,
|
|
145
|
-
category: e,
|
|
146
|
-
x: i,
|
|
147
|
-
y: o,
|
|
148
|
-
width: Math.abs(n(t.value) - n(0)),
|
|
149
|
-
height: r,
|
|
150
|
-
value: t.value
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
for (let t of ["left", "right"]) {
|
|
156
|
-
let i = 0, a = 0, s = f(t);
|
|
157
|
-
for (let c of n) {
|
|
158
|
-
if (c.scale !== t) continue;
|
|
159
|
-
let n = c.value >= 0 ? i : a, l = n + c.value;
|
|
160
|
-
c.value >= 0 ? i = l : a = l;
|
|
161
|
-
let u = Math.min(s(n), s(l));
|
|
162
|
-
m.push({
|
|
163
|
-
series: c.id,
|
|
164
|
-
category: e,
|
|
165
|
-
x: u,
|
|
166
|
-
y: o,
|
|
167
|
-
width: Math.abs(s(l) - s(n)),
|
|
168
|
-
height: r,
|
|
169
|
-
value: c.value
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return m;
|
|
175
|
-
}
|
|
176
|
-
function p(e, t, n, r, i, a, o, s) {
|
|
177
|
-
let c = s === "right" && a ? a : i, l = c.max - c.min || 1;
|
|
178
|
-
if (e === "horizontal") {
|
|
179
|
-
let e = Math.max(0, n - t.left - t.right), i = t.left + (o - c.min) / l * e;
|
|
180
|
-
return {
|
|
181
|
-
x1: i,
|
|
182
|
-
y1: t.top,
|
|
183
|
-
x2: i,
|
|
184
|
-
y2: r - t.bottom
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
let u = Math.max(0, r - t.top - t.bottom), d = t.top + (c.max - o) / l * u;
|
|
188
|
-
return {
|
|
189
|
-
x1: t.left,
|
|
190
|
-
y1: d,
|
|
191
|
-
x2: n - t.right,
|
|
192
|
-
y2: d
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
function m(e) {
|
|
196
|
-
let t = e.orientation ?? "vertical", n = e.pad ?? (t === "horizontal" ? s : o), r = (t) => (e.pins ?? []).flatMap((e) => (e.scale ?? "left") === t && Number.isFinite(e.value) ? [e.value] : []), i = l(e.mode, e.series, e.categories, "left", e.domain, r("left")) ?? {
|
|
197
|
-
min: 0,
|
|
198
|
-
max: 1
|
|
199
|
-
}, a = l(e.mode, e.series, e.categories, "right", e.rightDomain, r("right"));
|
|
200
|
-
return {
|
|
201
|
-
rects: e.categories <= 0 || e.series.length === 0 ? [] : t === "horizontal" ? f(e, n, i, a) : d(e, n, i, a),
|
|
202
|
-
orientation: t,
|
|
203
|
-
pad: n,
|
|
204
|
-
left: i,
|
|
205
|
-
right: a,
|
|
206
|
-
across: (r, o = "left") => p(t, n, e.width, e.height, i, a, r, o)
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function h(e) {
|
|
210
|
-
return m(e).rects;
|
|
211
|
-
}
|
|
212
|
-
function g(e, t, n = 4) {
|
|
213
|
-
if (!(t > e) || n < 1) return [e];
|
|
214
|
-
let r = (t - e) / n;
|
|
215
|
-
return Array.from({ length: n + 1 }, (t, n) => Number((e + r * n).toPrecision(6)));
|
|
216
|
-
}
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region src/charts/CategoryBarChart/index.tsx
|
|
219
|
-
var _ = 640, v = 320, y = [], b = [];
|
|
220
|
-
function x(e, t, n) {
|
|
221
|
-
return n ?? e[t % Math.max(1, e.length)] ?? "currentColor";
|
|
222
|
-
}
|
|
223
|
-
function S(e) {
|
|
224
|
-
return typeof e == "number" ? { value: Number.isFinite(e) ? e : void 0 } : e && typeof e.value == "number" && Number.isFinite(e.value) ? {
|
|
225
|
-
value: e.value,
|
|
226
|
-
color: e.color,
|
|
227
|
-
label: e.label
|
|
228
|
-
} : { value: void 0 };
|
|
229
|
-
}
|
|
230
|
-
function C(e, t, n) {
|
|
231
|
-
return x(t, n, e?.color);
|
|
232
|
-
}
|
|
233
|
-
function w({ categories: o, series: s, mode: c = "group", orientation: l = "vertical", domain: u, rightDomain: d, reference: f, references: p = y, bands: h = b, activeIndex: x, valueLabel: w, width: T = _, height: E = v, className: D, ariaLabel: O = "Bar chart", formatValue: k, formatTick: A, renderTooltip: j, onSelect: M, theme: N, unstyled: P }) {
|
|
234
|
-
let F = n({
|
|
235
|
-
theme: N,
|
|
236
|
-
unstyled: P
|
|
237
|
-
}), I = F?.palette.categorical ?? [], L = F?.palette.text, R = F?.palette.grid, z = s.some((e) => e.scale === "right"), B = l === "horizontal" ? {
|
|
238
|
-
top: 12,
|
|
239
|
-
right: z ? 48 : 64,
|
|
240
|
-
bottom: w ? 36 : 28,
|
|
241
|
-
left: 108
|
|
242
|
-
} : {
|
|
243
|
-
top: 16,
|
|
244
|
-
right: z ? 48 : 12,
|
|
245
|
-
bottom: w ? 40 : 28,
|
|
246
|
-
left: 44
|
|
247
|
-
}, V = f ? [f, ...p] : p, H = m({
|
|
248
|
-
mode: c,
|
|
249
|
-
orientation: l,
|
|
250
|
-
domain: u,
|
|
251
|
-
rightDomain: d,
|
|
252
|
-
pad: B,
|
|
253
|
-
width: T,
|
|
254
|
-
height: E,
|
|
255
|
-
categories: o.length,
|
|
256
|
-
pins: [...V.map((e) => ({
|
|
257
|
-
value: e.value,
|
|
258
|
-
scale: e.scale
|
|
259
|
-
})), ...h.flatMap((e) => [{
|
|
260
|
-
value: e.from,
|
|
261
|
-
scale: e.scale
|
|
262
|
-
}, {
|
|
263
|
-
value: e.to,
|
|
264
|
-
scale: e.scale
|
|
265
|
-
}])],
|
|
266
|
-
series: s.map((e) => ({
|
|
267
|
-
id: e.id,
|
|
268
|
-
scale: e.scale,
|
|
269
|
-
data: e.data.map((e) => S(e).value ?? NaN)
|
|
270
|
-
}))
|
|
271
|
-
}), [U, W] = r(null), G = U ?? x ?? 0, K = o[G] ?? o[0], q = s.flatMap((e, t) => {
|
|
272
|
-
let n = K === void 0 ? void 0 : S(e.data[G]);
|
|
273
|
-
return n?.value === void 0 ? [] : [{
|
|
274
|
-
label: e.name,
|
|
275
|
-
value: k?.(e.id, n.value) ?? String(n.value),
|
|
276
|
-
color: n.color ?? C(e, I, t)
|
|
277
|
-
}];
|
|
278
|
-
}), J = (e) => A?.(e) ?? String(e), Y = (e) => {
|
|
279
|
-
W(e);
|
|
280
|
-
let t = o[e];
|
|
281
|
-
t !== void 0 && M?.(t, e);
|
|
282
|
-
}, X = (e) => {
|
|
283
|
-
let t = l === "horizontal" ? "ArrowDown" : "ArrowRight", n = l === "horizontal" ? "ArrowUp" : "ArrowLeft";
|
|
284
|
-
if (e.key !== t && e.key !== n) return;
|
|
285
|
-
e.preventDefault();
|
|
286
|
-
let r = e.key === t ? G + 1 : G - 1;
|
|
287
|
-
Y(Math.max(0, Math.min(o.length - 1, r)));
|
|
288
|
-
}, Z = (e, t) => g(e.min, e.max).map((e) => ({
|
|
289
|
-
value: e,
|
|
290
|
-
at: H.across(e, t)
|
|
291
|
-
}));
|
|
292
|
-
return /* @__PURE__ */ a("div", {
|
|
293
|
-
className: t(D),
|
|
294
|
-
"data-mode": c,
|
|
295
|
-
"data-orientation": l,
|
|
296
|
-
style: { position: "relative" },
|
|
297
|
-
children: [/* @__PURE__ */ a("svg", {
|
|
298
|
-
role: "img",
|
|
299
|
-
"aria-label": O,
|
|
300
|
-
tabIndex: 0,
|
|
301
|
-
viewBox: `0 0 ${T} ${E}`,
|
|
302
|
-
style: e,
|
|
303
|
-
onKeyDown: X,
|
|
304
|
-
onPointerLeave: () => W(null),
|
|
305
|
-
children: [
|
|
306
|
-
l === "horizontal" ? /* @__PURE__ */ i("line", {
|
|
307
|
-
"data-part": "axis",
|
|
308
|
-
x1: B.left,
|
|
309
|
-
y1: B.top,
|
|
310
|
-
x2: B.left,
|
|
311
|
-
y2: E - B.bottom,
|
|
312
|
-
stroke: R
|
|
313
|
-
}) : /* @__PURE__ */ i("line", {
|
|
314
|
-
"data-part": "axis",
|
|
315
|
-
x1: B.left,
|
|
316
|
-
y1: E - B.bottom,
|
|
317
|
-
x2: T - B.right,
|
|
318
|
-
y2: E - B.bottom,
|
|
319
|
-
stroke: R
|
|
320
|
-
}),
|
|
321
|
-
o.map((e, t) => {
|
|
322
|
-
let n = l === "horizontal" ? (E - B.top - B.bottom) / o.length : (T - B.left - B.right) / o.length, r = l === "horizontal" ? B.top + (t + .5) * n : B.left + (t + .5) * n;
|
|
323
|
-
return l === "horizontal" ? /* @__PURE__ */ i("text", {
|
|
324
|
-
"data-part": "tick",
|
|
325
|
-
x: B.left - 8,
|
|
326
|
-
y: r,
|
|
327
|
-
textAnchor: "end",
|
|
328
|
-
dominantBaseline: "middle",
|
|
329
|
-
fill: L,
|
|
330
|
-
fontSize: 11,
|
|
331
|
-
children: e
|
|
332
|
-
}, e) : /* @__PURE__ */ i("text", {
|
|
333
|
-
"data-part": "tick",
|
|
334
|
-
x: r,
|
|
335
|
-
y: E - B.bottom + 14,
|
|
336
|
-
textAnchor: "middle",
|
|
337
|
-
fill: L,
|
|
338
|
-
fontSize: 11,
|
|
339
|
-
children: e
|
|
340
|
-
}, e);
|
|
341
|
-
}),
|
|
342
|
-
Z(H.left, "left").map((e) => l === "horizontal" ? /* @__PURE__ */ i("text", {
|
|
343
|
-
"data-part": "value-tick",
|
|
344
|
-
x: e.at.x1,
|
|
345
|
-
y: E - B.bottom + 14,
|
|
346
|
-
textAnchor: "middle",
|
|
347
|
-
fill: L,
|
|
348
|
-
fontSize: 11,
|
|
349
|
-
children: J(e.value)
|
|
350
|
-
}, `l-${e.value}`) : /* @__PURE__ */ i("text", {
|
|
351
|
-
"data-part": "value-tick",
|
|
352
|
-
x: B.left - 6,
|
|
353
|
-
y: e.at.y1,
|
|
354
|
-
textAnchor: "end",
|
|
355
|
-
dominantBaseline: "middle",
|
|
356
|
-
fill: L,
|
|
357
|
-
fontSize: 11,
|
|
358
|
-
children: J(e.value)
|
|
359
|
-
}, `l-${e.value}`)),
|
|
360
|
-
H.right && Z(H.right, "right").map((e) => /* @__PURE__ */ i("text", {
|
|
361
|
-
"data-part": "value-tick",
|
|
362
|
-
"data-scale": "right",
|
|
363
|
-
x: T - B.right + 6,
|
|
364
|
-
y: e.at.y1,
|
|
365
|
-
dominantBaseline: "middle",
|
|
366
|
-
fill: L,
|
|
367
|
-
fontSize: 11,
|
|
368
|
-
children: J(e.value)
|
|
369
|
-
}, `r-${e.value}`)),
|
|
370
|
-
w && /* @__PURE__ */ i("text", {
|
|
371
|
-
"data-part": "axis-label",
|
|
372
|
-
x: l === "horizontal" ? (B.left + T - B.right) / 2 : B.left,
|
|
373
|
-
y: E - 4,
|
|
374
|
-
textAnchor: l === "horizontal" ? "middle" : "start",
|
|
375
|
-
fill: L,
|
|
376
|
-
fontSize: 11,
|
|
377
|
-
children: w
|
|
378
|
-
}),
|
|
379
|
-
h.map((e, t) => {
|
|
380
|
-
let n = H.across(e.from, e.scale), r = H.across(e.to, e.scale), a = l === "horizontal", o = a ? Math.min(n.x1, r.x1) : B.left, s = a ? B.top : Math.min(n.y1, r.y1), c = a ? Math.abs(n.x1 - r.x1) : T - B.left - B.right, u = a ? E - B.top - B.bottom : Math.abs(n.y1 - r.y1);
|
|
381
|
-
return /* @__PURE__ */ i("rect", {
|
|
382
|
-
"data-part": "band",
|
|
383
|
-
x: o,
|
|
384
|
-
y: s,
|
|
385
|
-
width: c,
|
|
386
|
-
height: u,
|
|
387
|
-
fill: e.color ?? R
|
|
388
|
-
}, `band-${t}`);
|
|
389
|
-
}),
|
|
390
|
-
V.map((e, t) => {
|
|
391
|
-
let n = H.across(e.value, e.scale);
|
|
392
|
-
return /* @__PURE__ */ a("g", { children: [/* @__PURE__ */ i("line", {
|
|
393
|
-
"data-part": "reference",
|
|
394
|
-
...n,
|
|
395
|
-
stroke: e.color ?? R,
|
|
396
|
-
strokeDasharray: "4 3"
|
|
397
|
-
}), e.label && /* @__PURE__ */ i("text", {
|
|
398
|
-
"data-part": "reference-label",
|
|
399
|
-
x: n.x1 + 4,
|
|
400
|
-
y: B.top + 10 + t * 12,
|
|
401
|
-
fill: e.color ?? L,
|
|
402
|
-
fontSize: 10,
|
|
403
|
-
children: e.label
|
|
404
|
-
})] }, `ref-${e.label ?? e.value}-${t}`);
|
|
405
|
-
}),
|
|
406
|
-
H.rects.map((e) => {
|
|
407
|
-
let t = s.find((t) => t.id === e.series), n = s.findIndex((t) => t.id === e.series), r = S(t?.data[e.category]);
|
|
408
|
-
return /* @__PURE__ */ a("g", { children: [/* @__PURE__ */ i("rect", {
|
|
409
|
-
"data-part": "bar",
|
|
410
|
-
"data-series": e.series,
|
|
411
|
-
"data-category": e.category,
|
|
412
|
-
"data-active": e.category === G ? "" : void 0,
|
|
413
|
-
x: e.x,
|
|
414
|
-
y: e.y,
|
|
415
|
-
width: e.width,
|
|
416
|
-
height: Math.max(e.height, e.value === 0 ? 0 : 1),
|
|
417
|
-
fill: r?.color ?? C(t, I, n),
|
|
418
|
-
opacity: c === "overlay" ? .72 : 1,
|
|
419
|
-
onPointerEnter: () => W(e.category),
|
|
420
|
-
onClick: () => Y(e.category)
|
|
421
|
-
}), r?.label && /* @__PURE__ */ i("text", {
|
|
422
|
-
"data-part": "bar-label",
|
|
423
|
-
"data-series": e.series,
|
|
424
|
-
x: l === "horizontal" ? e.x + e.width + 4 : e.x + e.width / 2,
|
|
425
|
-
y: l === "horizontal" ? e.y + e.height / 2 : e.y - 4,
|
|
426
|
-
textAnchor: l === "horizontal" ? "start" : "middle",
|
|
427
|
-
dominantBaseline: l === "horizontal" ? "middle" : "auto",
|
|
428
|
-
fill: L,
|
|
429
|
-
fontSize: 10,
|
|
430
|
-
children: r.label
|
|
431
|
-
})] }, `${e.series}:${e.category}`);
|
|
432
|
-
})
|
|
433
|
-
]
|
|
434
|
-
}), K !== void 0 && (j?.(K, q) ?? /* @__PURE__ */ a("div", {
|
|
435
|
-
"data-part": "tooltip",
|
|
436
|
-
children: [/* @__PURE__ */ i("div", {
|
|
437
|
-
"data-part": "tooltip-time",
|
|
438
|
-
children: K
|
|
439
|
-
}), q.map((e) => /* @__PURE__ */ a("div", {
|
|
440
|
-
"data-part": "tooltip-row",
|
|
441
|
-
children: [
|
|
442
|
-
e.label,
|
|
443
|
-
" ",
|
|
444
|
-
e.value
|
|
445
|
-
]
|
|
446
|
-
}, e.label))]
|
|
447
|
-
}))]
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
//#endregion
|
|
451
|
-
export { h as n, w as t };
|
|
452
|
-
|
|
453
|
-
//# sourceMappingURL=CategoryBarChart-YEJ9VB8h.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryBarChart-YEJ9VB8h.js","names":["HEATMAP_SVG","useChartTheme","VERTICAL_PAD","HORIZONTAL_PAD","scaleOf","series","extentOf","mine","item","scale","min","max","category","categories","positive","negative","value","mode","pin","pins","next","domain","presentAt","placeVertical","options","plotH","height","pad","plotW","width","yFor","extent","right","left","span","slot","rects","present","inner","origin","gap","barW","yOf","y","index","start","end","placeHorizontal","xFor","barH","xOf","x","acrossLine","orientation","categoryFrame","pinsFor","categoryLayout","axisTicks","count","step","WIDTH","HEIGHT","NO_REFERENCES","NO_BANDS","ink","color","categorical","readDatum","datum","seriesColor","CategoryBarChart","resolved","text","grid","hasRight","valueLabel","lines","reference","references","frame","line","bands","band","focus","setFocus","useState","active","activeIndex","rows","formatValue","tickLabel","formatTick","choose","label","onSelect","onKey","forward","back","event","ticksFor","classes","className","ariaLabel","at","tick","horizontal","bandWidth","bandHeight","entry","rect","renderTooltip","row"],"sources":["../src/utils/category.utils.ts","../src/charts/CategoryBarChart/index.tsx"],"sourcesContent":["export type CategoryBarMode = \"group\" | \"stack\" | \"overlay\";\nexport type CategoryOrientation = \"vertical\" | \"horizontal\";\nexport type CategoryScale = \"left\" | \"right\";\n\nexport interface CategorySeriesInput {\n id: string;\n data: readonly number[];\n scale?: CategoryScale;\n}\n\nexport interface CategoryRect {\n series: string;\n category: number;\n x: number;\n y: number;\n width: number;\n height: number;\n value: number;\n}\n\nexport interface CategoryPad {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface CategoryExtent {\n min: number;\n max: number;\n}\n\nexport interface CategoryDomain {\n min?: number;\n max?: number;\n}\n\nexport interface CategoryLayoutOptions {\n mode: CategoryBarMode;\n series: readonly CategorySeriesInput[];\n categories: number;\n width: number;\n height: number;\n pad?: CategoryPad;\n orientation?: CategoryOrientation;\n domain?: CategoryDomain;\n rightDomain?: CategoryDomain;\n /** Values the axis must contain, such as a threshold the bars have not reached. */\n pins?: readonly { value: number; scale?: CategoryScale }[];\n}\n\nexport interface CategoryLine {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n}\n\nexport interface CategoryFrame {\n rects: CategoryRect[];\n orientation: CategoryOrientation;\n pad: CategoryPad;\n left: CategoryExtent;\n right: CategoryExtent | null;\n /** A line across the plot at one value. Horizontal charts draw it upright. */\n across: (value: number, scale?: CategoryScale) => CategoryLine;\n}\n\nconst VERTICAL_PAD: CategoryPad = { top: 16, right: 12, bottom: 28, left: 36 };\nconst HORIZONTAL_PAD: CategoryPad = { top: 12, right: 56, bottom: 28, left: 96 };\n\ninterface PresentBar {\n id: string;\n value: number;\n scale: CategoryScale;\n}\n\nfunction scaleOf(series: CategorySeriesInput): CategoryScale {\n return series.scale ?? \"left\";\n}\n\nfunction extentOf(\n mode: CategoryBarMode,\n series: readonly CategorySeriesInput[],\n categories: number,\n scale: CategoryScale,\n domain?: CategoryDomain,\n pins?: readonly number[],\n): CategoryExtent | null {\n const mine = series.filter((item) => scaleOf(item) === scale);\n\n if (mine.length === 0) return null;\n\n let min = 0;\n let max = 0;\n\n for (let category = 0; category < categories; category += 1) {\n let positive = 0;\n let negative = 0;\n\n for (const item of mine) {\n const value = item.data[category];\n\n if (typeof value !== \"number\" || !Number.isFinite(value)) continue;\n\n if (mode === \"stack\") {\n if (value >= 0) positive += value;\n else negative += value;\n } else {\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n }\n\n if (mode === \"stack\") {\n min = Math.min(min, negative);\n max = Math.max(max, positive);\n }\n }\n\n for (const pin of pins ?? []) {\n if (!Number.isFinite(pin)) continue;\n\n min = Math.min(min, pin);\n max = Math.max(max, pin);\n }\n\n const next = {\n min: domain?.min ?? min,\n max: domain?.max ?? max,\n };\n\n return { min: next.min, max: next.max === next.min ? next.max + 1 : next.max };\n}\n\nfunction presentAt(\n series: readonly CategorySeriesInput[],\n category: number,\n): PresentBar[] {\n return series.flatMap((item) => {\n const value = item.data[category];\n\n return typeof value === \"number\" && Number.isFinite(value)\n ? [{ id: item.id, value, scale: scaleOf(item) }]\n : [];\n });\n}\n\nfunction placeVertical(\n options: CategoryLayoutOptions,\n pad: CategoryPad,\n left: CategoryExtent,\n right: CategoryExtent | null,\n): CategoryRect[] {\n const { mode, series, categories, width, height } = options;\n const plotH = Math.max(0, height - pad.top - pad.bottom);\n const plotW = Math.max(0, width - pad.left - pad.right);\n const yFor = (scale: CategoryScale) => {\n const extent = scale === \"right\" && right ? right : left;\n const span = extent.max - extent.min || 1;\n\n return (value: number) => pad.top + ((extent.max - value) / span) * plotH;\n };\n const slot = plotW / categories;\n const rects: CategoryRect[] = [];\n\n for (let category = 0; category < categories; category += 1) {\n const present = presentAt(series, category);\n\n if (present.length === 0) continue;\n\n const inner = slot * 0.72;\n const origin = pad.left + category * slot + (slot - inner) / 2;\n\n if (mode === \"group\") {\n const gap = present.length > 1 ? 2 : 0;\n const barW = (inner - gap * (present.length - 1)) / present.length;\n\n present.forEach((item, index) => {\n const yOf = yFor(item.scale);\n const y = Math.min(yOf(item.value), yOf(0));\n\n rects.push({\n series: item.id,\n category,\n x: origin + index * (barW + gap),\n y,\n width: barW,\n height: Math.abs(yOf(item.value) - yOf(0)),\n value: item.value,\n });\n });\n continue;\n }\n\n if (mode === \"overlay\") {\n present.forEach((item) => {\n const yOf = yFor(item.scale);\n const y = Math.min(yOf(item.value), yOf(0));\n\n rects.push({\n series: item.id,\n category,\n x: origin,\n y,\n width: inner,\n height: Math.abs(yOf(item.value) - yOf(0)),\n value: item.value,\n });\n });\n continue;\n }\n\n for (const scale of [\"left\", \"right\"] as const) {\n let positive = 0;\n let negative = 0;\n const yOf = yFor(scale);\n\n for (const item of present) {\n if (item.scale !== scale) continue;\n\n const start = item.value >= 0 ? positive : negative;\n const end = start + item.value;\n\n if (item.value >= 0) positive = end;\n else negative = end;\n\n const y = Math.min(yOf(start), yOf(end));\n\n rects.push({\n series: item.id,\n category,\n x: origin,\n y,\n width: inner,\n height: Math.abs(yOf(end) - yOf(start)),\n value: item.value,\n });\n }\n }\n }\n\n return rects;\n}\n\nfunction placeHorizontal(\n options: CategoryLayoutOptions,\n pad: CategoryPad,\n left: CategoryExtent,\n right: CategoryExtent | null,\n): CategoryRect[] {\n const { mode, series, categories, width, height } = options;\n const plotW = Math.max(0, width - pad.left - pad.right);\n const plotH = Math.max(0, height - pad.top - pad.bottom);\n const xFor = (scale: CategoryScale) => {\n const extent = scale === \"right\" && right ? right : left;\n const span = extent.max - extent.min || 1;\n\n return (value: number) => pad.left + ((value - extent.min) / span) * plotW;\n };\n const slot = plotH / categories;\n const rects: CategoryRect[] = [];\n\n for (let category = 0; category < categories; category += 1) {\n const present = presentAt(series, category);\n\n if (present.length === 0) continue;\n\n const inner = slot * 0.72;\n const origin = pad.top + category * slot + (slot - inner) / 2;\n\n if (mode === \"group\") {\n const gap = present.length > 1 ? 2 : 0;\n const barH = (inner - gap * (present.length - 1)) / present.length;\n\n present.forEach((item, index) => {\n const xOf = xFor(item.scale);\n const x = Math.min(xOf(item.value), xOf(0));\n\n rects.push({\n series: item.id,\n category,\n x,\n y: origin + index * (barH + gap),\n width: Math.abs(xOf(item.value) - xOf(0)),\n height: barH,\n value: item.value,\n });\n });\n continue;\n }\n\n if (mode === \"overlay\") {\n present.forEach((item) => {\n const xOf = xFor(item.scale);\n const x = Math.min(xOf(item.value), xOf(0));\n\n rects.push({\n series: item.id,\n category,\n x,\n y: origin,\n width: Math.abs(xOf(item.value) - xOf(0)),\n height: inner,\n value: item.value,\n });\n });\n continue;\n }\n\n for (const scale of [\"left\", \"right\"] as const) {\n let positive = 0;\n let negative = 0;\n const xOf = xFor(scale);\n\n for (const item of present) {\n if (item.scale !== scale) continue;\n\n const start = item.value >= 0 ? positive : negative;\n const end = start + item.value;\n\n if (item.value >= 0) positive = end;\n else negative = end;\n\n const x = Math.min(xOf(start), xOf(end));\n\n rects.push({\n series: item.id,\n category,\n x,\n y: origin,\n width: Math.abs(xOf(end) - xOf(start)),\n height: inner,\n value: item.value,\n });\n }\n }\n }\n\n return rects;\n}\n\nfunction acrossLine(\n orientation: CategoryOrientation,\n pad: CategoryPad,\n width: number,\n height: number,\n left: CategoryExtent,\n right: CategoryExtent | null,\n value: number,\n scale: CategoryScale,\n): CategoryLine {\n const extent = scale === \"right\" && right ? right : left;\n const span = extent.max - extent.min || 1;\n\n if (orientation === \"horizontal\") {\n const plotW = Math.max(0, width - pad.left - pad.right);\n const x = pad.left + ((value - extent.min) / span) * plotW;\n\n return { x1: x, y1: pad.top, x2: x, y2: height - pad.bottom };\n }\n\n const plotH = Math.max(0, height - pad.top - pad.bottom);\n const y = pad.top + ((extent.max - value) / span) * plotH;\n\n return { x1: pad.left, y1: y, x2: width - pad.right, y2: y };\n}\n\n/** Bar rectangles, the value extents, and a helper for a reference line. */\nexport function categoryFrame(options: CategoryLayoutOptions): CategoryFrame {\n const orientation = options.orientation ?? \"vertical\";\n const pad = options.pad ?? (orientation === \"horizontal\" ? HORIZONTAL_PAD : VERTICAL_PAD);\n const pinsFor = (scale: CategoryScale) =>\n (options.pins ?? []).flatMap((pin) =>\n (pin.scale ?? \"left\") === scale && Number.isFinite(pin.value) ? [pin.value] : [],\n );\n const left = extentOf(\n options.mode,\n options.series,\n options.categories,\n \"left\",\n options.domain,\n pinsFor(\"left\"),\n ) ?? {\n min: 0,\n max: 1,\n };\n const right = extentOf(\n options.mode,\n options.series,\n options.categories,\n \"right\",\n options.rightDomain,\n pinsFor(\"right\"),\n );\n const rects =\n options.categories <= 0 || options.series.length === 0\n ? []\n : orientation === \"horizontal\"\n ? placeHorizontal(options, pad, left, right)\n : placeVertical(options, pad, left, right);\n\n return {\n rects,\n orientation,\n pad,\n left,\n right,\n across: (value, scale = \"left\") =>\n acrossLine(\n orientation,\n pad,\n options.width,\n options.height,\n left,\n right,\n value,\n scale,\n ),\n };\n}\n\n/** Bar rectangles for grouped, stacked, or overlaid category columns. */\nexport function categoryLayout(options: CategoryLayoutOptions): CategoryRect[] {\n return categoryFrame(options).rects;\n}\n\n/** Even ticks from `min` to `max`, including both ends. */\nexport function axisTicks(min: number, max: number, count = 4): number[] {\n if (!(max > min) || count < 1) return [min];\n\n const step = (max - min) / count;\n\n return Array.from({ length: count + 1 }, (_, index) =>\n Number((min + step * index).toPrecision(6)),\n );\n}\n","import { useState, type KeyboardEvent } from \"react\";\nimport type {\n CategoryBand,\n CategoryBarDatum,\n CategoryBarChartProps,\n CategoryBarSeries,\n CategoryReference,\n} from \"../../types/category.js\";\nimport { useChartTheme } from \"../../hooks/useChartTheme.js\";\nimport {\n axisTicks,\n categoryFrame,\n type CategoryScale,\n} from \"../../utils/category.utils.js\";\nimport { classes } from \"../../utils/dom.utils.js\";\nimport { HEATMAP_SVG } from \"../../styles/heatmap.js\";\n\nconst WIDTH = 640;\nconst HEIGHT = 320;\nconst NO_REFERENCES: readonly CategoryReference[] = [];\nconst NO_BANDS: readonly CategoryBand[] = [];\n\nfunction ink(categorical: readonly string[], index: number, color?: string) {\n return color ?? categorical[index % Math.max(1, categorical.length)] ?? \"currentColor\";\n}\n\nfunction readDatum(datum: CategoryBarDatum | undefined): {\n value: number | undefined;\n color?: string;\n label?: string;\n} {\n if (typeof datum === \"number\") {\n return { value: Number.isFinite(datum) ? datum : undefined };\n }\n\n if (datum && typeof datum.value === \"number\" && Number.isFinite(datum.value)) {\n return { value: datum.value, color: datum.color, label: datum.label };\n }\n\n return { value: undefined };\n}\n\nfunction seriesColor(item: CategoryBarSeries | undefined, categorical: readonly string[], index: number) {\n return ink(categorical, index, item?.color);\n}\n\nexport function CategoryBarChart({\n categories,\n series,\n mode = \"group\",\n orientation = \"vertical\",\n domain,\n rightDomain,\n reference,\n references = NO_REFERENCES,\n bands = NO_BANDS,\n activeIndex,\n valueLabel,\n width = WIDTH,\n height = HEIGHT,\n className,\n ariaLabel = \"Bar chart\",\n formatValue,\n formatTick,\n renderTooltip,\n onSelect,\n theme,\n unstyled,\n}: CategoryBarChartProps) {\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 hasRight = series.some((item) => item.scale === \"right\");\n const pad =\n orientation === \"horizontal\"\n ? { top: 12, right: hasRight ? 48 : 64, bottom: valueLabel ? 36 : 28, left: 108 }\n : { top: 16, right: hasRight ? 48 : 12, bottom: valueLabel ? 40 : 28, left: 44 };\n const lines = reference ? [reference, ...references] : references;\n const frame = categoryFrame({\n mode,\n orientation,\n domain,\n rightDomain,\n pad,\n width,\n height,\n categories: categories.length,\n pins: [\n ...lines.map((line) => ({ value: line.value, scale: line.scale })),\n ...bands.flatMap((band) => [\n { value: band.from, scale: band.scale },\n { value: band.to, scale: band.scale },\n ]),\n ],\n series: series.map((item) => ({\n id: item.id,\n scale: item.scale,\n data: item.data.map((datum) => readDatum(datum).value ?? Number.NaN),\n })),\n });\n const [focus, setFocus] = useState<number | null>(null);\n const active = focus ?? activeIndex ?? 0;\n const category = categories[active] ?? categories[0];\n const rows = series.flatMap((item, index) => {\n const datum = category === undefined ? undefined : readDatum(item.data[active]);\n\n return datum?.value === undefined\n ? []\n : [\n {\n label: item.name,\n value: formatValue?.(item.id, datum.value) ?? String(datum.value),\n color: datum.color ?? seriesColor(item, categorical, index),\n },\n ];\n });\n const tickLabel = (value: number) => formatTick?.(value) ?? String(value);\n const choose = (index: number) => {\n setFocus(index);\n const label = categories[index];\n\n if (label !== undefined) onSelect?.(label, index);\n };\n\n const onKey = (event: KeyboardEvent<SVGSVGElement>) => {\n const forward = orientation === \"horizontal\" ? \"ArrowDown\" : \"ArrowRight\";\n const back = orientation === \"horizontal\" ? \"ArrowUp\" : \"ArrowLeft\";\n\n if (event.key !== forward && event.key !== back) return;\n\n event.preventDefault();\n const next = event.key === forward ? active + 1 : active - 1;\n\n choose(Math.max(0, Math.min(categories.length - 1, next)));\n };\n\n const ticksFor = (extent: { min: number; max: number }, scale: CategoryScale) =>\n axisTicks(extent.min, extent.max).map((value) => ({\n value,\n at: frame.across(value, scale),\n }));\n\n return (\n <div\n className={classes(className)}\n data-mode={mode}\n data-orientation={orientation}\n style={{ position: \"relative\" }}\n >\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 onPointerLeave={() => setFocus(null)}\n >\n {orientation === \"horizontal\" ? (\n <line\n data-part=\"axis\"\n x1={pad.left}\n y1={pad.top}\n x2={pad.left}\n y2={height - pad.bottom}\n stroke={grid}\n />\n ) : (\n <line\n data-part=\"axis\"\n x1={pad.left}\n y1={height - pad.bottom}\n x2={width - pad.right}\n y2={height - pad.bottom}\n stroke={grid}\n />\n )}\n {categories.map((label, index) => {\n const slot =\n orientation === \"horizontal\"\n ? (height - pad.top - pad.bottom) / categories.length\n : (width - pad.left - pad.right) / categories.length;\n const at =\n orientation === \"horizontal\"\n ? pad.top + (index + 0.5) * slot\n : pad.left + (index + 0.5) * slot;\n\n return orientation === \"horizontal\" ? (\n <text\n key={label}\n data-part=\"tick\"\n x={pad.left - 8}\n y={at}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n fill={text}\n fontSize={11}\n >\n {label}\n </text>\n ) : (\n <text\n key={label}\n data-part=\"tick\"\n x={at}\n y={height - pad.bottom + 14}\n textAnchor=\"middle\"\n fill={text}\n fontSize={11}\n >\n {label}\n </text>\n );\n })}\n {ticksFor(frame.left, \"left\").map((tick) =>\n orientation === \"horizontal\" ? (\n <text\n key={`l-${tick.value}`}\n data-part=\"value-tick\"\n x={tick.at.x1}\n y={height - pad.bottom + 14}\n textAnchor=\"middle\"\n fill={text}\n fontSize={11}\n >\n {tickLabel(tick.value)}\n </text>\n ) : (\n <text\n key={`l-${tick.value}`}\n data-part=\"value-tick\"\n x={pad.left - 6}\n y={tick.at.y1}\n textAnchor=\"end\"\n dominantBaseline=\"middle\"\n fill={text}\n fontSize={11}\n >\n {tickLabel(tick.value)}\n </text>\n ),\n )}\n {frame.right &&\n ticksFor(frame.right, \"right\").map((tick) => (\n <text\n key={`r-${tick.value}`}\n data-part=\"value-tick\"\n data-scale=\"right\"\n x={width - pad.right + 6}\n y={tick.at.y1}\n dominantBaseline=\"middle\"\n fill={text}\n fontSize={11}\n >\n {tickLabel(tick.value)}\n </text>\n ))}\n {valueLabel && (\n <text\n data-part=\"axis-label\"\n x={orientation === \"horizontal\" ? (pad.left + width - pad.right) / 2 : pad.left}\n y={height - 4}\n textAnchor={orientation === \"horizontal\" ? \"middle\" : \"start\"}\n fill={text}\n fontSize={11}\n >\n {valueLabel}\n </text>\n )}\n {bands.map((band, index) => {\n const start = frame.across(band.from, band.scale);\n const end = frame.across(band.to, band.scale);\n const horizontal = orientation === \"horizontal\";\n const x = horizontal ? Math.min(start.x1, end.x1) : pad.left;\n const y = horizontal ? pad.top : Math.min(start.y1, end.y1);\n const bandWidth = horizontal\n ? Math.abs(start.x1 - end.x1)\n : width - pad.left - pad.right;\n const bandHeight = horizontal\n ? height - pad.top - pad.bottom\n : Math.abs(start.y1 - end.y1);\n\n return (\n <rect\n key={`band-${index}`}\n data-part=\"band\"\n x={x}\n y={y}\n width={bandWidth}\n height={bandHeight}\n fill={band.color ?? grid}\n />\n );\n })}\n {lines.map((line, index) => {\n const at = frame.across(line.value, line.scale);\n\n return (\n <g key={`ref-${line.label ?? line.value}-${index}`}>\n <line\n data-part=\"reference\"\n {...at}\n stroke={line.color ?? grid}\n strokeDasharray=\"4 3\"\n />\n {line.label && (\n <text\n data-part=\"reference-label\"\n x={at.x1 + 4}\n y={pad.top + 10 + index * 12}\n fill={line.color ?? text}\n fontSize={10}\n >\n {line.label}\n </text>\n )}\n </g>\n );\n })}\n {frame.rects.map((rect) => {\n const item = series.find((entry) => entry.id === rect.series);\n const index = series.findIndex((entry) => entry.id === rect.series);\n const datum = readDatum(item?.data[rect.category]);\n\n return (\n <g key={`${rect.series}:${rect.category}`}>\n <rect\n data-part=\"bar\"\n data-series={rect.series}\n data-category={rect.category}\n data-active={rect.category === active ? \"\" : undefined}\n x={rect.x}\n y={rect.y}\n width={rect.width}\n height={Math.max(rect.height, rect.value === 0 ? 0 : 1)}\n fill={datum?.color ?? seriesColor(item, categorical, index)}\n opacity={mode === \"overlay\" ? 0.72 : 1}\n onPointerEnter={() => setFocus(rect.category)}\n onClick={() => choose(rect.category)}\n />\n {datum?.label && (\n <text\n data-part=\"bar-label\"\n data-series={rect.series}\n x={orientation === \"horizontal\" ? rect.x + rect.width + 4 : rect.x + rect.width / 2}\n y={orientation === \"horizontal\" ? rect.y + rect.height / 2 : rect.y - 4}\n textAnchor={orientation === \"horizontal\" ? \"start\" : \"middle\"}\n dominantBaseline={orientation === \"horizontal\" ? \"middle\" : \"auto\"}\n fill={text}\n fontSize={10}\n >\n {datum.label}\n </text>\n )}\n </g>\n );\n })}\n </svg>\n {category !== undefined &&\n (renderTooltip?.(category, rows) ?? (\n <div data-part=\"tooltip\">\n <div data-part=\"tooltip-time\">{category}</div>\n {rows.map((row) => (\n <div key={row.label} data-part=\"tooltip-row\">\n {row.label} {row.value}\n </div>\n ))}\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAoEA,IAAME,IAA4B;CAAE,KAAK;CAAI,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAG,GACvEC,IAA8B;CAAE,KAAK;CAAI,OAAO;CAAI,QAAQ;CA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