@revivejs/angular-infinity-charts 2.0.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/LICENSE +21 -0
- package/README.md +272 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +40 -0
- package/src/InfinityChartComponent.d.ts +30 -0
- package/src/InfinityChartComponent.js +170 -0
- package/src/InfinityChartComponent.js.map +1 -0
- package/src/InfinityChartController.d.ts +25 -0
- package/src/InfinityChartController.js +173 -0
- package/src/InfinityChartController.js.map +1 -0
- package/src/InfinityChartDirective.d.ts +30 -0
- package/src/InfinityChartDirective.js +169 -0
- package/src/InfinityChartDirective.js.map +1 -0
- package/src/InfinityChartService.d.ts +10 -0
- package/src/InfinityChartService.js +46 -0
- package/src/InfinityChartService.js.map +1 -0
- package/src/public_api.d.ts +9 -0
- package/src/public_api.js +41 -0
- package/src/public_api.js.map +1 -0
- package/src/types.d.ts +220 -0
- package/src/types.js +3 -0
- package/src/types.js.map +1 -0
- package/vendor/infinity-charts/index.js +4746 -0
|
@@ -0,0 +1,4746 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
+
|
|
24
|
+
// node_modules/@revivejs/infinity-charts/dist/renderers/scene.js
|
|
25
|
+
var groupNode, rectNode, pathNode, textNode, lineNode, circleNode;
|
|
26
|
+
var init_scene = __esm({
|
|
27
|
+
"node_modules/@revivejs/infinity-charts/dist/renderers/scene.js"() {
|
|
28
|
+
groupNode = (id, children = [], attrs = {}, style = {}) => ({
|
|
29
|
+
id,
|
|
30
|
+
kind: "group",
|
|
31
|
+
attrs,
|
|
32
|
+
style,
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
rectNode = (id, attrs, style = {}) => ({
|
|
36
|
+
id,
|
|
37
|
+
kind: "rect",
|
|
38
|
+
attrs,
|
|
39
|
+
style
|
|
40
|
+
});
|
|
41
|
+
pathNode = (id, attrs, style = {}) => ({
|
|
42
|
+
id,
|
|
43
|
+
kind: "path",
|
|
44
|
+
attrs,
|
|
45
|
+
style
|
|
46
|
+
});
|
|
47
|
+
textNode = (id, textContent, attrs, style = {}) => ({
|
|
48
|
+
id,
|
|
49
|
+
kind: "text",
|
|
50
|
+
attrs,
|
|
51
|
+
style,
|
|
52
|
+
textContent
|
|
53
|
+
});
|
|
54
|
+
lineNode = (id, attrs, style = {}) => ({
|
|
55
|
+
id,
|
|
56
|
+
kind: "line",
|
|
57
|
+
attrs,
|
|
58
|
+
style
|
|
59
|
+
});
|
|
60
|
+
circleNode = (id, attrs, style = {}) => ({
|
|
61
|
+
id,
|
|
62
|
+
kind: "circle",
|
|
63
|
+
attrs,
|
|
64
|
+
style
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// node_modules/@revivejs/infinity-charts/dist/utils/math.js
|
|
70
|
+
var clamp, sum, padExtent, formatCompactNumber, polarToCartesian;
|
|
71
|
+
var init_math = __esm({
|
|
72
|
+
"node_modules/@revivejs/infinity-charts/dist/utils/math.js"() {
|
|
73
|
+
clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
74
|
+
sum = (values) => values.reduce((total, value) => total + value, 0);
|
|
75
|
+
padExtent = (minValue, maxValue, ratio = 0.08) => {
|
|
76
|
+
if (minValue === maxValue) {
|
|
77
|
+
const base = minValue === 0 ? 1 : Math.abs(minValue) * 0.2;
|
|
78
|
+
return [minValue - base, maxValue + base];
|
|
79
|
+
}
|
|
80
|
+
const span = maxValue - minValue;
|
|
81
|
+
const pad = span * ratio;
|
|
82
|
+
return [minValue - pad, maxValue + pad];
|
|
83
|
+
};
|
|
84
|
+
formatCompactNumber = (value) => new Intl.NumberFormat("en-US", {
|
|
85
|
+
notation: "compact",
|
|
86
|
+
maximumFractionDigits: value >= 100 ? 0 : 1
|
|
87
|
+
}).format(value);
|
|
88
|
+
polarToCartesian = (centerX, centerY, radius, angle) => ({
|
|
89
|
+
x: centerX + radius * Math.cos(angle - Math.PI / 2),
|
|
90
|
+
y: centerY + radius * Math.sin(angle - Math.PI / 2)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// node_modules/@revivejs/infinity-charts/dist/axes/axis-builder.js
|
|
96
|
+
var formatTick, buildCartesianAxisNodes, buildContinuousAxisNodes;
|
|
97
|
+
var init_axis_builder = __esm({
|
|
98
|
+
"node_modules/@revivejs/infinity-charts/dist/axes/axis-builder.js"() {
|
|
99
|
+
init_scene();
|
|
100
|
+
init_math();
|
|
101
|
+
formatTick = (value, formatter) => {
|
|
102
|
+
if (formatter) {
|
|
103
|
+
return formatter(value);
|
|
104
|
+
}
|
|
105
|
+
return typeof value === "number" ? formatCompactNumber(value) : String(value);
|
|
106
|
+
};
|
|
107
|
+
buildCartesianAxisNodes = ({ idPrefix, frame, theme, labels, xScale, yScale, xAxis, yAxis, grid }) => {
|
|
108
|
+
const nodes = [];
|
|
109
|
+
const plotLeft = frame.plot.x;
|
|
110
|
+
const plotRight = frame.plot.x + frame.plot.width;
|
|
111
|
+
const plotTop = frame.plot.y;
|
|
112
|
+
const plotBottom = frame.plot.y + frame.plot.height;
|
|
113
|
+
const fontSize = theme.fontSize;
|
|
114
|
+
if (grid.show && grid.y) {
|
|
115
|
+
yScale.ticks(yAxis.tickCount).forEach((tick, index) => {
|
|
116
|
+
const y = yScale.scale(tick);
|
|
117
|
+
nodes.push(lineNode(`${idPrefix}-grid-y-${index}`, {
|
|
118
|
+
x1: plotLeft,
|
|
119
|
+
y1: y,
|
|
120
|
+
x2: plotRight,
|
|
121
|
+
y2: y,
|
|
122
|
+
stroke: grid.color,
|
|
123
|
+
"stroke-width": 1,
|
|
124
|
+
opacity: grid.opacity,
|
|
125
|
+
"stroke-dasharray": "4 6"
|
|
126
|
+
}));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (grid.show && grid.x) {
|
|
130
|
+
labels.forEach((label, index) => {
|
|
131
|
+
const band = xScale.get(label);
|
|
132
|
+
nodes.push(lineNode(`${idPrefix}-grid-x-${index}`, {
|
|
133
|
+
x1: band.center,
|
|
134
|
+
y1: plotTop,
|
|
135
|
+
x2: band.center,
|
|
136
|
+
y2: plotBottom,
|
|
137
|
+
stroke: grid.color,
|
|
138
|
+
"stroke-width": 1,
|
|
139
|
+
opacity: grid.opacity * 0.8,
|
|
140
|
+
"stroke-dasharray": "2 6"
|
|
141
|
+
}));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (yAxis.show) {
|
|
145
|
+
nodes.push(lineNode(`${idPrefix}-axis-y`, {
|
|
146
|
+
x1: plotLeft,
|
|
147
|
+
y1: plotTop,
|
|
148
|
+
x2: plotLeft,
|
|
149
|
+
y2: plotBottom,
|
|
150
|
+
stroke: theme.axis,
|
|
151
|
+
"stroke-width": 1
|
|
152
|
+
}));
|
|
153
|
+
yScale.ticks(yAxis.tickCount).forEach((tick, index) => {
|
|
154
|
+
const y = yScale.scale(tick);
|
|
155
|
+
nodes.push(lineNode(`${idPrefix}-axis-y-tick-${index}`, {
|
|
156
|
+
x1: plotLeft - 6,
|
|
157
|
+
y1: y,
|
|
158
|
+
x2: plotLeft,
|
|
159
|
+
y2: y,
|
|
160
|
+
stroke: theme.axis,
|
|
161
|
+
"stroke-width": 1
|
|
162
|
+
}));
|
|
163
|
+
nodes.push(textNode(`${idPrefix}-axis-y-label-${index}`, formatTick(tick, yAxis.format), {
|
|
164
|
+
x: plotLeft - 12,
|
|
165
|
+
y: y + 4,
|
|
166
|
+
fill: theme.mutedText,
|
|
167
|
+
"font-size": fontSize - 1,
|
|
168
|
+
"font-family": theme.fontFamily,
|
|
169
|
+
"text-anchor": "end"
|
|
170
|
+
}));
|
|
171
|
+
});
|
|
172
|
+
if (yAxis.title) {
|
|
173
|
+
nodes.push(textNode(`${idPrefix}-axis-y-title`, yAxis.title, {
|
|
174
|
+
x: plotLeft - 46,
|
|
175
|
+
y: plotTop + frame.plot.height / 2,
|
|
176
|
+
fill: theme.mutedText,
|
|
177
|
+
"font-size": fontSize - 1,
|
|
178
|
+
"font-family": theme.fontFamily,
|
|
179
|
+
"font-weight": 600,
|
|
180
|
+
transform: `rotate(-90 ${plotLeft - 46} ${plotTop + frame.plot.height / 2})`,
|
|
181
|
+
"text-anchor": "middle"
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (xAxis.show) {
|
|
186
|
+
nodes.push(lineNode(`${idPrefix}-axis-x`, {
|
|
187
|
+
x1: plotLeft,
|
|
188
|
+
y1: plotBottom,
|
|
189
|
+
x2: plotRight,
|
|
190
|
+
y2: plotBottom,
|
|
191
|
+
stroke: theme.axis,
|
|
192
|
+
"stroke-width": 1
|
|
193
|
+
}));
|
|
194
|
+
labels.forEach((label, index) => {
|
|
195
|
+
const band = xScale.at(index);
|
|
196
|
+
nodes.push(lineNode(`${idPrefix}-axis-x-tick-${index}`, {
|
|
197
|
+
x1: band.center,
|
|
198
|
+
y1: plotBottom,
|
|
199
|
+
x2: band.center,
|
|
200
|
+
y2: plotBottom + 6,
|
|
201
|
+
stroke: theme.axis,
|
|
202
|
+
"stroke-width": 1
|
|
203
|
+
}));
|
|
204
|
+
nodes.push(textNode(`${idPrefix}-axis-x-label-${index}`, formatTick(label, xAxis.format), {
|
|
205
|
+
x: band.center,
|
|
206
|
+
y: plotBottom + 22,
|
|
207
|
+
fill: theme.mutedText,
|
|
208
|
+
"font-size": fontSize - 1,
|
|
209
|
+
"font-family": theme.fontFamily,
|
|
210
|
+
"text-anchor": "middle"
|
|
211
|
+
}));
|
|
212
|
+
});
|
|
213
|
+
if (xAxis.title) {
|
|
214
|
+
nodes.push(textNode(`${idPrefix}-axis-x-title`, xAxis.title, {
|
|
215
|
+
x: plotLeft + frame.plot.width / 2,
|
|
216
|
+
y: plotBottom + 38,
|
|
217
|
+
fill: theme.mutedText,
|
|
218
|
+
"font-size": fontSize - 1,
|
|
219
|
+
"font-family": theme.fontFamily,
|
|
220
|
+
"font-weight": 600,
|
|
221
|
+
"text-anchor": "middle"
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return [groupNode(`${idPrefix}-axes`, nodes)];
|
|
226
|
+
};
|
|
227
|
+
buildContinuousAxisNodes = ({ idPrefix, frame, theme, xScale, yScale, xAxis, yAxis, grid }) => {
|
|
228
|
+
const nodes = [];
|
|
229
|
+
const plotLeft = frame.plot.x;
|
|
230
|
+
const plotRight = frame.plot.x + frame.plot.width;
|
|
231
|
+
const plotTop = frame.plot.y;
|
|
232
|
+
const plotBottom = frame.plot.y + frame.plot.height;
|
|
233
|
+
const fontSize = theme.fontSize;
|
|
234
|
+
if (grid.show && grid.y) {
|
|
235
|
+
yScale.ticks(yAxis.tickCount).forEach((tick, index) => {
|
|
236
|
+
const y = yScale.scale(tick);
|
|
237
|
+
nodes.push(lineNode(`${idPrefix}-grid-y-${index}`, {
|
|
238
|
+
x1: plotLeft,
|
|
239
|
+
y1: y,
|
|
240
|
+
x2: plotRight,
|
|
241
|
+
y2: y,
|
|
242
|
+
stroke: grid.color,
|
|
243
|
+
"stroke-width": 1,
|
|
244
|
+
opacity: grid.opacity,
|
|
245
|
+
"stroke-dasharray": "4 6"
|
|
246
|
+
}));
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
if (grid.show && grid.x) {
|
|
250
|
+
xScale.ticks(xAxis.tickCount).forEach((tick, index) => {
|
|
251
|
+
const x = xScale.scale(tick);
|
|
252
|
+
nodes.push(lineNode(`${idPrefix}-grid-x-${index}`, {
|
|
253
|
+
x1: x,
|
|
254
|
+
y1: plotTop,
|
|
255
|
+
x2: x,
|
|
256
|
+
y2: plotBottom,
|
|
257
|
+
stroke: grid.color,
|
|
258
|
+
"stroke-width": 1,
|
|
259
|
+
opacity: grid.opacity * 0.8,
|
|
260
|
+
"stroke-dasharray": "2 6"
|
|
261
|
+
}));
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
if (yAxis.show) {
|
|
265
|
+
nodes.push(lineNode(`${idPrefix}-axis-y`, {
|
|
266
|
+
x1: plotLeft,
|
|
267
|
+
y1: plotTop,
|
|
268
|
+
x2: plotLeft,
|
|
269
|
+
y2: plotBottom,
|
|
270
|
+
stroke: theme.axis,
|
|
271
|
+
"stroke-width": 1
|
|
272
|
+
}));
|
|
273
|
+
yScale.ticks(yAxis.tickCount).forEach((tick, index) => {
|
|
274
|
+
const y = yScale.scale(tick);
|
|
275
|
+
nodes.push(lineNode(`${idPrefix}-axis-y-tick-${index}`, {
|
|
276
|
+
x1: plotLeft - 6,
|
|
277
|
+
y1: y,
|
|
278
|
+
x2: plotLeft,
|
|
279
|
+
y2: y,
|
|
280
|
+
stroke: theme.axis,
|
|
281
|
+
"stroke-width": 1
|
|
282
|
+
}));
|
|
283
|
+
nodes.push(textNode(`${idPrefix}-axis-y-label-${index}`, formatTick(tick, yAxis.format), {
|
|
284
|
+
x: plotLeft - 12,
|
|
285
|
+
y: y + 4,
|
|
286
|
+
fill: theme.mutedText,
|
|
287
|
+
"font-size": fontSize - 1,
|
|
288
|
+
"font-family": theme.fontFamily,
|
|
289
|
+
"text-anchor": "end"
|
|
290
|
+
}));
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
if (xAxis.show) {
|
|
294
|
+
nodes.push(lineNode(`${idPrefix}-axis-x`, {
|
|
295
|
+
x1: plotLeft,
|
|
296
|
+
y1: plotBottom,
|
|
297
|
+
x2: plotRight,
|
|
298
|
+
y2: plotBottom,
|
|
299
|
+
stroke: theme.axis,
|
|
300
|
+
"stroke-width": 1
|
|
301
|
+
}));
|
|
302
|
+
xScale.ticks(xAxis.tickCount).forEach((tick, index) => {
|
|
303
|
+
const x = xScale.scale(tick);
|
|
304
|
+
nodes.push(lineNode(`${idPrefix}-axis-x-tick-${index}`, {
|
|
305
|
+
x1: x,
|
|
306
|
+
y1: plotBottom,
|
|
307
|
+
x2: x,
|
|
308
|
+
y2: plotBottom + 6,
|
|
309
|
+
stroke: theme.axis,
|
|
310
|
+
"stroke-width": 1
|
|
311
|
+
}));
|
|
312
|
+
nodes.push(textNode(`${idPrefix}-axis-x-label-${index}`, formatTick(tick, xAxis.format), {
|
|
313
|
+
x,
|
|
314
|
+
y: plotBottom + 22,
|
|
315
|
+
fill: theme.mutedText,
|
|
316
|
+
"font-size": fontSize - 1,
|
|
317
|
+
"font-family": theme.fontFamily,
|
|
318
|
+
"text-anchor": "middle"
|
|
319
|
+
}));
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
return [groupNode(`${idPrefix}-axes`, nodes)];
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/cartesian-geometry.js
|
|
328
|
+
var buildLinePath, buildAreaPath;
|
|
329
|
+
var init_cartesian_geometry = __esm({
|
|
330
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/common/cartesian-geometry.js"() {
|
|
331
|
+
buildLinePath = (points) => points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
|
|
332
|
+
buildAreaPath = (points, baseline, lowerBoundary) => {
|
|
333
|
+
if (points.length === 0) {
|
|
334
|
+
return "";
|
|
335
|
+
}
|
|
336
|
+
if (lowerBoundary == null ? void 0 : lowerBoundary.length) {
|
|
337
|
+
const upper = buildLinePath(points);
|
|
338
|
+
const lower = [...lowerBoundary].reverse().map((point) => `L ${point.x} ${point.y}`).join(" ");
|
|
339
|
+
return `${upper} ${lower} Z`;
|
|
340
|
+
}
|
|
341
|
+
const start = points[0];
|
|
342
|
+
const end = points[points.length - 1];
|
|
343
|
+
const line = buildLinePath(points);
|
|
344
|
+
return `${line} L ${end.x} ${baseline} L ${start.x} ${baseline} Z`;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/chrome.js
|
|
350
|
+
var resolveAnchor, buildTitleNodes, buildLegendNodes, buildThresholdNodes;
|
|
351
|
+
var init_chrome = __esm({
|
|
352
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/common/chrome.js"() {
|
|
353
|
+
init_scene();
|
|
354
|
+
resolveAnchor = (align, bounds, estimatedWidth) => {
|
|
355
|
+
if (align === "center") {
|
|
356
|
+
return bounds.x + (bounds.width - estimatedWidth) / 2;
|
|
357
|
+
}
|
|
358
|
+
if (align === "end") {
|
|
359
|
+
return bounds.x + bounds.width - estimatedWidth;
|
|
360
|
+
}
|
|
361
|
+
return bounds.x + 12;
|
|
362
|
+
};
|
|
363
|
+
buildTitleNodes = (idPrefix, config, frame, theme) => {
|
|
364
|
+
if (!config.title.text && !config.title.subtitle) {
|
|
365
|
+
return [];
|
|
366
|
+
}
|
|
367
|
+
const alignMap = {
|
|
368
|
+
start: frame.header.x + 12,
|
|
369
|
+
center: frame.header.x + frame.header.width / 2,
|
|
370
|
+
end: frame.header.x + frame.header.width - 12
|
|
371
|
+
};
|
|
372
|
+
const anchorMap = {
|
|
373
|
+
start: "start",
|
|
374
|
+
center: "middle",
|
|
375
|
+
end: "end"
|
|
376
|
+
};
|
|
377
|
+
const x = alignMap[config.title.align];
|
|
378
|
+
return [
|
|
379
|
+
groupNode(`${idPrefix}-title-group`, [
|
|
380
|
+
config.title.text ? textNode(`${idPrefix}-title`, config.title.text, {
|
|
381
|
+
class: "ic-title",
|
|
382
|
+
x,
|
|
383
|
+
y: frame.header.y + 24,
|
|
384
|
+
fill: theme.title,
|
|
385
|
+
"font-family": theme.fontFamily,
|
|
386
|
+
"font-size": theme.fontSize + 3,
|
|
387
|
+
"font-weight": 700,
|
|
388
|
+
"text-anchor": anchorMap[config.title.align]
|
|
389
|
+
}) : groupNode(`${idPrefix}-title-empty`),
|
|
390
|
+
config.title.subtitle ? textNode(`${idPrefix}-subtitle`, config.title.subtitle, {
|
|
391
|
+
class: "ic-subtitle",
|
|
392
|
+
x,
|
|
393
|
+
y: frame.header.y + 44,
|
|
394
|
+
fill: theme.mutedText,
|
|
395
|
+
"font-family": theme.fontFamily,
|
|
396
|
+
"font-size": theme.fontSize,
|
|
397
|
+
"text-anchor": anchorMap[config.title.align]
|
|
398
|
+
}) : groupNode(`${idPrefix}-subtitle-empty`)
|
|
399
|
+
])
|
|
400
|
+
];
|
|
401
|
+
};
|
|
402
|
+
buildLegendNodes = (idPrefix, config, frame, theme, items) => {
|
|
403
|
+
const legendBounds = frame.legend;
|
|
404
|
+
if (!config.legend.show || items.length === 0 || !legendBounds) {
|
|
405
|
+
return [];
|
|
406
|
+
}
|
|
407
|
+
const vertical = config.legend.position === "left" || config.legend.position === "right";
|
|
408
|
+
const itemWidth = vertical ? legendBounds.width - 20 : 112;
|
|
409
|
+
const anchorX = resolveAnchor(config.legend.align, legendBounds, vertical ? itemWidth : itemWidth * items.length);
|
|
410
|
+
const nodes = items.flatMap((item, index) => {
|
|
411
|
+
const x = vertical ? legendBounds.x + 10 : anchorX + index * itemWidth;
|
|
412
|
+
const y = vertical ? legendBounds.y + 18 + index * 24 : legendBounds.y + 18;
|
|
413
|
+
return [
|
|
414
|
+
circleNode(`${idPrefix}-legend-dot-${item.id}`, {
|
|
415
|
+
class: "ic-legend-dot",
|
|
416
|
+
cx: x + 6,
|
|
417
|
+
cy: y - 4,
|
|
418
|
+
r: 5,
|
|
419
|
+
fill: item.color
|
|
420
|
+
}),
|
|
421
|
+
textNode(`${idPrefix}-legend-label-${item.id}`, item.label, {
|
|
422
|
+
class: "ic-legend-label",
|
|
423
|
+
x: x + 18,
|
|
424
|
+
y,
|
|
425
|
+
fill: theme.legendText,
|
|
426
|
+
"font-family": theme.fontFamily,
|
|
427
|
+
"font-size": theme.fontSize
|
|
428
|
+
})
|
|
429
|
+
];
|
|
430
|
+
});
|
|
431
|
+
return [groupNode(`${idPrefix}-legend`, nodes)];
|
|
432
|
+
};
|
|
433
|
+
buildThresholdNodes = ({ idPrefix, thresholds, frame, theme, yScale }) => {
|
|
434
|
+
const nodes = thresholds.filter((threshold) => {
|
|
435
|
+
var _a;
|
|
436
|
+
return ((_a = threshold.axis) != null ? _a : "y") === "y";
|
|
437
|
+
}).flatMap((threshold, index) => {
|
|
438
|
+
var _a, _b, _c, _d;
|
|
439
|
+
const color = (_a = threshold.color) != null ? _a : theme.threshold;
|
|
440
|
+
const y = yScale.scale(threshold.value);
|
|
441
|
+
return [
|
|
442
|
+
lineNode(`${idPrefix}-threshold-${(_b = threshold.id) != null ? _b : index}`, {
|
|
443
|
+
class: "ic-threshold-line",
|
|
444
|
+
x1: frame.plot.x,
|
|
445
|
+
y1: y,
|
|
446
|
+
x2: frame.plot.x + frame.plot.width,
|
|
447
|
+
y2: y,
|
|
448
|
+
stroke: color,
|
|
449
|
+
"stroke-width": 1.5,
|
|
450
|
+
"stroke-dasharray": (_c = threshold.dasharray) != null ? _c : "7 7",
|
|
451
|
+
opacity: 0.92
|
|
452
|
+
}),
|
|
453
|
+
threshold.label ? textNode(`${idPrefix}-threshold-label-${(_d = threshold.id) != null ? _d : index}`, threshold.label, {
|
|
454
|
+
class: "ic-threshold-label",
|
|
455
|
+
x: frame.plot.x + frame.plot.width - 4,
|
|
456
|
+
y: y - 6,
|
|
457
|
+
fill: color,
|
|
458
|
+
"font-family": theme.fontFamily,
|
|
459
|
+
"font-size": theme.fontSize - 1,
|
|
460
|
+
"text-anchor": "end",
|
|
461
|
+
"font-weight": 600
|
|
462
|
+
}) : groupNode(`${idPrefix}-threshold-label-empty-${index}`)
|
|
463
|
+
];
|
|
464
|
+
});
|
|
465
|
+
return nodes.length ? [groupNode(`${idPrefix}-thresholds`, nodes)] : [];
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/interaction.js
|
|
471
|
+
var buildAriaLabel, createInteractionAttrs, interactiveNodeStyle;
|
|
472
|
+
var init_interaction = __esm({
|
|
473
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/common/interaction.js"() {
|
|
474
|
+
buildAriaLabel = (payload) => {
|
|
475
|
+
const fragments = [
|
|
476
|
+
payload.seriesName,
|
|
477
|
+
payload.label,
|
|
478
|
+
payload.value !== void 0 ? String(payload.value) : void 0,
|
|
479
|
+
payload.detail
|
|
480
|
+
].filter(Boolean);
|
|
481
|
+
return fragments.join(", ");
|
|
482
|
+
};
|
|
483
|
+
createInteractionAttrs = (payload) => ({
|
|
484
|
+
"data-ic-interactive": "true",
|
|
485
|
+
"data-ic-payload": JSON.stringify(payload),
|
|
486
|
+
"aria-label": buildAriaLabel(payload)
|
|
487
|
+
});
|
|
488
|
+
interactiveNodeStyle = {
|
|
489
|
+
cursor: "pointer"
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/palette.js
|
|
495
|
+
var resolveSeriesColor;
|
|
496
|
+
var init_palette = __esm({
|
|
497
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/common/palette.js"() {
|
|
498
|
+
resolveSeriesColor = (config, index, explicit) => {
|
|
499
|
+
var _a, _b;
|
|
500
|
+
return (_b = (_a = explicit != null ? explicit : config.palette[index % config.palette.length]) != null ? _a : config.theme.palette[index % config.theme.palette.length]) != null ? _b : "#2563eb";
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/value-labels.js
|
|
506
|
+
var resolveLabelText, buildValueLabelNode;
|
|
507
|
+
var init_value_labels = __esm({
|
|
508
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/common/value-labels.js"() {
|
|
509
|
+
init_scene();
|
|
510
|
+
resolveLabelText = (config, value) => {
|
|
511
|
+
var _a, _b;
|
|
512
|
+
const formatted = (_b = (_a = config.yAxis).format) == null ? void 0 : _b.call(_a, value);
|
|
513
|
+
if (formatted !== void 0 && formatted !== null) {
|
|
514
|
+
return String(formatted);
|
|
515
|
+
}
|
|
516
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(1);
|
|
517
|
+
};
|
|
518
|
+
buildValueLabelNode = (id, config, value, x, y, options) => {
|
|
519
|
+
var _a, _b, _c, _d;
|
|
520
|
+
return textNode(id, resolveLabelText(config, value), {
|
|
521
|
+
class: (_a = options == null ? void 0 : options.className) != null ? _a : "ic-value-label",
|
|
522
|
+
x,
|
|
523
|
+
y,
|
|
524
|
+
fill: (_b = options == null ? void 0 : options.fill) != null ? _b : config.theme.title,
|
|
525
|
+
stroke: config.theme.plotBackground,
|
|
526
|
+
"stroke-width": 4,
|
|
527
|
+
"paint-order": "stroke",
|
|
528
|
+
"font-family": config.theme.fontFamily,
|
|
529
|
+
"font-size": (_c = options == null ? void 0 : options.fontSize) != null ? _c : Math.max(10, config.theme.fontSize - 1),
|
|
530
|
+
"font-weight": 700,
|
|
531
|
+
"text-anchor": (_d = options == null ? void 0 : options.anchor) != null ? _d : "middle"
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// node_modules/@revivejs/infinity-charts/dist/scales/band-scale.js
|
|
538
|
+
var createBandScale;
|
|
539
|
+
var init_band_scale = __esm({
|
|
540
|
+
"node_modules/@revivejs/infinity-charts/dist/scales/band-scale.js"() {
|
|
541
|
+
createBandScale = ({ domain, range, paddingInner = 0.18, paddingOuter = 0.08 }) => {
|
|
542
|
+
const [rangeStart, rangeEnd] = range;
|
|
543
|
+
const count = Math.max(1, domain.length);
|
|
544
|
+
const span = rangeEnd - rangeStart;
|
|
545
|
+
const step = span / Math.max(1, count + paddingOuter * 2 - paddingInner);
|
|
546
|
+
const bandwidth = step * (1 - paddingInner);
|
|
547
|
+
const resolveIndex = (index) => {
|
|
548
|
+
const start = rangeStart + step * (paddingOuter + index);
|
|
549
|
+
return {
|
|
550
|
+
start,
|
|
551
|
+
center: start + bandwidth / 2,
|
|
552
|
+
width: bandwidth
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
return {
|
|
556
|
+
domain,
|
|
557
|
+
range,
|
|
558
|
+
bandwidth,
|
|
559
|
+
step,
|
|
560
|
+
get: (label) => {
|
|
561
|
+
const index = Math.max(0, domain.indexOf(label));
|
|
562
|
+
return resolveIndex(index);
|
|
563
|
+
},
|
|
564
|
+
at: resolveIndex
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
// node_modules/@revivejs/infinity-charts/dist/scales/linear-scale.js
|
|
571
|
+
var roundFloat, niceStep, normalizeDomain, createLinearScale;
|
|
572
|
+
var init_linear_scale = __esm({
|
|
573
|
+
"node_modules/@revivejs/infinity-charts/dist/scales/linear-scale.js"() {
|
|
574
|
+
roundFloat = (value) => Number.parseFloat(value.toFixed(10));
|
|
575
|
+
niceStep = (span, tickCount) => {
|
|
576
|
+
const rawStep = span / Math.max(1, tickCount);
|
|
577
|
+
const power = Math.floor(Math.log10(rawStep));
|
|
578
|
+
const scaled = rawStep / 10 ** power;
|
|
579
|
+
const niceScaled = scaled <= 1 ? 1 : scaled <= 2 ? 2 : scaled <= 5 ? 5 : 10;
|
|
580
|
+
return niceScaled * 10 ** power;
|
|
581
|
+
};
|
|
582
|
+
normalizeDomain = ([minValue, maxValue]) => {
|
|
583
|
+
if (minValue === maxValue) {
|
|
584
|
+
const delta = minValue === 0 ? 1 : Math.abs(minValue) * 0.2;
|
|
585
|
+
return [minValue - delta, maxValue + delta];
|
|
586
|
+
}
|
|
587
|
+
return [minValue, maxValue];
|
|
588
|
+
};
|
|
589
|
+
createLinearScale = ({ domain, range, nice = true, tickCount = 5 }) => {
|
|
590
|
+
const normalized = normalizeDomain(domain);
|
|
591
|
+
const span = normalized[1] - normalized[0];
|
|
592
|
+
const resolvedDomain = nice && span > 0 ? (() => {
|
|
593
|
+
const step = niceStep(span, tickCount);
|
|
594
|
+
const minValue = Math.floor(normalized[0] / step) * step;
|
|
595
|
+
const maxValue = Math.ceil(normalized[1] / step) * step;
|
|
596
|
+
return [roundFloat(minValue), roundFloat(maxValue)];
|
|
597
|
+
})() : normalized;
|
|
598
|
+
const scale = (value) => {
|
|
599
|
+
const [domainStart, domainEnd] = resolvedDomain;
|
|
600
|
+
const [rangeStart, rangeEnd] = range;
|
|
601
|
+
const ratio = (value - domainStart) / (domainEnd - domainStart);
|
|
602
|
+
return rangeStart + ratio * (rangeEnd - rangeStart);
|
|
603
|
+
};
|
|
604
|
+
const ticks = (count = tickCount) => {
|
|
605
|
+
const [domainStart, domainEnd] = resolvedDomain;
|
|
606
|
+
const step = niceStep(domainEnd - domainStart, count);
|
|
607
|
+
const values = [];
|
|
608
|
+
for (let value = domainStart; value <= domainEnd + step * 0.5; value += step) {
|
|
609
|
+
values.push(roundFloat(value));
|
|
610
|
+
}
|
|
611
|
+
return values;
|
|
612
|
+
};
|
|
613
|
+
return {
|
|
614
|
+
domain: resolvedDomain,
|
|
615
|
+
range,
|
|
616
|
+
scale,
|
|
617
|
+
ticks
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/line/line-chart.js
|
|
624
|
+
var line_chart_exports = {};
|
|
625
|
+
__export(line_chart_exports, {
|
|
626
|
+
lineChart: () => lineChart
|
|
627
|
+
});
|
|
628
|
+
var lineChart;
|
|
629
|
+
var init_line_chart = __esm({
|
|
630
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/line/line-chart.js"() {
|
|
631
|
+
init_axis_builder();
|
|
632
|
+
init_cartesian_geometry();
|
|
633
|
+
init_chrome();
|
|
634
|
+
init_interaction();
|
|
635
|
+
init_palette();
|
|
636
|
+
init_value_labels();
|
|
637
|
+
init_scene();
|
|
638
|
+
init_band_scale();
|
|
639
|
+
init_linear_scale();
|
|
640
|
+
init_math();
|
|
641
|
+
lineChart = {
|
|
642
|
+
id: "line",
|
|
643
|
+
family: "cartesian",
|
|
644
|
+
render: ({ config, payload, frame, size }) => {
|
|
645
|
+
var _a, _b, _c;
|
|
646
|
+
if (payload.kind !== "cartesian") {
|
|
647
|
+
return [];
|
|
648
|
+
}
|
|
649
|
+
const values = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
650
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
651
|
+
var _a2;
|
|
652
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
653
|
+
}).map((threshold) => threshold.value);
|
|
654
|
+
const domainValues = [...values, ...thresholdValues];
|
|
655
|
+
const minValue = (_a = config.yAxis.min) != null ? _a : domainValues.length > 0 ? Math.min(...domainValues) : 0;
|
|
656
|
+
const maxValue = (_b = config.yAxis.max) != null ? _b : domainValues.length > 0 ? Math.max(...domainValues) : 1;
|
|
657
|
+
const [domainMin, domainMax] = padExtent(minValue, maxValue, 0.1);
|
|
658
|
+
const xScale = createBandScale({
|
|
659
|
+
domain: payload.labels,
|
|
660
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
661
|
+
paddingInner: 0.42,
|
|
662
|
+
paddingOuter: 0.18
|
|
663
|
+
});
|
|
664
|
+
const yScale = createLinearScale({
|
|
665
|
+
domain: [domainMin, domainMax],
|
|
666
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
667
|
+
nice: config.yAxis.nice,
|
|
668
|
+
tickCount: config.yAxis.tickCount
|
|
669
|
+
});
|
|
670
|
+
const plotChildren = [
|
|
671
|
+
rectNode("line-plot-bg", {
|
|
672
|
+
x: frame.plot.x,
|
|
673
|
+
y: frame.plot.y,
|
|
674
|
+
width: frame.plot.width,
|
|
675
|
+
height: frame.plot.height,
|
|
676
|
+
rx: 14,
|
|
677
|
+
fill: config.theme.plotBackground,
|
|
678
|
+
stroke: config.theme.plotBorder,
|
|
679
|
+
"stroke-width": 1
|
|
680
|
+
}),
|
|
681
|
+
...buildCartesianAxisNodes({
|
|
682
|
+
idPrefix: "line",
|
|
683
|
+
frame,
|
|
684
|
+
theme: config.theme,
|
|
685
|
+
labels: payload.labels,
|
|
686
|
+
xScale,
|
|
687
|
+
yScale,
|
|
688
|
+
xAxis: config.xAxis,
|
|
689
|
+
yAxis: config.yAxis,
|
|
690
|
+
grid: config.grid
|
|
691
|
+
}),
|
|
692
|
+
...buildThresholdNodes({
|
|
693
|
+
idPrefix: "line",
|
|
694
|
+
thresholds: config.thresholds,
|
|
695
|
+
frame,
|
|
696
|
+
theme: config.theme,
|
|
697
|
+
yScale
|
|
698
|
+
})
|
|
699
|
+
];
|
|
700
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
701
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
702
|
+
const points = series.data.map((datum, index) => {
|
|
703
|
+
const band = xScale.at(index);
|
|
704
|
+
return {
|
|
705
|
+
x: band.center,
|
|
706
|
+
y: yScale.scale(datum.y)
|
|
707
|
+
};
|
|
708
|
+
});
|
|
709
|
+
plotChildren.push(pathNode(`line-series-path-${series.id}`, {
|
|
710
|
+
d: buildLinePath(points),
|
|
711
|
+
fill: "none",
|
|
712
|
+
stroke: color,
|
|
713
|
+
"stroke-width": 3,
|
|
714
|
+
"stroke-linecap": "round",
|
|
715
|
+
"stroke-linejoin": "round",
|
|
716
|
+
opacity: 0.96
|
|
717
|
+
}));
|
|
718
|
+
points.forEach((point, index) => {
|
|
719
|
+
var _a2, _b2, _c2;
|
|
720
|
+
const datum = series.data[index];
|
|
721
|
+
plotChildren.push(circleNode(`line-point-${series.id}-${index}`, {
|
|
722
|
+
cx: point.x,
|
|
723
|
+
cy: point.y,
|
|
724
|
+
r: payload.labels.length > 18 ? 0 : 4,
|
|
725
|
+
fill: color,
|
|
726
|
+
stroke: config.theme.pointStroke,
|
|
727
|
+
"stroke-width": 2
|
|
728
|
+
}));
|
|
729
|
+
plotChildren.push(circleNode(`line-point-hit-${series.id}-${index}`, {
|
|
730
|
+
cx: point.x,
|
|
731
|
+
cy: point.y,
|
|
732
|
+
r: 11,
|
|
733
|
+
fill: color,
|
|
734
|
+
opacity: 1e-3,
|
|
735
|
+
"pointer-events": "all",
|
|
736
|
+
...createInteractionAttrs({
|
|
737
|
+
targetId: `line-point-${series.id}-${index}`,
|
|
738
|
+
chartType: "line",
|
|
739
|
+
kind: "datum",
|
|
740
|
+
label: (_c2 = (_b2 = datum == null ? void 0 : datum.label) != null ? _b2 : (_a2 = datum == null ? void 0 : datum.x) == null ? void 0 : _a2.toString()) != null ? _c2 : payload.labels[index],
|
|
741
|
+
seriesId: series.id,
|
|
742
|
+
seriesName: series.name,
|
|
743
|
+
value: datum == null ? void 0 : datum.y,
|
|
744
|
+
color,
|
|
745
|
+
index
|
|
746
|
+
})
|
|
747
|
+
}, interactiveNodeStyle));
|
|
748
|
+
if (config.showNumber && datum) {
|
|
749
|
+
plotChildren.push(buildValueLabelNode(`line-value-${series.id}-${index}`, config, datum.y, point.x, point.y - 12, {
|
|
750
|
+
fill: color
|
|
751
|
+
}));
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
});
|
|
755
|
+
return [
|
|
756
|
+
rectNode("line-surface", {
|
|
757
|
+
x: 0,
|
|
758
|
+
y: 0,
|
|
759
|
+
width: size.width,
|
|
760
|
+
height: size.height,
|
|
761
|
+
rx: config.layout.cornerRadius,
|
|
762
|
+
fill: (_c = config.layout.background) != null ? _c : config.theme.surface,
|
|
763
|
+
stroke: config.theme.border,
|
|
764
|
+
"stroke-width": 1
|
|
765
|
+
}),
|
|
766
|
+
...buildTitleNodes("line", config, frame, config.theme),
|
|
767
|
+
groupNode("line-plot", plotChildren),
|
|
768
|
+
...buildLegendNodes("line", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
769
|
+
id: series.id,
|
|
770
|
+
label: series.name,
|
|
771
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
772
|
+
})))
|
|
773
|
+
];
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/area/area-chart.js
|
|
780
|
+
var area_chart_exports = {};
|
|
781
|
+
__export(area_chart_exports, {
|
|
782
|
+
areaChart: () => areaChart
|
|
783
|
+
});
|
|
784
|
+
var areaChart;
|
|
785
|
+
var init_area_chart = __esm({
|
|
786
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/area/area-chart.js"() {
|
|
787
|
+
init_axis_builder();
|
|
788
|
+
init_cartesian_geometry();
|
|
789
|
+
init_chrome();
|
|
790
|
+
init_interaction();
|
|
791
|
+
init_palette();
|
|
792
|
+
init_value_labels();
|
|
793
|
+
init_scene();
|
|
794
|
+
init_band_scale();
|
|
795
|
+
init_linear_scale();
|
|
796
|
+
init_math();
|
|
797
|
+
areaChart = {
|
|
798
|
+
id: "area",
|
|
799
|
+
family: "cartesian",
|
|
800
|
+
render: ({ config, payload, frame, size }) => {
|
|
801
|
+
var _a, _b, _c;
|
|
802
|
+
if (payload.kind !== "cartesian") {
|
|
803
|
+
return [];
|
|
804
|
+
}
|
|
805
|
+
const values = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
806
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
807
|
+
var _a2;
|
|
808
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
809
|
+
}).map((threshold) => threshold.value);
|
|
810
|
+
const domainValues = [...values, ...thresholdValues];
|
|
811
|
+
const minValue = (_a = config.yAxis.min) != null ? _a : domainValues.length > 0 ? Math.min(0, ...domainValues) : 0;
|
|
812
|
+
const maxValue = (_b = config.yAxis.max) != null ? _b : domainValues.length > 0 ? Math.max(...domainValues) : 1;
|
|
813
|
+
const [domainMin, domainMax] = padExtent(minValue, maxValue, 0.08);
|
|
814
|
+
const xScale = createBandScale({
|
|
815
|
+
domain: payload.labels,
|
|
816
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
817
|
+
paddingInner: 0.42,
|
|
818
|
+
paddingOuter: 0.18
|
|
819
|
+
});
|
|
820
|
+
const yScale = createLinearScale({
|
|
821
|
+
domain: [domainMin, domainMax],
|
|
822
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
823
|
+
nice: config.yAxis.nice,
|
|
824
|
+
tickCount: config.yAxis.tickCount
|
|
825
|
+
});
|
|
826
|
+
const baseline = yScale.scale(Math.max(0, domainMin));
|
|
827
|
+
const plotChildren = [
|
|
828
|
+
rectNode("area-plot-bg", {
|
|
829
|
+
x: frame.plot.x,
|
|
830
|
+
y: frame.plot.y,
|
|
831
|
+
width: frame.plot.width,
|
|
832
|
+
height: frame.plot.height,
|
|
833
|
+
rx: 14,
|
|
834
|
+
fill: config.theme.plotBackground,
|
|
835
|
+
stroke: config.theme.plotBorder,
|
|
836
|
+
"stroke-width": 1
|
|
837
|
+
}),
|
|
838
|
+
...buildCartesianAxisNodes({
|
|
839
|
+
idPrefix: "area",
|
|
840
|
+
frame,
|
|
841
|
+
theme: config.theme,
|
|
842
|
+
labels: payload.labels,
|
|
843
|
+
xScale,
|
|
844
|
+
yScale,
|
|
845
|
+
xAxis: config.xAxis,
|
|
846
|
+
yAxis: config.yAxis,
|
|
847
|
+
grid: config.grid
|
|
848
|
+
}),
|
|
849
|
+
...buildThresholdNodes({
|
|
850
|
+
idPrefix: "area",
|
|
851
|
+
thresholds: config.thresholds,
|
|
852
|
+
frame,
|
|
853
|
+
theme: config.theme,
|
|
854
|
+
yScale
|
|
855
|
+
})
|
|
856
|
+
];
|
|
857
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
858
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
859
|
+
const points = series.data.map((datum, index) => {
|
|
860
|
+
const band = xScale.at(index);
|
|
861
|
+
return {
|
|
862
|
+
x: band.center,
|
|
863
|
+
y: yScale.scale(datum.y)
|
|
864
|
+
};
|
|
865
|
+
});
|
|
866
|
+
plotChildren.push(pathNode(`area-fill-${series.id}`, {
|
|
867
|
+
d: buildAreaPath(points, baseline),
|
|
868
|
+
fill: color,
|
|
869
|
+
opacity: 0.18
|
|
870
|
+
}));
|
|
871
|
+
plotChildren.push(pathNode(`area-line-${series.id}`, {
|
|
872
|
+
d: buildLinePath(points),
|
|
873
|
+
fill: "none",
|
|
874
|
+
stroke: color,
|
|
875
|
+
"stroke-width": 3,
|
|
876
|
+
"stroke-linecap": "round",
|
|
877
|
+
"stroke-linejoin": "round",
|
|
878
|
+
opacity: 0.98
|
|
879
|
+
}));
|
|
880
|
+
points.forEach((point, index) => {
|
|
881
|
+
var _a2, _b2, _c2;
|
|
882
|
+
const datum = series.data[index];
|
|
883
|
+
plotChildren.push(circleNode(`area-point-${series.id}-${index}`, {
|
|
884
|
+
cx: point.x,
|
|
885
|
+
cy: point.y,
|
|
886
|
+
r: payload.labels.length > 18 ? 0 : 4,
|
|
887
|
+
fill: color,
|
|
888
|
+
stroke: config.theme.pointStroke,
|
|
889
|
+
"stroke-width": 2
|
|
890
|
+
}));
|
|
891
|
+
plotChildren.push(circleNode(`area-point-hit-${series.id}-${index}`, {
|
|
892
|
+
cx: point.x,
|
|
893
|
+
cy: point.y,
|
|
894
|
+
r: 11,
|
|
895
|
+
fill: color,
|
|
896
|
+
opacity: 1e-3,
|
|
897
|
+
"pointer-events": "all",
|
|
898
|
+
...createInteractionAttrs({
|
|
899
|
+
targetId: `area-point-${series.id}-${index}`,
|
|
900
|
+
chartType: "area",
|
|
901
|
+
kind: "datum",
|
|
902
|
+
label: (_c2 = (_b2 = datum == null ? void 0 : datum.label) != null ? _b2 : (_a2 = datum == null ? void 0 : datum.x) == null ? void 0 : _a2.toString()) != null ? _c2 : payload.labels[index],
|
|
903
|
+
seriesId: series.id,
|
|
904
|
+
seriesName: series.name,
|
|
905
|
+
value: datum == null ? void 0 : datum.y,
|
|
906
|
+
color,
|
|
907
|
+
index
|
|
908
|
+
})
|
|
909
|
+
}, interactiveNodeStyle));
|
|
910
|
+
if (config.showNumber && datum) {
|
|
911
|
+
plotChildren.push(buildValueLabelNode(`area-value-${series.id}-${index}`, config, datum.y, point.x, point.y - 12, {
|
|
912
|
+
fill: color
|
|
913
|
+
}));
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
return [
|
|
918
|
+
rectNode("area-surface", {
|
|
919
|
+
x: 0,
|
|
920
|
+
y: 0,
|
|
921
|
+
width: size.width,
|
|
922
|
+
height: size.height,
|
|
923
|
+
rx: config.layout.cornerRadius,
|
|
924
|
+
fill: (_c = config.layout.background) != null ? _c : config.theme.surface,
|
|
925
|
+
stroke: config.theme.border,
|
|
926
|
+
"stroke-width": 1
|
|
927
|
+
}),
|
|
928
|
+
...buildTitleNodes("area", config, frame, config.theme),
|
|
929
|
+
groupNode("area-plot", plotChildren),
|
|
930
|
+
...buildLegendNodes("area", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
931
|
+
id: series.id,
|
|
932
|
+
label: series.name,
|
|
933
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
934
|
+
})))
|
|
935
|
+
];
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/stacked-area/stacked-area-chart.js
|
|
942
|
+
var stacked_area_chart_exports = {};
|
|
943
|
+
__export(stacked_area_chart_exports, {
|
|
944
|
+
stackedAreaChart: () => stackedAreaChart
|
|
945
|
+
});
|
|
946
|
+
var stackedAreaChart;
|
|
947
|
+
var init_stacked_area_chart = __esm({
|
|
948
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/stacked-area/stacked-area-chart.js"() {
|
|
949
|
+
init_axis_builder();
|
|
950
|
+
init_cartesian_geometry();
|
|
951
|
+
init_chrome();
|
|
952
|
+
init_interaction();
|
|
953
|
+
init_palette();
|
|
954
|
+
init_value_labels();
|
|
955
|
+
init_scene();
|
|
956
|
+
init_band_scale();
|
|
957
|
+
init_linear_scale();
|
|
958
|
+
init_math();
|
|
959
|
+
stackedAreaChart = {
|
|
960
|
+
id: "stacked-area",
|
|
961
|
+
family: "cartesian",
|
|
962
|
+
render: ({ config, payload, frame, size }) => {
|
|
963
|
+
var _a, _b, _c;
|
|
964
|
+
if (payload.kind !== "cartesian") {
|
|
965
|
+
return [];
|
|
966
|
+
}
|
|
967
|
+
const stackedTotals = payload.labels.map((_, index) => payload.series.reduce((total, series) => {
|
|
968
|
+
var _a2, _b2;
|
|
969
|
+
return total + Math.max(0, (_b2 = (_a2 = series.data[index]) == null ? void 0 : _a2.y) != null ? _b2 : 0);
|
|
970
|
+
}, 0));
|
|
971
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
972
|
+
var _a2;
|
|
973
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
974
|
+
}).map((threshold) => threshold.value);
|
|
975
|
+
const maxValue = (_a = config.yAxis.max) != null ? _a : stackedTotals.length > 0 ? Math.max(...stackedTotals, ...thresholdValues, 0) : 1;
|
|
976
|
+
const [domainMin, domainMax] = padExtent((_b = config.yAxis.min) != null ? _b : 0, maxValue, 0.08);
|
|
977
|
+
const xScale = createBandScale({
|
|
978
|
+
domain: payload.labels,
|
|
979
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
980
|
+
paddingInner: 0.36,
|
|
981
|
+
paddingOuter: 0.18
|
|
982
|
+
});
|
|
983
|
+
const yScale = createLinearScale({
|
|
984
|
+
domain: [domainMin, domainMax],
|
|
985
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
986
|
+
nice: config.yAxis.nice,
|
|
987
|
+
tickCount: config.yAxis.tickCount
|
|
988
|
+
});
|
|
989
|
+
const cumulative = payload.labels.map(() => 0);
|
|
990
|
+
const plotChildren = [
|
|
991
|
+
rectNode("stacked-area-plot-bg", {
|
|
992
|
+
x: frame.plot.x,
|
|
993
|
+
y: frame.plot.y,
|
|
994
|
+
width: frame.plot.width,
|
|
995
|
+
height: frame.plot.height,
|
|
996
|
+
rx: 14,
|
|
997
|
+
fill: config.theme.plotBackground,
|
|
998
|
+
stroke: config.theme.plotBorder,
|
|
999
|
+
"stroke-width": 1
|
|
1000
|
+
}),
|
|
1001
|
+
...buildCartesianAxisNodes({
|
|
1002
|
+
idPrefix: "stacked-area",
|
|
1003
|
+
frame,
|
|
1004
|
+
theme: config.theme,
|
|
1005
|
+
labels: payload.labels,
|
|
1006
|
+
xScale,
|
|
1007
|
+
yScale,
|
|
1008
|
+
xAxis: config.xAxis,
|
|
1009
|
+
yAxis: config.yAxis,
|
|
1010
|
+
grid: config.grid
|
|
1011
|
+
}),
|
|
1012
|
+
...buildThresholdNodes({
|
|
1013
|
+
idPrefix: "stacked-area",
|
|
1014
|
+
thresholds: config.thresholds,
|
|
1015
|
+
frame,
|
|
1016
|
+
theme: config.theme,
|
|
1017
|
+
yScale
|
|
1018
|
+
})
|
|
1019
|
+
];
|
|
1020
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
1021
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
1022
|
+
const lowerBoundary = [];
|
|
1023
|
+
const upperBoundary = [];
|
|
1024
|
+
series.data.forEach((datum, index) => {
|
|
1025
|
+
var _a2;
|
|
1026
|
+
const band = xScale.at(index);
|
|
1027
|
+
const previousTotal = (_a2 = cumulative[index]) != null ? _a2 : 0;
|
|
1028
|
+
const nextTotal = previousTotal + Math.max(0, datum.y);
|
|
1029
|
+
lowerBoundary.push({
|
|
1030
|
+
x: band.center,
|
|
1031
|
+
y: yScale.scale(previousTotal)
|
|
1032
|
+
});
|
|
1033
|
+
upperBoundary.push({
|
|
1034
|
+
x: band.center,
|
|
1035
|
+
y: yScale.scale(nextTotal)
|
|
1036
|
+
});
|
|
1037
|
+
cumulative[index] = nextTotal;
|
|
1038
|
+
});
|
|
1039
|
+
plotChildren.push(pathNode(`stacked-area-fill-${series.id}`, {
|
|
1040
|
+
d: buildAreaPath(upperBoundary, yScale.scale(0), lowerBoundary),
|
|
1041
|
+
fill: color,
|
|
1042
|
+
opacity: 0.22
|
|
1043
|
+
}));
|
|
1044
|
+
plotChildren.push(pathNode(`stacked-area-line-${series.id}`, {
|
|
1045
|
+
d: buildLinePath(upperBoundary),
|
|
1046
|
+
fill: "none",
|
|
1047
|
+
stroke: color,
|
|
1048
|
+
"stroke-width": 2.5,
|
|
1049
|
+
"stroke-linecap": "round",
|
|
1050
|
+
"stroke-linejoin": "round",
|
|
1051
|
+
opacity: 0.94
|
|
1052
|
+
}));
|
|
1053
|
+
upperBoundary.forEach((point, index) => {
|
|
1054
|
+
var _a2, _b2, _c2, _d, _e, _f, _g;
|
|
1055
|
+
plotChildren.push(circleNode(`stacked-area-point-${series.id}-${index}`, {
|
|
1056
|
+
cx: point.x,
|
|
1057
|
+
cy: point.y,
|
|
1058
|
+
r: payload.labels.length > 20 ? 0 : 3.5,
|
|
1059
|
+
fill: color,
|
|
1060
|
+
stroke: config.theme.pointStroke,
|
|
1061
|
+
"stroke-width": 2
|
|
1062
|
+
}));
|
|
1063
|
+
plotChildren.push(circleNode(`stacked-area-point-hit-${series.id}-${index}`, {
|
|
1064
|
+
cx: point.x,
|
|
1065
|
+
cy: point.y,
|
|
1066
|
+
r: 11,
|
|
1067
|
+
fill: color,
|
|
1068
|
+
opacity: 1e-3,
|
|
1069
|
+
"pointer-events": "all",
|
|
1070
|
+
...createInteractionAttrs({
|
|
1071
|
+
targetId: `stacked-area-point-${series.id}-${index}`,
|
|
1072
|
+
chartType: "stacked-area",
|
|
1073
|
+
kind: "datum",
|
|
1074
|
+
label: (_b2 = (_a2 = series.data[index]) == null ? void 0 : _a2.label) != null ? _b2 : payload.labels[index],
|
|
1075
|
+
seriesId: series.id,
|
|
1076
|
+
seriesName: series.name,
|
|
1077
|
+
value: (_d = (_c2 = series.data[index]) == null ? void 0 : _c2.y) != null ? _d : 0,
|
|
1078
|
+
detail: `Stacked total ${Math.round((_e = cumulative[index]) != null ? _e : 0)}`,
|
|
1079
|
+
color,
|
|
1080
|
+
index
|
|
1081
|
+
})
|
|
1082
|
+
}, interactiveNodeStyle));
|
|
1083
|
+
if (config.showNumber) {
|
|
1084
|
+
plotChildren.push(buildValueLabelNode(`stacked-area-value-${series.id}-${index}`, config, (_g = (_f = series.data[index]) == null ? void 0 : _f.y) != null ? _g : 0, point.x, point.y - 10, {
|
|
1085
|
+
fill: color
|
|
1086
|
+
}));
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
return [
|
|
1091
|
+
rectNode("stacked-area-surface", {
|
|
1092
|
+
x: 0,
|
|
1093
|
+
y: 0,
|
|
1094
|
+
width: size.width,
|
|
1095
|
+
height: size.height,
|
|
1096
|
+
rx: config.layout.cornerRadius,
|
|
1097
|
+
fill: (_c = config.layout.background) != null ? _c : config.theme.surface,
|
|
1098
|
+
stroke: config.theme.border,
|
|
1099
|
+
"stroke-width": 1
|
|
1100
|
+
}),
|
|
1101
|
+
...buildTitleNodes("stacked-area", config, frame, config.theme),
|
|
1102
|
+
groupNode("stacked-area-plot", plotChildren),
|
|
1103
|
+
...buildLegendNodes("stacked-area", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
1104
|
+
id: series.id,
|
|
1105
|
+
label: config.showNumber ? `${series.name} (${series.data.reduce((sum2, datum) => {
|
|
1106
|
+
var _a2;
|
|
1107
|
+
return sum2 + Math.max(0, (_a2 = datum == null ? void 0 : datum.y) != null ? _a2 : 0);
|
|
1108
|
+
}, 0)})` : series.name,
|
|
1109
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
1110
|
+
})))
|
|
1111
|
+
];
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/bar/bar-chart.js
|
|
1118
|
+
var bar_chart_exports = {};
|
|
1119
|
+
__export(bar_chart_exports, {
|
|
1120
|
+
barChart: () => barChart
|
|
1121
|
+
});
|
|
1122
|
+
var barChart;
|
|
1123
|
+
var init_bar_chart = __esm({
|
|
1124
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/bar/bar-chart.js"() {
|
|
1125
|
+
init_axis_builder();
|
|
1126
|
+
init_chrome();
|
|
1127
|
+
init_interaction();
|
|
1128
|
+
init_palette();
|
|
1129
|
+
init_value_labels();
|
|
1130
|
+
init_scene();
|
|
1131
|
+
init_band_scale();
|
|
1132
|
+
init_linear_scale();
|
|
1133
|
+
barChart = {
|
|
1134
|
+
id: "bar",
|
|
1135
|
+
family: "cartesian",
|
|
1136
|
+
render: ({ config, payload, frame, size }) => {
|
|
1137
|
+
var _a, _b, _c;
|
|
1138
|
+
if (payload.kind !== "cartesian") {
|
|
1139
|
+
return [];
|
|
1140
|
+
}
|
|
1141
|
+
const values = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
1142
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
1143
|
+
var _a2;
|
|
1144
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
1145
|
+
}).map((threshold) => threshold.value);
|
|
1146
|
+
const domainValues = [...values, ...thresholdValues];
|
|
1147
|
+
const minValue = (_a = config.yAxis.min) != null ? _a : domainValues.length > 0 ? Math.min(0, ...domainValues) : 0;
|
|
1148
|
+
const maxValue = (_b = config.yAxis.max) != null ? _b : domainValues.length > 0 ? Math.max(0, ...domainValues) : 1;
|
|
1149
|
+
const xScale = createBandScale({
|
|
1150
|
+
domain: payload.labels,
|
|
1151
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
1152
|
+
paddingInner: 0.22,
|
|
1153
|
+
paddingOuter: 0.12
|
|
1154
|
+
});
|
|
1155
|
+
const yScale = createLinearScale({
|
|
1156
|
+
domain: [minValue, maxValue],
|
|
1157
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
1158
|
+
nice: config.yAxis.nice,
|
|
1159
|
+
tickCount: config.yAxis.tickCount
|
|
1160
|
+
});
|
|
1161
|
+
const baseline = yScale.scale(0);
|
|
1162
|
+
const bars = [];
|
|
1163
|
+
payload.labels.forEach((label, groupIndex) => {
|
|
1164
|
+
const band = xScale.get(label);
|
|
1165
|
+
const groupWidth = band.width;
|
|
1166
|
+
const gap = 6;
|
|
1167
|
+
const seriesWidth = (groupWidth - gap * Math.max(0, payload.series.length - 1)) / Math.max(1, payload.series.length);
|
|
1168
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
1169
|
+
var _a2, _b2, _c2, _d, _e;
|
|
1170
|
+
const datum = series.data[groupIndex];
|
|
1171
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
1172
|
+
const x = band.start + seriesIndex * (seriesWidth + gap);
|
|
1173
|
+
const y = yScale.scale(Math.max((_a2 = datum == null ? void 0 : datum.y) != null ? _a2 : 0, 0));
|
|
1174
|
+
const height = Math.abs(yScale.scale((_b2 = datum == null ? void 0 : datum.y) != null ? _b2 : 0) - baseline);
|
|
1175
|
+
bars.push(rectNode(`bar-${series.id}-${groupIndex}`, {
|
|
1176
|
+
x,
|
|
1177
|
+
y: datum && datum.y >= 0 ? y : baseline,
|
|
1178
|
+
width: seriesWidth,
|
|
1179
|
+
height,
|
|
1180
|
+
rx: 8,
|
|
1181
|
+
fill: color,
|
|
1182
|
+
opacity: 0.92,
|
|
1183
|
+
...createInteractionAttrs({
|
|
1184
|
+
targetId: `bar-${series.id}-${groupIndex}`,
|
|
1185
|
+
chartType: "bar",
|
|
1186
|
+
kind: "datum",
|
|
1187
|
+
label: (_c2 = datum == null ? void 0 : datum.label) != null ? _c2 : label,
|
|
1188
|
+
seriesId: series.id,
|
|
1189
|
+
seriesName: series.name,
|
|
1190
|
+
value: (_d = datum == null ? void 0 : datum.y) != null ? _d : 0,
|
|
1191
|
+
color,
|
|
1192
|
+
index: groupIndex
|
|
1193
|
+
})
|
|
1194
|
+
}, interactiveNodeStyle));
|
|
1195
|
+
if (config.showNumber) {
|
|
1196
|
+
bars.push(buildValueLabelNode(`bar-value-${series.id}-${groupIndex}`, config, (_e = datum == null ? void 0 : datum.y) != null ? _e : 0, x + seriesWidth / 2, datum && datum.y >= 0 ? y - 10 : baseline + height + 16, {
|
|
1197
|
+
fill: color
|
|
1198
|
+
}));
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
});
|
|
1202
|
+
return [
|
|
1203
|
+
rectNode("bar-surface", {
|
|
1204
|
+
x: 0,
|
|
1205
|
+
y: 0,
|
|
1206
|
+
width: size.width,
|
|
1207
|
+
height: size.height,
|
|
1208
|
+
rx: config.layout.cornerRadius,
|
|
1209
|
+
fill: (_c = config.layout.background) != null ? _c : config.theme.surface,
|
|
1210
|
+
stroke: config.theme.border,
|
|
1211
|
+
"stroke-width": 1
|
|
1212
|
+
}),
|
|
1213
|
+
...buildTitleNodes("bar", config, frame, config.theme),
|
|
1214
|
+
groupNode("bar-plot", [
|
|
1215
|
+
rectNode("bar-plot-bg", {
|
|
1216
|
+
x: frame.plot.x,
|
|
1217
|
+
y: frame.plot.y,
|
|
1218
|
+
width: frame.plot.width,
|
|
1219
|
+
height: frame.plot.height,
|
|
1220
|
+
rx: 14,
|
|
1221
|
+
fill: config.theme.plotBackground,
|
|
1222
|
+
stroke: config.theme.plotBorder,
|
|
1223
|
+
"stroke-width": 1
|
|
1224
|
+
}),
|
|
1225
|
+
...buildCartesianAxisNodes({
|
|
1226
|
+
idPrefix: "bar",
|
|
1227
|
+
frame,
|
|
1228
|
+
theme: config.theme,
|
|
1229
|
+
labels: payload.labels,
|
|
1230
|
+
xScale,
|
|
1231
|
+
yScale,
|
|
1232
|
+
xAxis: config.xAxis,
|
|
1233
|
+
yAxis: config.yAxis,
|
|
1234
|
+
grid: config.grid
|
|
1235
|
+
}),
|
|
1236
|
+
...buildThresholdNodes({
|
|
1237
|
+
idPrefix: "bar",
|
|
1238
|
+
thresholds: config.thresholds,
|
|
1239
|
+
frame,
|
|
1240
|
+
theme: config.theme,
|
|
1241
|
+
yScale
|
|
1242
|
+
}),
|
|
1243
|
+
...bars
|
|
1244
|
+
]),
|
|
1245
|
+
...buildLegendNodes("bar", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
1246
|
+
id: series.id,
|
|
1247
|
+
label: series.name,
|
|
1248
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
1249
|
+
})))
|
|
1250
|
+
];
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/bar-3d/bar-3d-chart.js
|
|
1257
|
+
var bar_3d_chart_exports = {};
|
|
1258
|
+
__export(bar_3d_chart_exports, {
|
|
1259
|
+
bar3DChart: () => bar3DChart
|
|
1260
|
+
});
|
|
1261
|
+
var shadeHex, buildPolygonPath, bar3DChart;
|
|
1262
|
+
var init_bar_3d_chart = __esm({
|
|
1263
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/bar-3d/bar-3d-chart.js"() {
|
|
1264
|
+
init_axis_builder();
|
|
1265
|
+
init_chrome();
|
|
1266
|
+
init_interaction();
|
|
1267
|
+
init_palette();
|
|
1268
|
+
init_value_labels();
|
|
1269
|
+
init_scene();
|
|
1270
|
+
init_band_scale();
|
|
1271
|
+
init_linear_scale();
|
|
1272
|
+
shadeHex = (hex, amount) => {
|
|
1273
|
+
var _a;
|
|
1274
|
+
const normalized = hex.replace("#", "");
|
|
1275
|
+
const parts = normalized.length === 3 ? normalized.split("").map((part) => part + part) : (_a = normalized.match(/.{2}/g)) != null ? _a : ["25", "99", "eb"];
|
|
1276
|
+
const shifted = parts.map((part) => {
|
|
1277
|
+
const channel = Number.parseInt(part, 16);
|
|
1278
|
+
const next = Math.max(0, Math.min(255, Math.round(channel + 255 * amount)));
|
|
1279
|
+
return next.toString(16).padStart(2, "0");
|
|
1280
|
+
});
|
|
1281
|
+
return `#${shifted.join("")}`;
|
|
1282
|
+
};
|
|
1283
|
+
buildPolygonPath = (points) => `${points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ")} Z`;
|
|
1284
|
+
bar3DChart = {
|
|
1285
|
+
id: "bar-3d",
|
|
1286
|
+
family: "cartesian",
|
|
1287
|
+
render: ({ config, payload, frame, size }) => {
|
|
1288
|
+
var _a, _b, _c;
|
|
1289
|
+
if (payload.kind !== "cartesian") {
|
|
1290
|
+
return [];
|
|
1291
|
+
}
|
|
1292
|
+
const values = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
1293
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
1294
|
+
var _a2;
|
|
1295
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
1296
|
+
}).map((threshold) => threshold.value);
|
|
1297
|
+
const minValue = (_a = config.yAxis.min) != null ? _a : values.length > 0 ? Math.min(0, ...values, ...thresholdValues) : 0;
|
|
1298
|
+
const maxValue = (_b = config.yAxis.max) != null ? _b : values.length > 0 ? Math.max(0, ...values, ...thresholdValues) : 1;
|
|
1299
|
+
const xScale = createBandScale({
|
|
1300
|
+
domain: payload.labels,
|
|
1301
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
1302
|
+
paddingInner: 0.22,
|
|
1303
|
+
paddingOuter: 0.12
|
|
1304
|
+
});
|
|
1305
|
+
const yScale = createLinearScale({
|
|
1306
|
+
domain: [minValue, maxValue],
|
|
1307
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
1308
|
+
nice: config.yAxis.nice,
|
|
1309
|
+
tickCount: config.yAxis.tickCount
|
|
1310
|
+
});
|
|
1311
|
+
const baseline = yScale.scale(0);
|
|
1312
|
+
const depthX = config.bar3d.depthX;
|
|
1313
|
+
const depthY = config.bar3d.depthY;
|
|
1314
|
+
const floorY = frame.plot.y + frame.plot.height;
|
|
1315
|
+
const backTopY = frame.plot.y - depthY;
|
|
1316
|
+
const floorPlane = buildPolygonPath([
|
|
1317
|
+
{ x: frame.plot.x, y: floorY },
|
|
1318
|
+
{ x: frame.plot.x + frame.plot.width, y: floorY },
|
|
1319
|
+
{ x: frame.plot.x + frame.plot.width + depthX, y: floorY - depthY },
|
|
1320
|
+
{ x: frame.plot.x + depthX, y: floorY - depthY }
|
|
1321
|
+
]);
|
|
1322
|
+
const wallPlane = buildPolygonPath([
|
|
1323
|
+
{ x: frame.plot.x + frame.plot.width, y: frame.plot.y },
|
|
1324
|
+
{ x: frame.plot.x + frame.plot.width + depthX, y: backTopY },
|
|
1325
|
+
{ x: frame.plot.x + frame.plot.width + depthX, y: floorY - depthY },
|
|
1326
|
+
{ x: frame.plot.x + frame.plot.width, y: floorY }
|
|
1327
|
+
]);
|
|
1328
|
+
const bars = [];
|
|
1329
|
+
const floorGuides = payload.labels.flatMap((label, index) => {
|
|
1330
|
+
const band = xScale.get(label);
|
|
1331
|
+
const guideX = band.center;
|
|
1332
|
+
return [
|
|
1333
|
+
lineNode(`bar3d-floor-guide-${index}`, {
|
|
1334
|
+
x1: guideX,
|
|
1335
|
+
y1: floorY,
|
|
1336
|
+
x2: guideX + depthX,
|
|
1337
|
+
y2: floorY - depthY,
|
|
1338
|
+
stroke: config.bar3d.floorLineColor,
|
|
1339
|
+
"stroke-width": 1,
|
|
1340
|
+
opacity: 0.7
|
|
1341
|
+
})
|
|
1342
|
+
];
|
|
1343
|
+
});
|
|
1344
|
+
payload.labels.forEach((label, groupIndex) => {
|
|
1345
|
+
const band = xScale.get(label);
|
|
1346
|
+
const groupWidth = band.width;
|
|
1347
|
+
const gap = 6;
|
|
1348
|
+
const seriesWidth = (groupWidth - gap * Math.max(0, payload.series.length - 1)) / Math.max(1, payload.series.length);
|
|
1349
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
1350
|
+
var _a2, _b2;
|
|
1351
|
+
const datum = series.data[groupIndex];
|
|
1352
|
+
const rawValue = (_a2 = datum == null ? void 0 : datum.y) != null ? _a2 : 0;
|
|
1353
|
+
const baseColor = resolveSeriesColor(config, seriesIndex, series.color);
|
|
1354
|
+
const frontColor = baseColor;
|
|
1355
|
+
const topColor = shadeHex(baseColor, config.bar3d.topLightness);
|
|
1356
|
+
const sideColor = shadeHex(baseColor, config.bar3d.sideLightness);
|
|
1357
|
+
const x = band.start + seriesIndex * (seriesWidth + gap);
|
|
1358
|
+
const barTop = yScale.scale(Math.max(rawValue, 0));
|
|
1359
|
+
const frontY = rawValue >= 0 ? barTop : baseline;
|
|
1360
|
+
const height = Math.abs(yScale.scale(rawValue) - baseline);
|
|
1361
|
+
const capY = rawValue >= 0 ? frontY : frontY + height;
|
|
1362
|
+
const frontBaseY = rawValue >= 0 ? frontY + height : frontY;
|
|
1363
|
+
const shadowHeight = Math.max(8, Math.min(14, height * 0.12));
|
|
1364
|
+
bars.push(pathNode(`bar3d-shadow-${series.id}-${groupIndex}`, {
|
|
1365
|
+
d: buildPolygonPath([
|
|
1366
|
+
{ x, y: frontBaseY + 1 },
|
|
1367
|
+
{ x: x + seriesWidth, y: frontBaseY + 1 },
|
|
1368
|
+
{ x: x + seriesWidth + depthX, y: frontBaseY - depthY + shadowHeight },
|
|
1369
|
+
{ x: x + depthX, y: frontBaseY - depthY + shadowHeight }
|
|
1370
|
+
]),
|
|
1371
|
+
fill: config.bar3d.shadowColor,
|
|
1372
|
+
opacity: 0.18
|
|
1373
|
+
}));
|
|
1374
|
+
bars.push(pathNode(`bar3d-side-${series.id}-${groupIndex}`, {
|
|
1375
|
+
d: buildPolygonPath([
|
|
1376
|
+
{ x: x + seriesWidth, y: frontY },
|
|
1377
|
+
{ x: x + seriesWidth + depthX, y: frontY - depthY },
|
|
1378
|
+
{ x: x + seriesWidth + depthX, y: frontY + height - depthY },
|
|
1379
|
+
{ x: x + seriesWidth, y: frontY + height }
|
|
1380
|
+
]),
|
|
1381
|
+
fill: sideColor,
|
|
1382
|
+
opacity: 0.98
|
|
1383
|
+
}));
|
|
1384
|
+
bars.push(pathNode(`bar3d-top-${series.id}-${groupIndex}`, {
|
|
1385
|
+
d: buildPolygonPath([
|
|
1386
|
+
{ x, y: capY },
|
|
1387
|
+
{ x: x + depthX, y: capY - depthY },
|
|
1388
|
+
{ x: x + seriesWidth + depthX, y: capY - depthY },
|
|
1389
|
+
{ x: x + seriesWidth, y: capY }
|
|
1390
|
+
]),
|
|
1391
|
+
fill: topColor,
|
|
1392
|
+
opacity: 0.99
|
|
1393
|
+
}));
|
|
1394
|
+
bars.push(rectNode(`bar3d-front-${series.id}-${groupIndex}`, {
|
|
1395
|
+
x,
|
|
1396
|
+
y: frontY,
|
|
1397
|
+
width: seriesWidth,
|
|
1398
|
+
height,
|
|
1399
|
+
rx: 2,
|
|
1400
|
+
fill: frontColor,
|
|
1401
|
+
opacity: 0.99,
|
|
1402
|
+
...createInteractionAttrs({
|
|
1403
|
+
targetId: `bar3d-front-${series.id}-${groupIndex}`,
|
|
1404
|
+
chartType: "bar-3d",
|
|
1405
|
+
kind: "datum",
|
|
1406
|
+
label: (_b2 = datum == null ? void 0 : datum.label) != null ? _b2 : label,
|
|
1407
|
+
seriesId: series.id,
|
|
1408
|
+
seriesName: series.name,
|
|
1409
|
+
value: rawValue,
|
|
1410
|
+
color: frontColor,
|
|
1411
|
+
index: groupIndex
|
|
1412
|
+
})
|
|
1413
|
+
}, interactiveNodeStyle));
|
|
1414
|
+
bars.push(lineNode(`bar3d-highlight-${series.id}-${groupIndex}`, {
|
|
1415
|
+
x1: x + 1,
|
|
1416
|
+
y1: frontY + 1,
|
|
1417
|
+
x2: x + seriesWidth - 1,
|
|
1418
|
+
y2: frontY + 1,
|
|
1419
|
+
stroke: shadeHex(baseColor, 0.24),
|
|
1420
|
+
"stroke-width": 1.2,
|
|
1421
|
+
opacity: 0.72
|
|
1422
|
+
}));
|
|
1423
|
+
if (config.showNumber) {
|
|
1424
|
+
bars.push(buildValueLabelNode(`bar3d-value-${series.id}-${groupIndex}`, config, rawValue, x + seriesWidth / 2 + depthX * 0.32, rawValue >= 0 ? capY - depthY - 8 : frontY + height + 16, {
|
|
1425
|
+
fill: topColor
|
|
1426
|
+
}));
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
});
|
|
1430
|
+
return [
|
|
1431
|
+
rectNode("bar3d-surface", {
|
|
1432
|
+
x: 0,
|
|
1433
|
+
y: 0,
|
|
1434
|
+
width: size.width,
|
|
1435
|
+
height: size.height,
|
|
1436
|
+
rx: config.layout.cornerRadius,
|
|
1437
|
+
fill: (_c = config.layout.background) != null ? _c : config.theme.surface,
|
|
1438
|
+
stroke: config.theme.border,
|
|
1439
|
+
"stroke-width": 1
|
|
1440
|
+
}),
|
|
1441
|
+
...buildTitleNodes("bar3d", config, frame, config.theme),
|
|
1442
|
+
groupNode("bar3d-plot", [
|
|
1443
|
+
rectNode("bar3d-plot-bg", {
|
|
1444
|
+
x: frame.plot.x,
|
|
1445
|
+
y: frame.plot.y,
|
|
1446
|
+
width: frame.plot.width,
|
|
1447
|
+
height: frame.plot.height,
|
|
1448
|
+
rx: 14,
|
|
1449
|
+
fill: config.theme.plotBackground,
|
|
1450
|
+
stroke: config.theme.plotBorder,
|
|
1451
|
+
"stroke-width": 1
|
|
1452
|
+
}),
|
|
1453
|
+
pathNode("bar3d-floor-plane", {
|
|
1454
|
+
d: floorPlane,
|
|
1455
|
+
fill: config.bar3d.floorColor,
|
|
1456
|
+
stroke: config.bar3d.floorLineColor,
|
|
1457
|
+
"stroke-width": 1,
|
|
1458
|
+
opacity: 0.96
|
|
1459
|
+
}),
|
|
1460
|
+
pathNode("bar3d-wall-plane", {
|
|
1461
|
+
d: wallPlane,
|
|
1462
|
+
fill: shadeHex(config.bar3d.floorColor, -0.05),
|
|
1463
|
+
stroke: config.bar3d.floorLineColor,
|
|
1464
|
+
"stroke-width": 1,
|
|
1465
|
+
opacity: 0.84
|
|
1466
|
+
}),
|
|
1467
|
+
...floorGuides,
|
|
1468
|
+
...buildCartesianAxisNodes({
|
|
1469
|
+
idPrefix: "bar3d",
|
|
1470
|
+
frame,
|
|
1471
|
+
theme: config.theme,
|
|
1472
|
+
labels: payload.labels,
|
|
1473
|
+
xScale,
|
|
1474
|
+
yScale,
|
|
1475
|
+
xAxis: config.xAxis,
|
|
1476
|
+
yAxis: config.yAxis,
|
|
1477
|
+
grid: config.grid
|
|
1478
|
+
}),
|
|
1479
|
+
...buildThresholdNodes({
|
|
1480
|
+
idPrefix: "bar3d",
|
|
1481
|
+
thresholds: config.thresholds,
|
|
1482
|
+
frame,
|
|
1483
|
+
theme: config.theme,
|
|
1484
|
+
yScale
|
|
1485
|
+
}),
|
|
1486
|
+
...bars
|
|
1487
|
+
]),
|
|
1488
|
+
...buildLegendNodes("bar3d", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
1489
|
+
id: series.id,
|
|
1490
|
+
label: config.showNumber ? `${series.name} (${series.data.reduce((sum2, datum) => {
|
|
1491
|
+
var _a2;
|
|
1492
|
+
return sum2 + ((_a2 = datum == null ? void 0 : datum.y) != null ? _a2 : 0);
|
|
1493
|
+
}, 0)})` : series.name,
|
|
1494
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
1495
|
+
})))
|
|
1496
|
+
];
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
|
|
1502
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/combo/combo-chart.js
|
|
1503
|
+
var combo_chart_exports = {};
|
|
1504
|
+
__export(combo_chart_exports, {
|
|
1505
|
+
comboChart: () => comboChart
|
|
1506
|
+
});
|
|
1507
|
+
var comboChart;
|
|
1508
|
+
var init_combo_chart = __esm({
|
|
1509
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/combo/combo-chart.js"() {
|
|
1510
|
+
init_axis_builder();
|
|
1511
|
+
init_cartesian_geometry();
|
|
1512
|
+
init_chrome();
|
|
1513
|
+
init_interaction();
|
|
1514
|
+
init_palette();
|
|
1515
|
+
init_value_labels();
|
|
1516
|
+
init_scene();
|
|
1517
|
+
init_band_scale();
|
|
1518
|
+
init_linear_scale();
|
|
1519
|
+
init_math();
|
|
1520
|
+
comboChart = {
|
|
1521
|
+
id: "combo",
|
|
1522
|
+
family: "cartesian",
|
|
1523
|
+
render: ({ config, payload, frame, size }) => {
|
|
1524
|
+
var _a, _b, _c;
|
|
1525
|
+
if (payload.kind !== "cartesian") {
|
|
1526
|
+
return [];
|
|
1527
|
+
}
|
|
1528
|
+
const values = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
1529
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
1530
|
+
var _a2;
|
|
1531
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
1532
|
+
}).map((threshold) => threshold.value);
|
|
1533
|
+
const minValue = (_a = config.yAxis.min) != null ? _a : values.length > 0 ? Math.min(0, ...values, ...thresholdValues) : 0;
|
|
1534
|
+
const maxValue = (_b = config.yAxis.max) != null ? _b : values.length > 0 ? Math.max(0, ...values, ...thresholdValues) : 1;
|
|
1535
|
+
const [domainMin, domainMax] = padExtent(minValue, maxValue, 0.08);
|
|
1536
|
+
const xScale = createBandScale({
|
|
1537
|
+
domain: payload.labels,
|
|
1538
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
1539
|
+
paddingInner: 0.24,
|
|
1540
|
+
paddingOuter: 0.12
|
|
1541
|
+
});
|
|
1542
|
+
const yScale = createLinearScale({
|
|
1543
|
+
domain: [domainMin, domainMax],
|
|
1544
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
1545
|
+
nice: config.yAxis.nice,
|
|
1546
|
+
tickCount: config.yAxis.tickCount
|
|
1547
|
+
});
|
|
1548
|
+
const baseline = yScale.scale(Math.max(0, domainMin));
|
|
1549
|
+
const plotChildren = [
|
|
1550
|
+
rectNode("combo-plot-bg", {
|
|
1551
|
+
x: frame.plot.x,
|
|
1552
|
+
y: frame.plot.y,
|
|
1553
|
+
width: frame.plot.width,
|
|
1554
|
+
height: frame.plot.height,
|
|
1555
|
+
rx: 14,
|
|
1556
|
+
fill: config.theme.plotBackground,
|
|
1557
|
+
stroke: config.theme.plotBorder,
|
|
1558
|
+
"stroke-width": 1
|
|
1559
|
+
}),
|
|
1560
|
+
...buildCartesianAxisNodes({
|
|
1561
|
+
idPrefix: "combo",
|
|
1562
|
+
frame,
|
|
1563
|
+
theme: config.theme,
|
|
1564
|
+
labels: payload.labels,
|
|
1565
|
+
xScale,
|
|
1566
|
+
yScale,
|
|
1567
|
+
xAxis: config.xAxis,
|
|
1568
|
+
yAxis: config.yAxis,
|
|
1569
|
+
grid: config.grid
|
|
1570
|
+
}),
|
|
1571
|
+
...buildThresholdNodes({
|
|
1572
|
+
idPrefix: "combo",
|
|
1573
|
+
thresholds: config.thresholds,
|
|
1574
|
+
frame,
|
|
1575
|
+
theme: config.theme,
|
|
1576
|
+
yScale
|
|
1577
|
+
})
|
|
1578
|
+
];
|
|
1579
|
+
const barSeries = payload.series.filter((series) => series.type === "bar");
|
|
1580
|
+
const groupedGap = 6;
|
|
1581
|
+
payload.labels.forEach((label, groupIndex) => {
|
|
1582
|
+
const band = xScale.get(label);
|
|
1583
|
+
const groupWidth = band.width;
|
|
1584
|
+
const seriesWidth = (groupWidth - groupedGap * Math.max(0, barSeries.length - 1)) / Math.max(1, barSeries.length);
|
|
1585
|
+
barSeries.forEach((series, barIndex) => {
|
|
1586
|
+
var _a2, _b2;
|
|
1587
|
+
const datum = series.data[groupIndex];
|
|
1588
|
+
const color = resolveSeriesColor(config, payload.series.indexOf(series), series.color);
|
|
1589
|
+
const x = band.start + barIndex * (seriesWidth + groupedGap);
|
|
1590
|
+
const rawValue = (_a2 = datum == null ? void 0 : datum.y) != null ? _a2 : 0;
|
|
1591
|
+
const y = yScale.scale(Math.max(rawValue, 0));
|
|
1592
|
+
const height = Math.abs(yScale.scale(rawValue) - baseline);
|
|
1593
|
+
plotChildren.push(rectNode(`combo-bar-${series.id}-${groupIndex}`, {
|
|
1594
|
+
x,
|
|
1595
|
+
y: rawValue >= 0 ? y : baseline,
|
|
1596
|
+
width: seriesWidth,
|
|
1597
|
+
height,
|
|
1598
|
+
rx: 8,
|
|
1599
|
+
fill: color,
|
|
1600
|
+
opacity: 0.84,
|
|
1601
|
+
...createInteractionAttrs({
|
|
1602
|
+
targetId: `combo-bar-${series.id}-${groupIndex}`,
|
|
1603
|
+
chartType: "combo",
|
|
1604
|
+
kind: "datum",
|
|
1605
|
+
label: (_b2 = datum == null ? void 0 : datum.label) != null ? _b2 : label,
|
|
1606
|
+
seriesId: series.id,
|
|
1607
|
+
seriesName: series.name,
|
|
1608
|
+
value: rawValue,
|
|
1609
|
+
color,
|
|
1610
|
+
index: groupIndex
|
|
1611
|
+
})
|
|
1612
|
+
}, interactiveNodeStyle));
|
|
1613
|
+
if (config.showNumber) {
|
|
1614
|
+
plotChildren.push(buildValueLabelNode(`combo-bar-value-${series.id}-${groupIndex}`, config, rawValue, x + seriesWidth / 2, rawValue >= 0 ? y - 10 : baseline + height + 16, {
|
|
1615
|
+
fill: color
|
|
1616
|
+
}));
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
});
|
|
1620
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
1621
|
+
if (series.type === "bar") {
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
1625
|
+
const points = series.data.map((datum, index) => {
|
|
1626
|
+
const band = xScale.at(index);
|
|
1627
|
+
return {
|
|
1628
|
+
x: band.center,
|
|
1629
|
+
y: yScale.scale(datum.y)
|
|
1630
|
+
};
|
|
1631
|
+
});
|
|
1632
|
+
if (series.type === "area") {
|
|
1633
|
+
plotChildren.push(pathNode(`combo-area-fill-${series.id}`, {
|
|
1634
|
+
d: buildAreaPath(points, baseline),
|
|
1635
|
+
fill: color,
|
|
1636
|
+
opacity: 0.16
|
|
1637
|
+
}));
|
|
1638
|
+
}
|
|
1639
|
+
if (series.type === "area" || series.type === "line") {
|
|
1640
|
+
plotChildren.push(pathNode(`combo-line-${series.id}`, {
|
|
1641
|
+
d: buildLinePath(points),
|
|
1642
|
+
fill: "none",
|
|
1643
|
+
stroke: color,
|
|
1644
|
+
"stroke-width": 3,
|
|
1645
|
+
"stroke-linecap": "round",
|
|
1646
|
+
"stroke-linejoin": "round",
|
|
1647
|
+
opacity: 0.97
|
|
1648
|
+
}));
|
|
1649
|
+
}
|
|
1650
|
+
points.forEach((point, index) => {
|
|
1651
|
+
var _a2, _b2, _c2;
|
|
1652
|
+
const radius = series.type === "scatter" ? 5 : payload.labels.length > 18 ? 0 : 4;
|
|
1653
|
+
const datum = series.data[index];
|
|
1654
|
+
plotChildren.push(circleNode(`combo-point-${series.id}-${index}`, {
|
|
1655
|
+
cx: point.x,
|
|
1656
|
+
cy: point.y,
|
|
1657
|
+
r: radius,
|
|
1658
|
+
fill: color,
|
|
1659
|
+
stroke: config.theme.pointStroke,
|
|
1660
|
+
"stroke-width": 2,
|
|
1661
|
+
opacity: 0.96
|
|
1662
|
+
}));
|
|
1663
|
+
plotChildren.push(circleNode(`combo-point-hit-${series.id}-${index}`, {
|
|
1664
|
+
cx: point.x,
|
|
1665
|
+
cy: point.y,
|
|
1666
|
+
r: series.type === "scatter" ? 10 : 11,
|
|
1667
|
+
fill: color,
|
|
1668
|
+
opacity: 1e-3,
|
|
1669
|
+
"pointer-events": "all",
|
|
1670
|
+
...createInteractionAttrs({
|
|
1671
|
+
targetId: `combo-point-${series.id}-${index}`,
|
|
1672
|
+
chartType: "combo",
|
|
1673
|
+
kind: "datum",
|
|
1674
|
+
label: (_c2 = (_b2 = datum == null ? void 0 : datum.label) != null ? _b2 : (_a2 = datum == null ? void 0 : datum.x) == null ? void 0 : _a2.toString()) != null ? _c2 : payload.labels[index],
|
|
1675
|
+
seriesId: series.id,
|
|
1676
|
+
seriesName: series.name,
|
|
1677
|
+
value: datum == null ? void 0 : datum.y,
|
|
1678
|
+
color,
|
|
1679
|
+
index
|
|
1680
|
+
})
|
|
1681
|
+
}, interactiveNodeStyle));
|
|
1682
|
+
if (config.showNumber && datum) {
|
|
1683
|
+
plotChildren.push(buildValueLabelNode(`combo-point-value-${series.id}-${index}`, config, datum.y, point.x, point.y - 12, {
|
|
1684
|
+
fill: color
|
|
1685
|
+
}));
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
});
|
|
1689
|
+
return [
|
|
1690
|
+
rectNode("combo-surface", {
|
|
1691
|
+
x: 0,
|
|
1692
|
+
y: 0,
|
|
1693
|
+
width: size.width,
|
|
1694
|
+
height: size.height,
|
|
1695
|
+
rx: config.layout.cornerRadius,
|
|
1696
|
+
fill: (_c = config.layout.background) != null ? _c : config.theme.surface,
|
|
1697
|
+
stroke: config.theme.border,
|
|
1698
|
+
"stroke-width": 1
|
|
1699
|
+
}),
|
|
1700
|
+
...buildTitleNodes("combo", config, frame, config.theme),
|
|
1701
|
+
groupNode("combo-plot", plotChildren),
|
|
1702
|
+
...buildLegendNodes("combo", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
1703
|
+
id: series.id,
|
|
1704
|
+
label: series.name,
|
|
1705
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
1706
|
+
})))
|
|
1707
|
+
];
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
});
|
|
1712
|
+
|
|
1713
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/sparkline/sparkline-chart.js
|
|
1714
|
+
var sparkline_chart_exports = {};
|
|
1715
|
+
__export(sparkline_chart_exports, {
|
|
1716
|
+
sparklineChart: () => sparklineChart
|
|
1717
|
+
});
|
|
1718
|
+
var sparklineChart;
|
|
1719
|
+
var init_sparkline_chart = __esm({
|
|
1720
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/sparkline/sparkline-chart.js"() {
|
|
1721
|
+
init_cartesian_geometry();
|
|
1722
|
+
init_chrome();
|
|
1723
|
+
init_interaction();
|
|
1724
|
+
init_palette();
|
|
1725
|
+
init_value_labels();
|
|
1726
|
+
init_scene();
|
|
1727
|
+
init_band_scale();
|
|
1728
|
+
init_linear_scale();
|
|
1729
|
+
init_math();
|
|
1730
|
+
sparklineChart = {
|
|
1731
|
+
id: "sparkline",
|
|
1732
|
+
family: "cartesian",
|
|
1733
|
+
render: ({ config, payload, frame, size }) => {
|
|
1734
|
+
var _a, _b, _c, _d;
|
|
1735
|
+
if (payload.kind !== "cartesian") {
|
|
1736
|
+
return [];
|
|
1737
|
+
}
|
|
1738
|
+
const values = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
1739
|
+
const [domainMin, domainMax] = padExtent((_a = config.yAxis.min) != null ? _a : values.length > 0 ? Math.min(...values) : 0, (_b = config.yAxis.max) != null ? _b : values.length > 0 ? Math.max(...values) : 1, 0.1);
|
|
1740
|
+
const xScale = createBandScale({
|
|
1741
|
+
domain: payload.labels,
|
|
1742
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
1743
|
+
paddingInner: 0.52,
|
|
1744
|
+
paddingOuter: 0.1
|
|
1745
|
+
});
|
|
1746
|
+
const yScale = createLinearScale({
|
|
1747
|
+
domain: [domainMin, domainMax],
|
|
1748
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
1749
|
+
nice: false,
|
|
1750
|
+
tickCount: 4
|
|
1751
|
+
});
|
|
1752
|
+
const baseline = yScale.scale(domainMin);
|
|
1753
|
+
const plotChildren = [
|
|
1754
|
+
rectNode("sparkline-plot-bg", {
|
|
1755
|
+
x: frame.plot.x,
|
|
1756
|
+
y: frame.plot.y,
|
|
1757
|
+
width: frame.plot.width,
|
|
1758
|
+
height: frame.plot.height,
|
|
1759
|
+
rx: 14,
|
|
1760
|
+
fill: config.theme.plotBackground,
|
|
1761
|
+
stroke: config.theme.plotBorder,
|
|
1762
|
+
"stroke-width": 1
|
|
1763
|
+
})
|
|
1764
|
+
];
|
|
1765
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
1766
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
1767
|
+
const points = series.data.map((datum, index) => {
|
|
1768
|
+
const band = xScale.at(index);
|
|
1769
|
+
return {
|
|
1770
|
+
x: band.center,
|
|
1771
|
+
y: yScale.scale(datum.y)
|
|
1772
|
+
};
|
|
1773
|
+
});
|
|
1774
|
+
const lastPoint = points[points.length - 1];
|
|
1775
|
+
if (seriesIndex === 0) {
|
|
1776
|
+
plotChildren.push(pathNode(`sparkline-fill-${series.id}`, {
|
|
1777
|
+
d: buildAreaPath(points, baseline),
|
|
1778
|
+
fill: color,
|
|
1779
|
+
opacity: 0.12
|
|
1780
|
+
}));
|
|
1781
|
+
}
|
|
1782
|
+
plotChildren.push(pathNode(`sparkline-line-${series.id}`, {
|
|
1783
|
+
d: buildLinePath(points),
|
|
1784
|
+
fill: "none",
|
|
1785
|
+
stroke: color,
|
|
1786
|
+
"stroke-width": 3,
|
|
1787
|
+
"stroke-linecap": "round",
|
|
1788
|
+
"stroke-linejoin": "round",
|
|
1789
|
+
opacity: 0.96
|
|
1790
|
+
}));
|
|
1791
|
+
points.forEach((point, index) => {
|
|
1792
|
+
var _a2, _b2;
|
|
1793
|
+
const datum = series.data[index];
|
|
1794
|
+
plotChildren.push(circleNode(`sparkline-point-hit-${series.id}-${index}`, {
|
|
1795
|
+
cx: point.x,
|
|
1796
|
+
cy: point.y,
|
|
1797
|
+
r: 9,
|
|
1798
|
+
fill: color,
|
|
1799
|
+
opacity: 1e-3,
|
|
1800
|
+
"pointer-events": "all",
|
|
1801
|
+
...createInteractionAttrs({
|
|
1802
|
+
targetId: index === points.length - 1 ? `sparkline-point-${series.id}` : `sparkline-line-${series.id}`,
|
|
1803
|
+
chartType: "sparkline",
|
|
1804
|
+
kind: "datum",
|
|
1805
|
+
label: (_b2 = (_a2 = datum == null ? void 0 : datum.label) != null ? _a2 : payload.labels[index]) != null ? _b2 : series.name,
|
|
1806
|
+
seriesId: series.id,
|
|
1807
|
+
seriesName: series.name,
|
|
1808
|
+
value: datum == null ? void 0 : datum.y,
|
|
1809
|
+
color,
|
|
1810
|
+
index
|
|
1811
|
+
})
|
|
1812
|
+
}, interactiveNodeStyle));
|
|
1813
|
+
if (config.showNumber && datum) {
|
|
1814
|
+
plotChildren.push(buildValueLabelNode(`sparkline-value-${series.id}-${index}`, config, datum.y, point.x, point.y - 10, {
|
|
1815
|
+
fill: color,
|
|
1816
|
+
fontSize: Math.max(9, config.theme.fontSize - 2)
|
|
1817
|
+
}));
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
if (lastPoint) {
|
|
1821
|
+
plotChildren.push(circleNode(`sparkline-point-${series.id}`, {
|
|
1822
|
+
cx: lastPoint.x,
|
|
1823
|
+
cy: lastPoint.y,
|
|
1824
|
+
r: 4.5,
|
|
1825
|
+
fill: color,
|
|
1826
|
+
stroke: config.theme.pointStroke,
|
|
1827
|
+
"stroke-width": 2
|
|
1828
|
+
}));
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
const primarySeries = payload.series[0];
|
|
1832
|
+
const currentValue = (_c = primarySeries == null ? void 0 : primarySeries.data[primarySeries.data.length - 1]) == null ? void 0 : _c.y;
|
|
1833
|
+
return [
|
|
1834
|
+
rectNode("sparkline-surface", {
|
|
1835
|
+
x: 0,
|
|
1836
|
+
y: 0,
|
|
1837
|
+
width: size.width,
|
|
1838
|
+
height: size.height,
|
|
1839
|
+
rx: config.layout.cornerRadius,
|
|
1840
|
+
fill: (_d = config.layout.background) != null ? _d : config.theme.surface,
|
|
1841
|
+
stroke: config.theme.border,
|
|
1842
|
+
"stroke-width": 1
|
|
1843
|
+
}),
|
|
1844
|
+
...buildTitleNodes("sparkline", config, frame, config.theme),
|
|
1845
|
+
groupNode("sparkline-plot", plotChildren),
|
|
1846
|
+
config.showNumber && typeof currentValue === "number" ? textNode("sparkline-current-value", `${currentValue}`, {
|
|
1847
|
+
x: size.width - 18,
|
|
1848
|
+
y: 24,
|
|
1849
|
+
fill: config.theme.title,
|
|
1850
|
+
"font-family": config.theme.fontFamily,
|
|
1851
|
+
"font-size": config.theme.fontSize + 4,
|
|
1852
|
+
"font-weight": 700,
|
|
1853
|
+
"text-anchor": "end"
|
|
1854
|
+
}) : groupNode("sparkline-current-value-empty"),
|
|
1855
|
+
!config.legend.show && (primarySeries == null ? void 0 : primarySeries.name) ? textNode("sparkline-current-label", primarySeries.name, {
|
|
1856
|
+
x: 18,
|
|
1857
|
+
y: 24,
|
|
1858
|
+
fill: config.theme.mutedText,
|
|
1859
|
+
"font-family": config.theme.fontFamily,
|
|
1860
|
+
"font-size": config.theme.fontSize - 1,
|
|
1861
|
+
"font-weight": 600
|
|
1862
|
+
}) : groupNode("sparkline-current-label-empty"),
|
|
1863
|
+
...buildLegendNodes("sparkline", config, frame, config.theme, payload.series.map((series, index) => {
|
|
1864
|
+
var _a2, _b2;
|
|
1865
|
+
return {
|
|
1866
|
+
id: series.id,
|
|
1867
|
+
label: config.showNumber ? `${series.name} (${(_b2 = (_a2 = series.data[series.data.length - 1]) == null ? void 0 : _a2.y) != null ? _b2 : 0})` : series.name,
|
|
1868
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
1869
|
+
};
|
|
1870
|
+
}))
|
|
1871
|
+
];
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
|
|
1877
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/scatter/scatter-chart.js
|
|
1878
|
+
var scatter_chart_exports = {};
|
|
1879
|
+
__export(scatter_chart_exports, {
|
|
1880
|
+
scatterChart: () => scatterChart
|
|
1881
|
+
});
|
|
1882
|
+
var scatterChart;
|
|
1883
|
+
var init_scatter_chart = __esm({
|
|
1884
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/scatter/scatter-chart.js"() {
|
|
1885
|
+
init_axis_builder();
|
|
1886
|
+
init_chrome();
|
|
1887
|
+
init_interaction();
|
|
1888
|
+
init_palette();
|
|
1889
|
+
init_value_labels();
|
|
1890
|
+
init_scene();
|
|
1891
|
+
init_linear_scale();
|
|
1892
|
+
init_math();
|
|
1893
|
+
scatterChart = {
|
|
1894
|
+
id: "scatter",
|
|
1895
|
+
family: "cartesian",
|
|
1896
|
+
render: ({ config, payload, frame, size }) => {
|
|
1897
|
+
var _a, _b, _c, _d, _e;
|
|
1898
|
+
if (payload.kind !== "cartesian") {
|
|
1899
|
+
return [];
|
|
1900
|
+
}
|
|
1901
|
+
const xValues = payload.series.flatMap((series) => series.data.map((datum, index) => typeof datum.x === "number" ? datum.x : index));
|
|
1902
|
+
const yValues = payload.series.flatMap((series) => series.data.map((datum) => datum.y));
|
|
1903
|
+
const thresholdValues = config.thresholds.filter((threshold) => {
|
|
1904
|
+
var _a2;
|
|
1905
|
+
return ((_a2 = threshold.axis) != null ? _a2 : "y") === "y";
|
|
1906
|
+
}).map((threshold) => threshold.value);
|
|
1907
|
+
const [xMin, xMax] = padExtent((_a = config.xAxis.min) != null ? _a : xValues.length > 0 ? Math.min(...xValues) : 0, (_b = config.xAxis.max) != null ? _b : xValues.length > 0 ? Math.max(...xValues) : 1, 0.08);
|
|
1908
|
+
const [yMin, yMax] = padExtent((_c = config.yAxis.min) != null ? _c : yValues.length > 0 ? Math.min(...yValues, ...thresholdValues) : 0, (_d = config.yAxis.max) != null ? _d : yValues.length > 0 ? Math.max(...yValues, ...thresholdValues) : 1, 0.08);
|
|
1909
|
+
const xScale = createLinearScale({
|
|
1910
|
+
domain: [xMin, xMax],
|
|
1911
|
+
range: [frame.plot.x, frame.plot.x + frame.plot.width],
|
|
1912
|
+
nice: true,
|
|
1913
|
+
tickCount: config.xAxis.tickCount
|
|
1914
|
+
});
|
|
1915
|
+
const yScale = createLinearScale({
|
|
1916
|
+
domain: [yMin, yMax],
|
|
1917
|
+
range: [frame.plot.y + frame.plot.height, frame.plot.y],
|
|
1918
|
+
nice: config.yAxis.nice,
|
|
1919
|
+
tickCount: config.yAxis.tickCount
|
|
1920
|
+
});
|
|
1921
|
+
const dots = [];
|
|
1922
|
+
payload.series.forEach((series, seriesIndex) => {
|
|
1923
|
+
const color = resolveSeriesColor(config, seriesIndex, series.color);
|
|
1924
|
+
series.data.forEach((datum, index) => {
|
|
1925
|
+
const x = xScale.scale(typeof datum.x === "number" ? datum.x : index);
|
|
1926
|
+
const y = yScale.scale(datum.y);
|
|
1927
|
+
dots.push(circleNode(`scatter-point-${series.id}-${index}`, {
|
|
1928
|
+
cx: x,
|
|
1929
|
+
cy: y,
|
|
1930
|
+
r: 5.5,
|
|
1931
|
+
fill: color,
|
|
1932
|
+
stroke: config.theme.pointStroke,
|
|
1933
|
+
"stroke-width": 1.5,
|
|
1934
|
+
opacity: 0.94,
|
|
1935
|
+
...createInteractionAttrs({
|
|
1936
|
+
targetId: `scatter-point-${series.id}-${index}`,
|
|
1937
|
+
chartType: "scatter",
|
|
1938
|
+
kind: "datum",
|
|
1939
|
+
label: datum.label || `Point ${index + 1}`,
|
|
1940
|
+
seriesId: series.id,
|
|
1941
|
+
seriesName: series.name,
|
|
1942
|
+
value: datum.y,
|
|
1943
|
+
secondaryValue: typeof datum.x === "number" ? datum.x : index,
|
|
1944
|
+
detail: `x=${typeof datum.x === "number" ? datum.x : index}`,
|
|
1945
|
+
color,
|
|
1946
|
+
index
|
|
1947
|
+
})
|
|
1948
|
+
}, interactiveNodeStyle));
|
|
1949
|
+
if (config.showNumber) {
|
|
1950
|
+
dots.push(buildValueLabelNode(`scatter-value-${series.id}-${index}`, config, datum.y, x, y - 12, {
|
|
1951
|
+
fill: color
|
|
1952
|
+
}));
|
|
1953
|
+
}
|
|
1954
|
+
});
|
|
1955
|
+
});
|
|
1956
|
+
return [
|
|
1957
|
+
rectNode("scatter-surface", {
|
|
1958
|
+
x: 0,
|
|
1959
|
+
y: 0,
|
|
1960
|
+
width: size.width,
|
|
1961
|
+
height: size.height,
|
|
1962
|
+
rx: config.layout.cornerRadius,
|
|
1963
|
+
fill: (_e = config.layout.background) != null ? _e : config.theme.surface,
|
|
1964
|
+
stroke: config.theme.border,
|
|
1965
|
+
"stroke-width": 1
|
|
1966
|
+
}),
|
|
1967
|
+
...buildTitleNodes("scatter", config, frame, config.theme),
|
|
1968
|
+
groupNode("scatter-plot", [
|
|
1969
|
+
rectNode("scatter-plot-bg", {
|
|
1970
|
+
x: frame.plot.x,
|
|
1971
|
+
y: frame.plot.y,
|
|
1972
|
+
width: frame.plot.width,
|
|
1973
|
+
height: frame.plot.height,
|
|
1974
|
+
rx: 14,
|
|
1975
|
+
fill: config.theme.plotBackground,
|
|
1976
|
+
stroke: config.theme.plotBorder,
|
|
1977
|
+
"stroke-width": 1
|
|
1978
|
+
}),
|
|
1979
|
+
...buildContinuousAxisNodes({
|
|
1980
|
+
idPrefix: "scatter",
|
|
1981
|
+
frame,
|
|
1982
|
+
theme: config.theme,
|
|
1983
|
+
xScale,
|
|
1984
|
+
yScale,
|
|
1985
|
+
xAxis: config.xAxis,
|
|
1986
|
+
yAxis: config.yAxis,
|
|
1987
|
+
grid: config.grid
|
|
1988
|
+
}),
|
|
1989
|
+
...buildThresholdNodes({
|
|
1990
|
+
idPrefix: "scatter",
|
|
1991
|
+
thresholds: config.thresholds,
|
|
1992
|
+
frame,
|
|
1993
|
+
theme: config.theme,
|
|
1994
|
+
yScale
|
|
1995
|
+
}),
|
|
1996
|
+
...dots
|
|
1997
|
+
]),
|
|
1998
|
+
...buildLegendNodes("scatter", config, frame, config.theme, payload.series.map((series, index) => ({
|
|
1999
|
+
id: series.id,
|
|
2000
|
+
label: series.name,
|
|
2001
|
+
color: resolveSeriesColor(config, index, series.color)
|
|
2002
|
+
})))
|
|
2003
|
+
];
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
});
|
|
2008
|
+
|
|
2009
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/radial-path.js
|
|
2010
|
+
var describeArc;
|
|
2011
|
+
var init_radial_path = __esm({
|
|
2012
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/common/radial-path.js"() {
|
|
2013
|
+
init_math();
|
|
2014
|
+
describeArc = (centerX, centerY, innerRadius, outerRadius, startAngle, endAngle) => {
|
|
2015
|
+
const startOuter = polarToCartesian(centerX, centerY, outerRadius, startAngle);
|
|
2016
|
+
const endOuter = polarToCartesian(centerX, centerY, outerRadius, endAngle);
|
|
2017
|
+
const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
|
|
2018
|
+
if (innerRadius <= 0) {
|
|
2019
|
+
return [
|
|
2020
|
+
`M ${centerX} ${centerY}`,
|
|
2021
|
+
`L ${startOuter.x} ${startOuter.y}`,
|
|
2022
|
+
`A ${outerRadius} ${outerRadius} 0 ${largeArc} 1 ${endOuter.x} ${endOuter.y}`,
|
|
2023
|
+
"Z"
|
|
2024
|
+
].join(" ");
|
|
2025
|
+
}
|
|
2026
|
+
const startInner = polarToCartesian(centerX, centerY, innerRadius, endAngle);
|
|
2027
|
+
const endInner = polarToCartesian(centerX, centerY, innerRadius, startAngle);
|
|
2028
|
+
return [
|
|
2029
|
+
`M ${startOuter.x} ${startOuter.y}`,
|
|
2030
|
+
`A ${outerRadius} ${outerRadius} 0 ${largeArc} 1 ${endOuter.x} ${endOuter.y}`,
|
|
2031
|
+
`L ${startInner.x} ${startInner.y}`,
|
|
2032
|
+
`A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${endInner.x} ${endInner.y}`,
|
|
2033
|
+
"Z"
|
|
2034
|
+
].join(" ");
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
|
|
2039
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/gauge/gauge-chart.js
|
|
2040
|
+
var gauge_chart_exports = {};
|
|
2041
|
+
__export(gauge_chart_exports, {
|
|
2042
|
+
batteryChart: () => batteryChart,
|
|
2043
|
+
gaugeChart: () => gaugeChart,
|
|
2044
|
+
radialProgressChart: () => radialProgressChart,
|
|
2045
|
+
semicircleGaugeChart: () => semicircleGaugeChart,
|
|
2046
|
+
thermometerChart: () => thermometerChart,
|
|
2047
|
+
thermometerHorizontalChart: () => thermometerHorizontalChart
|
|
2048
|
+
});
|
|
2049
|
+
var resolveAnchor2, getActiveSegment, getSegmentColorAtValue, createMetricTextNode, renderSurface, renderArcSegments, renderFilledArcSegments, renderGaugeArc, createArcGaugeDefinition, renderThermometer, createThermometerDefinition, createBatteryDefinition, gaugeChart, semicircleGaugeChart, radialProgressChart, thermometerChart, thermometerHorizontalChart, batteryChart;
|
|
2050
|
+
var init_gauge_chart = __esm({
|
|
2051
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/gauge/gauge-chart.js"() {
|
|
2052
|
+
init_chrome();
|
|
2053
|
+
init_interaction();
|
|
2054
|
+
init_radial_path();
|
|
2055
|
+
init_scene();
|
|
2056
|
+
init_math();
|
|
2057
|
+
resolveAnchor2 = (centerX, x) => {
|
|
2058
|
+
if (x < centerX - 8) {
|
|
2059
|
+
return "end";
|
|
2060
|
+
}
|
|
2061
|
+
if (x > centerX + 8) {
|
|
2062
|
+
return "start";
|
|
2063
|
+
}
|
|
2064
|
+
return "middle";
|
|
2065
|
+
};
|
|
2066
|
+
getActiveSegment = (payload) => {
|
|
2067
|
+
var _a;
|
|
2068
|
+
return (_a = payload.segments.find((segment) => payload.value >= segment.from && payload.value <= segment.to)) != null ? _a : payload.segments[payload.segments.length - 1];
|
|
2069
|
+
};
|
|
2070
|
+
getSegmentColorAtValue = (payload, value) => {
|
|
2071
|
+
var _a, _b, _c, _d;
|
|
2072
|
+
return (_d = (_c = (_a = payload.segments.find((segment) => value >= segment.from && value <= segment.to)) == null ? void 0 : _a.color) != null ? _c : (_b = payload.segments[payload.segments.length - 1]) == null ? void 0 : _b.color) != null ? _d : payload.color;
|
|
2073
|
+
};
|
|
2074
|
+
createMetricTextNode = (id, text, config, options) => {
|
|
2075
|
+
var _a, _b;
|
|
2076
|
+
return textNode(id, text, {
|
|
2077
|
+
x: options.x,
|
|
2078
|
+
y: options.y,
|
|
2079
|
+
fill: options.fill,
|
|
2080
|
+
stroke: config.theme.plotBackground,
|
|
2081
|
+
"stroke-width": 6,
|
|
2082
|
+
"paint-order": "stroke",
|
|
2083
|
+
"font-family": config.theme.fontFamily,
|
|
2084
|
+
"font-size": options.fontSize,
|
|
2085
|
+
"font-weight": (_a = options.fontWeight) != null ? _a : 600,
|
|
2086
|
+
"text-anchor": (_b = options.anchor) != null ? _b : "middle",
|
|
2087
|
+
"dominant-baseline": "middle"
|
|
2088
|
+
});
|
|
2089
|
+
};
|
|
2090
|
+
renderSurface = (prefix, config, frame, width, height) => {
|
|
2091
|
+
var _a;
|
|
2092
|
+
return [
|
|
2093
|
+
rectNode(`${prefix}-surface`, {
|
|
2094
|
+
x: 0,
|
|
2095
|
+
y: 0,
|
|
2096
|
+
width,
|
|
2097
|
+
height,
|
|
2098
|
+
rx: config.layout.cornerRadius,
|
|
2099
|
+
fill: (_a = config.layout.background) != null ? _a : config.theme.surface,
|
|
2100
|
+
stroke: config.theme.border,
|
|
2101
|
+
"stroke-width": 1
|
|
2102
|
+
}),
|
|
2103
|
+
...buildTitleNodes(prefix, config, frame, config.theme),
|
|
2104
|
+
rectNode(`${prefix}-plot-bg`, {
|
|
2105
|
+
x: frame.plot.x,
|
|
2106
|
+
y: frame.plot.y,
|
|
2107
|
+
width: frame.plot.width,
|
|
2108
|
+
height: frame.plot.height,
|
|
2109
|
+
rx: 16,
|
|
2110
|
+
fill: config.theme.plotBackground,
|
|
2111
|
+
stroke: config.theme.plotBorder,
|
|
2112
|
+
"stroke-width": 1
|
|
2113
|
+
})
|
|
2114
|
+
];
|
|
2115
|
+
};
|
|
2116
|
+
renderArcSegments = (prefix, payload, centerX, centerY, innerRadius, outerRadius, startAngle, endAngle) => {
|
|
2117
|
+
const sweep = endAngle - startAngle;
|
|
2118
|
+
const span = payload.max - payload.min || 1;
|
|
2119
|
+
return payload.segments.map((segment) => {
|
|
2120
|
+
const segmentStart = startAngle + (segment.from - payload.min) / span * sweep;
|
|
2121
|
+
const segmentEnd = startAngle + (segment.to - payload.min) / span * sweep;
|
|
2122
|
+
return pathNode(`${prefix}-segment-${segment.id}`, {
|
|
2123
|
+
d: describeArc(centerX, centerY, innerRadius, outerRadius, segmentStart, segmentEnd),
|
|
2124
|
+
fill: segment.color,
|
|
2125
|
+
opacity: 0.26
|
|
2126
|
+
});
|
|
2127
|
+
});
|
|
2128
|
+
};
|
|
2129
|
+
renderFilledArcSegments = (prefix, payload, centerX, centerY, innerRadius, outerRadius, startAngle, endAngle, interactionAttrs) => {
|
|
2130
|
+
const sweep = endAngle - startAngle;
|
|
2131
|
+
const span = payload.max - payload.min || 1;
|
|
2132
|
+
return payload.segments.flatMap((segment) => {
|
|
2133
|
+
const filledTo = Math.min(payload.value, segment.to);
|
|
2134
|
+
if (filledTo <= segment.from) {
|
|
2135
|
+
return [];
|
|
2136
|
+
}
|
|
2137
|
+
const segmentStart = startAngle + (segment.from - payload.min) / span * sweep;
|
|
2138
|
+
const segmentEnd = startAngle + (filledTo - payload.min) / span * sweep;
|
|
2139
|
+
return [
|
|
2140
|
+
pathNode(`${prefix}-progress-${segment.id}`, {
|
|
2141
|
+
d: describeArc(centerX, centerY, innerRadius, outerRadius, segmentStart, segmentEnd),
|
|
2142
|
+
fill: segment.color,
|
|
2143
|
+
opacity: 0.98,
|
|
2144
|
+
...interactionAttrs
|
|
2145
|
+
}, interactiveNodeStyle)
|
|
2146
|
+
];
|
|
2147
|
+
});
|
|
2148
|
+
};
|
|
2149
|
+
renderGaugeArc = (prefix, config, payload, frame, width, height, options) => {
|
|
2150
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2151
|
+
const centerX = frame.plot.x + frame.plot.width / 2;
|
|
2152
|
+
const centerY = frame.plot.y + frame.plot.height * options.centerYRatio;
|
|
2153
|
+
const startAngle = (_a = options.startAngle) != null ? _a : payload.startAngle;
|
|
2154
|
+
const endAngle = (_b = options.endAngle) != null ? _b : payload.endAngle;
|
|
2155
|
+
const sweep = endAngle - startAngle;
|
|
2156
|
+
const valueAngle = startAngle + sweep * payload.ratio;
|
|
2157
|
+
const outerRadius = Math.min(frame.plot.width * options.outerRadiusX, frame.plot.height * options.outerRadiusY);
|
|
2158
|
+
const innerRadius = outerRadius * options.innerRatio;
|
|
2159
|
+
const progressInnerRadius = outerRadius * options.progressInnerRatio;
|
|
2160
|
+
const progressOuterRadius = outerRadius * options.progressOuterRatio;
|
|
2161
|
+
const minPoint = polarToCartesian(centerX, centerY, outerRadius + 18, startAngle);
|
|
2162
|
+
const maxPoint = polarToCartesian(centerX, centerY, outerRadius + 18, endAngle);
|
|
2163
|
+
const needleStart = polarToCartesian(centerX, centerY, (_c = options.needleStartRadius) != null ? _c : 12, valueAngle);
|
|
2164
|
+
const needleEnd = polarToCartesian(centerX, centerY, outerRadius + ((_d = options.needleEndOffset) != null ? _d : 4), valueAngle);
|
|
2165
|
+
const activeSegment = getActiveSegment(payload);
|
|
2166
|
+
const labelLift = config.showNumber ? 0 : -16;
|
|
2167
|
+
const valueY = centerY + ((_e = options.valueYOffset) != null ? _e : options.compactLabels ? -14 : -20);
|
|
2168
|
+
const labelY = centerY + ((_f = options.labelYOffset) != null ? _f : options.compactLabels ? 18 : 16) + labelLift;
|
|
2169
|
+
const statusY = centerY + ((_g = options.statusYOffset) != null ? _g : options.compactLabels ? 38 : 34) + labelLift;
|
|
2170
|
+
const gaugeInteraction = createInteractionAttrs({
|
|
2171
|
+
targetId: `${prefix}-value`,
|
|
2172
|
+
chartType: prefix,
|
|
2173
|
+
kind: "gauge",
|
|
2174
|
+
label: payload.label,
|
|
2175
|
+
value: payload.formattedValue,
|
|
2176
|
+
detail: activeSegment == null ? void 0 : activeSegment.label,
|
|
2177
|
+
color: payload.color
|
|
2178
|
+
});
|
|
2179
|
+
return [
|
|
2180
|
+
...renderSurface(prefix, config, frame, width, height),
|
|
2181
|
+
groupNode(`${prefix}-plot`, [
|
|
2182
|
+
pathNode(`${prefix}-track`, {
|
|
2183
|
+
d: describeArc(centerX, centerY, innerRadius, outerRadius, startAngle, endAngle),
|
|
2184
|
+
fill: (_h = payload.trackColor) != null ? _h : config.theme.surfaceAlt,
|
|
2185
|
+
stroke: config.theme.plotBorder,
|
|
2186
|
+
"stroke-width": 1,
|
|
2187
|
+
opacity: 0.9
|
|
2188
|
+
}),
|
|
2189
|
+
...renderArcSegments(prefix, payload, centerX, centerY, innerRadius, outerRadius, startAngle, endAngle),
|
|
2190
|
+
payload.ratio > 0 ? groupNode(`${prefix}-progress`, renderFilledArcSegments(prefix, payload, centerX, centerY, progressInnerRadius, progressOuterRadius, startAngle, endAngle, gaugeInteraction)) : groupNode(`${prefix}-progress-empty`),
|
|
2191
|
+
!config.showNumber || options.showMinMax === false ? groupNode(`${prefix}-minmax-empty`) : groupNode(`${prefix}-minmax`, [
|
|
2192
|
+
createMetricTextNode(`${prefix}-min`, String(payload.min), config, {
|
|
2193
|
+
x: minPoint.x,
|
|
2194
|
+
y: minPoint.y + 4,
|
|
2195
|
+
fill: config.theme.mutedText,
|
|
2196
|
+
fontSize: config.theme.fontSize - 1,
|
|
2197
|
+
fontWeight: 600,
|
|
2198
|
+
anchor: resolveAnchor2(centerX, minPoint.x)
|
|
2199
|
+
}),
|
|
2200
|
+
createMetricTextNode(`${prefix}-max`, String(payload.max), config, {
|
|
2201
|
+
x: maxPoint.x,
|
|
2202
|
+
y: maxPoint.y + 4,
|
|
2203
|
+
fill: config.theme.mutedText,
|
|
2204
|
+
fontSize: config.theme.fontSize - 1,
|
|
2205
|
+
fontWeight: 600,
|
|
2206
|
+
anchor: resolveAnchor2(centerX, maxPoint.x)
|
|
2207
|
+
})
|
|
2208
|
+
]),
|
|
2209
|
+
options.needle !== false ? lineNode(`${prefix}-needle`, {
|
|
2210
|
+
x1: needleStart.x,
|
|
2211
|
+
y1: needleStart.y,
|
|
2212
|
+
x2: needleEnd.x,
|
|
2213
|
+
y2: needleEnd.y,
|
|
2214
|
+
stroke: config.theme.gaugeNeedle,
|
|
2215
|
+
"stroke-width": options.compactLabels ? 4 : 4.5,
|
|
2216
|
+
"stroke-linecap": "round"
|
|
2217
|
+
}) : groupNode(`${prefix}-needle-empty`),
|
|
2218
|
+
options.showHub === false ? groupNode(`${prefix}-hub-empty`) : groupNode(`${prefix}-hub`, [
|
|
2219
|
+
circleNode(`${prefix}-hub-ring`, {
|
|
2220
|
+
cx: centerX,
|
|
2221
|
+
cy: centerY,
|
|
2222
|
+
r: (_i = options.hubOuterRadius) != null ? _i : 8,
|
|
2223
|
+
fill: config.theme.surface,
|
|
2224
|
+
stroke: config.theme.gaugeNeedle,
|
|
2225
|
+
"stroke-width": 3
|
|
2226
|
+
}),
|
|
2227
|
+
circleNode(`${prefix}-hub-core`, {
|
|
2228
|
+
cx: centerX,
|
|
2229
|
+
cy: centerY,
|
|
2230
|
+
r: (_j = options.hubInnerRadius) != null ? _j : 3,
|
|
2231
|
+
fill: payload.color
|
|
2232
|
+
})
|
|
2233
|
+
]),
|
|
2234
|
+
config.showNumber ? createMetricTextNode(`${prefix}-value`, payload.formattedValue, config, {
|
|
2235
|
+
x: centerX,
|
|
2236
|
+
y: valueY,
|
|
2237
|
+
fill: config.theme.title,
|
|
2238
|
+
fontSize: config.theme.fontSize + ((_k = options.valueSizeBoost) != null ? _k : options.compactLabels ? 10 : 16),
|
|
2239
|
+
fontWeight: 700
|
|
2240
|
+
}) : groupNode(`${prefix}-value-empty`),
|
|
2241
|
+
createMetricTextNode(`${prefix}-label`, payload.label, config, {
|
|
2242
|
+
x: centerX,
|
|
2243
|
+
y: labelY,
|
|
2244
|
+
fill: config.theme.text,
|
|
2245
|
+
fontSize: config.theme.fontSize + ((_l = options.labelSizeBoost) != null ? _l : 1),
|
|
2246
|
+
fontWeight: 600
|
|
2247
|
+
}),
|
|
2248
|
+
activeSegment ? createMetricTextNode(`${prefix}-status`, activeSegment.label, config, {
|
|
2249
|
+
x: centerX,
|
|
2250
|
+
y: statusY,
|
|
2251
|
+
fill: activeSegment.color,
|
|
2252
|
+
fontSize: config.theme.fontSize + ((_m = options.statusSizeBoost) != null ? _m : 0),
|
|
2253
|
+
fontWeight: 600
|
|
2254
|
+
}) : groupNode(`${prefix}-status-empty`)
|
|
2255
|
+
]),
|
|
2256
|
+
...buildLegendNodes(prefix, config, frame, config.theme, payload.segments.map((segment) => ({
|
|
2257
|
+
id: segment.id,
|
|
2258
|
+
label: segment.label,
|
|
2259
|
+
color: segment.color
|
|
2260
|
+
})))
|
|
2261
|
+
];
|
|
2262
|
+
};
|
|
2263
|
+
createArcGaugeDefinition = (id, options) => ({
|
|
2264
|
+
id,
|
|
2265
|
+
family: "radial",
|
|
2266
|
+
render: ({ config, payload, frame, size }) => {
|
|
2267
|
+
if (payload.kind !== "gauge") {
|
|
2268
|
+
return [];
|
|
2269
|
+
}
|
|
2270
|
+
return renderGaugeArc(id, config, payload, frame, size.width, size.height, options);
|
|
2271
|
+
}
|
|
2272
|
+
});
|
|
2273
|
+
renderThermometer = (prefix, config, payload, frame, width, height, horizontal) => {
|
|
2274
|
+
var _a, _b, _c;
|
|
2275
|
+
const activeSegment = getActiveSegment(payload);
|
|
2276
|
+
if (horizontal) {
|
|
2277
|
+
const trackWidth = frame.plot.width * 0.74;
|
|
2278
|
+
const trackHeight = Math.min(28, frame.plot.height * 0.18);
|
|
2279
|
+
const trackX = frame.plot.x + frame.plot.width * 0.11;
|
|
2280
|
+
const trackY = frame.plot.y + frame.plot.height * 0.5 - trackHeight / 2;
|
|
2281
|
+
const fillWidth = trackWidth * payload.ratio;
|
|
2282
|
+
const fillEnd = trackX + fillWidth;
|
|
2283
|
+
return [
|
|
2284
|
+
...renderSurface(prefix, config, frame, width, height),
|
|
2285
|
+
groupNode(`${prefix}-plot`, [
|
|
2286
|
+
rectNode(`${prefix}-track`, {
|
|
2287
|
+
x: trackX,
|
|
2288
|
+
y: trackY,
|
|
2289
|
+
width: trackWidth,
|
|
2290
|
+
height: trackHeight,
|
|
2291
|
+
rx: trackHeight / 2,
|
|
2292
|
+
fill: (_a = payload.trackColor) != null ? _a : config.theme.surfaceAlt,
|
|
2293
|
+
stroke: config.theme.plotBorder,
|
|
2294
|
+
"stroke-width": 1
|
|
2295
|
+
}),
|
|
2296
|
+
...payload.segments.map((segment, index) => {
|
|
2297
|
+
const ratioFrom = (segment.from - payload.min) / (payload.max - payload.min || 1);
|
|
2298
|
+
const ratioTo = (segment.to - payload.min) / (payload.max - payload.min || 1);
|
|
2299
|
+
return rectNode(`${prefix}-band-${segment.id}`, {
|
|
2300
|
+
x: trackX + trackWidth * ratioFrom,
|
|
2301
|
+
y: trackY,
|
|
2302
|
+
width: trackWidth * Math.max(0, ratioTo - ratioFrom),
|
|
2303
|
+
height: trackHeight,
|
|
2304
|
+
rx: index === 0 || index === payload.segments.length - 1 ? trackHeight / 2 : 0,
|
|
2305
|
+
fill: segment.color,
|
|
2306
|
+
opacity: 0.2
|
|
2307
|
+
});
|
|
2308
|
+
}),
|
|
2309
|
+
...payload.segments.flatMap((segment) => {
|
|
2310
|
+
const ratioFrom = (segment.from - payload.min) / (payload.max - payload.min || 1);
|
|
2311
|
+
const ratioTo = (segment.to - payload.min) / (payload.max - payload.min || 1);
|
|
2312
|
+
const segmentStart = trackX + trackWidth * ratioFrom;
|
|
2313
|
+
const segmentEnd = trackX + trackWidth * ratioTo;
|
|
2314
|
+
const visibleWidth = Math.max(0, Math.min(fillEnd, segmentEnd) - segmentStart);
|
|
2315
|
+
if (visibleWidth <= 0) {
|
|
2316
|
+
return [];
|
|
2317
|
+
}
|
|
2318
|
+
const rounded = segmentStart <= trackX + 0.5 || Math.abs(segmentStart + visibleWidth - fillEnd) < 0.5;
|
|
2319
|
+
return [
|
|
2320
|
+
rectNode(`${prefix}-fill-${segment.id}`, {
|
|
2321
|
+
x: segmentStart,
|
|
2322
|
+
y: trackY,
|
|
2323
|
+
width: visibleWidth,
|
|
2324
|
+
height: trackHeight,
|
|
2325
|
+
rx: rounded ? trackHeight / 2 : 0,
|
|
2326
|
+
fill: segment.color,
|
|
2327
|
+
opacity: 0.96
|
|
2328
|
+
})
|
|
2329
|
+
];
|
|
2330
|
+
}),
|
|
2331
|
+
rectNode(`${prefix}-fill-hitbox`, {
|
|
2332
|
+
x: trackX,
|
|
2333
|
+
y: trackY,
|
|
2334
|
+
width: Math.max(fillWidth, 12),
|
|
2335
|
+
height: trackHeight,
|
|
2336
|
+
rx: trackHeight / 2,
|
|
2337
|
+
fill: "#ffffff",
|
|
2338
|
+
opacity: 1e-3,
|
|
2339
|
+
...createInteractionAttrs({
|
|
2340
|
+
targetId: `${prefix}-fill-hitbox`,
|
|
2341
|
+
chartType: prefix,
|
|
2342
|
+
kind: "gauge",
|
|
2343
|
+
label: payload.label,
|
|
2344
|
+
value: payload.formattedValue,
|
|
2345
|
+
detail: activeSegment == null ? void 0 : activeSegment.label,
|
|
2346
|
+
color: payload.color
|
|
2347
|
+
})
|
|
2348
|
+
}, interactiveNodeStyle),
|
|
2349
|
+
config.showNumber ? textNode(`${prefix}-value`, payload.formattedValue, {
|
|
2350
|
+
x: frame.plot.x + frame.plot.width / 2,
|
|
2351
|
+
y: trackY - 18,
|
|
2352
|
+
fill: config.theme.title,
|
|
2353
|
+
"font-family": config.theme.fontFamily,
|
|
2354
|
+
"font-size": config.theme.fontSize + 14,
|
|
2355
|
+
"font-weight": 700,
|
|
2356
|
+
"text-anchor": "middle"
|
|
2357
|
+
}) : groupNode(`${prefix}-value-empty`),
|
|
2358
|
+
textNode(`${prefix}-label`, payload.label, {
|
|
2359
|
+
x: frame.plot.x + frame.plot.width / 2,
|
|
2360
|
+
y: trackY + trackHeight + 24,
|
|
2361
|
+
fill: config.theme.text,
|
|
2362
|
+
"font-family": config.theme.fontFamily,
|
|
2363
|
+
"font-size": config.theme.fontSize + 1,
|
|
2364
|
+
"text-anchor": "middle"
|
|
2365
|
+
}),
|
|
2366
|
+
activeSegment ? textNode(`${prefix}-status`, activeSegment.label, {
|
|
2367
|
+
x: frame.plot.x + frame.plot.width / 2,
|
|
2368
|
+
y: trackY + trackHeight + 44,
|
|
2369
|
+
fill: activeSegment.color,
|
|
2370
|
+
"font-family": config.theme.fontFamily,
|
|
2371
|
+
"font-size": config.theme.fontSize,
|
|
2372
|
+
"text-anchor": "middle"
|
|
2373
|
+
}) : groupNode(`${prefix}-status-empty`),
|
|
2374
|
+
config.showNumber ? groupNode(`${prefix}-minmax`, [
|
|
2375
|
+
textNode(`${prefix}-min`, String(payload.min), {
|
|
2376
|
+
x: trackX,
|
|
2377
|
+
y: trackY + trackHeight + 24,
|
|
2378
|
+
fill: config.theme.mutedText,
|
|
2379
|
+
"font-family": config.theme.fontFamily,
|
|
2380
|
+
"font-size": config.theme.fontSize - 1
|
|
2381
|
+
}),
|
|
2382
|
+
textNode(`${prefix}-max`, String(payload.max), {
|
|
2383
|
+
x: trackX + trackWidth,
|
|
2384
|
+
y: trackY + trackHeight + 24,
|
|
2385
|
+
fill: config.theme.mutedText,
|
|
2386
|
+
"font-family": config.theme.fontFamily,
|
|
2387
|
+
"font-size": config.theme.fontSize - 1,
|
|
2388
|
+
"text-anchor": "end"
|
|
2389
|
+
})
|
|
2390
|
+
]) : groupNode(`${prefix}-minmax-empty`)
|
|
2391
|
+
]),
|
|
2392
|
+
...buildLegendNodes(prefix, config, frame, config.theme, payload.segments.map((segment) => ({
|
|
2393
|
+
id: segment.id,
|
|
2394
|
+
label: segment.label,
|
|
2395
|
+
color: segment.color
|
|
2396
|
+
})))
|
|
2397
|
+
];
|
|
2398
|
+
}
|
|
2399
|
+
const tubeWidth = Math.min(34, frame.plot.width * 0.12);
|
|
2400
|
+
const tubeHeight = frame.plot.height * 0.72;
|
|
2401
|
+
const tubeX = frame.plot.x + frame.plot.width * 0.22;
|
|
2402
|
+
const tubeY = frame.plot.y + frame.plot.height * 0.08;
|
|
2403
|
+
const bulbRadius = tubeWidth * 0.82;
|
|
2404
|
+
const bulbCx = tubeX + tubeWidth / 2;
|
|
2405
|
+
const bulbCy = tubeY + tubeHeight + bulbRadius * 0.72;
|
|
2406
|
+
const innerTubeX = tubeX + 4;
|
|
2407
|
+
const innerTubeY = tubeY + 4;
|
|
2408
|
+
const innerTubeWidth = tubeWidth - 8;
|
|
2409
|
+
const innerTubeHeight = tubeHeight - 8;
|
|
2410
|
+
const fillHeight = innerTubeHeight * payload.ratio;
|
|
2411
|
+
const fillY = innerTubeY + innerTubeHeight - fillHeight;
|
|
2412
|
+
const fillBottom = innerTubeY + innerTubeHeight;
|
|
2413
|
+
return [
|
|
2414
|
+
...renderSurface(prefix, config, frame, width, height),
|
|
2415
|
+
groupNode(`${prefix}-plot`, [
|
|
2416
|
+
rectNode(`${prefix}-track`, {
|
|
2417
|
+
x: tubeX,
|
|
2418
|
+
y: tubeY,
|
|
2419
|
+
width: tubeWidth,
|
|
2420
|
+
height: tubeHeight,
|
|
2421
|
+
rx: tubeWidth / 2,
|
|
2422
|
+
fill: (_b = payload.trackColor) != null ? _b : config.theme.surfaceAlt,
|
|
2423
|
+
stroke: config.theme.plotBorder,
|
|
2424
|
+
"stroke-width": 1
|
|
2425
|
+
}),
|
|
2426
|
+
...payload.segments.map((segment, index) => {
|
|
2427
|
+
const ratioFrom = (segment.from - payload.min) / (payload.max - payload.min || 1);
|
|
2428
|
+
const ratioTo = (segment.to - payload.min) / (payload.max - payload.min || 1);
|
|
2429
|
+
return rectNode(`${prefix}-band-${segment.id}`, {
|
|
2430
|
+
x: tubeX,
|
|
2431
|
+
y: tubeY + tubeHeight - tubeHeight * ratioTo,
|
|
2432
|
+
width: tubeWidth,
|
|
2433
|
+
height: tubeHeight * Math.max(0, ratioTo - ratioFrom),
|
|
2434
|
+
rx: index === 0 || index === payload.segments.length - 1 ? tubeWidth / 2 : 0,
|
|
2435
|
+
fill: segment.color,
|
|
2436
|
+
opacity: 0.2
|
|
2437
|
+
});
|
|
2438
|
+
}),
|
|
2439
|
+
...payload.segments.flatMap((segment) => {
|
|
2440
|
+
const ratioFrom = (segment.from - payload.min) / (payload.max - payload.min || 1);
|
|
2441
|
+
const ratioTo = (segment.to - payload.min) / (payload.max - payload.min || 1);
|
|
2442
|
+
const segmentTop = innerTubeY + innerTubeHeight - innerTubeHeight * ratioTo;
|
|
2443
|
+
const segmentBottom = innerTubeY + innerTubeHeight - innerTubeHeight * ratioFrom;
|
|
2444
|
+
const visibleTop = Math.max(fillY, segmentTop);
|
|
2445
|
+
const visibleBottom = Math.min(fillBottom, segmentBottom);
|
|
2446
|
+
const visibleHeight = Math.max(0, visibleBottom - visibleTop);
|
|
2447
|
+
if (visibleHeight <= 0) {
|
|
2448
|
+
return [];
|
|
2449
|
+
}
|
|
2450
|
+
const rounded = visibleTop <= fillY + 0.5 || Math.abs(visibleBottom - fillBottom) < 0.5;
|
|
2451
|
+
return [
|
|
2452
|
+
rectNode(`${prefix}-fill-${segment.id}`, {
|
|
2453
|
+
x: innerTubeX,
|
|
2454
|
+
y: visibleTop,
|
|
2455
|
+
width: innerTubeWidth,
|
|
2456
|
+
height: visibleHeight,
|
|
2457
|
+
rx: rounded ? innerTubeWidth / 2 : 0,
|
|
2458
|
+
fill: segment.color,
|
|
2459
|
+
opacity: 0.96
|
|
2460
|
+
})
|
|
2461
|
+
];
|
|
2462
|
+
}),
|
|
2463
|
+
rectNode(`${prefix}-fill-hitbox`, {
|
|
2464
|
+
x: innerTubeX,
|
|
2465
|
+
y: fillY,
|
|
2466
|
+
width: innerTubeWidth,
|
|
2467
|
+
height: Math.max(fillHeight, 12),
|
|
2468
|
+
rx: innerTubeWidth / 2,
|
|
2469
|
+
fill: "#ffffff",
|
|
2470
|
+
opacity: 1e-3,
|
|
2471
|
+
...createInteractionAttrs({
|
|
2472
|
+
targetId: `${prefix}-fill-hitbox`,
|
|
2473
|
+
chartType: prefix,
|
|
2474
|
+
kind: "gauge",
|
|
2475
|
+
label: payload.label,
|
|
2476
|
+
value: payload.formattedValue,
|
|
2477
|
+
detail: activeSegment == null ? void 0 : activeSegment.label,
|
|
2478
|
+
color: payload.color
|
|
2479
|
+
})
|
|
2480
|
+
}, interactiveNodeStyle),
|
|
2481
|
+
circleNode(`${prefix}-bulb-track`, {
|
|
2482
|
+
cx: bulbCx,
|
|
2483
|
+
cy: bulbCy,
|
|
2484
|
+
r: bulbRadius,
|
|
2485
|
+
fill: (_c = payload.trackColor) != null ? _c : config.theme.surfaceAlt,
|
|
2486
|
+
stroke: config.theme.plotBorder,
|
|
2487
|
+
"stroke-width": 1
|
|
2488
|
+
}),
|
|
2489
|
+
circleNode(`${prefix}-bulb-fill`, {
|
|
2490
|
+
cx: bulbCx,
|
|
2491
|
+
cy: bulbCy,
|
|
2492
|
+
r: bulbRadius - 5,
|
|
2493
|
+
fill: payload.color
|
|
2494
|
+
}),
|
|
2495
|
+
config.showNumber ? textNode(`${prefix}-value`, payload.formattedValue, {
|
|
2496
|
+
x: frame.plot.x + frame.plot.width * 0.68,
|
|
2497
|
+
y: frame.plot.y + frame.plot.height * 0.42,
|
|
2498
|
+
fill: config.theme.title,
|
|
2499
|
+
"font-family": config.theme.fontFamily,
|
|
2500
|
+
"font-size": config.theme.fontSize + 18,
|
|
2501
|
+
"font-weight": 700,
|
|
2502
|
+
"text-anchor": "middle"
|
|
2503
|
+
}) : groupNode(`${prefix}-value-empty`),
|
|
2504
|
+
textNode(`${prefix}-label`, payload.label, {
|
|
2505
|
+
x: frame.plot.x + frame.plot.width * 0.68,
|
|
2506
|
+
y: frame.plot.y + frame.plot.height * 0.42 + 28,
|
|
2507
|
+
fill: config.theme.text,
|
|
2508
|
+
"font-family": config.theme.fontFamily,
|
|
2509
|
+
"font-size": config.theme.fontSize + 1,
|
|
2510
|
+
"text-anchor": "middle"
|
|
2511
|
+
}),
|
|
2512
|
+
activeSegment ? textNode(`${prefix}-status`, activeSegment.label, {
|
|
2513
|
+
x: frame.plot.x + frame.plot.width * 0.68,
|
|
2514
|
+
y: frame.plot.y + frame.plot.height * 0.42 + 52,
|
|
2515
|
+
fill: activeSegment.color,
|
|
2516
|
+
"font-family": config.theme.fontFamily,
|
|
2517
|
+
"font-size": config.theme.fontSize,
|
|
2518
|
+
"text-anchor": "middle"
|
|
2519
|
+
}) : groupNode(`${prefix}-status-empty`),
|
|
2520
|
+
config.showNumber ? groupNode(`${prefix}-minmax`, [
|
|
2521
|
+
textNode(`${prefix}-min`, String(payload.min), {
|
|
2522
|
+
x: tubeX + tubeWidth + 12,
|
|
2523
|
+
y: tubeY + tubeHeight + 2,
|
|
2524
|
+
fill: config.theme.mutedText,
|
|
2525
|
+
"font-family": config.theme.fontFamily,
|
|
2526
|
+
"font-size": config.theme.fontSize - 1
|
|
2527
|
+
}),
|
|
2528
|
+
textNode(`${prefix}-max`, String(payload.max), {
|
|
2529
|
+
x: tubeX + tubeWidth + 12,
|
|
2530
|
+
y: tubeY + 10,
|
|
2531
|
+
fill: config.theme.mutedText,
|
|
2532
|
+
"font-family": config.theme.fontFamily,
|
|
2533
|
+
"font-size": config.theme.fontSize - 1
|
|
2534
|
+
})
|
|
2535
|
+
]) : groupNode(`${prefix}-minmax-empty`)
|
|
2536
|
+
]),
|
|
2537
|
+
...buildLegendNodes(prefix, config, frame, config.theme, payload.segments.map((segment) => ({
|
|
2538
|
+
id: segment.id,
|
|
2539
|
+
label: segment.label,
|
|
2540
|
+
color: segment.color
|
|
2541
|
+
})))
|
|
2542
|
+
];
|
|
2543
|
+
};
|
|
2544
|
+
createThermometerDefinition = (id, horizontal) => ({
|
|
2545
|
+
id,
|
|
2546
|
+
family: "widget",
|
|
2547
|
+
render: ({ config, payload, frame, size }) => {
|
|
2548
|
+
if (payload.kind !== "gauge") {
|
|
2549
|
+
return [];
|
|
2550
|
+
}
|
|
2551
|
+
return renderThermometer(id, config, payload, frame, size.width, size.height, horizontal);
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
createBatteryDefinition = () => ({
|
|
2555
|
+
id: "battery",
|
|
2556
|
+
family: "widget",
|
|
2557
|
+
render: ({ config, payload, frame, size }) => {
|
|
2558
|
+
if (payload.kind !== "gauge") {
|
|
2559
|
+
return [];
|
|
2560
|
+
}
|
|
2561
|
+
const activeSegment = getActiveSegment(payload);
|
|
2562
|
+
const bodyWidth = frame.plot.width * 0.58;
|
|
2563
|
+
const bodyHeight = Math.min(92, frame.plot.height * 0.34);
|
|
2564
|
+
const bodyX = frame.plot.x + frame.plot.width * 0.12;
|
|
2565
|
+
const bodyY = frame.plot.y + frame.plot.height * 0.36;
|
|
2566
|
+
const terminalWidth = 16;
|
|
2567
|
+
const terminalHeight = bodyHeight * 0.36;
|
|
2568
|
+
const fillInset = 10;
|
|
2569
|
+
const fillWidth = (bodyWidth - fillInset * 2) * payload.ratio;
|
|
2570
|
+
const segmentGap = 6;
|
|
2571
|
+
const segmentCount = 4;
|
|
2572
|
+
const segmentWidth = (bodyWidth - fillInset * 2 - segmentGap * (segmentCount - 1)) / segmentCount;
|
|
2573
|
+
return [
|
|
2574
|
+
...renderSurface("battery", config, frame, size.width, size.height),
|
|
2575
|
+
groupNode("battery-plot", [
|
|
2576
|
+
rectNode("battery-body", {
|
|
2577
|
+
x: bodyX,
|
|
2578
|
+
y: bodyY,
|
|
2579
|
+
width: bodyWidth,
|
|
2580
|
+
height: bodyHeight,
|
|
2581
|
+
rx: 18,
|
|
2582
|
+
fill: config.theme.surface,
|
|
2583
|
+
stroke: config.theme.border,
|
|
2584
|
+
"stroke-width": 2
|
|
2585
|
+
}),
|
|
2586
|
+
rectNode("battery-terminal", {
|
|
2587
|
+
x: bodyX + bodyWidth + 6,
|
|
2588
|
+
y: bodyY + (bodyHeight - terminalHeight) / 2,
|
|
2589
|
+
width: terminalWidth,
|
|
2590
|
+
height: terminalHeight,
|
|
2591
|
+
rx: 6,
|
|
2592
|
+
fill: config.theme.surfaceAlt,
|
|
2593
|
+
stroke: config.theme.border,
|
|
2594
|
+
"stroke-width": 1
|
|
2595
|
+
}),
|
|
2596
|
+
...Array.from({ length: segmentCount }, (_, index) => {
|
|
2597
|
+
const x = bodyX + fillInset + index * (segmentWidth + segmentGap);
|
|
2598
|
+
const segmentRatioStart = index / segmentCount;
|
|
2599
|
+
const segmentRatioEnd = (index + 1) / segmentCount;
|
|
2600
|
+
const fillRatioWithinSegment = Math.max(0, Math.min(payload.ratio, segmentRatioEnd) - segmentRatioStart) / (segmentRatioEnd - segmentRatioStart);
|
|
2601
|
+
const filled = fillRatioWithinSegment > 0;
|
|
2602
|
+
const segmentMidValue = payload.min + (segmentRatioStart + (segmentRatioEnd - segmentRatioStart) / 2) * (payload.max - payload.min);
|
|
2603
|
+
const fillColor = getSegmentColorAtValue(payload, segmentMidValue);
|
|
2604
|
+
return rectNode(`battery-segment-${index}`, {
|
|
2605
|
+
x,
|
|
2606
|
+
y: bodyY + fillInset,
|
|
2607
|
+
width: segmentWidth,
|
|
2608
|
+
height: bodyHeight - fillInset * 2,
|
|
2609
|
+
rx: 8,
|
|
2610
|
+
fill: filled ? fillColor : config.theme.surfaceAlt,
|
|
2611
|
+
opacity: filled ? 0.3 + fillRatioWithinSegment * 0.7 : 0.72
|
|
2612
|
+
});
|
|
2613
|
+
}),
|
|
2614
|
+
rectNode("battery-fill-overlay", {
|
|
2615
|
+
x: bodyX + fillInset,
|
|
2616
|
+
y: bodyY + fillInset,
|
|
2617
|
+
width: fillWidth,
|
|
2618
|
+
height: bodyHeight - fillInset * 2,
|
|
2619
|
+
rx: 10,
|
|
2620
|
+
fill: payload.color,
|
|
2621
|
+
opacity: 0.18,
|
|
2622
|
+
...createInteractionAttrs({
|
|
2623
|
+
targetId: "battery-fill-overlay",
|
|
2624
|
+
chartType: "battery",
|
|
2625
|
+
kind: "gauge",
|
|
2626
|
+
label: payload.label,
|
|
2627
|
+
value: payload.formattedValue,
|
|
2628
|
+
detail: activeSegment == null ? void 0 : activeSegment.label,
|
|
2629
|
+
color: payload.color
|
|
2630
|
+
})
|
|
2631
|
+
}, interactiveNodeStyle),
|
|
2632
|
+
config.showNumber ? textNode("battery-value", payload.formattedValue, {
|
|
2633
|
+
x: frame.plot.x + frame.plot.width * 0.76,
|
|
2634
|
+
y: bodyY + 26,
|
|
2635
|
+
fill: config.theme.title,
|
|
2636
|
+
"font-family": config.theme.fontFamily,
|
|
2637
|
+
"font-size": config.theme.fontSize + 16,
|
|
2638
|
+
"font-weight": 700,
|
|
2639
|
+
"text-anchor": "middle"
|
|
2640
|
+
}) : groupNode("battery-value-empty"),
|
|
2641
|
+
textNode("battery-label", payload.label, {
|
|
2642
|
+
x: frame.plot.x + frame.plot.width * 0.76,
|
|
2643
|
+
y: bodyY + 54,
|
|
2644
|
+
fill: config.theme.text,
|
|
2645
|
+
"font-family": config.theme.fontFamily,
|
|
2646
|
+
"font-size": config.theme.fontSize + 1,
|
|
2647
|
+
"text-anchor": "middle"
|
|
2648
|
+
}),
|
|
2649
|
+
activeSegment ? textNode("battery-status", activeSegment.label, {
|
|
2650
|
+
x: frame.plot.x + frame.plot.width * 0.76,
|
|
2651
|
+
y: bodyY + 78,
|
|
2652
|
+
fill: activeSegment.color,
|
|
2653
|
+
"font-family": config.theme.fontFamily,
|
|
2654
|
+
"font-size": config.theme.fontSize,
|
|
2655
|
+
"text-anchor": "middle"
|
|
2656
|
+
}) : groupNode("battery-status-empty")
|
|
2657
|
+
]),
|
|
2658
|
+
...buildLegendNodes("battery", config, frame, config.theme, payload.segments.map((segment) => ({
|
|
2659
|
+
id: segment.id,
|
|
2660
|
+
label: segment.label,
|
|
2661
|
+
color: segment.color
|
|
2662
|
+
})))
|
|
2663
|
+
];
|
|
2664
|
+
}
|
|
2665
|
+
});
|
|
2666
|
+
gaugeChart = createArcGaugeDefinition("gauge", {
|
|
2667
|
+
centerYRatio: 0.74,
|
|
2668
|
+
outerRadiusX: 0.34,
|
|
2669
|
+
outerRadiusY: 0.62,
|
|
2670
|
+
innerRatio: 0.72,
|
|
2671
|
+
progressInnerRatio: 0.8,
|
|
2672
|
+
progressOuterRatio: 0.95,
|
|
2673
|
+
needle: true,
|
|
2674
|
+
showMinMax: true,
|
|
2675
|
+
showHub: true,
|
|
2676
|
+
valueYOffset: -20,
|
|
2677
|
+
labelYOffset: 18,
|
|
2678
|
+
statusYOffset: 34,
|
|
2679
|
+
needleStartRadius: 10,
|
|
2680
|
+
needleEndOffset: 4,
|
|
2681
|
+
hubOuterRadius: 7,
|
|
2682
|
+
hubInnerRadius: 3
|
|
2683
|
+
});
|
|
2684
|
+
semicircleGaugeChart = createArcGaugeDefinition("gauge-semicircle", {
|
|
2685
|
+
centerYRatio: 0.78,
|
|
2686
|
+
outerRadiusX: 0.46,
|
|
2687
|
+
outerRadiusY: 0.72,
|
|
2688
|
+
innerRatio: 0.74,
|
|
2689
|
+
progressInnerRatio: 0.82,
|
|
2690
|
+
progressOuterRatio: 0.96,
|
|
2691
|
+
needle: true,
|
|
2692
|
+
showMinMax: true,
|
|
2693
|
+
showHub: true,
|
|
2694
|
+
startAngle: Math.PI * 3 / 2,
|
|
2695
|
+
endAngle: Math.PI * 5 / 2,
|
|
2696
|
+
compactLabels: true,
|
|
2697
|
+
valueYOffset: -8,
|
|
2698
|
+
labelYOffset: 20,
|
|
2699
|
+
statusYOffset: 36,
|
|
2700
|
+
valueSizeBoost: 10,
|
|
2701
|
+
needleStartRadius: 8,
|
|
2702
|
+
needleEndOffset: 3,
|
|
2703
|
+
hubOuterRadius: 6,
|
|
2704
|
+
hubInnerRadius: 2.5
|
|
2705
|
+
});
|
|
2706
|
+
radialProgressChart = createArcGaugeDefinition("radial-progress", {
|
|
2707
|
+
centerYRatio: 0.5,
|
|
2708
|
+
outerRadiusX: 0.3,
|
|
2709
|
+
outerRadiusY: 0.33,
|
|
2710
|
+
innerRatio: 0.7,
|
|
2711
|
+
progressInnerRatio: 0.72,
|
|
2712
|
+
progressOuterRatio: 0.98,
|
|
2713
|
+
needle: false,
|
|
2714
|
+
showMinMax: false,
|
|
2715
|
+
showHub: false,
|
|
2716
|
+
startAngle: 1e-3,
|
|
2717
|
+
endAngle: Math.PI * 2 - 1e-3,
|
|
2718
|
+
valueYOffset: -2,
|
|
2719
|
+
labelYOffset: 18,
|
|
2720
|
+
statusYOffset: 36,
|
|
2721
|
+
valueSizeBoost: 10,
|
|
2722
|
+
labelSizeBoost: 0,
|
|
2723
|
+
statusSizeBoost: 0
|
|
2724
|
+
});
|
|
2725
|
+
thermometerChart = createThermometerDefinition("thermometer", false);
|
|
2726
|
+
thermometerHorizontalChart = createThermometerDefinition("thermometer-horizontal", true);
|
|
2727
|
+
batteryChart = createBatteryDefinition();
|
|
2728
|
+
}
|
|
2729
|
+
});
|
|
2730
|
+
|
|
2731
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/donut/donut-chart.js
|
|
2732
|
+
var donut_chart_exports = {};
|
|
2733
|
+
__export(donut_chart_exports, {
|
|
2734
|
+
donutChart: () => donutChart,
|
|
2735
|
+
pieChart: () => pieChart
|
|
2736
|
+
});
|
|
2737
|
+
var createRadialDefinition, donutChart, pieChart;
|
|
2738
|
+
var init_donut_chart = __esm({
|
|
2739
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/donut/donut-chart.js"() {
|
|
2740
|
+
init_chrome();
|
|
2741
|
+
init_interaction();
|
|
2742
|
+
init_palette();
|
|
2743
|
+
init_radial_path();
|
|
2744
|
+
init_value_labels();
|
|
2745
|
+
init_scene();
|
|
2746
|
+
init_math();
|
|
2747
|
+
createRadialDefinition = (mode) => ({
|
|
2748
|
+
id: mode,
|
|
2749
|
+
family: "radial",
|
|
2750
|
+
render: ({ config, payload, frame, size }) => {
|
|
2751
|
+
var _a;
|
|
2752
|
+
if (payload.kind !== "radial") {
|
|
2753
|
+
return [];
|
|
2754
|
+
}
|
|
2755
|
+
const centerX = frame.plot.x + frame.plot.width / 2;
|
|
2756
|
+
const centerY = frame.plot.y + frame.plot.height / 2 - (config.legend.show ? 4 : 0);
|
|
2757
|
+
const outerRadius = Math.max(44, Math.min(frame.plot.width / 2 - 28, frame.plot.height / 2 - 10));
|
|
2758
|
+
const innerRadius = mode === "pie" ? 0 : outerRadius * 0.58;
|
|
2759
|
+
const total = payload.total || 1;
|
|
2760
|
+
const gap = 0.012;
|
|
2761
|
+
let currentAngle = 0;
|
|
2762
|
+
const slices = payload.slices.flatMap((slice, index) => {
|
|
2763
|
+
const rawSweep = slice.value / total * Math.PI * 2;
|
|
2764
|
+
const startAngle = currentAngle + gap;
|
|
2765
|
+
const endAngle = currentAngle + rawSweep - gap;
|
|
2766
|
+
currentAngle += rawSweep;
|
|
2767
|
+
const fill = resolveSeriesColor(config, index, slice.color);
|
|
2768
|
+
const share = total > 0 ? (slice.value / total * 100).toFixed(1) : "0.0";
|
|
2769
|
+
const midAngle = startAngle + (endAngle - startAngle) / 2;
|
|
2770
|
+
const insideRadius = mode === "pie" ? outerRadius * 0.58 : innerRadius + (outerRadius - innerRadius) * 0.72;
|
|
2771
|
+
const insidePoint = polarToCartesian(centerX, centerY, insideRadius, midAngle);
|
|
2772
|
+
const edgePoint = polarToCartesian(centerX, centerY, outerRadius + 2, midAngle);
|
|
2773
|
+
const elbowPoint = polarToCartesian(centerX, centerY, outerRadius + 18, midAngle);
|
|
2774
|
+
const useOutsideLabel = config.showNumber;
|
|
2775
|
+
const anchor = elbowPoint.x >= centerX ? "start" : "end";
|
|
2776
|
+
const labelX = elbowPoint.x + (anchor === "start" ? 10 : -10);
|
|
2777
|
+
const labelY = elbowPoint.y + 4;
|
|
2778
|
+
return [
|
|
2779
|
+
pathNode(`${mode}-slice-${slice.id}`, {
|
|
2780
|
+
d: describeArc(centerX, centerY, innerRadius, outerRadius, startAngle, endAngle),
|
|
2781
|
+
fill,
|
|
2782
|
+
stroke: config.theme.pointStroke,
|
|
2783
|
+
"stroke-width": mode === "pie" ? 2 : 3,
|
|
2784
|
+
opacity: 0.96,
|
|
2785
|
+
...createInteractionAttrs({
|
|
2786
|
+
targetId: `${mode}-slice-${slice.id}`,
|
|
2787
|
+
chartType: mode,
|
|
2788
|
+
kind: "slice",
|
|
2789
|
+
label: slice.label,
|
|
2790
|
+
value: slice.value,
|
|
2791
|
+
detail: `${share}% of total`,
|
|
2792
|
+
color: fill,
|
|
2793
|
+
index
|
|
2794
|
+
})
|
|
2795
|
+
}, interactiveNodeStyle),
|
|
2796
|
+
config.showNumber && useOutsideLabel ? lineNode(`${mode}-slice-guide-${slice.id}`, {
|
|
2797
|
+
x1: edgePoint.x,
|
|
2798
|
+
y1: edgePoint.y,
|
|
2799
|
+
x2: elbowPoint.x,
|
|
2800
|
+
y2: elbowPoint.y,
|
|
2801
|
+
stroke: fill,
|
|
2802
|
+
"stroke-width": 1.5,
|
|
2803
|
+
opacity: 0.88
|
|
2804
|
+
}) : groupNode(`${mode}-slice-guide-empty-${slice.id}`),
|
|
2805
|
+
config.showNumber ? buildValueLabelNode(`${mode}-slice-value-${slice.id}`, config, slice.value, useOutsideLabel ? labelX : insidePoint.x, useOutsideLabel ? labelY : insidePoint.y + 4, {
|
|
2806
|
+
anchor: useOutsideLabel ? anchor : "middle",
|
|
2807
|
+
fill: useOutsideLabel ? config.theme.title : "#ffffff",
|
|
2808
|
+
fontSize: config.theme.fontSize
|
|
2809
|
+
}) : groupNode(`${mode}-slice-value-empty-${slice.id}`)
|
|
2810
|
+
];
|
|
2811
|
+
});
|
|
2812
|
+
return [
|
|
2813
|
+
rectNode(`${mode}-surface`, {
|
|
2814
|
+
x: 0,
|
|
2815
|
+
y: 0,
|
|
2816
|
+
width: size.width,
|
|
2817
|
+
height: size.height,
|
|
2818
|
+
rx: config.layout.cornerRadius,
|
|
2819
|
+
fill: (_a = config.layout.background) != null ? _a : config.theme.surface,
|
|
2820
|
+
stroke: config.theme.border,
|
|
2821
|
+
"stroke-width": 1
|
|
2822
|
+
}),
|
|
2823
|
+
...buildTitleNodes(mode, config, frame, config.theme),
|
|
2824
|
+
groupNode(`${mode}-plot`, [
|
|
2825
|
+
rectNode(`${mode}-plot-bg`, {
|
|
2826
|
+
x: frame.plot.x,
|
|
2827
|
+
y: frame.plot.y,
|
|
2828
|
+
width: frame.plot.width,
|
|
2829
|
+
height: frame.plot.height,
|
|
2830
|
+
rx: 14,
|
|
2831
|
+
fill: config.theme.plotBackground,
|
|
2832
|
+
stroke: config.theme.plotBorder,
|
|
2833
|
+
"stroke-width": 1
|
|
2834
|
+
}),
|
|
2835
|
+
...slices,
|
|
2836
|
+
mode === "donut" && config.showNumber ? textNode(`${mode}-center-total`, String(payload.total), {
|
|
2837
|
+
x: centerX,
|
|
2838
|
+
y: centerY + 4,
|
|
2839
|
+
fill: config.theme.title,
|
|
2840
|
+
"font-family": config.theme.fontFamily,
|
|
2841
|
+
"font-size": config.theme.fontSize + 8,
|
|
2842
|
+
"font-weight": 700,
|
|
2843
|
+
"text-anchor": "middle"
|
|
2844
|
+
}) : groupNode(`${mode}-center-total-empty`),
|
|
2845
|
+
mode === "donut" && config.showNumber ? textNode(`${mode}-center-label`, "total", {
|
|
2846
|
+
x: centerX,
|
|
2847
|
+
y: centerY + 22,
|
|
2848
|
+
fill: config.theme.mutedText,
|
|
2849
|
+
"font-family": config.theme.fontFamily,
|
|
2850
|
+
"font-size": config.theme.fontSize,
|
|
2851
|
+
"text-anchor": "middle"
|
|
2852
|
+
}) : groupNode(`${mode}-center-label-empty`)
|
|
2853
|
+
]),
|
|
2854
|
+
...buildLegendNodes(mode, config, frame, config.theme, payload.slices.map((slice, index) => ({
|
|
2855
|
+
id: slice.id,
|
|
2856
|
+
label: config.showNumber ? `${slice.label} (${slice.value})` : slice.label,
|
|
2857
|
+
color: resolveSeriesColor(config, index, slice.color)
|
|
2858
|
+
})))
|
|
2859
|
+
];
|
|
2860
|
+
}
|
|
2861
|
+
});
|
|
2862
|
+
donutChart = createRadialDefinition("donut");
|
|
2863
|
+
pieChart = createRadialDefinition("pie");
|
|
2864
|
+
}
|
|
2865
|
+
});
|
|
2866
|
+
|
|
2867
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/index.js
|
|
2868
|
+
var charts_exports = {};
|
|
2869
|
+
__export(charts_exports, {
|
|
2870
|
+
coreChartsPack: () => coreChartsPack
|
|
2871
|
+
});
|
|
2872
|
+
var coreChartsPack;
|
|
2873
|
+
var init_charts = __esm({
|
|
2874
|
+
"node_modules/@revivejs/infinity-charts/dist/charts/index.js"() {
|
|
2875
|
+
init_area_chart();
|
|
2876
|
+
init_bar_3d_chart();
|
|
2877
|
+
init_bar_chart();
|
|
2878
|
+
init_combo_chart();
|
|
2879
|
+
init_donut_chart();
|
|
2880
|
+
init_gauge_chart();
|
|
2881
|
+
init_line_chart();
|
|
2882
|
+
init_scatter_chart();
|
|
2883
|
+
init_sparkline_chart();
|
|
2884
|
+
init_stacked_area_chart();
|
|
2885
|
+
coreChartsPack = {
|
|
2886
|
+
id: "core",
|
|
2887
|
+
charts: [
|
|
2888
|
+
lineChart,
|
|
2889
|
+
areaChart,
|
|
2890
|
+
stackedAreaChart,
|
|
2891
|
+
barChart,
|
|
2892
|
+
bar3DChart,
|
|
2893
|
+
comboChart,
|
|
2894
|
+
sparklineChart,
|
|
2895
|
+
scatterChart,
|
|
2896
|
+
gaugeChart,
|
|
2897
|
+
semicircleGaugeChart,
|
|
2898
|
+
radialProgressChart,
|
|
2899
|
+
thermometerChart,
|
|
2900
|
+
thermometerHorizontalChart,
|
|
2901
|
+
batteryChart,
|
|
2902
|
+
pieChart,
|
|
2903
|
+
donutChart
|
|
2904
|
+
],
|
|
2905
|
+
plugins: []
|
|
2906
|
+
};
|
|
2907
|
+
}
|
|
2908
|
+
});
|
|
2909
|
+
|
|
2910
|
+
// node_modules/@revivejs/infinity-charts/dist/index.js
|
|
2911
|
+
var index_exports = {};
|
|
2912
|
+
__export(index_exports, {
|
|
2913
|
+
ChartRegistry: () => ChartRegistry,
|
|
2914
|
+
builtInChartTypes: () => builtInChartTypes,
|
|
2915
|
+
create: () => create,
|
|
2916
|
+
createChart: () => createChart,
|
|
2917
|
+
loadAllCharts: () => loadAllCharts,
|
|
2918
|
+
loadChart: () => loadChart,
|
|
2919
|
+
mount: () => mount,
|
|
2920
|
+
preloadCharts: () => preloadCharts,
|
|
2921
|
+
registerChart: () => registerChart,
|
|
2922
|
+
registerChartLoader: () => registerChartLoader,
|
|
2923
|
+
registerPack: () => registerPack,
|
|
2924
|
+
registerPlugin: () => registerPlugin,
|
|
2925
|
+
usePack: () => usePack
|
|
2926
|
+
});
|
|
2927
|
+
module.exports = __toCommonJS(index_exports);
|
|
2928
|
+
|
|
2929
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/loaders.js
|
|
2930
|
+
var builtInChartLoaders = {
|
|
2931
|
+
line: async () => (await Promise.resolve().then(() => (init_line_chart(), line_chart_exports))).lineChart,
|
|
2932
|
+
area: async () => (await Promise.resolve().then(() => (init_area_chart(), area_chart_exports))).areaChart,
|
|
2933
|
+
"stacked-area": async () => (await Promise.resolve().then(() => (init_stacked_area_chart(), stacked_area_chart_exports))).stackedAreaChart,
|
|
2934
|
+
bar: async () => (await Promise.resolve().then(() => (init_bar_chart(), bar_chart_exports))).barChart,
|
|
2935
|
+
"bar-3d": async () => (await Promise.resolve().then(() => (init_bar_3d_chart(), bar_3d_chart_exports))).bar3DChart,
|
|
2936
|
+
combo: async () => (await Promise.resolve().then(() => (init_combo_chart(), combo_chart_exports))).comboChart,
|
|
2937
|
+
sparkline: async () => (await Promise.resolve().then(() => (init_sparkline_chart(), sparkline_chart_exports))).sparklineChart,
|
|
2938
|
+
scatter: async () => (await Promise.resolve().then(() => (init_scatter_chart(), scatter_chart_exports))).scatterChart,
|
|
2939
|
+
gauge: async () => (await Promise.resolve().then(() => (init_gauge_chart(), gauge_chart_exports))).gaugeChart,
|
|
2940
|
+
"gauge-semicircle": async () => (await Promise.resolve().then(() => (init_gauge_chart(), gauge_chart_exports))).semicircleGaugeChart,
|
|
2941
|
+
"radial-progress": async () => (await Promise.resolve().then(() => (init_gauge_chart(), gauge_chart_exports))).radialProgressChart,
|
|
2942
|
+
thermometer: async () => (await Promise.resolve().then(() => (init_gauge_chart(), gauge_chart_exports))).thermometerChart,
|
|
2943
|
+
"thermometer-horizontal": async () => (await Promise.resolve().then(() => (init_gauge_chart(), gauge_chart_exports))).thermometerHorizontalChart,
|
|
2944
|
+
battery: async () => (await Promise.resolve().then(() => (init_gauge_chart(), gauge_chart_exports))).batteryChart,
|
|
2945
|
+
pie: async () => (await Promise.resolve().then(() => (init_donut_chart(), donut_chart_exports))).pieChart,
|
|
2946
|
+
donut: async () => (await Promise.resolve().then(() => (init_donut_chart(), donut_chart_exports))).donutChart
|
|
2947
|
+
};
|
|
2948
|
+
var builtInChartTypes = Object.keys(builtInChartLoaders);
|
|
2949
|
+
|
|
2950
|
+
// node_modules/@revivejs/infinity-charts/dist/charts/common/data-normalizer.js
|
|
2951
|
+
init_math();
|
|
2952
|
+
var gaugeLikeTypes = /* @__PURE__ */ new Set([
|
|
2953
|
+
"gauge",
|
|
2954
|
+
"gauge-semicircle",
|
|
2955
|
+
"radial-progress",
|
|
2956
|
+
"thermometer",
|
|
2957
|
+
"thermometer-horizontal",
|
|
2958
|
+
"battery"
|
|
2959
|
+
]);
|
|
2960
|
+
var resolveDefaultCartesianSeriesType = (type) => {
|
|
2961
|
+
if (type === "bar") {
|
|
2962
|
+
return "bar";
|
|
2963
|
+
}
|
|
2964
|
+
if (type === "bar-3d") {
|
|
2965
|
+
return "bar";
|
|
2966
|
+
}
|
|
2967
|
+
if (type === "area" || type === "stacked-area") {
|
|
2968
|
+
return "area";
|
|
2969
|
+
}
|
|
2970
|
+
if (type === "scatter") {
|
|
2971
|
+
return "scatter";
|
|
2972
|
+
}
|
|
2973
|
+
return "line";
|
|
2974
|
+
};
|
|
2975
|
+
var isNumberArray = (input) => Array.isArray(input) && (input.length === 0 || input.every((value) => typeof value === "number"));
|
|
2976
|
+
var isRecordData = (input) => typeof input === "object" && input !== null && !Array.isArray(input) && Object.values(input).every((value) => typeof value === "number");
|
|
2977
|
+
var isCartesianSeriesArray = (input) => Array.isArray(input) && (input.length === 0 || input.every((item) => typeof item === "object" && item !== null && "data" in item && Array.isArray(item.data)));
|
|
2978
|
+
var isSliceArray = (input) => Array.isArray(input) && (input.length === 0 || input.every((item) => typeof item === "object" && item !== null && "value" in item && "label" in item && !("data" in item)));
|
|
2979
|
+
var isLabeledValueArray = (input) => Array.isArray(input) && (input.length === 0 || input.every((item) => typeof item === "object" && item !== null && "value" in item && "label" in item && !("data" in item)));
|
|
2980
|
+
var normalizeSingleCartesianData = (input) => {
|
|
2981
|
+
var _a;
|
|
2982
|
+
const labels = [...(_a = input.labels) != null ? _a : []];
|
|
2983
|
+
if (isNumberArray(input.data)) {
|
|
2984
|
+
const resolvedLabels = labels.length > 0 ? labels : input.data.map((_, index) => `Point ${index + 1}`);
|
|
2985
|
+
return {
|
|
2986
|
+
kind: "cartesian",
|
|
2987
|
+
labels: resolvedLabels,
|
|
2988
|
+
series: [
|
|
2989
|
+
{
|
|
2990
|
+
kind: "cartesian",
|
|
2991
|
+
id: "series-0",
|
|
2992
|
+
name: "Series 1",
|
|
2993
|
+
type: resolveDefaultCartesianSeriesType(input.type),
|
|
2994
|
+
data: input.data.map((value, index) => {
|
|
2995
|
+
var _a2, _b;
|
|
2996
|
+
return {
|
|
2997
|
+
index,
|
|
2998
|
+
x: (_a2 = resolvedLabels[index]) != null ? _a2 : `Point ${index + 1}`,
|
|
2999
|
+
label: (_b = resolvedLabels[index]) != null ? _b : `Point ${index + 1}`,
|
|
3000
|
+
y: value
|
|
3001
|
+
};
|
|
3002
|
+
})
|
|
3003
|
+
}
|
|
3004
|
+
]
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
if (isRecordData(input.data)) {
|
|
3008
|
+
const resolvedLabels = Object.keys(input.data);
|
|
3009
|
+
const values = Object.values(input.data);
|
|
3010
|
+
return {
|
|
3011
|
+
kind: "cartesian",
|
|
3012
|
+
labels: resolvedLabels,
|
|
3013
|
+
series: [
|
|
3014
|
+
{
|
|
3015
|
+
kind: "cartesian",
|
|
3016
|
+
id: "series-0",
|
|
3017
|
+
name: "Series 1",
|
|
3018
|
+
type: resolveDefaultCartesianSeriesType(input.type),
|
|
3019
|
+
data: values.map((value, index) => {
|
|
3020
|
+
var _a2, _b;
|
|
3021
|
+
return {
|
|
3022
|
+
index,
|
|
3023
|
+
x: (_a2 = resolvedLabels[index]) != null ? _a2 : `Point ${index + 1}`,
|
|
3024
|
+
label: (_b = resolvedLabels[index]) != null ? _b : `Point ${index + 1}`,
|
|
3025
|
+
y: value
|
|
3026
|
+
};
|
|
3027
|
+
})
|
|
3028
|
+
}
|
|
3029
|
+
]
|
|
3030
|
+
};
|
|
3031
|
+
}
|
|
3032
|
+
if (Array.isArray(input.data)) {
|
|
3033
|
+
const entries = input.data;
|
|
3034
|
+
const resolvedLabels = labels.length > 0 ? labels : entries.map((entry, index) => {
|
|
3035
|
+
var _a2, _b, _c;
|
|
3036
|
+
if (typeof entry === "number") {
|
|
3037
|
+
return `Point ${index + 1}`;
|
|
3038
|
+
}
|
|
3039
|
+
if ("y" in entry) {
|
|
3040
|
+
return (_b = entry.label) != null ? _b : String((_a2 = entry.x) != null ? _a2 : `Point ${index + 1}`);
|
|
3041
|
+
}
|
|
3042
|
+
return (_c = entry.label) != null ? _c : `Point ${index + 1}`;
|
|
3043
|
+
});
|
|
3044
|
+
return {
|
|
3045
|
+
kind: "cartesian",
|
|
3046
|
+
labels: resolvedLabels,
|
|
3047
|
+
series: [
|
|
3048
|
+
{
|
|
3049
|
+
kind: "cartesian",
|
|
3050
|
+
id: "series-0",
|
|
3051
|
+
name: "Series 1",
|
|
3052
|
+
type: resolveDefaultCartesianSeriesType(input.type),
|
|
3053
|
+
data: entries.map((entry, index) => {
|
|
3054
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3055
|
+
if (typeof entry === "number") {
|
|
3056
|
+
return {
|
|
3057
|
+
index,
|
|
3058
|
+
x: (_a2 = resolvedLabels[index]) != null ? _a2 : `Point ${index + 1}`,
|
|
3059
|
+
label: (_b = resolvedLabels[index]) != null ? _b : `Point ${index + 1}`,
|
|
3060
|
+
y: entry
|
|
3061
|
+
};
|
|
3062
|
+
}
|
|
3063
|
+
if ("y" in entry) {
|
|
3064
|
+
return {
|
|
3065
|
+
index,
|
|
3066
|
+
x: (_d = (_c = entry.x) != null ? _c : resolvedLabels[index]) != null ? _d : `Point ${index + 1}`,
|
|
3067
|
+
label: (_f = (_e = entry.label) != null ? _e : resolvedLabels[index]) != null ? _f : `Point ${index + 1}`,
|
|
3068
|
+
y: entry.y
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
return {
|
|
3072
|
+
index,
|
|
3073
|
+
x: (_h = (_g = entry.label) != null ? _g : resolvedLabels[index]) != null ? _h : `Point ${index + 1}`,
|
|
3074
|
+
label: (_j = (_i = entry.label) != null ? _i : resolvedLabels[index]) != null ? _j : `Point ${index + 1}`,
|
|
3075
|
+
y: entry.value
|
|
3076
|
+
};
|
|
3077
|
+
})
|
|
3078
|
+
}
|
|
3079
|
+
]
|
|
3080
|
+
};
|
|
3081
|
+
}
|
|
3082
|
+
return {
|
|
3083
|
+
kind: "cartesian",
|
|
3084
|
+
labels: [],
|
|
3085
|
+
series: [
|
|
3086
|
+
{
|
|
3087
|
+
kind: "cartesian",
|
|
3088
|
+
id: "series-0",
|
|
3089
|
+
name: "Series 1",
|
|
3090
|
+
type: resolveDefaultCartesianSeriesType(input.type),
|
|
3091
|
+
data: []
|
|
3092
|
+
}
|
|
3093
|
+
]
|
|
3094
|
+
};
|
|
3095
|
+
};
|
|
3096
|
+
var normalizeCartesianSeries = (input) => {
|
|
3097
|
+
var _a, _b, _c, _d, _e;
|
|
3098
|
+
if (!isCartesianSeriesArray(input.series)) {
|
|
3099
|
+
return normalizeSingleCartesianData(input);
|
|
3100
|
+
}
|
|
3101
|
+
const baseLabels = ((_a = input.labels) == null ? void 0 : _a.length) ? [...input.labels] : (_c = (_b = input.series[0]) == null ? void 0 : _b.data.map((datum, index) => {
|
|
3102
|
+
var _a2, _b2;
|
|
3103
|
+
if (typeof datum === "number") {
|
|
3104
|
+
return `Point ${index + 1}`;
|
|
3105
|
+
}
|
|
3106
|
+
return (_b2 = datum.label) != null ? _b2 : String((_a2 = datum.x) != null ? _a2 : `Point ${index + 1}`);
|
|
3107
|
+
})) != null ? _c : [];
|
|
3108
|
+
const series = input.series.map((entry, seriesIndex) => {
|
|
3109
|
+
var _a2, _b2, _c2;
|
|
3110
|
+
return {
|
|
3111
|
+
kind: "cartesian",
|
|
3112
|
+
id: (_a2 = entry.id) != null ? _a2 : `series-${seriesIndex}`,
|
|
3113
|
+
name: (_b2 = entry.name) != null ? _b2 : `Series ${seriesIndex + 1}`,
|
|
3114
|
+
color: entry.color,
|
|
3115
|
+
type: (_c2 = entry.type) != null ? _c2 : resolveDefaultCartesianSeriesType(input.type),
|
|
3116
|
+
data: entry.data.map((datum, index) => {
|
|
3117
|
+
var _a3, _b3, _c3, _d2, _e2, _f;
|
|
3118
|
+
if (typeof datum === "number") {
|
|
3119
|
+
return {
|
|
3120
|
+
index,
|
|
3121
|
+
x: (_a3 = baseLabels[index]) != null ? _a3 : `Point ${index + 1}`,
|
|
3122
|
+
label: (_b3 = baseLabels[index]) != null ? _b3 : `Point ${index + 1}`,
|
|
3123
|
+
y: datum
|
|
3124
|
+
};
|
|
3125
|
+
}
|
|
3126
|
+
return {
|
|
3127
|
+
index,
|
|
3128
|
+
x: (_d2 = (_c3 = datum.x) != null ? _c3 : baseLabels[index]) != null ? _d2 : `Point ${index + 1}`,
|
|
3129
|
+
label: (_f = (_e2 = datum.label) != null ? _e2 : baseLabels[index]) != null ? _f : `Point ${index + 1}`,
|
|
3130
|
+
y: datum.y
|
|
3131
|
+
};
|
|
3132
|
+
})
|
|
3133
|
+
};
|
|
3134
|
+
});
|
|
3135
|
+
const labels = baseLabels.length > 0 ? baseLabels : (_e = (_d = series[0]) == null ? void 0 : _d.data.map((datum) => datum.label)) != null ? _e : [];
|
|
3136
|
+
return {
|
|
3137
|
+
kind: "cartesian",
|
|
3138
|
+
labels,
|
|
3139
|
+
series
|
|
3140
|
+
};
|
|
3141
|
+
};
|
|
3142
|
+
var normalizeRadialPayload = (input) => {
|
|
3143
|
+
const slices = isSliceArray(input.series) ? input.series : isSliceArray(input.data) ? input.data : isRecordData(input.data) ? Object.entries(input.data).map(([label, value]) => ({ label, value })) : isLabeledValueArray(input.data) ? input.data : isNumberArray(input.data) ? input.data.map((value, index) => ({
|
|
3144
|
+
label: `Slice ${index + 1}`,
|
|
3145
|
+
value
|
|
3146
|
+
})) : [];
|
|
3147
|
+
const normalizedSlices = slices.map((slice, index) => {
|
|
3148
|
+
const explicitId = typeof slice.id === "string" ? slice.id : void 0;
|
|
3149
|
+
const explicitColor = typeof slice.color === "string" ? slice.color : void 0;
|
|
3150
|
+
return {
|
|
3151
|
+
id: explicitId != null ? explicitId : `slice-${index}`,
|
|
3152
|
+
label: slice.label,
|
|
3153
|
+
value: slice.value,
|
|
3154
|
+
color: explicitColor
|
|
3155
|
+
};
|
|
3156
|
+
});
|
|
3157
|
+
return {
|
|
3158
|
+
kind: "radial",
|
|
3159
|
+
mode: input.type === "pie" ? "pie" : "donut",
|
|
3160
|
+
slices: normalizedSlices,
|
|
3161
|
+
total: sum(normalizedSlices.map((slice) => slice.value))
|
|
3162
|
+
};
|
|
3163
|
+
};
|
|
3164
|
+
var resolveGaugeSource = (input) => {
|
|
3165
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3166
|
+
if (isCartesianSeriesArray(input.series)) {
|
|
3167
|
+
const firstSeries = input.series[0];
|
|
3168
|
+
const firstDatum = firstSeries == null ? void 0 : firstSeries.data[0];
|
|
3169
|
+
if (firstSeries && firstDatum !== void 0) {
|
|
3170
|
+
if (typeof firstDatum === "number") {
|
|
3171
|
+
return {
|
|
3172
|
+
value: firstDatum,
|
|
3173
|
+
label: (_a = firstSeries.name) != null ? _a : "Value",
|
|
3174
|
+
color: firstSeries.color
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3177
|
+
return {
|
|
3178
|
+
value: firstDatum.y,
|
|
3179
|
+
label: (_c = (_b = firstDatum.label) != null ? _b : firstSeries.name) != null ? _c : "Value",
|
|
3180
|
+
color: firstSeries.color
|
|
3181
|
+
};
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
if (isLabeledValueArray(input.data)) {
|
|
3185
|
+
const first = input.data[0];
|
|
3186
|
+
if (first) {
|
|
3187
|
+
return {
|
|
3188
|
+
value: first.value,
|
|
3189
|
+
label: first.label,
|
|
3190
|
+
color: first.color
|
|
3191
|
+
};
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
if (isNumberArray(input.data)) {
|
|
3195
|
+
return {
|
|
3196
|
+
value: (_d = input.data[0]) != null ? _d : 0,
|
|
3197
|
+
label: (_f = (_e = input.labels) == null ? void 0 : _e[0]) != null ? _f : "Value"
|
|
3198
|
+
};
|
|
3199
|
+
}
|
|
3200
|
+
if (isRecordData(input.data)) {
|
|
3201
|
+
const [label, value] = (_g = Object.entries(input.data)[0]) != null ? _g : ["Value", 0];
|
|
3202
|
+
return { value, label };
|
|
3203
|
+
}
|
|
3204
|
+
return {
|
|
3205
|
+
value: 0,
|
|
3206
|
+
label: (_i = (_h = input.labels) == null ? void 0 : _h[0]) != null ? _i : "Value"
|
|
3207
|
+
};
|
|
3208
|
+
};
|
|
3209
|
+
var normalizeGaugePayload = (input) => {
|
|
3210
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3211
|
+
const gauge = input.gauge;
|
|
3212
|
+
const min = (_a = gauge == null ? void 0 : gauge.min) != null ? _a : 0;
|
|
3213
|
+
const max = (_b = gauge == null ? void 0 : gauge.max) != null ? _b : 100;
|
|
3214
|
+
const span = max - min || 1;
|
|
3215
|
+
const source = resolveGaugeSource(input);
|
|
3216
|
+
const value = clamp(source.value, min, max);
|
|
3217
|
+
const ratio = clamp((value - min) / span, 0, 1);
|
|
3218
|
+
const segments = ((_c = gauge == null ? void 0 : gauge.bands) == null ? void 0 : _c.length) ? gauge.bands.map((band, index) => {
|
|
3219
|
+
var _a2, _b2;
|
|
3220
|
+
return {
|
|
3221
|
+
id: `band-${index}`,
|
|
3222
|
+
from: clamp(band.from, min, max),
|
|
3223
|
+
to: clamp(band.to, min, max),
|
|
3224
|
+
color: (_a2 = band.color) != null ? _a2 : "#2563eb",
|
|
3225
|
+
label: (_b2 = band.label) != null ? _b2 : `Band ${index + 1}`
|
|
3226
|
+
};
|
|
3227
|
+
}) : [
|
|
3228
|
+
{
|
|
3229
|
+
id: "band-0",
|
|
3230
|
+
from: min,
|
|
3231
|
+
to: max,
|
|
3232
|
+
color: "#2563eb",
|
|
3233
|
+
label: "Value"
|
|
3234
|
+
}
|
|
3235
|
+
];
|
|
3236
|
+
const activeColor = (_h = (_g = (_e = source.color) != null ? _e : (_d = segments.find((segment) => value >= segment.from && value <= segment.to)) == null ? void 0 : _d.color) != null ? _g : (_f = segments[segments.length - 1]) == null ? void 0 : _f.color) != null ? _h : "#2563eb";
|
|
3237
|
+
const formattedValue = (gauge == null ? void 0 : gauge.valueFormatter) ? gauge.valueFormatter(value) : `${Number.isInteger(value) ? value : value.toFixed(1)}${(_i = gauge == null ? void 0 : gauge.unit) != null ? _i : ""}`;
|
|
3238
|
+
return {
|
|
3239
|
+
kind: "gauge",
|
|
3240
|
+
value,
|
|
3241
|
+
min,
|
|
3242
|
+
max,
|
|
3243
|
+
ratio,
|
|
3244
|
+
label: (gauge == null ? void 0 : gauge.label) || source.label,
|
|
3245
|
+
unit: (_j = gauge == null ? void 0 : gauge.unit) != null ? _j : "",
|
|
3246
|
+
formattedValue,
|
|
3247
|
+
startAngle: (_k = gauge == null ? void 0 : gauge.startAngle) != null ? _k : Math.PI * 5 / 4,
|
|
3248
|
+
endAngle: (_l = gauge == null ? void 0 : gauge.endAngle) != null ? _l : Math.PI * 11 / 4,
|
|
3249
|
+
needle: (_m = gauge == null ? void 0 : gauge.needle) != null ? _m : true,
|
|
3250
|
+
trackColor: gauge == null ? void 0 : gauge.trackColor,
|
|
3251
|
+
color: activeColor,
|
|
3252
|
+
segments
|
|
3253
|
+
};
|
|
3254
|
+
};
|
|
3255
|
+
var normalizeChartPayload = (input) => input.type === "donut" || input.type === "pie" ? normalizeRadialPayload(input) : gaugeLikeTypes.has(input.type) ? normalizeGaugePayload(input) : normalizeCartesianSeries(input);
|
|
3256
|
+
var coerceCartesianSeriesInput = (input) => {
|
|
3257
|
+
const payload = normalizeCartesianSeries(input);
|
|
3258
|
+
return payload.series.map((series) => ({
|
|
3259
|
+
id: series.id,
|
|
3260
|
+
name: series.name,
|
|
3261
|
+
color: series.color,
|
|
3262
|
+
type: series.type,
|
|
3263
|
+
data: series.data.map((datum) => ({
|
|
3264
|
+
x: datum.x,
|
|
3265
|
+
y: datum.y,
|
|
3266
|
+
label: datum.label
|
|
3267
|
+
}))
|
|
3268
|
+
}));
|
|
3269
|
+
};
|
|
3270
|
+
var coerceRadialSliceInput = (input) => {
|
|
3271
|
+
const payload = normalizeRadialPayload(input);
|
|
3272
|
+
return payload.slices.map((slice) => ({
|
|
3273
|
+
id: slice.id,
|
|
3274
|
+
label: slice.label,
|
|
3275
|
+
value: slice.value,
|
|
3276
|
+
color: slice.color
|
|
3277
|
+
}));
|
|
3278
|
+
};
|
|
3279
|
+
var appendDataPoint = (config, point) => {
|
|
3280
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
3281
|
+
if (gaugeLikeTypes.has(config.type)) {
|
|
3282
|
+
const nextValue = typeof point === "number" ? point : (_b = (_a = point.value) != null ? _a : point.y) != null ? _b : 0;
|
|
3283
|
+
const nextLabel2 = typeof point === "object" ? (_e = (_d = point.label) != null ? _d : (_c = config.gauge) == null ? void 0 : _c.label) != null ? _e : "Value" : (_g = (_f = config.gauge) == null ? void 0 : _f.label) != null ? _g : "Value";
|
|
3284
|
+
const nextColor = typeof point === "object" ? point.color : void 0;
|
|
3285
|
+
config.data = [
|
|
3286
|
+
{
|
|
3287
|
+
label: nextLabel2,
|
|
3288
|
+
value: nextValue,
|
|
3289
|
+
...nextColor ? { color: nextColor } : {}
|
|
3290
|
+
}
|
|
3291
|
+
];
|
|
3292
|
+
config.series = void 0;
|
|
3293
|
+
config.labels = [nextLabel2];
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
if (config.type === "pie" || config.type === "donut") {
|
|
3297
|
+
const slices = coerceRadialSliceInput(config);
|
|
3298
|
+
const nextValue = typeof point === "number" ? point : (_i = (_h = point.value) != null ? _h : point.y) != null ? _i : 0;
|
|
3299
|
+
slices.push({
|
|
3300
|
+
id: `slice-${slices.length}`,
|
|
3301
|
+
label: typeof point === "number" ? `Slice ${slices.length + 1}` : (_j = point.label) != null ? _j : `Slice ${slices.length + 1}`,
|
|
3302
|
+
value: nextValue,
|
|
3303
|
+
color: typeof point === "object" ? point.color : void 0
|
|
3304
|
+
});
|
|
3305
|
+
config.data = slices;
|
|
3306
|
+
config.series = void 0;
|
|
3307
|
+
return;
|
|
3308
|
+
}
|
|
3309
|
+
const series = coerceCartesianSeriesInput(config);
|
|
3310
|
+
if (series.length === 0) {
|
|
3311
|
+
series.push({
|
|
3312
|
+
id: "series-0",
|
|
3313
|
+
name: "Series 1",
|
|
3314
|
+
type: config.type === "bar" ? "bar" : config.type === "area" ? "area" : config.type === "scatter" ? "scatter" : "line",
|
|
3315
|
+
data: []
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3318
|
+
const primarySeries = series[0];
|
|
3319
|
+
const nextLabel = typeof point === "number" ? `Point ${primarySeries.data.length + 1}` : (_k = point.label) != null ? _k : `Point ${primarySeries.data.length + 1}`;
|
|
3320
|
+
if (typeof point === "number") {
|
|
3321
|
+
primarySeries.data.push({ label: nextLabel, y: point });
|
|
3322
|
+
} else if (Array.isArray(point.values)) {
|
|
3323
|
+
series.forEach((entry, index) => {
|
|
3324
|
+
var _a2, _b2;
|
|
3325
|
+
entry.data.push({
|
|
3326
|
+
label: nextLabel,
|
|
3327
|
+
y: (_b2 = (_a2 = point.values) == null ? void 0 : _a2[index]) != null ? _b2 : 0
|
|
3328
|
+
});
|
|
3329
|
+
});
|
|
3330
|
+
} else if (point.seriesId && series.length > 1) {
|
|
3331
|
+
series.forEach((entry) => {
|
|
3332
|
+
var _a2, _b2;
|
|
3333
|
+
entry.data.push({
|
|
3334
|
+
label: nextLabel,
|
|
3335
|
+
y: entry.id === point.seriesId ? (_b2 = (_a2 = point.value) != null ? _a2 : point.y) != null ? _b2 : 0 : 0
|
|
3336
|
+
});
|
|
3337
|
+
});
|
|
3338
|
+
} else {
|
|
3339
|
+
primarySeries.data.push({
|
|
3340
|
+
label: nextLabel,
|
|
3341
|
+
y: (_m = (_l = point.value) != null ? _l : point.y) != null ? _m : 0
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
const maxPoints = (_o = (_n = config.realtime) == null ? void 0 : _n.maxPoints) != null ? _o : 0;
|
|
3345
|
+
if (maxPoints > 0) {
|
|
3346
|
+
series.forEach((entry) => {
|
|
3347
|
+
if (entry.data.length > maxPoints) {
|
|
3348
|
+
entry.data = entry.data.slice(-maxPoints);
|
|
3349
|
+
}
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
config.series = series;
|
|
3353
|
+
config.data = void 0;
|
|
3354
|
+
config.labels = primarySeries.data.map((datum) => {
|
|
3355
|
+
var _a2;
|
|
3356
|
+
return typeof datum === "number" ? "" : (_a2 = datum.label) != null ? _a2 : "";
|
|
3357
|
+
});
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3360
|
+
// node_modules/@revivejs/infinity-charts/dist/events/event-emitter.js
|
|
3361
|
+
var EventEmitter = class {
|
|
3362
|
+
constructor() {
|
|
3363
|
+
__publicField(this, "handlers", /* @__PURE__ */ new Map());
|
|
3364
|
+
}
|
|
3365
|
+
on(event, handler) {
|
|
3366
|
+
var _a;
|
|
3367
|
+
if (!this.handlers.has(event)) {
|
|
3368
|
+
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
3369
|
+
}
|
|
3370
|
+
(_a = this.handlers.get(event)) == null ? void 0 : _a.add(handler);
|
|
3371
|
+
return () => {
|
|
3372
|
+
var _a2;
|
|
3373
|
+
(_a2 = this.handlers.get(event)) == null ? void 0 : _a2.delete(handler);
|
|
3374
|
+
};
|
|
3375
|
+
}
|
|
3376
|
+
emit(event, payload) {
|
|
3377
|
+
var _a;
|
|
3378
|
+
(_a = this.handlers.get(event)) == null ? void 0 : _a.forEach((handler) => {
|
|
3379
|
+
handler(payload);
|
|
3380
|
+
});
|
|
3381
|
+
}
|
|
3382
|
+
clear() {
|
|
3383
|
+
this.handlers.clear();
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
|
|
3387
|
+
// node_modules/@revivejs/infinity-charts/dist/interaction/interaction-layer.js
|
|
3388
|
+
var escapeHtml = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
3389
|
+
var clamp2 = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
3390
|
+
var InteractionLayer = class {
|
|
3391
|
+
constructor(container, events) {
|
|
3392
|
+
__publicField(this, "container");
|
|
3393
|
+
__publicField(this, "events");
|
|
3394
|
+
__publicField(this, "tooltip", document.createElement("div"));
|
|
3395
|
+
__publicField(this, "config");
|
|
3396
|
+
__publicField(this, "activeTarget");
|
|
3397
|
+
__publicField(this, "setRelativePosition", false);
|
|
3398
|
+
__publicField(this, "handlePointerMove", (event) => {
|
|
3399
|
+
var _a;
|
|
3400
|
+
if (!((_a = this.config) == null ? void 0 : _a.interaction.enabled)) {
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
const target = this.resolveInteractiveElement(event.target);
|
|
3404
|
+
if (!target) {
|
|
3405
|
+
this.clearActiveTarget();
|
|
3406
|
+
return;
|
|
3407
|
+
}
|
|
3408
|
+
const payload = this.readPayload(target);
|
|
3409
|
+
if (!payload) {
|
|
3410
|
+
this.clearActiveTarget();
|
|
3411
|
+
return;
|
|
3412
|
+
}
|
|
3413
|
+
this.activateTarget(target, payload);
|
|
3414
|
+
if (this.config.interaction.tooltip) {
|
|
3415
|
+
this.showTooltip(payload, event.clientX, event.clientY);
|
|
3416
|
+
}
|
|
3417
|
+
});
|
|
3418
|
+
__publicField(this, "handlePointerLeave", () => {
|
|
3419
|
+
this.clearActiveTarget();
|
|
3420
|
+
});
|
|
3421
|
+
__publicField(this, "handleClick", (event) => {
|
|
3422
|
+
var _a;
|
|
3423
|
+
if (!((_a = this.config) == null ? void 0 : _a.interaction.enabled) || !this.config.interaction.click) {
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
const target = this.resolveInteractiveElement(event.target);
|
|
3427
|
+
if (!target) {
|
|
3428
|
+
return;
|
|
3429
|
+
}
|
|
3430
|
+
const payload = this.readPayload(target);
|
|
3431
|
+
if (!payload) {
|
|
3432
|
+
return;
|
|
3433
|
+
}
|
|
3434
|
+
this.events.emit("interaction:click", payload);
|
|
3435
|
+
if (payload.kind === "datum") {
|
|
3436
|
+
this.events.emit("point:click", payload);
|
|
3437
|
+
}
|
|
3438
|
+
if (payload.kind === "slice") {
|
|
3439
|
+
this.events.emit("slice:click", payload);
|
|
3440
|
+
}
|
|
3441
|
+
if (payload.kind === "gauge") {
|
|
3442
|
+
this.events.emit("gauge:click", payload);
|
|
3443
|
+
}
|
|
3444
|
+
});
|
|
3445
|
+
this.container = container;
|
|
3446
|
+
this.events = events;
|
|
3447
|
+
this.tooltip.dataset.infinityChartsTooltip = "true";
|
|
3448
|
+
this.tooltip.className = "infinity-chart-tooltip";
|
|
3449
|
+
this.tooltip.setAttribute("aria-hidden", "true");
|
|
3450
|
+
this.tooltip.style.position = "absolute";
|
|
3451
|
+
this.tooltip.style.pointerEvents = "none";
|
|
3452
|
+
this.tooltip.style.zIndex = "12";
|
|
3453
|
+
this.tooltip.style.minWidth = "160px";
|
|
3454
|
+
this.tooltip.style.maxWidth = "280px";
|
|
3455
|
+
this.tooltip.style.padding = "12px 14px";
|
|
3456
|
+
this.tooltip.style.borderRadius = "14px";
|
|
3457
|
+
this.tooltip.style.border = "1px solid transparent";
|
|
3458
|
+
this.tooltip.style.boxSizing = "border-box";
|
|
3459
|
+
this.tooltip.style.backdropFilter = "blur(16px)";
|
|
3460
|
+
this.tooltip.style.opacity = "0";
|
|
3461
|
+
this.tooltip.style.transform = "translateY(8px)";
|
|
3462
|
+
this.tooltip.style.transition = "opacity 160ms ease, transform 160ms ease";
|
|
3463
|
+
this.tooltip.style.whiteSpace = "normal";
|
|
3464
|
+
this.ensureContainerPositioning();
|
|
3465
|
+
this.installListeners();
|
|
3466
|
+
this.container.append(this.tooltip);
|
|
3467
|
+
}
|
|
3468
|
+
update(config) {
|
|
3469
|
+
this.config = config;
|
|
3470
|
+
this.tooltip.style.background = config.theme.tooltipBackground;
|
|
3471
|
+
this.tooltip.style.color = config.theme.tooltipText;
|
|
3472
|
+
this.tooltip.style.borderColor = config.theme.border;
|
|
3473
|
+
this.tooltip.style.boxShadow = config.theme.shadow;
|
|
3474
|
+
this.tooltip.style.fontFamily = config.theme.fontFamily;
|
|
3475
|
+
this.tooltip.style.fontSize = `${config.theme.fontSize}px`;
|
|
3476
|
+
if (!config.interaction.enabled) {
|
|
3477
|
+
this.clearActiveTarget(false);
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
destroy() {
|
|
3481
|
+
this.container.removeEventListener("mousemove", this.handlePointerMove);
|
|
3482
|
+
this.container.removeEventListener("mouseleave", this.handlePointerLeave);
|
|
3483
|
+
this.container.removeEventListener("click", this.handleClick);
|
|
3484
|
+
this.clearActiveTarget(false);
|
|
3485
|
+
this.tooltip.remove();
|
|
3486
|
+
if (this.setRelativePosition) {
|
|
3487
|
+
this.container.style.removeProperty("position");
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
ensureContainerPositioning() {
|
|
3491
|
+
if (typeof window === "undefined") {
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3494
|
+
if (window.getComputedStyle(this.container).position === "static") {
|
|
3495
|
+
this.container.style.position = "relative";
|
|
3496
|
+
this.setRelativePosition = true;
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
installListeners() {
|
|
3500
|
+
this.container.addEventListener("mousemove", this.handlePointerMove);
|
|
3501
|
+
this.container.addEventListener("mouseleave", this.handlePointerLeave);
|
|
3502
|
+
this.container.addEventListener("click", this.handleClick);
|
|
3503
|
+
}
|
|
3504
|
+
activateTarget(target, payload) {
|
|
3505
|
+
var _a, _b, _c, _d;
|
|
3506
|
+
if (((_a = this.activeTarget) == null ? void 0 : _a.element) === target) {
|
|
3507
|
+
return;
|
|
3508
|
+
}
|
|
3509
|
+
this.clearActiveTarget(false);
|
|
3510
|
+
const filter = target instanceof HTMLElement || target instanceof SVGElement ? target.style.getPropertyValue("filter") : "";
|
|
3511
|
+
const opacity = target instanceof HTMLElement || target instanceof SVGElement ? target.style.getPropertyValue("opacity") : "";
|
|
3512
|
+
if (((_b = this.config) == null ? void 0 : _b.interaction.hover) !== false && (target instanceof HTMLElement || target instanceof SVGElement)) {
|
|
3513
|
+
const glow = (_d = (_c = this.config) == null ? void 0 : _c.theme.interactiveGlow) != null ? _d : "rgba(37, 99, 235, 0.22)";
|
|
3514
|
+
target.style.setProperty("filter", `brightness(1.08) saturate(1.08) drop-shadow(0 12px 24px ${glow})`);
|
|
3515
|
+
if (!opacity) {
|
|
3516
|
+
target.style.setProperty("opacity", "1");
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
this.activeTarget = {
|
|
3520
|
+
element: target,
|
|
3521
|
+
payload,
|
|
3522
|
+
filter,
|
|
3523
|
+
opacity
|
|
3524
|
+
};
|
|
3525
|
+
this.events.emit("interaction:hover", payload);
|
|
3526
|
+
if (payload.kind === "datum") {
|
|
3527
|
+
this.events.emit("point:hover", payload);
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
clearActiveTarget(emitLeave = true) {
|
|
3531
|
+
if (this.activeTarget && (this.activeTarget.element instanceof HTMLElement || this.activeTarget.element instanceof SVGElement)) {
|
|
3532
|
+
this.activeTarget.element.style.setProperty("filter", this.activeTarget.filter);
|
|
3533
|
+
if (this.activeTarget.opacity) {
|
|
3534
|
+
this.activeTarget.element.style.setProperty("opacity", this.activeTarget.opacity);
|
|
3535
|
+
} else {
|
|
3536
|
+
this.activeTarget.element.style.removeProperty("opacity");
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
if (emitLeave && this.activeTarget) {
|
|
3540
|
+
this.events.emit("interaction:leave", this.activeTarget.payload);
|
|
3541
|
+
}
|
|
3542
|
+
this.activeTarget = void 0;
|
|
3543
|
+
this.hideTooltip();
|
|
3544
|
+
}
|
|
3545
|
+
showTooltip(payload, clientX, clientY) {
|
|
3546
|
+
var _a, _b;
|
|
3547
|
+
const rows = [
|
|
3548
|
+
payload.seriesName && payload.label !== payload.seriesName ? ["Series", payload.seriesName] : void 0,
|
|
3549
|
+
payload.value !== void 0 ? ["Value", String(payload.value)] : void 0,
|
|
3550
|
+
payload.secondaryValue !== void 0 ? ["Compare", String(payload.secondaryValue)] : void 0,
|
|
3551
|
+
payload.detail ? ["Context", payload.detail] : void 0
|
|
3552
|
+
].filter((entry) => Boolean(entry));
|
|
3553
|
+
const title = (_b = (_a = payload.label) != null ? _a : payload.seriesName) != null ? _b : payload.chartType;
|
|
3554
|
+
const swatch = payload.color ? `<span style="display:inline-block;width:10px;height:10px;border-radius:999px;background:${escapeHtml(payload.color)};"></span>` : "";
|
|
3555
|
+
this.tooltip.innerHTML = `
|
|
3556
|
+
<div style="display:flex;align-items:center;gap:8px;font-weight:700;font-size:1em;margin-bottom:${rows.length > 0 ? "8px" : "0"};">
|
|
3557
|
+
${swatch}
|
|
3558
|
+
<span>${escapeHtml(title)}</span>
|
|
3559
|
+
</div>
|
|
3560
|
+
${rows.map(([label, value]) => {
|
|
3561
|
+
var _a2, _b2;
|
|
3562
|
+
return `
|
|
3563
|
+
<div style="display:flex;justify-content:space-between;gap:12px;margin-top:6px;">
|
|
3564
|
+
<span style="color:${escapeHtml((_b2 = (_a2 = this.config) == null ? void 0 : _a2.theme.mutedText) != null ? _b2 : "#64748b")};">${escapeHtml(label)}</span>
|
|
3565
|
+
<strong style="font-weight:600;">${escapeHtml(value)}</strong>
|
|
3566
|
+
</div>
|
|
3567
|
+
`;
|
|
3568
|
+
}).join("")}
|
|
3569
|
+
`;
|
|
3570
|
+
const bounds = this.container.getBoundingClientRect();
|
|
3571
|
+
const padding = 16;
|
|
3572
|
+
const offset = 16;
|
|
3573
|
+
const tooltipWidth = this.tooltip.offsetWidth || 220;
|
|
3574
|
+
const tooltipHeight = this.tooltip.offsetHeight || 96;
|
|
3575
|
+
const left = clamp2(clientX - bounds.left + offset, padding, Math.max(padding, bounds.width - tooltipWidth - padding));
|
|
3576
|
+
const top = clamp2(clientY - bounds.top + offset, padding, Math.max(padding, bounds.height - tooltipHeight - padding));
|
|
3577
|
+
this.tooltip.style.left = `${left}px`;
|
|
3578
|
+
this.tooltip.style.top = `${top}px`;
|
|
3579
|
+
this.tooltip.style.opacity = "1";
|
|
3580
|
+
this.tooltip.style.transform = "translateY(0)";
|
|
3581
|
+
}
|
|
3582
|
+
hideTooltip() {
|
|
3583
|
+
this.tooltip.style.opacity = "0";
|
|
3584
|
+
this.tooltip.style.transform = "translateY(8px)";
|
|
3585
|
+
}
|
|
3586
|
+
resolveInteractiveElement(target) {
|
|
3587
|
+
if (!(target instanceof Element)) {
|
|
3588
|
+
return null;
|
|
3589
|
+
}
|
|
3590
|
+
return target.closest("[data-ic-interactive='true']");
|
|
3591
|
+
}
|
|
3592
|
+
readPayload(target) {
|
|
3593
|
+
const raw = target.getAttribute("data-ic-payload");
|
|
3594
|
+
if (!raw) {
|
|
3595
|
+
return void 0;
|
|
3596
|
+
}
|
|
3597
|
+
try {
|
|
3598
|
+
return JSON.parse(raw);
|
|
3599
|
+
} catch (e) {
|
|
3600
|
+
return void 0;
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
};
|
|
3604
|
+
|
|
3605
|
+
// node_modules/@revivejs/infinity-charts/dist/layout/chart-layout.js
|
|
3606
|
+
var createRect = (x, y, width, height) => ({
|
|
3607
|
+
x,
|
|
3608
|
+
y,
|
|
3609
|
+
width: Math.max(0, width),
|
|
3610
|
+
height: Math.max(0, height)
|
|
3611
|
+
});
|
|
3612
|
+
var createChartFrame = (config, size, payload) => {
|
|
3613
|
+
const { padding, plotPadding } = config.layout;
|
|
3614
|
+
const outer = createRect(0, 0, size.width, size.height);
|
|
3615
|
+
const radialLike = payload.kind === "radial" || payload.kind === "gauge";
|
|
3616
|
+
const headerHeight = config.title.text || config.title.subtitle ? config.title.subtitle ? 58 : 40 : 0;
|
|
3617
|
+
const innerX = padding.left;
|
|
3618
|
+
const innerY = padding.top;
|
|
3619
|
+
const innerWidth = size.width - padding.left - padding.right;
|
|
3620
|
+
const innerHeight = size.height - padding.top - padding.bottom;
|
|
3621
|
+
let bodyX = innerX;
|
|
3622
|
+
let bodyY = innerY + headerHeight;
|
|
3623
|
+
let bodyWidth = innerWidth;
|
|
3624
|
+
let bodyHeight = innerHeight - headerHeight;
|
|
3625
|
+
let legend;
|
|
3626
|
+
const shouldReserveLegend = config.legend.show && (payload.kind === "cartesian" && payload.series.length > 0 || payload.kind === "radial" && payload.slices.length > 0 || payload.kind === "gauge" && payload.segments.length > 0);
|
|
3627
|
+
if (shouldReserveLegend) {
|
|
3628
|
+
if (config.legend.position === "right") {
|
|
3629
|
+
legend = createRect(size.width - padding.right - 164, bodyY + 8, 156, Math.max(0, bodyHeight - 16));
|
|
3630
|
+
bodyWidth -= legend.width + 12;
|
|
3631
|
+
} else if (config.legend.position === "left") {
|
|
3632
|
+
legend = createRect(padding.left + 8, bodyY + 8, 156, Math.max(0, bodyHeight - 16));
|
|
3633
|
+
bodyX += legend.width + 12;
|
|
3634
|
+
bodyWidth -= legend.width + 12;
|
|
3635
|
+
} else {
|
|
3636
|
+
const legendHeight = radialLike ? 30 : 36;
|
|
3637
|
+
const legendOffset = radialLike ? 36 : 44;
|
|
3638
|
+
legend = createRect(bodyX + 8, size.height - padding.bottom - legendOffset, Math.max(0, bodyWidth - 16), legendHeight);
|
|
3639
|
+
bodyHeight -= legendOffset;
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
const compactCartesian = config.type === "sparkline";
|
|
3643
|
+
const radialPlotPadding = radialLike ? {
|
|
3644
|
+
top: Math.min(plotPadding.top, 4),
|
|
3645
|
+
right: Math.min(plotPadding.right, 4),
|
|
3646
|
+
bottom: Math.min(plotPadding.bottom, 4),
|
|
3647
|
+
left: Math.min(plotPadding.left, 4)
|
|
3648
|
+
} : plotPadding;
|
|
3649
|
+
const axisLeft = payload.kind === "cartesian" && config.yAxis.show && !compactCartesian ? 56 : radialLike ? 0 : 8;
|
|
3650
|
+
const axisBottom = payload.kind === "cartesian" && config.xAxis.show && !compactCartesian ? 42 : radialLike ? 0 : 8;
|
|
3651
|
+
const trailingInset = radialLike ? 8 : 12;
|
|
3652
|
+
const plot = createRect(bodyX + axisLeft + radialPlotPadding.left, bodyY + radialPlotPadding.top, bodyWidth - axisLeft - trailingInset - radialPlotPadding.left - radialPlotPadding.right, bodyHeight - axisBottom - radialPlotPadding.top - radialPlotPadding.bottom);
|
|
3653
|
+
return {
|
|
3654
|
+
outer,
|
|
3655
|
+
header: createRect(innerX, innerY, innerWidth, headerHeight),
|
|
3656
|
+
body: createRect(bodyX, bodyY, bodyWidth, bodyHeight),
|
|
3657
|
+
plot,
|
|
3658
|
+
legend
|
|
3659
|
+
};
|
|
3660
|
+
};
|
|
3661
|
+
|
|
3662
|
+
// node_modules/@revivejs/infinity-charts/dist/plugins/plugin-manager.js
|
|
3663
|
+
var PluginManager = class {
|
|
3664
|
+
constructor(initialPlugins = []) {
|
|
3665
|
+
__publicField(this, "plugins", /* @__PURE__ */ new Map());
|
|
3666
|
+
initialPlugins.forEach((plugin) => this.register(plugin));
|
|
3667
|
+
}
|
|
3668
|
+
register(plugin) {
|
|
3669
|
+
this.plugins.set(plugin.id, plugin);
|
|
3670
|
+
}
|
|
3671
|
+
invoke(hook, context) {
|
|
3672
|
+
this.plugins.forEach((plugin) => {
|
|
3673
|
+
var _a, _b;
|
|
3674
|
+
(_b = (_a = plugin.hooks) == null ? void 0 : _a[hook]) == null ? void 0 : _b.call(_a, context);
|
|
3675
|
+
});
|
|
3676
|
+
}
|
|
3677
|
+
list() {
|
|
3678
|
+
return [...this.plugins.values()];
|
|
3679
|
+
}
|
|
3680
|
+
};
|
|
3681
|
+
|
|
3682
|
+
// node_modules/@revivejs/infinity-charts/dist/realtime/render-scheduler.js
|
|
3683
|
+
var RenderScheduler = class {
|
|
3684
|
+
constructor() {
|
|
3685
|
+
__publicField(this, "frameId", 0);
|
|
3686
|
+
__publicField(this, "queued", /* @__PURE__ */ new Set());
|
|
3687
|
+
}
|
|
3688
|
+
schedule(reason, callback) {
|
|
3689
|
+
this.queued.add(reason);
|
|
3690
|
+
if (this.frameId !== 0) {
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3693
|
+
this.frameId = window.requestAnimationFrame(() => {
|
|
3694
|
+
const reasons = [...this.queued.values()];
|
|
3695
|
+
this.queued.clear();
|
|
3696
|
+
this.frameId = 0;
|
|
3697
|
+
callback(reasons);
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3700
|
+
flush(callback) {
|
|
3701
|
+
if (this.queued.size === 0) {
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
const reasons = [...this.queued.values()];
|
|
3705
|
+
this.queued.clear();
|
|
3706
|
+
if (this.frameId !== 0) {
|
|
3707
|
+
window.cancelAnimationFrame(this.frameId);
|
|
3708
|
+
this.frameId = 0;
|
|
3709
|
+
}
|
|
3710
|
+
callback(reasons);
|
|
3711
|
+
}
|
|
3712
|
+
destroy() {
|
|
3713
|
+
if (this.frameId !== 0) {
|
|
3714
|
+
window.cancelAnimationFrame(this.frameId);
|
|
3715
|
+
}
|
|
3716
|
+
this.frameId = 0;
|
|
3717
|
+
this.queued.clear();
|
|
3718
|
+
}
|
|
3719
|
+
};
|
|
3720
|
+
|
|
3721
|
+
// node_modules/@revivejs/infinity-charts/dist/core/chart-engine.js
|
|
3722
|
+
init_scene();
|
|
3723
|
+
|
|
3724
|
+
// node_modules/@revivejs/infinity-charts/dist/renderers/svg/svg-renderer.js
|
|
3725
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
3726
|
+
var tagNameByKind = {
|
|
3727
|
+
group: "g",
|
|
3728
|
+
rect: "rect",
|
|
3729
|
+
path: "path",
|
|
3730
|
+
text: "text",
|
|
3731
|
+
line: "line",
|
|
3732
|
+
circle: "circle"
|
|
3733
|
+
};
|
|
3734
|
+
var SvgRenderer = class {
|
|
3735
|
+
constructor() {
|
|
3736
|
+
__publicField(this, "svg");
|
|
3737
|
+
__publicField(this, "container");
|
|
3738
|
+
__publicField(this, "attrCache", /* @__PURE__ */ new WeakMap());
|
|
3739
|
+
__publicField(this, "styleCache", /* @__PURE__ */ new WeakMap());
|
|
3740
|
+
__publicField(this, "previousChartTypeClass");
|
|
3741
|
+
__publicField(this, "previousThemeClass");
|
|
3742
|
+
this.svg = document.createElementNS(SVG_NS, "svg");
|
|
3743
|
+
this.svg.setAttribute("xmlns", SVG_NS);
|
|
3744
|
+
this.svg.setAttribute("preserveAspectRatio", "xMidYMid meet");
|
|
3745
|
+
this.svg.style.display = "block";
|
|
3746
|
+
this.svg.style.width = "100%";
|
|
3747
|
+
this.svg.style.height = "100%";
|
|
3748
|
+
}
|
|
3749
|
+
mount(container) {
|
|
3750
|
+
this.container = container;
|
|
3751
|
+
container.innerHTML = "";
|
|
3752
|
+
container.classList.add("infinity-chart-host");
|
|
3753
|
+
container.append(this.svg);
|
|
3754
|
+
}
|
|
3755
|
+
resize(width, height) {
|
|
3756
|
+
this.svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
3757
|
+
this.svg.setAttribute("width", String(width));
|
|
3758
|
+
this.svg.setAttribute("height", String(height));
|
|
3759
|
+
}
|
|
3760
|
+
render(scene, options) {
|
|
3761
|
+
var _a, _b;
|
|
3762
|
+
this.applyRootClasses(options.chartType, options.themeMode);
|
|
3763
|
+
this.svg.style.background = (_a = options.background) != null ? _a : "transparent";
|
|
3764
|
+
this.svg.setAttribute("role", "img");
|
|
3765
|
+
this.svg.setAttribute("aria-label", (_b = options.ariaLabel) != null ? _b : "Infinity chart");
|
|
3766
|
+
this.syncChildren(this.svg, scene, options.animation);
|
|
3767
|
+
}
|
|
3768
|
+
destroy() {
|
|
3769
|
+
this.svg.remove();
|
|
3770
|
+
}
|
|
3771
|
+
applyRootClasses(chartType = "chart", themeMode = "light") {
|
|
3772
|
+
const normalizedType = chartType.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
|
|
3773
|
+
const nextTypeClass = `infinity-chart-host--${normalizedType}`;
|
|
3774
|
+
const nextThemeClass = `infinity-chart-theme--${themeMode}`;
|
|
3775
|
+
if (this.container) {
|
|
3776
|
+
if (this.previousChartTypeClass) {
|
|
3777
|
+
this.container.classList.remove(this.previousChartTypeClass);
|
|
3778
|
+
}
|
|
3779
|
+
if (this.previousThemeClass) {
|
|
3780
|
+
this.container.classList.remove(this.previousThemeClass);
|
|
3781
|
+
}
|
|
3782
|
+
this.container.classList.add(nextTypeClass, nextThemeClass);
|
|
3783
|
+
this.container.dataset.infinityChartType = chartType;
|
|
3784
|
+
this.container.dataset.infinityChartTheme = themeMode;
|
|
3785
|
+
}
|
|
3786
|
+
this.svg.setAttribute("class", `infinity-chart-svg infinity-chart-svg--${normalizedType} infinity-chart-theme--${themeMode}`);
|
|
3787
|
+
this.svg.dataset.infinityChartType = chartType;
|
|
3788
|
+
this.svg.dataset.infinityChartTheme = themeMode;
|
|
3789
|
+
this.previousChartTypeClass = nextTypeClass;
|
|
3790
|
+
this.previousThemeClass = nextThemeClass;
|
|
3791
|
+
}
|
|
3792
|
+
syncChildren(parent, nodes, animation) {
|
|
3793
|
+
const existing = /* @__PURE__ */ new Map();
|
|
3794
|
+
Array.from(parent.children).forEach((child) => {
|
|
3795
|
+
const element = child;
|
|
3796
|
+
const id = element.dataset.sceneId;
|
|
3797
|
+
if (id) {
|
|
3798
|
+
existing.set(id, element);
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3801
|
+
let anchor = parent.firstChild;
|
|
3802
|
+
const used = /* @__PURE__ */ new Set();
|
|
3803
|
+
nodes.forEach((node) => {
|
|
3804
|
+
const tagName = tagNameByKind[node.kind];
|
|
3805
|
+
let element = existing.get(node.id);
|
|
3806
|
+
const isNewElement = !element || element.tagName.toLowerCase() !== tagName;
|
|
3807
|
+
if (isNewElement) {
|
|
3808
|
+
element == null ? void 0 : element.remove();
|
|
3809
|
+
element = document.createElementNS(SVG_NS, tagName);
|
|
3810
|
+
element.dataset.sceneId = node.id;
|
|
3811
|
+
}
|
|
3812
|
+
if (!element) {
|
|
3813
|
+
return;
|
|
3814
|
+
}
|
|
3815
|
+
this.applyNode(element, node, animation, isNewElement);
|
|
3816
|
+
if (anchor !== element) {
|
|
3817
|
+
parent.insertBefore(element, anchor);
|
|
3818
|
+
}
|
|
3819
|
+
used.add(node.id);
|
|
3820
|
+
if (node.kind === "text") {
|
|
3821
|
+
} else if (node.children && node.children.length > 0) {
|
|
3822
|
+
this.syncChildren(element, node.children, animation);
|
|
3823
|
+
} else {
|
|
3824
|
+
while (element.firstChild) {
|
|
3825
|
+
element.removeChild(element.firstChild);
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
anchor = element.nextSibling;
|
|
3829
|
+
});
|
|
3830
|
+
existing.forEach((element, id) => {
|
|
3831
|
+
if (!used.has(id)) {
|
|
3832
|
+
element.remove();
|
|
3833
|
+
}
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
applyNode(element, node, animation, isNewElement) {
|
|
3837
|
+
var _a, _b, _c;
|
|
3838
|
+
this.applyAttributes(element, (_a = node.attrs) != null ? _a : {});
|
|
3839
|
+
this.applyStyles(element, {
|
|
3840
|
+
...animation.enabled && node.kind !== "group" ? {
|
|
3841
|
+
transition: `opacity ${animation.duration}ms ${animation.easing}, fill ${animation.duration}ms ${animation.easing}, stroke ${animation.duration}ms ${animation.easing}, transform ${animation.duration}ms ${animation.easing}, filter 160ms ease`
|
|
3842
|
+
} : {},
|
|
3843
|
+
...(_b = node.style) != null ? _b : {}
|
|
3844
|
+
});
|
|
3845
|
+
if (node.kind === "text") {
|
|
3846
|
+
element.textContent = (_c = node.textContent) != null ? _c : "";
|
|
3847
|
+
}
|
|
3848
|
+
if (isNewElement) {
|
|
3849
|
+
this.animateNodeEntry(element, node, animation);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
applyAttributes(element, attrs) {
|
|
3853
|
+
var _a;
|
|
3854
|
+
const previous = (_a = this.attrCache.get(element)) != null ? _a : /* @__PURE__ */ new Set();
|
|
3855
|
+
const next = /* @__PURE__ */ new Set();
|
|
3856
|
+
Object.entries(attrs).forEach(([key, value]) => {
|
|
3857
|
+
if (value === void 0 || value === null || value === false) {
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
element.setAttribute(key, String(value));
|
|
3861
|
+
next.add(key);
|
|
3862
|
+
});
|
|
3863
|
+
previous.forEach((key) => {
|
|
3864
|
+
if (!next.has(key)) {
|
|
3865
|
+
element.removeAttribute(key);
|
|
3866
|
+
}
|
|
3867
|
+
});
|
|
3868
|
+
this.attrCache.set(element, next);
|
|
3869
|
+
}
|
|
3870
|
+
applyStyles(element, styles) {
|
|
3871
|
+
var _a;
|
|
3872
|
+
const previous = (_a = this.styleCache.get(element)) != null ? _a : /* @__PURE__ */ new Set();
|
|
3873
|
+
const next = /* @__PURE__ */ new Set();
|
|
3874
|
+
Object.entries(styles).forEach(([key, value]) => {
|
|
3875
|
+
if (value === void 0) {
|
|
3876
|
+
return;
|
|
3877
|
+
}
|
|
3878
|
+
element.style.setProperty(key, String(value));
|
|
3879
|
+
next.add(key);
|
|
3880
|
+
});
|
|
3881
|
+
previous.forEach((key) => {
|
|
3882
|
+
if (!next.has(key)) {
|
|
3883
|
+
element.style.removeProperty(key);
|
|
3884
|
+
}
|
|
3885
|
+
});
|
|
3886
|
+
this.styleCache.set(element, next);
|
|
3887
|
+
}
|
|
3888
|
+
animateNodeEntry(element, node, animation) {
|
|
3889
|
+
if (!animation.enabled || typeof element.animate !== "function" || node.kind === "group") {
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3892
|
+
const delay = Math.max(0, animation.stagger);
|
|
3893
|
+
if (node.kind === "path" && element.getAttribute("fill") === "none") {
|
|
3894
|
+
const path = element;
|
|
3895
|
+
if (typeof path.getTotalLength === "function") {
|
|
3896
|
+
try {
|
|
3897
|
+
const length = Math.max(1, path.getTotalLength());
|
|
3898
|
+
const previousDasharray = element.style.getPropertyValue("stroke-dasharray");
|
|
3899
|
+
const previousDashoffset = element.style.getPropertyValue("stroke-dashoffset");
|
|
3900
|
+
element.style.setProperty("stroke-dasharray", String(length));
|
|
3901
|
+
element.style.setProperty("stroke-dashoffset", String(length));
|
|
3902
|
+
const animationHandle = element.animate([
|
|
3903
|
+
{ opacity: 0.18, strokeDashoffset: String(length) },
|
|
3904
|
+
{ opacity: 1, strokeDashoffset: "0" }
|
|
3905
|
+
], {
|
|
3906
|
+
duration: animation.duration + 120,
|
|
3907
|
+
delay,
|
|
3908
|
+
easing: animation.easing,
|
|
3909
|
+
fill: "forwards"
|
|
3910
|
+
});
|
|
3911
|
+
void animationHandle.finished.finally(() => {
|
|
3912
|
+
if (previousDasharray) {
|
|
3913
|
+
element.style.setProperty("stroke-dasharray", previousDasharray);
|
|
3914
|
+
} else {
|
|
3915
|
+
element.style.removeProperty("stroke-dasharray");
|
|
3916
|
+
}
|
|
3917
|
+
if (previousDashoffset) {
|
|
3918
|
+
element.style.setProperty("stroke-dashoffset", previousDashoffset);
|
|
3919
|
+
} else {
|
|
3920
|
+
element.style.removeProperty("stroke-dashoffset");
|
|
3921
|
+
}
|
|
3922
|
+
});
|
|
3923
|
+
return;
|
|
3924
|
+
} catch (e) {
|
|
3925
|
+
}
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
element.animate([
|
|
3929
|
+
{
|
|
3930
|
+
opacity: 0,
|
|
3931
|
+
transform: "translateY(10px) scale(0.985)",
|
|
3932
|
+
transformOrigin: "center center"
|
|
3933
|
+
},
|
|
3934
|
+
{
|
|
3935
|
+
opacity: 1,
|
|
3936
|
+
transform: "translateY(0) scale(1)",
|
|
3937
|
+
transformOrigin: "center center"
|
|
3938
|
+
}
|
|
3939
|
+
], {
|
|
3940
|
+
duration: animation.duration,
|
|
3941
|
+
delay,
|
|
3942
|
+
easing: animation.easing,
|
|
3943
|
+
fill: "both"
|
|
3944
|
+
});
|
|
3945
|
+
}
|
|
3946
|
+
};
|
|
3947
|
+
|
|
3948
|
+
// node_modules/@revivejs/infinity-charts/dist/core/chart-registry.js
|
|
3949
|
+
var ChartRegistry = class {
|
|
3950
|
+
constructor() {
|
|
3951
|
+
__publicField(this, "charts", /* @__PURE__ */ new Map());
|
|
3952
|
+
__publicField(this, "loaders", /* @__PURE__ */ new Map());
|
|
3953
|
+
__publicField(this, "pending", /* @__PURE__ */ new Map());
|
|
3954
|
+
}
|
|
3955
|
+
register(definition) {
|
|
3956
|
+
this.charts.set(definition.id, definition);
|
|
3957
|
+
}
|
|
3958
|
+
registerLoader(type, loader) {
|
|
3959
|
+
this.loaders.set(type, loader);
|
|
3960
|
+
}
|
|
3961
|
+
has(type) {
|
|
3962
|
+
return this.charts.has(type);
|
|
3963
|
+
}
|
|
3964
|
+
hasLoader(type) {
|
|
3965
|
+
return this.loaders.has(type);
|
|
3966
|
+
}
|
|
3967
|
+
get(type) {
|
|
3968
|
+
const chart = this.charts.get(type);
|
|
3969
|
+
if (!chart) {
|
|
3970
|
+
throw new Error(`Infinity Charts has no chart registered for "${type}".`);
|
|
3971
|
+
}
|
|
3972
|
+
return chart;
|
|
3973
|
+
}
|
|
3974
|
+
async ensure(type) {
|
|
3975
|
+
if (this.charts.has(type)) {
|
|
3976
|
+
return this.get(type);
|
|
3977
|
+
}
|
|
3978
|
+
const inFlight = this.pending.get(type);
|
|
3979
|
+
if (inFlight) {
|
|
3980
|
+
return inFlight;
|
|
3981
|
+
}
|
|
3982
|
+
const loader = this.loaders.get(type);
|
|
3983
|
+
if (!loader) {
|
|
3984
|
+
throw new Error(`Infinity Charts has no chart registered or loader configured for "${type}".`);
|
|
3985
|
+
}
|
|
3986
|
+
const pending = loader().then((definition) => {
|
|
3987
|
+
this.register(definition);
|
|
3988
|
+
this.pending.delete(type);
|
|
3989
|
+
return this.get(type);
|
|
3990
|
+
}).catch((error) => {
|
|
3991
|
+
this.pending.delete(type);
|
|
3992
|
+
throw error;
|
|
3993
|
+
});
|
|
3994
|
+
this.pending.set(type, pending);
|
|
3995
|
+
return pending;
|
|
3996
|
+
}
|
|
3997
|
+
};
|
|
3998
|
+
|
|
3999
|
+
// node_modules/@revivejs/infinity-charts/dist/animation/animation-engine.js
|
|
4000
|
+
var resolveAnimationOptions = (options) => {
|
|
4001
|
+
var _a, _b, _c, _d, _e;
|
|
4002
|
+
const reducedMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4003
|
+
const enabled = (_a = options == null ? void 0 : options.enabled) != null ? _a : !reducedMotion;
|
|
4004
|
+
const mode = enabled === false ? "none" : (_b = options == null ? void 0 : options.mode) != null ? _b : "subtle";
|
|
4005
|
+
return {
|
|
4006
|
+
enabled,
|
|
4007
|
+
duration: enabled ? (_c = options == null ? void 0 : options.duration) != null ? _c : 320 : 0,
|
|
4008
|
+
easing: (_d = options == null ? void 0 : options.easing) != null ? _d : "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
4009
|
+
stagger: (_e = options == null ? void 0 : options.stagger) != null ? _e : 18,
|
|
4010
|
+
mode,
|
|
4011
|
+
reducedMotion
|
|
4012
|
+
};
|
|
4013
|
+
};
|
|
4014
|
+
|
|
4015
|
+
// node_modules/@revivejs/infinity-charts/dist/utils/deep-merge.js
|
|
4016
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4017
|
+
var deepMerge = (base, patch) => {
|
|
4018
|
+
if (patch === void 0) {
|
|
4019
|
+
return structuredClone(base);
|
|
4020
|
+
}
|
|
4021
|
+
if (!isPlainObject(base) || !isPlainObject(patch)) {
|
|
4022
|
+
return structuredClone(patch != null ? patch : base);
|
|
4023
|
+
}
|
|
4024
|
+
const result = { ...base };
|
|
4025
|
+
Object.entries(patch).forEach(([key, value]) => {
|
|
4026
|
+
if (value === void 0) {
|
|
4027
|
+
return;
|
|
4028
|
+
}
|
|
4029
|
+
const current = result[key];
|
|
4030
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
4031
|
+
result[key] = deepMerge(current, value);
|
|
4032
|
+
return;
|
|
4033
|
+
}
|
|
4034
|
+
result[key] = Array.isArray(value) ? [...value] : value;
|
|
4035
|
+
});
|
|
4036
|
+
return result;
|
|
4037
|
+
};
|
|
4038
|
+
|
|
4039
|
+
// node_modules/@revivejs/infinity-charts/dist/theme/themes.js
|
|
4040
|
+
var lightTheme = {
|
|
4041
|
+
name: "Infinity Light",
|
|
4042
|
+
mode: "light",
|
|
4043
|
+
background: "#faf8f4",
|
|
4044
|
+
surface: "#ffffff",
|
|
4045
|
+
surfaceAlt: "#f5f1eb",
|
|
4046
|
+
plotBackground: "#fffdfa",
|
|
4047
|
+
plotBorder: "#e7ded4",
|
|
4048
|
+
border: "#e4dbd1",
|
|
4049
|
+
grid: "#e8dfd6",
|
|
4050
|
+
axis: "#91867b",
|
|
4051
|
+
text: "#27303b",
|
|
4052
|
+
mutedText: "#736b63",
|
|
4053
|
+
title: "#171d26",
|
|
4054
|
+
legendText: "#27303b",
|
|
4055
|
+
shadow: "0 18px 54px rgba(15, 23, 42, 0.14)",
|
|
4056
|
+
palette: [
|
|
4057
|
+
"#2563eb",
|
|
4058
|
+
"#0ea5e9",
|
|
4059
|
+
"#14b8a6",
|
|
4060
|
+
"#f59e0b",
|
|
4061
|
+
"#ef4444",
|
|
4062
|
+
"#8b5cf6",
|
|
4063
|
+
"#ec4899",
|
|
4064
|
+
"#84cc16"
|
|
4065
|
+
],
|
|
4066
|
+
semantic: {
|
|
4067
|
+
success: "#16a34a",
|
|
4068
|
+
warning: "#d97706",
|
|
4069
|
+
danger: "#dc2626",
|
|
4070
|
+
info: "#0284c7"
|
|
4071
|
+
},
|
|
4072
|
+
fontFamily: '"IBM Plex Sans", system-ui, sans-serif',
|
|
4073
|
+
fontSize: 13,
|
|
4074
|
+
tooltipBackground: "#102038",
|
|
4075
|
+
tooltipText: "#f8fafc",
|
|
4076
|
+
pointStroke: "#ffffff",
|
|
4077
|
+
threshold: "#d97706",
|
|
4078
|
+
gaugeTrack: "#ece2d7",
|
|
4079
|
+
gaugeNeedle: "#102038",
|
|
4080
|
+
interactiveGlow: "rgba(37, 99, 235, 0.22)"
|
|
4081
|
+
};
|
|
4082
|
+
var darkTheme = {
|
|
4083
|
+
name: "Infinity Dark",
|
|
4084
|
+
mode: "dark",
|
|
4085
|
+
background: "#07101d",
|
|
4086
|
+
surface: "#0f172a",
|
|
4087
|
+
surfaceAlt: "#132038",
|
|
4088
|
+
plotBackground: "#0d1628",
|
|
4089
|
+
plotBorder: "#1b2940",
|
|
4090
|
+
border: "#223048",
|
|
4091
|
+
grid: "#22324b",
|
|
4092
|
+
axis: "#7f93ad",
|
|
4093
|
+
text: "#d7e2f1",
|
|
4094
|
+
mutedText: "#8fa4bc",
|
|
4095
|
+
title: "#f8fbff",
|
|
4096
|
+
legendText: "#d7e2f1",
|
|
4097
|
+
shadow: "0 22px 64px rgba(2, 6, 23, 0.55)",
|
|
4098
|
+
palette: [
|
|
4099
|
+
"#60a5fa",
|
|
4100
|
+
"#38bdf8",
|
|
4101
|
+
"#2dd4bf",
|
|
4102
|
+
"#fbbf24",
|
|
4103
|
+
"#fb7185",
|
|
4104
|
+
"#a78bfa",
|
|
4105
|
+
"#f472b6",
|
|
4106
|
+
"#a3e635"
|
|
4107
|
+
],
|
|
4108
|
+
semantic: {
|
|
4109
|
+
success: "#4ade80",
|
|
4110
|
+
warning: "#fbbf24",
|
|
4111
|
+
danger: "#f87171",
|
|
4112
|
+
info: "#38bdf8"
|
|
4113
|
+
},
|
|
4114
|
+
fontFamily: '"IBM Plex Sans", system-ui, sans-serif',
|
|
4115
|
+
fontSize: 13,
|
|
4116
|
+
tooltipBackground: "#e5eefb",
|
|
4117
|
+
tooltipText: "#081221",
|
|
4118
|
+
pointStroke: "#0f172a",
|
|
4119
|
+
threshold: "#fbbf24",
|
|
4120
|
+
gaugeTrack: "#16243b",
|
|
4121
|
+
gaugeNeedle: "#f8fbff",
|
|
4122
|
+
interactiveGlow: "rgba(96, 165, 250, 0.26)"
|
|
4123
|
+
};
|
|
4124
|
+
|
|
4125
|
+
// node_modules/@revivejs/infinity-charts/dist/theme/theme-engine.js
|
|
4126
|
+
var withCssVarFallback = (name, fallback) => `var(${name}, ${fallback})`;
|
|
4127
|
+
var wrapThemeWithCssVariables = (theme) => ({
|
|
4128
|
+
...theme,
|
|
4129
|
+
background: withCssVarFallback("--ic-background", theme.background),
|
|
4130
|
+
surface: withCssVarFallback("--ic-surface", theme.surface),
|
|
4131
|
+
surfaceAlt: withCssVarFallback("--ic-surface-alt", theme.surfaceAlt),
|
|
4132
|
+
plotBackground: withCssVarFallback("--ic-plot-background", theme.plotBackground),
|
|
4133
|
+
plotBorder: withCssVarFallback("--ic-plot-border", theme.plotBorder),
|
|
4134
|
+
border: withCssVarFallback("--ic-border", theme.border),
|
|
4135
|
+
grid: withCssVarFallback("--ic-grid", theme.grid),
|
|
4136
|
+
axis: withCssVarFallback("--ic-axis", theme.axis),
|
|
4137
|
+
text: withCssVarFallback("--ic-text", theme.text),
|
|
4138
|
+
mutedText: withCssVarFallback("--ic-muted-text", theme.mutedText),
|
|
4139
|
+
title: withCssVarFallback("--ic-title", theme.title),
|
|
4140
|
+
legendText: withCssVarFallback("--ic-legend-text", theme.legendText),
|
|
4141
|
+
shadow: withCssVarFallback("--ic-shadow", theme.shadow),
|
|
4142
|
+
palette: theme.palette.map((color, index) => withCssVarFallback(`--ic-series-${index + 1}`, color)),
|
|
4143
|
+
semantic: {
|
|
4144
|
+
success: withCssVarFallback("--ic-success", theme.semantic.success),
|
|
4145
|
+
warning: withCssVarFallback("--ic-warning", theme.semantic.warning),
|
|
4146
|
+
danger: withCssVarFallback("--ic-danger", theme.semantic.danger),
|
|
4147
|
+
info: withCssVarFallback("--ic-info", theme.semantic.info)
|
|
4148
|
+
},
|
|
4149
|
+
fontFamily: withCssVarFallback("--ic-font-family", theme.fontFamily),
|
|
4150
|
+
tooltipBackground: withCssVarFallback("--ic-tooltip-background", theme.tooltipBackground),
|
|
4151
|
+
tooltipText: withCssVarFallback("--ic-tooltip-text", theme.tooltipText),
|
|
4152
|
+
pointStroke: withCssVarFallback("--ic-point-stroke", theme.pointStroke),
|
|
4153
|
+
threshold: withCssVarFallback("--ic-threshold", theme.threshold),
|
|
4154
|
+
gaugeTrack: withCssVarFallback("--ic-gauge-track", theme.gaugeTrack),
|
|
4155
|
+
gaugeNeedle: withCssVarFallback("--ic-gauge-needle", theme.gaugeNeedle),
|
|
4156
|
+
interactiveGlow: withCssVarFallback("--ic-interactive-glow", theme.interactiveGlow)
|
|
4157
|
+
});
|
|
4158
|
+
var resolveTheme = (theme, paletteOverride = [], colors) => {
|
|
4159
|
+
const base = theme === "dark" ? darkTheme : typeof theme === "object" && (theme == null ? void 0 : theme.mode) === "dark" ? darkTheme : lightTheme;
|
|
4160
|
+
const merged = typeof theme === "object" ? deepMerge(base, theme) : deepMerge(base);
|
|
4161
|
+
if (paletteOverride.length > 0) {
|
|
4162
|
+
merged.palette = [...paletteOverride];
|
|
4163
|
+
}
|
|
4164
|
+
if (colors) {
|
|
4165
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
4166
|
+
if (value !== void 0) {
|
|
4167
|
+
merged[key] = value;
|
|
4168
|
+
}
|
|
4169
|
+
});
|
|
4170
|
+
}
|
|
4171
|
+
return wrapThemeWithCssVariables(merged);
|
|
4172
|
+
};
|
|
4173
|
+
|
|
4174
|
+
// node_modules/@revivejs/infinity-charts/dist/core/defaults.js
|
|
4175
|
+
var DEFAULT_PADDING = {
|
|
4176
|
+
top: 20,
|
|
4177
|
+
right: 20,
|
|
4178
|
+
bottom: 20,
|
|
4179
|
+
left: 20
|
|
4180
|
+
};
|
|
4181
|
+
var DEFAULT_PLOT_PADDING = {
|
|
4182
|
+
top: 8,
|
|
4183
|
+
right: 8,
|
|
4184
|
+
bottom: 8,
|
|
4185
|
+
left: 8
|
|
4186
|
+
};
|
|
4187
|
+
var measureWidgetTypes = /* @__PURE__ */ new Set([
|
|
4188
|
+
"gauge",
|
|
4189
|
+
"gauge-semicircle",
|
|
4190
|
+
"radial-progress",
|
|
4191
|
+
"thermometer",
|
|
4192
|
+
"thermometer-horizontal",
|
|
4193
|
+
"battery"
|
|
4194
|
+
]);
|
|
4195
|
+
var radialChartTypes = /* @__PURE__ */ new Set(["pie", "donut"]);
|
|
4196
|
+
var resolveMargin = (input, fallback) => {
|
|
4197
|
+
var _a, _b, _c, _d;
|
|
4198
|
+
return {
|
|
4199
|
+
top: (_a = input == null ? void 0 : input.top) != null ? _a : fallback.top,
|
|
4200
|
+
right: (_b = input == null ? void 0 : input.right) != null ? _b : fallback.right,
|
|
4201
|
+
bottom: (_c = input == null ? void 0 : input.bottom) != null ? _c : fallback.bottom,
|
|
4202
|
+
left: (_d = input == null ? void 0 : input.left) != null ? _d : fallback.left
|
|
4203
|
+
};
|
|
4204
|
+
};
|
|
4205
|
+
var resolveTitle = (title) => {
|
|
4206
|
+
var _a, _b, _c;
|
|
4207
|
+
if (typeof title === "string") {
|
|
4208
|
+
return {
|
|
4209
|
+
text: title,
|
|
4210
|
+
subtitle: "",
|
|
4211
|
+
align: "start"
|
|
4212
|
+
};
|
|
4213
|
+
}
|
|
4214
|
+
return {
|
|
4215
|
+
text: (_a = title == null ? void 0 : title.text) != null ? _a : "",
|
|
4216
|
+
subtitle: (_b = title == null ? void 0 : title.subtitle) != null ? _b : "",
|
|
4217
|
+
align: (_c = title == null ? void 0 : title.align) != null ? _c : "start"
|
|
4218
|
+
};
|
|
4219
|
+
};
|
|
4220
|
+
var resolveLayout = (config) => {
|
|
4221
|
+
var _a, _b, _c, _d, _e;
|
|
4222
|
+
return {
|
|
4223
|
+
padding: resolveMargin((_a = config.layout) == null ? void 0 : _a.padding, DEFAULT_PADDING),
|
|
4224
|
+
plotPadding: resolveMargin((_b = config.layout) == null ? void 0 : _b.plotPadding, DEFAULT_PLOT_PADDING),
|
|
4225
|
+
cornerRadius: (_d = (_c = config.layout) == null ? void 0 : _c.cornerRadius) != null ? _d : 20,
|
|
4226
|
+
background: (_e = config.layout) == null ? void 0 : _e.background
|
|
4227
|
+
};
|
|
4228
|
+
};
|
|
4229
|
+
var resolveInteraction = (config) => {
|
|
4230
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4231
|
+
const enabled = (_b = (_a = config.interaction) == null ? void 0 : _a.enabled) != null ? _b : true;
|
|
4232
|
+
const showTooltip = (_e = (_d = config.showTooltip) != null ? _d : (_c = config.interaction) == null ? void 0 : _c.tooltip) != null ? _e : true;
|
|
4233
|
+
return {
|
|
4234
|
+
enabled,
|
|
4235
|
+
tooltip: enabled && showTooltip,
|
|
4236
|
+
hover: enabled && ((_g = (_f = config.interaction) == null ? void 0 : _f.hover) != null ? _g : true),
|
|
4237
|
+
click: enabled && ((_i = (_h = config.interaction) == null ? void 0 : _h.click) != null ? _i : true)
|
|
4238
|
+
};
|
|
4239
|
+
};
|
|
4240
|
+
var resolveBar3D = (config, theme) => {
|
|
4241
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
4242
|
+
return {
|
|
4243
|
+
depthX: (_b = (_a = config.bar3d) == null ? void 0 : _a.depthX) != null ? _b : 24,
|
|
4244
|
+
depthY: (_d = (_c = config.bar3d) == null ? void 0 : _c.depthY) != null ? _d : 16,
|
|
4245
|
+
topLightness: (_f = (_e = config.bar3d) == null ? void 0 : _e.topLightness) != null ? _f : 0.14,
|
|
4246
|
+
sideLightness: (_h = (_g = config.bar3d) == null ? void 0 : _g.sideLightness) != null ? _h : -0.18,
|
|
4247
|
+
floorColor: (_j = (_i = config.bar3d) == null ? void 0 : _i.floorColor) != null ? _j : theme.surfaceAlt,
|
|
4248
|
+
floorLineColor: (_l = (_k = config.bar3d) == null ? void 0 : _k.floorLineColor) != null ? _l : theme.plotBorder,
|
|
4249
|
+
shadowColor: (_n = (_m = config.bar3d) == null ? void 0 : _m.shadowColor) != null ? _n : theme.mode === "dark" ? "rgba(2, 6, 23, 0.42)" : "rgba(15, 23, 42, 0.14)"
|
|
4250
|
+
};
|
|
4251
|
+
};
|
|
4252
|
+
var createGaugeBandsFromThresholds = (min, max, thresholds, theme) => {
|
|
4253
|
+
const sorted = [...thresholds != null ? thresholds : []].filter((threshold) => {
|
|
4254
|
+
var _a;
|
|
4255
|
+
return ((_a = threshold.axis) != null ? _a : "y") === "y";
|
|
4256
|
+
}).map((threshold) => threshold.value).filter((value) => value > min && value < max).sort((left, right) => left - right);
|
|
4257
|
+
if (sorted.length === 0) {
|
|
4258
|
+
return [];
|
|
4259
|
+
}
|
|
4260
|
+
const points = [min, ...sorted, max];
|
|
4261
|
+
const fallbackColors = [
|
|
4262
|
+
theme.semantic.success,
|
|
4263
|
+
theme.semantic.warning,
|
|
4264
|
+
theme.semantic.danger
|
|
4265
|
+
];
|
|
4266
|
+
return points.slice(0, -1).map((from, index) => {
|
|
4267
|
+
var _a;
|
|
4268
|
+
return {
|
|
4269
|
+
from,
|
|
4270
|
+
to: (_a = points[index + 1]) != null ? _a : max,
|
|
4271
|
+
color: fallbackColors[Math.min(index, fallbackColors.length - 1)],
|
|
4272
|
+
label: index === 0 ? "Optimal" : index === points.length - 2 ? "Critical" : "Attention"
|
|
4273
|
+
};
|
|
4274
|
+
});
|
|
4275
|
+
};
|
|
4276
|
+
var resolveGauge = (config, theme) => {
|
|
4277
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
4278
|
+
const min = (_d = (_c = (_a = config.gauge) == null ? void 0 : _a.min) != null ? _c : (_b = config.yAxis) == null ? void 0 : _b.min) != null ? _d : 0;
|
|
4279
|
+
const configuredMax = (_h = (_g = (_e = config.gauge) == null ? void 0 : _e.max) != null ? _g : (_f = config.yAxis) == null ? void 0 : _f.max) != null ? _h : 100;
|
|
4280
|
+
const max = configuredMax > min ? configuredMax : min + 1;
|
|
4281
|
+
const thresholdBands = createGaugeBandsFromThresholds(min, max, config.thresholds, theme);
|
|
4282
|
+
const defaultBands = [
|
|
4283
|
+
{
|
|
4284
|
+
from: min,
|
|
4285
|
+
to: min + (max - min) * 0.6,
|
|
4286
|
+
color: theme.semantic.success,
|
|
4287
|
+
label: "Healthy"
|
|
4288
|
+
},
|
|
4289
|
+
{
|
|
4290
|
+
from: min + (max - min) * 0.6,
|
|
4291
|
+
to: min + (max - min) * 0.85,
|
|
4292
|
+
color: theme.semantic.warning,
|
|
4293
|
+
label: "Attention"
|
|
4294
|
+
},
|
|
4295
|
+
{
|
|
4296
|
+
from: min + (max - min) * 0.85,
|
|
4297
|
+
to: max,
|
|
4298
|
+
color: theme.semantic.danger,
|
|
4299
|
+
label: "Critical"
|
|
4300
|
+
}
|
|
4301
|
+
];
|
|
4302
|
+
const bands = ((_j = (_i = config.gauge) == null ? void 0 : _i.bands) == null ? void 0 : _j.length) ? config.gauge.bands.map((band, index) => {
|
|
4303
|
+
var _a2;
|
|
4304
|
+
return {
|
|
4305
|
+
from: Math.max(min, Math.min(max, band.from)),
|
|
4306
|
+
to: Math.max(min, Math.min(max, band.to)),
|
|
4307
|
+
color: band.color,
|
|
4308
|
+
label: (_a2 = band.label) != null ? _a2 : `Band ${index + 1}`
|
|
4309
|
+
};
|
|
4310
|
+
}) : thresholdBands.length ? thresholdBands : defaultBands;
|
|
4311
|
+
return {
|
|
4312
|
+
min,
|
|
4313
|
+
max,
|
|
4314
|
+
unit: (_l = (_k = config.gauge) == null ? void 0 : _k.unit) != null ? _l : "",
|
|
4315
|
+
label: (_n = (_m = config.gauge) == null ? void 0 : _m.label) != null ? _n : "",
|
|
4316
|
+
startAngle: (_p = (_o = config.gauge) == null ? void 0 : _o.startAngle) != null ? _p : Math.PI * 5 / 4,
|
|
4317
|
+
endAngle: (_r = (_q = config.gauge) == null ? void 0 : _q.endAngle) != null ? _r : Math.PI * 11 / 4,
|
|
4318
|
+
needle: (_t = (_s = config.gauge) == null ? void 0 : _s.needle) != null ? _t : true,
|
|
4319
|
+
trackColor: (_v = (_u = config.gauge) == null ? void 0 : _u.trackColor) != null ? _v : theme.gaugeTrack,
|
|
4320
|
+
bands,
|
|
4321
|
+
valueFormatter: (_w = config.gauge) == null ? void 0 : _w.valueFormatter
|
|
4322
|
+
};
|
|
4323
|
+
};
|
|
4324
|
+
var resolveChartConfig = (config, container) => {
|
|
4325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa;
|
|
4326
|
+
const theme = resolveTheme(config.theme, (_a = config.palette) != null ? _a : [], config.colors);
|
|
4327
|
+
const compactSparkline = config.type === "sparkline";
|
|
4328
|
+
const compactMeasureWidget = measureWidgetTypes.has(config.type);
|
|
4329
|
+
const radialChart = radialChartTypes.has(config.type);
|
|
4330
|
+
const compactWidget = compactSparkline || compactMeasureWidget;
|
|
4331
|
+
return {
|
|
4332
|
+
...config,
|
|
4333
|
+
container,
|
|
4334
|
+
showNumber: (_b = config.showNumber) != null ? _b : true,
|
|
4335
|
+
showLegend: (_e = (_d = config.showLegend) != null ? _d : (_c = config.legend) == null ? void 0 : _c.show) != null ? _e : !compactWidget,
|
|
4336
|
+
showTooltip: (_h = (_g = config.showTooltip) != null ? _g : (_f = config.interaction) == null ? void 0 : _f.tooltip) != null ? _h : true,
|
|
4337
|
+
title: resolveTitle(config.title),
|
|
4338
|
+
theme,
|
|
4339
|
+
colors: { ...(_i = config.colors) != null ? _i : {} },
|
|
4340
|
+
renderer: (_j = config.renderer) != null ? _j : "svg",
|
|
4341
|
+
palette: ((_k = config.palette) == null ? void 0 : _k.length) ? [...config.palette] : [...theme.palette],
|
|
4342
|
+
animation: resolveAnimationOptions(config.animation),
|
|
4343
|
+
bar3d: resolveBar3D(config, theme),
|
|
4344
|
+
responsive: {
|
|
4345
|
+
enabled: (_m = (_l = config.responsive) == null ? void 0 : _l.enabled) != null ? _m : true,
|
|
4346
|
+
debounceMs: (_o = (_n = config.responsive) == null ? void 0 : _n.debounceMs) != null ? _o : 48,
|
|
4347
|
+
minHeight: (_q = (_p = config.responsive) == null ? void 0 : _p.minHeight) != null ? _q : compactSparkline ? 120 : compactMeasureWidget ? 240 : radialChart ? 340 : 280
|
|
4348
|
+
},
|
|
4349
|
+
interaction: resolveInteraction(config),
|
|
4350
|
+
realtime: {
|
|
4351
|
+
enabled: (_s = (_r = config.realtime) == null ? void 0 : _r.enabled) != null ? _s : false,
|
|
4352
|
+
maxPoints: (_u = (_t = config.realtime) == null ? void 0 : _t.maxPoints) != null ? _u : 0,
|
|
4353
|
+
batchWindowMs: (_w = (_v = config.realtime) == null ? void 0 : _v.batchWindowMs) != null ? _w : 0,
|
|
4354
|
+
preserveDomain: (_y = (_x = config.realtime) == null ? void 0 : _x.preserveDomain) != null ? _y : false
|
|
4355
|
+
},
|
|
4356
|
+
layout: resolveLayout(config),
|
|
4357
|
+
xAxis: {
|
|
4358
|
+
show: (_A = (_z = config.xAxis) == null ? void 0 : _z.show) != null ? _A : !compactWidget,
|
|
4359
|
+
title: (_C = (_B = config.xAxis) == null ? void 0 : _B.title) != null ? _C : "",
|
|
4360
|
+
tickCount: (_E = (_D = config.xAxis) == null ? void 0 : _D.tickCount) != null ? _E : 5,
|
|
4361
|
+
min: (_F = config.xAxis) == null ? void 0 : _F.min,
|
|
4362
|
+
max: (_G = config.xAxis) == null ? void 0 : _G.max,
|
|
4363
|
+
nice: (_I = (_H = config.xAxis) == null ? void 0 : _H.nice) != null ? _I : false,
|
|
4364
|
+
format: (_J = config.xAxis) == null ? void 0 : _J.format
|
|
4365
|
+
},
|
|
4366
|
+
yAxis: {
|
|
4367
|
+
show: (_L = (_K = config.yAxis) == null ? void 0 : _K.show) != null ? _L : !compactWidget,
|
|
4368
|
+
title: (_N = (_M = config.yAxis) == null ? void 0 : _M.title) != null ? _N : "",
|
|
4369
|
+
tickCount: (_P = (_O = config.yAxis) == null ? void 0 : _O.tickCount) != null ? _P : 5,
|
|
4370
|
+
min: (_Q = config.yAxis) == null ? void 0 : _Q.min,
|
|
4371
|
+
max: (_R = config.yAxis) == null ? void 0 : _R.max,
|
|
4372
|
+
nice: (_T = (_S = config.yAxis) == null ? void 0 : _S.nice) != null ? _T : true,
|
|
4373
|
+
format: (_U = config.yAxis) == null ? void 0 : _U.format
|
|
4374
|
+
},
|
|
4375
|
+
grid: {
|
|
4376
|
+
show: (_W = (_V = config.grid) == null ? void 0 : _V.show) != null ? _W : !compactWidget,
|
|
4377
|
+
x: (_Y = (_X = config.grid) == null ? void 0 : _X.x) != null ? _Y : false,
|
|
4378
|
+
y: (__ = (_Z = config.grid) == null ? void 0 : _Z.y) != null ? __ : true,
|
|
4379
|
+
color: (_aa = (_$ = config.grid) == null ? void 0 : _$.color) != null ? _aa : theme.grid,
|
|
4380
|
+
opacity: (_ca = (_ba = config.grid) == null ? void 0 : _ba.opacity) != null ? _ca : 1
|
|
4381
|
+
},
|
|
4382
|
+
legend: {
|
|
4383
|
+
show: (_fa = (_ea = config.showLegend) != null ? _ea : (_da = config.legend) == null ? void 0 : _da.show) != null ? _fa : !compactWidget,
|
|
4384
|
+
position: (_ha = (_ga = config.legend) == null ? void 0 : _ga.position) != null ? _ha : "bottom",
|
|
4385
|
+
align: (_ja = (_ia = config.legend) == null ? void 0 : _ia.align) != null ? _ja : "start"
|
|
4386
|
+
},
|
|
4387
|
+
gauge: {
|
|
4388
|
+
...resolveGauge(config, theme),
|
|
4389
|
+
startAngle: (_la = (_ka = config.gauge) == null ? void 0 : _ka.startAngle) != null ? _la : config.type === "gauge-semicircle" ? Math.PI * 3 / 2 : config.type === "radial-progress" ? 1e-3 : Math.PI * 5 / 4,
|
|
4390
|
+
endAngle: (_na = (_ma = config.gauge) == null ? void 0 : _ma.endAngle) != null ? _na : config.type === "gauge-semicircle" ? Math.PI * 5 / 2 : config.type === "radial-progress" ? Math.PI * 2 - 1e-3 : Math.PI * 11 / 4,
|
|
4391
|
+
needle: (_pa = (_oa = config.gauge) == null ? void 0 : _oa.needle) != null ? _pa : config.type === "radial-progress" ? false : true
|
|
4392
|
+
},
|
|
4393
|
+
thresholds: [...(_qa = config.thresholds) != null ? _qa : []],
|
|
4394
|
+
plugins: [...(_ra = config.plugins) != null ? _ra : []],
|
|
4395
|
+
states: { ...(_sa = config.states) != null ? _sa : {} }
|
|
4396
|
+
};
|
|
4397
|
+
};
|
|
4398
|
+
|
|
4399
|
+
// node_modules/@revivejs/infinity-charts/dist/utils/dom.js
|
|
4400
|
+
var resolveContainer = (input) => {
|
|
4401
|
+
if (typeof input !== "string") {
|
|
4402
|
+
return input;
|
|
4403
|
+
}
|
|
4404
|
+
const element = document.querySelector(input);
|
|
4405
|
+
if (!element) {
|
|
4406
|
+
throw new Error(`Infinity Charts could not find container: ${input}`);
|
|
4407
|
+
}
|
|
4408
|
+
return element;
|
|
4409
|
+
};
|
|
4410
|
+
var measureContainer = (element, width, height, minHeight = 280) => {
|
|
4411
|
+
var _a, _b;
|
|
4412
|
+
const measuredWidth = (_a = width != null ? width : element.clientWidth) != null ? _a : 720;
|
|
4413
|
+
const measuredHeight = (_b = height != null ? height : element.clientHeight) != null ? _b : minHeight;
|
|
4414
|
+
return {
|
|
4415
|
+
width: Math.max(240, measuredWidth),
|
|
4416
|
+
height: Math.max(minHeight, measuredHeight)
|
|
4417
|
+
};
|
|
4418
|
+
};
|
|
4419
|
+
var debounce = (callback, waitMs) => {
|
|
4420
|
+
let timeoutId = 0;
|
|
4421
|
+
return ((...args) => {
|
|
4422
|
+
window.clearTimeout(timeoutId);
|
|
4423
|
+
timeoutId = window.setTimeout(() => {
|
|
4424
|
+
callback(...args);
|
|
4425
|
+
}, waitMs);
|
|
4426
|
+
});
|
|
4427
|
+
};
|
|
4428
|
+
|
|
4429
|
+
// node_modules/@revivejs/infinity-charts/dist/core/chart-engine.js
|
|
4430
|
+
var buildStatusScene = (size, config, options) => {
|
|
4431
|
+
var _a, _b;
|
|
4432
|
+
return [
|
|
4433
|
+
rectNode("status-surface", {
|
|
4434
|
+
x: 0,
|
|
4435
|
+
y: 0,
|
|
4436
|
+
width: size.width,
|
|
4437
|
+
height: size.height,
|
|
4438
|
+
rx: config.layout.cornerRadius,
|
|
4439
|
+
fill: (_a = config.layout.background) != null ? _a : config.theme.surface,
|
|
4440
|
+
stroke: config.theme.border,
|
|
4441
|
+
"stroke-width": 1
|
|
4442
|
+
}),
|
|
4443
|
+
rectNode("status-card", {
|
|
4444
|
+
x: Math.max(24, size.width * 0.08),
|
|
4445
|
+
y: Math.max(32, size.height * 0.22),
|
|
4446
|
+
width: Math.max(220, size.width * 0.84),
|
|
4447
|
+
height: Math.max(120, size.height * 0.38),
|
|
4448
|
+
rx: 20,
|
|
4449
|
+
fill: config.theme.plotBackground,
|
|
4450
|
+
stroke: config.theme.border,
|
|
4451
|
+
"stroke-width": 1
|
|
4452
|
+
}),
|
|
4453
|
+
rectNode("status-accent", {
|
|
4454
|
+
x: Math.max(44, size.width * 0.12),
|
|
4455
|
+
y: Math.max(54, size.height * 0.3),
|
|
4456
|
+
width: 68,
|
|
4457
|
+
height: 8,
|
|
4458
|
+
rx: 999,
|
|
4459
|
+
fill: (_b = options.accent) != null ? _b : config.theme.palette[0],
|
|
4460
|
+
opacity: 0.88
|
|
4461
|
+
}),
|
|
4462
|
+
textNode("status-title", options.title, {
|
|
4463
|
+
x: Math.max(44, size.width * 0.12),
|
|
4464
|
+
y: Math.max(102, size.height * 0.38),
|
|
4465
|
+
fill: config.theme.title,
|
|
4466
|
+
"font-family": config.theme.fontFamily,
|
|
4467
|
+
"font-size": config.theme.fontSize + 14,
|
|
4468
|
+
"font-weight": 700
|
|
4469
|
+
}),
|
|
4470
|
+
textNode("status-subtitle", options.subtitle, {
|
|
4471
|
+
x: Math.max(44, size.width * 0.12),
|
|
4472
|
+
y: Math.max(132, size.height * 0.38),
|
|
4473
|
+
fill: config.theme.mutedText,
|
|
4474
|
+
"font-family": config.theme.fontFamily,
|
|
4475
|
+
"font-size": config.theme.fontSize + 1
|
|
4476
|
+
})
|
|
4477
|
+
];
|
|
4478
|
+
};
|
|
4479
|
+
var ChartEngine = class {
|
|
4480
|
+
constructor(config, options) {
|
|
4481
|
+
__publicField(this, "registry");
|
|
4482
|
+
__publicField(this, "renderer", new SvgRenderer());
|
|
4483
|
+
__publicField(this, "scheduler", new RenderScheduler());
|
|
4484
|
+
__publicField(this, "events", new EventEmitter());
|
|
4485
|
+
__publicField(this, "pluginManager");
|
|
4486
|
+
__publicField(this, "container");
|
|
4487
|
+
__publicField(this, "resizeHandler");
|
|
4488
|
+
__publicField(this, "interaction");
|
|
4489
|
+
__publicField(this, "resizeObserver");
|
|
4490
|
+
__publicField(this, "destroyed", false);
|
|
4491
|
+
__publicField(this, "inputConfig");
|
|
4492
|
+
__publicField(this, "resolvedConfig");
|
|
4493
|
+
__publicField(this, "renderId", 0);
|
|
4494
|
+
__publicField(this, "renderPromise", Promise.resolve());
|
|
4495
|
+
var _a;
|
|
4496
|
+
this.registry = options.registry;
|
|
4497
|
+
this.container = resolveContainer(config.container);
|
|
4498
|
+
this.inputConfig = { ...config, container: this.container };
|
|
4499
|
+
this.resolvedConfig = resolveChartConfig(this.inputConfig, this.container);
|
|
4500
|
+
this.pluginManager = new PluginManager([
|
|
4501
|
+
...(_a = options.globalPlugins) != null ? _a : [],
|
|
4502
|
+
...this.resolvedConfig.plugins
|
|
4503
|
+
]);
|
|
4504
|
+
this.renderer.mount(this.container);
|
|
4505
|
+
this.interaction = new InteractionLayer(this.container, this.events);
|
|
4506
|
+
this.interaction.update(this.resolvedConfig);
|
|
4507
|
+
this.pluginManager.invoke("beforeInit", this.createPluginContext("init"));
|
|
4508
|
+
this.render(["init"]);
|
|
4509
|
+
void this.ready().then(() => {
|
|
4510
|
+
if (!this.destroyed) {
|
|
4511
|
+
this.pluginManager.invoke("afterInit", this.createPluginContext("init"));
|
|
4512
|
+
}
|
|
4513
|
+
}).catch(() => {
|
|
4514
|
+
});
|
|
4515
|
+
this.resizeHandler = debounce(() => {
|
|
4516
|
+
this.resize();
|
|
4517
|
+
}, this.resolvedConfig.responsive.debounceMs);
|
|
4518
|
+
this.installResponsiveHandling();
|
|
4519
|
+
}
|
|
4520
|
+
ready() {
|
|
4521
|
+
return this.renderPromise;
|
|
4522
|
+
}
|
|
4523
|
+
update(config) {
|
|
4524
|
+
this.inputConfig = {
|
|
4525
|
+
...this.inputConfig,
|
|
4526
|
+
...config,
|
|
4527
|
+
container: this.container
|
|
4528
|
+
};
|
|
4529
|
+
this.refreshResolvedConfig();
|
|
4530
|
+
this.scheduleRender("config");
|
|
4531
|
+
}
|
|
4532
|
+
updateSeries(series) {
|
|
4533
|
+
this.inputConfig.series = series;
|
|
4534
|
+
this.inputConfig.data = void 0;
|
|
4535
|
+
this.refreshResolvedConfig();
|
|
4536
|
+
this.scheduleRender("series");
|
|
4537
|
+
}
|
|
4538
|
+
appendData(point) {
|
|
4539
|
+
appendDataPoint(this.inputConfig, point);
|
|
4540
|
+
this.refreshResolvedConfig();
|
|
4541
|
+
this.scheduleRender("realtime");
|
|
4542
|
+
}
|
|
4543
|
+
appendBatch(points) {
|
|
4544
|
+
points.forEach((point) => appendDataPoint(this.inputConfig, point));
|
|
4545
|
+
this.refreshResolvedConfig();
|
|
4546
|
+
this.scheduleRender("realtime");
|
|
4547
|
+
}
|
|
4548
|
+
replaceData(data) {
|
|
4549
|
+
this.inputConfig.data = data;
|
|
4550
|
+
this.inputConfig.series = void 0;
|
|
4551
|
+
this.refreshResolvedConfig();
|
|
4552
|
+
this.scheduleRender("data");
|
|
4553
|
+
}
|
|
4554
|
+
resize(width, height) {
|
|
4555
|
+
if (width !== void 0) {
|
|
4556
|
+
this.inputConfig.width = width;
|
|
4557
|
+
}
|
|
4558
|
+
if (height !== void 0) {
|
|
4559
|
+
this.inputConfig.height = height;
|
|
4560
|
+
}
|
|
4561
|
+
this.refreshResolvedConfig();
|
|
4562
|
+
this.scheduleRender("resize");
|
|
4563
|
+
}
|
|
4564
|
+
setTheme(theme) {
|
|
4565
|
+
this.inputConfig.theme = theme;
|
|
4566
|
+
this.refreshResolvedConfig();
|
|
4567
|
+
this.scheduleRender("theme");
|
|
4568
|
+
}
|
|
4569
|
+
registerPlugin(plugin) {
|
|
4570
|
+
this.pluginManager.register(plugin);
|
|
4571
|
+
this.scheduleRender("plugin");
|
|
4572
|
+
}
|
|
4573
|
+
registerPack(pack) {
|
|
4574
|
+
var _a;
|
|
4575
|
+
pack.charts.forEach((chart) => this.registry.register(chart));
|
|
4576
|
+
(_a = pack.plugins) == null ? void 0 : _a.forEach((plugin) => this.pluginManager.register(plugin));
|
|
4577
|
+
this.scheduleRender("plugin");
|
|
4578
|
+
}
|
|
4579
|
+
on(event, handler) {
|
|
4580
|
+
return this.events.on(event, handler);
|
|
4581
|
+
}
|
|
4582
|
+
destroy() {
|
|
4583
|
+
var _a;
|
|
4584
|
+
if (this.destroyed) {
|
|
4585
|
+
return;
|
|
4586
|
+
}
|
|
4587
|
+
this.destroyed = true;
|
|
4588
|
+
this.pluginManager.invoke("beforeDestroy", this.createPluginContext("config"));
|
|
4589
|
+
(_a = this.resizeObserver) == null ? void 0 : _a.disconnect();
|
|
4590
|
+
globalThis.removeEventListener("resize", this.resizeHandler);
|
|
4591
|
+
this.scheduler.destroy();
|
|
4592
|
+
this.events.emit("destroy");
|
|
4593
|
+
this.events.clear();
|
|
4594
|
+
this.interaction.destroy();
|
|
4595
|
+
this.renderer.destroy();
|
|
4596
|
+
this.pluginManager.invoke("afterDestroy", this.createPluginContext("config"));
|
|
4597
|
+
}
|
|
4598
|
+
installResponsiveHandling() {
|
|
4599
|
+
if (!this.resolvedConfig.responsive.enabled) {
|
|
4600
|
+
return;
|
|
4601
|
+
}
|
|
4602
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
4603
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
4604
|
+
this.resizeHandler();
|
|
4605
|
+
});
|
|
4606
|
+
this.resizeObserver.observe(this.container);
|
|
4607
|
+
return;
|
|
4608
|
+
}
|
|
4609
|
+
globalThis.addEventListener("resize", this.resizeHandler);
|
|
4610
|
+
}
|
|
4611
|
+
scheduleRender(reason) {
|
|
4612
|
+
this.pluginManager.invoke("onUpdate", this.createPluginContext(reason));
|
|
4613
|
+
this.scheduler.schedule(reason, (reasons) => {
|
|
4614
|
+
this.render(reasons);
|
|
4615
|
+
});
|
|
4616
|
+
}
|
|
4617
|
+
render(reasons) {
|
|
4618
|
+
const nextRenderId = ++this.renderId;
|
|
4619
|
+
const promise = this.renderInternal(reasons, nextRenderId);
|
|
4620
|
+
this.renderPromise = promise;
|
|
4621
|
+
void promise.catch(() => {
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4624
|
+
async renderInternal(reasons, renderId) {
|
|
4625
|
+
var _a;
|
|
4626
|
+
if (this.destroyed) {
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4629
|
+
const payload = normalizeChartPayload(this.resolvedConfig);
|
|
4630
|
+
const size = measureContainer(this.container, this.resolvedConfig.width, this.resolvedConfig.height, this.resolvedConfig.responsive.minHeight);
|
|
4631
|
+
const frame = createChartFrame(this.resolvedConfig, size, payload);
|
|
4632
|
+
const chartType = this.resolvedConfig.type;
|
|
4633
|
+
const reason = (_a = reasons[0]) != null ? _a : "config";
|
|
4634
|
+
const shouldLazyLoad = !this.registry.has(chartType) && this.registry.hasLoader(chartType);
|
|
4635
|
+
this.renderer.resize(size.width, size.height);
|
|
4636
|
+
if (shouldLazyLoad) {
|
|
4637
|
+
this.renderer.render(buildStatusScene(size, this.resolvedConfig, {
|
|
4638
|
+
title: `Loading ${chartType}`,
|
|
4639
|
+
subtitle: "Infinity Charts is fetching this chart module on demand.",
|
|
4640
|
+
accent: this.resolvedConfig.theme.palette[0]
|
|
4641
|
+
}), {
|
|
4642
|
+
background: this.resolvedConfig.theme.background,
|
|
4643
|
+
animation: this.resolvedConfig.animation,
|
|
4644
|
+
ariaLabel: `${chartType} chart loading`,
|
|
4645
|
+
chartType,
|
|
4646
|
+
themeMode: this.resolvedConfig.theme.mode
|
|
4647
|
+
});
|
|
4648
|
+
this.events.emit("load:start", { type: chartType, reasons });
|
|
4649
|
+
}
|
|
4650
|
+
let definition;
|
|
4651
|
+
try {
|
|
4652
|
+
definition = await this.registry.ensure(chartType);
|
|
4653
|
+
} catch (error) {
|
|
4654
|
+
if (this.destroyed || renderId !== this.renderId) {
|
|
4655
|
+
return;
|
|
4656
|
+
}
|
|
4657
|
+
this.renderer.render(buildStatusScene(size, this.resolvedConfig, {
|
|
4658
|
+
title: `Unable to load ${chartType}`,
|
|
4659
|
+
subtitle: error instanceof Error ? error.message : "Unexpected chart loading error.",
|
|
4660
|
+
accent: this.resolvedConfig.theme.semantic.danger
|
|
4661
|
+
}), {
|
|
4662
|
+
background: this.resolvedConfig.theme.background,
|
|
4663
|
+
animation: this.resolvedConfig.animation,
|
|
4664
|
+
ariaLabel: `${chartType} chart load error`,
|
|
4665
|
+
chartType,
|
|
4666
|
+
themeMode: this.resolvedConfig.theme.mode
|
|
4667
|
+
});
|
|
4668
|
+
this.events.emit("load:error", { type: chartType, error });
|
|
4669
|
+
throw error;
|
|
4670
|
+
}
|
|
4671
|
+
if (this.destroyed || renderId !== this.renderId) {
|
|
4672
|
+
return;
|
|
4673
|
+
}
|
|
4674
|
+
this.pluginManager.invoke("beforeRender", this.createPluginContext(reason));
|
|
4675
|
+
this.renderer.render(definition.render({
|
|
4676
|
+
config: this.resolvedConfig,
|
|
4677
|
+
payload,
|
|
4678
|
+
size,
|
|
4679
|
+
frame,
|
|
4680
|
+
reasons
|
|
4681
|
+
}), {
|
|
4682
|
+
background: this.resolvedConfig.theme.background,
|
|
4683
|
+
animation: this.resolvedConfig.animation,
|
|
4684
|
+
ariaLabel: this.resolvedConfig.title.text || `${chartType} chart`,
|
|
4685
|
+
chartType,
|
|
4686
|
+
themeMode: this.resolvedConfig.theme.mode
|
|
4687
|
+
});
|
|
4688
|
+
this.pluginManager.invoke("afterRender", this.createPluginContext(reason));
|
|
4689
|
+
if (shouldLazyLoad) {
|
|
4690
|
+
this.events.emit("load:end", { type: chartType, reasons });
|
|
4691
|
+
}
|
|
4692
|
+
this.events.emit("render", { reasons, size, type: chartType });
|
|
4693
|
+
}
|
|
4694
|
+
refreshResolvedConfig() {
|
|
4695
|
+
this.resolvedConfig = resolveChartConfig({
|
|
4696
|
+
...this.inputConfig,
|
|
4697
|
+
container: this.container
|
|
4698
|
+
}, this.container);
|
|
4699
|
+
this.interaction.update(this.resolvedConfig);
|
|
4700
|
+
}
|
|
4701
|
+
createPluginContext(reason) {
|
|
4702
|
+
return {
|
|
4703
|
+
chart: this,
|
|
4704
|
+
config: this.resolvedConfig,
|
|
4705
|
+
reason
|
|
4706
|
+
};
|
|
4707
|
+
}
|
|
4708
|
+
};
|
|
4709
|
+
|
|
4710
|
+
// node_modules/@revivejs/infinity-charts/dist/index.js
|
|
4711
|
+
var globalRegistry = new ChartRegistry();
|
|
4712
|
+
var globalPlugins = [];
|
|
4713
|
+
builtInChartTypes.forEach((type) => {
|
|
4714
|
+
globalRegistry.registerLoader(type, builtInChartLoaders[type]);
|
|
4715
|
+
});
|
|
4716
|
+
var registerChart = (chart) => {
|
|
4717
|
+
globalRegistry.register(chart);
|
|
4718
|
+
};
|
|
4719
|
+
var registerChartLoader = (type, loader) => {
|
|
4720
|
+
globalRegistry.registerLoader(type, loader);
|
|
4721
|
+
};
|
|
4722
|
+
var registerPlugin = (plugin) => {
|
|
4723
|
+
globalPlugins.push(plugin);
|
|
4724
|
+
};
|
|
4725
|
+
var registerPack = (pack) => {
|
|
4726
|
+
var _a;
|
|
4727
|
+
pack.charts.forEach((chart) => globalRegistry.register(chart));
|
|
4728
|
+
(_a = pack.plugins) == null ? void 0 : _a.forEach((plugin) => globalPlugins.push(plugin));
|
|
4729
|
+
};
|
|
4730
|
+
var loadChart = async (type) => {
|
|
4731
|
+
await globalRegistry.ensure(type);
|
|
4732
|
+
};
|
|
4733
|
+
var preloadCharts = async (types) => {
|
|
4734
|
+
await Promise.all(types.map((type) => globalRegistry.ensure(type)));
|
|
4735
|
+
};
|
|
4736
|
+
var loadAllCharts = async () => {
|
|
4737
|
+
const { coreChartsPack: coreChartsPack2 } = await Promise.resolve().then(() => (init_charts(), charts_exports));
|
|
4738
|
+
registerPack(coreChartsPack2);
|
|
4739
|
+
};
|
|
4740
|
+
var createChart = (config) => new ChartEngine(config, {
|
|
4741
|
+
registry: globalRegistry,
|
|
4742
|
+
globalPlugins
|
|
4743
|
+
});
|
|
4744
|
+
var create = createChart;
|
|
4745
|
+
var mount = createChart;
|
|
4746
|
+
var usePack = registerPack;
|