@konce-pt/angular 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +38 -19
- package/fesm2022/konce-pt-angular-charts.mjs +1409 -0
- package/fesm2022/konce-pt-angular-charts.mjs.map +1 -0
- package/fesm2022/konce-pt-angular-grid.mjs +232 -0
- package/{dist/fesm2022 → fesm2022}/konce-pt-angular-grid.mjs.map +1 -1
- package/fesm2022/konce-pt-angular-roadmap.mjs +1919 -0
- package/fesm2022/konce-pt-angular-roadmap.mjs.map +1 -0
- package/fesm2022/konce-pt-angular.mjs +11869 -0
- package/fesm2022/konce-pt-angular.mjs.map +1 -0
- package/package.json +28 -51
- package/roadmap/src/lib/llms.txt +112 -0
- package/{dist/src → src}/lib/form-field/llms.txt +5 -0
- package/{dist/src → src}/lib/input/llms.txt +13 -3
- package/src/lib/input-number/llms.txt +61 -0
- package/src/lib/tooltip/llms.txt +33 -0
- package/{dist/types → types}/konce-pt-angular-charts.d.ts +1 -0
- package/types/konce-pt-angular-charts.d.ts.map +1 -0
- package/{dist/types → types}/konce-pt-angular-grid.d.ts +1 -0
- package/types/konce-pt-angular-grid.d.ts.map +1 -0
- package/{dist/types → types}/konce-pt-angular-icons.d.ts +1 -0
- package/types/konce-pt-angular-icons.d.ts.map +1 -0
- package/types/konce-pt-angular-roadmap.d.ts +649 -0
- package/types/konce-pt-angular-roadmap.d.ts.map +1 -0
- package/{dist/types → types}/konce-pt-angular.d.ts +69 -3
- package/types/konce-pt-angular.d.ts.map +1 -0
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -316
- package/dist/fesm2022/konce-pt-angular-charts.mjs +0 -957
- package/dist/fesm2022/konce-pt-angular-charts.mjs.map +0 -1
- package/dist/fesm2022/konce-pt-angular-grid.mjs +0 -218
- package/dist/fesm2022/konce-pt-angular.mjs +0 -8462
- package/dist/fesm2022/konce-pt-angular.mjs.map +0 -1
- package/dist/package.json +0 -79
- package/dist/src/lib/input-number/llms.txt +0 -17
- package/dist/src/lib/tooltip/llms.txt +0 -19
- /package/{dist/charts → charts}/src/lib/llms.txt +0 -0
- /package/{dist/fesm2022 → fesm2022}/konce-pt-angular-icons.mjs +0 -0
- /package/{dist/fesm2022 → fesm2022}/konce-pt-angular-icons.mjs.map +0 -0
- /package/{dist/grid → grid}/src/lib/llms.txt +0 -0
- /package/{dist/src → src}/lib/accordion/llms.txt +0 -0
- /package/{dist/src → src}/lib/alert/llms.txt +0 -0
- /package/{dist/src → src}/lib/app-shell/llms.txt +0 -0
- /package/{dist/src → src}/lib/autocomplete/llms.txt +0 -0
- /package/{dist/src → src}/lib/avatar/llms.txt +0 -0
- /package/{dist/src → src}/lib/avatar-group/llms.txt +0 -0
- /package/{dist/src → src}/lib/badge/llms.txt +0 -0
- /package/{dist/src → src}/lib/bottom-sheet/llms.txt +0 -0
- /package/{dist/src → src}/lib/breadcrumb/llms.txt +0 -0
- /package/{dist/src → src}/lib/button/llms.txt +0 -0
- /package/{dist/src → src}/lib/button-group/llms.txt +0 -0
- /package/{dist/src → src}/lib/card/llms.txt +0 -0
- /package/{dist/src → src}/lib/carousel/llms.txt +0 -0
- /package/{dist/src → src}/lib/checkbox/llms.txt +0 -0
- /package/{dist/src → src}/lib/chip/llms.txt +0 -0
- /package/{dist/src → src}/lib/chips-input/llms.txt +0 -0
- /package/{dist/src → src}/lib/color-picker/llms.txt +0 -0
- /package/{dist/src → src}/lib/confirm/llms.txt +0 -0
- /package/{dist/src → src}/lib/context-menu/llms.txt +0 -0
- /package/{dist/src → src}/lib/data-table/llms.txt +0 -0
- /package/{dist/src → src}/lib/data-view/llms.txt +0 -0
- /package/{dist/src → src}/lib/date-range/llms.txt +0 -0
- /package/{dist/src → src}/lib/datepicker/llms.txt +0 -0
- /package/{dist/src → src}/lib/dialog/llms.txt +0 -0
- /package/{dist/src → src}/lib/divider/llms.txt +0 -0
- /package/{dist/src → src}/lib/drawer/llms.txt +0 -0
- /package/{dist/src → src}/lib/empty/llms.txt +0 -0
- /package/{dist/src → src}/lib/fab/llms.txt +0 -0
- /package/{dist/src → src}/lib/fieldset/llms.txt +0 -0
- /package/{dist/src → src}/lib/file-upload/llms.txt +0 -0
- /package/{dist/src → src}/lib/galleria/llms.txt +0 -0
- /package/{dist/src → src}/lib/i18n/llms.txt +0 -0
- /package/{dist/src → src}/lib/icon/llms.txt +0 -0
- /package/{dist/src → src}/lib/icon-button/llms.txt +0 -0
- /package/{dist/src → src}/lib/image/llms.txt +0 -0
- /package/{dist/src → src}/lib/input-mask/llms.txt +0 -0
- /package/{dist/src → src}/lib/input-otp/llms.txt +0 -0
- /package/{dist/src → src}/lib/knob/llms.txt +0 -0
- /package/{dist/src → src}/lib/listbox/llms.txt +0 -0
- /package/{dist/src → src}/lib/megamenu/llms.txt +0 -0
- /package/{dist/src → src}/lib/menu/llms.txt +0 -0
- /package/{dist/src → src}/lib/menubar/llms.txt +0 -0
- /package/{dist/src → src}/lib/meter-group/llms.txt +0 -0
- /package/{dist/src → src}/lib/order-list/llms.txt +0 -0
- /package/{dist/src → src}/lib/paginator/llms.txt +0 -0
- /package/{dist/src → src}/lib/panel/llms.txt +0 -0
- /package/{dist/src → src}/lib/password/llms.txt +0 -0
- /package/{dist/src → src}/lib/pick-list/llms.txt +0 -0
- /package/{dist/src → src}/lib/popover/llms.txt +0 -0
- /package/{dist/src → src}/lib/progress/llms.txt +0 -0
- /package/{dist/src → src}/lib/radio-group/llms.txt +0 -0
- /package/{dist/src → src}/lib/rating/llms.txt +0 -0
- /package/{dist/src → src}/lib/rich-text/llms.txt +0 -0
- /package/{dist/src → src}/lib/scroll-top/llms.txt +0 -0
- /package/{dist/src → src}/lib/select/llms.txt +0 -0
- /package/{dist/src → src}/lib/sidenav/llms.txt +0 -0
- /package/{dist/src → src}/lib/skeleton/llms.txt +0 -0
- /package/{dist/src → src}/lib/slider/llms.txt +0 -0
- /package/{dist/src → src}/lib/speed-dial/llms.txt +0 -0
- /package/{dist/src → src}/lib/spinner/llms.txt +0 -0
- /package/{dist/src → src}/lib/split-button/llms.txt +0 -0
- /package/{dist/src → src}/lib/splitter/llms.txt +0 -0
- /package/{dist/src → src}/lib/stepper/llms.txt +0 -0
- /package/{dist/src → src}/lib/switch/llms.txt +0 -0
- /package/{dist/src → src}/lib/switch-group/llms.txt +0 -0
- /package/{dist/src → src}/lib/tabs/llms.txt +0 -0
- /package/{dist/src → src}/lib/textarea/llms.txt +0 -0
- /package/{dist/src → src}/lib/timeline/llms.txt +0 -0
- /package/{dist/src → src}/lib/toast/llms.txt +0 -0
- /package/{dist/src → src}/lib/toolbar/llms.txt +0 -0
- /package/{dist/src → src}/lib/tree/llms.txt +0 -0
|
@@ -0,0 +1,1409 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, signal } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
function n$2(value) {
|
|
5
|
+
// Skraca zapis (mniejszy DOM) i unika notacji wykładniczej dla małych liczb.
|
|
6
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3);
|
|
7
|
+
}
|
|
8
|
+
/** Ścieżka odcinkowa (M/L). */
|
|
9
|
+
function linearPath(points) {
|
|
10
|
+
return points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${n$2(p.x)} ${n$2(p.y)}`).join(' ');
|
|
11
|
+
}
|
|
12
|
+
/** Standardowa interpolacja sześcienna (Catmull-Rom przez punkty → krzywe Béziera). */
|
|
13
|
+
function cubicPath(points) {
|
|
14
|
+
if (points.length < 3)
|
|
15
|
+
return linearPath(points);
|
|
16
|
+
let d = `M ${n$2(points[0].x)} ${n$2(points[0].y)}`;
|
|
17
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
18
|
+
const p0 = points[i - 1] ?? points[i];
|
|
19
|
+
const p1 = points[i];
|
|
20
|
+
const p2 = points[i + 1];
|
|
21
|
+
const p3 = points[i + 2] ?? p2;
|
|
22
|
+
const c1x = p1.x + (p2.x - p0.x) / 6;
|
|
23
|
+
const c1y = p1.y + (p2.y - p0.y) / 6;
|
|
24
|
+
const c2x = p2.x - (p3.x - p1.x) / 6;
|
|
25
|
+
const c2y = p2.y - (p3.y - p1.y) / 6;
|
|
26
|
+
d += ` C ${n$2(c1x)} ${n$2(c1y)}, ${n$2(c2x)} ${n$2(c2y)}, ${n$2(p2.x)} ${n$2(p2.y)}`;
|
|
27
|
+
}
|
|
28
|
+
return d;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Monotoniczna interpolacja sześcienna (Fritsch–Carlson).
|
|
32
|
+
* Styczne przycinane tak, by krzywa nie przestrzelała ekstremów danych.
|
|
33
|
+
* Liczona względem indeksu punktu (równe odstępy w X, typowe dla osi kategorii).
|
|
34
|
+
*/
|
|
35
|
+
function monotonePath(points) {
|
|
36
|
+
const size = points.length;
|
|
37
|
+
if (size < 3)
|
|
38
|
+
return linearPath(points);
|
|
39
|
+
const dx = [];
|
|
40
|
+
const dy = [];
|
|
41
|
+
const slope = [];
|
|
42
|
+
for (let i = 0; i < size - 1; i++) {
|
|
43
|
+
dx[i] = points[i + 1].x - points[i].x;
|
|
44
|
+
dy[i] = points[i + 1].y - points[i].y;
|
|
45
|
+
slope[i] = dy[i] / (dx[i] || 1);
|
|
46
|
+
}
|
|
47
|
+
// Styczne w węzłach (m).
|
|
48
|
+
const m = new Array(size);
|
|
49
|
+
m[0] = slope[0];
|
|
50
|
+
m[size - 1] = slope[size - 2];
|
|
51
|
+
for (let i = 1; i < size - 1; i++) {
|
|
52
|
+
if (slope[i - 1] * slope[i] <= 0) {
|
|
53
|
+
m[i] = 0; // lokalne ekstremum → styczna pozioma
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
m[i] = (slope[i - 1] + slope[i]) / 2;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Ograniczenie Fritsch–Carlson.
|
|
60
|
+
for (let i = 0; i < size - 1; i++) {
|
|
61
|
+
if (slope[i] === 0) {
|
|
62
|
+
m[i] = 0;
|
|
63
|
+
m[i + 1] = 0;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const a = m[i] / slope[i];
|
|
67
|
+
const b = m[i + 1] / slope[i];
|
|
68
|
+
const h = Math.hypot(a, b);
|
|
69
|
+
if (h > 3) {
|
|
70
|
+
const t = 3 / h;
|
|
71
|
+
m[i] = t * a * slope[i];
|
|
72
|
+
m[i + 1] = t * b * slope[i];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let d = `M ${n$2(points[0].x)} ${n$2(points[0].y)}`;
|
|
76
|
+
for (let i = 0; i < size - 1; i++) {
|
|
77
|
+
const c1x = points[i].x + dx[i] / 3;
|
|
78
|
+
const c1y = points[i].y + (m[i] * dx[i]) / 3;
|
|
79
|
+
const c2x = points[i + 1].x - dx[i] / 3;
|
|
80
|
+
const c2y = points[i + 1].y - (m[i + 1] * dx[i]) / 3;
|
|
81
|
+
d += ` C ${n$2(c1x)} ${n$2(c1y)}, ${n$2(c2x)} ${n$2(c2y)}, ${n$2(points[i + 1].x)} ${n$2(points[i + 1].y)}`;
|
|
82
|
+
}
|
|
83
|
+
return d;
|
|
84
|
+
}
|
|
85
|
+
/** Ścieżka linii dla wybranego trybu interpolacji. */
|
|
86
|
+
function linePath(points, mode = 'linear') {
|
|
87
|
+
if (points.length === 0)
|
|
88
|
+
return '';
|
|
89
|
+
if (points.length === 1)
|
|
90
|
+
return `M ${n$2(points[0].x)} ${n$2(points[0].y)}`;
|
|
91
|
+
switch (mode) {
|
|
92
|
+
case 'cubic':
|
|
93
|
+
return cubicPath(points);
|
|
94
|
+
case 'cubic-monotonic':
|
|
95
|
+
return monotonePath(points);
|
|
96
|
+
default:
|
|
97
|
+
return linearPath(points);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Ścieżka obszaru pod linią (domknięta do `baselineY`). */
|
|
101
|
+
function areaPath(points, baselineY, mode = 'linear') {
|
|
102
|
+
if (points.length === 0)
|
|
103
|
+
return '';
|
|
104
|
+
const top = linePath(points, mode);
|
|
105
|
+
const first = points[0];
|
|
106
|
+
const last = points.at(-1);
|
|
107
|
+
return `${top} L ${n$2(last.x)} ${n$2(baselineY)} L ${n$2(first.x)} ${n$2(baselineY)} Z`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
* Skalowanie i „ładne" podziałki osi (auto-skala).
|
|
112
|
+
* Wszystkie funkcje czyste — bez stanu i DOM.
|
|
113
|
+
*/
|
|
114
|
+
/** Zakres [min, max] tablicy liczb (0..0 dla pustej). */
|
|
115
|
+
function extent(values) {
|
|
116
|
+
if (values.length === 0)
|
|
117
|
+
return [0, 0];
|
|
118
|
+
let min = values[0];
|
|
119
|
+
let max = values[0];
|
|
120
|
+
for (const v of values) {
|
|
121
|
+
if (v < min)
|
|
122
|
+
min = v;
|
|
123
|
+
if (v > max)
|
|
124
|
+
max = v;
|
|
125
|
+
}
|
|
126
|
+
return [min, max];
|
|
127
|
+
}
|
|
128
|
+
/** Interpolacja liniowa domeny → zakresu (np. wartość → współrzędna piksela). */
|
|
129
|
+
function linearScale(domainMin, domainMax, rangeMin, rangeMax) {
|
|
130
|
+
const dSpan = domainMax - domainMin || 1;
|
|
131
|
+
const rSpan = rangeMax - rangeMin;
|
|
132
|
+
return (value) => rangeMin + ((value - domainMin) / dSpan) * rSpan;
|
|
133
|
+
}
|
|
134
|
+
/** Zaokrągla liczbę do „ładnej" wartości (1/2/5 × 10ⁿ). */
|
|
135
|
+
function niceNum(range, round) {
|
|
136
|
+
const exponent = Math.floor(Math.log10(range || 1));
|
|
137
|
+
const fraction = (range || 1) / 10 ** exponent;
|
|
138
|
+
return niceFraction(fraction, round) * 10 ** exponent;
|
|
139
|
+
}
|
|
140
|
+
/** Mantysa 1/2/5/10 — do najbliższej (`round`) albo w górę. */
|
|
141
|
+
function niceFraction(fraction, round) {
|
|
142
|
+
if (round) {
|
|
143
|
+
if (fraction < 1.5)
|
|
144
|
+
return 1;
|
|
145
|
+
if (fraction < 3)
|
|
146
|
+
return 2;
|
|
147
|
+
if (fraction < 7)
|
|
148
|
+
return 5;
|
|
149
|
+
return 10;
|
|
150
|
+
}
|
|
151
|
+
if (fraction <= 1)
|
|
152
|
+
return 1;
|
|
153
|
+
if (fraction <= 2)
|
|
154
|
+
return 2;
|
|
155
|
+
if (fraction <= 5)
|
|
156
|
+
return 5;
|
|
157
|
+
return 10;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* „Ładna" skala obejmująca [dataMin, dataMax] z ~`maxTicks` podziałkami.
|
|
161
|
+
* Wynikowy zakres jest rozszerzony do równych kroków; zawsze zawiera 0,
|
|
162
|
+
* gdy dane są jednoznakowe (typowe dla słupków/linii wartościowych).
|
|
163
|
+
*/
|
|
164
|
+
function niceScale(dataMin, dataMax, maxTicks = 5) {
|
|
165
|
+
let lo = dataMin;
|
|
166
|
+
let hi = dataMax;
|
|
167
|
+
if (lo > 0)
|
|
168
|
+
lo = 0;
|
|
169
|
+
if (hi < 0)
|
|
170
|
+
hi = 0;
|
|
171
|
+
if (lo === hi) {
|
|
172
|
+
hi = lo + 1;
|
|
173
|
+
}
|
|
174
|
+
const range = niceNum(hi - lo, false);
|
|
175
|
+
const step = niceNum(range / Math.max(1, maxTicks - 1), true);
|
|
176
|
+
const niceMin = Math.floor(lo / step) * step;
|
|
177
|
+
const niceMax = Math.ceil(hi / step) * step;
|
|
178
|
+
const ticks = [];
|
|
179
|
+
// +1e-9: zabezpieczenie przed błędami zmiennoprzecinkowymi na krańcu pętli.
|
|
180
|
+
for (let t = niceMin; t <= niceMax + 1e-9; t += step) {
|
|
181
|
+
ticks.push(Math.abs(t) < 1e-9 ? 0 : t);
|
|
182
|
+
}
|
|
183
|
+
return { min: niceMin, max: niceMax, step, ticks };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Skala pasmowa: dzieli [rangeStart, rangeEnd] na `count` równych pasm
|
|
187
|
+
* z marginesem `padding` (0..1 udziału pasma) po bokach i między pasmami.
|
|
188
|
+
*/
|
|
189
|
+
function bandScale(count, rangeStart, rangeEnd, padding = 0.1) {
|
|
190
|
+
const span = rangeEnd - rangeStart;
|
|
191
|
+
const step = count > 0 ? span / count : span;
|
|
192
|
+
const bandwidth = step * (1 - padding);
|
|
193
|
+
const offset = (step - bandwidth) / 2;
|
|
194
|
+
return {
|
|
195
|
+
bandwidth,
|
|
196
|
+
start: (index) => rangeStart + index * step + offset,
|
|
197
|
+
center: (index) => rangeStart + index * step + step / 2,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/*
|
|
202
|
+
* Geometria wykresu słupkowego (pionowego i poziomego) z zaokrągleniem rogów.
|
|
203
|
+
* Wspiera wiele serii (grupowanie obok siebie w obrębie kategorii).
|
|
204
|
+
*/
|
|
205
|
+
function n$1(value) {
|
|
206
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3);
|
|
207
|
+
}
|
|
208
|
+
/** Prostokąt z zaokrąglonymi rogami tylko po wybranych stronach. */
|
|
209
|
+
function roundedRect(x, y, w, h, r, corners) {
|
|
210
|
+
const radius = Math.max(0, Math.min(r, w / 2, h / 2));
|
|
211
|
+
const tl = corners.tl ? radius : 0;
|
|
212
|
+
const tr = corners.tr ? radius : 0;
|
|
213
|
+
const br = corners.br ? radius : 0;
|
|
214
|
+
const bl = corners.bl ? radius : 0;
|
|
215
|
+
return [
|
|
216
|
+
`M ${n$1(x + tl)} ${n$1(y)}`,
|
|
217
|
+
`H ${n$1(x + w - tr)}`,
|
|
218
|
+
tr ? `A ${n$1(tr)} ${n$1(tr)} 0 0 1 ${n$1(x + w)} ${n$1(y + tr)}` : '',
|
|
219
|
+
`V ${n$1(y + h - br)}`,
|
|
220
|
+
br ? `A ${n$1(br)} ${n$1(br)} 0 0 1 ${n$1(x + w - br)} ${n$1(y + h)}` : '',
|
|
221
|
+
`H ${n$1(x + bl)}`,
|
|
222
|
+
bl ? `A ${n$1(bl)} ${n$1(bl)} 0 0 1 ${n$1(x)} ${n$1(y + h - bl)}` : '',
|
|
223
|
+
`V ${n$1(y + tl)}`,
|
|
224
|
+
tl ? `A ${n$1(tl)} ${n$1(tl)} 0 0 1 ${n$1(x + tl)} ${n$1(y)}` : '',
|
|
225
|
+
'Z',
|
|
226
|
+
]
|
|
227
|
+
.filter(Boolean)
|
|
228
|
+
.join(' ');
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Wylicza słupki dla obszaru `plot`.
|
|
232
|
+
* @param seriesData wartości[serie][kategorie]
|
|
233
|
+
* @param plot obszar rysowania {x,y,width,height}
|
|
234
|
+
* @param orientation pionowa (rośnie w górę) lub pozioma (rośnie w prawo)
|
|
235
|
+
* @param borderRadius promień zaokrąglenia w px
|
|
236
|
+
*/
|
|
237
|
+
function barLayout(seriesData, categoryCount, plot, orientation, borderRadius) {
|
|
238
|
+
let min = 0;
|
|
239
|
+
let max = 0;
|
|
240
|
+
for (const row of seriesData) {
|
|
241
|
+
for (const v of row) {
|
|
242
|
+
if (v < min)
|
|
243
|
+
min = v;
|
|
244
|
+
if (v > max)
|
|
245
|
+
max = v;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const scale = niceScale(min, max, 5);
|
|
249
|
+
const seriesCount = seriesData.length || 1;
|
|
250
|
+
const bars = [];
|
|
251
|
+
if (orientation === 'vertical') {
|
|
252
|
+
const value = linearScale(scale.min, scale.max, plot.y + plot.height, plot.y);
|
|
253
|
+
const baseline = value(0);
|
|
254
|
+
const cat = bandScale(categoryCount, plot.x, plot.x + plot.width, 0.2);
|
|
255
|
+
const group = bandScale(seriesCount, 0, cat.bandwidth, 0.1);
|
|
256
|
+
seriesData.forEach((values, s) => {
|
|
257
|
+
for (let c = 0; c < categoryCount; c++) {
|
|
258
|
+
const v = values[c] ?? 0;
|
|
259
|
+
const x = cat.start(c) + group.start(s);
|
|
260
|
+
const w = group.bandwidth;
|
|
261
|
+
const yv = value(v);
|
|
262
|
+
const top = Math.min(baseline, yv);
|
|
263
|
+
const h = Math.abs(yv - baseline);
|
|
264
|
+
const up = v >= 0;
|
|
265
|
+
bars.push({
|
|
266
|
+
rect: { x, y: top, width: w, height: h },
|
|
267
|
+
path: roundedRect(x, top, w, h, borderRadius, up ? { tl: true, tr: true } : { bl: true, br: true }),
|
|
268
|
+
seriesIndex: s,
|
|
269
|
+
categoryIndex: c,
|
|
270
|
+
value: v,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return { bars, baseline, scale, ticks: scale.ticks.map((t) => ({ value: t, pos: value(t) })) };
|
|
275
|
+
}
|
|
276
|
+
// horizontal
|
|
277
|
+
const value = linearScale(scale.min, scale.max, plot.x, plot.x + plot.width);
|
|
278
|
+
const baseline = value(0);
|
|
279
|
+
const cat = bandScale(categoryCount, plot.y, plot.y + plot.height, 0.2);
|
|
280
|
+
const group = bandScale(seriesCount, 0, cat.bandwidth, 0.1);
|
|
281
|
+
seriesData.forEach((values, s) => {
|
|
282
|
+
for (let c = 0; c < categoryCount; c++) {
|
|
283
|
+
const v = values[c] ?? 0;
|
|
284
|
+
const y = cat.start(c) + group.start(s);
|
|
285
|
+
const h = group.bandwidth;
|
|
286
|
+
const xv = value(v);
|
|
287
|
+
const left = Math.min(baseline, xv);
|
|
288
|
+
const w = Math.abs(xv - baseline);
|
|
289
|
+
const right = v >= 0;
|
|
290
|
+
bars.push({
|
|
291
|
+
rect: { x: left, y, width: w, height: h },
|
|
292
|
+
path: roundedRect(left, y, w, h, borderRadius, right ? { tr: true, br: true } : { tl: true, bl: true }),
|
|
293
|
+
seriesIndex: s,
|
|
294
|
+
categoryIndex: c,
|
|
295
|
+
value: v,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return { bars, baseline, scale, ticks: scale.ticks.map((t) => ({ value: t, pos: value(t) })) };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const HALF_PI = Math.PI / 2;
|
|
303
|
+
function n(value) {
|
|
304
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3);
|
|
305
|
+
}
|
|
306
|
+
/** Punkt na okręgu dla kąta (0 = góra, rośnie zgodnie z zegarem). */
|
|
307
|
+
function polarToCartesian(cx, cy, radius, angle) {
|
|
308
|
+
const a = angle - HALF_PI;
|
|
309
|
+
return { x: cx + radius * Math.cos(a), y: cy + radius * Math.sin(a) };
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Ścieżka wycinka pierścienia od `startAngle` do `endAngle`.
|
|
313
|
+
* `innerRadius = 0` → pełny wycinek koła (pie); > 0 → pierścień (doughnut).
|
|
314
|
+
*/
|
|
315
|
+
function arcPath(cx, cy, outerRadius, innerRadius, startAngle, endAngle) {
|
|
316
|
+
const sweep = endAngle - startAngle;
|
|
317
|
+
const largeArc = sweep > Math.PI ? 1 : 0;
|
|
318
|
+
// Pełny okrąg (np. pojedynczy wycinek 100%) — rozbijamy na dwa łuki.
|
|
319
|
+
if (sweep >= Math.PI * 2 - 1e-6) {
|
|
320
|
+
const outer = fullCircle(cx, cy, outerRadius, 1);
|
|
321
|
+
if (innerRadius <= 0)
|
|
322
|
+
return outer;
|
|
323
|
+
return `${outer} ${fullCircle(cx, cy, innerRadius, 0)}`;
|
|
324
|
+
}
|
|
325
|
+
const oStart = polarToCartesian(cx, cy, outerRadius, startAngle);
|
|
326
|
+
const oEnd = polarToCartesian(cx, cy, outerRadius, endAngle);
|
|
327
|
+
if (innerRadius <= 0) {
|
|
328
|
+
return [
|
|
329
|
+
`M ${n(cx)} ${n(cy)}`,
|
|
330
|
+
`L ${n(oStart.x)} ${n(oStart.y)}`,
|
|
331
|
+
`A ${n(outerRadius)} ${n(outerRadius)} 0 ${largeArc} 1 ${n(oEnd.x)} ${n(oEnd.y)}`,
|
|
332
|
+
'Z',
|
|
333
|
+
].join(' ');
|
|
334
|
+
}
|
|
335
|
+
const iStart = polarToCartesian(cx, cy, innerRadius, endAngle);
|
|
336
|
+
const iEnd = polarToCartesian(cx, cy, innerRadius, startAngle);
|
|
337
|
+
return [
|
|
338
|
+
`M ${n(oStart.x)} ${n(oStart.y)}`,
|
|
339
|
+
`A ${n(outerRadius)} ${n(outerRadius)} 0 ${largeArc} 1 ${n(oEnd.x)} ${n(oEnd.y)}`,
|
|
340
|
+
`L ${n(iStart.x)} ${n(iStart.y)}`,
|
|
341
|
+
`A ${n(innerRadius)} ${n(innerRadius)} 0 ${largeArc} 0 ${n(iEnd.x)} ${n(iEnd.y)}`,
|
|
342
|
+
'Z',
|
|
343
|
+
].join(' ');
|
|
344
|
+
}
|
|
345
|
+
/** Pełny okrąg jako dwa półłuki (sweepFlag steruje kierunkiem — dla wycięcia). */
|
|
346
|
+
function fullCircle(cx, cy, r, sweepFlag) {
|
|
347
|
+
const top = polarToCartesian(cx, cy, r, 0);
|
|
348
|
+
const bottom = polarToCartesian(cx, cy, r, Math.PI);
|
|
349
|
+
return [
|
|
350
|
+
`M ${n(top.x)} ${n(top.y)}`,
|
|
351
|
+
`A ${n(r)} ${n(r)} 0 1 ${sweepFlag} ${n(bottom.x)} ${n(bottom.y)}`,
|
|
352
|
+
`A ${n(r)} ${n(r)} 0 1 ${sweepFlag} ${n(top.x)} ${n(top.y)}`,
|
|
353
|
+
'Z',
|
|
354
|
+
].join(' ');
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Wycinki pie/doughnut: kąt proporcjonalny do wartości (Σ = 2π).
|
|
358
|
+
* `innerRadius` w px (0 dla pie).
|
|
359
|
+
*/
|
|
360
|
+
function pieSlices(values, cx, cy, outerRadius, innerRadius = 0) {
|
|
361
|
+
const total = values.reduce((a, v) => a + Math.max(0, v), 0);
|
|
362
|
+
if (total <= 0)
|
|
363
|
+
return [];
|
|
364
|
+
const slices = [];
|
|
365
|
+
let angle = 0;
|
|
366
|
+
for (const value of values) {
|
|
367
|
+
const sweep = (Math.max(0, value) / total) * Math.PI * 2;
|
|
368
|
+
const start = angle;
|
|
369
|
+
const end = angle + sweep;
|
|
370
|
+
slices.push({
|
|
371
|
+
path: arcPath(cx, cy, outerRadius, innerRadius, start, end),
|
|
372
|
+
midAngle: (start + end) / 2,
|
|
373
|
+
startAngle: start,
|
|
374
|
+
endAngle: end,
|
|
375
|
+
value,
|
|
376
|
+
});
|
|
377
|
+
angle = end;
|
|
378
|
+
}
|
|
379
|
+
return slices;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Wycinki polar area: równy kąt (2π/N), promień proporcjonalny do wartości.
|
|
383
|
+
* `maxValue` skaluje promień do `outerRadius`.
|
|
384
|
+
*/
|
|
385
|
+
function polarSlices(values, cx, cy, outerRadius, maxValue = 1) {
|
|
386
|
+
const count = values.length;
|
|
387
|
+
if (count === 0)
|
|
388
|
+
return [];
|
|
389
|
+
const sweep = (Math.PI * 2) / count;
|
|
390
|
+
return values.map((value, i) => {
|
|
391
|
+
const start = i * sweep;
|
|
392
|
+
const end = start + sweep;
|
|
393
|
+
const r = (Math.max(0, value) / maxValue) * outerRadius;
|
|
394
|
+
return {
|
|
395
|
+
path: arcPath(cx, cy, r, 0, start, end),
|
|
396
|
+
midAngle: (start + end) / 2,
|
|
397
|
+
startAngle: start,
|
|
398
|
+
endAngle: end,
|
|
399
|
+
value,
|
|
400
|
+
};
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/*
|
|
405
|
+
* Geometria wykresu radarowego: osie promieniowe + wielokąty serii.
|
|
406
|
+
*/
|
|
407
|
+
/** Siatka radaru: `levels` koncentrycznych wielokątów + osie do etykiet. */
|
|
408
|
+
function radarGrid(count, cx, cy, radius, levels = 4) {
|
|
409
|
+
const axes = [];
|
|
410
|
+
const step = (Math.PI * 2) / Math.max(1, count);
|
|
411
|
+
for (let i = 0; i < count; i++) {
|
|
412
|
+
const angle = i * step;
|
|
413
|
+
axes.push({ angle, labelIndex: i, end: polarToCartesian(cx, cy, radius, angle) });
|
|
414
|
+
}
|
|
415
|
+
const rings = [];
|
|
416
|
+
for (let l = 1; l <= levels; l++) {
|
|
417
|
+
const r = (radius * l) / levels;
|
|
418
|
+
rings.push(polygonPath(axes.map((a) => polarToCartesian(cx, cy, r, a.angle))));
|
|
419
|
+
}
|
|
420
|
+
return { rings, axes };
|
|
421
|
+
}
|
|
422
|
+
/** Punkty wielokąta serii (wartość → promień, skalowane do `maxValue`). */
|
|
423
|
+
function radarPoints(values, cx, cy, radius, maxValue) {
|
|
424
|
+
const count = values.length;
|
|
425
|
+
const step = (Math.PI * 2) / Math.max(1, count);
|
|
426
|
+
const max = maxValue || 1;
|
|
427
|
+
return values.map((v, i) => polarToCartesian(cx, cy, (Math.max(0, v) / max) * radius, i * step));
|
|
428
|
+
}
|
|
429
|
+
/** Zamknięta ścieżka wielokąta łącząca punkty. */
|
|
430
|
+
function polygonPath(points) {
|
|
431
|
+
if (points.length === 0)
|
|
432
|
+
return '';
|
|
433
|
+
const nf = (v) => (Number.isInteger(v) ? String(v) : v.toFixed(3));
|
|
434
|
+
return points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${nf(p.x)} ${nf(p.y)}`).join(' ') + ' Z';
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** Obszar rysowania po odjęciu marginesów od pełnego viewBoxa. */
|
|
438
|
+
function plotArea(width, height, insets) {
|
|
439
|
+
return {
|
|
440
|
+
x: insets.left,
|
|
441
|
+
y: insets.top,
|
|
442
|
+
width: Math.max(0, width - insets.left - insets.right),
|
|
443
|
+
height: Math.max(0, height - insets.top - insets.bottom),
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
/** Środek i promień dla wykresów promieniowych (pie/doughnut/polar/radar). */
|
|
447
|
+
function radialArea(width, height, padding) {
|
|
448
|
+
const cx = width / 2;
|
|
449
|
+
const cy = height / 2;
|
|
450
|
+
const radius = Math.max(0, Math.min(width, height) / 2 - padding);
|
|
451
|
+
return { cx, cy, radius };
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/*
|
|
455
|
+
* Domyślna paleta kolorów wykresów — oparta o semantyczne tokeny Koncept UI.
|
|
456
|
+
* Rozszerzona o dodatkowe odcienie skali, by obsłużyć wiele serii/wycinków.
|
|
457
|
+
*/
|
|
458
|
+
/** Kolejność kolorów dla kolejnych serii / wycinków. */
|
|
459
|
+
const KPT_CHART_PALETTE = [
|
|
460
|
+
'var(--kpt-color-primary)',
|
|
461
|
+
'var(--kpt-color-info)',
|
|
462
|
+
'var(--kpt-color-success)',
|
|
463
|
+
'var(--kpt-color-warning)',
|
|
464
|
+
'var(--kpt-color-danger)',
|
|
465
|
+
'var(--kpt-color-blue-700)',
|
|
466
|
+
'var(--kpt-color-green-700)',
|
|
467
|
+
'var(--kpt-color-amber-700)',
|
|
468
|
+
'var(--kpt-color-red-700)',
|
|
469
|
+
'var(--kpt-color-neutral-500)',
|
|
470
|
+
];
|
|
471
|
+
/** Kolor serii/wycinka: jawny z danych albo z palety (cyklicznie). */
|
|
472
|
+
function seriesColor(explicit, index, palette = KPT_CHART_PALETTE) {
|
|
473
|
+
return explicit ?? palette[index % palette.length];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/*
|
|
477
|
+
* Lekki formatter liczb dla etykiet osi i tooltipów.
|
|
478
|
+
* Framework-free; korzysta z wbudowanego Intl (dostępny w przeglądarce i Node).
|
|
479
|
+
*/
|
|
480
|
+
/** Formatuje liczbę zwięźle (do 2 miejsc, bez zer końcowych). */
|
|
481
|
+
function formatNumber(value, locale) {
|
|
482
|
+
if (!Number.isFinite(value))
|
|
483
|
+
return '';
|
|
484
|
+
return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(value);
|
|
485
|
+
}
|
|
486
|
+
/** Zaokrągla do skończonej liczby miejsc (do etykiet osi). */
|
|
487
|
+
function round(value, digits = 0) {
|
|
488
|
+
const f = 10 ** digits;
|
|
489
|
+
return Math.round(value * f) / f;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
const _forTrack0$1 = ($index, $item) => $item.key;
|
|
493
|
+
function KptChartLegend_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
494
|
+
i0.ɵɵdomElementStart(0, "div", 1);
|
|
495
|
+
i0.ɵɵtext(1);
|
|
496
|
+
i0.ɵɵdomElementEnd();
|
|
497
|
+
} if (rf & 2) {
|
|
498
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
499
|
+
i0.ɵɵattribute("data-align", ctx_r0.title()?.position ?? "start");
|
|
500
|
+
i0.ɵɵadvance();
|
|
501
|
+
i0.ɵɵtextInterpolate(ctx_r0.title()?.text);
|
|
502
|
+
} }
|
|
503
|
+
function KptChartLegend_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
504
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
505
|
+
i0.ɵɵdomElementStart(0, "li")(1, "button", 3);
|
|
506
|
+
i0.ɵɵdomListener("click", function KptChartLegend_For_4_Template_button_click_1_listener() { const item_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.toggle.emit(item_r3.key)); })("pointerenter", function KptChartLegend_For_4_Template_button_pointerenter_1_listener() { const item_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.highlight.emit(item_r3.key)); })("pointerleave", function KptChartLegend_For_4_Template_button_pointerleave_1_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.highlight.emit(null)); });
|
|
507
|
+
i0.ɵɵdomElement(2, "span", 4);
|
|
508
|
+
i0.ɵɵdomElementStart(3, "span", 5);
|
|
509
|
+
i0.ɵɵtext(4);
|
|
510
|
+
i0.ɵɵdomElementEnd()()();
|
|
511
|
+
} if (rf & 2) {
|
|
512
|
+
const item_r3 = ctx.$implicit;
|
|
513
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
514
|
+
i0.ɵɵadvance();
|
|
515
|
+
i0.ɵɵclassProp("kpt-chart__legend-item--hidden", item_r3.hidden);
|
|
516
|
+
i0.ɵɵadvance();
|
|
517
|
+
i0.ɵɵstyleProp("--%NS%kpt-chart-legend-color", item_r3.color);
|
|
518
|
+
i0.ɵɵattribute("data-style", ctx_r0.pointStyle());
|
|
519
|
+
i0.ɵɵadvance(2);
|
|
520
|
+
i0.ɵɵtextInterpolate(item_r3.name);
|
|
521
|
+
} }
|
|
522
|
+
/**
|
|
523
|
+
* Legenda wykresu — klikalne elementy (toggle serii), podświetlanie na hover,
|
|
524
|
+
* pozycjonowanie, wyrównanie, styl punktu i opcjonalny tytuł.
|
|
525
|
+
* Element wewnętrzny biblioteki — nie jest częścią publicznego API.
|
|
526
|
+
*/
|
|
527
|
+
class KptChartLegend {
|
|
528
|
+
constructor() {
|
|
529
|
+
this.items = input([], /* @ts-ignore */
|
|
530
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
531
|
+
this.position = input('bottom', /* @ts-ignore */
|
|
532
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
533
|
+
this.align = input('center', /* @ts-ignore */
|
|
534
|
+
...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
535
|
+
this.pointStyle = input('circle', /* @ts-ignore */
|
|
536
|
+
...(ngDevMode ? [{ debugName: "pointStyle" }] : /* istanbul ignore next */ []));
|
|
537
|
+
this.title = input(undefined, /* @ts-ignore */
|
|
538
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
539
|
+
/** Kliknięcie elementu — przełącz widoczność serii/wycinka (klucz). */
|
|
540
|
+
this.toggle = output();
|
|
541
|
+
/** Wejście/wyjście kursora — podświetl serię (klucz) lub wyczyść (null). */
|
|
542
|
+
this.highlight = output();
|
|
543
|
+
}
|
|
544
|
+
static { this.ɵfac = function KptChartLegend_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || KptChartLegend)(); }; }
|
|
545
|
+
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: KptChartLegend, selectors: [["kpt-chart-legend"]], hostAttrs: [1, "kpt-chart-legend-host"], inputs: { items: [1, "items"], position: [1, "position"], align: [1, "align"], pointStyle: [1, "pointStyle"], title: [1, "title"] }, outputs: { toggle: "toggle", highlight: "highlight" }, decls: 5, vars: 3, consts: [[1, "kpt-chart__legend"], [1, "kpt-chart__legend-title"], [1, "kpt-chart__legend-list"], ["type", "button", 1, "kpt-chart__legend-item", 3, "click", "pointerenter", "pointerleave"], [1, "kpt-chart__legend-marker"], [1, "kpt-chart__legend-label"]], template: function KptChartLegend_Template(rf, ctx) { if (rf & 1) {
|
|
546
|
+
i0.ɵɵdomElementStart(0, "div", 0);
|
|
547
|
+
i0.ɵɵconditionalCreate(1, KptChartLegend_Conditional_1_Template, 2, 2, "div", 1);
|
|
548
|
+
i0.ɵɵdomElementStart(2, "ul", 2);
|
|
549
|
+
i0.ɵɵrepeaterCreate(3, KptChartLegend_For_4_Template, 5, 6, "li", null, _forTrack0$1);
|
|
550
|
+
i0.ɵɵdomElementEnd()();
|
|
551
|
+
} if (rf & 2) {
|
|
552
|
+
i0.ɵɵattribute("data-position", ctx.position())("data-align", ctx.align());
|
|
553
|
+
i0.ɵɵadvance();
|
|
554
|
+
i0.ɵɵconditional(ctx.title()?.display && ctx.title()?.text ? 1 : -1);
|
|
555
|
+
i0.ɵɵadvance(2);
|
|
556
|
+
i0.ɵɵrepeater(ctx.items());
|
|
557
|
+
} }, encapsulation: 2 }); }
|
|
558
|
+
}
|
|
559
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(KptChartLegend, [{
|
|
560
|
+
type: Component,
|
|
561
|
+
args: [{
|
|
562
|
+
selector: 'kpt-chart-legend',
|
|
563
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
564
|
+
encapsulation: ViewEncapsulation.None,
|
|
565
|
+
template: `
|
|
566
|
+
<div class="kpt-chart__legend" [attr.data-position]="position()" [attr.data-align]="align()">
|
|
567
|
+
@if (title()?.display && title()?.text) {
|
|
568
|
+
<div class="kpt-chart__legend-title" [attr.data-align]="title()?.position ?? 'start'">{{ title()?.text }}</div>
|
|
569
|
+
}
|
|
570
|
+
<ul class="kpt-chart__legend-list">
|
|
571
|
+
@for (item of items(); track item.key) {
|
|
572
|
+
<li>
|
|
573
|
+
<button
|
|
574
|
+
type="button"
|
|
575
|
+
class="kpt-chart__legend-item"
|
|
576
|
+
[class.kpt-chart__legend-item--hidden]="item.hidden"
|
|
577
|
+
(click)="toggle.emit(item.key)"
|
|
578
|
+
(pointerenter)="highlight.emit(item.key)"
|
|
579
|
+
(pointerleave)="highlight.emit(null)"
|
|
580
|
+
>
|
|
581
|
+
<span class="kpt-chart__legend-marker" [attr.data-style]="pointStyle()" [style.--kpt-chart-legend-color]="item.color"></span>
|
|
582
|
+
<span class="kpt-chart__legend-label">{{ item.name }}</span>
|
|
583
|
+
</button>
|
|
584
|
+
</li>
|
|
585
|
+
}
|
|
586
|
+
</ul>
|
|
587
|
+
</div>
|
|
588
|
+
`,
|
|
589
|
+
host: { class: 'kpt-chart-legend-host' },
|
|
590
|
+
}]
|
|
591
|
+
}], null, { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], pointStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "pointStyle", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], toggle: [{ type: i0.Output, args: ["toggle"] }], highlight: [{ type: i0.Output, args: ["highlight"] }] }); })();
|
|
592
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(KptChartLegend, { className: "KptChartLegend", filePath: "lib/chart-legend.component.ts", lineNumber: 46 }); })();
|
|
593
|
+
|
|
594
|
+
function KptChartTooltip_Conditional_0_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
595
|
+
i0.ɵɵdomElementStart(0, "div", 2);
|
|
596
|
+
i0.ɵɵtext(1);
|
|
597
|
+
i0.ɵɵdomElementEnd();
|
|
598
|
+
} if (rf & 2) {
|
|
599
|
+
const t_r1 = i0.ɵɵnextContext();
|
|
600
|
+
i0.ɵɵadvance();
|
|
601
|
+
i0.ɵɵtextInterpolate(t_r1.label);
|
|
602
|
+
} }
|
|
603
|
+
function KptChartTooltip_Conditional_0_For_3_Template(rf, ctx) { if (rf & 1) {
|
|
604
|
+
i0.ɵɵdomElementStart(0, "div", 3);
|
|
605
|
+
i0.ɵɵdomElement(1, "span", 4);
|
|
606
|
+
i0.ɵɵdomElementStart(2, "span", 5);
|
|
607
|
+
i0.ɵɵtext(3);
|
|
608
|
+
i0.ɵɵdomElementEnd();
|
|
609
|
+
i0.ɵɵdomElementStart(4, "span", 6);
|
|
610
|
+
i0.ɵɵtext(5);
|
|
611
|
+
i0.ɵɵdomElementEnd()();
|
|
612
|
+
} if (rf & 2) {
|
|
613
|
+
const row_r2 = ctx.$implicit;
|
|
614
|
+
i0.ɵɵadvance();
|
|
615
|
+
i0.ɵɵstyleProp("background", row_r2.color);
|
|
616
|
+
i0.ɵɵadvance(2);
|
|
617
|
+
i0.ɵɵtextInterpolate(row_r2.name);
|
|
618
|
+
i0.ɵɵadvance(2);
|
|
619
|
+
i0.ɵɵtextInterpolate(row_r2.value);
|
|
620
|
+
} }
|
|
621
|
+
function KptChartTooltip_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
622
|
+
i0.ɵɵdomElementStart(0, "div", 1);
|
|
623
|
+
i0.ɵɵconditionalCreate(1, KptChartTooltip_Conditional_0_Conditional_1_Template, 2, 1, "div", 2);
|
|
624
|
+
i0.ɵɵrepeaterCreate(2, KptChartTooltip_Conditional_0_For_3_Template, 6, 4, "div", 3, i0.ɵɵrepeaterTrackByIndex);
|
|
625
|
+
i0.ɵɵdomElementEnd();
|
|
626
|
+
} if (rf & 2) {
|
|
627
|
+
const t_r1 = ctx;
|
|
628
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
629
|
+
i0.ɵɵstyleProp("left", ctx_r2.clampX(), "%")("top", t_r1.y, "%");
|
|
630
|
+
i0.ɵɵclassProp("kpt-chart__tooltip--flip", t_r1.y < 22);
|
|
631
|
+
i0.ɵɵadvance();
|
|
632
|
+
i0.ɵɵconditional(t_r1.label ? 1 : -1);
|
|
633
|
+
i0.ɵɵadvance();
|
|
634
|
+
i0.ɵɵrepeater(t_r1.rows);
|
|
635
|
+
} }
|
|
636
|
+
/**
|
|
637
|
+
* Dymek (tooltip) wykresu — pozycjonowany procentowo względem kontenera
|
|
638
|
+
* (niezależnie od skali SVG). Zabezpieczony przed wyjściem poza krawędzie.
|
|
639
|
+
* Element wewnętrzny biblioteki — nie jest częścią publicznego API.
|
|
640
|
+
*/
|
|
641
|
+
class KptChartTooltip {
|
|
642
|
+
constructor() {
|
|
643
|
+
this.state = input(null, /* @ts-ignore */
|
|
644
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
645
|
+
// Utrzymuje dymek w granicach kontenera (margines 6%).
|
|
646
|
+
this.clampX = computed(() => {
|
|
647
|
+
const t = this.state();
|
|
648
|
+
if (!t)
|
|
649
|
+
return 50;
|
|
650
|
+
return Math.min(94, Math.max(6, t.x));
|
|
651
|
+
}, /* @ts-ignore */
|
|
652
|
+
...(ngDevMode ? [{ debugName: "clampX" }] : /* istanbul ignore next */ []));
|
|
653
|
+
}
|
|
654
|
+
static { this.ɵfac = function KptChartTooltip_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || KptChartTooltip)(); }; }
|
|
655
|
+
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: KptChartTooltip, selectors: [["kpt-chart-tooltip"]], hostAttrs: [1, "kpt-chart-tooltip-host"], inputs: { state: [1, "state"] }, decls: 1, vars: 1, consts: [["role", "tooltip", 1, "kpt-chart__tooltip", 3, "kpt-chart__tooltip--flip", "left", "top"], ["role", "tooltip", 1, "kpt-chart__tooltip"], [1, "kpt-chart__tooltip-title"], [1, "kpt-chart__tooltip-row"], [1, "kpt-chart__tooltip-dot"], [1, "kpt-chart__tooltip-name"], [1, "kpt-chart__tooltip-val"]], template: function KptChartTooltip_Template(rf, ctx) { if (rf & 1) {
|
|
656
|
+
i0.ɵɵconditionalCreate(0, KptChartTooltip_Conditional_0_Template, 4, 7, "div", 0);
|
|
657
|
+
} if (rf & 2) {
|
|
658
|
+
let tmp_0_0;
|
|
659
|
+
i0.ɵɵconditional((tmp_0_0 = ctx.state()) ? 0 : -1, tmp_0_0);
|
|
660
|
+
} }, encapsulation: 2 }); }
|
|
661
|
+
}
|
|
662
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(KptChartTooltip, [{
|
|
663
|
+
type: Component,
|
|
664
|
+
args: [{
|
|
665
|
+
selector: 'kpt-chart-tooltip',
|
|
666
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
667
|
+
encapsulation: ViewEncapsulation.None,
|
|
668
|
+
template: `
|
|
669
|
+
@if (state(); as t) {
|
|
670
|
+
<div class="kpt-chart__tooltip" [class.kpt-chart__tooltip--flip]="t.y < 22" [style.left.%]="clampX()" [style.top.%]="t.y" role="tooltip">
|
|
671
|
+
@if (t.label) {
|
|
672
|
+
<div class="kpt-chart__tooltip-title">{{ t.label }}</div>
|
|
673
|
+
}
|
|
674
|
+
@for (row of t.rows; track $index) {
|
|
675
|
+
<div class="kpt-chart__tooltip-row">
|
|
676
|
+
<span class="kpt-chart__tooltip-dot" [style.background]="row.color"></span>
|
|
677
|
+
<span class="kpt-chart__tooltip-name">{{ row.name }}</span>
|
|
678
|
+
<span class="kpt-chart__tooltip-val">{{ row.value }}</span>
|
|
679
|
+
</div>
|
|
680
|
+
}
|
|
681
|
+
</div>
|
|
682
|
+
}
|
|
683
|
+
`,
|
|
684
|
+
host: { class: 'kpt-chart-tooltip-host' },
|
|
685
|
+
}]
|
|
686
|
+
}], null, { state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }] }); })();
|
|
687
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(KptChartTooltip, { className: "KptChartTooltip", filePath: "lib/chart-tooltip.component.ts", lineNumber: 45 }); })();
|
|
688
|
+
|
|
689
|
+
const _forTrack0 = ($index, $item) => $item.key;
|
|
690
|
+
const _forTrack1 = ($index, $item) => $item.key + "#" + $item.index;
|
|
691
|
+
function KptChart_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
692
|
+
i0.ɵɵelementStart(0, "div", 8);
|
|
693
|
+
i0.ɵɵtext(1);
|
|
694
|
+
i0.ɵɵelementEnd();
|
|
695
|
+
} if (rf & 2) {
|
|
696
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
697
|
+
i0.ɵɵstyleProp("text-align", ctx_r0.titleStyle())("color", ctx_r0.titleOpts()?.color)("font-family", ctx_r0.titleOpts()?.font?.family)("font-size", ctx_r0.titleOpts()?.font?.size, "px")("font-weight", ctx_r0.titleOpts()?.font?.weight)("padding-top", ctx_r0.titleOpts()?.padding?.top, "px")("padding-bottom", ctx_r0.titleOpts()?.padding?.bottom, "px");
|
|
698
|
+
i0.ɵɵadvance();
|
|
699
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.titleOpts()?.text, " ");
|
|
700
|
+
} }
|
|
701
|
+
function KptChart_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
702
|
+
i0.ɵɵelementStart(0, "div", 9);
|
|
703
|
+
i0.ɵɵtext(1);
|
|
704
|
+
i0.ɵɵelementEnd();
|
|
705
|
+
} if (rf & 2) {
|
|
706
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
707
|
+
i0.ɵɵstyleProp("text-align", ctx_r0.subtitleStyle())("color", ctx_r0.subtitleOpts()?.color)("font-family", ctx_r0.subtitleOpts()?.font?.family)("font-size", ctx_r0.subtitleOpts()?.font?.size, "px")("font-weight", ctx_r0.subtitleOpts()?.font?.weight)("padding-top", ctx_r0.subtitleOpts()?.padding?.top, "px")("padding-bottom", ctx_r0.subtitleOpts()?.padding?.bottom, "px");
|
|
708
|
+
i0.ɵɵadvance();
|
|
709
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.subtitleOpts()?.text, " ");
|
|
710
|
+
} }
|
|
711
|
+
function KptChart_Case_6_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
712
|
+
i0.ɵɵnamespaceSVG();
|
|
713
|
+
i0.ɵɵelement(0, "line", 11);
|
|
714
|
+
} if (rf & 2) {
|
|
715
|
+
const g_r2 = ctx.$implicit;
|
|
716
|
+
i0.ɵɵattribute("x1", g_r2.x1)("y1", g_r2.y1)("x2", g_r2.x2)("y2", g_r2.y2);
|
|
717
|
+
} }
|
|
718
|
+
function KptChart_Case_6_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
719
|
+
i0.ɵɵnamespaceSVG();
|
|
720
|
+
i0.ɵɵelement(0, "line", 12);
|
|
721
|
+
} if (rf & 2) {
|
|
722
|
+
const ch_r3 = ctx;
|
|
723
|
+
i0.ɵɵattribute("x1", ch_r3.x)("y1", ch_r3.y1)("x2", ch_r3.x)("y2", ch_r3.y2);
|
|
724
|
+
} }
|
|
725
|
+
function KptChart_Case_6_Conditional_0_For_6_Template(rf, ctx) { if (rf & 1) {
|
|
726
|
+
i0.ɵɵnamespaceSVG();
|
|
727
|
+
i0.ɵɵelementStart(0, "text");
|
|
728
|
+
i0.ɵɵtext(1);
|
|
729
|
+
i0.ɵɵelementEnd();
|
|
730
|
+
} if (rf & 2) {
|
|
731
|
+
const l_r4 = ctx.$implicit;
|
|
732
|
+
i0.ɵɵattribute("x", l_r4.x)("y", l_r4.y)("text-anchor", l_r4.anchor);
|
|
733
|
+
i0.ɵɵadvance();
|
|
734
|
+
i0.ɵɵtextInterpolate(l_r4.text);
|
|
735
|
+
} }
|
|
736
|
+
function KptChart_Case_6_Conditional_0_For_8_Template(rf, ctx) { if (rf & 1) {
|
|
737
|
+
i0.ɵɵnamespaceSVG();
|
|
738
|
+
i0.ɵɵelementStart(0, "text");
|
|
739
|
+
i0.ɵɵtext(1);
|
|
740
|
+
i0.ɵɵelementEnd();
|
|
741
|
+
} if (rf & 2) {
|
|
742
|
+
const l_r5 = ctx.$implicit;
|
|
743
|
+
i0.ɵɵattribute("x", l_r5.x)("y", l_r5.y)("text-anchor", l_r5.anchor);
|
|
744
|
+
i0.ɵɵadvance();
|
|
745
|
+
i0.ɵɵtextInterpolate(l_r5.text);
|
|
746
|
+
} }
|
|
747
|
+
function KptChart_Case_6_Conditional_0_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
748
|
+
i0.ɵɵnamespaceSVG();
|
|
749
|
+
i0.ɵɵelementStart(0, "g", 14);
|
|
750
|
+
i0.ɵɵelement(1, "rect");
|
|
751
|
+
i0.ɵɵelementStart(2, "text", 16);
|
|
752
|
+
i0.ɵɵtext(3);
|
|
753
|
+
i0.ɵɵelementEnd()();
|
|
754
|
+
} if (rf & 2) {
|
|
755
|
+
const ch_r6 = ctx;
|
|
756
|
+
i0.ɵɵadvance();
|
|
757
|
+
i0.ɵɵattribute("x", ch_r6.pillX)("y", ch_r6.pillY)("width", ch_r6.pillW)("height", ch_r6.pillH)("rx", ch_r6.pillH / 2);
|
|
758
|
+
i0.ɵɵadvance();
|
|
759
|
+
i0.ɵɵattribute("x", ch_r6.labelX)("y", ch_r6.labelY);
|
|
760
|
+
i0.ɵɵadvance();
|
|
761
|
+
i0.ɵɵtextInterpolate(ch_r6.text);
|
|
762
|
+
} }
|
|
763
|
+
function KptChart_Case_6_Conditional_0_For_11_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
764
|
+
i0.ɵɵnamespaceSVG();
|
|
765
|
+
i0.ɵɵelement(0, "path", 20);
|
|
766
|
+
} if (rf & 2) {
|
|
767
|
+
const s_r7 = i0.ɵɵnextContext().$implicit;
|
|
768
|
+
i0.ɵɵstyleProp("fill", s_r7.color);
|
|
769
|
+
i0.ɵɵattribute("d", s_r7.area);
|
|
770
|
+
} }
|
|
771
|
+
function KptChart_Case_6_Conditional_0_For_11_For_4_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
772
|
+
i0.ɵɵnamespaceSVG();
|
|
773
|
+
i0.ɵɵelement(0, "circle", 23);
|
|
774
|
+
} if (rf & 2) {
|
|
775
|
+
const ctx_r8 = i0.ɵɵnextContext();
|
|
776
|
+
const p_r10 = ctx_r8.$implicit;
|
|
777
|
+
const $index_r11 = ctx_r8.$index;
|
|
778
|
+
const s_r7 = i0.ɵɵnextContext().$implicit;
|
|
779
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
780
|
+
i0.ɵɵstyleProp("fill", s_r7.color)("--%NS%kpt-chart-i", $index_r11);
|
|
781
|
+
i0.ɵɵclassProp("kpt-chart__point--active", ctx_r0.activeIndex() === $index_r11);
|
|
782
|
+
i0.ɵɵattribute("cx", p_r10.x)("cy", p_r10.y);
|
|
783
|
+
} }
|
|
784
|
+
function KptChart_Case_6_Conditional_0_For_11_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
785
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
786
|
+
i0.ɵɵconditionalCreate(0, KptChart_Case_6_Conditional_0_For_11_For_4_Conditional_0_Template, 1, 8, ":svg:circle", 21);
|
|
787
|
+
i0.ɵɵnamespaceSVG();
|
|
788
|
+
i0.ɵɵelementStart(1, "circle", 22);
|
|
789
|
+
i0.ɵɵlistener("pointerenter", function KptChart_Case_6_Conditional_0_For_11_For_4_Template_circle_pointerenter_1_listener() { const ctx_r11 = i0.ɵɵrestoreView(_r8); const p_r10 = ctx_r11.$implicit; const $index_r11 = ctx_r11.$index; const s_r7 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.onLineEnter($index_r11, p_r10.x, p_r10.y, s_r7.name, p_r10.label, p_r10.value, s_r7.color)); })("pointerleave", function KptChart_Case_6_Conditional_0_For_11_For_4_Template_circle_pointerleave_1_listener() { i0.ɵɵrestoreView(_r8); const ctx_r0 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r0.onLineLeave()); });
|
|
790
|
+
i0.ɵɵelementEnd();
|
|
791
|
+
} if (rf & 2) {
|
|
792
|
+
const p_r10 = ctx.$implicit;
|
|
793
|
+
const vm_r13 = i0.ɵɵnextContext(2);
|
|
794
|
+
i0.ɵɵconditional(vm_r13.showPoints ? 0 : -1);
|
|
795
|
+
i0.ɵɵadvance();
|
|
796
|
+
i0.ɵɵattribute("cx", p_r10.x)("cy", p_r10.y);
|
|
797
|
+
} }
|
|
798
|
+
function KptChart_Case_6_Conditional_0_For_11_Template(rf, ctx) { if (rf & 1) {
|
|
799
|
+
i0.ɵɵnamespaceSVG();
|
|
800
|
+
i0.ɵɵelementStart(0, "g", 17);
|
|
801
|
+
i0.ɵɵconditionalCreate(1, KptChart_Case_6_Conditional_0_For_11_Conditional_1_Template, 1, 3, ":svg:path", 18);
|
|
802
|
+
i0.ɵɵelement(2, "path", 19);
|
|
803
|
+
i0.ɵɵrepeaterCreate(3, KptChart_Case_6_Conditional_0_For_11_For_4_Template, 2, 3, null, null, i0.ɵɵrepeaterTrackByIndex);
|
|
804
|
+
i0.ɵɵelementEnd();
|
|
805
|
+
} if (rf & 2) {
|
|
806
|
+
const s_r7 = ctx.$implicit;
|
|
807
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
808
|
+
i0.ɵɵclassProp("kpt-chart__series--dim", ctx_r0.dim(s_r7.key));
|
|
809
|
+
i0.ɵɵadvance();
|
|
810
|
+
i0.ɵɵconditional(s_r7.area ? 1 : -1);
|
|
811
|
+
i0.ɵɵadvance();
|
|
812
|
+
i0.ɵɵstyleProp("stroke", s_r7.color);
|
|
813
|
+
i0.ɵɵattribute("d", s_r7.path);
|
|
814
|
+
i0.ɵɵadvance();
|
|
815
|
+
i0.ɵɵrepeater(s_r7.points);
|
|
816
|
+
} }
|
|
817
|
+
function KptChart_Case_6_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
818
|
+
i0.ɵɵnamespaceSVG();
|
|
819
|
+
i0.ɵɵelementStart(0, "g", 10);
|
|
820
|
+
i0.ɵɵrepeaterCreate(1, KptChart_Case_6_Conditional_0_For_2_Template, 1, 4, ":svg:line", 11, i0.ɵɵrepeaterTrackByIndex);
|
|
821
|
+
i0.ɵɵelementEnd();
|
|
822
|
+
i0.ɵɵconditionalCreate(3, KptChart_Case_6_Conditional_0_Conditional_3_Template, 1, 4, ":svg:line", 12);
|
|
823
|
+
i0.ɵɵelementStart(4, "g", 13);
|
|
824
|
+
i0.ɵɵrepeaterCreate(5, KptChart_Case_6_Conditional_0_For_6_Template, 2, 4, ":svg:text", null, i0.ɵɵrepeaterTrackByIndex);
|
|
825
|
+
i0.ɵɵrepeaterCreate(7, KptChart_Case_6_Conditional_0_For_8_Template, 2, 4, ":svg:text", null, i0.ɵɵrepeaterTrackByIndex);
|
|
826
|
+
i0.ɵɵelementEnd();
|
|
827
|
+
i0.ɵɵconditionalCreate(9, KptChart_Case_6_Conditional_0_Conditional_9_Template, 4, 8, ":svg:g", 14);
|
|
828
|
+
i0.ɵɵrepeaterCreate(10, KptChart_Case_6_Conditional_0_For_11_Template, 5, 6, ":svg:g", 15, _forTrack0);
|
|
829
|
+
} if (rf & 2) {
|
|
830
|
+
let tmp_4_0;
|
|
831
|
+
let tmp_7_0;
|
|
832
|
+
const vm_r13 = ctx;
|
|
833
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
834
|
+
i0.ɵɵadvance();
|
|
835
|
+
i0.ɵɵrepeater(vm_r13.grid);
|
|
836
|
+
i0.ɵɵadvance(2);
|
|
837
|
+
i0.ɵɵconditional((tmp_4_0 = ctx_r0.crosshair()) ? 3 : -1, tmp_4_0);
|
|
838
|
+
i0.ɵɵadvance(2);
|
|
839
|
+
i0.ɵɵrepeater(vm_r13.valueLabels);
|
|
840
|
+
i0.ɵɵadvance(2);
|
|
841
|
+
i0.ɵɵrepeater(vm_r13.catLabels);
|
|
842
|
+
i0.ɵɵadvance(2);
|
|
843
|
+
i0.ɵɵconditional((tmp_7_0 = ctx_r0.crosshair()) ? 9 : -1, tmp_7_0);
|
|
844
|
+
i0.ɵɵadvance();
|
|
845
|
+
i0.ɵɵrepeater(vm_r13.series);
|
|
846
|
+
} }
|
|
847
|
+
function KptChart_Case_6_Template(rf, ctx) { if (rf & 1) {
|
|
848
|
+
i0.ɵɵconditionalCreate(0, KptChart_Case_6_Conditional_0_Template, 12, 2);
|
|
849
|
+
} if (rf & 2) {
|
|
850
|
+
let tmp_1_0;
|
|
851
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
852
|
+
i0.ɵɵconditional((tmp_1_0 = ctx_r0.lineVm()) ? 0 : -1, tmp_1_0);
|
|
853
|
+
} }
|
|
854
|
+
function KptChart_Case_7_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
855
|
+
i0.ɵɵnamespaceSVG();
|
|
856
|
+
i0.ɵɵelement(0, "line", 11);
|
|
857
|
+
} if (rf & 2) {
|
|
858
|
+
const g_r14 = ctx.$implicit;
|
|
859
|
+
i0.ɵɵattribute("x1", g_r14.x1)("y1", g_r14.y1)("x2", g_r14.x2)("y2", g_r14.y2);
|
|
860
|
+
} }
|
|
861
|
+
function KptChart_Case_7_Conditional_0_For_5_Template(rf, ctx) { if (rf & 1) {
|
|
862
|
+
i0.ɵɵnamespaceSVG();
|
|
863
|
+
i0.ɵɵelementStart(0, "text");
|
|
864
|
+
i0.ɵɵtext(1);
|
|
865
|
+
i0.ɵɵelementEnd();
|
|
866
|
+
} if (rf & 2) {
|
|
867
|
+
const l_r15 = ctx.$implicit;
|
|
868
|
+
i0.ɵɵattribute("x", l_r15.x)("y", l_r15.y)("text-anchor", l_r15.anchor);
|
|
869
|
+
i0.ɵɵadvance();
|
|
870
|
+
i0.ɵɵtextInterpolate(l_r15.text);
|
|
871
|
+
} }
|
|
872
|
+
function KptChart_Case_7_Conditional_0_For_7_Template(rf, ctx) { if (rf & 1) {
|
|
873
|
+
i0.ɵɵnamespaceSVG();
|
|
874
|
+
i0.ɵɵelementStart(0, "text");
|
|
875
|
+
i0.ɵɵtext(1);
|
|
876
|
+
i0.ɵɵelementEnd();
|
|
877
|
+
} if (rf & 2) {
|
|
878
|
+
const l_r16 = ctx.$implicit;
|
|
879
|
+
i0.ɵɵattribute("x", l_r16.x)("y", l_r16.y)("text-anchor", l_r16.anchor);
|
|
880
|
+
i0.ɵɵadvance();
|
|
881
|
+
i0.ɵɵtextInterpolate(l_r16.text);
|
|
882
|
+
} }
|
|
883
|
+
function KptChart_Case_7_Conditional_0_For_10_Template(rf, ctx) { if (rf & 1) {
|
|
884
|
+
const _r17 = i0.ɵɵgetCurrentView();
|
|
885
|
+
i0.ɵɵnamespaceSVG();
|
|
886
|
+
i0.ɵɵelementStart(0, "path", 26);
|
|
887
|
+
i0.ɵɵlistener("pointerenter", function KptChart_Case_7_Conditional_0_For_10_Template_path_pointerenter_0_listener() { const b_r18 = i0.ɵɵrestoreView(_r17).$implicit; const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.showTip(b_r18.tipX, b_r18.tipY, b_r18.name, b_r18.label, b_r18.value, b_r18.color)); })("pointerleave", function KptChart_Case_7_Conditional_0_For_10_Template_path_pointerleave_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.hideTip()); });
|
|
888
|
+
i0.ɵɵelementEnd();
|
|
889
|
+
} if (rf & 2) {
|
|
890
|
+
const b_r18 = ctx.$implicit;
|
|
891
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
892
|
+
i0.ɵɵstyleProp("fill", b_r18.color)("--%NS%kpt-chart-i", b_r18.index);
|
|
893
|
+
i0.ɵɵclassProp("kpt-chart__series--dim", ctx_r0.dim(b_r18.key));
|
|
894
|
+
i0.ɵɵattribute("d", b_r18.path);
|
|
895
|
+
} }
|
|
896
|
+
function KptChart_Case_7_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
897
|
+
i0.ɵɵnamespaceSVG();
|
|
898
|
+
i0.ɵɵelementStart(0, "g", 10);
|
|
899
|
+
i0.ɵɵrepeaterCreate(1, KptChart_Case_7_Conditional_0_For_2_Template, 1, 4, ":svg:line", 11, i0.ɵɵrepeaterTrackByIndex);
|
|
900
|
+
i0.ɵɵelementEnd();
|
|
901
|
+
i0.ɵɵelementStart(3, "g", 13);
|
|
902
|
+
i0.ɵɵrepeaterCreate(4, KptChart_Case_7_Conditional_0_For_5_Template, 2, 4, ":svg:text", null, i0.ɵɵrepeaterTrackByIndex);
|
|
903
|
+
i0.ɵɵrepeaterCreate(6, KptChart_Case_7_Conditional_0_For_7_Template, 2, 4, ":svg:text", null, i0.ɵɵrepeaterTrackByIndex);
|
|
904
|
+
i0.ɵɵelementEnd();
|
|
905
|
+
i0.ɵɵelementStart(8, "g", 24);
|
|
906
|
+
i0.ɵɵrepeaterCreate(9, KptChart_Case_7_Conditional_0_For_10_Template, 1, 7, ":svg:path", 25, _forTrack1);
|
|
907
|
+
i0.ɵɵelementEnd();
|
|
908
|
+
} if (rf & 2) {
|
|
909
|
+
const vm_r19 = ctx;
|
|
910
|
+
i0.ɵɵadvance();
|
|
911
|
+
i0.ɵɵrepeater(vm_r19.grid);
|
|
912
|
+
i0.ɵɵadvance(3);
|
|
913
|
+
i0.ɵɵrepeater(vm_r19.valueLabels);
|
|
914
|
+
i0.ɵɵadvance(2);
|
|
915
|
+
i0.ɵɵrepeater(vm_r19.catLabels);
|
|
916
|
+
i0.ɵɵadvance(2);
|
|
917
|
+
i0.ɵɵattribute("data-orientation", vm_r19.orientation);
|
|
918
|
+
i0.ɵɵadvance();
|
|
919
|
+
i0.ɵɵrepeater(vm_r19.bars);
|
|
920
|
+
} }
|
|
921
|
+
function KptChart_Case_7_Template(rf, ctx) { if (rf & 1) {
|
|
922
|
+
i0.ɵɵconditionalCreate(0, KptChart_Case_7_Conditional_0_Template, 11, 1);
|
|
923
|
+
} if (rf & 2) {
|
|
924
|
+
let tmp_1_0;
|
|
925
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
926
|
+
i0.ɵɵconditional((tmp_1_0 = ctx_r0.barVm()) ? 0 : -1, tmp_1_0);
|
|
927
|
+
} }
|
|
928
|
+
function KptChart_Case_8_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
929
|
+
i0.ɵɵnamespaceSVG();
|
|
930
|
+
i0.ɵɵelement(0, "path", 27);
|
|
931
|
+
} if (rf & 2) {
|
|
932
|
+
const r_r20 = ctx.$implicit;
|
|
933
|
+
i0.ɵɵattribute("d", r_r20);
|
|
934
|
+
} }
|
|
935
|
+
function KptChart_Case_8_Conditional_0_For_4_Template(rf, ctx) { if (rf & 1) {
|
|
936
|
+
i0.ɵɵnamespaceSVG();
|
|
937
|
+
i0.ɵɵelement(0, "line", 11);
|
|
938
|
+
} if (rf & 2) {
|
|
939
|
+
const a_r21 = ctx.$implicit;
|
|
940
|
+
i0.ɵɵattribute("x1", a_r21.x1)("y1", a_r21.y1)("x2", a_r21.x2)("y2", a_r21.y2);
|
|
941
|
+
} }
|
|
942
|
+
function KptChart_Case_8_Conditional_0_For_7_Template(rf, ctx) { if (rf & 1) {
|
|
943
|
+
i0.ɵɵnamespaceSVG();
|
|
944
|
+
i0.ɵɵelementStart(0, "text");
|
|
945
|
+
i0.ɵɵtext(1);
|
|
946
|
+
i0.ɵɵelementEnd();
|
|
947
|
+
} if (rf & 2) {
|
|
948
|
+
const l_r22 = ctx.$implicit;
|
|
949
|
+
i0.ɵɵattribute("x", l_r22.x)("y", l_r22.y)("text-anchor", l_r22.anchor);
|
|
950
|
+
i0.ɵɵadvance();
|
|
951
|
+
i0.ɵɵtextInterpolate(l_r22.text);
|
|
952
|
+
} }
|
|
953
|
+
function KptChart_Case_8_Conditional_0_For_9_For_3_Template(rf, ctx) { if (rf & 1) {
|
|
954
|
+
const _r23 = i0.ɵɵgetCurrentView();
|
|
955
|
+
i0.ɵɵnamespaceSVG();
|
|
956
|
+
i0.ɵɵelementStart(0, "circle", 32);
|
|
957
|
+
i0.ɵɵlistener("pointerenter", function KptChart_Case_8_Conditional_0_For_9_For_3_Template_circle_pointerenter_0_listener() { const p_r24 = i0.ɵɵrestoreView(_r23).$implicit; const s_r25 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.showTip(p_r24.x, p_r24.y, s_r25.name, p_r24.label, p_r24.value, s_r25.color)); })("pointerleave", function KptChart_Case_8_Conditional_0_For_9_For_3_Template_circle_pointerleave_0_listener() { i0.ɵɵrestoreView(_r23); const ctx_r0 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r0.hideTip()); });
|
|
958
|
+
i0.ɵɵelementEnd();
|
|
959
|
+
} if (rf & 2) {
|
|
960
|
+
const p_r24 = ctx.$implicit;
|
|
961
|
+
const $index_r26 = ctx.$index;
|
|
962
|
+
const s_r25 = i0.ɵɵnextContext().$implicit;
|
|
963
|
+
i0.ɵɵstyleProp("fill", s_r25.color)("--%NS%kpt-chart-i", $index_r26);
|
|
964
|
+
i0.ɵɵattribute("cx", p_r24.x)("cy", p_r24.y);
|
|
965
|
+
} }
|
|
966
|
+
function KptChart_Case_8_Conditional_0_For_9_Template(rf, ctx) { if (rf & 1) {
|
|
967
|
+
i0.ɵɵnamespaceSVG();
|
|
968
|
+
i0.ɵɵelementStart(0, "g", 29);
|
|
969
|
+
i0.ɵɵelement(1, "path", 30);
|
|
970
|
+
i0.ɵɵrepeaterCreate(2, KptChart_Case_8_Conditional_0_For_9_For_3_Template, 1, 6, ":svg:circle", 31, i0.ɵɵrepeaterTrackByIndex);
|
|
971
|
+
i0.ɵɵelementEnd();
|
|
972
|
+
} if (rf & 2) {
|
|
973
|
+
const s_r25 = ctx.$implicit;
|
|
974
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
975
|
+
i0.ɵɵclassProp("kpt-chart__series--dim", ctx_r0.dim(s_r25.key));
|
|
976
|
+
i0.ɵɵadvance();
|
|
977
|
+
i0.ɵɵstyleProp("fill", s_r25.color)("stroke", s_r25.color);
|
|
978
|
+
i0.ɵɵattribute("d", s_r25.polygon);
|
|
979
|
+
i0.ɵɵadvance();
|
|
980
|
+
i0.ɵɵrepeater(s_r25.points);
|
|
981
|
+
} }
|
|
982
|
+
function KptChart_Case_8_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
983
|
+
i0.ɵɵnamespaceSVG();
|
|
984
|
+
i0.ɵɵelementStart(0, "g", 10);
|
|
985
|
+
i0.ɵɵrepeaterCreate(1, KptChart_Case_8_Conditional_0_For_2_Template, 1, 1, ":svg:path", 27, i0.ɵɵrepeaterTrackByIndex);
|
|
986
|
+
i0.ɵɵrepeaterCreate(3, KptChart_Case_8_Conditional_0_For_4_Template, 1, 4, ":svg:line", 11, i0.ɵɵrepeaterTrackByIndex);
|
|
987
|
+
i0.ɵɵelementEnd();
|
|
988
|
+
i0.ɵɵelementStart(5, "g", 13);
|
|
989
|
+
i0.ɵɵrepeaterCreate(6, KptChart_Case_8_Conditional_0_For_7_Template, 2, 4, ":svg:text", null, i0.ɵɵrepeaterTrackByIndex);
|
|
990
|
+
i0.ɵɵelementEnd();
|
|
991
|
+
i0.ɵɵrepeaterCreate(8, KptChart_Case_8_Conditional_0_For_9_Template, 4, 7, ":svg:g", 28, _forTrack0);
|
|
992
|
+
} if (rf & 2) {
|
|
993
|
+
const vm_r27 = ctx;
|
|
994
|
+
i0.ɵɵadvance();
|
|
995
|
+
i0.ɵɵrepeater(vm_r27.rings);
|
|
996
|
+
i0.ɵɵadvance(2);
|
|
997
|
+
i0.ɵɵrepeater(vm_r27.axisLines);
|
|
998
|
+
i0.ɵɵadvance(3);
|
|
999
|
+
i0.ɵɵrepeater(vm_r27.axisLabels);
|
|
1000
|
+
i0.ɵɵadvance(2);
|
|
1001
|
+
i0.ɵɵrepeater(vm_r27.series);
|
|
1002
|
+
} }
|
|
1003
|
+
function KptChart_Case_8_Template(rf, ctx) { if (rf & 1) {
|
|
1004
|
+
i0.ɵɵconditionalCreate(0, KptChart_Case_8_Conditional_0_Template, 10, 0);
|
|
1005
|
+
} if (rf & 2) {
|
|
1006
|
+
let tmp_1_0;
|
|
1007
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1008
|
+
i0.ɵɵconditional((tmp_1_0 = ctx_r0.radarVm()) ? 0 : -1, tmp_1_0);
|
|
1009
|
+
} }
|
|
1010
|
+
function KptChart_Case_9_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
1011
|
+
const _r28 = i0.ɵɵgetCurrentView();
|
|
1012
|
+
i0.ɵɵnamespaceSVG();
|
|
1013
|
+
i0.ɵɵelementStart(0, "path", 35);
|
|
1014
|
+
i0.ɵɵlistener("pointerenter", function KptChart_Case_9_Conditional_0_For_2_Template_path_pointerenter_0_listener() { const sl_r29 = i0.ɵɵrestoreView(_r28).$implicit; const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.showTip(sl_r29.tipX, sl_r29.tipY, sl_r29.label, "", sl_r29.value, sl_r29.color)); })("pointerleave", function KptChart_Case_9_Conditional_0_For_2_Template_path_pointerleave_0_listener() { i0.ɵɵrestoreView(_r28); const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.hideTip()); });
|
|
1015
|
+
i0.ɵɵelementEnd();
|
|
1016
|
+
} if (rf & 2) {
|
|
1017
|
+
const sl_r29 = ctx.$implicit;
|
|
1018
|
+
const $index_r30 = ctx.$index;
|
|
1019
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
1020
|
+
i0.ɵɵstyleProp("fill", sl_r29.color)("--%NS%kpt-chart-i", $index_r30);
|
|
1021
|
+
i0.ɵɵclassProp("kpt-chart__series--dim", ctx_r0.dim(sl_r29.key));
|
|
1022
|
+
i0.ɵɵattribute("d", sl_r29.path);
|
|
1023
|
+
} }
|
|
1024
|
+
function KptChart_Case_9_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
1025
|
+
i0.ɵɵnamespaceSVG();
|
|
1026
|
+
i0.ɵɵelementStart(0, "g", 33);
|
|
1027
|
+
i0.ɵɵrepeaterCreate(1, KptChart_Case_9_Conditional_0_For_2_Template, 1, 7, ":svg:path", 34, _forTrack0);
|
|
1028
|
+
i0.ɵɵelementEnd();
|
|
1029
|
+
} if (rf & 2) {
|
|
1030
|
+
i0.ɵɵadvance();
|
|
1031
|
+
i0.ɵɵrepeater(ctx);
|
|
1032
|
+
} }
|
|
1033
|
+
function KptChart_Case_9_Template(rf, ctx) { if (rf & 1) {
|
|
1034
|
+
i0.ɵɵconditionalCreate(0, KptChart_Case_9_Conditional_0_Template, 3, 0, ":svg:g", 33);
|
|
1035
|
+
} if (rf & 2) {
|
|
1036
|
+
let tmp_1_0;
|
|
1037
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1038
|
+
i0.ɵɵconditional((tmp_1_0 = ctx_r0.pieVm()) ? 0 : -1, tmp_1_0);
|
|
1039
|
+
} }
|
|
1040
|
+
function KptChart_Conditional_11_Template(rf, ctx) { if (rf & 1) {
|
|
1041
|
+
const _r31 = i0.ɵɵgetCurrentView();
|
|
1042
|
+
i0.ɵɵelementStart(0, "kpt-chart-legend", 36);
|
|
1043
|
+
i0.ɵɵlistener("toggle", function KptChart_Conditional_11_Template_kpt_chart_legend_toggle_0_listener($event) { i0.ɵɵrestoreView(_r31); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onToggle($event)); })("highlight", function KptChart_Conditional_11_Template_kpt_chart_legend_highlight_0_listener($event) { i0.ɵɵrestoreView(_r31); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onHighlight($event)); });
|
|
1044
|
+
i0.ɵɵelementEnd();
|
|
1045
|
+
} if (rf & 2) {
|
|
1046
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1047
|
+
i0.ɵɵproperty("items", ctx_r0.legendItems())("position", ctx_r0.legendOpts().position)("align", ctx_r0.legendOpts().align)("pointStyle", ctx_r0.legendOpts().pointStyle)("title", ctx_r0.legendOpts().title);
|
|
1048
|
+
} }
|
|
1049
|
+
const VERTICAL_INSETS = { top: 12, right: 16, bottom: 28, left: 46 };
|
|
1050
|
+
const HORIZONTAL_INSETS = { top: 12, right: 16, bottom: 28, left: 76 };
|
|
1051
|
+
/**
|
|
1052
|
+
* Wykres SVG w pełni konfigurowalny przez obiekt `config`.
|
|
1053
|
+
* Typy: line, bar, pie, doughnut, polarArea, radar. Sygnały + zoneless,
|
|
1054
|
+
* natywne renderowanie SVG (bez manipulacji DOM). Rdzeń obliczeń: `../core`.
|
|
1055
|
+
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* <kpt-chart [config]="{ type: 'line', labels: ['Sty','Lut','Mar'],
|
|
1058
|
+
* series: [{ name: 'Sprzedaż', data: [12, 19, 7] }] }" />
|
|
1059
|
+
*/
|
|
1060
|
+
class KptChart {
|
|
1061
|
+
constructor() {
|
|
1062
|
+
this.config = input.required(/* @ts-ignore */
|
|
1063
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
1064
|
+
/** Szerokość viewBoxa (jednostki SVG). Wykres skaluje się do kontenera. */
|
|
1065
|
+
this.width = input(600, /* @ts-ignore */
|
|
1066
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
1067
|
+
/** Wysokość viewBoxa (jednostki SVG). */
|
|
1068
|
+
this.height = input(360, /* @ts-ignore */
|
|
1069
|
+
...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
1070
|
+
// --- Stan interakcji ---
|
|
1071
|
+
this.hidden = signal(new Set(), /* @ts-ignore */
|
|
1072
|
+
...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
1073
|
+
this.highlighted = signal(null, /* @ts-ignore */
|
|
1074
|
+
...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
1075
|
+
this.tooltip = signal(null, /* @ts-ignore */
|
|
1076
|
+
...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
1077
|
+
/** Indeks kategorii pod kursorem (dla prowadnicy crosshair w wykresie liniowym). */
|
|
1078
|
+
this.activeIndex = signal(null, /* @ts-ignore */
|
|
1079
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
1080
|
+
// --- Znormalizowana konfiguracja ---
|
|
1081
|
+
this.type = computed(() => this.config().type, /* @ts-ignore */
|
|
1082
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1083
|
+
this.anim = computed(() => {
|
|
1084
|
+
const a = this.config().animation ?? {};
|
|
1085
|
+
return { enabled: a.enabled ?? true, duration: a.duration ?? 400, delay: a.delay ?? 0, stagger: a.stagger ?? 60 };
|
|
1086
|
+
}, /* @ts-ignore */
|
|
1087
|
+
...(ngDevMode ? [{ debugName: "anim" }] : /* istanbul ignore next */ []));
|
|
1088
|
+
this.legendOpts = computed(() => {
|
|
1089
|
+
const l = this.config().legend ?? {};
|
|
1090
|
+
return {
|
|
1091
|
+
display: l.display ?? true,
|
|
1092
|
+
position: l.position ?? 'bottom',
|
|
1093
|
+
align: l.align ?? 'center',
|
|
1094
|
+
pointStyle: l.pointStyle ?? 'circle',
|
|
1095
|
+
title: l.title,
|
|
1096
|
+
};
|
|
1097
|
+
}, /* @ts-ignore */
|
|
1098
|
+
...(ngDevMode ? [{ debugName: "legendOpts" }] : /* istanbul ignore next */ []));
|
|
1099
|
+
this.titleOpts = computed(() => this.config().title, /* @ts-ignore */
|
|
1100
|
+
...(ngDevMode ? [{ debugName: "titleOpts" }] : /* istanbul ignore next */ []));
|
|
1101
|
+
this.subtitleOpts = computed(() => this.config().subtitle, /* @ts-ignore */
|
|
1102
|
+
...(ngDevMode ? [{ debugName: "subtitleOpts" }] : /* istanbul ignore next */ []));
|
|
1103
|
+
this.titleStyle = computed(() => styleFor(this.titleOpts()?.align), /* @ts-ignore */
|
|
1104
|
+
...(ngDevMode ? [{ debugName: "titleStyle" }] : /* istanbul ignore next */ []));
|
|
1105
|
+
this.subtitleStyle = computed(() => styleFor(this.subtitleOpts()?.align), /* @ts-ignore */
|
|
1106
|
+
...(ngDevMode ? [{ debugName: "subtitleStyle" }] : /* istanbul ignore next */ []));
|
|
1107
|
+
// --- Legenda ---
|
|
1108
|
+
this.legendItems = computed(() => {
|
|
1109
|
+
const c = this.config();
|
|
1110
|
+
const h = this.hidden();
|
|
1111
|
+
if (c.type === 'pie' || c.type === 'doughnut' || c.type === 'polarArea') {
|
|
1112
|
+
return c.labels.map((label, i) => {
|
|
1113
|
+
const key = 'cat:' + i;
|
|
1114
|
+
return { key, name: label, color: seriesColor(c.series[0]?.color, i), hidden: h.has(key) };
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
return c.series.map((s, i) => {
|
|
1118
|
+
const key = 'ser:' + s.name;
|
|
1119
|
+
return { key, name: s.name, color: seriesColor(s.color, i), hidden: h.has(key) };
|
|
1120
|
+
});
|
|
1121
|
+
}, /* @ts-ignore */
|
|
1122
|
+
...(ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []));
|
|
1123
|
+
// --- Wykres liniowy ---
|
|
1124
|
+
this.lineVm = computed(() => {
|
|
1125
|
+
const c = this.config();
|
|
1126
|
+
if (c.type !== 'line')
|
|
1127
|
+
return null;
|
|
1128
|
+
const h = this.hidden();
|
|
1129
|
+
const active = c.series.map((s, i) => ({ s, i })).filter(({ s }) => !h.has('ser:' + s.name));
|
|
1130
|
+
const values = [];
|
|
1131
|
+
for (const { s } of active)
|
|
1132
|
+
values.push(...s.data);
|
|
1133
|
+
const [mn, mx] = extent(values.length ? values : [0]);
|
|
1134
|
+
const scale = niceScale(Math.min(0, mn), Math.max(0, mx), 5);
|
|
1135
|
+
const plot = plotArea(this.width(), this.height(), VERTICAL_INSETS);
|
|
1136
|
+
const yScale = linearScale(scale.min, scale.max, plot.y + plot.height, plot.y);
|
|
1137
|
+
const n = c.labels.length;
|
|
1138
|
+
const xAt = (i) => (n > 1 ? plot.x + (i / (n - 1)) * plot.width : plot.x + plot.width / 2);
|
|
1139
|
+
const baseline = yScale(0);
|
|
1140
|
+
const series = active.map(({ s, i }) => {
|
|
1141
|
+
const pts = s.data.map((v, idx) => ({ x: xAt(idx), y: yScale(v), value: v, label: c.labels[idx] ?? '' }));
|
|
1142
|
+
const color = seriesColor(s.color, i);
|
|
1143
|
+
return {
|
|
1144
|
+
key: 'ser:' + s.name,
|
|
1145
|
+
name: s.name,
|
|
1146
|
+
color,
|
|
1147
|
+
path: linePath(pts, c.interpolation ?? 'linear'),
|
|
1148
|
+
area: c.area ? areaPath(pts, baseline, c.interpolation ?? 'linear') : null,
|
|
1149
|
+
points: pts,
|
|
1150
|
+
};
|
|
1151
|
+
});
|
|
1152
|
+
return {
|
|
1153
|
+
plot,
|
|
1154
|
+
series,
|
|
1155
|
+
grid: scale.ticks.map((t) => ({ x1: plot.x, y1: yScale(t), x2: plot.x + plot.width, y2: yScale(t) })),
|
|
1156
|
+
valueLabels: scale.ticks.map((t) => ({ x: plot.x - 8, y: yScale(t) + 3, text: formatNumber(t), anchor: 'end' })),
|
|
1157
|
+
catLabels: c.labels.map((l, idx) => ({ x: xAt(idx), y: plot.y + plot.height + 18, text: l, anchor: 'middle' })),
|
|
1158
|
+
showPoints: c.points ?? true,
|
|
1159
|
+
};
|
|
1160
|
+
}, /* @ts-ignore */
|
|
1161
|
+
...(ngDevMode ? [{ debugName: "lineVm" }] : /* istanbul ignore next */ []));
|
|
1162
|
+
// --- Wykres słupkowy ---
|
|
1163
|
+
this.barVm = computed(() => {
|
|
1164
|
+
const c = this.config();
|
|
1165
|
+
if (c.type !== 'bar')
|
|
1166
|
+
return null;
|
|
1167
|
+
const h = this.hidden();
|
|
1168
|
+
const orientation = c.orientation ?? 'vertical';
|
|
1169
|
+
const active = c.series.map((s, i) => ({ s, i })).filter(({ s }) => !h.has('ser:' + s.name));
|
|
1170
|
+
const plot = plotArea(this.width(), this.height(), orientation === 'vertical' ? VERTICAL_INSETS : HORIZONTAL_INSETS);
|
|
1171
|
+
const layout = barLayout(active.map(({ s }) => s.data), c.labels.length, plot, orientation, c.borderRadius ?? 4);
|
|
1172
|
+
const colors = active.map(({ s, i }) => seriesColor(s.color, i));
|
|
1173
|
+
const names = active.map(({ s }) => s.name);
|
|
1174
|
+
const bars = layout.bars.map((b, order) => {
|
|
1175
|
+
const tipX = orientation === 'vertical' ? b.rect.x + b.rect.width / 2 : b.rect.x + b.rect.width;
|
|
1176
|
+
const tipY = orientation === 'vertical' ? b.rect.y : b.rect.y + b.rect.height / 2;
|
|
1177
|
+
return {
|
|
1178
|
+
key: 'ser:' + names[b.seriesIndex],
|
|
1179
|
+
path: b.path,
|
|
1180
|
+
color: colors[b.seriesIndex],
|
|
1181
|
+
name: names[b.seriesIndex],
|
|
1182
|
+
label: c.labels[b.categoryIndex] ?? '',
|
|
1183
|
+
value: b.value,
|
|
1184
|
+
tipX,
|
|
1185
|
+
tipY,
|
|
1186
|
+
index: order,
|
|
1187
|
+
};
|
|
1188
|
+
});
|
|
1189
|
+
const cat = orientation === 'vertical'
|
|
1190
|
+
? bandScale(c.labels.length, plot.x, plot.x + plot.width, 0.2)
|
|
1191
|
+
: bandScale(c.labels.length, plot.y, plot.y + plot.height, 0.2);
|
|
1192
|
+
if (orientation === 'vertical') {
|
|
1193
|
+
return {
|
|
1194
|
+
orientation,
|
|
1195
|
+
bars,
|
|
1196
|
+
grid: layout.ticks.map((t) => ({ x1: plot.x, y1: t.pos, x2: plot.x + plot.width, y2: t.pos })),
|
|
1197
|
+
valueLabels: layout.ticks.map((t) => ({ x: plot.x - 8, y: t.pos + 3, text: formatNumber(t.value), anchor: 'end' })),
|
|
1198
|
+
catLabels: c.labels.map((l, idx) => ({ x: cat.center(idx), y: plot.y + plot.height + 18, text: l, anchor: 'middle' })),
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
return {
|
|
1202
|
+
orientation,
|
|
1203
|
+
bars,
|
|
1204
|
+
grid: layout.ticks.map((t) => ({ x1: t.pos, y1: plot.y, x2: t.pos, y2: plot.y + plot.height })),
|
|
1205
|
+
valueLabels: layout.ticks.map((t) => ({ x: t.pos, y: plot.y + plot.height + 18, text: formatNumber(t.value), anchor: 'middle' })),
|
|
1206
|
+
catLabels: c.labels.map((l, idx) => ({ x: plot.x - 8, y: cat.center(idx) + 3, text: l, anchor: 'end' })),
|
|
1207
|
+
};
|
|
1208
|
+
}, /* @ts-ignore */
|
|
1209
|
+
...(ngDevMode ? [{ debugName: "barVm" }] : /* istanbul ignore next */ []));
|
|
1210
|
+
// --- Pie / Doughnut / Polar Area ---
|
|
1211
|
+
this.pieVm = computed(() => {
|
|
1212
|
+
const c = this.config();
|
|
1213
|
+
if (c.type !== 'pie' && c.type !== 'doughnut' && c.type !== 'polarArea')
|
|
1214
|
+
return null;
|
|
1215
|
+
const h = this.hidden();
|
|
1216
|
+
const s0 = c.series[0];
|
|
1217
|
+
if (!s0)
|
|
1218
|
+
return [];
|
|
1219
|
+
const { cx, cy, radius } = radialArea(this.width(), this.height(), 8);
|
|
1220
|
+
const entries = c.labels
|
|
1221
|
+
.map((label, i) => ({ label, i, value: s0.data[i] ?? 0, color: seriesColor(s0.color, i) }))
|
|
1222
|
+
.filter((e) => !h.has('cat:' + e.i));
|
|
1223
|
+
const values = entries.map((e) => e.value);
|
|
1224
|
+
if (c.type === 'polarArea') {
|
|
1225
|
+
const max = Math.max(1, ...values.map((v) => Math.max(0, v)));
|
|
1226
|
+
const slices = polarSlices(values, cx, cy, radius, max);
|
|
1227
|
+
return slices.map((sl, k) => tipSlice(entries[k], sl.midAngle, radius * 0.62, cx, cy, sl.path));
|
|
1228
|
+
}
|
|
1229
|
+
const inner = c.type === 'doughnut' ? radius * (c.innerRadius ?? 0.6) : 0;
|
|
1230
|
+
const slices = pieSlices(values, cx, cy, radius, inner);
|
|
1231
|
+
return slices.map((sl, k) => tipSlice(entries[k], sl.midAngle, (radius + inner) / 2, cx, cy, sl.path));
|
|
1232
|
+
}, /* @ts-ignore */
|
|
1233
|
+
...(ngDevMode ? [{ debugName: "pieVm" }] : /* istanbul ignore next */ []));
|
|
1234
|
+
// --- Radar ---
|
|
1235
|
+
this.radarVm = computed(() => {
|
|
1236
|
+
const c = this.config();
|
|
1237
|
+
if (c.type !== 'radar')
|
|
1238
|
+
return null;
|
|
1239
|
+
const h = this.hidden();
|
|
1240
|
+
const count = c.labels.length;
|
|
1241
|
+
const { cx, cy, radius } = radialArea(this.width(), this.height(), 30);
|
|
1242
|
+
const grid = radarGrid(count, cx, cy, radius, 4);
|
|
1243
|
+
const active = c.series.map((s, i) => ({ s, i })).filter(({ s }) => !h.has('ser:' + s.name));
|
|
1244
|
+
let max = 1;
|
|
1245
|
+
for (const { s } of active)
|
|
1246
|
+
for (const v of s.data)
|
|
1247
|
+
max = Math.max(max, v);
|
|
1248
|
+
const series = active.map(({ s, i }) => {
|
|
1249
|
+
const pts = radarPoints(s.data, cx, cy, radius, max);
|
|
1250
|
+
return {
|
|
1251
|
+
key: 'ser:' + s.name,
|
|
1252
|
+
name: s.name,
|
|
1253
|
+
color: seriesColor(s.color, i),
|
|
1254
|
+
polygon: polygonPath(pts),
|
|
1255
|
+
points: pts.map((p, idx) => ({ x: p.x, y: p.y, value: s.data[idx] ?? 0, label: c.labels[idx] ?? '' })),
|
|
1256
|
+
};
|
|
1257
|
+
});
|
|
1258
|
+
return {
|
|
1259
|
+
rings: grid.rings,
|
|
1260
|
+
axisLines: grid.axes.map((a) => ({ x1: cx, y1: cy, x2: a.end.x, y2: a.end.y })),
|
|
1261
|
+
axisLabels: grid.axes.map((a) => {
|
|
1262
|
+
const p = polarToCartesian(cx, cy, radius + 14, a.angle);
|
|
1263
|
+
const anchor = Math.abs(p.x - cx) < 1 ? 'middle' : p.x > cx ? 'start' : 'end';
|
|
1264
|
+
return { x: p.x, y: p.y + 3, text: c.labels[a.labelIndex] ?? '', anchor };
|
|
1265
|
+
}),
|
|
1266
|
+
series,
|
|
1267
|
+
};
|
|
1268
|
+
}, /* @ts-ignore */
|
|
1269
|
+
...(ngDevMode ? [{ debugName: "radarVm" }] : /* istanbul ignore next */ []));
|
|
1270
|
+
// --- Crosshair (prowadnica + pigułka etykiety osi X) dla wykresu liniowego ---
|
|
1271
|
+
this.crosshair = computed(() => {
|
|
1272
|
+
const c = this.config();
|
|
1273
|
+
if (c.type !== 'line' || !c.crosshair)
|
|
1274
|
+
return null;
|
|
1275
|
+
const i = this.activeIndex();
|
|
1276
|
+
const vm = this.lineVm();
|
|
1277
|
+
if (i === null || !vm)
|
|
1278
|
+
return null;
|
|
1279
|
+
const cat = vm.catLabels[i];
|
|
1280
|
+
if (!cat)
|
|
1281
|
+
return null;
|
|
1282
|
+
const w = Math.max(28, cat.text.length * 7 + 16);
|
|
1283
|
+
return {
|
|
1284
|
+
x: cat.x,
|
|
1285
|
+
y1: vm.plot.y,
|
|
1286
|
+
y2: vm.plot.y + vm.plot.height,
|
|
1287
|
+
text: cat.text,
|
|
1288
|
+
labelX: cat.x,
|
|
1289
|
+
labelY: cat.y,
|
|
1290
|
+
pillX: cat.x - w / 2,
|
|
1291
|
+
pillY: cat.y - 13,
|
|
1292
|
+
pillW: w,
|
|
1293
|
+
pillH: 18,
|
|
1294
|
+
};
|
|
1295
|
+
}, /* @ts-ignore */
|
|
1296
|
+
...(ngDevMode ? [{ debugName: "crosshair" }] : /* istanbul ignore next */ []));
|
|
1297
|
+
}
|
|
1298
|
+
// --- Zdarzenia ---
|
|
1299
|
+
onLineEnter(idx, tipX, tipY, name, label, value, color) {
|
|
1300
|
+
this.activeIndex.set(idx);
|
|
1301
|
+
this.showTip(tipX, tipY, name, label, value, color);
|
|
1302
|
+
}
|
|
1303
|
+
onLineLeave() {
|
|
1304
|
+
this.activeIndex.set(null);
|
|
1305
|
+
this.hideTip();
|
|
1306
|
+
}
|
|
1307
|
+
showTip(tipX, tipY, name, label, value, color) {
|
|
1308
|
+
if (this.config().tooltip?.enabled === false)
|
|
1309
|
+
return;
|
|
1310
|
+
const fmt = this.config().tooltip?.format;
|
|
1311
|
+
const text = fmt ? fmt({ series: name, label, value }) : formatNumber(value);
|
|
1312
|
+
this.tooltip.set({ x: (tipX / this.width()) * 100, y: (tipY / this.height()) * 100, label, rows: [{ name, value: text, color }] });
|
|
1313
|
+
}
|
|
1314
|
+
hideTip() {
|
|
1315
|
+
this.tooltip.set(null);
|
|
1316
|
+
}
|
|
1317
|
+
onToggle(key) {
|
|
1318
|
+
const set = new Set(this.hidden());
|
|
1319
|
+
if (set.has(key))
|
|
1320
|
+
set.delete(key);
|
|
1321
|
+
else
|
|
1322
|
+
set.add(key);
|
|
1323
|
+
this.hidden.set(set);
|
|
1324
|
+
}
|
|
1325
|
+
onHighlight(key) {
|
|
1326
|
+
this.highlighted.set(key);
|
|
1327
|
+
}
|
|
1328
|
+
/** Czy dany element ma być wygaszony (aktywne podświetlenie innego). */
|
|
1329
|
+
dim(key) {
|
|
1330
|
+
const hi = this.highlighted();
|
|
1331
|
+
return hi !== null && hi !== key;
|
|
1332
|
+
}
|
|
1333
|
+
static { this.ɵfac = function KptChart_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || KptChart)(); }; }
|
|
1334
|
+
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: KptChart, selectors: [["kpt-chart"]], hostAttrs: [1, "kpt-chart-host"], hostVars: 8, hostBindings: function KptChart_HostBindings(rf, ctx) { if (rf & 2) {
|
|
1335
|
+
i0.ɵɵstyleProp("--%NS%kpt-chart-duration", ctx.anim().duration + "ms")("--%NS%kpt-chart-stagger", ctx.anim().stagger + "ms")("--%NS%kpt-chart-delay", ctx.anim().delay + "ms");
|
|
1336
|
+
i0.ɵɵclassProp("kpt-chart--no-anim", !ctx.anim().enabled);
|
|
1337
|
+
} }, inputs: { config: [1, "config"], width: [1, "width"], height: [1, "height"] }, decls: 12, vars: 7, consts: [[1, "kpt-chart"], [1, "kpt-chart__title", 3, "text-align", "color", "font-family", "font-size", "font-weight", "padding-top", "padding-bottom"], [1, "kpt-chart__subtitle", 3, "text-align", "color", "font-family", "font-size", "font-weight", "padding-top", "padding-bottom"], [1, "kpt-chart__body"], [1, "kpt-chart__canvas"], ["role", "img", "preserveAspectRatio", "xMidYMid meet", 1, "kpt-chart__svg"], [3, "state"], [3, "items", "position", "align", "pointStyle", "title"], [1, "kpt-chart__title"], [1, "kpt-chart__subtitle"], [1, "kpt-chart__grid"], [1, "kpt-chart__gridline"], [1, "kpt-chart__crosshair"], [1, "kpt-chart__axis"], [1, "kpt-chart__cat-active"], [1, "kpt-chart__series", 3, "kpt-chart__series--dim"], ["text-anchor", "middle"], [1, "kpt-chart__series"], [1, "kpt-chart__area", 3, "fill"], ["pathLength", "1", 1, "kpt-chart__line"], [1, "kpt-chart__area"], ["r", "4", 1, "kpt-chart__point", 3, "kpt-chart__point--active", "fill", "--%NS%kpt-chart-i"], ["r", "12", 1, "kpt-chart__hit", 3, "pointerenter", "pointerleave"], ["r", "4", 1, "kpt-chart__point"], [1, "kpt-chart__bars"], [1, "kpt-chart__bar", 3, "kpt-chart__series--dim", "fill", "--%NS%kpt-chart-i"], [1, "kpt-chart__bar", 3, "pointerenter", "pointerleave"], [1, "kpt-chart__ring"], [1, "kpt-chart__series", "kpt-chart__radar", 3, "kpt-chart__series--dim"], [1, "kpt-chart__series", "kpt-chart__radar"], [1, "kpt-chart__radar-area"], ["r", "4", 1, "kpt-chart__point", 3, "fill", "--%NS%kpt-chart-i"], ["r", "4", 1, "kpt-chart__point", 3, "pointerenter", "pointerleave"], [1, "kpt-chart__slices"], [1, "kpt-chart__slice", 3, "kpt-chart__series--dim", "fill", "--%NS%kpt-chart-i"], [1, "kpt-chart__slice", 3, "pointerenter", "pointerleave"], [3, "toggle", "highlight", "items", "position", "align", "pointStyle", "title"]], template: function KptChart_Template(rf, ctx) { if (rf & 1) {
|
|
1338
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
1339
|
+
i0.ɵɵconditionalCreate(1, KptChart_Conditional_1_Template, 2, 15, "div", 1);
|
|
1340
|
+
i0.ɵɵconditionalCreate(2, KptChart_Conditional_2_Template, 2, 15, "div", 2);
|
|
1341
|
+
i0.ɵɵelementStart(3, "div", 3)(4, "div", 4);
|
|
1342
|
+
i0.ɵɵnamespaceSVG();
|
|
1343
|
+
i0.ɵɵelementStart(5, "svg", 5);
|
|
1344
|
+
i0.ɵɵconditionalCreate(6, KptChart_Case_6_Template, 1, 1)(7, KptChart_Case_7_Template, 1, 1)(8, KptChart_Case_8_Template, 1, 1)(9, KptChart_Case_9_Template, 1, 1);
|
|
1345
|
+
i0.ɵɵelementEnd();
|
|
1346
|
+
i0.ɵɵnamespaceHTML();
|
|
1347
|
+
i0.ɵɵelement(10, "kpt-chart-tooltip", 6);
|
|
1348
|
+
i0.ɵɵelementEnd();
|
|
1349
|
+
i0.ɵɵconditionalCreate(11, KptChart_Conditional_11_Template, 1, 5, "kpt-chart-legend", 7);
|
|
1350
|
+
i0.ɵɵelementEnd()();
|
|
1351
|
+
} if (rf & 2) {
|
|
1352
|
+
let tmp_4_0;
|
|
1353
|
+
i0.ɵɵattribute("data-legend", ctx.legendOpts().display ? ctx.legendOpts().position : null);
|
|
1354
|
+
i0.ɵɵadvance();
|
|
1355
|
+
i0.ɵɵconditional(ctx.titleOpts()?.display && ctx.titleOpts()?.text ? 1 : -1);
|
|
1356
|
+
i0.ɵɵadvance();
|
|
1357
|
+
i0.ɵɵconditional(ctx.subtitleOpts()?.display && ctx.subtitleOpts()?.text ? 2 : -1);
|
|
1358
|
+
i0.ɵɵadvance(3);
|
|
1359
|
+
i0.ɵɵattribute("viewBox", "0 0 " + ctx.width() + " " + ctx.height());
|
|
1360
|
+
i0.ɵɵadvance();
|
|
1361
|
+
i0.ɵɵconditional((tmp_4_0 = ctx.type()) === "line" ? 6 : tmp_4_0 === "bar" ? 7 : tmp_4_0 === "radar" ? 8 : 9);
|
|
1362
|
+
i0.ɵɵadvance(4);
|
|
1363
|
+
i0.ɵɵproperty("state", ctx.tooltip());
|
|
1364
|
+
i0.ɵɵadvance();
|
|
1365
|
+
i0.ɵɵconditional(ctx.legendOpts().display ? 11 : -1);
|
|
1366
|
+
} }, dependencies: [KptChartLegend, KptChartTooltip], styles: ["@layer kpt.components{.kpt-chart-host{display:block;--%NS%kpt-chart-duration: .4s;--%NS%kpt-chart-stagger: 60ms;--%NS%kpt-chart-delay: 0ms;--%NS%kpt-chart-ease: cubic-bezier(.25, 1, .5, 1)}.kpt-chart{display:flex;flex-direction:column;gap:var(--%NS%kpt-space-2, .5rem);color:var(--%NS%kpt-color-on-surface)}.kpt-chart__title{font-size:var(--%NS%kpt-font-size-lg, 1.125rem);font-weight:var(--%NS%kpt-font-weight-semibold, 600);color:var(--%NS%kpt-color-on-surface)}.kpt-chart__subtitle{font-size:var(--%NS%kpt-font-size-sm, .875rem);color:var(--%NS%kpt-color-on-surface-muted, #6b7280)}.kpt-chart__body{display:flex;gap:var(--%NS%kpt-space-3, .75rem);align-items:center;min-width:0}.kpt-chart[data-legend=top] .kpt-chart__body,.kpt-chart[data-legend=bottom] .kpt-chart__body{flex-direction:column}.kpt-chart[data-legend=top] .kpt-chart-legend-host,.kpt-chart[data-legend=left] .kpt-chart-legend-host{order:-1}.kpt-chart__canvas{position:relative;flex:1 1 auto;min-width:0;width:100%}.kpt-chart__svg{display:block;width:100%;height:auto}.kpt-chart__gridline{stroke:var(--%NS%kpt-color-border);stroke-width:1;opacity:.7}.kpt-chart__ring{fill:none;stroke:var(--%NS%kpt-color-border);stroke-width:1;opacity:.7}.kpt-chart__axis text{fill:var(--%NS%kpt-color-on-surface-muted, #6b7280);font-size:11px;font-family:var(--%NS%kpt-font-family-sans)}.kpt-chart__crosshair{stroke:var(--%NS%kpt-color-border-strong);stroke-width:1;stroke-dasharray:4 4;opacity:.75;pointer-events:none}.kpt-chart__cat-active{pointer-events:none}.kpt-chart__cat-active rect{fill:var(--%NS%kpt-color-on-surface)}.kpt-chart__cat-active text{fill:var(--%NS%kpt-color-surface);font-size:11px;font-weight:var(--%NS%kpt-font-weight-medium, 500);font-family:var(--%NS%kpt-font-family-sans)}.kpt-chart__series,.kpt-chart__bar,.kpt-chart__slice{transition:opacity .2s var(--%NS%kpt-chart-ease)}.kpt-chart__series--dim{opacity:.22}.kpt-chart__line{fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.kpt-chart__area{stroke:none;opacity:.15}.kpt-chart__point{stroke:var(--%NS%kpt-color-surface);stroke-width:2;cursor:pointer;transition:transform .15s var(--%NS%kpt-chart-ease);transform-box:fill-box;transform-origin:center}.kpt-chart__point:hover{transform:scale(1.4)}.kpt-chart__point--active{transform:scale(1.5)}.kpt-chart__hit{fill:transparent;pointer-events:all;cursor:pointer}.kpt-chart__bar{cursor:pointer}.kpt-chart__slice{cursor:pointer;stroke:var(--%NS%kpt-color-surface);stroke-width:1.5}.kpt-chart__radar-area{fill-opacity:.18;stroke-width:2;stroke-linejoin:round}.kpt-chart__legend-title{font-size:var(--%NS%kpt-font-size-sm, .875rem);font-weight:var(--%NS%kpt-font-weight-medium, 500);color:var(--%NS%kpt-color-on-surface-muted);margin-bottom:var(--%NS%kpt-space-1, .25rem)}.kpt-chart__legend-list{display:flex;flex-wrap:wrap;gap:var(--%NS%kpt-space-2, .5rem) var(--%NS%kpt-space-4, 1rem);align-items:center;justify-content:center;margin:0;padding:0;list-style:none}.kpt-chart__legend[data-align=start] .kpt-chart__legend-list{justify-content:flex-start}.kpt-chart__legend[data-align=end] .kpt-chart__legend-list{justify-content:flex-end}.kpt-chart__legend[data-position=left] .kpt-chart__legend-list,.kpt-chart__legend[data-position=right] .kpt-chart__legend-list{flex-direction:column;align-items:flex-start}.kpt-chart__legend-item{display:inline-flex;align-items:center;gap:var(--%NS%kpt-space-2, .5rem);padding:0;border:0;background:none;cursor:pointer;font:inherit;font-size:var(--%NS%kpt-font-size-sm, .875rem);color:var(--%NS%kpt-color-on-surface)}.kpt-chart__legend-item--hidden{opacity:.45}.kpt-chart__legend-item--hidden .kpt-chart__legend-label{text-decoration:line-through}.kpt-chart__legend-marker{display:inline-block;width:12px;height:12px;background:var(--%NS%kpt-chart-legend-color);flex:none}.kpt-chart__legend-marker[data-style=circle]{border-radius:var(--%NS%kpt-radius-full, 9999px)}.kpt-chart__legend-marker[data-style=rect]{border-radius:var(--%NS%kpt-radius-sm, .25rem)}.kpt-chart__legend-marker[data-style=rectRot]{transform:rotate(45deg);border-radius:2px}.kpt-chart__legend-marker[data-style=triangle]{background:none;width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:12px solid var(--%NS%kpt-chart-legend-color)}.kpt-chart__legend-marker[data-style=line]{height:3px;border-radius:var(--%NS%kpt-radius-full, 9999px)}.kpt-chart__tooltip{position:absolute;transform:translate(-50%,calc(-100% - 10px));pointer-events:none;background:var(--%NS%kpt-color-surface-raised, var(--%NS%kpt-color-surface));color:var(--%NS%kpt-color-on-surface);border:1px solid var(--%NS%kpt-color-border);border-radius:var(--%NS%kpt-radius-md, .5rem);box-shadow:0 4px 16px #0000001f;padding:var(--%NS%kpt-space-2, .5rem) var(--%NS%kpt-space-3, .75rem);font-size:var(--%NS%kpt-font-size-sm, .875rem);white-space:nowrap;z-index:2}.kpt-chart__tooltip--flip{transform:translate(-50%,12px)}.kpt-chart__tooltip-title{font-weight:var(--%NS%kpt-font-weight-semibold, 600);margin-bottom:2px}.kpt-chart__tooltip-row{display:flex;align-items:center;gap:var(--%NS%kpt-space-2, .5rem)}.kpt-chart__tooltip-dot{width:8px;height:8px;border-radius:var(--%NS%kpt-radius-full, 9999px);flex:none}.kpt-chart__tooltip-name{color:var(--%NS%kpt-color-on-surface-muted)}.kpt-chart__tooltip-val{margin-left:auto;font-weight:var(--%NS%kpt-font-weight-medium, 500)}.kpt-chart__line{stroke-dasharray:1;stroke-dashoffset:1;animation:kpt-chart-draw var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) var(--%NS%kpt-chart-delay) forwards}.kpt-chart__area{animation:kpt-chart-fade var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) var(--%NS%kpt-chart-delay) backwards}.kpt-chart__point{animation:kpt-chart-fade var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) calc(var(--%NS%kpt-chart-delay) + var(--%NS%kpt-chart-duration) + var(--%NS%kpt-chart-i, 0) * var(--%NS%kpt-chart-stagger)) backwards}.kpt-chart__bars[data-orientation=vertical] .kpt-chart__bar{transform-box:fill-box;transform-origin:bottom;animation:kpt-chart-grow-y var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) calc(var(--%NS%kpt-chart-delay) + var(--%NS%kpt-chart-i, 0) * var(--%NS%kpt-chart-stagger)) backwards}.kpt-chart__bars[data-orientation=horizontal] .kpt-chart__bar{transform-box:fill-box;transform-origin:left;animation:kpt-chart-grow-x var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) calc(var(--%NS%kpt-chart-delay) + var(--%NS%kpt-chart-i, 0) * var(--%NS%kpt-chart-stagger)) backwards}.kpt-chart__slice,.kpt-chart__radar-area{transform-box:fill-box;transform-origin:center}.kpt-chart__slice{animation:kpt-chart-pop var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) calc(var(--%NS%kpt-chart-delay) + var(--%NS%kpt-chart-i, 0) * var(--%NS%kpt-chart-stagger)) backwards}.kpt-chart__radar-area{animation:kpt-chart-pop var(--%NS%kpt-chart-duration) var(--%NS%kpt-chart-ease) var(--%NS%kpt-chart-delay) backwards}@keyframes kpt-chart-draw{to{stroke-dashoffset:0}}@keyframes kpt-chart-fade{0%{opacity:0}}@keyframes kpt-chart-grow-y{0%{transform:scaleY(0)}}@keyframes kpt-chart-grow-x{0%{transform:scaleX(0)}}@keyframes kpt-chart-pop{0%{transform:scale(0);opacity:0}}.kpt-chart--%NS%no-anim :is(.kpt-chart__line,.kpt-chart__area,.kpt-chart__point,.kpt-chart__bar,.kpt-chart__slice,.kpt-chart__radar-area){animation:none;stroke-dashoffset:0}@media(prefers-reduced-motion:reduce){.kpt-chart :is(.kpt-chart__line,.kpt-chart__area,.kpt-chart__point,.kpt-chart__bar,.kpt-chart__slice,.kpt-chart__radar-area){animation:none;stroke-dashoffset:0}}}\n"], encapsulation: 2 }); }
|
|
1367
|
+
}
|
|
1368
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(KptChart, [{
|
|
1369
|
+
type: Component,
|
|
1370
|
+
args: [{ selector: 'kpt-chart', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [KptChartLegend, KptChartTooltip], host: {
|
|
1371
|
+
class: 'kpt-chart-host',
|
|
1372
|
+
'[class.kpt-chart--no-anim]': '!anim().enabled',
|
|
1373
|
+
'[style.--kpt-chart-duration]': "anim().duration + 'ms'",
|
|
1374
|
+
'[style.--kpt-chart-stagger]': "anim().stagger + 'ms'",
|
|
1375
|
+
'[style.--kpt-chart-delay]': "anim().delay + 'ms'",
|
|
1376
|
+
}, template: "<div class=\"kpt-chart\" [attr.data-legend]=\"legendOpts().display ? legendOpts().position : null\">\n @if (titleOpts()?.display && titleOpts()?.text) {\n <div\n class=\"kpt-chart__title\"\n [style.text-align]=\"titleStyle()\"\n [style.color]=\"titleOpts()?.color\"\n [style.font-family]=\"titleOpts()?.font?.family\"\n [style.font-size.px]=\"titleOpts()?.font?.size\"\n [style.font-weight]=\"titleOpts()?.font?.weight\"\n [style.padding-top.px]=\"titleOpts()?.padding?.top\"\n [style.padding-bottom.px]=\"titleOpts()?.padding?.bottom\"\n >\n {{ titleOpts()?.text }}\n </div>\n }\n @if (subtitleOpts()?.display && subtitleOpts()?.text) {\n <div\n class=\"kpt-chart__subtitle\"\n [style.text-align]=\"subtitleStyle()\"\n [style.color]=\"subtitleOpts()?.color\"\n [style.font-family]=\"subtitleOpts()?.font?.family\"\n [style.font-size.px]=\"subtitleOpts()?.font?.size\"\n [style.font-weight]=\"subtitleOpts()?.font?.weight\"\n [style.padding-top.px]=\"subtitleOpts()?.padding?.top\"\n [style.padding-bottom.px]=\"subtitleOpts()?.padding?.bottom\"\n >\n {{ subtitleOpts()?.text }}\n </div>\n }\n\n <div class=\"kpt-chart__body\">\n <div class=\"kpt-chart__canvas\">\n <svg [attr.viewBox]=\"'0 0 ' + width() + ' ' + height()\" class=\"kpt-chart__svg\" role=\"img\" preserveAspectRatio=\"xMidYMid meet\">\n @switch (type()) {\n @case ('line') {\n @if (lineVm(); as vm) {\n <g class=\"kpt-chart__grid\">\n @for (g of vm.grid; track $index) {\n <line class=\"kpt-chart__gridline\" [attr.x1]=\"g.x1\" [attr.y1]=\"g.y1\" [attr.x2]=\"g.x2\" [attr.y2]=\"g.y2\" />\n }\n </g>\n @if (crosshair(); as ch) {\n <line class=\"kpt-chart__crosshair\" [attr.x1]=\"ch.x\" [attr.y1]=\"ch.y1\" [attr.x2]=\"ch.x\" [attr.y2]=\"ch.y2\" />\n }\n <g class=\"kpt-chart__axis\">\n @for (l of vm.valueLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n @for (l of vm.catLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n </g>\n @if (crosshair(); as ch) {\n <g class=\"kpt-chart__cat-active\">\n <rect [attr.x]=\"ch.pillX\" [attr.y]=\"ch.pillY\" [attr.width]=\"ch.pillW\" [attr.height]=\"ch.pillH\" [attr.rx]=\"ch.pillH / 2\" />\n <text [attr.x]=\"ch.labelX\" [attr.y]=\"ch.labelY\" text-anchor=\"middle\">{{ ch.text }}</text>\n </g>\n }\n @for (s of vm.series; track s.key) {\n <g class=\"kpt-chart__series\" [class.kpt-chart__series--dim]=\"dim(s.key)\">\n @if (s.area) {\n <path class=\"kpt-chart__area\" [attr.d]=\"s.area\" [style.fill]=\"s.color\" />\n }\n <path class=\"kpt-chart__line\" [attr.d]=\"s.path\" [style.stroke]=\"s.color\" pathLength=\"1\" />\n @for (p of s.points; track $index) {\n @if (vm.showPoints) {\n <circle\n class=\"kpt-chart__point\"\n [class.kpt-chart__point--active]=\"activeIndex() === $index\"\n [attr.cx]=\"p.x\"\n [attr.cy]=\"p.y\"\n r=\"4\"\n [style.fill]=\"s.color\"\n [style.--kpt-chart-i]=\"$index\"\n />\n }\n <circle\n class=\"kpt-chart__hit\"\n [attr.cx]=\"p.x\"\n [attr.cy]=\"p.y\"\n r=\"12\"\n (pointerenter)=\"onLineEnter($index, p.x, p.y, s.name, p.label, p.value, s.color)\"\n (pointerleave)=\"onLineLeave()\"\n />\n }\n </g>\n }\n }\n }\n\n @case ('bar') {\n @if (barVm(); as vm) {\n <g class=\"kpt-chart__grid\">\n @for (g of vm.grid; track $index) {\n <line class=\"kpt-chart__gridline\" [attr.x1]=\"g.x1\" [attr.y1]=\"g.y1\" [attr.x2]=\"g.x2\" [attr.y2]=\"g.y2\" />\n }\n </g>\n <g class=\"kpt-chart__axis\">\n @for (l of vm.valueLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n @for (l of vm.catLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n </g>\n <g class=\"kpt-chart__bars\" [attr.data-orientation]=\"vm.orientation\">\n @for (b of vm.bars; track b.key + '#' + b.index) {\n <path\n class=\"kpt-chart__bar\"\n [class.kpt-chart__series--dim]=\"dim(b.key)\"\n [attr.d]=\"b.path\"\n [style.fill]=\"b.color\"\n [style.--kpt-chart-i]=\"b.index\"\n (pointerenter)=\"showTip(b.tipX, b.tipY, b.name, b.label, b.value, b.color)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n </g>\n }\n }\n\n @case ('radar') {\n @if (radarVm(); as vm) {\n <g class=\"kpt-chart__grid\">\n @for (r of vm.rings; track $index) {\n <path class=\"kpt-chart__ring\" [attr.d]=\"r\" />\n }\n @for (a of vm.axisLines; track $index) {\n <line class=\"kpt-chart__gridline\" [attr.x1]=\"a.x1\" [attr.y1]=\"a.y1\" [attr.x2]=\"a.x2\" [attr.y2]=\"a.y2\" />\n }\n </g>\n <g class=\"kpt-chart__axis\">\n @for (l of vm.axisLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n </g>\n @for (s of vm.series; track s.key) {\n <g class=\"kpt-chart__series kpt-chart__radar\" [class.kpt-chart__series--dim]=\"dim(s.key)\">\n <path class=\"kpt-chart__radar-area\" [attr.d]=\"s.polygon\" [style.fill]=\"s.color\" [style.stroke]=\"s.color\" />\n @for (p of s.points; track $index) {\n <circle\n class=\"kpt-chart__point\"\n [attr.cx]=\"p.x\"\n [attr.cy]=\"p.y\"\n r=\"4\"\n [style.fill]=\"s.color\"\n [style.--kpt-chart-i]=\"$index\"\n (pointerenter)=\"showTip(p.x, p.y, s.name, p.label, p.value, s.color)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n </g>\n }\n }\n }\n\n @default {\n @if (pieVm(); as slices) {\n <g class=\"kpt-chart__slices\">\n @for (sl of slices; track sl.key) {\n <path\n class=\"kpt-chart__slice\"\n [class.kpt-chart__series--dim]=\"dim(sl.key)\"\n [attr.d]=\"sl.path\"\n [style.fill]=\"sl.color\"\n [style.--kpt-chart-i]=\"$index\"\n (pointerenter)=\"showTip(sl.tipX, sl.tipY, sl.label, '', sl.value, sl.color)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n </g>\n }\n }\n }\n </svg>\n\n <kpt-chart-tooltip [state]=\"tooltip()\" />\n </div>\n\n @if (legendOpts().display) {\n <kpt-chart-legend\n [items]=\"legendItems()\"\n [position]=\"legendOpts().position\"\n [align]=\"legendOpts().align\"\n [pointStyle]=\"legendOpts().pointStyle\"\n [title]=\"legendOpts().title\"\n (toggle)=\"onToggle($event)\"\n (highlight)=\"onHighlight($event)\"\n />\n }\n </div>\n</div>\n", styles: ["@layer kpt.components{.kpt-chart-host{display:block;--kpt-chart-duration: .4s;--kpt-chart-stagger: 60ms;--kpt-chart-delay: 0ms;--kpt-chart-ease: cubic-bezier(.25, 1, .5, 1)}.kpt-chart{display:flex;flex-direction:column;gap:var(--kpt-space-2, .5rem);color:var(--kpt-color-on-surface)}.kpt-chart__title{font-size:var(--kpt-font-size-lg, 1.125rem);font-weight:var(--kpt-font-weight-semibold, 600);color:var(--kpt-color-on-surface)}.kpt-chart__subtitle{font-size:var(--kpt-font-size-sm, .875rem);color:var(--kpt-color-on-surface-muted, #6b7280)}.kpt-chart__body{display:flex;gap:var(--kpt-space-3, .75rem);align-items:center;min-width:0}.kpt-chart[data-legend=top] .kpt-chart__body,.kpt-chart[data-legend=bottom] .kpt-chart__body{flex-direction:column}.kpt-chart[data-legend=top] .kpt-chart-legend-host,.kpt-chart[data-legend=left] .kpt-chart-legend-host{order:-1}.kpt-chart__canvas{position:relative;flex:1 1 auto;min-width:0;width:100%}.kpt-chart__svg{display:block;width:100%;height:auto}.kpt-chart__gridline{stroke:var(--kpt-color-border);stroke-width:1;opacity:.7}.kpt-chart__ring{fill:none;stroke:var(--kpt-color-border);stroke-width:1;opacity:.7}.kpt-chart__axis text{fill:var(--kpt-color-on-surface-muted, #6b7280);font-size:11px;font-family:var(--kpt-font-family-sans)}.kpt-chart__crosshair{stroke:var(--kpt-color-border-strong);stroke-width:1;stroke-dasharray:4 4;opacity:.75;pointer-events:none}.kpt-chart__cat-active{pointer-events:none}.kpt-chart__cat-active rect{fill:var(--kpt-color-on-surface)}.kpt-chart__cat-active text{fill:var(--kpt-color-surface);font-size:11px;font-weight:var(--kpt-font-weight-medium, 500);font-family:var(--kpt-font-family-sans)}.kpt-chart__series,.kpt-chart__bar,.kpt-chart__slice{transition:opacity .2s var(--kpt-chart-ease)}.kpt-chart__series--dim{opacity:.22}.kpt-chart__line{fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.kpt-chart__area{stroke:none;opacity:.15}.kpt-chart__point{stroke:var(--kpt-color-surface);stroke-width:2;cursor:pointer;transition:transform .15s var(--kpt-chart-ease);transform-box:fill-box;transform-origin:center}.kpt-chart__point:hover{transform:scale(1.4)}.kpt-chart__point--active{transform:scale(1.5)}.kpt-chart__hit{fill:transparent;pointer-events:all;cursor:pointer}.kpt-chart__bar{cursor:pointer}.kpt-chart__slice{cursor:pointer;stroke:var(--kpt-color-surface);stroke-width:1.5}.kpt-chart__radar-area{fill-opacity:.18;stroke-width:2;stroke-linejoin:round}.kpt-chart__legend-title{font-size:var(--kpt-font-size-sm, .875rem);font-weight:var(--kpt-font-weight-medium, 500);color:var(--kpt-color-on-surface-muted);margin-bottom:var(--kpt-space-1, .25rem)}.kpt-chart__legend-list{display:flex;flex-wrap:wrap;gap:var(--kpt-space-2, .5rem) var(--kpt-space-4, 1rem);align-items:center;justify-content:center;margin:0;padding:0;list-style:none}.kpt-chart__legend[data-align=start] .kpt-chart__legend-list{justify-content:flex-start}.kpt-chart__legend[data-align=end] .kpt-chart__legend-list{justify-content:flex-end}.kpt-chart__legend[data-position=left] .kpt-chart__legend-list,.kpt-chart__legend[data-position=right] .kpt-chart__legend-list{flex-direction:column;align-items:flex-start}.kpt-chart__legend-item{display:inline-flex;align-items:center;gap:var(--kpt-space-2, .5rem);padding:0;border:0;background:none;cursor:pointer;font:inherit;font-size:var(--kpt-font-size-sm, .875rem);color:var(--kpt-color-on-surface)}.kpt-chart__legend-item--hidden{opacity:.45}.kpt-chart__legend-item--hidden .kpt-chart__legend-label{text-decoration:line-through}.kpt-chart__legend-marker{display:inline-block;width:12px;height:12px;background:var(--kpt-chart-legend-color);flex:none}.kpt-chart__legend-marker[data-style=circle]{border-radius:var(--kpt-radius-full, 9999px)}.kpt-chart__legend-marker[data-style=rect]{border-radius:var(--kpt-radius-sm, .25rem)}.kpt-chart__legend-marker[data-style=rectRot]{transform:rotate(45deg);border-radius:2px}.kpt-chart__legend-marker[data-style=triangle]{background:none;width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:12px solid var(--kpt-chart-legend-color)}.kpt-chart__legend-marker[data-style=line]{height:3px;border-radius:var(--kpt-radius-full, 9999px)}.kpt-chart__tooltip{position:absolute;transform:translate(-50%,calc(-100% - 10px));pointer-events:none;background:var(--kpt-color-surface-raised, var(--kpt-color-surface));color:var(--kpt-color-on-surface);border:1px solid var(--kpt-color-border);border-radius:var(--kpt-radius-md, .5rem);box-shadow:0 4px 16px #0000001f;padding:var(--kpt-space-2, .5rem) var(--kpt-space-3, .75rem);font-size:var(--kpt-font-size-sm, .875rem);white-space:nowrap;z-index:2}.kpt-chart__tooltip--flip{transform:translate(-50%,12px)}.kpt-chart__tooltip-title{font-weight:var(--kpt-font-weight-semibold, 600);margin-bottom:2px}.kpt-chart__tooltip-row{display:flex;align-items:center;gap:var(--kpt-space-2, .5rem)}.kpt-chart__tooltip-dot{width:8px;height:8px;border-radius:var(--kpt-radius-full, 9999px);flex:none}.kpt-chart__tooltip-name{color:var(--kpt-color-on-surface-muted)}.kpt-chart__tooltip-val{margin-left:auto;font-weight:var(--kpt-font-weight-medium, 500)}.kpt-chart__line{stroke-dasharray:1;stroke-dashoffset:1;animation:kpt-chart-draw var(--kpt-chart-duration) var(--kpt-chart-ease) var(--kpt-chart-delay) forwards}.kpt-chart__area{animation:kpt-chart-fade var(--kpt-chart-duration) var(--kpt-chart-ease) var(--kpt-chart-delay) backwards}.kpt-chart__point{animation:kpt-chart-fade var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-duration) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__bars[data-orientation=vertical] .kpt-chart__bar{transform-box:fill-box;transform-origin:bottom;animation:kpt-chart-grow-y var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__bars[data-orientation=horizontal] .kpt-chart__bar{transform-box:fill-box;transform-origin:left;animation:kpt-chart-grow-x var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__slice,.kpt-chart__radar-area{transform-box:fill-box;transform-origin:center}.kpt-chart__slice{animation:kpt-chart-pop var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__radar-area{animation:kpt-chart-pop var(--kpt-chart-duration) var(--kpt-chart-ease) var(--kpt-chart-delay) backwards}@keyframes kpt-chart-draw{to{stroke-dashoffset:0}}@keyframes kpt-chart-fade{0%{opacity:0}}@keyframes kpt-chart-grow-y{0%{transform:scaleY(0)}}@keyframes kpt-chart-grow-x{0%{transform:scaleX(0)}}@keyframes kpt-chart-pop{0%{transform:scale(0);opacity:0}}.kpt-chart--no-anim :is(.kpt-chart__line,.kpt-chart__area,.kpt-chart__point,.kpt-chart__bar,.kpt-chart__slice,.kpt-chart__radar-area){animation:none;stroke-dashoffset:0}@media(prefers-reduced-motion:reduce){.kpt-chart :is(.kpt-chart__line,.kpt-chart__area,.kpt-chart__point,.kpt-chart__bar,.kpt-chart__slice,.kpt-chart__radar-area){animation:none;stroke-dashoffset:0}}}\n"] }]
|
|
1377
|
+
}], null, { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }] }); })();
|
|
1378
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(KptChart, { className: "KptChart", filePath: "lib/chart.component.ts", lineNumber: 106 }); })();
|
|
1379
|
+
// Buduje SliceVm z pozycją tooltipa na promieniu środka wycinka.
|
|
1380
|
+
function tipSlice(entry, midAngle, tipRadius, cx, cy, path) {
|
|
1381
|
+
const p = polarToCartesian(cx, cy, tipRadius, midAngle);
|
|
1382
|
+
return { key: 'cat:' + entry.i, path, color: entry.color, label: entry.label, value: entry.value, tipX: p.x, tipY: p.y };
|
|
1383
|
+
}
|
|
1384
|
+
function styleFor(align) {
|
|
1385
|
+
if (align === 'center')
|
|
1386
|
+
return 'center';
|
|
1387
|
+
if (align === 'end')
|
|
1388
|
+
return 'right';
|
|
1389
|
+
return 'left';
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/*
|
|
1393
|
+
* Rdzeń wykresów — czyste typy TypeScript (bez zależności od DOM/frameworka).
|
|
1394
|
+
* Współdzielone przez warstwę Angular (Faza 1) i React (Faza 2).
|
|
1395
|
+
*/
|
|
1396
|
+
|
|
1397
|
+
/* Rdzeń wykresów (pure TS) — barrel eksportów. */
|
|
1398
|
+
|
|
1399
|
+
/*
|
|
1400
|
+
* Public API — @konce-pt/angular/charts
|
|
1401
|
+
* Wykresy SVG dla Angulara (sygnały, zoneless). Rdzeń obliczeń: pure TS.
|
|
1402
|
+
*/
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Generated bundle index. Do not edit.
|
|
1406
|
+
*/
|
|
1407
|
+
|
|
1408
|
+
export { KPT_CHART_PALETTE, KptChart, areaPath, barLayout, linePath, niceScale, pieSlices, polarSlices, radarGrid, radarPoints, seriesColor };
|
|
1409
|
+
//# sourceMappingURL=konce-pt-angular-charts.mjs.map
|