@schemavaults/ui 0.107.0 → 0.109.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/dist/components/hooks/index.d.ts +2 -0
- package/dist/components/hooks/index.js +1 -0
- package/dist/components/hooks/index.js.map +1 -1
- package/dist/components/hooks/use-measured-width.d.ts +33 -0
- package/dist/components/hooks/use-measured-width.js +61 -0
- package/dist/components/hooks/use-measured-width.js.map +1 -0
- package/dist/components/ui/bar-chart/bar-chart.d.ts +71 -13
- package/dist/components/ui/bar-chart/bar-chart.js +263 -96
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/bar-list/bar-list.d.ts +63 -0
- package/dist/components/ui/bar-list/bar-list.js +39 -0
- package/dist/components/ui/bar-list/bar-list.js.map +1 -0
- package/dist/components/ui/bar-list/index.d.ts +2 -0
- package/dist/components/ui/bar-list/index.js +2 -0
- package/dist/components/ui/bar-list/index.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-colors.d.ts +69 -0
- package/dist/components/ui/chart-primitives/chart-colors.js +201 -0
- package/dist/components/ui/chart-primitives/chart-colors.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-data-table.d.ts +20 -0
- package/dist/components/ui/chart-primitives/chart-data-table.js +11 -0
- package/dist/components/ui/chart-primitives/chart-data-table.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-format.d.ts +12 -0
- package/dist/components/ui/chart-primitives/chart-format.js +40 -0
- package/dist/components/ui/chart-primitives/chart-format.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-legend.d.ts +20 -0
- package/dist/components/ui/chart-primitives/chart-legend.js +22 -0
- package/dist/components/ui/chart-primitives/chart-legend.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-scale.d.ts +59 -0
- package/dist/components/ui/chart-primitives/chart-scale.js +178 -0
- package/dist/components/ui/chart-primitives/chart-scale.js.map +1 -0
- package/dist/components/ui/chart-primitives/chart-tooltip.d.ts +67 -0
- package/dist/components/ui/chart-primitives/chart-tooltip.js +57 -0
- package/dist/components/ui/chart-primitives/chart-tooltip.js.map +1 -0
- package/dist/components/ui/chart-primitives/index.d.ts +12 -0
- package/dist/components/ui/chart-primitives/index.js +7 -0
- package/dist/components/ui/chart-primitives/index.js.map +1 -0
- package/dist/components/ui/chart-primitives/responsive-chart.d.ts +26 -0
- package/dist/components/ui/chart-primitives/responsive-chart.js +25 -0
- package/dist/components/ui/chart-primitives/responsive-chart.js.map +1 -0
- package/dist/components/ui/chart-primitives/use-chart-width.d.ts +30 -0
- package/dist/components/ui/chart-primitives/use-chart-width.js +56 -0
- package/dist/components/ui/chart-primitives/use-chart-width.js.map +1 -0
- package/dist/components/ui/funnel-chart/funnel-chart.d.ts +135 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js +257 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
- package/dist/components/ui/funnel-chart/index.d.ts +3 -0
- package/dist/components/ui/funnel-chart/index.js +3 -0
- package/dist/components/ui/funnel-chart/index.js.map +1 -0
- package/dist/components/ui/histogram/bin-values.d.ts +53 -0
- package/dist/components/ui/histogram/bin-values.js +137 -0
- package/dist/components/ui/histogram/bin-values.js.map +1 -0
- package/dist/components/ui/histogram/histogram.d.ts +76 -0
- package/dist/components/ui/histogram/histogram.js +149 -0
- package/dist/components/ui/histogram/histogram.js.map +1 -0
- package/dist/components/ui/histogram/index.d.ts +4 -0
- package/dist/components/ui/histogram/index.js +3 -0
- package/dist/components/ui/histogram/index.js.map +1 -0
- package/dist/components/ui/index.d.ts +8 -0
- package/dist/components/ui/index.js +4 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.d.ts +104 -20
- package/dist/components/ui/line-chart/line-chart.js +285 -139
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.d.ts +35 -7
- package/dist/components/ui/pie-chart/pie-chart.js +200 -88
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/scatter-plot/scatter-plot.d.ts +123 -21
- package/dist/components/ui/scatter-plot/scatter-plot.js +507 -243
- package/dist/components/ui/scatter-plot/scatter-plot.js.map +1 -1
- package/dist/components/ui/sparkline/sparkline.d.ts +15 -5
- package/dist/components/ui/sparkline/sparkline.js +21 -37
- package/dist/components/ui/sparkline/sparkline.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { cn } from "../../../lib/utils";
|
|
6
|
+
export const funnelChartSizeIds = [
|
|
7
|
+
"sm",
|
|
8
|
+
"md",
|
|
9
|
+
"lg",
|
|
10
|
+
"xl",
|
|
11
|
+
];
|
|
12
|
+
export const funnelChartOrientationIds = [
|
|
13
|
+
"vertical",
|
|
14
|
+
"horizontal",
|
|
15
|
+
];
|
|
16
|
+
export const funnelChartStageColorIds = [
|
|
17
|
+
"default",
|
|
18
|
+
"primary",
|
|
19
|
+
"positive",
|
|
20
|
+
"warning",
|
|
21
|
+
"destructive",
|
|
22
|
+
"muted",
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Baseline used when computing each stage's conversion rate.
|
|
26
|
+
*
|
|
27
|
+
* - `"previous"` — share of the immediately preceding stage (step conversion).
|
|
28
|
+
* - `"first"` — share of the first stage (cumulative conversion).
|
|
29
|
+
* - `"none"` — don't compute conversion rates.
|
|
30
|
+
*/
|
|
31
|
+
export const funnelChartConversionModeIds = [
|
|
32
|
+
"previous",
|
|
33
|
+
"first",
|
|
34
|
+
"none",
|
|
35
|
+
];
|
|
36
|
+
/** Default canvas dimensions per size. Either axis can be overridden via the
|
|
37
|
+
* `width` / `height` props. */
|
|
38
|
+
const SIZE_TO_CANVAS = {
|
|
39
|
+
sm: { width: 260, height: 160 },
|
|
40
|
+
md: { width: 380, height: 220 },
|
|
41
|
+
lg: { width: 500, height: 300 },
|
|
42
|
+
xl: { width: 660, height: 400 },
|
|
43
|
+
};
|
|
44
|
+
const STAGE_FILL_CLASSES = {
|
|
45
|
+
default: "fill-schemavaults-brand-blue",
|
|
46
|
+
primary: "fill-primary",
|
|
47
|
+
positive: "fill-emerald-500 dark:fill-emerald-400",
|
|
48
|
+
warning: "fill-warning",
|
|
49
|
+
destructive: "fill-destructive",
|
|
50
|
+
muted: "fill-muted-foreground",
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Fallback color rotation when a stage doesn't specify its own color. Index is
|
|
54
|
+
* the stage position in the input array, modulo the palette length.
|
|
55
|
+
*/
|
|
56
|
+
const DEFAULT_COLOR_ROTATION = [
|
|
57
|
+
"default",
|
|
58
|
+
"positive",
|
|
59
|
+
"warning",
|
|
60
|
+
"destructive",
|
|
61
|
+
"primary",
|
|
62
|
+
"muted",
|
|
63
|
+
];
|
|
64
|
+
export const funnelChartVariants = cva("relative inline-flex shrink-0 items-center justify-center", {
|
|
65
|
+
variants: {
|
|
66
|
+
size: {
|
|
67
|
+
sm: "text-[10px]",
|
|
68
|
+
md: "text-[11px]",
|
|
69
|
+
lg: "text-xs",
|
|
70
|
+
xl: "text-sm",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
size: "md",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
function sanitizeValue(value) {
|
|
78
|
+
if (!Number.isFinite(value) || value < 0)
|
|
79
|
+
return 0;
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
function lerp(from, to, t) {
|
|
83
|
+
return from + (to - from) * t;
|
|
84
|
+
}
|
|
85
|
+
function defaultValueLabel({ value }) {
|
|
86
|
+
return value.toLocaleString();
|
|
87
|
+
}
|
|
88
|
+
function defaultConversionLabel({ conversion, }) {
|
|
89
|
+
if (conversion === null)
|
|
90
|
+
return null;
|
|
91
|
+
return `${Math.round(conversion * 100)}%`;
|
|
92
|
+
}
|
|
93
|
+
function FunnelChart({ stages, label, orientation = "vertical", max, size, width, height, stageGap = 4, minStageRatio = 0.04, taperLastStage = false, conversionMode = "previous", showStageLabels = true, showValueLabels = true, showConversionLabels = true, stageLabelFormatter, valueLabelFormatter, conversionLabelFormatter, onStageClick, children, className, overlayClassName, stageLabelClassName, valueLabelClassName, conversionLabelClassName, ref, ...props }) {
|
|
94
|
+
const resolvedSize = size ?? "md";
|
|
95
|
+
const canvas = SIZE_TO_CANVAS[resolvedSize];
|
|
96
|
+
const W = width ?? canvas.width;
|
|
97
|
+
const H = height ?? canvas.height;
|
|
98
|
+
const titleId = useId();
|
|
99
|
+
const isHorizontal = orientation === "horizontal";
|
|
100
|
+
const showConversion = showConversionLabels && conversionMode !== "none";
|
|
101
|
+
const hasLabelGutter = showStageLabels || showValueLabels;
|
|
102
|
+
// One gutter carries the stage name + value, the opposite one carries the
|
|
103
|
+
// conversion rate. Vertical funnels read left-to-right; horizontal funnels
|
|
104
|
+
// put the names underneath, like a category axis.
|
|
105
|
+
const labelGutter = hasLabelGutter ? (isHorizontal ? 38 : 92) : 6;
|
|
106
|
+
const conversionGutter = showConversion
|
|
107
|
+
? isHorizontal
|
|
108
|
+
? 18
|
|
109
|
+
: 54
|
|
110
|
+
: 6;
|
|
111
|
+
const padTop = isHorizontal ? conversionGutter : 6;
|
|
112
|
+
const padBottom = isHorizontal ? labelGutter : 6;
|
|
113
|
+
const padLeft = isHorizontal ? 6 : labelGutter;
|
|
114
|
+
const padRight = isHorizontal ? 6 : conversionGutter;
|
|
115
|
+
const plotX0 = padLeft;
|
|
116
|
+
const plotY0 = padTop;
|
|
117
|
+
const plotW = Math.max(0, W - padLeft - padRight);
|
|
118
|
+
const plotH = Math.max(0, H - padTop - padBottom);
|
|
119
|
+
const count = stages.length;
|
|
120
|
+
const sanitized = stages.map((s) => sanitizeValue(s.value));
|
|
121
|
+
const computedMax = max ?? Math.max(0, ...sanitized);
|
|
122
|
+
const scaleMax = computedMax > 0 ? computedMax : 1;
|
|
123
|
+
const minRatio = Math.max(0, Math.min(1, minStageRatio));
|
|
124
|
+
/** Thickness of the funnel, in SVG units, for a given stage value. */
|
|
125
|
+
function thicknessFor(value) {
|
|
126
|
+
const span = isHorizontal ? plotH : plotW;
|
|
127
|
+
const raw = value / scaleMax;
|
|
128
|
+
const ratio = value > 0 ? Math.max(minRatio, raw) : 0;
|
|
129
|
+
return Math.min(1, ratio) * span;
|
|
130
|
+
}
|
|
131
|
+
function conversionFor(index) {
|
|
132
|
+
if (conversionMode === "none")
|
|
133
|
+
return null;
|
|
134
|
+
if (conversionMode === "first") {
|
|
135
|
+
const baseline = sanitized[0] ?? 0;
|
|
136
|
+
return baseline > 0 ? sanitized[index] / baseline : null;
|
|
137
|
+
}
|
|
138
|
+
if (index === 0)
|
|
139
|
+
return null;
|
|
140
|
+
const baseline = sanitized[index - 1];
|
|
141
|
+
return baseline > 0 ? sanitized[index] / baseline : null;
|
|
142
|
+
}
|
|
143
|
+
const resolved = (() => {
|
|
144
|
+
if (count === 0)
|
|
145
|
+
return [];
|
|
146
|
+
const flowSpan = isHorizontal ? plotW : plotH;
|
|
147
|
+
const band = flowSpan / count;
|
|
148
|
+
const gap = Math.max(0, Math.min(band, stageGap));
|
|
149
|
+
// Center line the funnel is mirrored around.
|
|
150
|
+
const center = isHorizontal
|
|
151
|
+
? plotY0 + plotH / 2
|
|
152
|
+
: plotX0 + plotW / 2;
|
|
153
|
+
return stages.map((stage, index) => {
|
|
154
|
+
const value = sanitized[index];
|
|
155
|
+
const isLast = index === count - 1;
|
|
156
|
+
const startThickness = thicknessFor(value);
|
|
157
|
+
const endThickness = isLast
|
|
158
|
+
? taperLastStage
|
|
159
|
+
? 0
|
|
160
|
+
: startThickness
|
|
161
|
+
: thicknessFor(sanitized[index + 1]);
|
|
162
|
+
// Interpolate the edges across the band, then inset by the gap so the
|
|
163
|
+
// silhouette stays continuous no matter how wide the gap is.
|
|
164
|
+
const bandStart = (isHorizontal ? plotX0 : plotY0) + index * band;
|
|
165
|
+
const a = bandStart + gap / 2;
|
|
166
|
+
const b = bandStart + band - gap / 2;
|
|
167
|
+
const tA = band > 0 ? (a - bandStart) / band : 0;
|
|
168
|
+
const tB = band > 0 ? (b - bandStart) / band : 1;
|
|
169
|
+
const thicknessA = lerp(startThickness, endThickness, tA);
|
|
170
|
+
const thicknessB = lerp(startThickness, endThickness, tB);
|
|
171
|
+
const points = isHorizontal
|
|
172
|
+
? [
|
|
173
|
+
`${a},${center - thicknessA / 2}`,
|
|
174
|
+
`${b},${center - thicknessB / 2}`,
|
|
175
|
+
`${b},${center + thicknessB / 2}`,
|
|
176
|
+
`${a},${center + thicknessA / 2}`,
|
|
177
|
+
].join(" ")
|
|
178
|
+
: [
|
|
179
|
+
`${center - thicknessA / 2},${a}`,
|
|
180
|
+
`${center + thicknessA / 2},${a}`,
|
|
181
|
+
`${center + thicknessB / 2},${b}`,
|
|
182
|
+
`${center - thicknessB / 2},${b}`,
|
|
183
|
+
].join(" ");
|
|
184
|
+
const mid = (a + b) / 2;
|
|
185
|
+
const presetColor = stage.color ??
|
|
186
|
+
DEFAULT_COLOR_ROTATION[index % DEFAULT_COLOR_ROTATION.length];
|
|
187
|
+
const fillClass = stage.fill
|
|
188
|
+
? undefined
|
|
189
|
+
: STAGE_FILL_CLASSES[presetColor];
|
|
190
|
+
return {
|
|
191
|
+
stage,
|
|
192
|
+
value,
|
|
193
|
+
fraction: value / scaleMax,
|
|
194
|
+
conversion: conversionFor(index),
|
|
195
|
+
points,
|
|
196
|
+
labelX: isHorizontal ? mid : plotX0 - 10,
|
|
197
|
+
labelY: isHorizontal ? plotY0 + plotH + 14 : mid,
|
|
198
|
+
conversionX: isHorizontal ? mid : plotX0 + plotW + 10,
|
|
199
|
+
conversionY: isHorizontal ? plotY0 - 6 : mid,
|
|
200
|
+
fillClass,
|
|
201
|
+
fill: stage.fill,
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
})();
|
|
205
|
+
function contextFor(r, index) {
|
|
206
|
+
return {
|
|
207
|
+
stage: r.stage,
|
|
208
|
+
value: r.value,
|
|
209
|
+
fraction: r.fraction,
|
|
210
|
+
conversion: r.conversion,
|
|
211
|
+
index,
|
|
212
|
+
count,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
return (_jsxs("div", { ref: ref, role: "img", "aria-labelledby": titleId, "data-slot": "funnel-chart", "data-orientation": orientation, className: cn(funnelChartVariants({ size }), className), style: { width: W, height: H }, ...props, children: [_jsxs("svg", { width: W, height: H, viewBox: `0 0 ${W} ${H}`, "aria-hidden": children ? "true" : undefined, className: "h-full w-full overflow-visible", children: [_jsx("title", { id: titleId, children: label }), resolved.length === 0 ? (_jsx("text", { x: W / 2, y: H / 2, textAnchor: "middle", dominantBaseline: "central", className: "fill-muted-foreground", children: "No data" })) : (resolved.map((r) => {
|
|
216
|
+
const handler = r.stage.onClick ?? onStageClick;
|
|
217
|
+
const isInteractive = typeof handler === "function";
|
|
218
|
+
const name = r.stage.label ?? r.stage.id;
|
|
219
|
+
return (_jsx("polygon", { points: r.points, fill: r.fill, "data-stage-id": r.stage.id, role: isInteractive ? "button" : undefined, tabIndex: isInteractive ? 0 : undefined, "aria-label": `${name}: ${r.value}`, onClick: isInteractive
|
|
220
|
+
? (event) => {
|
|
221
|
+
handler(r.stage, event);
|
|
222
|
+
}
|
|
223
|
+
: undefined, onKeyDown: isInteractive
|
|
224
|
+
? (event) => {
|
|
225
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
handler(r.stage, event);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
: undefined, className: cn("transition-opacity", r.fillClass, isInteractive &&
|
|
231
|
+
"cursor-pointer hover:opacity-80 focus:outline-none focus-visible:opacity-80", r.stage.className) }, r.stage.id));
|
|
232
|
+
})), hasLabelGutter && resolved.length > 0 ? (_jsx("g", { "aria-hidden": "true", "data-slot": "funnel-chart-stage-labels", className: "pointer-events-none select-none", children: resolved.map((r, index) => {
|
|
233
|
+
const context = contextFor(r, index);
|
|
234
|
+
const name = showStageLabels
|
|
235
|
+
? stageLabelFormatter
|
|
236
|
+
? stageLabelFormatter(context)
|
|
237
|
+
: (r.stage.label ?? r.stage.id)
|
|
238
|
+
: null;
|
|
239
|
+
const value = showValueLabels
|
|
240
|
+
? (valueLabelFormatter ?? defaultValueLabel)(context)
|
|
241
|
+
: null;
|
|
242
|
+
if (!name && !value)
|
|
243
|
+
return null;
|
|
244
|
+
// Two stacked lines: the name, then the value underneath it.
|
|
245
|
+
const bothLines = Boolean(name) && Boolean(value);
|
|
246
|
+
const anchor = isHorizontal ? "middle" : "end";
|
|
247
|
+
return (_jsxs("g", { children: [name ? (_jsx("text", { x: r.labelX, y: r.labelY, dy: bothLines && !isHorizontal ? "-0.25em" : 0, textAnchor: anchor, dominantBaseline: isHorizontal ? "auto" : "central", className: cn("fill-foreground font-medium", stageLabelClassName), children: name })) : null, value ? (_jsx("text", { x: r.labelX, y: r.labelY, dy: bothLines ? "1.25em" : isHorizontal ? 0 : "0.35em", textAnchor: anchor, dominantBaseline: isHorizontal ? "auto" : "central", className: cn("fill-muted-foreground tabular-nums", valueLabelClassName), children: value })) : null] }, `${r.stage.id}-label`));
|
|
248
|
+
}) })) : null, showConversion && resolved.length > 0 ? (_jsx("g", { "aria-hidden": "true", "data-slot": "funnel-chart-conversion-labels", className: "pointer-events-none select-none", children: resolved.map((r, index) => {
|
|
249
|
+
const text = (conversionLabelFormatter ?? defaultConversionLabel)(contextFor(r, index));
|
|
250
|
+
if (text === null || text === "")
|
|
251
|
+
return null;
|
|
252
|
+
return (_jsx("text", { x: r.conversionX, y: r.conversionY, textAnchor: isHorizontal ? "middle" : "start", dominantBaseline: isHorizontal ? "auto" : "central", className: cn("fill-muted-foreground tabular-nums", conversionLabelClassName), children: text }, `${r.stage.id}-conv`));
|
|
253
|
+
}) })) : null] }), children ? (_jsx("div", { className: cn("pointer-events-none absolute inset-0 flex items-center justify-center text-center", overlayClassName), children: children })) : null] }));
|
|
254
|
+
}
|
|
255
|
+
FunnelChart.displayName = "FunnelChart";
|
|
256
|
+
export { FunnelChart };
|
|
257
|
+
//# sourceMappingURL=funnel-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funnel-chart.js","sourceRoot":"","sources":["../../../../src/components/ui/funnel-chart/funnel-chart.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AASlE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACuB,CAAC;AAG9B,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,UAAU;IACV,YAAY;CACe,CAAC;AAI9B,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS;IACT,SAAS;IACT,UAAU;IACV,SAAS;IACT,aAAa;IACb,OAAO;CACoB,CAAC;AAI9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,UAAU;IACV,OAAO;IACP,MAAM;CACqB,CAAC;AAI9B;+BAC+B;AAC/B,MAAM,cAAc,GAGhB;IACF,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAC/B,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAC/B,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAC/B,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;CAChC,CAA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C,WAAW,EAChB,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAC7C,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACnD,SAAS,EAAE,EAAE,CACX,oCAAoC,EACpC,wBAAwB,CACzB,YAEA,IAAI,IAVA,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAWpB,CACR,CAAC;wBACJ,CAAC,CAAC,GACA,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,QAAQ,CAAC,CAAC,CAAC,CACV,cACE,SAAS,EAAE,EAAE,CACX,mFAAmF,EACnF,gBAAgB,CACjB,YAEA,QAAQ,GACL,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC;AACD,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/funnel-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-free binning for `Histogram`: turns raw values into adjacent
|
|
3
|
+
* buckets with round edges.
|
|
4
|
+
*/
|
|
5
|
+
/** One histogram bar: the values in `[lower, upper)`. */
|
|
6
|
+
export interface HistogramBucket {
|
|
7
|
+
/** Inclusive lower edge. */
|
|
8
|
+
lower: number;
|
|
9
|
+
/** Exclusive upper edge, or `null` for an open-ended overflow bucket. */
|
|
10
|
+
upper: number | null;
|
|
11
|
+
count: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const histogramScaleIds: ["linear", "log"];
|
|
14
|
+
export type HistogramScaleId = (typeof histogramScaleIds)[number];
|
|
15
|
+
export interface BinValuesOptions {
|
|
16
|
+
/**
|
|
17
|
+
* `"linear"` (default): equal-width bins of a nice width (1, 2 or 5 ×
|
|
18
|
+
* 10^k). `"log"`: edges at 0, 1, 2, 5, 10, 20, 50 … up past the largest
|
|
19
|
+
* value, for data spread over orders of magnitude.
|
|
20
|
+
*/
|
|
21
|
+
scale?: HistogramScaleId;
|
|
22
|
+
/**
|
|
23
|
+
* The data's resolution: no bin is narrower than this, and log edges start
|
|
24
|
+
* no lower. Pass `1` for whole-number data (milliseconds, counts) so there
|
|
25
|
+
* are no bins with nothing in them by construction. Defaults to `0`.
|
|
26
|
+
*/
|
|
27
|
+
minBinWidth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Linear only: fold values past the 95th percentile into one open-ended
|
|
30
|
+
* overflow bucket when the largest value is more than twice the p95 (and
|
|
31
|
+
* there are at least 20 values), so a long tail doesn't flatten the rest.
|
|
32
|
+
* Defaults to `true`.
|
|
33
|
+
*/
|
|
34
|
+
foldTail?: boolean;
|
|
35
|
+
/** Linear only: fewest bins to aim for. Defaults to `8`. */
|
|
36
|
+
minBins?: number;
|
|
37
|
+
/** Linear only: most bins to aim for. Defaults to `40`. */
|
|
38
|
+
maxBins?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Bins `values` for a `Histogram`. Every finite value lands in exactly one
|
|
42
|
+
* bucket (the counts sum to the number of finite values; `NaN` and
|
|
43
|
+
* infinities are skipped). Empty buckets at either end are trimmed; empty
|
|
44
|
+
* buckets inside the range stay, so gaps show.
|
|
45
|
+
*
|
|
46
|
+
* - linear: bins of a nice width starting at the smallest value, about √n of
|
|
47
|
+
* them (8–40). A long tail past twice the p95 folds into one overflow
|
|
48
|
+
* bucket (`upper: null`).
|
|
49
|
+
* - log: edges at 0, 1, 2, 5, 10 … (scaled to the data's smallest decade),
|
|
50
|
+
* up past the largest value. Values at or below 0 count in the first
|
|
51
|
+
* bucket.
|
|
52
|
+
*/
|
|
53
|
+
export declare function binValues(values: readonly number[], options?: BinValuesOptions): HistogramBucket[];
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-free binning for `Histogram`: turns raw values into adjacent
|
|
3
|
+
* buckets with round edges.
|
|
4
|
+
*/
|
|
5
|
+
import { cleanNumber, niceStep } from "../../ui/chart-primitives/chart-scale";
|
|
6
|
+
export const histogramScaleIds = ["linear", "log"];
|
|
7
|
+
function ascending(a, b) {
|
|
8
|
+
return a - b;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Percentile `p` (0–1) of ascending-sorted values, interpolating linearly
|
|
12
|
+
* between the closest ranks (like Postgres `percentile_cont`).
|
|
13
|
+
*/
|
|
14
|
+
function percentile(sorted, p) {
|
|
15
|
+
const rank = Math.min(1, Math.max(0, p)) * (sorted.length - 1);
|
|
16
|
+
const lower = Math.floor(rank);
|
|
17
|
+
const upper = Math.ceil(rank);
|
|
18
|
+
return sorted[lower] + (sorted[upper] - sorted[lower]) * (rank - lower);
|
|
19
|
+
}
|
|
20
|
+
/** Decimal places that represent multiples of `width` exactly enough for edges. */
|
|
21
|
+
function decimalsOf(width) {
|
|
22
|
+
if (!(width > 0) || width >= 1)
|
|
23
|
+
return 0;
|
|
24
|
+
return Math.min(20, Math.ceil(-Math.log10(width) - 1e-9) + 1);
|
|
25
|
+
}
|
|
26
|
+
function linearEdges(sorted, options) {
|
|
27
|
+
const min = sorted[0];
|
|
28
|
+
const max = sorted[sorted.length - 1];
|
|
29
|
+
const p95 = percentile(sorted, 0.95);
|
|
30
|
+
// Distances from the minimum, so the test doesn't depend on where zero is.
|
|
31
|
+
const hasLongTail = options.foldTail &&
|
|
32
|
+
sorted.length >= 20 &&
|
|
33
|
+
p95 > min &&
|
|
34
|
+
max - min > 2 * (p95 - min);
|
|
35
|
+
const top = hasLongTail ? p95 : max;
|
|
36
|
+
const bins = Math.min(Math.max(1, options.maxBins), Math.max(Math.max(1, options.minBins), Math.ceil(Math.sqrt(sorted.length))));
|
|
37
|
+
// Identical values: one bin at the data's resolution (or its decade).
|
|
38
|
+
const width = top > min
|
|
39
|
+
? niceStep((top - min) / bins, options.minBinWidth)
|
|
40
|
+
: options.minBinWidth > 0
|
|
41
|
+
? niceStep(options.minBinWidth)
|
|
42
|
+
: min !== 0
|
|
43
|
+
? 10 ** Math.floor(Math.log10(Math.abs(min)))
|
|
44
|
+
: 1;
|
|
45
|
+
// Each edge is start + k·width, rounded to the width's own precision (not
|
|
46
|
+
// accumulated, so no float drift), and must move forward: a width below
|
|
47
|
+
// the values' precision (epoch milliseconds binned by 0.1) stops the walk
|
|
48
|
+
// instead of looping forever.
|
|
49
|
+
const decimals = decimalsOf(width);
|
|
50
|
+
const edgeAt = (k) => Number((Math.floor(min / width) * width + k * width).toFixed(decimals));
|
|
51
|
+
const edges = [edgeAt(0)];
|
|
52
|
+
const maxEdges = bins * 3 + 3;
|
|
53
|
+
for (let k = 1; edges[edges.length - 1] <= top && k <= maxEdges; k += 1) {
|
|
54
|
+
const next = edgeAt(k);
|
|
55
|
+
if (next <= edges[edges.length - 1])
|
|
56
|
+
break;
|
|
57
|
+
edges.push(next);
|
|
58
|
+
}
|
|
59
|
+
if (edges.length === 1)
|
|
60
|
+
edges.push(edges[0] + width);
|
|
61
|
+
return {
|
|
62
|
+
edges,
|
|
63
|
+
overflowFrom: hasLongTail ? edges[edges.length - 1] : null,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** 0, then the 1-2-5 series from the smallest positive value's decade (or `minBinWidth`) past `max`. */
|
|
67
|
+
function logEdges(sorted, minBinWidth) {
|
|
68
|
+
const max = sorted[sorted.length - 1];
|
|
69
|
+
const smallestPositive = sorted.find((v) => v > 0);
|
|
70
|
+
const decade = smallestPositive === undefined
|
|
71
|
+
? 1
|
|
72
|
+
: 10 ** Math.floor(Math.log10(smallestPositive));
|
|
73
|
+
let edge = niceStep(Math.max(decade, minBinWidth));
|
|
74
|
+
const edges = [0, edge];
|
|
75
|
+
while (edges[edges.length - 1] <= max) {
|
|
76
|
+
edge = nextOneTwoFive(edge);
|
|
77
|
+
edges.push(edge);
|
|
78
|
+
}
|
|
79
|
+
return edges;
|
|
80
|
+
}
|
|
81
|
+
/** The next value in 1, 2, 5, 10, 20, 50 … after `value` (itself on the series). */
|
|
82
|
+
function nextOneTwoFive(value) {
|
|
83
|
+
const magnitude = 10 ** Math.floor(Math.log10(value) + 1e-9);
|
|
84
|
+
const leading = Math.round(value / magnitude);
|
|
85
|
+
const next = leading < 2 ? 2 : leading < 5 ? 5 : 10;
|
|
86
|
+
return cleanNumber(next * magnitude);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Bins `values` for a `Histogram`. Every finite value lands in exactly one
|
|
90
|
+
* bucket (the counts sum to the number of finite values; `NaN` and
|
|
91
|
+
* infinities are skipped). Empty buckets at either end are trimmed; empty
|
|
92
|
+
* buckets inside the range stay, so gaps show.
|
|
93
|
+
*
|
|
94
|
+
* - linear: bins of a nice width starting at the smallest value, about √n of
|
|
95
|
+
* them (8–40). A long tail past twice the p95 folds into one overflow
|
|
96
|
+
* bucket (`upper: null`).
|
|
97
|
+
* - log: edges at 0, 1, 2, 5, 10 … (scaled to the data's smallest decade),
|
|
98
|
+
* up past the largest value. Values at or below 0 count in the first
|
|
99
|
+
* bucket.
|
|
100
|
+
*/
|
|
101
|
+
export function binValues(values, options = {}) {
|
|
102
|
+
const { scale = "linear", minBinWidth = 0, foldTail = true, minBins = 8, maxBins = 40, } = options;
|
|
103
|
+
const sorted = values.filter(Number.isFinite).sort(ascending);
|
|
104
|
+
if (sorted.length === 0)
|
|
105
|
+
return [];
|
|
106
|
+
const safeMinBinWidth = Number.isFinite(minBinWidth) && minBinWidth > 0 ? minBinWidth : 0;
|
|
107
|
+
const { edges, overflowFrom } = scale === "log"
|
|
108
|
+
? { edges: logEdges(sorted, safeMinBinWidth), overflowFrom: null }
|
|
109
|
+
: linearEdges(sorted, {
|
|
110
|
+
minBinWidth: safeMinBinWidth,
|
|
111
|
+
foldTail,
|
|
112
|
+
minBins,
|
|
113
|
+
maxBins,
|
|
114
|
+
});
|
|
115
|
+
const buckets = [];
|
|
116
|
+
for (let i = 0; i < edges.length - 1; i += 1) {
|
|
117
|
+
buckets.push({ lower: edges[i], upper: edges[i + 1], count: 0 });
|
|
118
|
+
}
|
|
119
|
+
if (overflowFrom !== null) {
|
|
120
|
+
buckets.push({ lower: overflowFrom, upper: null, count: 0 });
|
|
121
|
+
}
|
|
122
|
+
let index = 0;
|
|
123
|
+
for (const value of sorted) {
|
|
124
|
+
while (index < buckets.length - 1 &&
|
|
125
|
+
buckets[index].upper !== null &&
|
|
126
|
+
value >= buckets[index].upper) {
|
|
127
|
+
index += 1;
|
|
128
|
+
}
|
|
129
|
+
buckets[index].count += 1;
|
|
130
|
+
}
|
|
131
|
+
const first = buckets.findIndex((bucket) => bucket.count > 0);
|
|
132
|
+
let last = buckets.length - 1;
|
|
133
|
+
while (last > first && buckets[last].count === 0)
|
|
134
|
+
last -= 1;
|
|
135
|
+
return buckets.slice(first, last + 1);
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=bin-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin-values.js","sourceRoot":"","sources":["../../../../src/components/ui/histogram/bin-values.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAWrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,KAAK,CAA6B,CAAC;AA6B/E,SAAS,SAAS,CAAC,CAAS,EAAE,CAAS;IACrC,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,MAAyB,EAAE,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,CAAC;IAED,MAAM,KAAK,GAAW,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACtE,IAAI,IAAI,GAAW,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACtC,OAAO,IAAI,GAAG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAE,CAAC,KAAK,KAAK,CAAC;QAAE,IAAI,IAAI,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactElement, ReactNode, Ref } from "react";
|
|
2
|
+
import { type ChartColorId } from "../../ui/chart-primitives/chart-colors";
|
|
3
|
+
import { type ChartWidth } from "../../ui/chart-primitives/use-chart-width";
|
|
4
|
+
import type { HistogramBucket } from "./bin-values";
|
|
5
|
+
/** What the counted things are called in the readout: "12 traces". */
|
|
6
|
+
export interface HistogramCountNoun {
|
|
7
|
+
singular: string;
|
|
8
|
+
plural: string;
|
|
9
|
+
}
|
|
10
|
+
export interface HistogramProps extends Omit<HTMLAttributes<HTMLDivElement>, "color"> {
|
|
11
|
+
/**
|
|
12
|
+
* Adjacent buckets in ascending order, e.g. from `binValues()`. A last
|
|
13
|
+
* bucket with `upper: null` is an open-ended overflow bucket.
|
|
14
|
+
*/
|
|
15
|
+
buckets: ReadonlyArray<HistogramBucket>;
|
|
16
|
+
/** Accessible label describing what the chart represents. */
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* The size of the whole sample, for each bucket's share. Defaults to the
|
|
20
|
+
* sum of the bucket counts.
|
|
21
|
+
*/
|
|
22
|
+
total?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Canvas width in pixels, or `"auto"` (the default) to fill the container
|
|
25
|
+
* and redraw when it resizes. An `"auto"` chart renders an empty
|
|
26
|
+
* placeholder at its height until it has been measured.
|
|
27
|
+
*/
|
|
28
|
+
width?: ChartWidth;
|
|
29
|
+
/** Canvas height in pixels, x-axis labels included. Defaults to `240`. */
|
|
30
|
+
height?: number;
|
|
31
|
+
/** Colour of the bars. Defaults to `"chart-1"`. */
|
|
32
|
+
color?: ChartColorId;
|
|
33
|
+
/** Colour of the overflow bucket, set apart from the regular bins. Defaults to `"other"`. */
|
|
34
|
+
overflowColor?: ChartColorId;
|
|
35
|
+
/** Format a bucket edge for the x-axis and the readout. Defaults to a thousands-separated number. */
|
|
36
|
+
formatBoundary?: (value: number) => string;
|
|
37
|
+
/** Format a count. Defaults to a thousands-separated number. */
|
|
38
|
+
formatCount?: (count: number) => string;
|
|
39
|
+
/** Describe a bucket's range in the readout and the table. Defaults to "lower – upper" / "lower or more". */
|
|
40
|
+
describeBucket?: (bucket: HistogramBucket) => string;
|
|
41
|
+
/** What the counted things are called. Defaults to value / values. */
|
|
42
|
+
countNoun?: HistogramCountNoun;
|
|
43
|
+
/**
|
|
44
|
+
* The caption under the chart when the last bucket is an overflow bucket.
|
|
45
|
+
* Defaults to a sentence saying how many values it holds; `false` hides it.
|
|
46
|
+
*/
|
|
47
|
+
overflowCaption?: ReactNode | false;
|
|
48
|
+
/** Show the hover / focus readout. Defaults to `true`. */
|
|
49
|
+
showTooltip?: boolean;
|
|
50
|
+
/** Text rendered when there are no buckets. */
|
|
51
|
+
emptyMessage?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Hold the current render at reduced opacity while new data loads, rather
|
|
54
|
+
* than flashing a skeleton.
|
|
55
|
+
*/
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
/** Optional ref forwarded to the wrapper element. */
|
|
58
|
+
ref?: Ref<HTMLDivElement>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A histogram: the counts of adjacent ranges of one quantity, as touching
|
|
62
|
+
* columns on a shared count axis, labelled at the bucket edges.
|
|
63
|
+
*
|
|
64
|
+
* Unlike `BarChart` (unrelated categories, each label under its bar), the
|
|
65
|
+
* x-axis here is continuous: labels sit on the edges between bars, thinned
|
|
66
|
+
* so they never crowd. An open-ended overflow bucket is drawn in the
|
|
67
|
+
* de-emphasis grey with a caption, so a long tail doesn't flatten the rest.
|
|
68
|
+
* Hover or the arrow keys read out a bucket's range, count and share.
|
|
69
|
+
*
|
|
70
|
+
* Bin raw values with `binValues()`.
|
|
71
|
+
*/
|
|
72
|
+
declare function Histogram({ buckets, label, total, width, height, color, overflowColor, formatBoundary, formatCount, describeBucket, countNoun, overflowCaption, showTooltip, emptyMessage, loading, className, style, ref, ...props }: HistogramProps): ReactElement;
|
|
73
|
+
declare namespace Histogram {
|
|
74
|
+
var displayName: string;
|
|
75
|
+
}
|
|
76
|
+
export { Histogram };
|