@vielzeug/prism 26.10.20 → 26.10.22
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 +1 -1
- package/dist/charts/bar/bar-chart.cjs +1 -1
- package/dist/charts/bar/bar-chart.cjs.map +1 -1
- package/dist/charts/bar/bar-chart.d.ts.map +1 -1
- package/dist/charts/bar/bar-chart.js +136 -97
- package/dist/charts/bar/bar-chart.js.map +1 -1
- package/dist/charts/bar/bar-value-labels.cjs +2 -0
- package/dist/charts/bar/bar-value-labels.cjs.map +1 -0
- package/dist/charts/bar/bar-value-labels.d.ts +34 -0
- package/dist/charts/bar/bar-value-labels.d.ts.map +1 -0
- package/dist/charts/bar/bar-value-labels.js +55 -0
- package/dist/charts/bar/bar-value-labels.js.map +1 -0
- package/dist/charts/heatmap/heatmap-chart.cjs +2 -0
- package/dist/charts/heatmap/heatmap-chart.cjs.map +1 -0
- package/dist/charts/heatmap/heatmap-chart.d.ts +12 -0
- package/dist/charts/heatmap/heatmap-chart.d.ts.map +1 -0
- package/dist/charts/heatmap/heatmap-chart.js +282 -0
- package/dist/charts/heatmap/heatmap-chart.js.map +1 -0
- package/dist/charts/heatmap/heatmap-color.cjs +2 -0
- package/dist/charts/heatmap/heatmap-color.cjs.map +1 -0
- package/dist/charts/heatmap/heatmap-color.d.ts +32 -0
- package/dist/charts/heatmap/heatmap-color.d.ts.map +1 -0
- package/dist/charts/heatmap/heatmap-color.js +61 -0
- package/dist/charts/heatmap/heatmap-color.js.map +1 -0
- package/dist/charts/heatmap/index.d.ts +2 -0
- package/dist/charts/heatmap/index.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/prism.cjs +1 -1
- package/dist/prism.cjs.map +1 -1
- package/dist/prism.iife.js +1 -1
- package/dist/prism.iife.js.map +1 -1
- package/dist/prism.js +539 -123
- package/dist/prism.js.map +1 -1
- package/dist/theme/prism.css +47 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import "../../_dev.js";
|
|
2
|
+
import { createSvgElement as e, removeChildren as t, setAttributes as n } from "../../svg/element.js";
|
|
3
|
+
import { estimateTextWidth as r } from "../../svg/text.js";
|
|
4
|
+
import { comparisonContent as i } from "../../interaction/tooltip.js";
|
|
5
|
+
import { chartArea as a, resolveMargin as o } from "../../core/layout.js";
|
|
6
|
+
import { createRadialScaffold as s } from "../../core/chart-scaffold.js";
|
|
7
|
+
import { createRamp as c, valueColorFor as l } from "./heatmap-color.js";
|
|
8
|
+
//#region src/charts/heatmap/heatmap-chart.ts
|
|
9
|
+
var u = {
|
|
10
|
+
ArrowDown: 1,
|
|
11
|
+
ArrowLeft: -1,
|
|
12
|
+
ArrowRight: 1,
|
|
13
|
+
ArrowUp: -1
|
|
14
|
+
}, d = [
|
|
15
|
+
"#e0f2fe",
|
|
16
|
+
"#7dd3fc",
|
|
17
|
+
"#0ea5e9",
|
|
18
|
+
"#0369a1",
|
|
19
|
+
"#082f49"
|
|
20
|
+
], f = "var(--prism-grid-color, #e2e8f0)", p = 11, m = 8, h = .4, g = 96, _ = .71;
|
|
21
|
+
function createHeatmapChart(v, y) {
|
|
22
|
+
let b = y.rows, x = y.columns, S = y.cells, C = y.domain, w = y.rowSummary, T = o({
|
|
23
|
+
bottom: 8,
|
|
24
|
+
left: 8,
|
|
25
|
+
right: 8,
|
|
26
|
+
top: 8,
|
|
27
|
+
...y.margin
|
|
28
|
+
}), E = Math.max(0, y.gap ?? 2), D = y.showValues ?? !0, O = y.valueFormat ?? String, k = c(y.colorRange ?? d), A = y.emptyColor ?? f, j = buildBinBounds(y.bins), M = j.length, N = /* @__PURE__ */ new Map(), cellKey = (e, t) => `${e}\u0000${t}`, P = null, F = -1, I = null, positionOf = () => .5, L = e("g"), add = (t, n, r) => {
|
|
29
|
+
let i = e(t, r);
|
|
30
|
+
return n.appendChild(i), i;
|
|
31
|
+
};
|
|
32
|
+
function currentDomain() {
|
|
33
|
+
if (C) return C;
|
|
34
|
+
let e = S.filter((e) => e.value !== null).map((e) => e.value);
|
|
35
|
+
return e.length === 0 ? [0, 1] : [Math.min(...e), Math.max(...e)];
|
|
36
|
+
}
|
|
37
|
+
function computePositionOf() {
|
|
38
|
+
if (M === 0) {
|
|
39
|
+
let [e, t] = currentDomain();
|
|
40
|
+
return (n) => t === e ? 1 : Math.min(1, Math.max(0, (n - e) / (t - e)));
|
|
41
|
+
}
|
|
42
|
+
return (e) => {
|
|
43
|
+
let t = M - 1;
|
|
44
|
+
for (let n = 0; n < M; n += 1) {
|
|
45
|
+
let r = j[n][1];
|
|
46
|
+
if (r !== null && e < r) {
|
|
47
|
+
t = n;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return M === 1 ? .5 : t / (M - 1);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function render(e) {
|
|
55
|
+
let { legend: i, svg: o } = e;
|
|
56
|
+
o.contains(L) || o.appendChild(L), t(L), I = null, F = -1, P = null, N.clear();
|
|
57
|
+
for (let e of S) N.set(cellKey(e.row, e.column), e);
|
|
58
|
+
if (positionOf = computePositionOf(), M > 0 && i) {
|
|
59
|
+
let e = j.map((e, t) => ({
|
|
60
|
+
color: k(M === 1 ? .5 : t / (M - 1)),
|
|
61
|
+
name: (y.binLabel ?? defaultBinLabel(O))(e[0], e[1])
|
|
62
|
+
}));
|
|
63
|
+
y.emptyLabel && e.push({
|
|
64
|
+
color: A,
|
|
65
|
+
name: y.emptyLabel
|
|
66
|
+
}), i.update(e);
|
|
67
|
+
}
|
|
68
|
+
if (b.length === 0 || x.length === 0) {
|
|
69
|
+
i?.update([]);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let s = a(e.dimensions.width, e.dimensions.height, T), c = w && w.values.length > 0 ? w : null, u = Math.min(Math.max(...b.map((e) => r(e, p))) + 16, s.width * h), d = 0;
|
|
73
|
+
if (c) {
|
|
74
|
+
let e = c.values.filter((e) => e !== null), t = Math.max(r(c.header ?? "", p), ...e.map((e) => r(e, p)));
|
|
75
|
+
d = Math.min(t + 16, s.width * h);
|
|
76
|
+
}
|
|
77
|
+
let f = Math.max(...x.map((e) => r(e, p))), v = f > s.width / x.length - m, C = v ? Math.min(f * _ + m, g) : 19, R = T.left + u, z = T.top + C, B = Math.max(0, s.width - u - d) / x.length, V = Math.max(0, s.height - C) / b.length, H = [];
|
|
78
|
+
for (let e = 0; e < b.length; e += 1) for (let t = 0; t < x.length; t += 1) {
|
|
79
|
+
let n = b[e], r = x[t], i = N.get(cellKey(n, r))?.value ?? null;
|
|
80
|
+
H.push({
|
|
81
|
+
column: r,
|
|
82
|
+
columnWidth: B,
|
|
83
|
+
fill: i === null ? A : k(positionOf(i)),
|
|
84
|
+
row: n,
|
|
85
|
+
rowHeight: V,
|
|
86
|
+
x: R + t * B,
|
|
87
|
+
y: z + e * V
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
P = {
|
|
91
|
+
cells: H,
|
|
92
|
+
columnCount: x.length,
|
|
93
|
+
colWidth: B,
|
|
94
|
+
gridX: R,
|
|
95
|
+
gridY: z,
|
|
96
|
+
rowCount: b.length,
|
|
97
|
+
rowHeight: V
|
|
98
|
+
};
|
|
99
|
+
for (let e = 0; e < x.length; e += 1) {
|
|
100
|
+
let t = R + e * B + B / 2, r = add("text", L, {
|
|
101
|
+
"aria-hidden": "true",
|
|
102
|
+
class: "prism-heatmap-column-label",
|
|
103
|
+
x: String(t),
|
|
104
|
+
y: String(T.top + C - 4)
|
|
105
|
+
});
|
|
106
|
+
r.textContent = x[e], v ? n(r, {
|
|
107
|
+
"text-anchor": "start",
|
|
108
|
+
transform: `rotate(-45 ${t} ${T.top + C - 4})`
|
|
109
|
+
}) : n(r, { "text-anchor": "middle" });
|
|
110
|
+
}
|
|
111
|
+
for (let e = 0; e < b.length; e += 1) {
|
|
112
|
+
let t = add("text", L, {
|
|
113
|
+
"aria-hidden": "true",
|
|
114
|
+
class: "prism-heatmap-row-label",
|
|
115
|
+
"dominant-baseline": "central",
|
|
116
|
+
"text-anchor": "end",
|
|
117
|
+
x: String(R - m),
|
|
118
|
+
y: String(z + e * V + V / 2)
|
|
119
|
+
});
|
|
120
|
+
t.textContent = b[e];
|
|
121
|
+
}
|
|
122
|
+
if (c) {
|
|
123
|
+
let e = T.left + s.width - d / 2;
|
|
124
|
+
if (c.header) {
|
|
125
|
+
let t = add("text", L, {
|
|
126
|
+
"aria-hidden": "true",
|
|
127
|
+
class: "prism-heatmap-summary-header",
|
|
128
|
+
"text-anchor": "middle",
|
|
129
|
+
x: String(e),
|
|
130
|
+
y: String(T.top + C - 4)
|
|
131
|
+
});
|
|
132
|
+
t.textContent = c.header;
|
|
133
|
+
}
|
|
134
|
+
for (let t = 0; t < b.length; t += 1) {
|
|
135
|
+
let n = add("text", L, {
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
class: "prism-heatmap-summary",
|
|
138
|
+
"dominant-baseline": "central",
|
|
139
|
+
"text-anchor": "middle",
|
|
140
|
+
x: String(e),
|
|
141
|
+
y: String(z + t * V + V / 2)
|
|
142
|
+
});
|
|
143
|
+
n.textContent = c.values[t] ?? "—";
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (let e of H) {
|
|
147
|
+
let t = N.get(cellKey(e.row, e.column))?.value ?? null, n = add("g", L, {
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
class: "prism-heatmap-cell"
|
|
150
|
+
});
|
|
151
|
+
if (add("rect", n, {
|
|
152
|
+
class: "prism-heatmap-cell-rect",
|
|
153
|
+
height: String(Math.max(0, e.rowHeight - E)),
|
|
154
|
+
rx: "2",
|
|
155
|
+
width: String(Math.max(0, e.columnWidth - E)),
|
|
156
|
+
x: String(e.x + E / 2),
|
|
157
|
+
y: String(e.y + E / 2)
|
|
158
|
+
}).style.setProperty("fill", e.fill), D && t !== null && B > 28 && V > 16) {
|
|
159
|
+
let r = add("text", n, {
|
|
160
|
+
class: "prism-heatmap-value",
|
|
161
|
+
"dominant-baseline": "central",
|
|
162
|
+
"text-anchor": "middle",
|
|
163
|
+
x: String(e.x + B / 2),
|
|
164
|
+
y: String(e.y + V / 2)
|
|
165
|
+
});
|
|
166
|
+
r.textContent = O(t), r.style.setProperty("fill", l(e.fill, "var(--prism-text-color, #0f172a)"));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
I = add("rect", L, {
|
|
170
|
+
class: "prism-heatmap-highlight",
|
|
171
|
+
height: "0",
|
|
172
|
+
rx: "2",
|
|
173
|
+
visibility: "hidden",
|
|
174
|
+
width: "0",
|
|
175
|
+
x: "0",
|
|
176
|
+
y: "0"
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function eventFor(e, t) {
|
|
180
|
+
return {
|
|
181
|
+
cell: N.get(cellKey(e.row, e.column)),
|
|
182
|
+
column: e.column,
|
|
183
|
+
originalEvent: t,
|
|
184
|
+
row: e.row
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function indexAt(e, t) {
|
|
188
|
+
if (!P) return -1;
|
|
189
|
+
let n = e.getBoundingClientRect(), r = t.clientX - n.left, i = t.clientY - n.top, a = Math.floor((r - P.gridX) / P.colWidth), o = Math.floor((i - P.gridY) / P.rowHeight);
|
|
190
|
+
return a < 0 || o < 0 || a >= P.columnCount || o >= P.rowCount ? -1 : o * P.columnCount + a;
|
|
191
|
+
}
|
|
192
|
+
function describe(e) {
|
|
193
|
+
let t = P.cells[e], n = N.get(cellKey(t.row, t.column))?.value ?? null;
|
|
194
|
+
return `${t.row} \u00b7 ${t.column}: ${n === null ? "—" : O(n)}`;
|
|
195
|
+
}
|
|
196
|
+
function activate(e, t, r) {
|
|
197
|
+
if (!P || !I) return;
|
|
198
|
+
let a = P.cells[t];
|
|
199
|
+
if (!a) return;
|
|
200
|
+
F = t;
|
|
201
|
+
let o = N.get(cellKey(a.row, a.column))?.value ?? null;
|
|
202
|
+
n(I, {
|
|
203
|
+
height: String(Math.max(0, a.rowHeight - E)),
|
|
204
|
+
visibility: "visible",
|
|
205
|
+
width: String(Math.max(0, a.columnWidth - E)),
|
|
206
|
+
x: String(a.x + E / 2),
|
|
207
|
+
y: String(a.y + E / 2)
|
|
208
|
+
}), y.onCellHover?.(eventFor(a, r));
|
|
209
|
+
let s = describe(t);
|
|
210
|
+
if (!e.tooltip) {
|
|
211
|
+
e.announcer.announce(s);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
let c = e.svg.getBoundingClientRect(), l = e.container.getBoundingClientRect();
|
|
215
|
+
e.tooltip.show(a.x + a.columnWidth / 2 + (c.left - l.left), a.y + (c.top - l.top), {
|
|
216
|
+
key: cellKey(a.row, a.column),
|
|
217
|
+
meta: { text: s },
|
|
218
|
+
value: o ?? 0
|
|
219
|
+
}, {
|
|
220
|
+
color: a.fill,
|
|
221
|
+
data: [],
|
|
222
|
+
name: `${a.row} \u00b7 ${a.column}`
|
|
223
|
+
}, i(e.svg.ownerDocument, `${a.row} \u00b7 ${a.column}`, [{
|
|
224
|
+
color: a.fill,
|
|
225
|
+
name: a.column,
|
|
226
|
+
value: o === null ? "—" : O(o)
|
|
227
|
+
}], s));
|
|
228
|
+
}
|
|
229
|
+
function deactivate(e) {
|
|
230
|
+
F !== -1 && (F = -1, I?.setAttribute("visibility", "hidden"), y.onCellHover?.(null), e.tooltip?.hide(), e.announcer.clear());
|
|
231
|
+
}
|
|
232
|
+
return s(v, {
|
|
233
|
+
a11y: y.a11y,
|
|
234
|
+
legend: M > 0 && y.legend !== !1 && {},
|
|
235
|
+
margin: y.margin,
|
|
236
|
+
tooltip: y.tooltip
|
|
237
|
+
}, (e) => {
|
|
238
|
+
if (render(e), P) return {
|
|
239
|
+
onClick(t) {
|
|
240
|
+
let n = indexAt(e.svg, t);
|
|
241
|
+
n >= 0 && y.onCellClick?.(eventFor(P.cells[n], t));
|
|
242
|
+
},
|
|
243
|
+
onKeyDown(t) {
|
|
244
|
+
let n = u[t.key];
|
|
245
|
+
if (n !== void 0) {
|
|
246
|
+
if (t.preventDefault(), F < 0) {
|
|
247
|
+
activate(e, 0, t);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
let r = P.columnCount, i = Math.floor(F / r), a = F % r;
|
|
251
|
+
if (t.key === "ArrowUp" || t.key === "ArrowDown") {
|
|
252
|
+
let o = i + n;
|
|
253
|
+
o >= 0 && o < P.rowCount && activate(e, o * r + a, t);
|
|
254
|
+
} else {
|
|
255
|
+
let o = a + n;
|
|
256
|
+
o >= 0 && o < P.columnCount && activate(e, i * r + o, t);
|
|
257
|
+
}
|
|
258
|
+
} else (t.key === "Enter" || t.key === " ") && F >= 0 ? (t.preventDefault(), y.onCellClick?.(eventFor(P.cells[F], t))) : t.key === "Escape" && deactivate(e);
|
|
259
|
+
},
|
|
260
|
+
onMouseLeave: () => deactivate(e),
|
|
261
|
+
onMouseMove(t) {
|
|
262
|
+
let n = indexAt(e.svg, t);
|
|
263
|
+
n < 0 ? F >= 0 && deactivate(e) : n !== F && activate(e, n, t);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}, (e) => {
|
|
267
|
+
e.rows && (b = e.rows), e.columns && (x = e.columns), S = e.cells, e.domain && (C = e.domain), "rowSummary" in e && (w = e.rowSummary);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function buildBinBounds(e) {
|
|
271
|
+
if (!e || e.length === 0) return [];
|
|
272
|
+
let t = [...e].sort((e, t) => e - t), n = [], r = null;
|
|
273
|
+
for (let e of t) n.push([r, e]), r = e;
|
|
274
|
+
return n.push([r, null]), n;
|
|
275
|
+
}
|
|
276
|
+
function defaultBinLabel(e) {
|
|
277
|
+
return (t, n) => t === null && n !== null ? `<${e(n)}` : t !== null && n === null ? `\u2265${e(t)}` : t !== null && n !== null ? `${e(t)}\u2013${e(n)}` : "—";
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
export { createHeatmapChart };
|
|
281
|
+
|
|
282
|
+
//# sourceMappingURL=heatmap-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmap-chart.js","names":["ARROW_STEPS","DEFAULT_COLOR_RANGE","EMPTY_FALLBACK","LABEL_FONT_SIZE","LABEL_PAD","MAX_LABEL_GUTTER_RATIO","MAX_HEADER_BAND","ROTATED_LABEL_SLOPE","rows","config","columns","cells","domain","rowSummary","margin","resolveMargin","gap","showValues","formatValue","ramp","createRamp","emptyColor","binBounds","binCount","cellsByKey","row","column","layout","activeIndex","highlight","root","createSvgElement","el","tag","attrs","parent","values","cell","d0","d1","value","bin","i","upper","ctx","svg","removeChildren","legend","items","bounds","area","chartArea","summary","leftGutter","estimateTextWidth","rightGutter","summaryTexts","widest","maxColumnLabelWidth","rotate","headerBand","gridX","gridY","colWidth","rowHeight","geometries","r","c","cx","label","setAttributes","summaryX","header","geometry","group","text","valueColorFor","rect","x","event","y","col","index","originalEvent","svgRect","containerRect","comparisonContent","createRadialScaffold","container","step","colCount","nextRow","nextCol","next","bins","thresholds","a","b","lower","threshold","from","to"],"sources":["../../../src/charts/heatmap/heatmap-chart.ts"],"sourcesContent":["import { devOnly, warn } from '../../_dev';\nimport type { ChartEventHandlers, RadialScaffoldContext } from '../../core/chart-scaffold';\nimport { createRadialScaffold } from '../../core/chart-scaffold';\nimport { chartArea, resolveMargin } from '../../core/layout';\nimport { comparisonContent } from '../../interaction/tooltip';\nimport { createSvgElement, removeChildren, setAttributes } from '../../svg/element';\nimport { estimateTextWidth } from '../../svg/text';\nimport type { ChartHandle, HeatmapCell, HeatmapChartConfig, HeatmapData, HeatmapEvent } from '../../types';\nimport { createRamp, valueColorFor } from './heatmap-color';\n\nconst ARROW_STEPS: Record<string, number> = { ArrowDown: 1, ArrowLeft: -1, ArrowRight: 1, ArrowUp: -1 };\nconst DEFAULT_COLOR_RANGE = ['#e0f2fe', '#7dd3fc', '#0ea5e9', '#0369a1', '#082f49'];\nconst EMPTY_FALLBACK = 'var(--prism-grid-color, #e2e8f0)';\nconst LABEL_FONT_SIZE = 11;\nconst LABEL_PAD = 8;\nconst MAX_LABEL_GUTTER_RATIO = 0.4;\nconst MAX_HEADER_BAND = 96;\nconst ROTATED_LABEL_SLOPE = 0.71;\n\ninterface CellGeometry {\n column: string;\n columnWidth: number;\n fill: string;\n row: string;\n rowHeight: number;\n x: number;\n y: number;\n}\n\ninterface HeatmapLayout {\n cells: CellGeometry[];\n columnCount: number;\n colWidth: number;\n gridX: number;\n gridY: number;\n rowCount: number;\n rowHeight: number;\n}\n\nfunction warnOnInvalid(rows: readonly string[], columns: readonly string[], cells: readonly HeatmapCell[]): void {\n devOnly(() => {\n const rowSet = new Set(rows);\n const columnSet = new Set(columns);\n\n for (const cell of cells) {\n if (!rowSet.has(cell.row)) warn(`Heatmap cell for column \"${cell.column}\" has unknown row \"${cell.row}\".`);\n if (!columnSet.has(cell.column)) {\n warn(`Heatmap cell for row \"${cell.row}\" has unknown column \"${cell.column}\".`);\n }\n }\n });\n}\n\n/**\n * A matrix heatmap: rows down the left, columns across the top, one colored cell per\n * row/column pair. The ramp is continuous by default; `bins` turns it into discrete\n * steps with a swatch legend. Cells show their formatted value when they are large\n * enough, choosing dark or light text against the fill.\n *\n * Keyboard: arrows move the active cell, Enter/Space fires `onCellClick`, Escape\n * deactivates. The tooltip (or the live region without one) describes the active cell.\n */\nexport function createHeatmapChart(container: HTMLElement, config: HeatmapChartConfig): ChartHandle<HeatmapData> {\n let rows = config.rows;\n let columns = config.columns;\n let cells = config.cells;\n let domain = config.domain;\n let rowSummary = config.rowSummary;\n\n warnOnInvalid(rows, columns, cells);\n\n const margin = resolveMargin({ bottom: 8, left: 8, right: 8, top: 8, ...config.margin });\n const gap = Math.max(0, config.gap ?? 2);\n const showValues = config.showValues ?? true;\n const formatValue = config.valueFormat ?? String;\n const ramp = createRamp(config.colorRange ?? DEFAULT_COLOR_RANGE);\n const emptyColor = config.emptyColor ?? EMPTY_FALLBACK;\n const binBounds = buildBinBounds(config.bins);\n const binCount = binBounds.length;\n\n const cellsByKey = new Map<string, HeatmapCell>();\n const cellKey = (row: string, column: string): string => `${row}\\u0000${column}`;\n\n let layout: HeatmapLayout | null = null;\n let activeIndex = -1;\n let highlight: SVGRectElement | null = null;\n // Set by render(): the ramp position for a value depends on the current domain/bins.\n let positionOf: (value: number) => number = () => 0.5;\n\n const root = createSvgElement('g');\n\n const add = <K extends keyof SVGElementTagNameMap>(\n tag: K,\n parent: SVGElement,\n attrs?: Record<string, number | string | undefined>,\n ): SVGElementTagNameMap[K] => {\n const el = createSvgElement(tag, attrs);\n\n parent.appendChild(el);\n\n return el;\n };\n\n function currentDomain(): [number, number] {\n if (domain) return domain;\n\n const values = cells.filter((cell) => cell.value !== null).map((cell) => cell.value as number);\n\n if (values.length === 0) return [0, 1];\n\n return [Math.min(...values), Math.max(...values)];\n }\n\n function computePositionOf(): (value: number) => number {\n if (binCount === 0) {\n const [d0, d1] = currentDomain();\n\n return (value) => (d1 === d0 ? 1 : Math.min(1, Math.max(0, (value - d0) / (d1 - d0))));\n }\n\n return (value) => {\n let bin = binCount - 1;\n\n for (let i = 0; i < binCount; i += 1) {\n const upper = binBounds[i]![1];\n\n if (upper !== null && value < upper) {\n bin = i;\n break;\n }\n }\n\n return binCount === 1 ? 0.5 : bin / (binCount - 1);\n };\n }\n\n function render(ctx: RadialScaffoldContext): void {\n const { legend, svg } = ctx;\n\n if (!svg.contains(root)) svg.appendChild(root);\n removeChildren(root);\n highlight = null;\n activeIndex = -1;\n layout = null;\n\n cellsByKey.clear();\n for (const cell of cells) cellsByKey.set(cellKey(cell.row, cell.column), cell);\n\n positionOf = computePositionOf();\n\n if (binCount > 0 && legend) {\n const items = binBounds.map((bounds, i) => ({\n color: ramp(binCount === 1 ? 0.5 : i / (binCount - 1)),\n name: (config.binLabel ?? defaultBinLabel(formatValue))(bounds[0], bounds[1]),\n }));\n\n if (config.emptyLabel) items.push({ color: emptyColor, name: config.emptyLabel });\n legend.update(items);\n }\n\n if (rows.length === 0 || columns.length === 0) {\n legend?.update([]);\n\n return;\n }\n\n const area = chartArea(ctx.dimensions.width, ctx.dimensions.height, margin);\n const summary = rowSummary && rowSummary.values.length > 0 ? rowSummary : null;\n const leftGutter = Math.min(\n Math.max(...rows.map((row) => estimateTextWidth(row, LABEL_FONT_SIZE))) + LABEL_PAD * 2,\n area.width * MAX_LABEL_GUTTER_RATIO,\n );\n let rightGutter = 0;\n\n if (summary) {\n const summaryTexts = summary.values.filter((value): value is string => value !== null);\n const widest = Math.max(\n estimateTextWidth(summary.header ?? '', LABEL_FONT_SIZE),\n ...summaryTexts.map((value) => estimateTextWidth(value, LABEL_FONT_SIZE)),\n );\n\n rightGutter = Math.min(widest + LABEL_PAD * 2, area.width * MAX_LABEL_GUTTER_RATIO);\n }\n\n const maxColumnLabelWidth = Math.max(...columns.map((column) => estimateTextWidth(column, LABEL_FONT_SIZE)));\n const rotate = maxColumnLabelWidth > area.width / columns.length - LABEL_PAD;\n const headerBand = rotate\n ? Math.min(maxColumnLabelWidth * ROTATED_LABEL_SLOPE + LABEL_PAD, MAX_HEADER_BAND)\n : LABEL_FONT_SIZE + LABEL_PAD;\n\n const gridX = margin.left + leftGutter;\n const gridY = margin.top + headerBand;\n const colWidth = Math.max(0, area.width - leftGutter - rightGutter) / columns.length;\n const rowHeight = Math.max(0, area.height - headerBand) / rows.length;\n\n const geometries: CellGeometry[] = [];\n\n for (let r = 0; r < rows.length; r += 1) {\n for (let c = 0; c < columns.length; c += 1) {\n const row = rows[r]!;\n const column = columns[c]!;\n const value = cellsByKey.get(cellKey(row, column))?.value ?? null;\n\n geometries.push({\n column,\n columnWidth: colWidth,\n fill: value === null ? emptyColor : ramp(positionOf(value)),\n row,\n rowHeight,\n x: gridX + c * colWidth,\n y: gridY + r * rowHeight,\n });\n }\n }\n\n layout = {\n cells: geometries,\n columnCount: columns.length,\n colWidth,\n gridX,\n gridY,\n rowCount: rows.length,\n rowHeight,\n };\n\n // Column headers: horizontal when they fit their column, rotated -45° otherwise.\n for (let c = 0; c < columns.length; c += 1) {\n const cx = gridX + c * colWidth + colWidth / 2;\n const label = add('text', root, {\n 'aria-hidden': 'true',\n class: 'prism-heatmap-column-label',\n x: String(cx),\n y: String(margin.top + headerBand - 4),\n });\n\n label.textContent = columns[c];\n\n if (rotate) {\n setAttributes(label, { 'text-anchor': 'start', transform: `rotate(-45 ${cx} ${margin.top + headerBand - 4})` });\n } else {\n setAttributes(label, { 'text-anchor': 'middle' });\n }\n }\n\n // Row labels in the left gutter.\n for (let r = 0; r < rows.length; r += 1) {\n const label = add('text', root, {\n 'aria-hidden': 'true',\n class: 'prism-heatmap-row-label',\n 'dominant-baseline': 'central',\n 'text-anchor': 'end',\n x: String(gridX - LABEL_PAD),\n y: String(gridY + r * rowHeight + rowHeight / 2),\n });\n\n label.textContent = rows[r];\n }\n\n // Row summary in the right gutter: header in the column-header band, one value per row.\n if (summary) {\n const summaryX = margin.left + area.width - rightGutter / 2;\n\n if (summary.header) {\n const header = add('text', root, {\n 'aria-hidden': 'true',\n class: 'prism-heatmap-summary-header',\n 'text-anchor': 'middle',\n x: String(summaryX),\n y: String(margin.top + headerBand - 4),\n });\n\n header.textContent = summary.header;\n }\n\n for (let r = 0; r < rows.length; r += 1) {\n const label = add('text', root, {\n 'aria-hidden': 'true',\n class: 'prism-heatmap-summary',\n 'dominant-baseline': 'central',\n 'text-anchor': 'middle',\n x: String(summaryX),\n y: String(gridY + r * rowHeight + rowHeight / 2),\n });\n\n label.textContent = summary.values[r] ?? '\\u2014';\n }\n }\n\n // Cells, with their in-cell value when it fits.\n for (const geometry of geometries) {\n const value = cellsByKey.get(cellKey(geometry.row, geometry.column))?.value ?? null;\n const group = add('g', root, { 'aria-hidden': 'true', class: 'prism-heatmap-cell' });\n const rect = add('rect', group, {\n class: 'prism-heatmap-cell-rect',\n height: String(Math.max(0, geometry.rowHeight - gap)),\n rx: '2',\n width: String(Math.max(0, geometry.columnWidth - gap)),\n x: String(geometry.x + gap / 2),\n y: String(geometry.y + gap / 2),\n });\n\n rect.style.setProperty('fill', geometry.fill);\n\n if (showValues && value !== null && colWidth > 28 && rowHeight > 16) {\n const text = add('text', group, {\n class: 'prism-heatmap-value',\n 'dominant-baseline': 'central',\n 'text-anchor': 'middle',\n x: String(geometry.x + colWidth / 2),\n y: String(geometry.y + rowHeight / 2),\n });\n\n text.textContent = formatValue(value);\n text.style.setProperty('fill', valueColorFor(geometry.fill, 'var(--prism-text-color, #0f172a)'));\n }\n }\n\n highlight = add('rect', root, {\n class: 'prism-heatmap-highlight',\n height: '0',\n rx: '2',\n visibility: 'hidden',\n width: '0',\n x: '0',\n y: '0',\n });\n }\n\n function eventFor(geometry: CellGeometry, originalEvent: Event): HeatmapEvent {\n return {\n cell: cellsByKey.get(cellKey(geometry.row, geometry.column)),\n column: geometry.column,\n originalEvent,\n row: geometry.row,\n };\n }\n\n function indexAt(svg: SVGSVGElement, event: MouseEvent): number {\n if (!layout) return -1;\n\n const rect = svg.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const col = Math.floor((x - layout.gridX) / layout.colWidth);\n const row = Math.floor((y - layout.gridY) / layout.rowHeight);\n\n if (col < 0 || row < 0 || col >= layout.columnCount || row >= layout.rowCount) return -1;\n\n return row * layout.columnCount + col;\n }\n\n function describe(index: number): string {\n const geometry = layout!.cells[index]!;\n const value = cellsByKey.get(cellKey(geometry.row, geometry.column))?.value ?? null;\n\n return `${geometry.row} \\u00b7 ${geometry.column}: ${value === null ? '\\u2014' : formatValue(value)}`;\n }\n\n function activate(ctx: RadialScaffoldContext, index: number, originalEvent: Event): void {\n if (!layout || !highlight) return;\n\n const geometry = layout.cells[index];\n\n if (!geometry) return;\n\n activeIndex = index;\n const value = cellsByKey.get(cellKey(geometry.row, geometry.column))?.value ?? null;\n\n setAttributes(highlight, {\n height: String(Math.max(0, geometry.rowHeight - gap)),\n visibility: 'visible',\n width: String(Math.max(0, geometry.columnWidth - gap)),\n x: String(geometry.x + gap / 2),\n y: String(geometry.y + gap / 2),\n });\n\n config.onCellHover?.(eventFor(geometry, originalEvent));\n\n const text = describe(index);\n\n if (!ctx.tooltip) {\n ctx.announcer.announce(text);\n\n return;\n }\n\n const svgRect = ctx.svg.getBoundingClientRect();\n const containerRect = ctx.container.getBoundingClientRect();\n\n ctx.tooltip.show(\n geometry.x + geometry.columnWidth / 2 + (svgRect.left - containerRect.left),\n geometry.y + (svgRect.top - containerRect.top),\n { key: cellKey(geometry.row, geometry.column), meta: { text }, value: value ?? 0 },\n { color: geometry.fill, data: [], name: `${geometry.row} \\u00b7 ${geometry.column}` },\n comparisonContent(\n ctx.svg.ownerDocument,\n `${geometry.row} \\u00b7 ${geometry.column}`,\n [{ color: geometry.fill, name: geometry.column, value: value === null ? '\\u2014' : formatValue(value) }],\n text,\n ),\n );\n }\n\n function deactivate(ctx: RadialScaffoldContext): void {\n if (activeIndex === -1) return;\n\n activeIndex = -1;\n highlight?.setAttribute('visibility', 'hidden');\n config.onCellHover?.(null);\n ctx.tooltip?.hide();\n ctx.announcer.clear();\n }\n\n return createRadialScaffold<HeatmapData>(\n container,\n {\n a11y: config.a11y,\n legend: binCount > 0 && config.legend !== false ? {} : false,\n margin: config.margin,\n tooltip: config.tooltip,\n },\n (ctx): ChartEventHandlers | undefined => {\n render(ctx);\n\n if (!layout) return undefined;\n\n return {\n onClick(event) {\n const index = indexAt(ctx.svg, event);\n\n if (index >= 0) config.onCellClick?.(eventFor(layout!.cells[index]!, event));\n },\n onKeyDown(event) {\n const step = ARROW_STEPS[event.key];\n\n if (step !== undefined) {\n event.preventDefault();\n\n if (activeIndex < 0) {\n activate(ctx, 0, event);\n\n return;\n }\n\n const colCount = layout!.columnCount;\n const row = Math.floor(activeIndex / colCount);\n const col = activeIndex % colCount;\n\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n const nextRow = row + step;\n\n if (nextRow >= 0 && nextRow < layout!.rowCount) {\n activate(ctx, nextRow * colCount + col, event);\n }\n } else {\n const nextCol = col + step;\n\n if (nextCol >= 0 && nextCol < layout!.columnCount) {\n activate(ctx, row * colCount + nextCol, event);\n }\n }\n } else if ((event.key === 'Enter' || event.key === ' ') && activeIndex >= 0) {\n event.preventDefault();\n config.onCellClick?.(eventFor(layout!.cells[activeIndex]!, event));\n } else if (event.key === 'Escape') {\n deactivate(ctx);\n }\n },\n onMouseLeave: () => deactivate(ctx),\n onMouseMove(event) {\n const index = indexAt(ctx.svg, event);\n\n if (index < 0) {\n if (activeIndex >= 0) deactivate(ctx);\n } else if (index !== activeIndex) {\n activate(ctx, index, event);\n }\n },\n };\n },\n (next) => {\n if (next.rows) rows = next.rows;\n if (next.columns) columns = next.columns;\n cells = next.cells;\n if (next.domain) domain = next.domain;\n // Key present (even as `undefined`) replaces the summary; absent keeps it (partial updates).\n if ('rowSummary' in next) rowSummary = next.rowSummary;\n warnOnInvalid(rows, columns, cells);\n },\n );\n}\n\n// ─── Bins ─────────────────────────────────────────────────────────────────────\n\nfunction buildBinBounds(bins: number[] | undefined): Array<[number | null, number | null]> {\n if (!bins || bins.length === 0) return [];\n\n const thresholds = [...bins].sort((a, b) => a - b);\n const bounds: Array<[number | null, number | null]> = [];\n let lower: number | null = null;\n\n for (const threshold of thresholds) {\n bounds.push([lower, threshold]);\n lower = threshold;\n }\n\n bounds.push([lower, null]);\n\n return bounds;\n}\n\nfunction defaultBinLabel(formatValue: (value: number) => string): (from: number | null, to: number | null) => string {\n return (from, to) => {\n if (from === null && to !== null) return `<${formatValue(to)}`;\n if (from !== null && to === null) return `\\u2265${formatValue(from)}`;\n if (from !== null && to !== null) return `${formatValue(from)}\\u2013${formatValue(to)}`;\n\n return '\\u2014';\n };\n}\n"],"mappings":";;;;;;;;AAUA,IAAMA,IAAsC;CAAE,WAAW;CAAG,WAAW;CAAI,YAAY;CAAG,SAAS;AAAG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:Number.parseInt(i[1],16)};let a=e.exec(r);if(a)return{b:Number.parseInt(a[3],16)*17,g:Number.parseInt(a[2],16)*17,r:Number.parseInt(a[1],16)*17};let o=n.exec(r);return o?{b:Number(o[3]),g:Number(o[2]),r:Number(o[1])}:null}function toCssColor({b:e,g:t,r:n}){return`rgb(${n} ${t} ${e})`}function mixColors(e,t,n){let r=Math.min(1,Math.max(0,n));return{b:Math.round(e.b+(t.b-e.b)*r),g:Math.round(e.g+(t.g-e.g)*r),r:Math.round(e.r+(t.r-e.r)*r)}}function createRamp(e){let t=e.map(parseColor);return n=>{let r=Math.min(1,Math.max(0,n));if(e.length>=2&&t.every(e=>e!==null)){let n=r*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return toCssColor(mixColors(t[i],t[i+1],n-i))}return e[Math.min(e.length-1,Math.round(r*(e.length-1)))]}}function relativeLuminance(e){let t=parseColor(e);if(!t)return null;let channel=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4};return .2126*channel(t.r)+.7152*channel(t.g)+.0722*channel(t.b)}function valueColorFor(e,t){let n=relativeLuminance(e);return n===null?t:n>.179?`#000`:`#fff`}exports.createRamp=createRamp,exports.mixColors=mixColors,exports.parseColor=parseColor,exports.relativeLuminance=relativeLuminance,exports.toCssColor=toCssColor,exports.valueColorFor=valueColorFor;
|
|
2
|
+
//# sourceMappingURL=heatmap-color.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmap-color.cjs","names":["HEX_SHORT","HEX_LONG","RGB_FUNC","hexLong","color","hexShort","rgb","r","g","b","k","t","from","to","parsed","range","position","index","c","value","luminance","fill","fallback"],"sources":["../../../src/charts/heatmap/heatmap-color.ts"],"sourcesContent":["/** Color helpers for the heatmap ramp: parse, interpolate, and pick readable text. */\n\nexport interface Rgb {\n b: number;\n g: number;\n r: number;\n}\n\nconst HEX_SHORT = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i;\nconst HEX_LONG = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;\nconst RGB_FUNC = /^rgba?\\(\\s*(\\d{1,3})\\s*[,\\s]\\s*(\\d{1,3})\\s*[,\\s]\\s*(\\d{1,3})\\s*(?:[,\\s][\\d.]+\\s*)?\\)$/i;\n\n/**\n * Parses `#rgb`, `#rrggbb`, or `rgb()/rgba()` in comma or space syntax (alpha\n * ignored); anything else (CSS vars, named colors) is null. Space syntax matters\n * because `toCssColor` emits it, so ramp fills always round-trip through here.\n */\nexport function parseColor(color: string): Rgb | null {\n const hexLong = HEX_LONG.exec(color);\n\n if (hexLong) {\n return {\n b: Number.parseInt(hexLong[3]!, 16),\n g: Number.parseInt(hexLong[2]!, 16),\n r: Number.parseInt(hexLong[1]!, 16),\n };\n }\n\n const hexShort = HEX_SHORT.exec(color);\n\n if (hexShort) {\n return {\n b: Number.parseInt(hexShort[3]!, 16) * 17,\n g: Number.parseInt(hexShort[2]!, 16) * 17,\n r: Number.parseInt(hexShort[1]!, 16) * 17,\n };\n }\n\n const rgb = RGB_FUNC.exec(color);\n\n if (rgb) {\n return { b: Number(rgb[3]!), g: Number(rgb[2]!), r: Number(rgb[1]!) };\n }\n\n return null;\n}\n\nexport function toCssColor({ b, g, r }: Rgb): string {\n return `rgb(${r} ${g} ${b})`;\n}\n\n/** Linear sRGB blend; `t` is clamped to [0, 1]. */\nexport function mixColors(from: Rgb, to: Rgb, t: number): Rgb {\n const k = Math.min(1, Math.max(0, t));\n\n return {\n b: Math.round(from.b + (to.b - from.b) * k),\n g: Math.round(from.g + (to.g - from.g) * k),\n r: Math.round(from.r + (to.r - from.r) * k),\n };\n}\n\n/**\n * A ramp over `range` colors: parseable colors interpolate continuously;\n * a range with unparseable entries (CSS vars, named colors) degrades to\n * nearest-step selection, which keeps the ramp honest without measurement.\n */\nexport function createRamp(range: readonly string[]): (t: number) => string {\n const parsed = range.map(parseColor);\n\n return (t: number): string => {\n const k = Math.min(1, Math.max(0, t));\n\n if (range.length >= 2 && parsed.every((color): color is Rgb => color !== null)) {\n const position = k * (range.length - 1);\n const index = Math.min(range.length - 2, Math.floor(position));\n\n return toCssColor(mixColors(parsed[index]!, parsed[index + 1]!, position - index));\n }\n\n return range[Math.min(range.length - 1, Math.round(k * (range.length - 1)))]!;\n };\n}\n\n/** WCAG relative luminance (0..1); null for unparseable colors. */\nexport function relativeLuminance(color: string): number | null {\n const rgb = parseColor(color);\n\n if (!rgb) return null;\n\n const channel = (value: number): number => {\n const c = value / 255;\n\n return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n };\n\n return 0.2126 * channel(rgb.r) + 0.7152 * channel(rgb.g) + 0.0722 * channel(rgb.b);\n}\n\n/**\n * The in-cell text color for a fill: black or white by the fill's luminance,\n * falling back to the theme's text color when the fill cannot be measured.\n * The 0.179 threshold is the exact WCAG crossover for pure black and white,\n * which is the only text pair with no luminance band where both fail 4.5:1 —\n * so in-cell values always clear AA on any ramp.\n */\nexport function valueColorFor(fill: string, fallback: string): string {\n const luminance = relativeLuminance(fill);\n\n if (luminance === null) return fallback;\n\n return luminance > 0.179 ? '#000' : '#fff';\n}\n"],"mappings":"AAQA,IAAMA,EAAY,qCACZC,EAAW,8CACXC,EAAW,yFAOjB,SAAgB,WAAW,EAA2B,CACpD,IAAMC,EAAUF,EAAS,KAAKG,CAAK,EAEnC,GAAID,EACF,MAAO,CACL,EAAG,OAAO,SAASA,EAAQ,GAAK,EAAE,EAClC,EAAG,OAAO,SAASA,EAAQ,GAAK,EAAE,EAClC,EAAG,OAAO,SAASA,EAAQ,GAAK,EAAE,CACpC,EAGF,IAAME,EAAWL,EAAU,KAAKI,CAAK,EAErC,GAAIC,EACF,MAAO,CACL,EAAG,OAAO,SAASA,EAAS,GAAK,EAAE,EAAI,GACvC,EAAG,OAAO,SAASA,EAAS,GAAK,EAAE,EAAI,GACvC,EAAG,OAAO,SAASA,EAAS,GAAK,EAAE,EAAI,EACzC,EAGF,IAAMC,EAAMJ,EA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,QAAW,GAA0B,CACzC,IAAMY,EAAIC,EAAQ,IAElB,OAAOD,GAAK,OAAUA,EAAI,QAAUA,EAAI,MAAS,QAAU,GAC7D,EAEA,MAAO,OAAS,QAAQZ,EAAI,CAAC,EAAI,MAAS,QAAQA,EAAI,CAAC,EAAI,MAAS,QAAQA,EAAI,CAAC,CACnF,CASA,SAAgB,cAAc,EAAc,EAA0B,CACpE,IAAMc,EAAY,kBAAkBC,CAAI,EAIxC,OAFID,IAAc,KAAaE,EAExBF,EAAY,KAAQ,OAAS,MACtC,C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Color helpers for the heatmap ramp: parse, interpolate, and pick readable text. */
|
|
2
|
+
export interface Rgb {
|
|
3
|
+
b: number;
|
|
4
|
+
g: number;
|
|
5
|
+
r: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parses `#rgb`, `#rrggbb`, or `rgb()/rgba()` in comma or space syntax (alpha
|
|
9
|
+
* ignored); anything else (CSS vars, named colors) is null. Space syntax matters
|
|
10
|
+
* because `toCssColor` emits it, so ramp fills always round-trip through here.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseColor(color: string): Rgb | null;
|
|
13
|
+
export declare function toCssColor({ b, g, r }: Rgb): string;
|
|
14
|
+
/** Linear sRGB blend; `t` is clamped to [0, 1]. */
|
|
15
|
+
export declare function mixColors(from: Rgb, to: Rgb, t: number): Rgb;
|
|
16
|
+
/**
|
|
17
|
+
* A ramp over `range` colors: parseable colors interpolate continuously;
|
|
18
|
+
* a range with unparseable entries (CSS vars, named colors) degrades to
|
|
19
|
+
* nearest-step selection, which keeps the ramp honest without measurement.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createRamp(range: readonly string[]): (t: number) => string;
|
|
22
|
+
/** WCAG relative luminance (0..1); null for unparseable colors. */
|
|
23
|
+
export declare function relativeLuminance(color: string): number | null;
|
|
24
|
+
/**
|
|
25
|
+
* The in-cell text color for a fill: black or white by the fill's luminance,
|
|
26
|
+
* falling back to the theme's text color when the fill cannot be measured.
|
|
27
|
+
* The 0.179 threshold is the exact WCAG crossover for pure black and white,
|
|
28
|
+
* which is the only text pair with no luminance band where both fail 4.5:1 —
|
|
29
|
+
* so in-cell values always clear AA on any ramp.
|
|
30
|
+
*/
|
|
31
|
+
export declare function valueColorFor(fill: string, fallback: string): string;
|
|
32
|
+
//# sourceMappingURL=heatmap-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmap-color.d.ts","sourceRoot":"","sources":["../../../src/charts/heatmap/heatmap-color.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAMD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CA4BpD;AAED,wBAAgB,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAEnD;AAED,mDAAmD;AACnD,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,GAAG,CAQ5D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAe1E;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY9D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMpE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region src/charts/heatmap/heatmap-color.ts
|
|
2
|
+
var e = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i, t = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i, n = /^rgba?\(\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*(?:[,\s][\d.]+\s*)?\)$/i;
|
|
3
|
+
function parseColor(r) {
|
|
4
|
+
let i = t.exec(r);
|
|
5
|
+
if (i) return {
|
|
6
|
+
b: Number.parseInt(i[3], 16),
|
|
7
|
+
g: Number.parseInt(i[2], 16),
|
|
8
|
+
r: Number.parseInt(i[1], 16)
|
|
9
|
+
};
|
|
10
|
+
let a = e.exec(r);
|
|
11
|
+
if (a) return {
|
|
12
|
+
b: Number.parseInt(a[3], 16) * 17,
|
|
13
|
+
g: Number.parseInt(a[2], 16) * 17,
|
|
14
|
+
r: Number.parseInt(a[1], 16) * 17
|
|
15
|
+
};
|
|
16
|
+
let o = n.exec(r);
|
|
17
|
+
return o ? {
|
|
18
|
+
b: Number(o[3]),
|
|
19
|
+
g: Number(o[2]),
|
|
20
|
+
r: Number(o[1])
|
|
21
|
+
} : null;
|
|
22
|
+
}
|
|
23
|
+
function toCssColor({ b: e, g: t, r: n }) {
|
|
24
|
+
return `rgb(${n} ${t} ${e})`;
|
|
25
|
+
}
|
|
26
|
+
function mixColors(e, t, n) {
|
|
27
|
+
let r = Math.min(1, Math.max(0, n));
|
|
28
|
+
return {
|
|
29
|
+
b: Math.round(e.b + (t.b - e.b) * r),
|
|
30
|
+
g: Math.round(e.g + (t.g - e.g) * r),
|
|
31
|
+
r: Math.round(e.r + (t.r - e.r) * r)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function createRamp(e) {
|
|
35
|
+
let t = e.map(parseColor);
|
|
36
|
+
return (n) => {
|
|
37
|
+
let r = Math.min(1, Math.max(0, n));
|
|
38
|
+
if (e.length >= 2 && t.every((e) => e !== null)) {
|
|
39
|
+
let n = r * (e.length - 1), i = Math.min(e.length - 2, Math.floor(n));
|
|
40
|
+
return toCssColor(mixColors(t[i], t[i + 1], n - i));
|
|
41
|
+
}
|
|
42
|
+
return e[Math.min(e.length - 1, Math.round(r * (e.length - 1)))];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function relativeLuminance(e) {
|
|
46
|
+
let t = parseColor(e);
|
|
47
|
+
if (!t) return null;
|
|
48
|
+
let channel = (e) => {
|
|
49
|
+
let t = e / 255;
|
|
50
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
51
|
+
};
|
|
52
|
+
return .2126 * channel(t.r) + .7152 * channel(t.g) + .0722 * channel(t.b);
|
|
53
|
+
}
|
|
54
|
+
function valueColorFor(e, t) {
|
|
55
|
+
let n = relativeLuminance(e);
|
|
56
|
+
return n === null ? t : n > .179 ? "#000" : "#fff";
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { createRamp, mixColors, parseColor, relativeLuminance, toCssColor, valueColorFor };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=heatmap-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmap-color.js","names":["HEX_SHORT","HEX_LONG","RGB_FUNC","hexLong","color","hexShort","rgb","r","g","b","k","t","from","to","parsed","range","position","index","c","value","luminance","fill","fallback"],"sources":["../../../src/charts/heatmap/heatmap-color.ts"],"sourcesContent":["/** Color helpers for the heatmap ramp: parse, interpolate, and pick readable text. */\n\nexport interface Rgb {\n b: number;\n g: number;\n r: number;\n}\n\nconst HEX_SHORT = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i;\nconst HEX_LONG = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;\nconst RGB_FUNC = /^rgba?\\(\\s*(\\d{1,3})\\s*[,\\s]\\s*(\\d{1,3})\\s*[,\\s]\\s*(\\d{1,3})\\s*(?:[,\\s][\\d.]+\\s*)?\\)$/i;\n\n/**\n * Parses `#rgb`, `#rrggbb`, or `rgb()/rgba()` in comma or space syntax (alpha\n * ignored); anything else (CSS vars, named colors) is null. Space syntax matters\n * because `toCssColor` emits it, so ramp fills always round-trip through here.\n */\nexport function parseColor(color: string): Rgb | null {\n const hexLong = HEX_LONG.exec(color);\n\n if (hexLong) {\n return {\n b: Number.parseInt(hexLong[3]!, 16),\n g: Number.parseInt(hexLong[2]!, 16),\n r: Number.parseInt(hexLong[1]!, 16),\n };\n }\n\n const hexShort = HEX_SHORT.exec(color);\n\n if (hexShort) {\n return {\n b: Number.parseInt(hexShort[3]!, 16) * 17,\n g: Number.parseInt(hexShort[2]!, 16) * 17,\n r: Number.parseInt(hexShort[1]!, 16) * 17,\n };\n }\n\n const rgb = RGB_FUNC.exec(color);\n\n if (rgb) {\n return { b: Number(rgb[3]!), g: Number(rgb[2]!), r: Number(rgb[1]!) };\n }\n\n return null;\n}\n\nexport function toCssColor({ b, g, r }: Rgb): string {\n return `rgb(${r} ${g} ${b})`;\n}\n\n/** Linear sRGB blend; `t` is clamped to [0, 1]. */\nexport function mixColors(from: Rgb, to: Rgb, t: number): Rgb {\n const k = Math.min(1, Math.max(0, t));\n\n return {\n b: Math.round(from.b + (to.b - from.b) * k),\n g: Math.round(from.g + (to.g - from.g) * k),\n r: Math.round(from.r + (to.r - from.r) * k),\n };\n}\n\n/**\n * A ramp over `range` colors: parseable colors interpolate continuously;\n * a range with unparseable entries (CSS vars, named colors) degrades to\n * nearest-step selection, which keeps the ramp honest without measurement.\n */\nexport function createRamp(range: readonly string[]): (t: number) => string {\n const parsed = range.map(parseColor);\n\n return (t: number): string => {\n const k = Math.min(1, Math.max(0, t));\n\n if (range.length >= 2 && parsed.every((color): color is Rgb => color !== null)) {\n const position = k * (range.length - 1);\n const index = Math.min(range.length - 2, Math.floor(position));\n\n return toCssColor(mixColors(parsed[index]!, parsed[index + 1]!, position - index));\n }\n\n return range[Math.min(range.length - 1, Math.round(k * (range.length - 1)))]!;\n };\n}\n\n/** WCAG relative luminance (0..1); null for unparseable colors. */\nexport function relativeLuminance(color: string): number | null {\n const rgb = parseColor(color);\n\n if (!rgb) return null;\n\n const channel = (value: number): number => {\n const c = value / 255;\n\n return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n };\n\n return 0.2126 * channel(rgb.r) + 0.7152 * channel(rgb.g) + 0.0722 * channel(rgb.b);\n}\n\n/**\n * The in-cell text color for a fill: black or white by the fill's luminance,\n * falling back to the theme's text color when the fill cannot be measured.\n * The 0.179 threshold is the exact WCAG crossover for pure black and white,\n * which is the only text pair with no luminance band where both fail 4.5:1 —\n * so in-cell values always clear AA on any ramp.\n */\nexport function valueColorFor(fill: string, fallback: string): string {\n const luminance = relativeLuminance(fill);\n\n if (luminance === null) return fallback;\n\n return luminance > 0.179 ? '#000' : '#fff';\n}\n"],"mappings":";AAQA,IAAMA,IAAY,sCACZC,IAAW,+CACXC,IAAW;AAOjB,SAAgB,WAAW,GAA2B;CACpD,IAAMC,IAAUF,EAAS,KAAKG,CAAK;CAEnC,IAAID,GACF,OAAO;EACL,GAAG,OAAO,SAASA,EAAQ,IAAK,EAAE;EAClC,GAAG,OAAO,SAASA,EAAQ,IAAK,EAAE;EAClC,GAAG,OAAO,SAASA,EAAQ,IAAK,EAAE;CACpC;CAGF,IAAME,IAAWL,EAAU,KAAKI,CAAK;CAErC,IAAIC,GACF,OAAO;EACL,GAAG,OAAO,SAASA,EAAS,IAAK,EAAE,IAAI;EACvC,GAAG,OAAO,SAASA,EAAS,IAAK,EAAE,IAAI;EACvC,GAAG,OAAO,SAASA,EAAS,IAAK,EAAE,IAAI;CACzC;CAGF,IAAMC,IAAMJ,EAAS,KAAKE,CAAK;CAM/B,OAJIE,IACK;EAAE,GAAG,OAAOA,EAAI,EAAG;EAAG,GAAG,OAAOA,EAAI,EAAG;EAAG,GAAG,OAAOA,EAAI,EAAG;CAAE,IAG/D;AACT;AAEA,SAAgB,WAAW,EAAE,MAAG,MAAG,QAAkB;CACnD,OAAO,OAAOC,EA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AASA,SAAgB,cAAc,GAAc,GAA0B;CACpE,IAAMc,IAAY,kBAAkBC,CAAI;CAIxC,OAFID,MAAc,OAAaE,IAExBF,IAAY,OAAQ,SAAS;AACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/charts/heatmap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./scales/linear.cjs"),t=require("./scales/time.cjs"),n=require("./errors.cjs"),r=require("./theme/index.cjs"),i=require("./charts/area/area-chart.cjs"),a=require("./scales/band.cjs"),o=require("./charts/bar/bar-chart.cjs"),s=require("./charts/line/line-chart.cjs"),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./scales/linear.cjs"),t=require("./scales/time.cjs"),n=require("./errors.cjs"),r=require("./theme/index.cjs"),i=require("./charts/area/area-chart.cjs"),a=require("./scales/band.cjs"),o=require("./charts/bar/bar-chart.cjs"),s=require("./charts/heatmap/heatmap-chart.cjs"),c=require("./charts/line/line-chart.cjs"),l=require("./charts/pie/pie-chart.cjs"),u=require("./charts/radar/radar-chart.cjs"),d=require("./charts/scatter/scatter-chart.cjs"),f=require("./charts/sparkline/sparkline.cjs");exports.PrismError=n.PrismError,exports.PrismRenderError=n.PrismRenderError,exports.bandScale=a.bandScale,exports.createAreaChart=i.createAreaChart,exports.createBarChart=o.createBarChart,exports.createHeatmapChart=s.createHeatmapChart,exports.createLineChart=c.createLineChart,exports.createPieChart=l.createPieChart,exports.createRadarChart=u.createRadarChart,exports.createScatterChart=d.createScatterChart,exports.createSparkline=f.createSparkline,exports.linearScale=e.linearScale,exports.resetTheme=r.resetTheme,exports.seriesColor=r.seriesColor,exports.setTheme=r.setTheme,exports.timeScale=t.timeScale;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { EasingFn, EasingName } from './animation/easing';
|
|
2
2
|
export { createAreaChart } from './charts/area';
|
|
3
3
|
export { createBarChart } from './charts/bar';
|
|
4
|
+
export { createHeatmapChart } from './charts/heatmap';
|
|
4
5
|
export { createLineChart } from './charts/line';
|
|
5
6
|
export { createPieChart } from './charts/pie';
|
|
6
7
|
export { createRadarChart } from './charts/radar';
|
|
@@ -12,5 +13,5 @@ export { linearScale } from './scales/linear';
|
|
|
12
13
|
export { timeScale } from './scales/time';
|
|
13
14
|
export type { BandScaleConfig, LinearScaleConfig, TimeScaleConfig } from './scales/types';
|
|
14
15
|
export { resetTheme, seriesColor, setTheme } from './theme';
|
|
15
|
-
export type { AreaChartConfig, AreaSeriesConfig, AxisConfig, AxisPosition, BandScale, BarChartConfig, BarSeriesConfig, BarVariant, BaseChartConfig, ChartA11y, ChartDimensions, ChartEvent, ChartHandle, ChartMargin, ContinuousDatum, CrosshairConfig, Datum, GridConfig, HorizontalAxisPosition, LegendConfig, LegendPosition, LineChartConfig, LineSeriesConfig, PieChartConfig, PieEvent, PieSliceConfig, PieVariant, PrismEvent, PrismTheme, RadarAxisConfig, RadarAxisValue, RadarChartConfig, RadarEvent, RadarGridConfig, RadarSeriesConfig, Scale, ScatterChartConfig, ScatterSeriesConfig, Series, SeriesValue, SparklineConfig, SparklineEvent, SparklineVariant, StackSegment, ThemeScope, TooltipConfig, TransitionConfig, TransitionOption, VerticalAxisPosition, XAxisConfig, YAxisConfig, } from './types';
|
|
16
|
+
export type { AreaChartConfig, AreaSeriesConfig, AxisConfig, AxisPosition, BandScale, BarChartConfig, BarSeriesConfig, BarVariant, BaseChartConfig, ChartA11y, ChartDimensions, ChartEvent, ChartHandle, ChartMargin, ContinuousDatum, CrosshairConfig, Datum, GridConfig, HeatmapCell, HeatmapChartConfig, HeatmapData, HeatmapEvent, HorizontalAxisPosition, LegendConfig, LegendPosition, LineChartConfig, LineSeriesConfig, PieChartConfig, PieEvent, PieSliceConfig, PieVariant, PrismEvent, PrismTheme, RadarAxisConfig, RadarAxisValue, RadarChartConfig, RadarEvent, RadarGridConfig, RadarSeriesConfig, Scale, ScatterChartConfig, ScatterSeriesConfig, Series, SeriesValue, SparklineConfig, SparklineEvent, SparklineVariant, StackSegment, ThemeScope, TooltipConfig, TransitionConfig, TransitionOption, VerticalAxisPosition, XAxisConfig, YAxisConfig, } from './types';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,KAAK,EACL,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,10 @@ import { resetTheme as i, seriesColor as a, setTheme as o } from "./theme/index.
|
|
|
5
5
|
import { createAreaChart as s } from "./charts/area/area-chart.js";
|
|
6
6
|
import { bandScale as c } from "./scales/band.js";
|
|
7
7
|
import { createBarChart as l } from "./charts/bar/bar-chart.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
8
|
+
import { createHeatmapChart as u } from "./charts/heatmap/heatmap-chart.js";
|
|
9
|
+
import { createLineChart as d } from "./charts/line/line-chart.js";
|
|
10
|
+
import { createPieChart as f } from "./charts/pie/pie-chart.js";
|
|
11
|
+
import { createRadarChart as p } from "./charts/radar/radar-chart.js";
|
|
12
|
+
import { createScatterChart as m } from "./charts/scatter/scatter-chart.js";
|
|
13
|
+
import { createSparkline as h } from "./charts/sparkline/sparkline.js";
|
|
14
|
+
export { n as PrismError, r as PrismRenderError, c as bandScale, s as createAreaChart, l as createBarChart, u as createHeatmapChart, d as createLineChart, f as createPieChart, p as createRadarChart, m as createScatterChart, h as createSparkline, e as linearScale, i as resetTheme, a as seriesColor, o as setTheme, t as timeScale };
|