@codeauradev/ngx-wind-charts 0.0.0-stage → 1.0.4

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.
@@ -0,0 +1,4016 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, afterNextRender, computed, effect, inject, input, signal } from "@angular/core";
3
+ function resolveFormat(format, currency = "USD") {
4
+ if (typeof format === "function") return format;
5
+ const number = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 });
6
+ if (format === "compact") {
7
+ const compact = new Intl.NumberFormat(void 0, {
8
+ notation: "compact",
9
+ maximumFractionDigits: 1
10
+ });
11
+ return (value) => compact.format(value);
12
+ }
13
+ if (format === "percent") return (value) => `${number.format(value)}%`;
14
+ if (format === "currency") {
15
+ const money = new Intl.NumberFormat(void 0, {
16
+ style: "currency",
17
+ currency,
18
+ maximumFractionDigits: 0
19
+ });
20
+ return (value) => money.format(value);
21
+ }
22
+ return (value) => number.format(value);
23
+ }
24
+ function percentLabel(part, total) {
25
+ if (total <= 0) return "0%";
26
+ return `${Math.round(part / total * 1e3) / 10}%`;
27
+ }
28
+ const DEFAULT_PALETTE = [
29
+ "var(--ngx-1)",
30
+ "var(--ngx-2)",
31
+ "var(--ngx-3)",
32
+ "var(--ngx-4)",
33
+ "var(--ngx-5)"
34
+ ];
35
+ function num(value) {
36
+ return Number.isFinite(value) ? value : 0;
37
+ }
38
+ function clamp(value, min, max) {
39
+ return Math.min(max, Math.max(min, value));
40
+ }
41
+ function round(value) {
42
+ return Math.round(value * 100) / 100;
43
+ }
44
+ function ellipsize(label, max = 16) {
45
+ if (label.length <= max) return label;
46
+ return `${label.slice(0, max - 1)}…`;
47
+ }
48
+ function seriesColor(explicit, index, palette) {
49
+ if (explicit) return explicit;
50
+ const source = palette.length > 0 ? palette : DEFAULT_PALETTE;
51
+ return source[index % source.length] ?? DEFAULT_PALETTE[0];
52
+ }
53
+ function niceNum(range, roundToStep) {
54
+ const abs = Math.abs(range);
55
+ if (!Number.isFinite(abs) || abs === 0) return 1;
56
+ const exp = Math.floor(Math.log10(abs));
57
+ const frac = abs / 10 ** exp;
58
+ let nice;
59
+ if (roundToStep) {
60
+ if (frac < 1.5) nice = 1;
61
+ else if (frac < 3) nice = 2;
62
+ else if (frac < 7) nice = 5;
63
+ else nice = 10;
64
+ } else if (frac <= 1) nice = 1;
65
+ else if (frac <= 2) nice = 2;
66
+ else if (frac <= 5) nice = 5;
67
+ else nice = 10;
68
+ return nice * 10 ** exp;
69
+ }
70
+ function niceTicks(min, max, count = 4) {
71
+ if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];
72
+ if (min > max) {
73
+ const swap = min;
74
+ min = max;
75
+ max = swap;
76
+ }
77
+ if (min === max) {
78
+ const pad = Math.abs(min) || 1;
79
+ min -= pad / 2;
80
+ max += pad / 2;
81
+ }
82
+ const step = niceNum((max - min) / Math.max(count, 1), true);
83
+ const start = Math.floor(min / step) * step;
84
+ const end = Math.ceil(max / step) * step;
85
+ const ticks = [];
86
+ const steps = Math.round((end - start) / step);
87
+ const guard = Math.min(Math.max(steps, 0), count + 8);
88
+ for (let i = 0; i <= guard; i += 1) ticks.push(Number((start + i * step).toPrecision(12)));
89
+ if (ticks.length < 2) return [min, max];
90
+ return ticks;
91
+ }
92
+ function pointOnCircle(cx, cy, radius, radians) {
93
+ return [cx + Math.cos(radians) * radius, cy + Math.sin(radians) * radius];
94
+ }
95
+ function mathPoint(cx, cy, radius, degrees) {
96
+ const radians = degrees * Math.PI / 180;
97
+ return [cx + Math.cos(radians) * radius, cy - Math.sin(radians) * radius];
98
+ }
99
+ function arcPath(cx, cy, radius, startDeg, endDeg) {
100
+ const [x0, y0] = mathPoint(cx, cy, radius, startDeg);
101
+ const [x1, y1] = mathPoint(cx, cy, radius, endDeg);
102
+ let delta = startDeg - endDeg;
103
+ delta = (delta % 360 + 360) % 360;
104
+ if (delta === 0) return "";
105
+ const large = delta > 180 ? 1 : 0;
106
+ return `M ${round(x0)} ${round(y0)} A ${round(radius)} ${round(radius)} 0 ${large} 1 ${round(x1)} ${round(y1)}`;
107
+ }
108
+ function donutSlicePath(cx, cy, outer, inner, start, end) {
109
+ const sweep = end - start;
110
+ if (sweep <= 1e-4) return "";
111
+ if (sweep >= Math.PI * 2 - 1e-4) {
112
+ const mid = start + Math.PI;
113
+ return `${donutSlicePath(cx, cy, outer, inner, start, mid)} ${donutSlicePath(cx, cy, outer, inner, mid, start + Math.PI * 2 - 1e-4)}`;
114
+ }
115
+ const large = sweep > Math.PI ? 1 : 0;
116
+ const [x0, y0] = pointOnCircle(cx, cy, outer, start);
117
+ const [x1, y1] = pointOnCircle(cx, cy, outer, end);
118
+ if (inner <= 0) return `M ${round(cx)} ${round(cy)} L ${round(x0)} ${round(y0)} A ${round(outer)} ${round(outer)} 0 ${large} 1 ${round(x1)} ${round(y1)} Z`;
119
+ const [ix0, iy0] = pointOnCircle(cx, cy, inner, end);
120
+ const [ix1, iy1] = pointOnCircle(cx, cy, inner, start);
121
+ return `M ${round(x0)} ${round(y0)} A ${round(outer)} ${round(outer)} 0 ${large} 1 ${round(x1)} ${round(y1)} L ${round(ix0)} ${round(iy0)} A ${round(inner)} ${round(inner)} 0 ${large} 0 ${round(ix1)} ${round(iy1)} Z`;
122
+ }
123
+ function domainOf(values, includeZero, maxPin, minPin) {
124
+ const finite = values.filter((value) => Number.isFinite(value));
125
+ const pinned = minPin !== void 0 && Number.isFinite(minPin);
126
+ if (finite.length === 0) {
127
+ const min = pinned ? minPin : 0;
128
+ const max = Math.max(min + 1, maxPin ?? min + 1);
129
+ return {
130
+ min,
131
+ max,
132
+ ticks: [min, max]
133
+ };
134
+ }
135
+ let min = Math.min(...finite);
136
+ let max = Math.max(...finite);
137
+ if (includeZero) {
138
+ min = Math.min(0, min);
139
+ max = Math.max(0, max);
140
+ }
141
+ if (maxPin !== void 0 && Number.isFinite(maxPin)) max = Math.max(max, maxPin);
142
+ if (min === max) {
143
+ const pad = Math.abs(min) || 1;
144
+ min -= includeZero || pinned ? 0 : pad * .5;
145
+ max += pad * .5;
146
+ if (includeZero) min = Math.min(0, min);
147
+ } else if (!includeZero && !pinned) {
148
+ const pad = (max - min) * .08;
149
+ min -= pad;
150
+ max += pad;
151
+ }
152
+ if (pinned) {
153
+ min = minPin;
154
+ if (max <= min) max = min + (Math.abs(min) || 1);
155
+ }
156
+ let ticks = niceTicks(min, max, 4);
157
+ if (pinned) {
158
+ ticks = ticks.filter((tick) => tick >= minPin - 1e-8);
159
+ if (ticks.length === 0 || ticks[0] > minPin + 1e-8) ticks.unshift(minPin);
160
+ }
161
+ return {
162
+ min: pinned ? minPin : ticks[0] ?? min,
163
+ max: ticks[ticks.length - 1] ?? max,
164
+ ticks
165
+ };
166
+ }
167
+ function scale(domainMin, domainMax, rangeMin, rangeMax) {
168
+ const span = domainMax - domainMin || 1;
169
+ return (value) => rangeMin + (value - domainMin) / span * (rangeMax - rangeMin);
170
+ }
171
+ function box(width, height, pad) {
172
+ return {
173
+ left: pad.left,
174
+ right: width - pad.right,
175
+ top: pad.top,
176
+ bottom: height - pad.bottom,
177
+ width: Math.max(1, width - pad.left - pad.right),
178
+ height: Math.max(1, height - pad.top - pad.bottom)
179
+ };
180
+ }
181
+ function yTicks(values, format, plot) {
182
+ const y = scale(values[0] ?? 0, values[values.length - 1] ?? 1, plot.bottom, plot.top);
183
+ return values.map((value) => {
184
+ const py = round(y(value));
185
+ return {
186
+ x1: plot.left,
187
+ y1: py,
188
+ x2: plot.right,
189
+ y2: py,
190
+ label: format(value),
191
+ labelX: plot.left - 8,
192
+ labelY: py,
193
+ anchor: "end"
194
+ };
195
+ });
196
+ }
197
+ function xValueTicks(values, format, plot) {
198
+ const x = scale(values[0] ?? 0, values[values.length - 1] ?? 1, plot.left, plot.right);
199
+ return values.map((value) => {
200
+ const px = round(x(value));
201
+ return {
202
+ x1: px,
203
+ y1: plot.top,
204
+ x2: px,
205
+ y2: plot.bottom,
206
+ label: format(value),
207
+ labelX: px,
208
+ labelY: plot.bottom + 16,
209
+ anchor: "middle"
210
+ };
211
+ });
212
+ }
213
+ function legendOf(series, palette) {
214
+ return series.map((item, index) => ({
215
+ name: item.name,
216
+ color: seriesColor(item.color, index, palette)
217
+ }));
218
+ }
219
+ function labelStep(count, space, estimate = 56) {
220
+ const fit = Math.max(1, Math.floor(space / estimate));
221
+ return Math.max(1, Math.ceil(count / Math.max(fit, 1)));
222
+ }
223
+ function layoutBars(input) {
224
+ const palette = input.palette ?? DEFAULT_PALETTE;
225
+ const categories = input.categories;
226
+ const series = input.series;
227
+ const values = series.reduce((all, item) => all.concat(item.data), []);
228
+ const empty = categories.length === 0 || series.length === 0;
229
+ const domain = domainOf(values, true, input.max);
230
+ const longest = domain.ticks.reduce((max, tick) => Math.max(max, input.format(tick).length), 2);
231
+ const horizontal = input.orientation === "horizontal";
232
+ const categoryEstimate = categories.reduce((max, label) => Math.max(max, label.length), 0);
233
+ const pad = horizontal ? {
234
+ top: 12,
235
+ right: 16,
236
+ bottom: 28,
237
+ left: Math.min(132, Math.max(48, categoryEstimate * 7 + 16))
238
+ } : {
239
+ top: 12,
240
+ right: 12,
241
+ bottom: 28,
242
+ left: Math.min(96, Math.max(40, longest * 7 + 14))
243
+ };
244
+ const width = Math.max(input.width, pad.left + pad.right + 40);
245
+ const height = Math.max(input.height, pad.top + pad.bottom + 40);
246
+ const plot = box(width, height, pad);
247
+ const legend = series.length > 1 || series.some((item) => item.name !== "Value") ? legendOf(series, palette) : legendOf(series, palette);
248
+ if (empty) return {
249
+ empty: true,
250
+ width,
251
+ height,
252
+ marks: [],
253
+ ticks: [],
254
+ categories: [],
255
+ zero: null,
256
+ legend: []
257
+ };
258
+ const marks = [];
259
+ const mode = input.mode;
260
+ const showValues = input.showValues ?? false;
261
+ if (!horizontal) {
262
+ const y = scale(domain.min, domain.max, plot.bottom, plot.top);
263
+ const band = plot.width / categories.length;
264
+ const step = labelStep(categories.length, plot.width);
265
+ const categoryLabels = categories.map((label, index) => ({
266
+ label: ellipsize(label),
267
+ x: round(plot.left + band * index + band / 2),
268
+ y: plot.bottom + 16,
269
+ anchor: "middle"
270
+ })).filter((_, index) => index % step === 0);
271
+ const zeroY = round(y(0));
272
+ categories.forEach((category, categoryIndex) => {
273
+ const inset = band * .18;
274
+ const inner = Math.max(1, band - inset * 2);
275
+ if (mode === "stacked") {
276
+ let positive = 0;
277
+ let negative = 0;
278
+ series.forEach((item, seriesIndex) => {
279
+ const value = num(item.data[categoryIndex] ?? 0);
280
+ const start = value >= 0 ? positive : negative;
281
+ const end = start + value;
282
+ if (value >= 0) positive = end;
283
+ else negative = end;
284
+ const y0 = y(start);
285
+ const y1 = y(end);
286
+ const top = Math.min(y0, y1);
287
+ const barHeight = Math.max(Math.abs(y1 - y0), value === 0 ? 0 : 1);
288
+ const x = plot.left + band * categoryIndex + inset;
289
+ const color = input.pointColors?.[categoryIndex] || seriesColor(item.color, seriesIndex, palette);
290
+ marks.push(barMark(category, item.name, value, input.format, color, x, top, inner, barHeight, showValues, `${categoryIndex}-${seriesIndex}`));
291
+ });
292
+ } else {
293
+ const gap = series.length > 1 ? Math.min(4, inner * .08) : 0;
294
+ const barWidth = Math.max(1, (inner - gap * (series.length - 1)) / series.length);
295
+ series.forEach((item, seriesIndex) => {
296
+ const value = num(item.data[categoryIndex] ?? 0);
297
+ const y0 = y(0);
298
+ const y1 = y(value);
299
+ const top = Math.min(y0, y1);
300
+ const barHeight = Math.max(Math.abs(y1 - y0), value === 0 ? 0 : 1);
301
+ const x = plot.left + band * categoryIndex + inset + seriesIndex * (barWidth + gap);
302
+ const color = (series.length === 1 ? input.pointColors?.[categoryIndex] : void 0) || seriesColor(item.color, seriesIndex, palette);
303
+ marks.push(barMark(category, item.name, value, input.format, color, x, top, barWidth, barHeight, showValues, `${categoryIndex}-${seriesIndex}`));
304
+ });
305
+ }
306
+ });
307
+ return {
308
+ empty: false,
309
+ width,
310
+ height,
311
+ marks,
312
+ ticks: yTicks(domain.ticks, input.format, plot),
313
+ categories: categoryLabels,
314
+ zero: domain.min < 0 && domain.max > 0 ? {
315
+ x1: plot.left,
316
+ y1: zeroY,
317
+ x2: plot.right,
318
+ y2: zeroY
319
+ } : null,
320
+ legend
321
+ };
322
+ }
323
+ const x = scale(domain.min, domain.max, plot.left, plot.right);
324
+ const band = plot.height / categories.length;
325
+ const categoryLabels = categories.map((label, index) => ({
326
+ label: ellipsize(label, 18),
327
+ x: plot.left - 8,
328
+ y: round(plot.top + band * index + band / 2),
329
+ anchor: "end"
330
+ }));
331
+ const zeroX = round(x(0));
332
+ categories.forEach((category, categoryIndex) => {
333
+ const inset = band * .2;
334
+ const inner = Math.max(1, band - inset * 2);
335
+ if (mode === "stacked") {
336
+ let positive = 0;
337
+ let negative = 0;
338
+ series.forEach((item, seriesIndex) => {
339
+ const value = num(item.data[categoryIndex] ?? 0);
340
+ const start = value >= 0 ? positive : negative;
341
+ const end = start + value;
342
+ if (value >= 0) positive = end;
343
+ else negative = end;
344
+ const x0 = x(start);
345
+ const x1 = x(end);
346
+ const left = Math.min(x0, x1);
347
+ const barWidth = Math.max(Math.abs(x1 - x0), value === 0 ? 0 : 1);
348
+ const y = plot.top + band * categoryIndex + inset;
349
+ const color = input.pointColors?.[categoryIndex] || seriesColor(item.color, seriesIndex, palette);
350
+ marks.push(barMark(category, item.name, value, input.format, color, left, y, barWidth, inner, showValues, `${categoryIndex}-${seriesIndex}`, true));
351
+ });
352
+ } else {
353
+ const gap = series.length > 1 ? Math.min(4, inner * .08) : 0;
354
+ const barHeight = Math.max(1, (inner - gap * (series.length - 1)) / series.length);
355
+ series.forEach((item, seriesIndex) => {
356
+ const value = num(item.data[categoryIndex] ?? 0);
357
+ const x0 = x(0);
358
+ const x1 = x(value);
359
+ const left = Math.min(x0, x1);
360
+ const barWidth = Math.max(Math.abs(x1 - x0), value === 0 ? 0 : 1);
361
+ const y = plot.top + band * categoryIndex + inset + seriesIndex * (barHeight + gap);
362
+ const color = (series.length === 1 ? input.pointColors?.[categoryIndex] : void 0) || seriesColor(item.color, seriesIndex, palette);
363
+ marks.push(barMark(category, item.name, value, input.format, color, left, y, barWidth, barHeight, showValues, `${categoryIndex}-${seriesIndex}`, true));
364
+ });
365
+ }
366
+ });
367
+ return {
368
+ empty: false,
369
+ width,
370
+ height,
371
+ marks,
372
+ ticks: xValueTicks(domain.ticks, input.format, plot),
373
+ categories: categoryLabels,
374
+ zero: domain.min < 0 && domain.max > 0 ? {
375
+ x1: zeroX,
376
+ y1: plot.top,
377
+ x2: zeroX,
378
+ y2: plot.bottom
379
+ } : null,
380
+ legend
381
+ };
382
+ }
383
+ function barMark(category, seriesName, value, format, color, x, y, width, height, showValues, key, horizontal = false) {
384
+ const formatted = format(value);
385
+ const showLabel = showValues && (horizontal ? width > 28 : height > 16);
386
+ return {
387
+ key,
388
+ x: round(x),
389
+ y: round(y),
390
+ width: round(Math.max(width, 0)),
391
+ height: round(Math.max(height, 0)),
392
+ color,
393
+ category,
394
+ series: seriesName,
395
+ value,
396
+ formatted,
397
+ labelX: round(horizontal ? x + width + 6 : x + width / 2),
398
+ labelY: round(horizontal ? y + height / 2 : y - 6),
399
+ showLabel,
400
+ origin: horizontal ? value < 0 ? "right" : "left" : value < 0 ? "top" : "bottom"
401
+ };
402
+ }
403
+ function layoutTrend(input) {
404
+ const palette = input.palette ?? DEFAULT_PALETTE;
405
+ const categories = input.categories;
406
+ const series = input.series;
407
+ const empty = categories.length === 0 || series.length === 0;
408
+ const stacked = input.stacked ?? false;
409
+ const domain = domainOf(stacked ? categories.map((_, index) => series.reduce((sum, item) => sum + num(item.data[index] ?? 0), 0)) : series.reduce((all, item) => all.concat(item.data.map(num)), []), stacked || Boolean(input.filled), void 0, input.min);
410
+ const longest = domain.ticks.reduce((max, tick) => Math.max(max, input.format(tick).length), 2);
411
+ const pad = {
412
+ top: 16,
413
+ right: 16,
414
+ bottom: 28,
415
+ left: Math.min(96, Math.max(40, longest * 7 + 14))
416
+ };
417
+ const width = Math.max(input.width, pad.left + pad.right + 40);
418
+ const height = Math.max(input.height, pad.top + pad.bottom + 40);
419
+ const plot = box(width, height, pad);
420
+ if (empty) return {
421
+ empty: true,
422
+ width,
423
+ height,
424
+ series: [],
425
+ ticks: [],
426
+ categories: [],
427
+ zero: null,
428
+ baseline: height,
429
+ fromZero: false,
430
+ legend: []
431
+ };
432
+ const y = scale(domain.min, domain.max, plot.bottom, plot.top);
433
+ const xAt = (index) => {
434
+ if (categories.length === 1) return plot.left + plot.width / 2;
435
+ return plot.left + index / (categories.length - 1) * plot.width;
436
+ };
437
+ const step = labelStep(categories.length, plot.width, 48);
438
+ const categoryLabels = categories.map((label, index) => ({
439
+ label: ellipsize(label),
440
+ x: round(xAt(index)),
441
+ y: plot.bottom + 16,
442
+ anchor: "middle"
443
+ })).filter((_, index) => index % step === 0);
444
+ const baseline = round(y(domain.min < 0 && domain.max > 0 ? 0 : domain.min));
445
+ const baselines = categories.map(() => 0);
446
+ return {
447
+ empty: false,
448
+ width,
449
+ height,
450
+ series: series.map((item, seriesIndex) => {
451
+ const color = seriesColor(item.color, seriesIndex, palette);
452
+ const points = categories.map((category, index) => {
453
+ const value = num(item.data[index] ?? 0);
454
+ const base = stacked ? baselines[index] ?? 0 : 0;
455
+ const yValue = stacked ? base + value : value;
456
+ if (stacked) baselines[index] = yValue;
457
+ return {
458
+ key: `${seriesIndex}-${index}`,
459
+ x: round(xAt(index)),
460
+ y: round(y(yValue)),
461
+ value,
462
+ formatted: input.format(value),
463
+ category,
464
+ series: item.name,
465
+ color
466
+ };
467
+ });
468
+ const line = points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
469
+ let area = null;
470
+ if (input.filled) {
471
+ if (!stacked) area = `${line} L ${points[points.length - 1]?.x ?? 0} ${baseline} L ${points[0]?.x ?? 0} ${baseline} Z`;
472
+ else {
473
+ const previous = seriesIndex === 0 ? categories.map((_, index) => ({
474
+ x: round(xAt(index)),
475
+ y: round(y(0))
476
+ })) : null;
477
+ area = `${line} ${(previous ? [...previous].reverse() : categories.map((_, index) => {
478
+ const base = series.slice(0, seriesIndex).reduce((sum, entry) => sum + num(entry.data[index] ?? 0), 0);
479
+ return {
480
+ x: round(xAt(index)),
481
+ y: round(y(base))
482
+ };
483
+ }).reverse()).map((point) => `L ${point.x} ${point.y}`).join(" ")} Z`;
484
+ }
485
+ }
486
+ return {
487
+ name: item.name,
488
+ color,
489
+ line,
490
+ area,
491
+ points
492
+ };
493
+ }),
494
+ ticks: yTicks(domain.ticks, input.format, plot),
495
+ categories: categoryLabels,
496
+ zero: domain.min < 0 && domain.max > 0 ? {
497
+ x1: plot.left,
498
+ y1: baseline,
499
+ x2: plot.right,
500
+ y2: baseline
501
+ } : null,
502
+ baseline,
503
+ fromZero: domain.min <= 0 && domain.max >= 0,
504
+ legend: legendOf(series, palette)
505
+ };
506
+ }
507
+ function layoutPie(input) {
508
+ const palette = input.palette ?? DEFAULT_PALETTE;
509
+ const slicesIn = input.data.map((datum) => ({
510
+ ...datum,
511
+ value: Math.max(0, num(datum.value))
512
+ })).filter((datum) => datum.value > 0);
513
+ const width = Math.max(input.width, 80);
514
+ const height = Math.max(input.height, 80);
515
+ const total = slicesIn.reduce((sum, datum) => sum + datum.value, 0);
516
+ if (total <= 0) return {
517
+ empty: true,
518
+ width,
519
+ height,
520
+ slices: [],
521
+ total: 0,
522
+ legend: []
523
+ };
524
+ const size = Math.min(width, height);
525
+ const cx = width / 2;
526
+ const cy = height / 2;
527
+ const outer = size / 2 - 8;
528
+ const inner = input.donut ? outer * clamp(input.innerRatio ?? .62, .2, .85) : 0;
529
+ let angle = -Math.PI / 2;
530
+ const slices = slicesIn.map((datum, index) => {
531
+ const sweep = datum.value / total * Math.PI * 2;
532
+ const start = angle;
533
+ const end = angle + sweep;
534
+ angle = end;
535
+ const color = datum.color || seriesColor(void 0, index, palette);
536
+ return {
537
+ key: `${datum.label}-${index}`,
538
+ label: datum.label,
539
+ value: datum.value,
540
+ formatted: input.format(datum.value),
541
+ percent: percentLabel(datum.value, total),
542
+ color,
543
+ path: donutSlicePath(cx, cy, outer, inner, start, end - 1e-5)
544
+ };
545
+ });
546
+ return {
547
+ empty: false,
548
+ width,
549
+ height,
550
+ slices,
551
+ total,
552
+ legend: slices.map((slice) => ({
553
+ name: slice.label,
554
+ color: slice.color
555
+ }))
556
+ };
557
+ }
558
+ function layoutRadar(input) {
559
+ const palette = input.palette ?? DEFAULT_PALETTE;
560
+ const categories = input.categories;
561
+ const series = input.series;
562
+ const width = Math.max(input.width, 160);
563
+ const height = Math.max(input.height, 160);
564
+ if (categories.length < 3 || series.length === 0) return {
565
+ empty: true,
566
+ width,
567
+ height,
568
+ rings: [],
569
+ spokes: [],
570
+ axes: [],
571
+ series: [],
572
+ legend: []
573
+ };
574
+ const maxValue = Math.max(1, ...series.reduce((all, item) => all.concat(item.data.map((value) => Math.max(0, num(value)))), []));
575
+ const cx = width / 2;
576
+ const cy = height / 2 + 4;
577
+ const radius = Math.min(width, height) / 2 - 36;
578
+ const levels = 4;
579
+ return {
580
+ empty: false,
581
+ width,
582
+ height,
583
+ rings: Array.from({ length: levels }, (_, level) => {
584
+ const ringRadius = radius * ((level + 1) / levels);
585
+ return categories.map((_, index) => {
586
+ const angle = -Math.PI / 2 + index / categories.length * Math.PI * 2;
587
+ const [x, y] = pointOnCircle(cx, cy, ringRadius, angle);
588
+ return `${index === 0 ? "M" : "L"} ${round(x)} ${round(y)}`;
589
+ }).join(" ") + " Z";
590
+ }),
591
+ spokes: categories.map((_, index) => {
592
+ const angle = -Math.PI / 2 + index / categories.length * Math.PI * 2;
593
+ const [x, y] = pointOnCircle(cx, cy, radius, angle);
594
+ return {
595
+ x1: round(cx),
596
+ y1: round(cy),
597
+ x2: round(x),
598
+ y2: round(y)
599
+ };
600
+ }),
601
+ axes: categories.map((label, index) => {
602
+ const angle = -Math.PI / 2 + index / categories.length * Math.PI * 2;
603
+ const [x, y] = pointOnCircle(cx, cy, radius + 16, angle);
604
+ const anchor = x < cx - 8 ? "end" : x > cx + 8 ? "start" : "middle";
605
+ return {
606
+ label: ellipsize(label, 14),
607
+ x: round(x),
608
+ y: round(y),
609
+ anchor
610
+ };
611
+ }),
612
+ series: series.map((item, seriesIndex) => {
613
+ const color = seriesColor(item.color, seriesIndex, palette);
614
+ const points = categories.map((axis, index) => {
615
+ const value = Math.max(0, num(item.data[index] ?? 0));
616
+ const angle = -Math.PI / 2 + index / categories.length * Math.PI * 2;
617
+ const [x, y] = pointOnCircle(cx, cy, radius * (value / maxValue), angle);
618
+ return {
619
+ key: `${seriesIndex}-${index}`,
620
+ x: round(x),
621
+ y: round(y),
622
+ value,
623
+ formatted: input.format(value),
624
+ axis,
625
+ series: item.name,
626
+ color
627
+ };
628
+ });
629
+ const polygon = `${points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ")} Z`;
630
+ return {
631
+ name: item.name,
632
+ color,
633
+ polygon,
634
+ points
635
+ };
636
+ }),
637
+ legend: legendOf(series, palette)
638
+ };
639
+ }
640
+ function layoutScatter(input) {
641
+ const palette = input.palette ?? DEFAULT_PALETTE;
642
+ const series = input.series.filter((item) => item.data.length > 0);
643
+ const width = Math.max(input.width, 160);
644
+ const height = Math.max(input.height, 160);
645
+ const pointsIn = series.reduce((all, item) => all.concat(item.data), []);
646
+ if (series.length === 0 || pointsIn.length === 0) return {
647
+ empty: true,
648
+ width,
649
+ height,
650
+ ticksX: [],
651
+ ticksY: [],
652
+ points: [],
653
+ legend: []
654
+ };
655
+ const xDomain = domainOf(pointsIn.map((point) => num(point.x)), false);
656
+ const yDomain = domainOf(pointsIn.map((point) => num(point.y)), false);
657
+ const longest = yDomain.ticks.reduce((max, tick) => Math.max(max, input.format(tick).length), 2);
658
+ const plot = box(width, height, {
659
+ top: 16,
660
+ right: 16,
661
+ bottom: 32,
662
+ left: Math.min(96, Math.max(40, longest * 7 + 14))
663
+ });
664
+ const x = scale(xDomain.min, xDomain.max, plot.left, plot.right);
665
+ const y = scale(yDomain.min, yDomain.max, plot.bottom, plot.top);
666
+ const points = series.reduce((all, item, seriesIndex) => {
667
+ const color = seriesColor(item.color, seriesIndex, palette);
668
+ return all.concat(item.data.map((point, index) => ({
669
+ key: `${seriesIndex}-${index}`,
670
+ cx: round(x(num(point.x))),
671
+ cy: round(y(num(point.y))),
672
+ color,
673
+ series: item.name,
674
+ label: point.label || item.name,
675
+ xValue: num(point.x),
676
+ yValue: num(point.y),
677
+ formattedX: input.format(num(point.x)),
678
+ formattedY: input.format(num(point.y))
679
+ })));
680
+ }, []);
681
+ return {
682
+ empty: false,
683
+ width,
684
+ height,
685
+ ticksX: xValueTicks(xDomain.ticks, input.format, plot),
686
+ ticksY: yTicks(yDomain.ticks, input.format, plot),
687
+ points,
688
+ legend: legendOf(series, palette)
689
+ };
690
+ }
691
+ function layoutGauge(input) {
692
+ const width = Math.max(input.width, 160);
693
+ const height = Math.max(input.height, 120);
694
+ const min = input.min ?? 0;
695
+ const max = input.max ?? 100;
696
+ const fraction = clamp((num(input.value) - min) / (max - min || 1), 0, 1);
697
+ const cx = width / 2;
698
+ const cy = height * .72;
699
+ const radius = Math.min(width * .38, height * .48);
700
+ const start = 210;
701
+ return {
702
+ empty: false,
703
+ width,
704
+ height,
705
+ track: arcPath(cx, cy, radius, start, -30),
706
+ valuePath: fraction <= 0 ? "" : arcPath(cx, cy, radius, start, start - 240 * fraction),
707
+ fraction,
708
+ labelX: round(cx),
709
+ labelY: round(cy + 4),
710
+ color: input.color || "var(--ngx-1)"
711
+ };
712
+ }
713
+ function layoutSparkline(input) {
714
+ const data = input.data.map(num);
715
+ const width = Math.max(input.width, 40);
716
+ const height = Math.max(input.height, 28);
717
+ const color = input.color || "var(--ngx-1)";
718
+ if (data.length === 0) return {
719
+ empty: true,
720
+ width,
721
+ height,
722
+ line: "",
723
+ area: "",
724
+ last: null,
725
+ color
726
+ };
727
+ const min = Math.min(...data);
728
+ const span = Math.max(...data) - min || 1;
729
+ const pad = 4;
730
+ const xAt = (index) => data.length === 1 ? width / 2 : pad + index / (data.length - 1) * (width - 8);
731
+ const yAt = (value) => pad + (1 - (value - min) / span) * (height - 8);
732
+ const coords = data.map((value, index) => ({
733
+ x: round(xAt(index)),
734
+ y: round(yAt(value)),
735
+ value
736
+ }));
737
+ const line = coords.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
738
+ const area = `${line} L ${coords[coords.length - 1]?.x ?? 0} ${round(height - 1)} L ${coords[0]?.x ?? 0} ${round(height - 1)} Z`;
739
+ const last = coords[coords.length - 1];
740
+ return {
741
+ empty: false,
742
+ width,
743
+ height,
744
+ line,
745
+ area,
746
+ last: last ? {
747
+ x: last.x,
748
+ y: last.y,
749
+ value: last.value,
750
+ formatted: input.format(last.value)
751
+ } : null,
752
+ color
753
+ };
754
+ }
755
+ function layoutHeatmap(input) {
756
+ const xLabels = input.xLabels;
757
+ const yLabels = input.yLabels;
758
+ const width = Math.max(input.width, 160);
759
+ const height = Math.max(input.height, 120);
760
+ const rows = yLabels.map((_, row) => xLabels.map((_, column) => num(input.data[row]?.[column] ?? 0)));
761
+ const flat = rows.reduce((all, row) => all.concat(row), []);
762
+ if (xLabels.length === 0 || yLabels.length === 0) return {
763
+ empty: true,
764
+ width,
765
+ height,
766
+ cells: [],
767
+ xLabels: [],
768
+ yLabels: [],
769
+ min: 0,
770
+ max: 0
771
+ };
772
+ const min = Math.min(...flat);
773
+ const max = Math.max(...flat);
774
+ const span = max - min || 1;
775
+ const yEstimate = yLabels.reduce((longest, label) => Math.max(longest, label.length), 0);
776
+ const plot = box(width, height, {
777
+ top: 8,
778
+ right: 8,
779
+ bottom: 28,
780
+ left: Math.min(120, Math.max(36, yEstimate * 7 + 12))
781
+ });
782
+ const gap = 3;
783
+ const cellW = Math.max(1, (plot.width - gap * (xLabels.length - 1)) / xLabels.length);
784
+ const cellH = Math.max(1, (plot.height - gap * (yLabels.length - 1)) / yLabels.length);
785
+ const cells = [];
786
+ yLabels.forEach((ylabel, row) => {
787
+ xLabels.forEach((xlabel, column) => {
788
+ const value = rows[row]?.[column] ?? 0;
789
+ cells.push({
790
+ key: `${row}-${column}`,
791
+ x: round(plot.left + column * (cellW + gap)),
792
+ y: round(plot.top + row * (cellH + gap)),
793
+ width: round(cellW),
794
+ height: round(cellH),
795
+ t: clamp((value - min) / span, 0, 1),
796
+ value,
797
+ formatted: input.format(value),
798
+ xlabel,
799
+ ylabel
800
+ });
801
+ });
802
+ });
803
+ return {
804
+ empty: false,
805
+ width,
806
+ height,
807
+ cells,
808
+ xLabels: xLabels.map((label, index) => ({
809
+ label: ellipsize(label, 8),
810
+ x: round(plot.left + index * (cellW + gap) + cellW / 2),
811
+ y: plot.bottom + 16,
812
+ anchor: "middle"
813
+ })),
814
+ yLabels: yLabels.map((label, index) => ({
815
+ label: ellipsize(label, 14),
816
+ x: plot.left - 8,
817
+ y: round(plot.top + index * (cellH + gap) + cellH / 2),
818
+ anchor: "end"
819
+ })),
820
+ min,
821
+ max
822
+ };
823
+ }
824
+ var NgxChartFrame = class NgxChartFrame {
825
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
826
+ ariaLabel = input("Chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
827
+ legend = input([], ...ngDevMode ? [{ debugName: "legend" }] : /* istanbul ignore next */ []);
828
+ showLegend = input(false, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
829
+ tooltip = input(null, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
830
+ srHeaders = input([], ...ngDevMode ? [{ debugName: "srHeaders" }] : /* istanbul ignore next */ []);
831
+ srRows = input([], ...ngDevMode ? [{ debugName: "srRows" }] : /* istanbul ignore next */ []);
832
+ range = input(void 0, ...ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []);
833
+ static ɵfac = i0.ɵɵngDeclareFactory({
834
+ minVersion: "12.0.0",
835
+ version: "22.2.3",
836
+ ngImport: i0,
837
+ type: NgxChartFrame,
838
+ deps: [],
839
+ target: i0.ɵɵFactoryTarget.Component
840
+ });
841
+ static ɵcmp = i0.ɵɵngDeclareComponent({
842
+ minVersion: "17.0.0",
843
+ version: "22.2.3",
844
+ type: NgxChartFrame,
845
+ isStandalone: true,
846
+ selector: "ngx-chart-frame",
847
+ inputs: {
848
+ title: {
849
+ classPropertyName: "title",
850
+ publicName: "title",
851
+ isSignal: true,
852
+ isRequired: false,
853
+ transformFunction: null
854
+ },
855
+ ariaLabel: {
856
+ classPropertyName: "ariaLabel",
857
+ publicName: "ariaLabel",
858
+ isSignal: true,
859
+ isRequired: false,
860
+ transformFunction: null
861
+ },
862
+ legend: {
863
+ classPropertyName: "legend",
864
+ publicName: "legend",
865
+ isSignal: true,
866
+ isRequired: false,
867
+ transformFunction: null
868
+ },
869
+ showLegend: {
870
+ classPropertyName: "showLegend",
871
+ publicName: "showLegend",
872
+ isSignal: true,
873
+ isRequired: false,
874
+ transformFunction: null
875
+ },
876
+ tooltip: {
877
+ classPropertyName: "tooltip",
878
+ publicName: "tooltip",
879
+ isSignal: true,
880
+ isRequired: false,
881
+ transformFunction: null
882
+ },
883
+ srHeaders: {
884
+ classPropertyName: "srHeaders",
885
+ publicName: "srHeaders",
886
+ isSignal: true,
887
+ isRequired: false,
888
+ transformFunction: null
889
+ },
890
+ srRows: {
891
+ classPropertyName: "srRows",
892
+ publicName: "srRows",
893
+ isSignal: true,
894
+ isRequired: false,
895
+ transformFunction: null
896
+ },
897
+ range: {
898
+ classPropertyName: "range",
899
+ publicName: "range",
900
+ isSignal: true,
901
+ isRequired: false,
902
+ transformFunction: null
903
+ }
904
+ },
905
+ ngImport: i0,
906
+ template: `
907
+ <figure class="ngx-charts ngx-wind-charts text-sm text-muted" [attr.aria-label]="ariaLabel()">
908
+ @if (title()) {
909
+ <div class="text-sm font-medium text-foreground">{{ title() }}</div>
910
+ }
911
+ <div class="ngx-plot relative w-full">
912
+ <ng-content />
913
+ @if (tooltip(); as tip) {
914
+ <div class="ngx-tip" [style.left.px]="tip.x" [style.top.px]="tip.y">
915
+ <div class="font-medium">{{ tip.title }}</div>
916
+ @for (row of tip.rows; track row.label) {
917
+ <div class="ngx-tip-row">
918
+ <span class="ngx-swatch" [style.background]="row.swatch"></span>
919
+ <span>{{ row.label }}</span>
920
+ <span class="ml-auto pl-3 font-medium text-foreground">{{ row.value }}</span>
921
+ </div>
922
+ }
923
+ </div>
924
+ }
925
+ </div>
926
+ @if (showLegend() && legend().length > 0) {
927
+ <ul class="ngx-legend">
928
+ @for (item of legend(); track item.name) {
929
+ <li>
930
+ <span class="ngx-swatch" [style.background]="item.color"></span>
931
+ <span>{{ item.name }}</span>
932
+ </li>
933
+ }
934
+ </ul>
935
+ }
936
+ @if (range(); as scale) {
937
+ <div class="ngx-key text-xs">
938
+ <span>{{ scale.min }}</span>
939
+ <span class="ngx-heat-scale"></span>
940
+ <span>{{ scale.max }}</span>
941
+ </div>
942
+ }
943
+ <table class="ngx-sr">
944
+ <caption>{{ ariaLabel() }}</caption>
945
+ <thead>
946
+ <tr>
947
+ @for (header of srHeaders(); track header) {
948
+ <th>{{ header }}</th>
949
+ }
950
+ </tr>
951
+ </thead>
952
+ <tbody>
953
+ @for (row of srRows(); track $index) {
954
+ <tr>
955
+ @for (cell of row; track $index) {
956
+ <td>{{ cell }}</td>
957
+ }
958
+ </tr>
959
+ }
960
+ </tbody>
961
+ </table>
962
+ </figure>
963
+ `,
964
+ isInline: true,
965
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
966
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
967
+ });
968
+ };
969
+ i0.ɵɵngDeclareClassMetadata({
970
+ minVersion: "12.0.0",
971
+ version: "22.2.3",
972
+ ngImport: i0,
973
+ type: NgxChartFrame,
974
+ decorators: [{
975
+ type: Component,
976
+ args: [{
977
+ selector: "ngx-chart-frame",
978
+ changeDetection: ChangeDetectionStrategy.OnPush,
979
+ template: `
980
+ <figure class="ngx-charts ngx-wind-charts text-sm text-muted" [attr.aria-label]="ariaLabel()">
981
+ @if (title()) {
982
+ <div class="text-sm font-medium text-foreground">{{ title() }}</div>
983
+ }
984
+ <div class="ngx-plot relative w-full">
985
+ <ng-content />
986
+ @if (tooltip(); as tip) {
987
+ <div class="ngx-tip" [style.left.px]="tip.x" [style.top.px]="tip.y">
988
+ <div class="font-medium">{{ tip.title }}</div>
989
+ @for (row of tip.rows; track row.label) {
990
+ <div class="ngx-tip-row">
991
+ <span class="ngx-swatch" [style.background]="row.swatch"></span>
992
+ <span>{{ row.label }}</span>
993
+ <span class="ml-auto pl-3 font-medium text-foreground">{{ row.value }}</span>
994
+ </div>
995
+ }
996
+ </div>
997
+ }
998
+ </div>
999
+ @if (showLegend() && legend().length > 0) {
1000
+ <ul class="ngx-legend">
1001
+ @for (item of legend(); track item.name) {
1002
+ <li>
1003
+ <span class="ngx-swatch" [style.background]="item.color"></span>
1004
+ <span>{{ item.name }}</span>
1005
+ </li>
1006
+ }
1007
+ </ul>
1008
+ }
1009
+ @if (range(); as scale) {
1010
+ <div class="ngx-key text-xs">
1011
+ <span>{{ scale.min }}</span>
1012
+ <span class="ngx-heat-scale"></span>
1013
+ <span>{{ scale.max }}</span>
1014
+ </div>
1015
+ }
1016
+ <table class="ngx-sr">
1017
+ <caption>{{ ariaLabel() }}</caption>
1018
+ <thead>
1019
+ <tr>
1020
+ @for (header of srHeaders(); track header) {
1021
+ <th>{{ header }}</th>
1022
+ }
1023
+ </tr>
1024
+ </thead>
1025
+ <tbody>
1026
+ @for (row of srRows(); track $index) {
1027
+ <tr>
1028
+ @for (cell of row; track $index) {
1029
+ <td>{{ cell }}</td>
1030
+ }
1031
+ </tr>
1032
+ }
1033
+ </tbody>
1034
+ </table>
1035
+ </figure>
1036
+ `,
1037
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
1038
+ }]
1039
+ }],
1040
+ propDecorators: {
1041
+ title: [{
1042
+ type: i0.Input,
1043
+ args: [{
1044
+ isSignal: true,
1045
+ alias: "title",
1046
+ required: false
1047
+ }]
1048
+ }],
1049
+ ariaLabel: [{
1050
+ type: i0.Input,
1051
+ args: [{
1052
+ isSignal: true,
1053
+ alias: "ariaLabel",
1054
+ required: false
1055
+ }]
1056
+ }],
1057
+ legend: [{
1058
+ type: i0.Input,
1059
+ args: [{
1060
+ isSignal: true,
1061
+ alias: "legend",
1062
+ required: false
1063
+ }]
1064
+ }],
1065
+ showLegend: [{
1066
+ type: i0.Input,
1067
+ args: [{
1068
+ isSignal: true,
1069
+ alias: "showLegend",
1070
+ required: false
1071
+ }]
1072
+ }],
1073
+ tooltip: [{
1074
+ type: i0.Input,
1075
+ args: [{
1076
+ isSignal: true,
1077
+ alias: "tooltip",
1078
+ required: false
1079
+ }]
1080
+ }],
1081
+ srHeaders: [{
1082
+ type: i0.Input,
1083
+ args: [{
1084
+ isSignal: true,
1085
+ alias: "srHeaders",
1086
+ required: false
1087
+ }]
1088
+ }],
1089
+ srRows: [{
1090
+ type: i0.Input,
1091
+ args: [{
1092
+ isSignal: true,
1093
+ alias: "srRows",
1094
+ required: false
1095
+ }]
1096
+ }],
1097
+ range: [{
1098
+ type: i0.Input,
1099
+ args: [{
1100
+ isSignal: true,
1101
+ alias: "range",
1102
+ required: false
1103
+ }]
1104
+ }]
1105
+ }
1106
+ });
1107
+ function normalizeSeries(input) {
1108
+ if (input.series && input.series.length > 0) {
1109
+ const longest = input.series.reduce((max, series) => Math.max(max, series.data.length), 0);
1110
+ const categories = input.categories && input.categories.length > 0 ? input.categories : Array.from({ length: longest }, (_, index) => String(index + 1));
1111
+ return {
1112
+ categories,
1113
+ series: input.series.map((series) => ({
1114
+ name: series.name || "Series",
1115
+ color: series.color,
1116
+ data: categories.map((_, index) => num(series.data[index] ?? 0))
1117
+ }))
1118
+ };
1119
+ }
1120
+ const data = input.data ?? [];
1121
+ return {
1122
+ categories: data.map((datum) => datum.label),
1123
+ series: [{
1124
+ name: "Value",
1125
+ data: data.map((datum) => num(datum.value))
1126
+ }],
1127
+ pointColors: data.map((datum) => datum.color)
1128
+ };
1129
+ }
1130
+ function tooltipAt(event, title, rows) {
1131
+ const box = (event.currentTarget?.closest(".ngx-plot"))?.getBoundingClientRect();
1132
+ return {
1133
+ x: box ? event.clientX - box.left : event.offsetX,
1134
+ y: box ? event.clientY - box.top : event.offsetY,
1135
+ title,
1136
+ rows
1137
+ };
1138
+ }
1139
+ function chartBox(preferred, initialWidth = 640) {
1140
+ const host = inject(ElementRef);
1141
+ const destroyRef = inject(DestroyRef);
1142
+ const width = signal(initialWidth, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
1143
+ const height = signal(Math.max(1, preferred()), ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
1144
+ effect(() => height.set(Math.max(1, preferred())));
1145
+ afterNextRender(() => {
1146
+ const root = host.nativeElement;
1147
+ const measure = () => {
1148
+ const nextW = root.clientWidth;
1149
+ if (nextW > 0) width.set(Math.round(nextW));
1150
+ };
1151
+ measure();
1152
+ if (typeof ResizeObserver === "undefined") return;
1153
+ const observer = new ResizeObserver(measure);
1154
+ observer.observe(root);
1155
+ destroyRef.onDestroy(() => observer.disconnect());
1156
+ });
1157
+ return {
1158
+ width,
1159
+ height
1160
+ };
1161
+ }
1162
+ let nextFillId = 0;
1163
+ var NgxLineChart = class NgxLineChart {
1164
+ host = inject(ElementRef);
1165
+ fillId = `ngx-fill-${nextFillId++}`;
1166
+ data = input(void 0, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
1167
+ series = input(void 0, ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
1168
+ categories = input(void 0, ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
1169
+ stacked = input(false, ...ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []);
1170
+ height = input(320, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
1171
+ showLegend = input(void 0, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
1172
+ showGrid = input(true, ...ngDevMode ? [{ debugName: "showGrid" }] : /* istanbul ignore next */ []);
1173
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
1174
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
1175
+ colors = input(void 0, ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
1176
+ ariaLabel = input("Line chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
1177
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
1178
+ min = input(void 0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
1179
+ animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
1180
+ box = chartBox(this.height);
1181
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
1182
+ filled = computed(() => this.host.nativeElement.localName === "ngx-area-chart", ...ngDevMode ? [{ debugName: "filled" }] : /* istanbul ignore next */ []);
1183
+ normalized = computed(() => normalizeSeries({
1184
+ data: this.data(),
1185
+ series: this.series(),
1186
+ categories: this.categories()
1187
+ }), ...ngDevMode ? [{ debugName: "normalized" }] : /* istanbul ignore next */ []);
1188
+ layout = computed(() => layoutTrend({
1189
+ categories: this.normalized().categories,
1190
+ series: this.normalized().series,
1191
+ width: this.box.width(),
1192
+ height: this.height(),
1193
+ palette: this.colors(),
1194
+ format: resolveFormat(this.format(), this.currency()),
1195
+ filled: this.filled(),
1196
+ stacked: this.stacked(),
1197
+ min: this.min()
1198
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
1199
+ legendOn = computed(() => this.showLegend() ?? this.layout().legend.length > 1, ...ngDevMode ? [{ debugName: "legendOn" }] : /* istanbul ignore next */ []);
1200
+ riseOrigin = computed(() => this.layout().baseline / Math.max(this.layout().height, 1) * 100, ...ngDevMode ? [{ debugName: "riseOrigin" }] : /* istanbul ignore next */ []);
1201
+ headers = computed(() => ["Category", ...this.normalized().series.map((item) => item.name)], ...ngDevMode ? [{ debugName: "headers" }] : /* istanbul ignore next */ []);
1202
+ rows = computed(() => this.normalized().categories.map((category, index) => [category, ...this.normalized().series.map((item) => String(item.data[index] ?? 0))]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
1203
+ drawDelay(index, count) {
1204
+ if (count <= 1) return 0;
1205
+ return Math.round(index / (count - 1) * 700);
1206
+ }
1207
+ onPoint(point, event) {
1208
+ const index = Number(point.key.slice(point.key.indexOf("-") + 1));
1209
+ const rows = this.layout().series.map((item) => {
1210
+ const match = item.points[index] ?? point;
1211
+ return {
1212
+ swatch: match.color,
1213
+ label: item.name,
1214
+ value: match.formatted
1215
+ };
1216
+ });
1217
+ this.tip.set(tooltipAt(event, point.category, rows));
1218
+ }
1219
+ static ɵfac = i0.ɵɵngDeclareFactory({
1220
+ minVersion: "12.0.0",
1221
+ version: "22.2.3",
1222
+ ngImport: i0,
1223
+ type: NgxLineChart,
1224
+ deps: [],
1225
+ target: i0.ɵɵFactoryTarget.Component
1226
+ });
1227
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1228
+ minVersion: "17.0.0",
1229
+ version: "22.2.3",
1230
+ type: NgxLineChart,
1231
+ isStandalone: true,
1232
+ selector: "ngx-line-chart, ngx-area-chart",
1233
+ inputs: {
1234
+ data: {
1235
+ classPropertyName: "data",
1236
+ publicName: "data",
1237
+ isSignal: true,
1238
+ isRequired: false,
1239
+ transformFunction: null
1240
+ },
1241
+ series: {
1242
+ classPropertyName: "series",
1243
+ publicName: "series",
1244
+ isSignal: true,
1245
+ isRequired: false,
1246
+ transformFunction: null
1247
+ },
1248
+ categories: {
1249
+ classPropertyName: "categories",
1250
+ publicName: "categories",
1251
+ isSignal: true,
1252
+ isRequired: false,
1253
+ transformFunction: null
1254
+ },
1255
+ stacked: {
1256
+ classPropertyName: "stacked",
1257
+ publicName: "stacked",
1258
+ isSignal: true,
1259
+ isRequired: false,
1260
+ transformFunction: null
1261
+ },
1262
+ height: {
1263
+ classPropertyName: "height",
1264
+ publicName: "height",
1265
+ isSignal: true,
1266
+ isRequired: false,
1267
+ transformFunction: null
1268
+ },
1269
+ showLegend: {
1270
+ classPropertyName: "showLegend",
1271
+ publicName: "showLegend",
1272
+ isSignal: true,
1273
+ isRequired: false,
1274
+ transformFunction: null
1275
+ },
1276
+ showGrid: {
1277
+ classPropertyName: "showGrid",
1278
+ publicName: "showGrid",
1279
+ isSignal: true,
1280
+ isRequired: false,
1281
+ transformFunction: null
1282
+ },
1283
+ format: {
1284
+ classPropertyName: "format",
1285
+ publicName: "format",
1286
+ isSignal: true,
1287
+ isRequired: false,
1288
+ transformFunction: null
1289
+ },
1290
+ currency: {
1291
+ classPropertyName: "currency",
1292
+ publicName: "currency",
1293
+ isSignal: true,
1294
+ isRequired: false,
1295
+ transformFunction: null
1296
+ },
1297
+ colors: {
1298
+ classPropertyName: "colors",
1299
+ publicName: "colors",
1300
+ isSignal: true,
1301
+ isRequired: false,
1302
+ transformFunction: null
1303
+ },
1304
+ ariaLabel: {
1305
+ classPropertyName: "ariaLabel",
1306
+ publicName: "ariaLabel",
1307
+ isSignal: true,
1308
+ isRequired: false,
1309
+ transformFunction: null
1310
+ },
1311
+ title: {
1312
+ classPropertyName: "title",
1313
+ publicName: "title",
1314
+ isSignal: true,
1315
+ isRequired: false,
1316
+ transformFunction: null
1317
+ },
1318
+ min: {
1319
+ classPropertyName: "min",
1320
+ publicName: "min",
1321
+ isSignal: true,
1322
+ isRequired: false,
1323
+ transformFunction: null
1324
+ },
1325
+ animate: {
1326
+ classPropertyName: "animate",
1327
+ publicName: "animate",
1328
+ isSignal: true,
1329
+ isRequired: false,
1330
+ transformFunction: null
1331
+ }
1332
+ },
1333
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
1334
+ ngImport: i0,
1335
+ template: `
1336
+ <ngx-chart-frame
1337
+ [title]="title()"
1338
+ [ariaLabel]="ariaLabel()"
1339
+ [legend]="layout().legend"
1340
+ [showLegend]="legendOn()"
1341
+ [tooltip]="tip()"
1342
+ [srHeaders]="headers()"
1343
+ [srRows]="rows()"
1344
+ >
1345
+ @if (layout().empty) {
1346
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
1347
+ } @else {
1348
+ <svg
1349
+ class="block w-full max-w-full"
1350
+ [style.height.px]="height()"
1351
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
1352
+ aria-hidden="true"
1353
+ (pointerleave)="tip.set(null)"
1354
+ >
1355
+ @for (tick of layout().ticks; track tick.label + '-' + tick.labelY) {
1356
+ @if (showGrid()) {
1357
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
1358
+ }
1359
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" [attr.text-anchor]="tick.anchor" dominant-baseline="middle">
1360
+ {{ tick.label }}
1361
+ </text>
1362
+ }
1363
+ @if (layout().zero; as zero) {
1364
+ <line class="ngx-zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1365
+ }
1366
+ <defs>
1367
+ @for (item of layout().series; track item.name; let index = $index) {
1368
+ @if (item.area) {
1369
+ <linearGradient
1370
+ [attr.id]="fillId + '-' + index"
1371
+ gradientUnits="userSpaceOnUse"
1372
+ x1="0"
1373
+ [attr.y1]="0"
1374
+ x2="0"
1375
+ [attr.y2]="layout().baseline"
1376
+ >
1377
+ <stop offset="0%" [attr.stop-color]="item.color" stop-opacity="0.32" />
1378
+ <stop offset="100%" [attr.stop-color]="item.color" stop-opacity="0" />
1379
+ </linearGradient>
1380
+ }
1381
+ }
1382
+ </defs>
1383
+ <g [class.ngx-rise-on]="animate() && layout().fromZero" [style.--ngx-rise-origin.%]="riseOrigin()">
1384
+ @for (item of layout().series; track item.name; let index = $index) {
1385
+ @if (item.area) {
1386
+ <path
1387
+ [attr.d]="item.area"
1388
+ [attr.fill]="'url(#' + fillId + '-' + index + ')'"
1389
+ [class.ngx-in]="animate() && !layout().fromZero"
1390
+ />
1391
+ }
1392
+ <path
1393
+ [attr.d]="item.line"
1394
+ fill="none"
1395
+ [attr.stroke]="item.color"
1396
+ stroke-width="2"
1397
+ stroke-linejoin="round"
1398
+ stroke-linecap="round"
1399
+ vector-effect="non-scaling-stroke"
1400
+ [class.ngx-draw]="animate() && !layout().fromZero"
1401
+ [attr.pathLength]="animate() && !layout().fromZero ? 1 : null"
1402
+ [attr.stroke-dasharray]="animate() && !layout().fromZero ? 1 : null"
1403
+ />
1404
+ @for (point of item.points; track point.key; let pointIndex = $index) {
1405
+ <circle
1406
+ [attr.cx]="point.x"
1407
+ [attr.cy]="point.y"
1408
+ r="4"
1409
+ [attr.fill]="point.color"
1410
+ class="cursor-pointer"
1411
+ [class.ngx-pop]="animate() && !layout().fromZero"
1412
+ [style.animation-delay.ms]="animate() && !layout().fromZero ? drawDelay(pointIndex, item.points.length) : 0"
1413
+ stroke="var(--ngx-surface)"
1414
+ stroke-width="1.5"
1415
+ (pointerenter)="onPoint(point, $event)"
1416
+ />
1417
+ }
1418
+ }
1419
+ </g>
1420
+ @for (label of layout().categories; track label.label + '-' + label.x) {
1421
+ <text [attr.x]="label.x" [attr.y]="label.y" text-anchor="middle" dominant-baseline="middle">{{ label.label }}</text>
1422
+ }
1423
+ </svg>
1424
+ }
1425
+ </ngx-chart-frame>
1426
+ `,
1427
+ isInline: true,
1428
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
1429
+ dependencies: [{
1430
+ kind: "component",
1431
+ type: NgxChartFrame,
1432
+ selector: "ngx-chart-frame",
1433
+ inputs: [
1434
+ "title",
1435
+ "ariaLabel",
1436
+ "legend",
1437
+ "showLegend",
1438
+ "tooltip",
1439
+ "srHeaders",
1440
+ "srRows",
1441
+ "range"
1442
+ ]
1443
+ }],
1444
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1445
+ });
1446
+ };
1447
+ i0.ɵɵngDeclareClassMetadata({
1448
+ minVersion: "12.0.0",
1449
+ version: "22.2.3",
1450
+ ngImport: i0,
1451
+ type: NgxLineChart,
1452
+ decorators: [{
1453
+ type: Component,
1454
+ args: [{
1455
+ selector: "ngx-line-chart, ngx-area-chart",
1456
+ changeDetection: ChangeDetectionStrategy.OnPush,
1457
+ imports: [NgxChartFrame],
1458
+ host: { "[style.--ngx-chart-height.px]": "height()" },
1459
+ template: `
1460
+ <ngx-chart-frame
1461
+ [title]="title()"
1462
+ [ariaLabel]="ariaLabel()"
1463
+ [legend]="layout().legend"
1464
+ [showLegend]="legendOn()"
1465
+ [tooltip]="tip()"
1466
+ [srHeaders]="headers()"
1467
+ [srRows]="rows()"
1468
+ >
1469
+ @if (layout().empty) {
1470
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
1471
+ } @else {
1472
+ <svg
1473
+ class="block w-full max-w-full"
1474
+ [style.height.px]="height()"
1475
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
1476
+ aria-hidden="true"
1477
+ (pointerleave)="tip.set(null)"
1478
+ >
1479
+ @for (tick of layout().ticks; track tick.label + '-' + tick.labelY) {
1480
+ @if (showGrid()) {
1481
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
1482
+ }
1483
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" [attr.text-anchor]="tick.anchor" dominant-baseline="middle">
1484
+ {{ tick.label }}
1485
+ </text>
1486
+ }
1487
+ @if (layout().zero; as zero) {
1488
+ <line class="ngx-zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1489
+ }
1490
+ <defs>
1491
+ @for (item of layout().series; track item.name; let index = $index) {
1492
+ @if (item.area) {
1493
+ <linearGradient
1494
+ [attr.id]="fillId + '-' + index"
1495
+ gradientUnits="userSpaceOnUse"
1496
+ x1="0"
1497
+ [attr.y1]="0"
1498
+ x2="0"
1499
+ [attr.y2]="layout().baseline"
1500
+ >
1501
+ <stop offset="0%" [attr.stop-color]="item.color" stop-opacity="0.32" />
1502
+ <stop offset="100%" [attr.stop-color]="item.color" stop-opacity="0" />
1503
+ </linearGradient>
1504
+ }
1505
+ }
1506
+ </defs>
1507
+ <g [class.ngx-rise-on]="animate() && layout().fromZero" [style.--ngx-rise-origin.%]="riseOrigin()">
1508
+ @for (item of layout().series; track item.name; let index = $index) {
1509
+ @if (item.area) {
1510
+ <path
1511
+ [attr.d]="item.area"
1512
+ [attr.fill]="'url(#' + fillId + '-' + index + ')'"
1513
+ [class.ngx-in]="animate() && !layout().fromZero"
1514
+ />
1515
+ }
1516
+ <path
1517
+ [attr.d]="item.line"
1518
+ fill="none"
1519
+ [attr.stroke]="item.color"
1520
+ stroke-width="2"
1521
+ stroke-linejoin="round"
1522
+ stroke-linecap="round"
1523
+ vector-effect="non-scaling-stroke"
1524
+ [class.ngx-draw]="animate() && !layout().fromZero"
1525
+ [attr.pathLength]="animate() && !layout().fromZero ? 1 : null"
1526
+ [attr.stroke-dasharray]="animate() && !layout().fromZero ? 1 : null"
1527
+ />
1528
+ @for (point of item.points; track point.key; let pointIndex = $index) {
1529
+ <circle
1530
+ [attr.cx]="point.x"
1531
+ [attr.cy]="point.y"
1532
+ r="4"
1533
+ [attr.fill]="point.color"
1534
+ class="cursor-pointer"
1535
+ [class.ngx-pop]="animate() && !layout().fromZero"
1536
+ [style.animation-delay.ms]="animate() && !layout().fromZero ? drawDelay(pointIndex, item.points.length) : 0"
1537
+ stroke="var(--ngx-surface)"
1538
+ stroke-width="1.5"
1539
+ (pointerenter)="onPoint(point, $event)"
1540
+ />
1541
+ }
1542
+ }
1543
+ </g>
1544
+ @for (label of layout().categories; track label.label + '-' + label.x) {
1545
+ <text [attr.x]="label.x" [attr.y]="label.y" text-anchor="middle" dominant-baseline="middle">{{ label.label }}</text>
1546
+ }
1547
+ </svg>
1548
+ }
1549
+ </ngx-chart-frame>
1550
+ `,
1551
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
1552
+ }]
1553
+ }],
1554
+ propDecorators: {
1555
+ data: [{
1556
+ type: i0.Input,
1557
+ args: [{
1558
+ isSignal: true,
1559
+ alias: "data",
1560
+ required: false
1561
+ }]
1562
+ }],
1563
+ series: [{
1564
+ type: i0.Input,
1565
+ args: [{
1566
+ isSignal: true,
1567
+ alias: "series",
1568
+ required: false
1569
+ }]
1570
+ }],
1571
+ categories: [{
1572
+ type: i0.Input,
1573
+ args: [{
1574
+ isSignal: true,
1575
+ alias: "categories",
1576
+ required: false
1577
+ }]
1578
+ }],
1579
+ stacked: [{
1580
+ type: i0.Input,
1581
+ args: [{
1582
+ isSignal: true,
1583
+ alias: "stacked",
1584
+ required: false
1585
+ }]
1586
+ }],
1587
+ height: [{
1588
+ type: i0.Input,
1589
+ args: [{
1590
+ isSignal: true,
1591
+ alias: "height",
1592
+ required: false
1593
+ }]
1594
+ }],
1595
+ showLegend: [{
1596
+ type: i0.Input,
1597
+ args: [{
1598
+ isSignal: true,
1599
+ alias: "showLegend",
1600
+ required: false
1601
+ }]
1602
+ }],
1603
+ showGrid: [{
1604
+ type: i0.Input,
1605
+ args: [{
1606
+ isSignal: true,
1607
+ alias: "showGrid",
1608
+ required: false
1609
+ }]
1610
+ }],
1611
+ format: [{
1612
+ type: i0.Input,
1613
+ args: [{
1614
+ isSignal: true,
1615
+ alias: "format",
1616
+ required: false
1617
+ }]
1618
+ }],
1619
+ currency: [{
1620
+ type: i0.Input,
1621
+ args: [{
1622
+ isSignal: true,
1623
+ alias: "currency",
1624
+ required: false
1625
+ }]
1626
+ }],
1627
+ colors: [{
1628
+ type: i0.Input,
1629
+ args: [{
1630
+ isSignal: true,
1631
+ alias: "colors",
1632
+ required: false
1633
+ }]
1634
+ }],
1635
+ ariaLabel: [{
1636
+ type: i0.Input,
1637
+ args: [{
1638
+ isSignal: true,
1639
+ alias: "ariaLabel",
1640
+ required: false
1641
+ }]
1642
+ }],
1643
+ title: [{
1644
+ type: i0.Input,
1645
+ args: [{
1646
+ isSignal: true,
1647
+ alias: "title",
1648
+ required: false
1649
+ }]
1650
+ }],
1651
+ min: [{
1652
+ type: i0.Input,
1653
+ args: [{
1654
+ isSignal: true,
1655
+ alias: "min",
1656
+ required: false
1657
+ }]
1658
+ }],
1659
+ animate: [{
1660
+ type: i0.Input,
1661
+ args: [{
1662
+ isSignal: true,
1663
+ alias: "animate",
1664
+ required: false
1665
+ }]
1666
+ }]
1667
+ }
1668
+ });
1669
+ var NgxBarChart = class NgxBarChart {
1670
+ data = input(void 0, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
1671
+ series = input(void 0, ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
1672
+ categories = input(void 0, ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
1673
+ mode = input("grouped", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
1674
+ orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
1675
+ height = input(320, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
1676
+ showLegend = input(void 0, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
1677
+ showGrid = input(true, ...ngDevMode ? [{ debugName: "showGrid" }] : /* istanbul ignore next */ []);
1678
+ showValues = input(false, ...ngDevMode ? [{ debugName: "showValues" }] : /* istanbul ignore next */ []);
1679
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
1680
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
1681
+ colors = input(void 0, ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
1682
+ ariaLabel = input("Bar chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
1683
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
1684
+ max = input(void 0, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
1685
+ animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
1686
+ box = chartBox(this.height);
1687
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
1688
+ normalized = computed(() => normalizeSeries({
1689
+ data: this.data(),
1690
+ series: this.series(),
1691
+ categories: this.categories()
1692
+ }), ...ngDevMode ? [{ debugName: "normalized" }] : /* istanbul ignore next */ []);
1693
+ layout = computed(() => layoutBars({
1694
+ categories: this.normalized().categories,
1695
+ series: this.normalized().series,
1696
+ pointColors: this.normalized().pointColors,
1697
+ mode: this.mode(),
1698
+ orientation: this.orientation(),
1699
+ width: this.box.width(),
1700
+ height: this.height(),
1701
+ palette: this.colors(),
1702
+ format: resolveFormat(this.format(), this.currency()),
1703
+ showValues: this.showValues(),
1704
+ max: this.max()
1705
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
1706
+ legendOn = computed(() => this.showLegend() ?? this.layout().legend.length > 1, ...ngDevMode ? [{ debugName: "legendOn" }] : /* istanbul ignore next */ []);
1707
+ headers = computed(() => ["Category", ...this.normalized().series.map((item) => item.name)], ...ngDevMode ? [{ debugName: "headers" }] : /* istanbul ignore next */ []);
1708
+ rows = computed(() => this.normalized().categories.map((category, index) => [category, ...this.normalized().series.map((item) => String(item.data[index] ?? 0))]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
1709
+ onMark(mark, event) {
1710
+ this.tip.set(tooltipAt(event, mark.category, [{
1711
+ swatch: mark.color,
1712
+ label: mark.series,
1713
+ value: mark.formatted
1714
+ }]));
1715
+ }
1716
+ static ɵfac = i0.ɵɵngDeclareFactory({
1717
+ minVersion: "12.0.0",
1718
+ version: "22.2.3",
1719
+ ngImport: i0,
1720
+ type: NgxBarChart,
1721
+ deps: [],
1722
+ target: i0.ɵɵFactoryTarget.Component
1723
+ });
1724
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1725
+ minVersion: "17.0.0",
1726
+ version: "22.2.3",
1727
+ type: NgxBarChart,
1728
+ isStandalone: true,
1729
+ selector: "ngx-bar-chart",
1730
+ inputs: {
1731
+ data: {
1732
+ classPropertyName: "data",
1733
+ publicName: "data",
1734
+ isSignal: true,
1735
+ isRequired: false,
1736
+ transformFunction: null
1737
+ },
1738
+ series: {
1739
+ classPropertyName: "series",
1740
+ publicName: "series",
1741
+ isSignal: true,
1742
+ isRequired: false,
1743
+ transformFunction: null
1744
+ },
1745
+ categories: {
1746
+ classPropertyName: "categories",
1747
+ publicName: "categories",
1748
+ isSignal: true,
1749
+ isRequired: false,
1750
+ transformFunction: null
1751
+ },
1752
+ mode: {
1753
+ classPropertyName: "mode",
1754
+ publicName: "mode",
1755
+ isSignal: true,
1756
+ isRequired: false,
1757
+ transformFunction: null
1758
+ },
1759
+ orientation: {
1760
+ classPropertyName: "orientation",
1761
+ publicName: "orientation",
1762
+ isSignal: true,
1763
+ isRequired: false,
1764
+ transformFunction: null
1765
+ },
1766
+ height: {
1767
+ classPropertyName: "height",
1768
+ publicName: "height",
1769
+ isSignal: true,
1770
+ isRequired: false,
1771
+ transformFunction: null
1772
+ },
1773
+ showLegend: {
1774
+ classPropertyName: "showLegend",
1775
+ publicName: "showLegend",
1776
+ isSignal: true,
1777
+ isRequired: false,
1778
+ transformFunction: null
1779
+ },
1780
+ showGrid: {
1781
+ classPropertyName: "showGrid",
1782
+ publicName: "showGrid",
1783
+ isSignal: true,
1784
+ isRequired: false,
1785
+ transformFunction: null
1786
+ },
1787
+ showValues: {
1788
+ classPropertyName: "showValues",
1789
+ publicName: "showValues",
1790
+ isSignal: true,
1791
+ isRequired: false,
1792
+ transformFunction: null
1793
+ },
1794
+ format: {
1795
+ classPropertyName: "format",
1796
+ publicName: "format",
1797
+ isSignal: true,
1798
+ isRequired: false,
1799
+ transformFunction: null
1800
+ },
1801
+ currency: {
1802
+ classPropertyName: "currency",
1803
+ publicName: "currency",
1804
+ isSignal: true,
1805
+ isRequired: false,
1806
+ transformFunction: null
1807
+ },
1808
+ colors: {
1809
+ classPropertyName: "colors",
1810
+ publicName: "colors",
1811
+ isSignal: true,
1812
+ isRequired: false,
1813
+ transformFunction: null
1814
+ },
1815
+ ariaLabel: {
1816
+ classPropertyName: "ariaLabel",
1817
+ publicName: "ariaLabel",
1818
+ isSignal: true,
1819
+ isRequired: false,
1820
+ transformFunction: null
1821
+ },
1822
+ title: {
1823
+ classPropertyName: "title",
1824
+ publicName: "title",
1825
+ isSignal: true,
1826
+ isRequired: false,
1827
+ transformFunction: null
1828
+ },
1829
+ max: {
1830
+ classPropertyName: "max",
1831
+ publicName: "max",
1832
+ isSignal: true,
1833
+ isRequired: false,
1834
+ transformFunction: null
1835
+ },
1836
+ animate: {
1837
+ classPropertyName: "animate",
1838
+ publicName: "animate",
1839
+ isSignal: true,
1840
+ isRequired: false,
1841
+ transformFunction: null
1842
+ }
1843
+ },
1844
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
1845
+ ngImport: i0,
1846
+ template: `
1847
+ <ngx-chart-frame
1848
+ [title]="title()"
1849
+ [ariaLabel]="ariaLabel()"
1850
+ [legend]="layout().legend"
1851
+ [showLegend]="legendOn()"
1852
+ [tooltip]="tip()"
1853
+ [srHeaders]="headers()"
1854
+ [srRows]="rows()"
1855
+ >
1856
+ @if (layout().empty) {
1857
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
1858
+ } @else {
1859
+ <svg
1860
+ class="block w-full max-w-full"
1861
+ [style.height.px]="height()"
1862
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
1863
+ aria-hidden="true"
1864
+ (pointerleave)="tip.set(null)"
1865
+ >
1866
+ @for (tick of layout().ticks; track tick.label + '-' + tick.labelX + '-' + tick.labelY) {
1867
+ @if (showGrid()) {
1868
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
1869
+ }
1870
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" [attr.text-anchor]="tick.anchor" dominant-baseline="middle">
1871
+ {{ tick.label }}
1872
+ </text>
1873
+ }
1874
+ @if (layout().zero; as zero) {
1875
+ <line class="ngx-zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1876
+ }
1877
+ @for (mark of layout().marks; track mark.key) {
1878
+ <rect
1879
+ [attr.x]="mark.x"
1880
+ [attr.y]="mark.y"
1881
+ [attr.width]="mark.width"
1882
+ [attr.height]="mark.height"
1883
+ [attr.fill]="mark.color"
1884
+ rx="3"
1885
+ class="cursor-pointer"
1886
+ [class.ngx-grow-y]="animate() && orientation() !== 'horizontal'"
1887
+ [class.ngx-grow-x]="animate() && orientation() === 'horizontal'"
1888
+ [class.ngx-grow-bottom]="mark.origin === 'bottom'"
1889
+ [class.ngx-grow-top]="mark.origin === 'top'"
1890
+ [class.ngx-grow-left]="mark.origin === 'left'"
1891
+ [class.ngx-grow-right]="mark.origin === 'right'"
1892
+ [style.animation-delay.ms]="animate() ? $index * 18 : 0"
1893
+ (pointerenter)="onMark(mark, $event)"
1894
+ />
1895
+ @if (mark.showLabel) {
1896
+ <text
1897
+ class="ngx-value"
1898
+ [class.ngx-in]="animate()"
1899
+ [style.animation-delay.ms]="animate() ? $index * 18 + 380 : 0"
1900
+ [attr.x]="mark.labelX"
1901
+ [attr.y]="mark.labelY"
1902
+ [attr.text-anchor]="orientation() === 'horizontal' ? 'start' : 'middle'"
1903
+ dominant-baseline="middle"
1904
+ >
1905
+ {{ mark.formatted }}
1906
+ </text>
1907
+ }
1908
+ }
1909
+ @for (label of layout().categories; track label.label + '-' + label.x + '-' + label.y) {
1910
+ <text [attr.x]="label.x" [attr.y]="label.y" [attr.text-anchor]="label.anchor" dominant-baseline="middle">
1911
+ {{ label.label }}
1912
+ </text>
1913
+ }
1914
+ </svg>
1915
+ }
1916
+ </ngx-chart-frame>
1917
+ `,
1918
+ isInline: true,
1919
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
1920
+ dependencies: [{
1921
+ kind: "component",
1922
+ type: NgxChartFrame,
1923
+ selector: "ngx-chart-frame",
1924
+ inputs: [
1925
+ "title",
1926
+ "ariaLabel",
1927
+ "legend",
1928
+ "showLegend",
1929
+ "tooltip",
1930
+ "srHeaders",
1931
+ "srRows",
1932
+ "range"
1933
+ ]
1934
+ }],
1935
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1936
+ });
1937
+ };
1938
+ i0.ɵɵngDeclareClassMetadata({
1939
+ minVersion: "12.0.0",
1940
+ version: "22.2.3",
1941
+ ngImport: i0,
1942
+ type: NgxBarChart,
1943
+ decorators: [{
1944
+ type: Component,
1945
+ args: [{
1946
+ selector: "ngx-bar-chart",
1947
+ changeDetection: ChangeDetectionStrategy.OnPush,
1948
+ imports: [NgxChartFrame],
1949
+ host: { "[style.--ngx-chart-height.px]": "height()" },
1950
+ template: `
1951
+ <ngx-chart-frame
1952
+ [title]="title()"
1953
+ [ariaLabel]="ariaLabel()"
1954
+ [legend]="layout().legend"
1955
+ [showLegend]="legendOn()"
1956
+ [tooltip]="tip()"
1957
+ [srHeaders]="headers()"
1958
+ [srRows]="rows()"
1959
+ >
1960
+ @if (layout().empty) {
1961
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
1962
+ } @else {
1963
+ <svg
1964
+ class="block w-full max-w-full"
1965
+ [style.height.px]="height()"
1966
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
1967
+ aria-hidden="true"
1968
+ (pointerleave)="tip.set(null)"
1969
+ >
1970
+ @for (tick of layout().ticks; track tick.label + '-' + tick.labelX + '-' + tick.labelY) {
1971
+ @if (showGrid()) {
1972
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
1973
+ }
1974
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" [attr.text-anchor]="tick.anchor" dominant-baseline="middle">
1975
+ {{ tick.label }}
1976
+ </text>
1977
+ }
1978
+ @if (layout().zero; as zero) {
1979
+ <line class="ngx-zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1980
+ }
1981
+ @for (mark of layout().marks; track mark.key) {
1982
+ <rect
1983
+ [attr.x]="mark.x"
1984
+ [attr.y]="mark.y"
1985
+ [attr.width]="mark.width"
1986
+ [attr.height]="mark.height"
1987
+ [attr.fill]="mark.color"
1988
+ rx="3"
1989
+ class="cursor-pointer"
1990
+ [class.ngx-grow-y]="animate() && orientation() !== 'horizontal'"
1991
+ [class.ngx-grow-x]="animate() && orientation() === 'horizontal'"
1992
+ [class.ngx-grow-bottom]="mark.origin === 'bottom'"
1993
+ [class.ngx-grow-top]="mark.origin === 'top'"
1994
+ [class.ngx-grow-left]="mark.origin === 'left'"
1995
+ [class.ngx-grow-right]="mark.origin === 'right'"
1996
+ [style.animation-delay.ms]="animate() ? $index * 18 : 0"
1997
+ (pointerenter)="onMark(mark, $event)"
1998
+ />
1999
+ @if (mark.showLabel) {
2000
+ <text
2001
+ class="ngx-value"
2002
+ [class.ngx-in]="animate()"
2003
+ [style.animation-delay.ms]="animate() ? $index * 18 + 380 : 0"
2004
+ [attr.x]="mark.labelX"
2005
+ [attr.y]="mark.labelY"
2006
+ [attr.text-anchor]="orientation() === 'horizontal' ? 'start' : 'middle'"
2007
+ dominant-baseline="middle"
2008
+ >
2009
+ {{ mark.formatted }}
2010
+ </text>
2011
+ }
2012
+ }
2013
+ @for (label of layout().categories; track label.label + '-' + label.x + '-' + label.y) {
2014
+ <text [attr.x]="label.x" [attr.y]="label.y" [attr.text-anchor]="label.anchor" dominant-baseline="middle">
2015
+ {{ label.label }}
2016
+ </text>
2017
+ }
2018
+ </svg>
2019
+ }
2020
+ </ngx-chart-frame>
2021
+ `,
2022
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
2023
+ }]
2024
+ }],
2025
+ propDecorators: {
2026
+ data: [{
2027
+ type: i0.Input,
2028
+ args: [{
2029
+ isSignal: true,
2030
+ alias: "data",
2031
+ required: false
2032
+ }]
2033
+ }],
2034
+ series: [{
2035
+ type: i0.Input,
2036
+ args: [{
2037
+ isSignal: true,
2038
+ alias: "series",
2039
+ required: false
2040
+ }]
2041
+ }],
2042
+ categories: [{
2043
+ type: i0.Input,
2044
+ args: [{
2045
+ isSignal: true,
2046
+ alias: "categories",
2047
+ required: false
2048
+ }]
2049
+ }],
2050
+ mode: [{
2051
+ type: i0.Input,
2052
+ args: [{
2053
+ isSignal: true,
2054
+ alias: "mode",
2055
+ required: false
2056
+ }]
2057
+ }],
2058
+ orientation: [{
2059
+ type: i0.Input,
2060
+ args: [{
2061
+ isSignal: true,
2062
+ alias: "orientation",
2063
+ required: false
2064
+ }]
2065
+ }],
2066
+ height: [{
2067
+ type: i0.Input,
2068
+ args: [{
2069
+ isSignal: true,
2070
+ alias: "height",
2071
+ required: false
2072
+ }]
2073
+ }],
2074
+ showLegend: [{
2075
+ type: i0.Input,
2076
+ args: [{
2077
+ isSignal: true,
2078
+ alias: "showLegend",
2079
+ required: false
2080
+ }]
2081
+ }],
2082
+ showGrid: [{
2083
+ type: i0.Input,
2084
+ args: [{
2085
+ isSignal: true,
2086
+ alias: "showGrid",
2087
+ required: false
2088
+ }]
2089
+ }],
2090
+ showValues: [{
2091
+ type: i0.Input,
2092
+ args: [{
2093
+ isSignal: true,
2094
+ alias: "showValues",
2095
+ required: false
2096
+ }]
2097
+ }],
2098
+ format: [{
2099
+ type: i0.Input,
2100
+ args: [{
2101
+ isSignal: true,
2102
+ alias: "format",
2103
+ required: false
2104
+ }]
2105
+ }],
2106
+ currency: [{
2107
+ type: i0.Input,
2108
+ args: [{
2109
+ isSignal: true,
2110
+ alias: "currency",
2111
+ required: false
2112
+ }]
2113
+ }],
2114
+ colors: [{
2115
+ type: i0.Input,
2116
+ args: [{
2117
+ isSignal: true,
2118
+ alias: "colors",
2119
+ required: false
2120
+ }]
2121
+ }],
2122
+ ariaLabel: [{
2123
+ type: i0.Input,
2124
+ args: [{
2125
+ isSignal: true,
2126
+ alias: "ariaLabel",
2127
+ required: false
2128
+ }]
2129
+ }],
2130
+ title: [{
2131
+ type: i0.Input,
2132
+ args: [{
2133
+ isSignal: true,
2134
+ alias: "title",
2135
+ required: false
2136
+ }]
2137
+ }],
2138
+ max: [{
2139
+ type: i0.Input,
2140
+ args: [{
2141
+ isSignal: true,
2142
+ alias: "max",
2143
+ required: false
2144
+ }]
2145
+ }],
2146
+ animate: [{
2147
+ type: i0.Input,
2148
+ args: [{
2149
+ isSignal: true,
2150
+ alias: "animate",
2151
+ required: false
2152
+ }]
2153
+ }]
2154
+ }
2155
+ });
2156
+ var NgxPieChart = class NgxPieChart {
2157
+ host = inject(ElementRef);
2158
+ data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
2159
+ donut = input(false, ...ngDevMode ? [{ debugName: "donut" }] : /* istanbul ignore next */ []);
2160
+ innerRatio = input(.62, ...ngDevMode ? [{ debugName: "innerRatio" }] : /* istanbul ignore next */ []);
2161
+ height = input(280, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
2162
+ showLegend = input(void 0, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
2163
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
2164
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
2165
+ colors = input(void 0, ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
2166
+ ariaLabel = input("Pie chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
2167
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
2168
+ animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
2169
+ box = chartBox(this.height);
2170
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
2171
+ isDonut = computed(() => this.donut() || this.host.nativeElement.localName === "ngx-donut-chart", ...ngDevMode ? [{ debugName: "isDonut" }] : /* istanbul ignore next */ []);
2172
+ side = computed(() => Math.max(1, Math.min(this.box.width(), this.height())), ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
2173
+ formatter = computed(() => resolveFormat(this.format(), this.currency()), ...ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []);
2174
+ layout = computed(() => layoutPie({
2175
+ data: this.data(),
2176
+ width: this.side(),
2177
+ height: this.side(),
2178
+ donut: this.isDonut(),
2179
+ innerRatio: this.innerRatio(),
2180
+ palette: this.colors(),
2181
+ format: this.formatter()
2182
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
2183
+ legendOn = computed(() => this.showLegend() ?? true, ...ngDevMode ? [{ debugName: "legendOn" }] : /* istanbul ignore next */ []);
2184
+ totalLabel = computed(() => this.formatter()(this.layout().total), ...ngDevMode ? [{ debugName: "totalLabel" }] : /* istanbul ignore next */ []);
2185
+ rows = computed(() => this.layout().slices.map((slice) => [
2186
+ slice.label,
2187
+ slice.formatted,
2188
+ slice.percent
2189
+ ]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
2190
+ onSlice(slice, event) {
2191
+ this.tip.set(tooltipAt(event, slice.label, [{
2192
+ swatch: slice.color,
2193
+ label: slice.percent,
2194
+ value: slice.formatted
2195
+ }]));
2196
+ }
2197
+ static ɵfac = i0.ɵɵngDeclareFactory({
2198
+ minVersion: "12.0.0",
2199
+ version: "22.2.3",
2200
+ ngImport: i0,
2201
+ type: NgxPieChart,
2202
+ deps: [],
2203
+ target: i0.ɵɵFactoryTarget.Component
2204
+ });
2205
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2206
+ minVersion: "17.0.0",
2207
+ version: "22.2.3",
2208
+ type: NgxPieChart,
2209
+ isStandalone: true,
2210
+ selector: "ngx-pie-chart, ngx-donut-chart",
2211
+ inputs: {
2212
+ data: {
2213
+ classPropertyName: "data",
2214
+ publicName: "data",
2215
+ isSignal: true,
2216
+ isRequired: false,
2217
+ transformFunction: null
2218
+ },
2219
+ donut: {
2220
+ classPropertyName: "donut",
2221
+ publicName: "donut",
2222
+ isSignal: true,
2223
+ isRequired: false,
2224
+ transformFunction: null
2225
+ },
2226
+ innerRatio: {
2227
+ classPropertyName: "innerRatio",
2228
+ publicName: "innerRatio",
2229
+ isSignal: true,
2230
+ isRequired: false,
2231
+ transformFunction: null
2232
+ },
2233
+ height: {
2234
+ classPropertyName: "height",
2235
+ publicName: "height",
2236
+ isSignal: true,
2237
+ isRequired: false,
2238
+ transformFunction: null
2239
+ },
2240
+ showLegend: {
2241
+ classPropertyName: "showLegend",
2242
+ publicName: "showLegend",
2243
+ isSignal: true,
2244
+ isRequired: false,
2245
+ transformFunction: null
2246
+ },
2247
+ format: {
2248
+ classPropertyName: "format",
2249
+ publicName: "format",
2250
+ isSignal: true,
2251
+ isRequired: false,
2252
+ transformFunction: null
2253
+ },
2254
+ currency: {
2255
+ classPropertyName: "currency",
2256
+ publicName: "currency",
2257
+ isSignal: true,
2258
+ isRequired: false,
2259
+ transformFunction: null
2260
+ },
2261
+ colors: {
2262
+ classPropertyName: "colors",
2263
+ publicName: "colors",
2264
+ isSignal: true,
2265
+ isRequired: false,
2266
+ transformFunction: null
2267
+ },
2268
+ ariaLabel: {
2269
+ classPropertyName: "ariaLabel",
2270
+ publicName: "ariaLabel",
2271
+ isSignal: true,
2272
+ isRequired: false,
2273
+ transformFunction: null
2274
+ },
2275
+ title: {
2276
+ classPropertyName: "title",
2277
+ publicName: "title",
2278
+ isSignal: true,
2279
+ isRequired: false,
2280
+ transformFunction: null
2281
+ },
2282
+ animate: {
2283
+ classPropertyName: "animate",
2284
+ publicName: "animate",
2285
+ isSignal: true,
2286
+ isRequired: false,
2287
+ transformFunction: null
2288
+ }
2289
+ },
2290
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
2291
+ ngImport: i0,
2292
+ template: `
2293
+ <ngx-chart-frame
2294
+ [title]="title()"
2295
+ [ariaLabel]="ariaLabel()"
2296
+ [legend]="layout().legend"
2297
+ [showLegend]="legendOn()"
2298
+ [tooltip]="tip()"
2299
+ [srHeaders]="['Category', 'Value', 'Share']"
2300
+ [srRows]="rows()"
2301
+ >
2302
+ @if (layout().empty) {
2303
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
2304
+ } @else {
2305
+ <div class="ngx-square" [style.width.px]="side()" [style.height.px]="side()">
2306
+ <svg class="h-full w-full" [attr.viewBox]="'0 0 ' + side() + ' ' + side()" aria-hidden="true" (pointerleave)="tip.set(null)">
2307
+ @for (slice of layout().slices; track slice.key) {
2308
+ <path
2309
+ [attr.d]="slice.path"
2310
+ [attr.fill]="slice.color"
2311
+ class="cursor-pointer"
2312
+ [class.ngx-in]="animate()"
2313
+ stroke="var(--ngx-surface)"
2314
+ stroke-width="1"
2315
+ (pointerenter)="onSlice(slice, $event)"
2316
+ />
2317
+ }
2318
+ </svg>
2319
+ @if (isDonut()) {
2320
+ <div class="pointer-events-none absolute inset-0 flex flex-col items-center justify-center">
2321
+ <span class="text-xs">Total</span>
2322
+ <span class="font-display text-2xl font-medium text-foreground">{{ totalLabel() }}</span>
2323
+ </div>
2324
+ }
2325
+ </div>
2326
+ }
2327
+ </ngx-chart-frame>
2328
+ `,
2329
+ isInline: true,
2330
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
2331
+ dependencies: [{
2332
+ kind: "component",
2333
+ type: NgxChartFrame,
2334
+ selector: "ngx-chart-frame",
2335
+ inputs: [
2336
+ "title",
2337
+ "ariaLabel",
2338
+ "legend",
2339
+ "showLegend",
2340
+ "tooltip",
2341
+ "srHeaders",
2342
+ "srRows",
2343
+ "range"
2344
+ ]
2345
+ }],
2346
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2347
+ });
2348
+ };
2349
+ i0.ɵɵngDeclareClassMetadata({
2350
+ minVersion: "12.0.0",
2351
+ version: "22.2.3",
2352
+ ngImport: i0,
2353
+ type: NgxPieChart,
2354
+ decorators: [{
2355
+ type: Component,
2356
+ args: [{
2357
+ selector: "ngx-pie-chart, ngx-donut-chart",
2358
+ changeDetection: ChangeDetectionStrategy.OnPush,
2359
+ imports: [NgxChartFrame],
2360
+ host: { "[style.--ngx-chart-height.px]": "height()" },
2361
+ template: `
2362
+ <ngx-chart-frame
2363
+ [title]="title()"
2364
+ [ariaLabel]="ariaLabel()"
2365
+ [legend]="layout().legend"
2366
+ [showLegend]="legendOn()"
2367
+ [tooltip]="tip()"
2368
+ [srHeaders]="['Category', 'Value', 'Share']"
2369
+ [srRows]="rows()"
2370
+ >
2371
+ @if (layout().empty) {
2372
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
2373
+ } @else {
2374
+ <div class="ngx-square" [style.width.px]="side()" [style.height.px]="side()">
2375
+ <svg class="h-full w-full" [attr.viewBox]="'0 0 ' + side() + ' ' + side()" aria-hidden="true" (pointerleave)="tip.set(null)">
2376
+ @for (slice of layout().slices; track slice.key) {
2377
+ <path
2378
+ [attr.d]="slice.path"
2379
+ [attr.fill]="slice.color"
2380
+ class="cursor-pointer"
2381
+ [class.ngx-in]="animate()"
2382
+ stroke="var(--ngx-surface)"
2383
+ stroke-width="1"
2384
+ (pointerenter)="onSlice(slice, $event)"
2385
+ />
2386
+ }
2387
+ </svg>
2388
+ @if (isDonut()) {
2389
+ <div class="pointer-events-none absolute inset-0 flex flex-col items-center justify-center">
2390
+ <span class="text-xs">Total</span>
2391
+ <span class="font-display text-2xl font-medium text-foreground">{{ totalLabel() }}</span>
2392
+ </div>
2393
+ }
2394
+ </div>
2395
+ }
2396
+ </ngx-chart-frame>
2397
+ `,
2398
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
2399
+ }]
2400
+ }],
2401
+ propDecorators: {
2402
+ data: [{
2403
+ type: i0.Input,
2404
+ args: [{
2405
+ isSignal: true,
2406
+ alias: "data",
2407
+ required: false
2408
+ }]
2409
+ }],
2410
+ donut: [{
2411
+ type: i0.Input,
2412
+ args: [{
2413
+ isSignal: true,
2414
+ alias: "donut",
2415
+ required: false
2416
+ }]
2417
+ }],
2418
+ innerRatio: [{
2419
+ type: i0.Input,
2420
+ args: [{
2421
+ isSignal: true,
2422
+ alias: "innerRatio",
2423
+ required: false
2424
+ }]
2425
+ }],
2426
+ height: [{
2427
+ type: i0.Input,
2428
+ args: [{
2429
+ isSignal: true,
2430
+ alias: "height",
2431
+ required: false
2432
+ }]
2433
+ }],
2434
+ showLegend: [{
2435
+ type: i0.Input,
2436
+ args: [{
2437
+ isSignal: true,
2438
+ alias: "showLegend",
2439
+ required: false
2440
+ }]
2441
+ }],
2442
+ format: [{
2443
+ type: i0.Input,
2444
+ args: [{
2445
+ isSignal: true,
2446
+ alias: "format",
2447
+ required: false
2448
+ }]
2449
+ }],
2450
+ currency: [{
2451
+ type: i0.Input,
2452
+ args: [{
2453
+ isSignal: true,
2454
+ alias: "currency",
2455
+ required: false
2456
+ }]
2457
+ }],
2458
+ colors: [{
2459
+ type: i0.Input,
2460
+ args: [{
2461
+ isSignal: true,
2462
+ alias: "colors",
2463
+ required: false
2464
+ }]
2465
+ }],
2466
+ ariaLabel: [{
2467
+ type: i0.Input,
2468
+ args: [{
2469
+ isSignal: true,
2470
+ alias: "ariaLabel",
2471
+ required: false
2472
+ }]
2473
+ }],
2474
+ title: [{
2475
+ type: i0.Input,
2476
+ args: [{
2477
+ isSignal: true,
2478
+ alias: "title",
2479
+ required: false
2480
+ }]
2481
+ }],
2482
+ animate: [{
2483
+ type: i0.Input,
2484
+ args: [{
2485
+ isSignal: true,
2486
+ alias: "animate",
2487
+ required: false
2488
+ }]
2489
+ }]
2490
+ }
2491
+ });
2492
+ var NgxGaugeChart = class NgxGaugeChart {
2493
+ value = input(0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
2494
+ min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
2495
+ max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
2496
+ label = input(void 0, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
2497
+ height = input(220, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
2498
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
2499
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
2500
+ color = input(void 0, ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
2501
+ ariaLabel = input("Gauge chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
2502
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
2503
+ animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
2504
+ box = chartBox(this.height);
2505
+ formatter = computed(() => resolveFormat(this.format(), this.currency()), ...ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []);
2506
+ formatted = computed(() => this.formatter()(this.value()), ...ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []);
2507
+ layout = computed(() => layoutGauge({
2508
+ value: this.value(),
2509
+ min: this.min(),
2510
+ max: this.max(),
2511
+ width: this.box.width(),
2512
+ height: this.height(),
2513
+ color: this.color()
2514
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
2515
+ static ɵfac = i0.ɵɵngDeclareFactory({
2516
+ minVersion: "12.0.0",
2517
+ version: "22.2.3",
2518
+ ngImport: i0,
2519
+ type: NgxGaugeChart,
2520
+ deps: [],
2521
+ target: i0.ɵɵFactoryTarget.Component
2522
+ });
2523
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2524
+ minVersion: "17.0.0",
2525
+ version: "22.2.3",
2526
+ type: NgxGaugeChart,
2527
+ isStandalone: true,
2528
+ selector: "ngx-gauge-chart",
2529
+ inputs: {
2530
+ value: {
2531
+ classPropertyName: "value",
2532
+ publicName: "value",
2533
+ isSignal: true,
2534
+ isRequired: false,
2535
+ transformFunction: null
2536
+ },
2537
+ min: {
2538
+ classPropertyName: "min",
2539
+ publicName: "min",
2540
+ isSignal: true,
2541
+ isRequired: false,
2542
+ transformFunction: null
2543
+ },
2544
+ max: {
2545
+ classPropertyName: "max",
2546
+ publicName: "max",
2547
+ isSignal: true,
2548
+ isRequired: false,
2549
+ transformFunction: null
2550
+ },
2551
+ label: {
2552
+ classPropertyName: "label",
2553
+ publicName: "label",
2554
+ isSignal: true,
2555
+ isRequired: false,
2556
+ transformFunction: null
2557
+ },
2558
+ height: {
2559
+ classPropertyName: "height",
2560
+ publicName: "height",
2561
+ isSignal: true,
2562
+ isRequired: false,
2563
+ transformFunction: null
2564
+ },
2565
+ format: {
2566
+ classPropertyName: "format",
2567
+ publicName: "format",
2568
+ isSignal: true,
2569
+ isRequired: false,
2570
+ transformFunction: null
2571
+ },
2572
+ currency: {
2573
+ classPropertyName: "currency",
2574
+ publicName: "currency",
2575
+ isSignal: true,
2576
+ isRequired: false,
2577
+ transformFunction: null
2578
+ },
2579
+ color: {
2580
+ classPropertyName: "color",
2581
+ publicName: "color",
2582
+ isSignal: true,
2583
+ isRequired: false,
2584
+ transformFunction: null
2585
+ },
2586
+ ariaLabel: {
2587
+ classPropertyName: "ariaLabel",
2588
+ publicName: "ariaLabel",
2589
+ isSignal: true,
2590
+ isRequired: false,
2591
+ transformFunction: null
2592
+ },
2593
+ title: {
2594
+ classPropertyName: "title",
2595
+ publicName: "title",
2596
+ isSignal: true,
2597
+ isRequired: false,
2598
+ transformFunction: null
2599
+ },
2600
+ animate: {
2601
+ classPropertyName: "animate",
2602
+ publicName: "animate",
2603
+ isSignal: true,
2604
+ isRequired: false,
2605
+ transformFunction: null
2606
+ }
2607
+ },
2608
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
2609
+ ngImport: i0,
2610
+ template: `
2611
+ <ngx-chart-frame
2612
+ [title]="title()"
2613
+ [ariaLabel]="ariaLabel()"
2614
+ [srHeaders]="['Label', 'Value']"
2615
+ [srRows]="[[label() || ariaLabel(), formatted()]]"
2616
+ >
2617
+ <div class="relative w-full" [style.height.px]="height()">
2618
+ <svg class="h-full w-full" [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height" aria-hidden="true">
2619
+ <path [attr.d]="layout().track" fill="none" stroke="var(--ngx-track)" stroke-width="14" stroke-linecap="round" />
2620
+ @if (layout().valuePath) {
2621
+ <path
2622
+ [attr.d]="layout().valuePath"
2623
+ fill="none"
2624
+ [attr.stroke]="layout().color"
2625
+ stroke-width="14"
2626
+ stroke-linecap="round"
2627
+ [class.ngx-in]="animate()"
2628
+ />
2629
+ }
2630
+ </svg>
2631
+ <div
2632
+ class="pointer-events-none absolute flex -translate-x-1/2 -translate-y-1/2 flex-col items-center"
2633
+ [style.left.%]="(layout().labelX / layout().width) * 100"
2634
+ [style.top.%]="(layout().labelY / layout().height) * 100"
2635
+ >
2636
+ <span class="font-display text-3xl font-medium text-foreground">{{ formatted() }}</span>
2637
+ @if (label()) {
2638
+ <span class="text-xs">{{ label() }}</span>
2639
+ }
2640
+ </div>
2641
+ </div>
2642
+ </ngx-chart-frame>
2643
+ `,
2644
+ isInline: true,
2645
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
2646
+ dependencies: [{
2647
+ kind: "component",
2648
+ type: NgxChartFrame,
2649
+ selector: "ngx-chart-frame",
2650
+ inputs: [
2651
+ "title",
2652
+ "ariaLabel",
2653
+ "legend",
2654
+ "showLegend",
2655
+ "tooltip",
2656
+ "srHeaders",
2657
+ "srRows",
2658
+ "range"
2659
+ ]
2660
+ }],
2661
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2662
+ });
2663
+ };
2664
+ i0.ɵɵngDeclareClassMetadata({
2665
+ minVersion: "12.0.0",
2666
+ version: "22.2.3",
2667
+ ngImport: i0,
2668
+ type: NgxGaugeChart,
2669
+ decorators: [{
2670
+ type: Component,
2671
+ args: [{
2672
+ selector: "ngx-gauge-chart",
2673
+ changeDetection: ChangeDetectionStrategy.OnPush,
2674
+ imports: [NgxChartFrame],
2675
+ host: { "[style.--ngx-chart-height.px]": "height()" },
2676
+ template: `
2677
+ <ngx-chart-frame
2678
+ [title]="title()"
2679
+ [ariaLabel]="ariaLabel()"
2680
+ [srHeaders]="['Label', 'Value']"
2681
+ [srRows]="[[label() || ariaLabel(), formatted()]]"
2682
+ >
2683
+ <div class="relative w-full" [style.height.px]="height()">
2684
+ <svg class="h-full w-full" [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height" aria-hidden="true">
2685
+ <path [attr.d]="layout().track" fill="none" stroke="var(--ngx-track)" stroke-width="14" stroke-linecap="round" />
2686
+ @if (layout().valuePath) {
2687
+ <path
2688
+ [attr.d]="layout().valuePath"
2689
+ fill="none"
2690
+ [attr.stroke]="layout().color"
2691
+ stroke-width="14"
2692
+ stroke-linecap="round"
2693
+ [class.ngx-in]="animate()"
2694
+ />
2695
+ }
2696
+ </svg>
2697
+ <div
2698
+ class="pointer-events-none absolute flex -translate-x-1/2 -translate-y-1/2 flex-col items-center"
2699
+ [style.left.%]="(layout().labelX / layout().width) * 100"
2700
+ [style.top.%]="(layout().labelY / layout().height) * 100"
2701
+ >
2702
+ <span class="font-display text-3xl font-medium text-foreground">{{ formatted() }}</span>
2703
+ @if (label()) {
2704
+ <span class="text-xs">{{ label() }}</span>
2705
+ }
2706
+ </div>
2707
+ </div>
2708
+ </ngx-chart-frame>
2709
+ `,
2710
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
2711
+ }]
2712
+ }],
2713
+ propDecorators: {
2714
+ value: [{
2715
+ type: i0.Input,
2716
+ args: [{
2717
+ isSignal: true,
2718
+ alias: "value",
2719
+ required: false
2720
+ }]
2721
+ }],
2722
+ min: [{
2723
+ type: i0.Input,
2724
+ args: [{
2725
+ isSignal: true,
2726
+ alias: "min",
2727
+ required: false
2728
+ }]
2729
+ }],
2730
+ max: [{
2731
+ type: i0.Input,
2732
+ args: [{
2733
+ isSignal: true,
2734
+ alias: "max",
2735
+ required: false
2736
+ }]
2737
+ }],
2738
+ label: [{
2739
+ type: i0.Input,
2740
+ args: [{
2741
+ isSignal: true,
2742
+ alias: "label",
2743
+ required: false
2744
+ }]
2745
+ }],
2746
+ height: [{
2747
+ type: i0.Input,
2748
+ args: [{
2749
+ isSignal: true,
2750
+ alias: "height",
2751
+ required: false
2752
+ }]
2753
+ }],
2754
+ format: [{
2755
+ type: i0.Input,
2756
+ args: [{
2757
+ isSignal: true,
2758
+ alias: "format",
2759
+ required: false
2760
+ }]
2761
+ }],
2762
+ currency: [{
2763
+ type: i0.Input,
2764
+ args: [{
2765
+ isSignal: true,
2766
+ alias: "currency",
2767
+ required: false
2768
+ }]
2769
+ }],
2770
+ color: [{
2771
+ type: i0.Input,
2772
+ args: [{
2773
+ isSignal: true,
2774
+ alias: "color",
2775
+ required: false
2776
+ }]
2777
+ }],
2778
+ ariaLabel: [{
2779
+ type: i0.Input,
2780
+ args: [{
2781
+ isSignal: true,
2782
+ alias: "ariaLabel",
2783
+ required: false
2784
+ }]
2785
+ }],
2786
+ title: [{
2787
+ type: i0.Input,
2788
+ args: [{
2789
+ isSignal: true,
2790
+ alias: "title",
2791
+ required: false
2792
+ }]
2793
+ }],
2794
+ animate: [{
2795
+ type: i0.Input,
2796
+ args: [{
2797
+ isSignal: true,
2798
+ alias: "animate",
2799
+ required: false
2800
+ }]
2801
+ }]
2802
+ }
2803
+ });
2804
+ var NgxHeatmap = class NgxHeatmap {
2805
+ xLabels = input([], ...ngDevMode ? [{ debugName: "xLabels" }] : /* istanbul ignore next */ []);
2806
+ yLabels = input([], ...ngDevMode ? [{ debugName: "yLabels" }] : /* istanbul ignore next */ []);
2807
+ data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
2808
+ height = input(280, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
2809
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
2810
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
2811
+ ariaLabel = input("Heatmap", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
2812
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
2813
+ box = chartBox(this.height);
2814
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
2815
+ formatter = computed(() => resolveFormat(this.format(), this.currency()), ...ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []);
2816
+ layout = computed(() => layoutHeatmap({
2817
+ xLabels: this.xLabels(),
2818
+ yLabels: this.yLabels(),
2819
+ data: this.data(),
2820
+ width: this.box.width(),
2821
+ height: this.height(),
2822
+ format: this.formatter()
2823
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
2824
+ range = computed(() => this.layout().empty ? void 0 : {
2825
+ min: this.formatter()(this.layout().min),
2826
+ max: this.formatter()(this.layout().max)
2827
+ }, ...ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []);
2828
+ headers = computed(() => ["", ...this.xLabels()], ...ngDevMode ? [{ debugName: "headers" }] : /* istanbul ignore next */ []);
2829
+ rows = computed(() => this.yLabels().map((label, row) => [label, ...(this.data()[row] ?? []).map((value) => this.formatter()(value))]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
2830
+ fill(t) {
2831
+ return `color-mix(in oklab, var(--ngx-2) ${Math.round(t * 100)}%, var(--ngx-track))`;
2832
+ }
2833
+ onCell(cell, event) {
2834
+ this.tip.set(tooltipAt(event, `${cell.ylabel} · ${cell.xlabel}`, [{
2835
+ swatch: "var(--ngx-2)",
2836
+ label: "Value",
2837
+ value: cell.formatted
2838
+ }]));
2839
+ }
2840
+ static ɵfac = i0.ɵɵngDeclareFactory({
2841
+ minVersion: "12.0.0",
2842
+ version: "22.2.3",
2843
+ ngImport: i0,
2844
+ type: NgxHeatmap,
2845
+ deps: [],
2846
+ target: i0.ɵɵFactoryTarget.Component
2847
+ });
2848
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2849
+ minVersion: "17.0.0",
2850
+ version: "22.2.3",
2851
+ type: NgxHeatmap,
2852
+ isStandalone: true,
2853
+ selector: "ngx-heatmap",
2854
+ inputs: {
2855
+ xLabels: {
2856
+ classPropertyName: "xLabels",
2857
+ publicName: "xLabels",
2858
+ isSignal: true,
2859
+ isRequired: false,
2860
+ transformFunction: null
2861
+ },
2862
+ yLabels: {
2863
+ classPropertyName: "yLabels",
2864
+ publicName: "yLabels",
2865
+ isSignal: true,
2866
+ isRequired: false,
2867
+ transformFunction: null
2868
+ },
2869
+ data: {
2870
+ classPropertyName: "data",
2871
+ publicName: "data",
2872
+ isSignal: true,
2873
+ isRequired: false,
2874
+ transformFunction: null
2875
+ },
2876
+ height: {
2877
+ classPropertyName: "height",
2878
+ publicName: "height",
2879
+ isSignal: true,
2880
+ isRequired: false,
2881
+ transformFunction: null
2882
+ },
2883
+ format: {
2884
+ classPropertyName: "format",
2885
+ publicName: "format",
2886
+ isSignal: true,
2887
+ isRequired: false,
2888
+ transformFunction: null
2889
+ },
2890
+ currency: {
2891
+ classPropertyName: "currency",
2892
+ publicName: "currency",
2893
+ isSignal: true,
2894
+ isRequired: false,
2895
+ transformFunction: null
2896
+ },
2897
+ ariaLabel: {
2898
+ classPropertyName: "ariaLabel",
2899
+ publicName: "ariaLabel",
2900
+ isSignal: true,
2901
+ isRequired: false,
2902
+ transformFunction: null
2903
+ },
2904
+ title: {
2905
+ classPropertyName: "title",
2906
+ publicName: "title",
2907
+ isSignal: true,
2908
+ isRequired: false,
2909
+ transformFunction: null
2910
+ }
2911
+ },
2912
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
2913
+ ngImport: i0,
2914
+ template: `
2915
+ <ngx-chart-frame
2916
+ [title]="title()"
2917
+ [ariaLabel]="ariaLabel()"
2918
+ [tooltip]="tip()"
2919
+ [range]="range()"
2920
+ [srHeaders]="headers()"
2921
+ [srRows]="rows()"
2922
+ >
2923
+ @if (layout().empty) {
2924
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
2925
+ } @else {
2926
+ <svg
2927
+ class="block w-full max-w-full"
2928
+ [style.height.px]="height()"
2929
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
2930
+ aria-hidden="true"
2931
+ (pointerleave)="tip.set(null)"
2932
+ >
2933
+ @for (cell of layout().cells; track cell.key) {
2934
+ <rect
2935
+ [attr.x]="cell.x"
2936
+ [attr.y]="cell.y"
2937
+ [attr.width]="cell.width"
2938
+ [attr.height]="cell.height"
2939
+ rx="4"
2940
+ [attr.fill]="fill(cell.t)"
2941
+ class="cursor-pointer"
2942
+ (pointerenter)="onCell(cell, $event)"
2943
+ />
2944
+ }
2945
+ @for (label of layout().xLabels; track label.label + '-' + label.x) {
2946
+ <text [attr.x]="label.x" [attr.y]="label.y" text-anchor="middle" dominant-baseline="middle">{{ label.label }}</text>
2947
+ }
2948
+ @for (label of layout().yLabels; track label.label + '-' + label.y) {
2949
+ <text [attr.x]="label.x" [attr.y]="label.y" text-anchor="end" dominant-baseline="middle">{{ label.label }}</text>
2950
+ }
2951
+ </svg>
2952
+ }
2953
+ </ngx-chart-frame>
2954
+ `,
2955
+ isInline: true,
2956
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
2957
+ dependencies: [{
2958
+ kind: "component",
2959
+ type: NgxChartFrame,
2960
+ selector: "ngx-chart-frame",
2961
+ inputs: [
2962
+ "title",
2963
+ "ariaLabel",
2964
+ "legend",
2965
+ "showLegend",
2966
+ "tooltip",
2967
+ "srHeaders",
2968
+ "srRows",
2969
+ "range"
2970
+ ]
2971
+ }],
2972
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2973
+ });
2974
+ };
2975
+ i0.ɵɵngDeclareClassMetadata({
2976
+ minVersion: "12.0.0",
2977
+ version: "22.2.3",
2978
+ ngImport: i0,
2979
+ type: NgxHeatmap,
2980
+ decorators: [{
2981
+ type: Component,
2982
+ args: [{
2983
+ selector: "ngx-heatmap",
2984
+ changeDetection: ChangeDetectionStrategy.OnPush,
2985
+ imports: [NgxChartFrame],
2986
+ host: { "[style.--ngx-chart-height.px]": "height()" },
2987
+ template: `
2988
+ <ngx-chart-frame
2989
+ [title]="title()"
2990
+ [ariaLabel]="ariaLabel()"
2991
+ [tooltip]="tip()"
2992
+ [range]="range()"
2993
+ [srHeaders]="headers()"
2994
+ [srRows]="rows()"
2995
+ >
2996
+ @if (layout().empty) {
2997
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
2998
+ } @else {
2999
+ <svg
3000
+ class="block w-full max-w-full"
3001
+ [style.height.px]="height()"
3002
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
3003
+ aria-hidden="true"
3004
+ (pointerleave)="tip.set(null)"
3005
+ >
3006
+ @for (cell of layout().cells; track cell.key) {
3007
+ <rect
3008
+ [attr.x]="cell.x"
3009
+ [attr.y]="cell.y"
3010
+ [attr.width]="cell.width"
3011
+ [attr.height]="cell.height"
3012
+ rx="4"
3013
+ [attr.fill]="fill(cell.t)"
3014
+ class="cursor-pointer"
3015
+ (pointerenter)="onCell(cell, $event)"
3016
+ />
3017
+ }
3018
+ @for (label of layout().xLabels; track label.label + '-' + label.x) {
3019
+ <text [attr.x]="label.x" [attr.y]="label.y" text-anchor="middle" dominant-baseline="middle">{{ label.label }}</text>
3020
+ }
3021
+ @for (label of layout().yLabels; track label.label + '-' + label.y) {
3022
+ <text [attr.x]="label.x" [attr.y]="label.y" text-anchor="end" dominant-baseline="middle">{{ label.label }}</text>
3023
+ }
3024
+ </svg>
3025
+ }
3026
+ </ngx-chart-frame>
3027
+ `,
3028
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
3029
+ }]
3030
+ }],
3031
+ propDecorators: {
3032
+ xLabels: [{
3033
+ type: i0.Input,
3034
+ args: [{
3035
+ isSignal: true,
3036
+ alias: "xLabels",
3037
+ required: false
3038
+ }]
3039
+ }],
3040
+ yLabels: [{
3041
+ type: i0.Input,
3042
+ args: [{
3043
+ isSignal: true,
3044
+ alias: "yLabels",
3045
+ required: false
3046
+ }]
3047
+ }],
3048
+ data: [{
3049
+ type: i0.Input,
3050
+ args: [{
3051
+ isSignal: true,
3052
+ alias: "data",
3053
+ required: false
3054
+ }]
3055
+ }],
3056
+ height: [{
3057
+ type: i0.Input,
3058
+ args: [{
3059
+ isSignal: true,
3060
+ alias: "height",
3061
+ required: false
3062
+ }]
3063
+ }],
3064
+ format: [{
3065
+ type: i0.Input,
3066
+ args: [{
3067
+ isSignal: true,
3068
+ alias: "format",
3069
+ required: false
3070
+ }]
3071
+ }],
3072
+ currency: [{
3073
+ type: i0.Input,
3074
+ args: [{
3075
+ isSignal: true,
3076
+ alias: "currency",
3077
+ required: false
3078
+ }]
3079
+ }],
3080
+ ariaLabel: [{
3081
+ type: i0.Input,
3082
+ args: [{
3083
+ isSignal: true,
3084
+ alias: "ariaLabel",
3085
+ required: false
3086
+ }]
3087
+ }],
3088
+ title: [{
3089
+ type: i0.Input,
3090
+ args: [{
3091
+ isSignal: true,
3092
+ alias: "title",
3093
+ required: false
3094
+ }]
3095
+ }]
3096
+ }
3097
+ });
3098
+ var NgxRadarChart = class NgxRadarChart {
3099
+ series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
3100
+ categories = input([], ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
3101
+ height = input(320, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
3102
+ showLegend = input(void 0, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
3103
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
3104
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
3105
+ colors = input(void 0, ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
3106
+ ariaLabel = input("Radar chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
3107
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
3108
+ animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
3109
+ box = chartBox(this.height);
3110
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
3111
+ side = computed(() => Math.max(1, Math.min(this.box.width(), this.height())), ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
3112
+ normalized = computed(() => normalizeSeries({
3113
+ series: this.series(),
3114
+ categories: this.categories()
3115
+ }), ...ngDevMode ? [{ debugName: "normalized" }] : /* istanbul ignore next */ []);
3116
+ layout = computed(() => layoutRadar({
3117
+ categories: this.normalized().categories,
3118
+ series: this.normalized().series,
3119
+ width: this.side(),
3120
+ height: this.side(),
3121
+ palette: this.colors(),
3122
+ format: resolveFormat(this.format(), this.currency())
3123
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
3124
+ legendOn = computed(() => this.showLegend() ?? this.layout().legend.length > 0, ...ngDevMode ? [{ debugName: "legendOn" }] : /* istanbul ignore next */ []);
3125
+ headers = computed(() => ["Axis", ...this.normalized().series.map((item) => item.name)], ...ngDevMode ? [{ debugName: "headers" }] : /* istanbul ignore next */ []);
3126
+ rows = computed(() => this.normalized().categories.map((category, index) => [category, ...this.normalized().series.map((item) => String(item.data[index] ?? 0))]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
3127
+ onPoint(point, event) {
3128
+ this.tip.set(tooltipAt(event, point.axis, [{
3129
+ swatch: point.color,
3130
+ label: point.series,
3131
+ value: point.formatted
3132
+ }]));
3133
+ }
3134
+ static ɵfac = i0.ɵɵngDeclareFactory({
3135
+ minVersion: "12.0.0",
3136
+ version: "22.2.3",
3137
+ ngImport: i0,
3138
+ type: NgxRadarChart,
3139
+ deps: [],
3140
+ target: i0.ɵɵFactoryTarget.Component
3141
+ });
3142
+ static ɵcmp = i0.ɵɵngDeclareComponent({
3143
+ minVersion: "17.0.0",
3144
+ version: "22.2.3",
3145
+ type: NgxRadarChart,
3146
+ isStandalone: true,
3147
+ selector: "ngx-radar-chart",
3148
+ inputs: {
3149
+ series: {
3150
+ classPropertyName: "series",
3151
+ publicName: "series",
3152
+ isSignal: true,
3153
+ isRequired: false,
3154
+ transformFunction: null
3155
+ },
3156
+ categories: {
3157
+ classPropertyName: "categories",
3158
+ publicName: "categories",
3159
+ isSignal: true,
3160
+ isRequired: false,
3161
+ transformFunction: null
3162
+ },
3163
+ height: {
3164
+ classPropertyName: "height",
3165
+ publicName: "height",
3166
+ isSignal: true,
3167
+ isRequired: false,
3168
+ transformFunction: null
3169
+ },
3170
+ showLegend: {
3171
+ classPropertyName: "showLegend",
3172
+ publicName: "showLegend",
3173
+ isSignal: true,
3174
+ isRequired: false,
3175
+ transformFunction: null
3176
+ },
3177
+ format: {
3178
+ classPropertyName: "format",
3179
+ publicName: "format",
3180
+ isSignal: true,
3181
+ isRequired: false,
3182
+ transformFunction: null
3183
+ },
3184
+ currency: {
3185
+ classPropertyName: "currency",
3186
+ publicName: "currency",
3187
+ isSignal: true,
3188
+ isRequired: false,
3189
+ transformFunction: null
3190
+ },
3191
+ colors: {
3192
+ classPropertyName: "colors",
3193
+ publicName: "colors",
3194
+ isSignal: true,
3195
+ isRequired: false,
3196
+ transformFunction: null
3197
+ },
3198
+ ariaLabel: {
3199
+ classPropertyName: "ariaLabel",
3200
+ publicName: "ariaLabel",
3201
+ isSignal: true,
3202
+ isRequired: false,
3203
+ transformFunction: null
3204
+ },
3205
+ title: {
3206
+ classPropertyName: "title",
3207
+ publicName: "title",
3208
+ isSignal: true,
3209
+ isRequired: false,
3210
+ transformFunction: null
3211
+ },
3212
+ animate: {
3213
+ classPropertyName: "animate",
3214
+ publicName: "animate",
3215
+ isSignal: true,
3216
+ isRequired: false,
3217
+ transformFunction: null
3218
+ }
3219
+ },
3220
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
3221
+ ngImport: i0,
3222
+ template: `
3223
+ <ngx-chart-frame
3224
+ [title]="title()"
3225
+ [ariaLabel]="ariaLabel()"
3226
+ [legend]="layout().legend"
3227
+ [showLegend]="legendOn()"
3228
+ [tooltip]="tip()"
3229
+ [srHeaders]="headers()"
3230
+ [srRows]="rows()"
3231
+ >
3232
+ @if (layout().empty) {
3233
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">Add at least three axes.</p>
3234
+ } @else {
3235
+ <div class="ngx-square" [style.width.px]="side()" [style.height.px]="side()">
3236
+ <svg class="h-full w-full" [attr.viewBox]="'0 0 ' + side() + ' ' + side()" aria-hidden="true" (pointerleave)="tip.set(null)">
3237
+ @for (ring of layout().rings; track $index) {
3238
+ <path [attr.d]="ring" fill="none" class="ngx-grid" />
3239
+ }
3240
+ @for (spoke of layout().spokes; track $index) {
3241
+ <line class="ngx-grid" [attr.x1]="spoke.x1" [attr.y1]="spoke.y1" [attr.x2]="spoke.x2" [attr.y2]="spoke.y2" />
3242
+ }
3243
+ @for (item of layout().series; track item.name) {
3244
+ <path [attr.d]="item.polygon" [attr.fill]="item.color" fill-opacity="0.16" [attr.stroke]="item.color" stroke-width="2" [class.ngx-in]="animate()" />
3245
+ @for (point of item.points; track point.key) {
3246
+ <circle
3247
+ [attr.cx]="point.x"
3248
+ [attr.cy]="point.y"
3249
+ r="3.5"
3250
+ [attr.fill]="point.color"
3251
+ class="cursor-pointer"
3252
+ (pointerenter)="onPoint(point, $event)"
3253
+ />
3254
+ }
3255
+ }
3256
+ @for (axis of layout().axes; track axis.label + '-' + axis.x) {
3257
+ <text [attr.x]="axis.x" [attr.y]="axis.y" [attr.text-anchor]="axis.anchor" dominant-baseline="middle">{{ axis.label }}</text>
3258
+ }
3259
+ </svg>
3260
+ </div>
3261
+ }
3262
+ </ngx-chart-frame>
3263
+ `,
3264
+ isInline: true,
3265
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
3266
+ dependencies: [{
3267
+ kind: "component",
3268
+ type: NgxChartFrame,
3269
+ selector: "ngx-chart-frame",
3270
+ inputs: [
3271
+ "title",
3272
+ "ariaLabel",
3273
+ "legend",
3274
+ "showLegend",
3275
+ "tooltip",
3276
+ "srHeaders",
3277
+ "srRows",
3278
+ "range"
3279
+ ]
3280
+ }],
3281
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3282
+ });
3283
+ };
3284
+ i0.ɵɵngDeclareClassMetadata({
3285
+ minVersion: "12.0.0",
3286
+ version: "22.2.3",
3287
+ ngImport: i0,
3288
+ type: NgxRadarChart,
3289
+ decorators: [{
3290
+ type: Component,
3291
+ args: [{
3292
+ selector: "ngx-radar-chart",
3293
+ changeDetection: ChangeDetectionStrategy.OnPush,
3294
+ imports: [NgxChartFrame],
3295
+ host: { "[style.--ngx-chart-height.px]": "height()" },
3296
+ template: `
3297
+ <ngx-chart-frame
3298
+ [title]="title()"
3299
+ [ariaLabel]="ariaLabel()"
3300
+ [legend]="layout().legend"
3301
+ [showLegend]="legendOn()"
3302
+ [tooltip]="tip()"
3303
+ [srHeaders]="headers()"
3304
+ [srRows]="rows()"
3305
+ >
3306
+ @if (layout().empty) {
3307
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">Add at least three axes.</p>
3308
+ } @else {
3309
+ <div class="ngx-square" [style.width.px]="side()" [style.height.px]="side()">
3310
+ <svg class="h-full w-full" [attr.viewBox]="'0 0 ' + side() + ' ' + side()" aria-hidden="true" (pointerleave)="tip.set(null)">
3311
+ @for (ring of layout().rings; track $index) {
3312
+ <path [attr.d]="ring" fill="none" class="ngx-grid" />
3313
+ }
3314
+ @for (spoke of layout().spokes; track $index) {
3315
+ <line class="ngx-grid" [attr.x1]="spoke.x1" [attr.y1]="spoke.y1" [attr.x2]="spoke.x2" [attr.y2]="spoke.y2" />
3316
+ }
3317
+ @for (item of layout().series; track item.name) {
3318
+ <path [attr.d]="item.polygon" [attr.fill]="item.color" fill-opacity="0.16" [attr.stroke]="item.color" stroke-width="2" [class.ngx-in]="animate()" />
3319
+ @for (point of item.points; track point.key) {
3320
+ <circle
3321
+ [attr.cx]="point.x"
3322
+ [attr.cy]="point.y"
3323
+ r="3.5"
3324
+ [attr.fill]="point.color"
3325
+ class="cursor-pointer"
3326
+ (pointerenter)="onPoint(point, $event)"
3327
+ />
3328
+ }
3329
+ }
3330
+ @for (axis of layout().axes; track axis.label + '-' + axis.x) {
3331
+ <text [attr.x]="axis.x" [attr.y]="axis.y" [attr.text-anchor]="axis.anchor" dominant-baseline="middle">{{ axis.label }}</text>
3332
+ }
3333
+ </svg>
3334
+ </div>
3335
+ }
3336
+ </ngx-chart-frame>
3337
+ `,
3338
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
3339
+ }]
3340
+ }],
3341
+ propDecorators: {
3342
+ series: [{
3343
+ type: i0.Input,
3344
+ args: [{
3345
+ isSignal: true,
3346
+ alias: "series",
3347
+ required: false
3348
+ }]
3349
+ }],
3350
+ categories: [{
3351
+ type: i0.Input,
3352
+ args: [{
3353
+ isSignal: true,
3354
+ alias: "categories",
3355
+ required: false
3356
+ }]
3357
+ }],
3358
+ height: [{
3359
+ type: i0.Input,
3360
+ args: [{
3361
+ isSignal: true,
3362
+ alias: "height",
3363
+ required: false
3364
+ }]
3365
+ }],
3366
+ showLegend: [{
3367
+ type: i0.Input,
3368
+ args: [{
3369
+ isSignal: true,
3370
+ alias: "showLegend",
3371
+ required: false
3372
+ }]
3373
+ }],
3374
+ format: [{
3375
+ type: i0.Input,
3376
+ args: [{
3377
+ isSignal: true,
3378
+ alias: "format",
3379
+ required: false
3380
+ }]
3381
+ }],
3382
+ currency: [{
3383
+ type: i0.Input,
3384
+ args: [{
3385
+ isSignal: true,
3386
+ alias: "currency",
3387
+ required: false
3388
+ }]
3389
+ }],
3390
+ colors: [{
3391
+ type: i0.Input,
3392
+ args: [{
3393
+ isSignal: true,
3394
+ alias: "colors",
3395
+ required: false
3396
+ }]
3397
+ }],
3398
+ ariaLabel: [{
3399
+ type: i0.Input,
3400
+ args: [{
3401
+ isSignal: true,
3402
+ alias: "ariaLabel",
3403
+ required: false
3404
+ }]
3405
+ }],
3406
+ title: [{
3407
+ type: i0.Input,
3408
+ args: [{
3409
+ isSignal: true,
3410
+ alias: "title",
3411
+ required: false
3412
+ }]
3413
+ }],
3414
+ animate: [{
3415
+ type: i0.Input,
3416
+ args: [{
3417
+ isSignal: true,
3418
+ alias: "animate",
3419
+ required: false
3420
+ }]
3421
+ }]
3422
+ }
3423
+ });
3424
+ var NgxScatterChart = class NgxScatterChart {
3425
+ series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
3426
+ height = input(320, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
3427
+ showLegend = input(void 0, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
3428
+ showGrid = input(true, ...ngDevMode ? [{ debugName: "showGrid" }] : /* istanbul ignore next */ []);
3429
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
3430
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
3431
+ colors = input(void 0, ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
3432
+ ariaLabel = input("Scatter chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
3433
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
3434
+ animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
3435
+ box = chartBox(this.height);
3436
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
3437
+ layout = computed(() => layoutScatter({
3438
+ series: this.series(),
3439
+ width: this.box.width(),
3440
+ height: this.height(),
3441
+ palette: this.colors(),
3442
+ format: resolveFormat(this.format(), this.currency())
3443
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
3444
+ legendOn = computed(() => this.showLegend() ?? this.layout().legend.length > 1, ...ngDevMode ? [{ debugName: "legendOn" }] : /* istanbul ignore next */ []);
3445
+ rows = computed(() => this.layout().points.map((point) => [
3446
+ point.label,
3447
+ point.formattedX,
3448
+ point.formattedY
3449
+ ]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
3450
+ onPoint(point, event) {
3451
+ this.tip.set(tooltipAt(event, point.label, [{
3452
+ swatch: point.color,
3453
+ label: point.series,
3454
+ value: `${point.formattedX}, ${point.formattedY}`
3455
+ }]));
3456
+ }
3457
+ static ɵfac = i0.ɵɵngDeclareFactory({
3458
+ minVersion: "12.0.0",
3459
+ version: "22.2.3",
3460
+ ngImport: i0,
3461
+ type: NgxScatterChart,
3462
+ deps: [],
3463
+ target: i0.ɵɵFactoryTarget.Component
3464
+ });
3465
+ static ɵcmp = i0.ɵɵngDeclareComponent({
3466
+ minVersion: "17.0.0",
3467
+ version: "22.2.3",
3468
+ type: NgxScatterChart,
3469
+ isStandalone: true,
3470
+ selector: "ngx-scatter-chart",
3471
+ inputs: {
3472
+ series: {
3473
+ classPropertyName: "series",
3474
+ publicName: "series",
3475
+ isSignal: true,
3476
+ isRequired: false,
3477
+ transformFunction: null
3478
+ },
3479
+ height: {
3480
+ classPropertyName: "height",
3481
+ publicName: "height",
3482
+ isSignal: true,
3483
+ isRequired: false,
3484
+ transformFunction: null
3485
+ },
3486
+ showLegend: {
3487
+ classPropertyName: "showLegend",
3488
+ publicName: "showLegend",
3489
+ isSignal: true,
3490
+ isRequired: false,
3491
+ transformFunction: null
3492
+ },
3493
+ showGrid: {
3494
+ classPropertyName: "showGrid",
3495
+ publicName: "showGrid",
3496
+ isSignal: true,
3497
+ isRequired: false,
3498
+ transformFunction: null
3499
+ },
3500
+ format: {
3501
+ classPropertyName: "format",
3502
+ publicName: "format",
3503
+ isSignal: true,
3504
+ isRequired: false,
3505
+ transformFunction: null
3506
+ },
3507
+ currency: {
3508
+ classPropertyName: "currency",
3509
+ publicName: "currency",
3510
+ isSignal: true,
3511
+ isRequired: false,
3512
+ transformFunction: null
3513
+ },
3514
+ colors: {
3515
+ classPropertyName: "colors",
3516
+ publicName: "colors",
3517
+ isSignal: true,
3518
+ isRequired: false,
3519
+ transformFunction: null
3520
+ },
3521
+ ariaLabel: {
3522
+ classPropertyName: "ariaLabel",
3523
+ publicName: "ariaLabel",
3524
+ isSignal: true,
3525
+ isRequired: false,
3526
+ transformFunction: null
3527
+ },
3528
+ title: {
3529
+ classPropertyName: "title",
3530
+ publicName: "title",
3531
+ isSignal: true,
3532
+ isRequired: false,
3533
+ transformFunction: null
3534
+ },
3535
+ animate: {
3536
+ classPropertyName: "animate",
3537
+ publicName: "animate",
3538
+ isSignal: true,
3539
+ isRequired: false,
3540
+ transformFunction: null
3541
+ }
3542
+ },
3543
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
3544
+ ngImport: i0,
3545
+ template: `
3546
+ <ngx-chart-frame
3547
+ [title]="title()"
3548
+ [ariaLabel]="ariaLabel()"
3549
+ [legend]="layout().legend"
3550
+ [showLegend]="legendOn()"
3551
+ [tooltip]="tip()"
3552
+ [srHeaders]="['Series', 'X', 'Y']"
3553
+ [srRows]="rows()"
3554
+ >
3555
+ @if (layout().empty) {
3556
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
3557
+ } @else {
3558
+ <svg
3559
+ class="block w-full max-w-full"
3560
+ [style.height.px]="height()"
3561
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
3562
+ aria-hidden="true"
3563
+ (pointerleave)="tip.set(null)"
3564
+ >
3565
+ @for (tick of layout().ticksY; track tick.label + '-' + tick.labelY) {
3566
+ @if (showGrid()) {
3567
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
3568
+ }
3569
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" text-anchor="end" dominant-baseline="middle">{{ tick.label }}</text>
3570
+ }
3571
+ @for (tick of layout().ticksX; track tick.label + '-' + tick.labelX) {
3572
+ @if (showGrid()) {
3573
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
3574
+ }
3575
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" text-anchor="middle" dominant-baseline="middle">{{ tick.label }}</text>
3576
+ }
3577
+ @for (point of layout().points; track point.key) {
3578
+ <circle
3579
+ [attr.cx]="point.cx"
3580
+ [attr.cy]="point.cy"
3581
+ r="5"
3582
+ [attr.fill]="point.color"
3583
+ class="cursor-pointer"
3584
+ stroke="var(--ngx-surface)"
3585
+ stroke-width="1.5"
3586
+ [class.ngx-in]="animate()"
3587
+ (pointerenter)="onPoint(point, $event)"
3588
+ />
3589
+ }
3590
+ </svg>
3591
+ }
3592
+ </ngx-chart-frame>
3593
+ `,
3594
+ isInline: true,
3595
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
3596
+ dependencies: [{
3597
+ kind: "component",
3598
+ type: NgxChartFrame,
3599
+ selector: "ngx-chart-frame",
3600
+ inputs: [
3601
+ "title",
3602
+ "ariaLabel",
3603
+ "legend",
3604
+ "showLegend",
3605
+ "tooltip",
3606
+ "srHeaders",
3607
+ "srRows",
3608
+ "range"
3609
+ ]
3610
+ }],
3611
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3612
+ });
3613
+ };
3614
+ i0.ɵɵngDeclareClassMetadata({
3615
+ minVersion: "12.0.0",
3616
+ version: "22.2.3",
3617
+ ngImport: i0,
3618
+ type: NgxScatterChart,
3619
+ decorators: [{
3620
+ type: Component,
3621
+ args: [{
3622
+ selector: "ngx-scatter-chart",
3623
+ changeDetection: ChangeDetectionStrategy.OnPush,
3624
+ imports: [NgxChartFrame],
3625
+ host: { "[style.--ngx-chart-height.px]": "height()" },
3626
+ template: `
3627
+ <ngx-chart-frame
3628
+ [title]="title()"
3629
+ [ariaLabel]="ariaLabel()"
3630
+ [legend]="layout().legend"
3631
+ [showLegend]="legendOn()"
3632
+ [tooltip]="tip()"
3633
+ [srHeaders]="['Series', 'X', 'Y']"
3634
+ [srRows]="rows()"
3635
+ >
3636
+ @if (layout().empty) {
3637
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
3638
+ } @else {
3639
+ <svg
3640
+ class="block w-full max-w-full"
3641
+ [style.height.px]="height()"
3642
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
3643
+ aria-hidden="true"
3644
+ (pointerleave)="tip.set(null)"
3645
+ >
3646
+ @for (tick of layout().ticksY; track tick.label + '-' + tick.labelY) {
3647
+ @if (showGrid()) {
3648
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
3649
+ }
3650
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" text-anchor="end" dominant-baseline="middle">{{ tick.label }}</text>
3651
+ }
3652
+ @for (tick of layout().ticksX; track tick.label + '-' + tick.labelX) {
3653
+ @if (showGrid()) {
3654
+ <line class="ngx-grid" [attr.x1]="tick.x1" [attr.y1]="tick.y1" [attr.x2]="tick.x2" [attr.y2]="tick.y2" />
3655
+ }
3656
+ <text [attr.x]="tick.labelX" [attr.y]="tick.labelY" text-anchor="middle" dominant-baseline="middle">{{ tick.label }}</text>
3657
+ }
3658
+ @for (point of layout().points; track point.key) {
3659
+ <circle
3660
+ [attr.cx]="point.cx"
3661
+ [attr.cy]="point.cy"
3662
+ r="5"
3663
+ [attr.fill]="point.color"
3664
+ class="cursor-pointer"
3665
+ stroke="var(--ngx-surface)"
3666
+ stroke-width="1.5"
3667
+ [class.ngx-in]="animate()"
3668
+ (pointerenter)="onPoint(point, $event)"
3669
+ />
3670
+ }
3671
+ </svg>
3672
+ }
3673
+ </ngx-chart-frame>
3674
+ `,
3675
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
3676
+ }]
3677
+ }],
3678
+ propDecorators: {
3679
+ series: [{
3680
+ type: i0.Input,
3681
+ args: [{
3682
+ isSignal: true,
3683
+ alias: "series",
3684
+ required: false
3685
+ }]
3686
+ }],
3687
+ height: [{
3688
+ type: i0.Input,
3689
+ args: [{
3690
+ isSignal: true,
3691
+ alias: "height",
3692
+ required: false
3693
+ }]
3694
+ }],
3695
+ showLegend: [{
3696
+ type: i0.Input,
3697
+ args: [{
3698
+ isSignal: true,
3699
+ alias: "showLegend",
3700
+ required: false
3701
+ }]
3702
+ }],
3703
+ showGrid: [{
3704
+ type: i0.Input,
3705
+ args: [{
3706
+ isSignal: true,
3707
+ alias: "showGrid",
3708
+ required: false
3709
+ }]
3710
+ }],
3711
+ format: [{
3712
+ type: i0.Input,
3713
+ args: [{
3714
+ isSignal: true,
3715
+ alias: "format",
3716
+ required: false
3717
+ }]
3718
+ }],
3719
+ currency: [{
3720
+ type: i0.Input,
3721
+ args: [{
3722
+ isSignal: true,
3723
+ alias: "currency",
3724
+ required: false
3725
+ }]
3726
+ }],
3727
+ colors: [{
3728
+ type: i0.Input,
3729
+ args: [{
3730
+ isSignal: true,
3731
+ alias: "colors",
3732
+ required: false
3733
+ }]
3734
+ }],
3735
+ ariaLabel: [{
3736
+ type: i0.Input,
3737
+ args: [{
3738
+ isSignal: true,
3739
+ alias: "ariaLabel",
3740
+ required: false
3741
+ }]
3742
+ }],
3743
+ title: [{
3744
+ type: i0.Input,
3745
+ args: [{
3746
+ isSignal: true,
3747
+ alias: "title",
3748
+ required: false
3749
+ }]
3750
+ }],
3751
+ animate: [{
3752
+ type: i0.Input,
3753
+ args: [{
3754
+ isSignal: true,
3755
+ alias: "animate",
3756
+ required: false
3757
+ }]
3758
+ }]
3759
+ }
3760
+ });
3761
+ var NgxSparkline = class NgxSparkline {
3762
+ data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
3763
+ height = input(56, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
3764
+ fill = input(true, ...ngDevMode ? [{ debugName: "fill" }] : /* istanbul ignore next */ []);
3765
+ format = input("number", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
3766
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
3767
+ color = input(void 0, ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
3768
+ ariaLabel = input("Sparkline", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
3769
+ title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
3770
+ box = chartBox(this.height);
3771
+ tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
3772
+ formatter = computed(() => resolveFormat(this.format(), this.currency()), ...ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []);
3773
+ layout = computed(() => layoutSparkline({
3774
+ data: this.data(),
3775
+ width: this.box.width(),
3776
+ height: this.height(),
3777
+ format: this.formatter(),
3778
+ color: this.color()
3779
+ }), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
3780
+ rows = computed(() => this.data().map((value, index) => [String(index + 1), this.formatter()(value)]), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
3781
+ onEnter(event) {
3782
+ const last = this.layout().last;
3783
+ if (!last) return;
3784
+ this.tip.set(tooltipAt(event, this.ariaLabel(), [{
3785
+ swatch: this.layout().color,
3786
+ label: "Latest",
3787
+ value: last.formatted
3788
+ }]));
3789
+ }
3790
+ static ɵfac = i0.ɵɵngDeclareFactory({
3791
+ minVersion: "12.0.0",
3792
+ version: "22.2.3",
3793
+ ngImport: i0,
3794
+ type: NgxSparkline,
3795
+ deps: [],
3796
+ target: i0.ɵɵFactoryTarget.Component
3797
+ });
3798
+ static ɵcmp = i0.ɵɵngDeclareComponent({
3799
+ minVersion: "17.0.0",
3800
+ version: "22.2.3",
3801
+ type: NgxSparkline,
3802
+ isStandalone: true,
3803
+ selector: "ngx-sparkline",
3804
+ inputs: {
3805
+ data: {
3806
+ classPropertyName: "data",
3807
+ publicName: "data",
3808
+ isSignal: true,
3809
+ isRequired: false,
3810
+ transformFunction: null
3811
+ },
3812
+ height: {
3813
+ classPropertyName: "height",
3814
+ publicName: "height",
3815
+ isSignal: true,
3816
+ isRequired: false,
3817
+ transformFunction: null
3818
+ },
3819
+ fill: {
3820
+ classPropertyName: "fill",
3821
+ publicName: "fill",
3822
+ isSignal: true,
3823
+ isRequired: false,
3824
+ transformFunction: null
3825
+ },
3826
+ format: {
3827
+ classPropertyName: "format",
3828
+ publicName: "format",
3829
+ isSignal: true,
3830
+ isRequired: false,
3831
+ transformFunction: null
3832
+ },
3833
+ currency: {
3834
+ classPropertyName: "currency",
3835
+ publicName: "currency",
3836
+ isSignal: true,
3837
+ isRequired: false,
3838
+ transformFunction: null
3839
+ },
3840
+ color: {
3841
+ classPropertyName: "color",
3842
+ publicName: "color",
3843
+ isSignal: true,
3844
+ isRequired: false,
3845
+ transformFunction: null
3846
+ },
3847
+ ariaLabel: {
3848
+ classPropertyName: "ariaLabel",
3849
+ publicName: "ariaLabel",
3850
+ isSignal: true,
3851
+ isRequired: false,
3852
+ transformFunction: null
3853
+ },
3854
+ title: {
3855
+ classPropertyName: "title",
3856
+ publicName: "title",
3857
+ isSignal: true,
3858
+ isRequired: false,
3859
+ transformFunction: null
3860
+ }
3861
+ },
3862
+ host: { properties: { "style.--ngx-chart-height.px": "height()" } },
3863
+ ngImport: i0,
3864
+ template: `
3865
+ <ngx-chart-frame [title]="title()" [ariaLabel]="ariaLabel()" [tooltip]="tip()" [srHeaders]="['Index', 'Value']" [srRows]="rows()">
3866
+ @if (layout().empty) {
3867
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
3868
+ } @else {
3869
+ <svg
3870
+ class="block w-full max-w-full"
3871
+ [style.height.px]="height()"
3872
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
3873
+ aria-hidden="true"
3874
+ (pointerleave)="tip.set(null)"
3875
+ (pointerenter)="onEnter($event)"
3876
+ >
3877
+ @if (fill() && layout().area) {
3878
+ <path [attr.d]="layout().area" [attr.fill]="layout().color" fill-opacity="0.16" />
3879
+ }
3880
+ <path [attr.d]="layout().line" fill="none" [attr.stroke]="layout().color" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" />
3881
+ @if (layout().last; as last) {
3882
+ <circle [attr.cx]="last.x" [attr.cy]="last.y" r="3" [attr.fill]="layout().color" />
3883
+ }
3884
+ </svg>
3885
+ }
3886
+ </ngx-chart-frame>
3887
+ `,
3888
+ isInline: true,
3889
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
3890
+ dependencies: [{
3891
+ kind: "component",
3892
+ type: NgxChartFrame,
3893
+ selector: "ngx-chart-frame",
3894
+ inputs: [
3895
+ "title",
3896
+ "ariaLabel",
3897
+ "legend",
3898
+ "showLegend",
3899
+ "tooltip",
3900
+ "srHeaders",
3901
+ "srRows",
3902
+ "range"
3903
+ ]
3904
+ }],
3905
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
3906
+ });
3907
+ };
3908
+ i0.ɵɵngDeclareClassMetadata({
3909
+ minVersion: "12.0.0",
3910
+ version: "22.2.3",
3911
+ ngImport: i0,
3912
+ type: NgxSparkline,
3913
+ decorators: [{
3914
+ type: Component,
3915
+ args: [{
3916
+ selector: "ngx-sparkline",
3917
+ changeDetection: ChangeDetectionStrategy.OnPush,
3918
+ imports: [NgxChartFrame],
3919
+ host: { "[style.--ngx-chart-height.px]": "height()" },
3920
+ template: `
3921
+ <ngx-chart-frame [title]="title()" [ariaLabel]="ariaLabel()" [tooltip]="tip()" [srHeaders]="['Index', 'Value']" [srRows]="rows()">
3922
+ @if (layout().empty) {
3923
+ <p class="flex items-center justify-center text-sm" [style.height.px]="height()">No data yet.</p>
3924
+ } @else {
3925
+ <svg
3926
+ class="block w-full max-w-full"
3927
+ [style.height.px]="height()"
3928
+ [attr.viewBox]="'0 0 ' + layout().width + ' ' + layout().height"
3929
+ aria-hidden="true"
3930
+ (pointerleave)="tip.set(null)"
3931
+ (pointerenter)="onEnter($event)"
3932
+ >
3933
+ @if (fill() && layout().area) {
3934
+ <path [attr.d]="layout().area" [attr.fill]="layout().color" fill-opacity="0.16" />
3935
+ }
3936
+ <path [attr.d]="layout().line" fill="none" [attr.stroke]="layout().color" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" />
3937
+ @if (layout().last; as last) {
3938
+ <circle [attr.cx]="last.x" [attr.cy]="last.y" r="3" [attr.fill]="layout().color" />
3939
+ }
3940
+ </svg>
3941
+ }
3942
+ </ngx-chart-frame>
3943
+ `,
3944
+ styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
3945
+ }]
3946
+ }],
3947
+ propDecorators: {
3948
+ data: [{
3949
+ type: i0.Input,
3950
+ args: [{
3951
+ isSignal: true,
3952
+ alias: "data",
3953
+ required: false
3954
+ }]
3955
+ }],
3956
+ height: [{
3957
+ type: i0.Input,
3958
+ args: [{
3959
+ isSignal: true,
3960
+ alias: "height",
3961
+ required: false
3962
+ }]
3963
+ }],
3964
+ fill: [{
3965
+ type: i0.Input,
3966
+ args: [{
3967
+ isSignal: true,
3968
+ alias: "fill",
3969
+ required: false
3970
+ }]
3971
+ }],
3972
+ format: [{
3973
+ type: i0.Input,
3974
+ args: [{
3975
+ isSignal: true,
3976
+ alias: "format",
3977
+ required: false
3978
+ }]
3979
+ }],
3980
+ currency: [{
3981
+ type: i0.Input,
3982
+ args: [{
3983
+ isSignal: true,
3984
+ alias: "currency",
3985
+ required: false
3986
+ }]
3987
+ }],
3988
+ color: [{
3989
+ type: i0.Input,
3990
+ args: [{
3991
+ isSignal: true,
3992
+ alias: "color",
3993
+ required: false
3994
+ }]
3995
+ }],
3996
+ ariaLabel: [{
3997
+ type: i0.Input,
3998
+ args: [{
3999
+ isSignal: true,
4000
+ alias: "ariaLabel",
4001
+ required: false
4002
+ }]
4003
+ }],
4004
+ title: [{
4005
+ type: i0.Input,
4006
+ args: [{
4007
+ isSignal: true,
4008
+ alias: "title",
4009
+ required: false
4010
+ }]
4011
+ }]
4012
+ }
4013
+ });
4014
+ export { NgxLineChart as NgxAreaChart, NgxLineChart, NgxBarChart, NgxPieChart as NgxDonutChart, NgxPieChart, NgxGaugeChart, NgxHeatmap, NgxRadarChart, NgxScatterChart, NgxSparkline, resolveFormat };
4015
+
4016
+ //# sourceMappingURL=codeauradev-ngx-wind-charts.mjs.map