@codeauradev/ngx-wind-charts 1.0.0 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/codeauradev-ngx-wind-charts-map.mjs +13 -7
- package/fesm2022/codeauradev-ngx-wind-charts-map.mjs.map +1 -1
- package/fesm2022/codeauradev-ngx-wind-charts.mjs +270 -131
- package/fesm2022/codeauradev-ngx-wind-charts.mjs.map +1 -1
- package/ngx-charts.css +103 -8
- package/package.json +1 -1
- package/types/codeauradev-ngx-wind-charts.d.ts +13 -0
|
@@ -120,13 +120,18 @@ function donutSlicePath(cx, cy, outer, inner, start, end) {
|
|
|
120
120
|
const [ix1, iy1] = pointOnCircle(cx, cy, inner, start);
|
|
121
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
122
|
}
|
|
123
|
-
function domainOf(values, includeZero, maxPin) {
|
|
123
|
+
function domainOf(values, includeZero, maxPin, minPin) {
|
|
124
124
|
const finite = values.filter((value) => Number.isFinite(value));
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
+
}
|
|
130
135
|
let min = Math.min(...finite);
|
|
131
136
|
let max = Math.max(...finite);
|
|
132
137
|
if (includeZero) {
|
|
@@ -136,17 +141,25 @@ function domainOf(values, includeZero, maxPin) {
|
|
|
136
141
|
if (maxPin !== void 0 && Number.isFinite(maxPin)) max = Math.max(max, maxPin);
|
|
137
142
|
if (min === max) {
|
|
138
143
|
const pad = Math.abs(min) || 1;
|
|
139
|
-
min -= includeZero ? 0 : pad * .5;
|
|
144
|
+
min -= includeZero || pinned ? 0 : pad * .5;
|
|
140
145
|
max += pad * .5;
|
|
141
146
|
if (includeZero) min = Math.min(0, min);
|
|
142
|
-
} else if (!includeZero) {
|
|
147
|
+
} else if (!includeZero && !pinned) {
|
|
143
148
|
const pad = (max - min) * .08;
|
|
144
149
|
min -= pad;
|
|
145
150
|
max += pad;
|
|
146
151
|
}
|
|
147
|
-
|
|
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
|
+
}
|
|
148
161
|
return {
|
|
149
|
-
min: ticks[0] ?? min,
|
|
162
|
+
min: pinned ? minPin : ticks[0] ?? min,
|
|
150
163
|
max: ticks[ticks.length - 1] ?? max,
|
|
151
164
|
ticks
|
|
152
165
|
};
|
|
@@ -167,7 +180,7 @@ function box(width, height, pad) {
|
|
|
167
180
|
}
|
|
168
181
|
function yTicks(values, format, plot) {
|
|
169
182
|
const y = scale(values[0] ?? 0, values[values.length - 1] ?? 1, plot.bottom, plot.top);
|
|
170
|
-
|
|
183
|
+
const marks = values.map((value) => {
|
|
171
184
|
const py = round(y(value));
|
|
172
185
|
return {
|
|
173
186
|
x1: plot.left,
|
|
@@ -180,6 +193,9 @@ function yTicks(values, format, plot) {
|
|
|
180
193
|
anchor: "end"
|
|
181
194
|
};
|
|
182
195
|
});
|
|
196
|
+
const kept = [];
|
|
197
|
+
for (const tick of marks) if (kept.every((item) => Math.abs(item.labelY - tick.labelY) >= 14)) kept.push(tick);
|
|
198
|
+
return kept.length > 0 ? kept : marks.slice(0, 1);
|
|
183
199
|
}
|
|
184
200
|
function xValueTicks(values, format, plot) {
|
|
185
201
|
const x = scale(values[0] ?? 0, values[values.length - 1] ?? 1, plot.left, plot.right);
|
|
@@ -211,7 +227,19 @@ function layoutBars(input) {
|
|
|
211
227
|
const palette = input.palette ?? DEFAULT_PALETTE;
|
|
212
228
|
const categories = input.categories;
|
|
213
229
|
const series = input.series;
|
|
214
|
-
const
|
|
230
|
+
const stacked = input.mode === "stacked";
|
|
231
|
+
const values = [];
|
|
232
|
+
if (stacked) categories.forEach((_, index) => {
|
|
233
|
+
let positive = 0;
|
|
234
|
+
let negative = 0;
|
|
235
|
+
for (const item of series) {
|
|
236
|
+
const value = num(item.data[index] ?? 0);
|
|
237
|
+
if (value >= 0) positive += value;
|
|
238
|
+
else negative += value;
|
|
239
|
+
}
|
|
240
|
+
values.push(positive, negative);
|
|
241
|
+
});
|
|
242
|
+
else series.forEach((item) => item.data.forEach((value) => values.push(num(value))));
|
|
215
243
|
const empty = categories.length === 0 || series.length === 0;
|
|
216
244
|
const domain = domainOf(values, true, input.max);
|
|
217
245
|
const longest = domain.ticks.reduce((max, tick) => Math.max(max, input.format(tick).length), 2);
|
|
@@ -228,8 +256,12 @@ function layoutBars(input) {
|
|
|
228
256
|
bottom: 28,
|
|
229
257
|
left: Math.min(96, Math.max(40, longest * 7 + 14))
|
|
230
258
|
};
|
|
231
|
-
const width = Math.max(input.width,
|
|
232
|
-
const height = Math.max(input.height,
|
|
259
|
+
const width = Math.max(input.width, 1);
|
|
260
|
+
const height = Math.max(input.height, 1);
|
|
261
|
+
pad.left = Math.min(pad.left, Math.max(16, width * .46));
|
|
262
|
+
pad.right = Math.min(pad.right, Math.max(8, width * .2));
|
|
263
|
+
pad.top = Math.min(pad.top, Math.max(4, height * .16));
|
|
264
|
+
pad.bottom = Math.min(pad.bottom, Math.max(8, height * .34));
|
|
233
265
|
const plot = box(width, height, pad);
|
|
234
266
|
const legend = series.length > 1 || series.some((item) => item.name !== "Value") ? legendOf(series, palette) : legendOf(series, palette);
|
|
235
267
|
if (empty) return {
|
|
@@ -383,7 +415,8 @@ function barMark(category, seriesName, value, format, color, x, y, width, height
|
|
|
383
415
|
formatted,
|
|
384
416
|
labelX: round(horizontal ? x + width + 6 : x + width / 2),
|
|
385
417
|
labelY: round(horizontal ? y + height / 2 : y - 6),
|
|
386
|
-
showLabel
|
|
418
|
+
showLabel,
|
|
419
|
+
origin: horizontal ? value < 0 ? "right" : "left" : value < 0 ? "top" : "bottom"
|
|
387
420
|
};
|
|
388
421
|
}
|
|
389
422
|
function layoutTrend(input) {
|
|
@@ -392,7 +425,7 @@ function layoutTrend(input) {
|
|
|
392
425
|
const series = input.series;
|
|
393
426
|
const empty = categories.length === 0 || series.length === 0;
|
|
394
427
|
const stacked = input.stacked ?? false;
|
|
395
|
-
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);
|
|
428
|
+
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);
|
|
396
429
|
const longest = domain.ticks.reduce((max, tick) => Math.max(max, input.format(tick).length), 2);
|
|
397
430
|
const pad = {
|
|
398
431
|
top: 16,
|
|
@@ -411,6 +444,8 @@ function layoutTrend(input) {
|
|
|
411
444
|
ticks: [],
|
|
412
445
|
categories: [],
|
|
413
446
|
zero: null,
|
|
447
|
+
baseline: height,
|
|
448
|
+
fromZero: false,
|
|
414
449
|
legend: []
|
|
415
450
|
};
|
|
416
451
|
const y = scale(domain.min, domain.max, plot.bottom, plot.top);
|
|
@@ -425,67 +460,66 @@ function layoutTrend(input) {
|
|
|
425
460
|
y: plot.bottom + 16,
|
|
426
461
|
anchor: "middle"
|
|
427
462
|
})).filter((_, index) => index % step === 0);
|
|
463
|
+
const baseline = round(y(domain.min < 0 && domain.max > 0 ? 0 : domain.min));
|
|
428
464
|
const baselines = categories.map(() => 0);
|
|
429
|
-
const layouts = series.map((item, seriesIndex) => {
|
|
430
|
-
const color = seriesColor(item.color, seriesIndex, palette);
|
|
431
|
-
const points = categories.map((category, index) => {
|
|
432
|
-
const value = num(item.data[index] ?? 0);
|
|
433
|
-
const base = stacked ? baselines[index] ?? 0 : 0;
|
|
434
|
-
const yValue = stacked ? base + value : value;
|
|
435
|
-
if (stacked) baselines[index] = yValue;
|
|
436
|
-
return {
|
|
437
|
-
key: `${seriesIndex}-${index}`,
|
|
438
|
-
x: round(xAt(index)),
|
|
439
|
-
y: round(y(yValue)),
|
|
440
|
-
value,
|
|
441
|
-
formatted: input.format(value),
|
|
442
|
-
category,
|
|
443
|
-
series: item.name,
|
|
444
|
-
color
|
|
445
|
-
};
|
|
446
|
-
});
|
|
447
|
-
const line = points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
|
|
448
|
-
let area = null;
|
|
449
|
-
if (input.filled) {
|
|
450
|
-
if (!stacked) {
|
|
451
|
-
const baseline = round(y(domain.min < 0 && domain.max > 0 ? 0 : domain.min));
|
|
452
|
-
area = `${line} L ${points[points.length - 1]?.x ?? 0} ${baseline} L ${points[0]?.x ?? 0} ${baseline} Z`;
|
|
453
|
-
} else {
|
|
454
|
-
const previous = seriesIndex === 0 ? categories.map((_, index) => ({
|
|
455
|
-
x: round(xAt(index)),
|
|
456
|
-
y: round(y(0))
|
|
457
|
-
})) : null;
|
|
458
|
-
area = `${line} ${(previous ? [...previous].reverse() : categories.map((_, index) => {
|
|
459
|
-
const base = series.slice(0, seriesIndex).reduce((sum, entry) => sum + num(entry.data[index] ?? 0), 0);
|
|
460
|
-
return {
|
|
461
|
-
x: round(xAt(index)),
|
|
462
|
-
y: round(y(base))
|
|
463
|
-
};
|
|
464
|
-
}).reverse()).map((point) => `L ${point.x} ${point.y}`).join(" ")} Z`;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
return {
|
|
468
|
-
name: item.name,
|
|
469
|
-
color,
|
|
470
|
-
line,
|
|
471
|
-
area,
|
|
472
|
-
points
|
|
473
|
-
};
|
|
474
|
-
});
|
|
475
|
-
const zeroY = round(y(0));
|
|
476
465
|
return {
|
|
477
466
|
empty: false,
|
|
478
467
|
width,
|
|
479
468
|
height,
|
|
480
|
-
series:
|
|
469
|
+
series: series.map((item, seriesIndex) => {
|
|
470
|
+
const color = seriesColor(item.color, seriesIndex, palette);
|
|
471
|
+
const points = categories.map((category, index) => {
|
|
472
|
+
const value = num(item.data[index] ?? 0);
|
|
473
|
+
const base = stacked ? baselines[index] ?? 0 : 0;
|
|
474
|
+
const yValue = stacked ? base + value : value;
|
|
475
|
+
if (stacked) baselines[index] = yValue;
|
|
476
|
+
return {
|
|
477
|
+
key: `${seriesIndex}-${index}`,
|
|
478
|
+
x: round(xAt(index)),
|
|
479
|
+
y: round(y(yValue)),
|
|
480
|
+
value,
|
|
481
|
+
formatted: input.format(value),
|
|
482
|
+
category,
|
|
483
|
+
series: item.name,
|
|
484
|
+
color
|
|
485
|
+
};
|
|
486
|
+
});
|
|
487
|
+
const line = points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
|
|
488
|
+
let area = null;
|
|
489
|
+
if (input.filled) {
|
|
490
|
+
if (!stacked) area = `${line} L ${points[points.length - 1]?.x ?? 0} ${baseline} L ${points[0]?.x ?? 0} ${baseline} Z`;
|
|
491
|
+
else {
|
|
492
|
+
const previous = seriesIndex === 0 ? categories.map((_, index) => ({
|
|
493
|
+
x: round(xAt(index)),
|
|
494
|
+
y: round(y(0))
|
|
495
|
+
})) : null;
|
|
496
|
+
area = `${line} ${(previous ? [...previous].reverse() : categories.map((_, index) => {
|
|
497
|
+
const base = series.slice(0, seriesIndex).reduce((sum, entry) => sum + num(entry.data[index] ?? 0), 0);
|
|
498
|
+
return {
|
|
499
|
+
x: round(xAt(index)),
|
|
500
|
+
y: round(y(base))
|
|
501
|
+
};
|
|
502
|
+
}).reverse()).map((point) => `L ${point.x} ${point.y}`).join(" ")} Z`;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return {
|
|
506
|
+
name: item.name,
|
|
507
|
+
color,
|
|
508
|
+
line,
|
|
509
|
+
area,
|
|
510
|
+
points
|
|
511
|
+
};
|
|
512
|
+
}),
|
|
481
513
|
ticks: yTicks(domain.ticks, input.format, plot),
|
|
482
514
|
categories: categoryLabels,
|
|
483
515
|
zero: domain.min < 0 && domain.max > 0 ? {
|
|
484
516
|
x1: plot.left,
|
|
485
|
-
y1:
|
|
517
|
+
y1: baseline,
|
|
486
518
|
x2: plot.right,
|
|
487
|
-
y2:
|
|
519
|
+
y2: baseline
|
|
488
520
|
} : null,
|
|
521
|
+
baseline,
|
|
522
|
+
fromZero: domain.min <= 0 && domain.max >= 0,
|
|
489
523
|
legend: legendOf(series, palette)
|
|
490
524
|
};
|
|
491
525
|
}
|
|
@@ -899,7 +933,7 @@ var NgxChartFrame = class NgxChartFrame {
|
|
|
899
933
|
<div class="ngx-tip" [style.left.px]="tip.x" [style.top.px]="tip.y">
|
|
900
934
|
<div class="font-medium">{{ tip.title }}</div>
|
|
901
935
|
@for (row of tip.rows; track row.label) {
|
|
902
|
-
<div class="ngx-
|
|
936
|
+
<div class="ngx-tip-row">
|
|
903
937
|
<span class="ngx-swatch" [style.background]="row.swatch"></span>
|
|
904
938
|
<span>{{ row.label }}</span>
|
|
905
939
|
<span class="ml-auto pl-3 font-medium text-foreground">{{ row.value }}</span>
|
|
@@ -947,7 +981,7 @@ var NgxChartFrame = class NgxChartFrame {
|
|
|
947
981
|
</figure>
|
|
948
982
|
`,
|
|
949
983
|
isInline: true,
|
|
950
|
-
styles: [":host{display:
|
|
984
|
+
styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%;max-width:100%;min-width:0;min-height:0;height:100%}\n"],
|
|
951
985
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
952
986
|
});
|
|
953
987
|
};
|
|
@@ -972,7 +1006,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
972
1006
|
<div class="ngx-tip" [style.left.px]="tip.x" [style.top.px]="tip.y">
|
|
973
1007
|
<div class="font-medium">{{ tip.title }}</div>
|
|
974
1008
|
@for (row of tip.rows; track row.label) {
|
|
975
|
-
<div class="ngx-
|
|
1009
|
+
<div class="ngx-tip-row">
|
|
976
1010
|
<span class="ngx-swatch" [style.background]="row.swatch"></span>
|
|
977
1011
|
<span>{{ row.label }}</span>
|
|
978
1012
|
<span class="ml-auto pl-3 font-medium text-foreground">{{ row.value }}</span>
|
|
@@ -1019,7 +1053,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1019
1053
|
</table>
|
|
1020
1054
|
</figure>
|
|
1021
1055
|
`,
|
|
1022
|
-
styles: [":host{display:
|
|
1056
|
+
styles: [":host{display:flex;flex-direction:column;box-sizing:border-box;width:100%;max-width:100%;min-width:0;min-height:0;height:100%}\n"]
|
|
1023
1057
|
}]
|
|
1024
1058
|
}],
|
|
1025
1059
|
propDecorators: {
|
|
@@ -1126,16 +1160,22 @@ function chartBox(preferred, initialWidth = 640) {
|
|
|
1126
1160
|
const destroyRef = inject(DestroyRef);
|
|
1127
1161
|
const width = signal(initialWidth, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
1128
1162
|
const height = signal(Math.max(1, preferred()), ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
1129
|
-
|
|
1163
|
+
let measure = () => height.set(Math.max(1, preferred()));
|
|
1164
|
+
effect(() => {
|
|
1165
|
+
preferred();
|
|
1166
|
+
measure();
|
|
1167
|
+
});
|
|
1130
1168
|
afterNextRender(() => {
|
|
1131
1169
|
const root = host.nativeElement;
|
|
1132
|
-
|
|
1170
|
+
measure = () => {
|
|
1171
|
+
const preferredH = Math.max(1, preferred());
|
|
1133
1172
|
const nextW = root.clientWidth;
|
|
1134
1173
|
if (nextW > 0) width.set(Math.round(nextW));
|
|
1174
|
+
height.set(preferredH);
|
|
1135
1175
|
};
|
|
1136
1176
|
measure();
|
|
1137
1177
|
if (typeof ResizeObserver === "undefined") return;
|
|
1138
|
-
const observer = new ResizeObserver(measure);
|
|
1178
|
+
const observer = new ResizeObserver(() => measure());
|
|
1139
1179
|
observer.observe(root);
|
|
1140
1180
|
destroyRef.onDestroy(() => observer.disconnect());
|
|
1141
1181
|
});
|
|
@@ -1144,8 +1184,10 @@ function chartBox(preferred, initialWidth = 640) {
|
|
|
1144
1184
|
height
|
|
1145
1185
|
};
|
|
1146
1186
|
}
|
|
1187
|
+
let nextFillId = 0;
|
|
1147
1188
|
var NgxLineChart = class NgxLineChart {
|
|
1148
1189
|
host = inject(ElementRef);
|
|
1190
|
+
fillId = `ngx-fill-${nextFillId++}`;
|
|
1149
1191
|
data = input(void 0, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
1150
1192
|
series = input(void 0, ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
|
|
1151
1193
|
categories = input(void 0, ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
|
|
@@ -1158,6 +1200,7 @@ var NgxLineChart = class NgxLineChart {
|
|
|
1158
1200
|
colors = input(void 0, ...ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []);
|
|
1159
1201
|
ariaLabel = input("Line chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
1160
1202
|
title = input(void 0, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
1203
|
+
min = input(void 0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
|
|
1161
1204
|
animate = input(true, ...ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []);
|
|
1162
1205
|
box = chartBox(this.height);
|
|
1163
1206
|
tip = signal(null, ...ngDevMode ? [{ debugName: "tip" }] : /* istanbul ignore next */ []);
|
|
@@ -1175,17 +1218,28 @@ var NgxLineChart = class NgxLineChart {
|
|
|
1175
1218
|
palette: this.colors(),
|
|
1176
1219
|
format: resolveFormat(this.format(), this.currency()),
|
|
1177
1220
|
filled: this.filled(),
|
|
1178
|
-
stacked: this.stacked()
|
|
1221
|
+
stacked: this.stacked(),
|
|
1222
|
+
min: this.min()
|
|
1179
1223
|
}), ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
|
|
1180
1224
|
legendOn = computed(() => this.showLegend() ?? this.layout().legend.length > 1, ...ngDevMode ? [{ debugName: "legendOn" }] : /* istanbul ignore next */ []);
|
|
1225
|
+
riseOrigin = computed(() => this.layout().baseline / Math.max(this.layout().height, 1) * 100, ...ngDevMode ? [{ debugName: "riseOrigin" }] : /* istanbul ignore next */ []);
|
|
1181
1226
|
headers = computed(() => ["Category", ...this.normalized().series.map((item) => item.name)], ...ngDevMode ? [{ debugName: "headers" }] : /* istanbul ignore next */ []);
|
|
1182
1227
|
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 */ []);
|
|
1228
|
+
drawDelay(index, count) {
|
|
1229
|
+
if (count <= 1) return 0;
|
|
1230
|
+
return Math.round(index / (count - 1) * 700);
|
|
1231
|
+
}
|
|
1183
1232
|
onPoint(point, event) {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1233
|
+
const index = Number(point.key.slice(point.key.indexOf("-") + 1));
|
|
1234
|
+
const rows = this.layout().series.map((item) => {
|
|
1235
|
+
const match = item.points[index] ?? point;
|
|
1236
|
+
return {
|
|
1237
|
+
swatch: match.color,
|
|
1238
|
+
label: item.name,
|
|
1239
|
+
value: match.formatted
|
|
1240
|
+
};
|
|
1241
|
+
});
|
|
1242
|
+
this.tip.set(tooltipAt(event, point.category, rows));
|
|
1189
1243
|
}
|
|
1190
1244
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1191
1245
|
minVersion: "12.0.0",
|
|
@@ -1286,6 +1340,13 @@ var NgxLineChart = class NgxLineChart {
|
|
|
1286
1340
|
isRequired: false,
|
|
1287
1341
|
transformFunction: null
|
|
1288
1342
|
},
|
|
1343
|
+
min: {
|
|
1344
|
+
classPropertyName: "min",
|
|
1345
|
+
publicName: "min",
|
|
1346
|
+
isSignal: true,
|
|
1347
|
+
isRequired: false,
|
|
1348
|
+
transformFunction: null
|
|
1349
|
+
},
|
|
1289
1350
|
animate: {
|
|
1290
1351
|
classPropertyName: "animate",
|
|
1291
1352
|
publicName: "animate",
|
|
@@ -1327,32 +1388,60 @@ var NgxLineChart = class NgxLineChart {
|
|
|
1327
1388
|
@if (layout().zero; as zero) {
|
|
1328
1389
|
<line class="ngx-zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
|
|
1329
1390
|
}
|
|
1330
|
-
|
|
1331
|
-
@
|
|
1332
|
-
|
|
1391
|
+
<defs>
|
|
1392
|
+
@for (item of layout().series; track item.name; let index = $index) {
|
|
1393
|
+
@if (item.area) {
|
|
1394
|
+
<linearGradient
|
|
1395
|
+
[attr.id]="fillId + '-' + index"
|
|
1396
|
+
gradientUnits="userSpaceOnUse"
|
|
1397
|
+
x1="0"
|
|
1398
|
+
[attr.y1]="0"
|
|
1399
|
+
x2="0"
|
|
1400
|
+
[attr.y2]="layout().baseline"
|
|
1401
|
+
>
|
|
1402
|
+
<stop offset="0%" [attr.stop-color]="item.color" stop-opacity="0.32" />
|
|
1403
|
+
<stop offset="100%" [attr.stop-color]="item.color" stop-opacity="0" />
|
|
1404
|
+
</linearGradient>
|
|
1405
|
+
}
|
|
1333
1406
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
<
|
|
1345
|
-
[attr.
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
stroke="
|
|
1351
|
-
|
|
1352
|
-
|
|
1407
|
+
</defs>
|
|
1408
|
+
<g [class.ngx-rise-on]="animate() && layout().fromZero" [style.--ngx-rise-origin.%]="riseOrigin()">
|
|
1409
|
+
@for (item of layout().series; track item.name; let index = $index) {
|
|
1410
|
+
@if (item.area) {
|
|
1411
|
+
<path
|
|
1412
|
+
[attr.d]="item.area"
|
|
1413
|
+
[attr.fill]="'url(#' + fillId + '-' + index + ')'"
|
|
1414
|
+
[class.ngx-in]="animate() && !layout().fromZero"
|
|
1415
|
+
/>
|
|
1416
|
+
}
|
|
1417
|
+
<path
|
|
1418
|
+
[attr.d]="item.line"
|
|
1419
|
+
fill="none"
|
|
1420
|
+
[attr.stroke]="item.color"
|
|
1421
|
+
stroke-width="2"
|
|
1422
|
+
stroke-linejoin="round"
|
|
1423
|
+
stroke-linecap="round"
|
|
1424
|
+
vector-effect="non-scaling-stroke"
|
|
1425
|
+
[class.ngx-draw]="animate() && !layout().fromZero"
|
|
1426
|
+
[attr.pathLength]="animate() && !layout().fromZero ? 1 : null"
|
|
1427
|
+
[attr.stroke-dasharray]="animate() && !layout().fromZero ? 1 : null"
|
|
1353
1428
|
/>
|
|
1429
|
+
@for (point of item.points; track point.key; let pointIndex = $index) {
|
|
1430
|
+
<circle
|
|
1431
|
+
[attr.cx]="point.x"
|
|
1432
|
+
[attr.cy]="point.y"
|
|
1433
|
+
r="4"
|
|
1434
|
+
[attr.fill]="point.color"
|
|
1435
|
+
class="cursor-pointer"
|
|
1436
|
+
[class.ngx-pop]="animate() && !layout().fromZero"
|
|
1437
|
+
[style.animation-delay.ms]="animate() && !layout().fromZero ? drawDelay(pointIndex, item.points.length) : 0"
|
|
1438
|
+
stroke="var(--ngx-surface)"
|
|
1439
|
+
stroke-width="1.5"
|
|
1440
|
+
(pointerenter)="onPoint(point, $event)"
|
|
1441
|
+
/>
|
|
1442
|
+
}
|
|
1354
1443
|
}
|
|
1355
|
-
|
|
1444
|
+
</g>
|
|
1356
1445
|
@for (label of layout().categories; track label.label + '-' + label.x) {
|
|
1357
1446
|
<text [attr.x]="label.x" [attr.y]="label.y" text-anchor="middle" dominant-baseline="middle">{{ label.label }}</text>
|
|
1358
1447
|
}
|
|
@@ -1423,32 +1512,60 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1423
1512
|
@if (layout().zero; as zero) {
|
|
1424
1513
|
<line class="ngx-zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
|
|
1425
1514
|
}
|
|
1426
|
-
|
|
1427
|
-
@
|
|
1428
|
-
|
|
1515
|
+
<defs>
|
|
1516
|
+
@for (item of layout().series; track item.name; let index = $index) {
|
|
1517
|
+
@if (item.area) {
|
|
1518
|
+
<linearGradient
|
|
1519
|
+
[attr.id]="fillId + '-' + index"
|
|
1520
|
+
gradientUnits="userSpaceOnUse"
|
|
1521
|
+
x1="0"
|
|
1522
|
+
[attr.y1]="0"
|
|
1523
|
+
x2="0"
|
|
1524
|
+
[attr.y2]="layout().baseline"
|
|
1525
|
+
>
|
|
1526
|
+
<stop offset="0%" [attr.stop-color]="item.color" stop-opacity="0.32" />
|
|
1527
|
+
<stop offset="100%" [attr.stop-color]="item.color" stop-opacity="0" />
|
|
1528
|
+
</linearGradient>
|
|
1529
|
+
}
|
|
1429
1530
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
<
|
|
1441
|
-
[attr.
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
stroke="
|
|
1447
|
-
|
|
1448
|
-
|
|
1531
|
+
</defs>
|
|
1532
|
+
<g [class.ngx-rise-on]="animate() && layout().fromZero" [style.--ngx-rise-origin.%]="riseOrigin()">
|
|
1533
|
+
@for (item of layout().series; track item.name; let index = $index) {
|
|
1534
|
+
@if (item.area) {
|
|
1535
|
+
<path
|
|
1536
|
+
[attr.d]="item.area"
|
|
1537
|
+
[attr.fill]="'url(#' + fillId + '-' + index + ')'"
|
|
1538
|
+
[class.ngx-in]="animate() && !layout().fromZero"
|
|
1539
|
+
/>
|
|
1540
|
+
}
|
|
1541
|
+
<path
|
|
1542
|
+
[attr.d]="item.line"
|
|
1543
|
+
fill="none"
|
|
1544
|
+
[attr.stroke]="item.color"
|
|
1545
|
+
stroke-width="2"
|
|
1546
|
+
stroke-linejoin="round"
|
|
1547
|
+
stroke-linecap="round"
|
|
1548
|
+
vector-effect="non-scaling-stroke"
|
|
1549
|
+
[class.ngx-draw]="animate() && !layout().fromZero"
|
|
1550
|
+
[attr.pathLength]="animate() && !layout().fromZero ? 1 : null"
|
|
1551
|
+
[attr.stroke-dasharray]="animate() && !layout().fromZero ? 1 : null"
|
|
1449
1552
|
/>
|
|
1553
|
+
@for (point of item.points; track point.key; let pointIndex = $index) {
|
|
1554
|
+
<circle
|
|
1555
|
+
[attr.cx]="point.x"
|
|
1556
|
+
[attr.cy]="point.y"
|
|
1557
|
+
r="4"
|
|
1558
|
+
[attr.fill]="point.color"
|
|
1559
|
+
class="cursor-pointer"
|
|
1560
|
+
[class.ngx-pop]="animate() && !layout().fromZero"
|
|
1561
|
+
[style.animation-delay.ms]="animate() && !layout().fromZero ? drawDelay(pointIndex, item.points.length) : 0"
|
|
1562
|
+
stroke="var(--ngx-surface)"
|
|
1563
|
+
stroke-width="1.5"
|
|
1564
|
+
(pointerenter)="onPoint(point, $event)"
|
|
1565
|
+
/>
|
|
1566
|
+
}
|
|
1450
1567
|
}
|
|
1451
|
-
|
|
1568
|
+
</g>
|
|
1452
1569
|
@for (label of layout().categories; track label.label + '-' + label.x) {
|
|
1453
1570
|
<text [attr.x]="label.x" [attr.y]="label.y" text-anchor="middle" dominant-baseline="middle">{{ label.label }}</text>
|
|
1454
1571
|
}
|
|
@@ -1556,6 +1673,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1556
1673
|
required: false
|
|
1557
1674
|
}]
|
|
1558
1675
|
}],
|
|
1676
|
+
min: [{
|
|
1677
|
+
type: i0.Input,
|
|
1678
|
+
args: [{
|
|
1679
|
+
isSignal: true,
|
|
1680
|
+
alias: "min",
|
|
1681
|
+
required: false
|
|
1682
|
+
}]
|
|
1683
|
+
}],
|
|
1559
1684
|
animate: [{
|
|
1560
1685
|
type: i0.Input,
|
|
1561
1686
|
args: [{
|
|
@@ -1781,15 +1906,22 @@ var NgxBarChart = class NgxBarChart {
|
|
|
1781
1906
|
[attr.width]="mark.width"
|
|
1782
1907
|
[attr.height]="mark.height"
|
|
1783
1908
|
[attr.fill]="mark.color"
|
|
1784
|
-
rx="3"
|
|
1909
|
+
[attr.rx]="mode() === 'stacked' ? 0 : 3"
|
|
1785
1910
|
class="cursor-pointer"
|
|
1786
|
-
[class.ngx-
|
|
1911
|
+
[class.ngx-grow-y]="animate() && orientation() !== 'horizontal'"
|
|
1912
|
+
[class.ngx-grow-x]="animate() && orientation() === 'horizontal'"
|
|
1913
|
+
[class.ngx-grow-bottom]="mark.origin === 'bottom'"
|
|
1914
|
+
[class.ngx-grow-top]="mark.origin === 'top'"
|
|
1915
|
+
[class.ngx-grow-left]="mark.origin === 'left'"
|
|
1916
|
+
[class.ngx-grow-right]="mark.origin === 'right'"
|
|
1787
1917
|
[style.animation-delay.ms]="animate() ? $index * 18 : 0"
|
|
1788
1918
|
(pointerenter)="onMark(mark, $event)"
|
|
1789
1919
|
/>
|
|
1790
1920
|
@if (mark.showLabel) {
|
|
1791
1921
|
<text
|
|
1792
1922
|
class="ngx-value"
|
|
1923
|
+
[class.ngx-in]="animate()"
|
|
1924
|
+
[style.animation-delay.ms]="animate() ? $index * 18 + 380 : 0"
|
|
1793
1925
|
[attr.x]="mark.labelX"
|
|
1794
1926
|
[attr.y]="mark.labelY"
|
|
1795
1927
|
[attr.text-anchor]="orientation() === 'horizontal' ? 'start' : 'middle'"
|
|
@@ -1809,7 +1941,7 @@ var NgxBarChart = class NgxBarChart {
|
|
|
1809
1941
|
</ngx-chart-frame>
|
|
1810
1942
|
`,
|
|
1811
1943
|
isInline: true,
|
|
1812
|
-
styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"],
|
|
1944
|
+
styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n", ":host{display:block;min-height:var(--ngx-chart-height,320px)}\n"],
|
|
1813
1945
|
dependencies: [{
|
|
1814
1946
|
kind: "component",
|
|
1815
1947
|
type: NgxChartFrame,
|
|
@@ -1878,15 +2010,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1878
2010
|
[attr.width]="mark.width"
|
|
1879
2011
|
[attr.height]="mark.height"
|
|
1880
2012
|
[attr.fill]="mark.color"
|
|
1881
|
-
rx="3"
|
|
2013
|
+
[attr.rx]="mode() === 'stacked' ? 0 : 3"
|
|
1882
2014
|
class="cursor-pointer"
|
|
1883
|
-
[class.ngx-
|
|
2015
|
+
[class.ngx-grow-y]="animate() && orientation() !== 'horizontal'"
|
|
2016
|
+
[class.ngx-grow-x]="animate() && orientation() === 'horizontal'"
|
|
2017
|
+
[class.ngx-grow-bottom]="mark.origin === 'bottom'"
|
|
2018
|
+
[class.ngx-grow-top]="mark.origin === 'top'"
|
|
2019
|
+
[class.ngx-grow-left]="mark.origin === 'left'"
|
|
2020
|
+
[class.ngx-grow-right]="mark.origin === 'right'"
|
|
1884
2021
|
[style.animation-delay.ms]="animate() ? $index * 18 : 0"
|
|
1885
2022
|
(pointerenter)="onMark(mark, $event)"
|
|
1886
2023
|
/>
|
|
1887
2024
|
@if (mark.showLabel) {
|
|
1888
2025
|
<text
|
|
1889
2026
|
class="ngx-value"
|
|
2027
|
+
[class.ngx-in]="animate()"
|
|
2028
|
+
[style.animation-delay.ms]="animate() ? $index * 18 + 380 : 0"
|
|
1890
2029
|
[attr.x]="mark.labelX"
|
|
1891
2030
|
[attr.y]="mark.labelY"
|
|
1892
2031
|
[attr.text-anchor]="orientation() === 'horizontal' ? 'start' : 'middle'"
|
|
@@ -1905,7 +2044,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1905
2044
|
}
|
|
1906
2045
|
</ngx-chart-frame>
|
|
1907
2046
|
`,
|
|
1908
|
-
styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n"]
|
|
2047
|
+
styles: [":host{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0}\n", ":host{display:block;min-height:var(--ngx-chart-height,320px)}\n"]
|
|
1909
2048
|
}]
|
|
1910
2049
|
}],
|
|
1911
2050
|
propDecorators: {
|