@cngx/common 0.0.1-rc.0 → 0.1.0-rc.1
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/a11y/README.md +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +164 -51
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2059 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1479 -73
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1144 -85
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +7 -6
- package/popover/README.md +8 -34
- package/stepper/README.md +69 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +159 -38
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1880 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1360 -45
- package/types/cngx-common-tabs.d.ts +1139 -56
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -19,6 +19,8 @@ import { nextUid } from '@cngx/core/utils';
|
|
|
19
19
|
* scale to a constant function returning `range[0]`.
|
|
20
20
|
* @param range `[start, end]` output range (typically pixel coordinates).
|
|
21
21
|
* @returns `(v: number) => number` mapping domain values to range values.
|
|
22
|
+
*
|
|
23
|
+
* @category common/chart/scales
|
|
22
24
|
*/
|
|
23
25
|
function createLinearScale(domain, range) {
|
|
24
26
|
const [d0, d1] = domain;
|
|
@@ -41,6 +43,8 @@ function createLinearScale(domain, range) {
|
|
|
41
43
|
* @param range `[start, end]` output range (typically pixel coordinates).
|
|
42
44
|
* @returns `(v: Date | number) => number` mapping time values to range
|
|
43
45
|
* values.
|
|
46
|
+
*
|
|
47
|
+
* @category common/chart/scales
|
|
44
48
|
*/
|
|
45
49
|
function createTimeScale(domain, range) {
|
|
46
50
|
const d0 = toMs$2(domain[0]);
|
|
@@ -48,6 +52,7 @@ function createTimeScale(domain, range) {
|
|
|
48
52
|
const linear = createLinearScale([d0, d1], range);
|
|
49
53
|
return (v) => linear(toMs$2(v));
|
|
50
54
|
}
|
|
55
|
+
/** @internal */
|
|
51
56
|
function toMs$2(v) {
|
|
52
57
|
return typeof v === 'number' ? v : v.getTime();
|
|
53
58
|
}
|
|
@@ -56,6 +61,8 @@ function toMs$2(v) {
|
|
|
56
61
|
* Construct a {@link BandScale} from a categorical domain and a numeric
|
|
57
62
|
* range. See the type-level documentation above for parameter
|
|
58
63
|
* semantics.
|
|
64
|
+
*
|
|
65
|
+
* @category common/chart/scales
|
|
59
66
|
*/
|
|
60
67
|
function createBandScale(domain, range, padding = 0) {
|
|
61
68
|
const [r0, r1] = range;
|
|
@@ -86,6 +93,8 @@ function createBandScale(domain, range, padding = 0) {
|
|
|
86
93
|
* an empty palette throws synchronously at construction time.
|
|
87
94
|
* @returns Callable `(v: T) => string` returning the palette entry for
|
|
88
95
|
* `v`. Lookup of an unknown value returns the palette's first entry.
|
|
96
|
+
*
|
|
97
|
+
* @category common/chart/scales
|
|
89
98
|
*/
|
|
90
99
|
function createOrdinalScale(domain, colors) {
|
|
91
100
|
if (colors.length === 0) {
|
|
@@ -103,6 +112,10 @@ function createOrdinalScale(domain, colors) {
|
|
|
103
112
|
* atoms, `<cngx-chart-data-table>`). `<cngx-chart>` provides itself
|
|
104
113
|
* via `useExisting`; child queries narrow the generic on the consumer
|
|
105
114
|
* side.
|
|
115
|
+
*
|
|
116
|
+
* @category common/chart
|
|
117
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
118
|
+
* @since 0.1.0
|
|
106
119
|
*/
|
|
107
120
|
const CNGX_CHART_CONTEXT = new InjectionToken('CngxChartContext');
|
|
108
121
|
/**
|
|
@@ -118,15 +131,20 @@ const CNGX_CHART_CONTEXT = new InjectionToken('CngxChartContext');
|
|
|
118
131
|
function injectChartContext(consumerName) {
|
|
119
132
|
const ctx = inject(CNGX_CHART_CONTEXT, { optional: true });
|
|
120
133
|
if (!ctx) {
|
|
121
|
-
throw new Error(`${consumerName}: missing CNGX_CHART_CONTEXT
|
|
134
|
+
throw new Error(`${consumerName}: missing CNGX_CHART_CONTEXT - must be a content child of <cngx-chart>`);
|
|
122
135
|
}
|
|
123
136
|
return ctx;
|
|
124
137
|
}
|
|
125
138
|
|
|
139
|
+
/** @internal */
|
|
126
140
|
const DEFAULT_TICK_COUNT = 5;
|
|
141
|
+
/** @internal */
|
|
127
142
|
const TICK_LENGTH = 5;
|
|
143
|
+
/** @internal */
|
|
128
144
|
const LABEL_OFFSET = 4;
|
|
145
|
+
/** @internal */
|
|
129
146
|
const AXIS_LABEL_OFFSET_INLINE = 32;
|
|
147
|
+
/** @internal */
|
|
130
148
|
const AXIS_LABEL_OFFSET_BLOCK = 36;
|
|
131
149
|
/**
|
|
132
150
|
* Declarative axis directive. Lives as a content child of
|
|
@@ -134,16 +152,30 @@ const AXIS_LABEL_OFFSET_BLOCK = 36;
|
|
|
134
152
|
* parent's scale derivation. Renders SVG ticks and labels in the
|
|
135
153
|
* coordinate system the parent publishes via {@link CNGX_CHART_CONTEXT}.
|
|
136
154
|
*
|
|
137
|
-
* Attribute-selector on `<svg:g>`
|
|
155
|
+
* Attribute-selector on `<svg:g>` - the host element IS the SVG group.
|
|
138
156
|
* This keeps the namespace boundary clean: a `<cngx-axis>` element
|
|
139
157
|
* inside `<svg>` would be in the XHTML namespace and SVG layout would
|
|
140
158
|
* not flow through it. By making the directive attribute-only, the
|
|
141
159
|
* host stays in the SVG namespace and the browser lays out tick lines
|
|
142
160
|
* and labels exactly where the geometry says.
|
|
143
161
|
*
|
|
144
|
-
* Host carries `aria-hidden="true"`
|
|
162
|
+
* Host carries `aria-hidden="true"` - axis text is decoration; the
|
|
145
163
|
* semantic data view lives on the parent chart's auto-Summary and
|
|
146
164
|
* Data Table.
|
|
165
|
+
*
|
|
166
|
+
* @category common/chart/axis
|
|
167
|
+
* @docsKind primary
|
|
168
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/axis.component.ts
|
|
169
|
+
* @since 0.1.0
|
|
170
|
+
* @relatedTo CngxChart, CngxLine, CngxBar, CngxArea
|
|
171
|
+
*
|
|
172
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
173
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
174
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
175
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
176
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
177
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
178
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
147
179
|
*/
|
|
148
180
|
class CngxAxis {
|
|
149
181
|
position = input.required(...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
@@ -161,7 +193,7 @@ class CngxAxis {
|
|
|
161
193
|
*/
|
|
162
194
|
showGrid = input(false, { ...(ngDevMode ? { debugName: "showGrid" } : /* istanbul ignore next */ {}), alias: 'grid' });
|
|
163
195
|
/**
|
|
164
|
-
* Optional axis title rendered alongside the tick labels
|
|
196
|
+
* Optional axis title rendered alongside the tick labels -
|
|
165
197
|
* "Months", "Revenue (k€)", etc. The title is positioned outside
|
|
166
198
|
* the tick labels (further from the chart area) and rotated -90°
|
|
167
199
|
* for left/right axes so it reads bottom-to-top. Theming via the
|
|
@@ -191,11 +223,11 @@ class CngxAxis {
|
|
|
191
223
|
}
|
|
192
224
|
if (t === 'time') {
|
|
193
225
|
const start = toMs$1(dom[0]);
|
|
194
|
-
const end = toMs$1(dom
|
|
226
|
+
const end = toMs$1(dom.at(-1));
|
|
195
227
|
return spread(start, end, count).map((ms) => new Date(ms));
|
|
196
228
|
}
|
|
197
229
|
const start = Number(dom[0]);
|
|
198
|
-
const end = Number(dom
|
|
230
|
+
const end = Number(dom.at(-1));
|
|
199
231
|
return spread(start, end, count);
|
|
200
232
|
}, { ...(ngDevMode ? { debugName: "tickValues" } : /* istanbul ignore next */ {}), equal: (a, b) => {
|
|
201
233
|
if (a === b) {
|
|
@@ -225,7 +257,11 @@ class CngxAxis {
|
|
|
225
257
|
}
|
|
226
258
|
return buildAxisLabelGeometry(this.position(), width, height);
|
|
227
259
|
}, { ...(ngDevMode ? { debugName: "axisLabelGeometry" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b ||
|
|
228
|
-
(a !== null &&
|
|
260
|
+
(a !== null &&
|
|
261
|
+
b !== null &&
|
|
262
|
+
a.transform === b.transform &&
|
|
263
|
+
a.anchor === b.anchor &&
|
|
264
|
+
a.baseline === b.baseline) });
|
|
229
265
|
axisGeometry = computed(() => {
|
|
230
266
|
const { width, height } = this.ctx.dimensions();
|
|
231
267
|
if (width <= 0 || height <= 0) {
|
|
@@ -325,7 +361,9 @@ class CngxAxis {
|
|
|
325
361
|
[attr.transform]="g.transform"
|
|
326
362
|
[attr.text-anchor]="g.anchor"
|
|
327
363
|
[attr.dominant-baseline]="g.baseline"
|
|
328
|
-
>
|
|
364
|
+
>
|
|
365
|
+
{{ title }}
|
|
366
|
+
</svg:text>
|
|
329
367
|
}
|
|
330
368
|
}
|
|
331
369
|
}
|
|
@@ -385,12 +423,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
385
423
|
[attr.transform]="g.transform"
|
|
386
424
|
[attr.text-anchor]="g.anchor"
|
|
387
425
|
[attr.dominant-baseline]="g.baseline"
|
|
388
|
-
>
|
|
426
|
+
>
|
|
427
|
+
{{ title }}
|
|
428
|
+
</svg:text>
|
|
389
429
|
}
|
|
390
430
|
}
|
|
391
431
|
}
|
|
392
432
|
`, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}\n"] }]
|
|
393
433
|
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], domain: [{ type: i0.Input, args: [{ isSignal: true, alias: "domain", required: false }] }], tickCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "ticks", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showGrid: [{ type: i0.Input, args: [{ isSignal: true, alias: "grid", required: false }] }], axisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
|
|
434
|
+
/** @internal */
|
|
394
435
|
function spread(start, end, count) {
|
|
395
436
|
if (count <= 1) {
|
|
396
437
|
return [start];
|
|
@@ -403,6 +444,7 @@ function spread(start, end, count) {
|
|
|
403
444
|
}
|
|
404
445
|
return out;
|
|
405
446
|
}
|
|
447
|
+
/** @internal */
|
|
406
448
|
function toMs$1(v) {
|
|
407
449
|
if (typeof v === 'number') {
|
|
408
450
|
return v;
|
|
@@ -412,6 +454,7 @@ function toMs$1(v) {
|
|
|
412
454
|
}
|
|
413
455
|
return Number(v);
|
|
414
456
|
}
|
|
457
|
+
/** @internal */
|
|
415
458
|
function buildAxisGeometry(pos, width, height) {
|
|
416
459
|
switch (pos) {
|
|
417
460
|
case 'top':
|
|
@@ -436,6 +479,7 @@ function buildAxisGeometry(pos, width, height) {
|
|
|
436
479
|
};
|
|
437
480
|
}
|
|
438
481
|
}
|
|
482
|
+
/** @internal */
|
|
439
483
|
function buildTickRendering(pos, offset, text, key, width, height) {
|
|
440
484
|
switch (pos) {
|
|
441
485
|
case 'bottom':
|
|
@@ -498,10 +542,12 @@ function buildTickRendering(pos, offset, text, key, width, height) {
|
|
|
498
542
|
}
|
|
499
543
|
/**
|
|
500
544
|
* Default tick label formatter. Strips floating-point arithmetic
|
|
501
|
-
* noise from non-integer numbers
|
|
502
|
-
* `'6.6'`, `2.2` stays `'2.2'`, `25` stays `'25'`
|
|
545
|
+
* noise from non-integer numbers - `6.6000000000000005` becomes
|
|
546
|
+
* `'6.6'`, `2.2` stays `'2.2'`, `25` stays `'25'` - without rounding
|
|
503
547
|
* away meaningful precision. Dates and other types fall through to
|
|
504
548
|
* `String(v)`; consumers needing a richer format bind `[format]`.
|
|
549
|
+
*
|
|
550
|
+
* @internal
|
|
505
551
|
*/
|
|
506
552
|
function defaultTickFormat(v) {
|
|
507
553
|
if (typeof v === 'number') {
|
|
@@ -518,6 +564,7 @@ function defaultTickFormat(v) {
|
|
|
518
564
|
}
|
|
519
565
|
return String(v);
|
|
520
566
|
}
|
|
567
|
+
/** @internal */
|
|
521
568
|
function buildAxisLabelGeometry(pos, width, height) {
|
|
522
569
|
switch (pos) {
|
|
523
570
|
case 'bottom':
|
|
@@ -556,7 +603,21 @@ function buildAxisLabelGeometry(pos, width, height) {
|
|
|
556
603
|
* "line at value" reference. Always reads scales from
|
|
557
604
|
* {@link CNGX_CHART_CONTEXT}.
|
|
558
605
|
*
|
|
559
|
-
* Attribute-selector on `<svg:g>`
|
|
606
|
+
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
607
|
+
*
|
|
608
|
+
* @category common/chart/layers
|
|
609
|
+
* @docsKind primary
|
|
610
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/threshold.component.ts
|
|
611
|
+
* @since 0.1.0
|
|
612
|
+
* @relatedTo CngxBand, CngxChart, CngxLine
|
|
613
|
+
*
|
|
614
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
615
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
616
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
617
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
618
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
619
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
620
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
560
621
|
*/
|
|
561
622
|
class CngxThreshold {
|
|
562
623
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -624,6 +685,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
624
685
|
/**
|
|
625
686
|
* Injection token for chart i18n strings. Defaults to English via
|
|
626
687
|
* `factory:`. Override at app root with {@link provideChartI18n}.
|
|
688
|
+
*
|
|
689
|
+
* @category common/chart/i18n
|
|
690
|
+
* @wcag AA
|
|
691
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/i18n/chart-i18n.ts
|
|
692
|
+
* @since 0.1.0
|
|
627
693
|
*/
|
|
628
694
|
const CNGX_CHART_I18N = new InjectionToken('CngxChartI18n', {
|
|
629
695
|
providedIn: 'root',
|
|
@@ -639,7 +705,11 @@ const CNGX_CHART_I18N = new InjectionToken('CngxChartI18n', {
|
|
|
639
705
|
},
|
|
640
706
|
dataTable: () => 'Data table',
|
|
641
707
|
valueColumnLabel: () => 'Value',
|
|
642
|
-
trendChanged: (trend) => trend === 'up'
|
|
708
|
+
trendChanged: (trend) => trend === 'up'
|
|
709
|
+
? 'Trend changed to up'
|
|
710
|
+
: trend === 'down'
|
|
711
|
+
? 'Trend changed to down'
|
|
712
|
+
: 'Trend flattened',
|
|
643
713
|
thresholdAlert: (threshold) => `Threshold ${threshold} crossed`,
|
|
644
714
|
empty: () => 'No data',
|
|
645
715
|
loading: () => 'Loading',
|
|
@@ -657,6 +727,8 @@ const CNGX_CHART_I18N = new InjectionToken('CngxChartI18n', {
|
|
|
657
727
|
* // ...remaining keys
|
|
658
728
|
* })]
|
|
659
729
|
* ```
|
|
730
|
+
*
|
|
731
|
+
* @category common/chart/i18n
|
|
660
732
|
*/
|
|
661
733
|
function provideChartI18n(i18n) {
|
|
662
734
|
return { provide: CNGX_CHART_I18N, useValue: i18n };
|
|
@@ -771,6 +843,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
771
843
|
/**
|
|
772
844
|
* Threshold (px) below which `CngxChartSlotContext.small` is true.
|
|
773
845
|
* Hardcoded for v1; later releases may make this a config token.
|
|
846
|
+
*
|
|
847
|
+
* @category common/chart
|
|
774
848
|
*/
|
|
775
849
|
const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
776
850
|
/**
|
|
@@ -788,6 +862,11 @@ const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
|
788
862
|
* </ng-template>
|
|
789
863
|
* </cngx-chart>
|
|
790
864
|
* ```
|
|
865
|
+
*
|
|
866
|
+
* @category common/chart
|
|
867
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
868
|
+
* @since 0.1.0
|
|
869
|
+
* @relatedTo CngxChartEmpty, CngxChartError, CngxChart
|
|
791
870
|
*/
|
|
792
871
|
class CngxChartLoading {
|
|
793
872
|
templateRef = inject((TemplateRef));
|
|
@@ -804,9 +883,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
804
883
|
/**
|
|
805
884
|
* Per-instance empty slot for `<cngx-chart>`. Receives a
|
|
806
885
|
* {@link CngxChartSlotContext} so the consumer can branch on chart
|
|
807
|
-
* size
|
|
886
|
+
* size - typically a compact text fallback when `small` is true and
|
|
808
887
|
* a richer surface (`<cngx-empty-state>`, illustration, action) at
|
|
809
888
|
* regular sizes.
|
|
889
|
+
*
|
|
890
|
+
* @category common/chart
|
|
891
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
892
|
+
* @since 0.1.0
|
|
893
|
+
* @relatedTo CngxChartLoading, CngxChartError, CngxChart
|
|
810
894
|
*/
|
|
811
895
|
class CngxChartEmpty {
|
|
812
896
|
templateRef = inject((TemplateRef));
|
|
@@ -821,8 +905,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
821
905
|
}]
|
|
822
906
|
}] });
|
|
823
907
|
/**
|
|
824
|
-
* `*cngxChartError` slot
|
|
908
|
+
* `*cngxChartError` slot - overrides the chart-level error placeholder.
|
|
825
909
|
* Receives a {@link CngxChartErrorContext}.
|
|
910
|
+
*
|
|
911
|
+
* @category common/chart
|
|
912
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
913
|
+
* @since 0.1.0
|
|
914
|
+
* @relatedTo CngxChartLoading, CngxChartEmpty, CngxChart
|
|
826
915
|
*/
|
|
827
916
|
class CngxChartError {
|
|
828
917
|
templateRef = inject((TemplateRef));
|
|
@@ -853,6 +942,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
853
942
|
* from above to below or vice versa anywhere in the projected range.
|
|
854
943
|
* The returned `thresholds` list is the subset of input thresholds
|
|
855
944
|
* the data actually crosses, in input order.
|
|
945
|
+
*
|
|
946
|
+
* @internal
|
|
856
947
|
*/
|
|
857
948
|
function computeChartSummary(values, thresholds) {
|
|
858
949
|
if (values.length === 0) {
|
|
@@ -878,6 +969,7 @@ function computeChartSummary(values, thresholds) {
|
|
|
878
969
|
const crossed = thresholds.filter((t) => crossesThreshold(values, t));
|
|
879
970
|
return { trend, min, max, current, thresholds: crossed };
|
|
880
971
|
}
|
|
972
|
+
/** @internal */
|
|
881
973
|
function crossesThreshold(values, threshold) {
|
|
882
974
|
let above = values[0] > threshold;
|
|
883
975
|
for (let i = 1; i < values.length; i++) {
|
|
@@ -931,13 +1023,17 @@ function dimensionsEqual(a, b) {
|
|
|
931
1023
|
return a.width === b.width && a.height === b.height;
|
|
932
1024
|
}
|
|
933
1025
|
|
|
1026
|
+
/** @internal */
|
|
934
1027
|
const NOOP_SCALE = () => 0;
|
|
1028
|
+
/** @internal */
|
|
935
1029
|
const NOOP_Y_SCALE = () => 0;
|
|
936
1030
|
/**
|
|
937
1031
|
* Stable reference for the default `summaryAccessor`. Exposed so the
|
|
938
1032
|
* dev-mode warning can detect "consumer omitted [summaryAccessor] on
|
|
939
1033
|
* non-numeric data" without false positives when the consumer happens
|
|
940
1034
|
* to pass an identical-looking arrow.
|
|
1035
|
+
*
|
|
1036
|
+
* @internal
|
|
941
1037
|
*/
|
|
942
1038
|
const DEFAULT_SUMMARY_ACCESSOR = (d) => Number(d);
|
|
943
1039
|
/**
|
|
@@ -958,20 +1054,36 @@ const DEFAULT_SUMMARY_ACCESSOR = (d) => Number(d);
|
|
|
958
1054
|
* the X axis (top/bottom position) drives `xScale`, the Y axis
|
|
959
1055
|
* (left/right) drives `yScale`. With no axis present, the
|
|
960
1056
|
* corresponding scale falls back to a no-op `() => 0` and content
|
|
961
|
-
* children may render off-canvas
|
|
1057
|
+
* children may render off-canvas - consumers must mount at least
|
|
962
1058
|
* one axis per direction they actually use.
|
|
963
1059
|
*
|
|
964
1060
|
* The `[width]` / `[height]` inputs override the resize observer for
|
|
965
1061
|
* fixed-dimension presets (inline sparkline at 80×24, etc.).
|
|
1062
|
+
*
|
|
1063
|
+
* @category common/chart
|
|
1064
|
+
* @docsKind primary
|
|
1065
|
+
* @wcag AA
|
|
1066
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart.component.ts
|
|
1067
|
+
* @since 0.1.0
|
|
1068
|
+
* @relatedTo CngxAxis, CngxLine, CngxArea, CngxBar, CngxChartLegend
|
|
1069
|
+
*/
|
|
1070
|
+
/**
|
|
1071
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
1072
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
1073
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
1074
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
1075
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
1076
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
1077
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
966
1078
|
*/
|
|
967
1079
|
class CngxChart {
|
|
968
1080
|
/**
|
|
969
1081
|
* Raw data input. Aliased as `data` at the template-binding level so
|
|
970
1082
|
* consumer markup stays `<cngx-chart [data]="rows">`. The public,
|
|
971
|
-
* typed read surface is the `data<U>()` method below
|
|
1083
|
+
* typed read surface is the `data<U>()` method below - layer atoms
|
|
972
1084
|
* call `this.ctx.data<T>()` to narrow without per-site casts.
|
|
973
1085
|
*
|
|
974
|
-
* @internal
|
|
1086
|
+
* @internal - alias for the public `data<U>()` method
|
|
975
1087
|
*/
|
|
976
1088
|
dataInput = input.required({ ...(ngDevMode ? { debugName: "dataInput" } : /* istanbul ignore next */ {}), alias: 'data' });
|
|
977
1089
|
width = input(undefined, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
@@ -992,9 +1104,9 @@ class CngxChart {
|
|
|
992
1104
|
/**
|
|
993
1105
|
* Controls when the SR-only data-table view is exposed to assistive
|
|
994
1106
|
* technology. `'auto'` (default) shows the table whenever the data
|
|
995
|
-
* has more than one point
|
|
1107
|
+
* has more than one point - a single value is announced via the
|
|
996
1108
|
* `aria-label`, no table needed. `'off'` keeps the table hidden
|
|
997
|
-
* regardless. The table element is always present in the DOM
|
|
1109
|
+
* regardless. The table element is always present in the DOM -
|
|
998
1110
|
* visibility flips through `aria-hidden`, the linked id on
|
|
999
1111
|
* `aria-describedby` never disappears.
|
|
1000
1112
|
*/
|
|
@@ -1010,7 +1122,7 @@ class CngxChart {
|
|
|
1010
1122
|
* Accepts the standard `CngxAsyncState<T>` shape (any producer:
|
|
1011
1123
|
* `createManualState`, `createAsyncState`, `injectAsyncState`,
|
|
1012
1124
|
* `fromHttpResource`, `tap*` pipeline output). The chart provides
|
|
1013
|
-
* `CNGX_STATEFUL` for downstream bridge directives
|
|
1125
|
+
* `CNGX_STATEFUL` for downstream bridge directives - composing
|
|
1014
1126
|
* `<cngx-toast-on />` etc. inside the chart works automatically.
|
|
1015
1127
|
*/
|
|
1016
1128
|
state = input(undefined, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
@@ -1042,7 +1154,7 @@ class CngxChart {
|
|
|
1042
1154
|
* ```
|
|
1043
1155
|
*
|
|
1044
1156
|
* Reads directly from the resize observer (host's actual painted
|
|
1045
|
-
* size)
|
|
1157
|
+
* size) - NOT from `dimensions()` which prefers the logical
|
|
1046
1158
|
* `[width]`/`[height]` inputs. This matters when an explicit
|
|
1047
1159
|
* `[width]="480"` chart squeezes via `max-width: 100%` on a narrow
|
|
1048
1160
|
* viewport: the rendered width is what the consumer cares about
|
|
@@ -1058,7 +1170,7 @@ class CngxChart {
|
|
|
1058
1170
|
};
|
|
1059
1171
|
}, ...(ngDevMode ? [{ debugName: "slotContext" }] : /* istanbul ignore next */ []));
|
|
1060
1172
|
/**
|
|
1061
|
-
* Error-slot context
|
|
1173
|
+
* Error-slot context - extends {@link slotContext} with the live
|
|
1062
1174
|
* error value under `$implicit` and `error` keys, so a consumer can
|
|
1063
1175
|
* render a typed message AND branch on chart size in the same
|
|
1064
1176
|
* template.
|
|
@@ -1129,13 +1241,16 @@ class CngxChart {
|
|
|
1129
1241
|
if (!yAxis) {
|
|
1130
1242
|
return NOOP_Y_SCALE;
|
|
1131
1243
|
}
|
|
1132
|
-
// SVG Y-axis is flipped
|
|
1133
|
-
return this.yScaleCache.get(yAxis.type(), yAxis.domain() ?? [], [
|
|
1244
|
+
// SVG Y-axis is flipped - domain[max] maps to range[0] (top), domain[min] to range[height] (bottom).
|
|
1245
|
+
return this.yScaleCache.get(yAxis.type(), yAxis.domain() ?? [], [
|
|
1246
|
+
height,
|
|
1247
|
+
0,
|
|
1248
|
+
]);
|
|
1134
1249
|
}, { ...(ngDevMode ? { debugName: "yScale" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b });
|
|
1135
1250
|
/**
|
|
1136
1251
|
* Auto-Summary derived from `data` and `<cngx-threshold>` content
|
|
1137
1252
|
* children. Drives the host's reactive `aria-label`. Layer atoms do
|
|
1138
|
-
* not contribute to the summary on Phase 3
|
|
1253
|
+
* not contribute to the summary on Phase 3 - Phase 5/6 may extend
|
|
1139
1254
|
* with per-layer hints.
|
|
1140
1255
|
*/
|
|
1141
1256
|
summary = computed(() => {
|
|
@@ -1231,7 +1346,7 @@ class CngxChart {
|
|
|
1231
1346
|
}, { ...(ngDevMode ? { debugName: "summaryValues" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
1232
1347
|
/**
|
|
1233
1348
|
* Auto-mode predicate. Drives the data-table's `aria-hidden`
|
|
1234
|
-
* binding. The id on `aria-describedby` is invariant
|
|
1349
|
+
* binding. The id on `aria-describedby` is invariant - it stays on
|
|
1235
1350
|
* the host whether the table is active or not. Single-value charts
|
|
1236
1351
|
* speak via the `aria-label` summary; multi-value charts add the
|
|
1237
1352
|
* table for row-by-row exploration.
|
|
@@ -1272,18 +1387,14 @@ class CngxChart {
|
|
|
1272
1387
|
<ng-container *ngTemplateOutlet="tpl; context: errorContext()" />
|
|
1273
1388
|
</div>
|
|
1274
1389
|
} @else {
|
|
1275
|
-
<div
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
>{{ i18n.error() }}</div>
|
|
1390
|
+
<div class="cngx-chart__fallback cngx-chart__fallback--error" [attr.aria-hidden]="true">
|
|
1391
|
+
{{ i18n.error() }}
|
|
1392
|
+
</div>
|
|
1279
1393
|
}
|
|
1280
1394
|
}
|
|
1281
1395
|
@case ('none') {}
|
|
1282
1396
|
@default {
|
|
1283
|
-
<svg
|
|
1284
|
-
[attr.viewBox]="viewBox()"
|
|
1285
|
-
[attr.preserveAspectRatio]="preserveAspectRatio()"
|
|
1286
|
-
>
|
|
1397
|
+
<svg [attr.viewBox]="viewBox()" [attr.preserveAspectRatio]="preserveAspectRatio()">
|
|
1287
1398
|
<svg:title>{{ ariaLabelText() }}</svg:title>
|
|
1288
1399
|
<ng-content />
|
|
1289
1400
|
</svg>
|
|
@@ -1294,7 +1405,7 @@ class CngxChart {
|
|
|
1294
1405
|
[values]="summaryValues()"
|
|
1295
1406
|
[hidden]="!tableActive() || activeView() !== 'content'"
|
|
1296
1407
|
/>
|
|
1297
|
-
`, isInline: true, styles: [":root{--cngx-chart-primary: var(--accent,
|
|
1408
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-chart{display:inline-block;max-width:100%}cngx-chart.cngx-chart--responsive{display:block;width:100%;aspect-ratio:var(--cngx-chart-aspect-ratio, 5 / 2)}cngx-chart>svg{display:block;width:100%;height:100%;overflow:visible}cngx-chart>.cngx-chart__fallback-frame{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart>.cngx-chart__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart .cngx-chart__spinner{width:var(--cngx-chart-spinner-size, 32px);height:var(--cngx-chart-spinner-size, 32px);border:var(--cngx-chart-spinner-thickness, 3px) solid var(--cngx-chart-spinner-track, rgb(0 0 0 / .08));border-top-color:var(--cngx-chart-spinner-color, var(--cngx-chart-primary, currentColor));border-radius:50%;animation:cngx-chart-spin .8s linear infinite}cngx-chart>.cngx-chart__fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:var(--cngx-chart-fallback-min-height, 48px);font-size:var(--cngx-chart-fallback-font-size, .875rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-chart-fallback-opacity, .7);padding:var(--cngx-chart-fallback-padding, 1rem);text-align:center;box-sizing:border-box}cngx-chart>.cngx-chart__fallback--error{color:var(--cngx-chart-danger, currentColor);opacity:1}@keyframes cngx-chart-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){cngx-chart .cngx-chart__spinner{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChartDataTable, selector: "cngx-chart-data-table", inputs: ["values", "hidden", "id"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1298
1409
|
}
|
|
1299
1410
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChart, decorators: [{
|
|
1300
1411
|
type: Component,
|
|
@@ -1334,18 +1445,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1334
1445
|
<ng-container *ngTemplateOutlet="tpl; context: errorContext()" />
|
|
1335
1446
|
</div>
|
|
1336
1447
|
} @else {
|
|
1337
|
-
<div
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
>{{ i18n.error() }}</div>
|
|
1448
|
+
<div class="cngx-chart__fallback cngx-chart__fallback--error" [attr.aria-hidden]="true">
|
|
1449
|
+
{{ i18n.error() }}
|
|
1450
|
+
</div>
|
|
1341
1451
|
}
|
|
1342
1452
|
}
|
|
1343
1453
|
@case ('none') {}
|
|
1344
1454
|
@default {
|
|
1345
|
-
<svg
|
|
1346
|
-
[attr.viewBox]="viewBox()"
|
|
1347
|
-
[attr.preserveAspectRatio]="preserveAspectRatio()"
|
|
1348
|
-
>
|
|
1455
|
+
<svg [attr.viewBox]="viewBox()" [attr.preserveAspectRatio]="preserveAspectRatio()">
|
|
1349
1456
|
<svg:title>{{ ariaLabelText() }}</svg:title>
|
|
1350
1457
|
<ng-content />
|
|
1351
1458
|
</svg>
|
|
@@ -1356,14 +1463,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1356
1463
|
[values]="summaryValues()"
|
|
1357
1464
|
[hidden]="!tableActive() || activeView() !== 'content'"
|
|
1358
1465
|
/>
|
|
1359
|
-
`, styles: [":root{--cngx-chart-primary: var(--accent,
|
|
1466
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-chart{display:inline-block;max-width:100%}cngx-chart.cngx-chart--responsive{display:block;width:100%;aspect-ratio:var(--cngx-chart-aspect-ratio, 5 / 2)}cngx-chart>svg{display:block;width:100%;height:100%;overflow:visible}cngx-chart>.cngx-chart__fallback-frame{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart>.cngx-chart__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart .cngx-chart__spinner{width:var(--cngx-chart-spinner-size, 32px);height:var(--cngx-chart-spinner-size, 32px);border:var(--cngx-chart-spinner-thickness, 3px) solid var(--cngx-chart-spinner-track, rgb(0 0 0 / .08));border-top-color:var(--cngx-chart-spinner-color, var(--cngx-chart-primary, currentColor));border-radius:50%;animation:cngx-chart-spin .8s linear infinite}cngx-chart>.cngx-chart__fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:var(--cngx-chart-fallback-min-height, 48px);font-size:var(--cngx-chart-fallback-font-size, .875rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-chart-fallback-opacity, .7);padding:var(--cngx-chart-fallback-padding, 1rem);text-align:center;box-sizing:border-box}cngx-chart>.cngx-chart__fallback--error{color:var(--cngx-chart-danger, currentColor);opacity:1}@keyframes cngx-chart-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){cngx-chart .cngx-chart__spinner{animation:none}}\n"] }]
|
|
1360
1467
|
}], ctorParameters: () => [], propDecorators: { dataInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], preserveAspectRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "preserveAspectRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], summaryAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "summaryAccessor", required: false }] }], accessibleTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibleTable", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], axes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxAxis), { ...{ descendants: true }, isSignal: true }] }], thresholds: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxThreshold), { ...{ descendants: true }, isSignal: true }] }], loadingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartLoading), { isSignal: true }] }], emptySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartEmpty), { isSignal: true }] }], errorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartError), { isSignal: true }] }] } });
|
|
1468
|
+
/** @internal */
|
|
1361
1469
|
function isHorizontalPosition(p) {
|
|
1362
1470
|
return p === 'top' || p === 'bottom';
|
|
1363
1471
|
}
|
|
1472
|
+
/** @internal */
|
|
1364
1473
|
function isVerticalPosition(p) {
|
|
1365
1474
|
return p === 'left' || p === 'right';
|
|
1366
1475
|
}
|
|
1476
|
+
/** @internal */
|
|
1367
1477
|
function buildScale(type, domain, range) {
|
|
1368
1478
|
if (domain.length < 2) {
|
|
1369
1479
|
return NOOP_SCALE;
|
|
@@ -1382,12 +1492,13 @@ function buildScale(type, domain, range) {
|
|
|
1382
1492
|
// createBandScale returns the leading edge; chart consumers
|
|
1383
1493
|
// (ticks, line/area/scatter, threshold/band yScale) want the
|
|
1384
1494
|
// centre so ticks align with their slot and lines trace through
|
|
1385
|
-
// bar centres. Bar atom uses its own slot logic
|
|
1495
|
+
// bar centres. Bar atom uses its own slot logic - unaffected.
|
|
1386
1496
|
const half = band.bandwidth() / 2;
|
|
1387
1497
|
return (v) => band(v) + half;
|
|
1388
1498
|
}
|
|
1389
1499
|
}
|
|
1390
1500
|
}
|
|
1501
|
+
/** @internal */
|
|
1391
1502
|
function createScaleLru() {
|
|
1392
1503
|
let lastType = null;
|
|
1393
1504
|
let lastDomainLen = -1;
|
|
@@ -1426,6 +1537,7 @@ function createScaleLru() {
|
|
|
1426
1537
|
},
|
|
1427
1538
|
};
|
|
1428
1539
|
}
|
|
1540
|
+
/** @internal */
|
|
1429
1541
|
function endpointKey(v) {
|
|
1430
1542
|
if (v instanceof Date) {
|
|
1431
1543
|
return v.getTime();
|
|
@@ -1435,6 +1547,7 @@ function endpointKey(v) {
|
|
|
1435
1547
|
}
|
|
1436
1548
|
return String(v);
|
|
1437
1549
|
}
|
|
1550
|
+
/** @internal */
|
|
1438
1551
|
function toMs(v) {
|
|
1439
1552
|
if (typeof v === 'number') {
|
|
1440
1553
|
return v;
|
|
@@ -1446,7 +1559,7 @@ function toMs(v) {
|
|
|
1446
1559
|
}
|
|
1447
1560
|
|
|
1448
1561
|
/**
|
|
1449
|
-
* Presentational legend atom
|
|
1562
|
+
* Presentational legend atom - a row (or column) of coloured swatches
|
|
1450
1563
|
* paired with labels. Decoupled from `<cngx-chart>` and the layer
|
|
1451
1564
|
* atoms by design: the consumer drives the items array, so the
|
|
1452
1565
|
* legend stays a pure rendering surface with zero opinions about
|
|
@@ -1473,6 +1586,13 @@ function toMs(v) {
|
|
|
1473
1586
|
* `--cngx-chart-legend-font-size`. `[orientation]` flips between row
|
|
1474
1587
|
* and column; `[align]` aligns along the main axis (`start`, `center`,
|
|
1475
1588
|
* `end`).
|
|
1589
|
+
*
|
|
1590
|
+
* @category common/chart/legend
|
|
1591
|
+
* @docsKind primary
|
|
1592
|
+
* @wcag AA
|
|
1593
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/legend/legend.component.ts
|
|
1594
|
+
* @since 0.1.0
|
|
1595
|
+
* @relatedTo CngxChart, CngxLine, CngxBar
|
|
1476
1596
|
*/
|
|
1477
1597
|
class CngxChartLegend {
|
|
1478
1598
|
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
@@ -1533,6 +1653,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1533
1653
|
* overshoots between data points.
|
|
1534
1654
|
* @returns The full path data starting with `M`. Returns `''` when
|
|
1535
1655
|
* the input is empty; `M x y` when the input has one point.
|
|
1656
|
+
*
|
|
1657
|
+
* @category common/chart/path
|
|
1536
1658
|
*/
|
|
1537
1659
|
function buildCurvePath(points, curve) {
|
|
1538
1660
|
if (points.length === 0) {
|
|
@@ -1547,6 +1669,7 @@ function buildCurvePath(points, curve) {
|
|
|
1547
1669
|
}
|
|
1548
1670
|
return buildMonotonePath(points);
|
|
1549
1671
|
}
|
|
1672
|
+
/** @internal */
|
|
1550
1673
|
function buildLinearPath(points) {
|
|
1551
1674
|
const start = points[0];
|
|
1552
1675
|
let out = `M ${start.x} ${start.y}`;
|
|
@@ -1559,6 +1682,8 @@ function buildLinearPath(points) {
|
|
|
1559
1682
|
* Monotone cubic Bézier interpolation (Fritsch-Carlson tangents on the
|
|
1560
1683
|
* X dimension). Input points must have strictly increasing `x`
|
|
1561
1684
|
* coordinates.
|
|
1685
|
+
*
|
|
1686
|
+
* @internal
|
|
1562
1687
|
*/
|
|
1563
1688
|
function buildMonotonePath(points) {
|
|
1564
1689
|
const n = points.length;
|
|
@@ -1597,7 +1722,7 @@ function buildMonotonePath(points) {
|
|
|
1597
1722
|
/**
|
|
1598
1723
|
* Pure-TS path builder with single-slot LRU memo on
|
|
1599
1724
|
* `(data, xScale, yScale)` reference identity. Pure TS, no Angular
|
|
1600
|
-
* dep. Compute guard only
|
|
1725
|
+
* dep. Compute guard only - does not know about signals or `equal`
|
|
1601
1726
|
* functions; the `d` computed in `<cngx-line>` carries the cascade
|
|
1602
1727
|
* guard separately.
|
|
1603
1728
|
*
|
|
@@ -1606,13 +1731,15 @@ function buildMonotonePath(points) {
|
|
|
1606
1731
|
* triggers a rebuild and updates the slot.
|
|
1607
1732
|
*
|
|
1608
1733
|
* Each call to `createPathBuilder` returns a fresh builder with its
|
|
1609
|
-
* own `lastData / lastX / lastY` slots
|
|
1734
|
+
* own `lastData / lastX / lastY` slots - there is no cross-call /
|
|
1610
1735
|
* cross-consumer state. The cascade guard for layer atoms is the
|
|
1611
1736
|
* `equal: (a, b) => a === b` on the `builder` `computed`; combined
|
|
1612
1737
|
* with Angular signals' default behaviour of skipping re-emissions
|
|
1613
1738
|
* when the inputs to the `computed` are unchanged, two consecutive
|
|
1614
1739
|
* cascade ticks with the same `(y, x, curve)` produce the same
|
|
1615
1740
|
* builder instance.
|
|
1741
|
+
*
|
|
1742
|
+
* @category common/chart/path
|
|
1616
1743
|
*/
|
|
1617
1744
|
function createPathBuilder(opts) {
|
|
1618
1745
|
const yAcc = opts.y;
|
|
@@ -1642,6 +1769,7 @@ function createPathBuilder(opts) {
|
|
|
1642
1769
|
},
|
|
1643
1770
|
};
|
|
1644
1771
|
}
|
|
1772
|
+
/** @internal */
|
|
1645
1773
|
function projectPoints(data, xAcc, yAcc, xScale, yScale) {
|
|
1646
1774
|
const out = new Array(data.length);
|
|
1647
1775
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -1665,6 +1793,20 @@ function projectPoints(data, xAcc, yAcc, xScale, yScale) {
|
|
|
1665
1793
|
* geometry actually changes. The `createPathBuilder` cache provides
|
|
1666
1794
|
* the **compute guard** — same `(data, xScale, yScale)` triple by
|
|
1667
1795
|
* reference skips the per-datapoint projection work.
|
|
1796
|
+
*
|
|
1797
|
+
* @category common/chart/layers
|
|
1798
|
+
* @docsKind primary
|
|
1799
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/line.component.ts
|
|
1800
|
+
* @since 0.1.0
|
|
1801
|
+
* @relatedTo CngxArea, CngxScatter, CngxBar, CngxChart
|
|
1802
|
+
*
|
|
1803
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
1804
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
1805
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
1806
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
1807
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
1808
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
1809
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1668
1810
|
*/
|
|
1669
1811
|
class CngxLine {
|
|
1670
1812
|
accessor = input((d) => Number(d), ...(ngDevMode ? [{ debugName: "accessor" }] : /* istanbul ignore next */ []));
|
|
@@ -1724,6 +1866,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1724
1866
|
*
|
|
1725
1867
|
* The `d` string is cascade-guarded with string equality on its
|
|
1726
1868
|
* `computed` so a no-op data refresh does not force a fill repaint.
|
|
1869
|
+
*
|
|
1870
|
+
* @category common/chart/layers
|
|
1871
|
+
* @docsKind primary
|
|
1872
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/area.component.ts
|
|
1873
|
+
* @since 0.1.0
|
|
1874
|
+
* @relatedTo CngxLine, CngxBand, CngxThreshold, CngxChart
|
|
1875
|
+
*
|
|
1876
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
1877
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
1878
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
1879
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
1880
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
1881
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
1882
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1727
1883
|
*/
|
|
1728
1884
|
class CngxArea {
|
|
1729
1885
|
accessor = input((d) => Number(d), ...(ngDevMode ? [{ debugName: "accessor" }] : /* istanbul ignore next */ []));
|
|
@@ -1779,6 +1935,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1779
1935
|
`, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-area{animation:none}}\n"] }]
|
|
1780
1936
|
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
1781
1937
|
|
|
1938
|
+
/** @internal */
|
|
1782
1939
|
const FALLBACK_BASELINE = 0;
|
|
1783
1940
|
/**
|
|
1784
1941
|
* Bar layer atom. Renders one `<rect>` per datapoint. Bar width comes
|
|
@@ -1791,6 +1948,20 @@ const FALLBACK_BASELINE = 0;
|
|
|
1791
1948
|
* interchangeably.
|
|
1792
1949
|
*
|
|
1793
1950
|
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
1951
|
+
*
|
|
1952
|
+
* @category common/chart/layers
|
|
1953
|
+
* @docsKind primary
|
|
1954
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/bar.component.ts
|
|
1955
|
+
* @since 0.1.0
|
|
1956
|
+
* @relatedTo CngxLine, CngxArea, CngxStackedBar, CngxChart
|
|
1957
|
+
*
|
|
1958
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
1959
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
1960
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
1961
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
1962
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
1963
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
1964
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1794
1965
|
*/
|
|
1795
1966
|
class CngxBar {
|
|
1796
1967
|
accessor = input(((d) => Number(d)), ...(ngDevMode ? [{ debugName: "accessor" }] : /* istanbul ignore next */ []));
|
|
@@ -1862,6 +2033,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1862
2033
|
}
|
|
1863
2034
|
`, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}\n"] }]
|
|
1864
2035
|
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
2036
|
+
/** @internal */
|
|
1865
2037
|
function clamp01(v) {
|
|
1866
2038
|
if (v < 0) {
|
|
1867
2039
|
return 0;
|
|
@@ -1871,6 +2043,7 @@ function clamp01(v) {
|
|
|
1871
2043
|
}
|
|
1872
2044
|
return v;
|
|
1873
2045
|
}
|
|
2046
|
+
/** @internal */
|
|
1874
2047
|
function rectsEqual(a, b) {
|
|
1875
2048
|
if (a === b) {
|
|
1876
2049
|
return true;
|
|
@@ -1890,10 +2063,24 @@ function rectsEqual(a, b) {
|
|
|
1890
2063
|
|
|
1891
2064
|
/**
|
|
1892
2065
|
* Scatter layer atom. Renders one `<circle>` per datapoint. X and Y
|
|
1893
|
-
* accessors are independent
|
|
2066
|
+
* accessors are independent - neither defaults to index, since the
|
|
1894
2067
|
* defining trait of a scatter chart is two genuine data dimensions.
|
|
1895
2068
|
*
|
|
1896
|
-
* Attribute-selector on `<svg:g>`
|
|
2069
|
+
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2070
|
+
*
|
|
2071
|
+
* @category common/chart/layers
|
|
2072
|
+
* @docsKind primary
|
|
2073
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/scatter.component.ts
|
|
2074
|
+
* @since 0.1.0
|
|
2075
|
+
* @relatedTo CngxLine, CngxBar, CngxArea, CngxChart
|
|
2076
|
+
*
|
|
2077
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2078
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2079
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2080
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2081
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2082
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2083
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1897
2084
|
*/
|
|
1898
2085
|
class CngxScatter {
|
|
1899
2086
|
x = input.required(...(ngDevMode ? [{ debugName: "x" }] : /* istanbul ignore next */ []));
|
|
@@ -1927,12 +2114,7 @@ class CngxScatter {
|
|
|
1927
2114
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScatter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1928
2115
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxScatter, isStandalone: true, selector: "[cngxScatter]", inputs: { x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: true, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: true, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxScatter"], ngImport: i0, template: `
|
|
1929
2116
|
@for (c of circles(); track c.key) {
|
|
1930
|
-
<svg:circle
|
|
1931
|
-
class="cngx-scatter"
|
|
1932
|
-
[attr.cx]="c.cx"
|
|
1933
|
-
[attr.cy]="c.cy"
|
|
1934
|
-
[attr.r]="radius()"
|
|
1935
|
-
/>
|
|
2117
|
+
<svg:circle class="cngx-scatter" [attr.cx]="c.cx" [attr.cy]="c.cy" [attr.r]="radius()" />
|
|
1936
2118
|
}
|
|
1937
2119
|
`, isInline: true, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1938
2120
|
}
|
|
@@ -1940,15 +2122,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1940
2122
|
type: Component,
|
|
1941
2123
|
args: [{ selector: '[cngxScatter]', exportAs: 'cngxScatter', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: `
|
|
1942
2124
|
@for (c of circles(); track c.key) {
|
|
1943
|
-
<svg:circle
|
|
1944
|
-
class="cngx-scatter"
|
|
1945
|
-
[attr.cx]="c.cx"
|
|
1946
|
-
[attr.cy]="c.cy"
|
|
1947
|
-
[attr.r]="radius()"
|
|
1948
|
-
/>
|
|
2125
|
+
<svg:circle class="cngx-scatter" [attr.cx]="c.cx" [attr.cy]="c.cy" [attr.r]="radius()" />
|
|
1949
2126
|
}
|
|
1950
2127
|
`, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}\n"] }]
|
|
1951
2128
|
}], propDecorators: { x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: true }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: true }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
2129
|
+
/** @internal */
|
|
1952
2130
|
function circlesEqual(a, b) {
|
|
1953
2131
|
if (a === b) {
|
|
1954
2132
|
return true;
|
|
@@ -1973,6 +2151,20 @@ function circlesEqual(a, b) {
|
|
|
1973
2151
|
* band sits behind line / area / bar layers without dominating.
|
|
1974
2152
|
*
|
|
1975
2153
|
* Attribute-selector on `<svg:g>` — see {@link CngxLine} for why.
|
|
2154
|
+
*
|
|
2155
|
+
* @category common/chart/layers
|
|
2156
|
+
* @docsKind primary
|
|
2157
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/band.component.ts
|
|
2158
|
+
* @since 0.1.0
|
|
2159
|
+
* @relatedTo CngxThreshold, CngxArea, CngxChart
|
|
2160
|
+
*
|
|
2161
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2162
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2163
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2164
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2165
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2166
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2167
|
+
* <example-url>http://localhost:4200/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1976
2168
|
*/
|
|
1977
2169
|
class CngxBand {
|
|
1978
2170
|
from = input.required(...(ngDevMode ? [{ debugName: "from" }] : /* istanbul ignore next */ []));
|
|
@@ -2077,7 +2269,7 @@ function injectPresetState(state) {
|
|
|
2077
2269
|
}
|
|
2078
2270
|
|
|
2079
2271
|
/**
|
|
2080
|
-
* Inline sparkline
|
|
2272
|
+
* Inline sparkline - a tiny line chart for KPI cards and dashboard
|
|
2081
2273
|
* tiles. Composes `<cngx-chart>` + `<cngx-line>` (+ optional
|
|
2082
2274
|
* `<cngx-area>`) with hidden axes that publish the scale domain
|
|
2083
2275
|
* derived from the `data` array.
|
|
@@ -2089,6 +2281,17 @@ function injectPresetState(state) {
|
|
|
2089
2281
|
* The host carries `role="img"` and a reactive `aria-label` derived
|
|
2090
2282
|
* from the chart's auto-Summary; consumers can override via
|
|
2091
2283
|
* `[ariaLabel]`.
|
|
2284
|
+
*
|
|
2285
|
+
* @category common/chart/presets
|
|
2286
|
+
* @docsKind primary
|
|
2287
|
+
* @wcag AA
|
|
2288
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/sparkline.component.ts
|
|
2289
|
+
* @since 0.1.0
|
|
2290
|
+
* @relatedTo CngxMiniArea, CngxMiniBar, CngxChart
|
|
2291
|
+
*
|
|
2292
|
+
* <example-url>http://localhost:4200/#/common/chart/sparkline/async-state-machine</example-url>
|
|
2293
|
+
* <example-url>http://localhost:4200/#/common/chart/sparkline/basic-sparklines</example-url>
|
|
2294
|
+
* <example-url>http://localhost:4200/#/common/chart/sparkline/with-area-fill</example-url>
|
|
2092
2295
|
*/
|
|
2093
2296
|
class CngxSparkline {
|
|
2094
2297
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -2161,7 +2364,7 @@ class CngxSparkline {
|
|
|
2161
2364
|
</cngx-chart>
|
|
2162
2365
|
}
|
|
2163
2366
|
}
|
|
2164
|
-
`, isInline: true, styles: ["cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline [cngxAxis]{display:none}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state"], exportAs: ["cngxChart"] }, { kind: "component", type: CngxAxis, selector: "[cngxAxis]", inputs: ["position", "type", "domain", "ticks", "format", "grid", "label"], exportAs: ["cngxAxis"] }, { kind: "component", type: CngxLine, selector: "[cngxLine]", inputs: ["accessor", "xAccessor", "color", "strokeWidth", "curve", "data"], exportAs: ["cngxLine"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "curve", "baseline", "data"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2367
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline [cngxAxis]{display:none}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state"], exportAs: ["cngxChart"] }, { kind: "component", type: CngxAxis, selector: "[cngxAxis]", inputs: ["position", "type", "domain", "ticks", "format", "grid", "label"], exportAs: ["cngxAxis"] }, { kind: "component", type: CngxLine, selector: "[cngxLine]", inputs: ["accessor", "xAccessor", "color", "strokeWidth", "curve", "data"], exportAs: ["cngxLine"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "curve", "baseline", "data"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2165
2368
|
}
|
|
2166
2369
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSparkline, decorators: [{
|
|
2167
2370
|
type: Component,
|
|
@@ -2199,15 +2402,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2199
2402
|
</cngx-chart>
|
|
2200
2403
|
}
|
|
2201
2404
|
}
|
|
2202
|
-
`, styles: ["cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline [cngxAxis]{display:none}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"] }]
|
|
2405
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline [cngxAxis]{display:none}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"] }]
|
|
2203
2406
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], showArea: [{ type: i0.Input, args: [{ isSignal: true, alias: "showArea", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
2204
2407
|
|
|
2205
2408
|
/**
|
|
2206
|
-
* Mini horizontal bar
|
|
2409
|
+
* Mini horizontal bar - a single-value bounded indicator. Renders
|
|
2207
2410
|
* pure DOM (no SVG), positioned with CSS only. Host carries
|
|
2208
2411
|
* `role="meter"` per the WAI-ARIA pattern for single-value bounded
|
|
2209
2412
|
* indicators; `aria-valuenow` / `aria-valuemin` / `aria-valuemax`
|
|
2210
2413
|
* tell AT the exact reading without a separate Summary.
|
|
2414
|
+
*
|
|
2415
|
+
* @category common/chart/presets
|
|
2416
|
+
* @docsKind primary
|
|
2417
|
+
* @wcag AA
|
|
2418
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/mini-bar.component.ts
|
|
2419
|
+
* @since 0.1.0
|
|
2420
|
+
* @relatedTo CngxMiniArea, CngxSparkline, CngxDonut, CngxBullet
|
|
2421
|
+
*
|
|
2422
|
+
* <example-url>http://localhost:4200/#/common/chart/mini-bar/async-state-machine</example-url>
|
|
2423
|
+
* <example-url>http://localhost:4200/#/common/chart/mini-bar/basic-readings</example-url>
|
|
2211
2424
|
*/
|
|
2212
2425
|
class CngxMiniBar {
|
|
2213
2426
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -2239,7 +2452,11 @@ class CngxMiniBar {
|
|
|
2239
2452
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniBar, isStandalone: true, selector: "cngx-mini-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-mini-bar" }, exportAs: ["cngxMiniBar"], ngImport: i0, template: `
|
|
2240
2453
|
@switch (activeView()) {
|
|
2241
2454
|
@case ('skeleton') {
|
|
2242
|
-
<span
|
|
2455
|
+
<span
|
|
2456
|
+
class="cngx-preset-skeleton"
|
|
2457
|
+
[attr.aria-busy]="true"
|
|
2458
|
+
[attr.aria-label]="i18n.loading()"
|
|
2459
|
+
></span>
|
|
2243
2460
|
}
|
|
2244
2461
|
@case ('empty') {
|
|
2245
2462
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2254,7 +2471,7 @@ class CngxMiniBar {
|
|
|
2254
2471
|
</div>
|
|
2255
2472
|
}
|
|
2256
2473
|
}
|
|
2257
|
-
`, isInline: true, styles: ["cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2474
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2258
2475
|
}
|
|
2259
2476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniBar, decorators: [{
|
|
2260
2477
|
type: Component,
|
|
@@ -2268,7 +2485,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2268
2485
|
}, template: `
|
|
2269
2486
|
@switch (activeView()) {
|
|
2270
2487
|
@case ('skeleton') {
|
|
2271
|
-
<span
|
|
2488
|
+
<span
|
|
2489
|
+
class="cngx-preset-skeleton"
|
|
2490
|
+
[attr.aria-busy]="true"
|
|
2491
|
+
[attr.aria-label]="i18n.loading()"
|
|
2492
|
+
></span>
|
|
2272
2493
|
}
|
|
2273
2494
|
@case ('empty') {
|
|
2274
2495
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2283,17 +2504,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2283
2504
|
</div>
|
|
2284
2505
|
}
|
|
2285
2506
|
}
|
|
2286
|
-
`, styles: ["cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2507
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2287
2508
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
2288
2509
|
|
|
2289
2510
|
/**
|
|
2290
|
-
* Mini deviation bar
|
|
2511
|
+
* Mini deviation bar - a single-value indicator that diverges from a
|
|
2291
2512
|
* `[baseline]` (default `0`) in either direction. Negative deviations
|
|
2292
2513
|
* render to the left of the baseline mark, positive to the right.
|
|
2293
2514
|
* Pure DOM, no SVG. Host carries `role="meter"`.
|
|
2294
2515
|
*
|
|
2295
2516
|
* Use cases: budget variance ("$+45k over"), score deltas ("−12%
|
|
2296
2517
|
* vs target"), KPI swing visualisations.
|
|
2518
|
+
*
|
|
2519
|
+
* @category common/chart/presets
|
|
2520
|
+
* @docsKind primary
|
|
2521
|
+
* @wcag AA
|
|
2522
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/deviation-bar.component.ts
|
|
2523
|
+
* @since 0.1.0
|
|
2524
|
+
* @relatedTo CngxMiniBar, CngxBullet, CngxStackedBar
|
|
2525
|
+
*
|
|
2526
|
+
* <example-url>http://localhost:4200/#/common/chart/deviation-bar/async-state-machine</example-url>
|
|
2527
|
+
* <example-url>http://localhost:4200/#/common/chart/deviation-bar/variance-readings</example-url>
|
|
2297
2528
|
*/
|
|
2298
2529
|
class CngxDeviationBar {
|
|
2299
2530
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -2326,7 +2557,11 @@ class CngxDeviationBar {
|
|
|
2326
2557
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDeviationBar, isStandalone: true, selector: "cngx-deviation-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, magnitude: { classPropertyName: "magnitude", publicName: "magnitude", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "-magnitude()", "attr.aria-valuemax": "magnitude()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-deviation-bar" }, exportAs: ["cngxDeviationBar"], ngImport: i0, template: `
|
|
2327
2558
|
@switch (activeView()) {
|
|
2328
2559
|
@case ('skeleton') {
|
|
2329
|
-
<span
|
|
2560
|
+
<span
|
|
2561
|
+
class="cngx-preset-skeleton"
|
|
2562
|
+
[attr.aria-busy]="true"
|
|
2563
|
+
[attr.aria-label]="i18n.loading()"
|
|
2564
|
+
></span>
|
|
2330
2565
|
}
|
|
2331
2566
|
@case ('empty') {
|
|
2332
2567
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2350,7 +2585,7 @@ class CngxDeviationBar {
|
|
|
2350
2585
|
</div>
|
|
2351
2586
|
}
|
|
2352
2587
|
}
|
|
2353
|
-
`, isInline: true, styles: ["cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var(--cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor));opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2588
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var( --cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)) );border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var( --cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor) );opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2354
2589
|
}
|
|
2355
2590
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDeviationBar, decorators: [{
|
|
2356
2591
|
type: Component,
|
|
@@ -2364,7 +2599,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2364
2599
|
}, template: `
|
|
2365
2600
|
@switch (activeView()) {
|
|
2366
2601
|
@case ('skeleton') {
|
|
2367
|
-
<span
|
|
2602
|
+
<span
|
|
2603
|
+
class="cngx-preset-skeleton"
|
|
2604
|
+
[attr.aria-busy]="true"
|
|
2605
|
+
[attr.aria-label]="i18n.loading()"
|
|
2606
|
+
></span>
|
|
2368
2607
|
}
|
|
2369
2608
|
@case ('empty') {
|
|
2370
2609
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2388,14 +2627,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2388
2627
|
</div>
|
|
2389
2628
|
}
|
|
2390
2629
|
}
|
|
2391
|
-
`, styles: ["cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var(--cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor));opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2630
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var( --cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)) );border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var( --cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor) );opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2392
2631
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], magnitude: [{ type: i0.Input, args: [{ isSignal: true, alias: "magnitude", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
2393
2632
|
|
|
2394
2633
|
/**
|
|
2395
|
-
* Inline mini area
|
|
2634
|
+
* Inline mini area - a tiny filled-area chart for KPI cards. Sibling
|
|
2396
2635
|
* of {@link CngxSparkline}; renders only the area (no line stroke).
|
|
2397
2636
|
* Default viewBox 80×24. Theming via `--cngx-mini-area-color`
|
|
2398
2637
|
* (atom-local) → `--cngx-chart-primary` (chart-level) cascade.
|
|
2638
|
+
*
|
|
2639
|
+
* @category common/chart/presets
|
|
2640
|
+
* @docsKind primary
|
|
2641
|
+
* @wcag AA
|
|
2642
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/mini-area.component.ts
|
|
2643
|
+
* @since 0.1.0
|
|
2644
|
+
* @relatedTo CngxSparkline, CngxMiniBar, CngxChart
|
|
2645
|
+
*
|
|
2646
|
+
* <example-url>http://localhost:4200/#/common/chart/mini-area/async-state-machine</example-url>
|
|
2647
|
+
* <example-url>http://localhost:4200/#/common/chart/mini-area/inline-area-trends</example-url>
|
|
2399
2648
|
*/
|
|
2400
2649
|
class CngxMiniArea {
|
|
2401
2650
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -2464,7 +2713,7 @@ class CngxMiniArea {
|
|
|
2464
2713
|
</cngx-chart>
|
|
2465
2714
|
}
|
|
2466
2715
|
}
|
|
2467
|
-
`, isInline: true, styles: ["cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area [cngxAxis]{display:none}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state"], exportAs: ["cngxChart"] }, { kind: "component", type: CngxAxis, selector: "[cngxAxis]", inputs: ["position", "type", "domain", "ticks", "format", "grid", "label"], exportAs: ["cngxAxis"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "curve", "baseline", "data"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2716
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area [cngxAxis]{display:none}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state"], exportAs: ["cngxChart"] }, { kind: "component", type: CngxAxis, selector: "[cngxAxis]", inputs: ["position", "type", "domain", "ticks", "format", "grid", "label"], exportAs: ["cngxAxis"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "curve", "baseline", "data"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2468
2717
|
}
|
|
2469
2718
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniArea, decorators: [{
|
|
2470
2719
|
type: Component,
|
|
@@ -2499,15 +2748,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2499
2748
|
</cngx-chart>
|
|
2500
2749
|
}
|
|
2501
2750
|
}
|
|
2502
|
-
`, styles: ["cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area [cngxAxis]{display:none}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2751
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area [cngxAxis]{display:none}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2503
2752
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
2504
2753
|
|
|
2754
|
+
/** @internal */
|
|
2505
2755
|
const TWO_PI = Math.PI * 2;
|
|
2506
2756
|
/**
|
|
2507
|
-
* Circular donut gauge
|
|
2757
|
+
* Circular donut gauge - a single-value bounded indicator. Renders a
|
|
2508
2758
|
* background ring + a foreground arc whose length is proportional to
|
|
2509
2759
|
* `value / max`. Host carries `role="meter"`; the optional `[label]`
|
|
2510
2760
|
* input renders an SR-only label inside the ring's centre.
|
|
2761
|
+
*
|
|
2762
|
+
* @category common/chart/presets
|
|
2763
|
+
* @docsKind primary
|
|
2764
|
+
* @wcag AA
|
|
2765
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/donut.component.ts
|
|
2766
|
+
* @since 0.1.0
|
|
2767
|
+
* @relatedTo CngxBullet, CngxMiniBar, CngxDeviationBar
|
|
2768
|
+
*
|
|
2769
|
+
* <example-url>http://localhost:4200/#/common/chart/donut/async-state-machine</example-url>
|
|
2770
|
+
* <example-url>http://localhost:4200/#/common/chart/donut/score-gauges</example-url>
|
|
2511
2771
|
*/
|
|
2512
2772
|
class CngxDonut {
|
|
2513
2773
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -2588,7 +2848,7 @@ class CngxDonut {
|
|
|
2588
2848
|
}
|
|
2589
2849
|
}
|
|
2590
2850
|
}
|
|
2591
|
-
`, isInline: true, styles: ["cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2851
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2592
2852
|
}
|
|
2593
2853
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDonut, decorators: [{
|
|
2594
2854
|
type: Component,
|
|
@@ -2650,14 +2910,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2650
2910
|
}
|
|
2651
2911
|
}
|
|
2652
2912
|
}
|
|
2653
|
-
`, styles: ["cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2913
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2654
2914
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
2655
2915
|
|
|
2656
2916
|
/**
|
|
2657
|
-
* Bullet chart
|
|
2917
|
+
* Bullet chart - Stephen Few's compact KPI visualisation. Three
|
|
2658
2918
|
* stacked layers: background `[ranges]` (qualitative bands), an
|
|
2659
2919
|
* `[actual]` filled bar, and a `[target]` vertical marker. Pure DOM,
|
|
2660
2920
|
* no SVG. Host carries `role="meter"`.
|
|
2921
|
+
*
|
|
2922
|
+
* @category common/chart/presets
|
|
2923
|
+
* @docsKind primary
|
|
2924
|
+
* @wcag AA
|
|
2925
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/bullet.component.ts
|
|
2926
|
+
* @since 0.1.0
|
|
2927
|
+
* @relatedTo CngxDonut, CngxMiniBar, CngxDeviationBar
|
|
2928
|
+
*
|
|
2929
|
+
* <example-url>http://localhost:4200/#/common/chart/bullet/async-state-machine</example-url>
|
|
2930
|
+
* <example-url>http://localhost:4200/#/common/chart/bullet/performance-vs-target</example-url>
|
|
2661
2931
|
*/
|
|
2662
2932
|
class CngxBullet {
|
|
2663
2933
|
actual = input.required(...(ngDevMode ? [{ debugName: "actual" }] : /* istanbul ignore next */ []));
|
|
@@ -2708,7 +2978,11 @@ class CngxBullet {
|
|
|
2708
2978
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBullet, isStandalone: true, selector: "cngx-bullet", inputs: { actual: { classPropertyName: "actual", publicName: "actual", isSignal: true, isRequired: true, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "actual()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "maxValue()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-bullet" }, exportAs: ["cngxBullet"], ngImport: i0, template: `
|
|
2709
2979
|
@switch (activeView()) {
|
|
2710
2980
|
@case ('skeleton') {
|
|
2711
|
-
<span
|
|
2981
|
+
<span
|
|
2982
|
+
class="cngx-preset-skeleton"
|
|
2983
|
+
[attr.aria-busy]="true"
|
|
2984
|
+
[attr.aria-label]="i18n.loading()"
|
|
2985
|
+
></span>
|
|
2712
2986
|
}
|
|
2713
2987
|
@case ('empty') {
|
|
2714
2988
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2741,7 +3015,7 @@ class CngxBullet {
|
|
|
2741
3015
|
</div>
|
|
2742
3016
|
}
|
|
2743
3017
|
}
|
|
2744
|
-
`, isInline: true, styles: ["cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3018
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2745
3019
|
}
|
|
2746
3020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBullet, decorators: [{
|
|
2747
3021
|
type: Component,
|
|
@@ -2755,7 +3029,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2755
3029
|
}, template: `
|
|
2756
3030
|
@switch (activeView()) {
|
|
2757
3031
|
@case ('skeleton') {
|
|
2758
|
-
<span
|
|
3032
|
+
<span
|
|
3033
|
+
class="cngx-preset-skeleton"
|
|
3034
|
+
[attr.aria-busy]="true"
|
|
3035
|
+
[attr.aria-label]="i18n.loading()"
|
|
3036
|
+
></span>
|
|
2759
3037
|
}
|
|
2760
3038
|
@case ('empty') {
|
|
2761
3039
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2788,8 +3066,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2788
3066
|
</div>
|
|
2789
3067
|
}
|
|
2790
3068
|
}
|
|
2791
|
-
`, styles: ["cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
3069
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2792
3070
|
}], propDecorators: { actual: [{ type: i0.Input, args: [{ isSignal: true, alias: "actual", required: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], ranges: [{ type: i0.Input, args: [{ isSignal: true, alias: "ranges", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
3071
|
+
/** @internal */
|
|
2793
3072
|
function pct(v, max) {
|
|
2794
3073
|
if (max <= 0) {
|
|
2795
3074
|
return 0;
|
|
@@ -2805,11 +3084,21 @@ function pct(v, max) {
|
|
|
2805
3084
|
}
|
|
2806
3085
|
|
|
2807
3086
|
/**
|
|
2808
|
-
* Single-bar stacked composition
|
|
3087
|
+
* Single-bar stacked composition - visualises proportional shares of
|
|
2809
3088
|
* a fixed total. Pure DOM, no SVG. Host carries `role="img"` because
|
|
2810
3089
|
* a stacked bar communicates a multi-segment ratio, not a single
|
|
2811
3090
|
* bounded reading; the SR description enumerates segments via the
|
|
2812
3091
|
* auto-generated `aria-label` (or the `[ariaLabel]` override).
|
|
3092
|
+
*
|
|
3093
|
+
* @category common/chart/presets
|
|
3094
|
+
* @docsKind primary
|
|
3095
|
+
* @wcag AA
|
|
3096
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/stacked-bar.component.ts
|
|
3097
|
+
* @since 0.1.0
|
|
3098
|
+
* @relatedTo CngxBar, CngxDeviationBar, CngxBullet
|
|
3099
|
+
*
|
|
3100
|
+
* <example-url>http://localhost:4200/#/common/chart/stacked-bar/async-state-machine</example-url>
|
|
3101
|
+
* <example-url>http://localhost:4200/#/common/chart/stacked-bar/proportional-share-strips</example-url>
|
|
2813
3102
|
*/
|
|
2814
3103
|
class CngxStackedBar {
|
|
2815
3104
|
segments = input.required(...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
@@ -2864,7 +3153,11 @@ class CngxStackedBar {
|
|
|
2864
3153
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStackedBar, isStandalone: true, selector: "cngx-stacked-bar", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "effectiveAriaLabel()" }, classAttribute: "cngx-stacked-bar" }, exportAs: ["cngxStackedBar"], ngImport: i0, template: `
|
|
2865
3154
|
@switch (activeView()) {
|
|
2866
3155
|
@case ('skeleton') {
|
|
2867
|
-
<span
|
|
3156
|
+
<span
|
|
3157
|
+
class="cngx-preset-skeleton"
|
|
3158
|
+
[attr.aria-busy]="true"
|
|
3159
|
+
[attr.aria-label]="i18n.loading()"
|
|
3160
|
+
></span>
|
|
2868
3161
|
}
|
|
2869
3162
|
@case ('empty') {
|
|
2870
3163
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2888,7 +3181,7 @@ class CngxStackedBar {
|
|
|
2888
3181
|
</div>
|
|
2889
3182
|
}
|
|
2890
3183
|
}
|
|
2891
|
-
`, isInline: true, styles: ["cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3184
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2892
3185
|
}
|
|
2893
3186
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStackedBar, decorators: [{
|
|
2894
3187
|
type: Component,
|
|
@@ -2899,7 +3192,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2899
3192
|
}, template: `
|
|
2900
3193
|
@switch (activeView()) {
|
|
2901
3194
|
@case ('skeleton') {
|
|
2902
|
-
<span
|
|
3195
|
+
<span
|
|
3196
|
+
class="cngx-preset-skeleton"
|
|
3197
|
+
[attr.aria-busy]="true"
|
|
3198
|
+
[attr.aria-label]="i18n.loading()"
|
|
3199
|
+
></span>
|
|
2903
3200
|
}
|
|
2904
3201
|
@case ('empty') {
|
|
2905
3202
|
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
@@ -2923,7 +3220,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2923
3220
|
</div>
|
|
2924
3221
|
}
|
|
2925
3222
|
}
|
|
2926
|
-
`, styles: ["cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
3223
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: false; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent)}\n", "cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
2927
3224
|
}], propDecorators: { segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: true }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
2928
3225
|
|
|
2929
3226
|
/**
|