@cngx/common 0.1.0-rc.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +19 -8
- package/data/README.md +10 -10
- package/fesm2022/cngx-common-a11y.mjs +701 -263
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +83 -64
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +135 -76
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +749 -296
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +51 -29
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +695 -405
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +112 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +668 -308
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7066 -2739
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2121 -492
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1207 -569
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +256 -261
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +202 -262
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +28 -61
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +1 -1
- package/menu-button/README.md +234 -0
- package/package.json +14 -4
- package/popover/README.md +42 -5
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/ng-add/index.js +7 -7
- package/schematics/ng-add/schema.json +5 -0
- package/stepper/README.md +0 -1
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +43 -11
- package/theming/components/cngx-popover.css +37 -13
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +343 -120
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +671 -384
- package/types/cngx-common-command.d.ts +44 -47
- package/types/cngx-common-data.d.ts +350 -342
- package/types/cngx-common-dialog.d.ts +91 -120
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4350 -1723
- package/types/cngx-common-layout.d.ts +1365 -286
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +671 -289
- package/types/cngx-common-stepper.d.ts +217 -347
- package/types/cngx-common-tabs.d.ts +173 -386
- package/types/cngx-common-timeline.d.ts +25 -104
|
@@ -20,8 +20,6 @@ import { CngxMessage } from '@cngx/core/i18n';
|
|
|
20
20
|
* scale to a constant function returning `range[0]`.
|
|
21
21
|
* @param range `[start, end]` output range (typically pixel coordinates).
|
|
22
22
|
* @returns `(v: number) => number` mapping domain values to range values.
|
|
23
|
-
*
|
|
24
|
-
* @category common/chart/scales
|
|
25
23
|
*/
|
|
26
24
|
declare function createLinearScale(domain: readonly [number, number], range: readonly [number, number]): (v: number) => number;
|
|
27
25
|
|
|
@@ -35,8 +33,6 @@ declare function createLinearScale(domain: readonly [number, number], range: rea
|
|
|
35
33
|
* @param range `[start, end]` output range (typically pixel coordinates).
|
|
36
34
|
* @returns `(v: Date | number) => number` mapping time values to range
|
|
37
35
|
* values.
|
|
38
|
-
*
|
|
39
|
-
* @category common/chart/scales
|
|
40
36
|
*/
|
|
41
37
|
declare function createTimeScale(domain: readonly [Date | number, Date | number], range: readonly [number, number]): (v: Date | number) => number;
|
|
42
38
|
|
|
@@ -56,8 +52,6 @@ declare function createTimeScale(domain: readonly [Date | number, Date | number]
|
|
|
56
52
|
* @returns Callable `(v: T) => number` returning the **leading edge** of
|
|
57
53
|
* the band, with a `bandwidth()` method returning the band width.
|
|
58
54
|
* Lookup of an unknown value returns `NaN`.
|
|
59
|
-
*
|
|
60
|
-
* @category common/chart/scales
|
|
61
55
|
*/
|
|
62
56
|
interface BandScale<T> {
|
|
63
57
|
(v: T): number;
|
|
@@ -67,8 +61,6 @@ interface BandScale<T> {
|
|
|
67
61
|
* Construct a {@link BandScale} from a categorical domain and a numeric
|
|
68
62
|
* range. See the type-level documentation above for parameter
|
|
69
63
|
* semantics.
|
|
70
|
-
*
|
|
71
|
-
* @category common/chart/scales
|
|
72
64
|
*/
|
|
73
65
|
declare function createBandScale<T>(domain: readonly T[], range: readonly [number, number], padding?: number): BandScale<T>;
|
|
74
66
|
|
|
@@ -80,12 +72,10 @@ declare function createBandScale<T>(domain: readonly T[], range: readonly [numbe
|
|
|
80
72
|
* @param domain Ordered list of categorical values. Values are matched
|
|
81
73
|
* by reference equality on lookup.
|
|
82
74
|
* @param colors Palette to cycle through. Must have at least one entry;
|
|
83
|
-
* an empty palette throws a `CngxRuntimeError` (`CNGX1049`)
|
|
75
|
+
* an empty palette throws a `CngxRuntimeError` ([`CNGX1049`](/error-codes/cngx1049.md))
|
|
84
76
|
* synchronously at construction time.
|
|
85
77
|
* @returns Callable `(v: T) => string` returning the palette entry for
|
|
86
78
|
* `v`. Lookup of an unknown value returns the palette's first entry.
|
|
87
|
-
*
|
|
88
|
-
* @category common/chart/scales
|
|
89
79
|
*/
|
|
90
80
|
declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly string[]): (v: T) => string;
|
|
91
81
|
|
|
@@ -115,15 +105,11 @@ declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly st
|
|
|
115
105
|
* area is computed against).
|
|
116
106
|
* @returns a fresh array of at most `targetSize` rows, or the input by
|
|
117
107
|
* reference when no reduction is needed.
|
|
118
|
-
*
|
|
119
|
-
* @category common/chart/buffer
|
|
120
108
|
*/
|
|
121
109
|
declare function downsampleLTTB<T>(data: readonly T[], targetSize: number, xAccessor: (d: T, i: number) => number, yAccessor: (d: T, i: number) => number): readonly T[];
|
|
122
110
|
|
|
123
111
|
/**
|
|
124
112
|
* Construction options for {@link injectChartBuffer}.
|
|
125
|
-
*
|
|
126
|
-
* @category common/chart/buffer
|
|
127
113
|
*/
|
|
128
114
|
interface ChartBufferOptions<T> {
|
|
129
115
|
/** Ring capacity - the maximum rows retained before eviction. */
|
|
@@ -142,8 +128,6 @@ interface ChartBufferOptions<T> {
|
|
|
142
128
|
* The realtime feed handle returned by {@link injectChartBuffer}. Bind
|
|
143
129
|
* `points` to a chart data input; drive it from any high-frequency producer
|
|
144
130
|
* via `push` / `pushBatch`.
|
|
145
|
-
*
|
|
146
|
-
* @category common/chart/buffer
|
|
147
131
|
*/
|
|
148
132
|
interface CngxChartBuffer<T> {
|
|
149
133
|
/**
|
|
@@ -193,27 +177,113 @@ interface CngxChartBuffer<T> {
|
|
|
193
177
|
* }
|
|
194
178
|
* }
|
|
195
179
|
* ```
|
|
196
|
-
*
|
|
197
|
-
* @category common/chart/buffer
|
|
198
180
|
*/
|
|
199
181
|
declare function injectChartBuffer<T>(opts: ChartBufferOptions<T>): CngxChartBuffer<T>;
|
|
200
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Backend-agnostic geometry a layer atom publishes for rendering. A
|
|
185
|
+
* discriminated union: each variant carries exactly the primitives its
|
|
186
|
+
* kind needs, and nothing more. Both the SVG self-render path and the
|
|
187
|
+
* Canvas renderer paint against this same shape, so a single
|
|
188
|
+
* layer-authoring API drives either backend.
|
|
189
|
+
*
|
|
190
|
+
* Coordinates are already scale-projected (pixel space); `color` is
|
|
191
|
+
* `null` when the atom defers to its CSS custom property (the SVG path
|
|
192
|
+
* reads the var directly, the Canvas renderer resolves it via
|
|
193
|
+
* `getComputedStyle`).
|
|
194
|
+
*
|
|
195
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
196
|
+
* @since 0.3.0
|
|
197
|
+
*/
|
|
198
|
+
type LayerGeometry = {
|
|
199
|
+
readonly kind: 'line' | 'area';
|
|
200
|
+
readonly d: string;
|
|
201
|
+
readonly color: string | null;
|
|
202
|
+
readonly strokeWidth: number | string | null;
|
|
203
|
+
readonly fill?: string | null;
|
|
204
|
+
readonly opacity?: number | null;
|
|
205
|
+
/**
|
|
206
|
+
* Optional point-marker pass a mark layer emits alongside its
|
|
207
|
+
* path - the scale-projected centres of the datapoints the layer
|
|
208
|
+
* chooses to mark (e.g. the lone datum of a warming series). Both
|
|
209
|
+
* the SVG template and the Canvas renderer paint these as small
|
|
210
|
+
* filled circles in the layer's resolved colour. Absent / empty
|
|
211
|
+
* when the layer draws no markers.
|
|
212
|
+
*/
|
|
213
|
+
readonly points?: readonly {
|
|
214
|
+
readonly cx: number;
|
|
215
|
+
readonly cy: number;
|
|
216
|
+
}[];
|
|
217
|
+
} | {
|
|
218
|
+
readonly kind: 'bar';
|
|
219
|
+
readonly rects: readonly {
|
|
220
|
+
readonly x: number;
|
|
221
|
+
readonly y: number;
|
|
222
|
+
readonly w: number;
|
|
223
|
+
readonly h: number;
|
|
224
|
+
readonly color: string | null;
|
|
225
|
+
}[];
|
|
226
|
+
} | {
|
|
227
|
+
readonly kind: 'scatter';
|
|
228
|
+
readonly marks: readonly {
|
|
229
|
+
readonly cx: number;
|
|
230
|
+
readonly cy: number;
|
|
231
|
+
readonly r: number;
|
|
232
|
+
readonly color: string | null;
|
|
233
|
+
}[];
|
|
234
|
+
} | {
|
|
235
|
+
readonly kind: 'threshold';
|
|
236
|
+
readonly x1: number;
|
|
237
|
+
readonly y1: number;
|
|
238
|
+
readonly x2: number;
|
|
239
|
+
readonly y2: number;
|
|
240
|
+
readonly color: string | null;
|
|
241
|
+
readonly dashed: boolean;
|
|
242
|
+
} | {
|
|
243
|
+
readonly kind: 'band';
|
|
244
|
+
readonly x: number;
|
|
245
|
+
readonly y: number;
|
|
246
|
+
readonly w: number;
|
|
247
|
+
readonly h: number;
|
|
248
|
+
readonly color: string | null;
|
|
249
|
+
readonly opacity: number | null;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Contract every layer atom (`[cngxLine]`, `[cngxBar]`, ...) self-provides
|
|
253
|
+
* via {@link CNGX_CHART_LAYER}. The chart shell and the Canvas renderer
|
|
254
|
+
* read layer geometry through this token instead of scraping the DOM.
|
|
255
|
+
*
|
|
256
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
257
|
+
* @since 0.3.0
|
|
258
|
+
*/
|
|
259
|
+
interface CngxChartLayer {
|
|
260
|
+
/** The layer's scale-projected geometry, cascade-guarded by an `equal` fn. */
|
|
261
|
+
readonly geometry: Signal<LayerGeometry>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Injection token each layer atom provides via
|
|
265
|
+
* `{ provide: CNGX_CHART_LAYER, useExisting: CngxX }`. A
|
|
266
|
+
* `contentChildren(CNGX_CHART_LAYER, { descendants: true })` query on the
|
|
267
|
+
* chart shell collects every mounted layer's geometry through DI.
|
|
268
|
+
*
|
|
269
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
270
|
+
* @since 0.3.0
|
|
271
|
+
* @relatedTo CngxLine, CngxArea, CngxBar, CngxScatter, CngxThreshold, CngxBand
|
|
272
|
+
*/
|
|
273
|
+
declare const CNGX_CHART_LAYER: InjectionToken<CngxChartLayer>;
|
|
274
|
+
|
|
201
275
|
/**
|
|
202
276
|
* Numeric input shape every concrete scale accepts. Linear scales take
|
|
203
277
|
* `number`, time scales take `Date | number`, band scales take `string`
|
|
204
278
|
* or arbitrary references via {@link createBandScale}'s generic. The
|
|
205
279
|
* union narrows at the layer atom (`[cngxLine]`, `[cngxBar]`, ...);
|
|
206
280
|
* the chart context surface stays scale-agnostic.
|
|
207
|
-
*
|
|
208
|
-
* @category common/chart
|
|
209
281
|
*/
|
|
210
282
|
type XScaleInput = number | Date | string;
|
|
211
283
|
/**
|
|
212
284
|
* Generic scale function shape. Maps a domain value of type `TIn` to a
|
|
213
285
|
* range value (typically a pixel coordinate). Mirrors the result type
|
|
214
286
|
* of every `create*Scale` factory in `@cngx/common/chart`.
|
|
215
|
-
*
|
|
216
|
-
* @category common/chart
|
|
217
287
|
*/
|
|
218
288
|
type ScaleFn<TIn> = (v: TIn) => number;
|
|
219
289
|
/**
|
|
@@ -230,8 +300,6 @@ type ScaleFn<TIn> = (v: TIn) => number;
|
|
|
230
300
|
* A collapsed plot (a box narrower than the room its axes need) reports
|
|
231
301
|
* `width` or `height` at or below `0`. Readers guard on the extent; the
|
|
232
302
|
* chart hands out its NOOP scale in the same case.
|
|
233
|
-
*
|
|
234
|
-
* @category common/chart
|
|
235
303
|
*/
|
|
236
304
|
interface CngxChartPlotArea {
|
|
237
305
|
readonly x0: number;
|
|
@@ -250,8 +318,6 @@ interface CngxChartPlotArea {
|
|
|
250
318
|
* boundary; layer atoms call `data<T>()` to narrow the array to their
|
|
251
319
|
* own `<T>` - the single boundary cast lives inside `CngxChart`'s
|
|
252
320
|
* `data<U>()` method, not at every consumer site.
|
|
253
|
-
*
|
|
254
|
-
* @category common/chart
|
|
255
321
|
*/
|
|
256
322
|
interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
257
323
|
readonly xScale: Signal<ScaleFn<TX>>;
|
|
@@ -284,6 +350,16 @@ interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
|
284
350
|
* SVG?", never "what mode am I in?".
|
|
285
351
|
*/
|
|
286
352
|
readonly renderSvg: Signal<boolean>;
|
|
353
|
+
/**
|
|
354
|
+
* The forced-colors series step of `layer`, counted in registration
|
|
355
|
+
* order: `0`-`3` for line, bar and scatter, `null` for the kinds outside
|
|
356
|
+
* the cycle and for a layer the chart does not know. The series layers
|
|
357
|
+
* write it to `data-cngx-series-step`, so the SVG cycle counts the same
|
|
358
|
+
* layers the Canvas backend counts, wrapped or not. A custom layer that
|
|
359
|
+
* draws its own forced-colors pattern can read it to join the cycle.
|
|
360
|
+
* Optional, so a test double or a custom context may leave it out.
|
|
361
|
+
*/
|
|
362
|
+
seriesStepOf?(layer: CngxChartLayer): number | null;
|
|
287
363
|
}
|
|
288
364
|
/**
|
|
289
365
|
* Injection token consumed by every chart child (`[cngxAxis]`, layer
|
|
@@ -291,14 +367,13 @@ interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
|
291
367
|
* via `useExisting`; child queries narrow the generic on the consumer
|
|
292
368
|
* side.
|
|
293
369
|
*
|
|
294
|
-
* @category common/chart
|
|
295
370
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
296
|
-
* @since 0.
|
|
371
|
+
* @since 0.3.0
|
|
297
372
|
*/
|
|
298
373
|
declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, number>>;
|
|
299
374
|
/**
|
|
300
375
|
* Inject the parent chart's reactive context. Throws a `CngxRuntimeError`
|
|
301
|
-
* with code `CNGX1048` when the consumer is not mounted as a content child
|
|
376
|
+
* with code [`CNGX1048`](/error-codes/cngx1048.md) when the consumer is not mounted as a content child
|
|
302
377
|
* of `<cngx-chart>`, in development and production alike. The `selector`
|
|
303
378
|
* argument is the consumer's public selector without brackets (`'cngxLine'`)
|
|
304
379
|
* and names it in the development message.
|
|
@@ -307,9 +382,8 @@ declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, n
|
|
|
307
382
|
* read `plot`, the scales and `renderSvg` the same way the built-in
|
|
308
383
|
* layer atoms do.
|
|
309
384
|
*
|
|
310
|
-
* @category common/chart
|
|
311
385
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
312
|
-
* @since 0.
|
|
386
|
+
* @since 0.3.0
|
|
313
387
|
*/
|
|
314
388
|
declare function injectChartContext(selector: string): CngxChartContext;
|
|
315
389
|
|
|
@@ -333,8 +407,6 @@ declare function injectChartContext(selector: string): CngxChartContext;
|
|
|
333
407
|
* the exported `CHART_SMALL_BREAKPOINT_PX` constant (400).
|
|
334
408
|
* Container-size based, not viewport-based, so it works correctly
|
|
335
409
|
* inside dashboard cells of any size.
|
|
336
|
-
*
|
|
337
|
-
* @category common/chart
|
|
338
410
|
*/
|
|
339
411
|
interface CngxChartSlotContext {
|
|
340
412
|
readonly width: number;
|
|
@@ -361,8 +433,6 @@ interface CngxChartSlotContext {
|
|
|
361
433
|
/**
|
|
362
434
|
* Threshold (px) below which `CngxChartSlotContext.small` is true.
|
|
363
435
|
* Hardcoded for v1; later releases may make this a config token.
|
|
364
|
-
*
|
|
365
|
-
* @category common/chart
|
|
366
436
|
*/
|
|
367
437
|
declare const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
368
438
|
/**
|
|
@@ -381,9 +451,8 @@ declare const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
|
381
451
|
* </cngx-chart>
|
|
382
452
|
* ```
|
|
383
453
|
*
|
|
384
|
-
* @category common/chart
|
|
385
454
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
386
|
-
* @since 0.
|
|
455
|
+
* @since 0.3.0
|
|
387
456
|
* @relatedTo CngxChartSlotContext, CngxChartEmpty, CngxChartError, CngxChart
|
|
388
457
|
*/
|
|
389
458
|
declare class CngxChartLoading {
|
|
@@ -406,9 +475,8 @@ declare class CngxChartLoading {
|
|
|
406
475
|
* </cngx-chart>
|
|
407
476
|
* ```
|
|
408
477
|
*
|
|
409
|
-
* @category common/chart
|
|
410
478
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
411
|
-
* @since 0.
|
|
479
|
+
* @since 0.3.0
|
|
412
480
|
* @relatedTo CngxChartSlotContext, CngxChartLoading, CngxChartError, CngxChart
|
|
413
481
|
*/
|
|
414
482
|
declare class CngxChartEmpty {
|
|
@@ -421,8 +489,6 @@ declare class CngxChartEmpty {
|
|
|
421
489
|
* common slot context with the live error value via `$implicit` and
|
|
422
490
|
* `error` keys, so consumers can render a typed message AND branch
|
|
423
491
|
* on chart size.
|
|
424
|
-
*
|
|
425
|
-
* @category common/chart
|
|
426
492
|
*/
|
|
427
493
|
interface CngxChartErrorContext extends CngxChartSlotContext {
|
|
428
494
|
readonly $implicit: unknown;
|
|
@@ -440,9 +506,8 @@ interface CngxChartErrorContext extends CngxChartSlotContext {
|
|
|
440
506
|
* </cngx-chart>
|
|
441
507
|
* ```
|
|
442
508
|
*
|
|
443
|
-
* @category common/chart
|
|
444
509
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
445
|
-
* @since 0.
|
|
510
|
+
* @since 0.3.0
|
|
446
511
|
* @relatedTo CngxChartErrorContext, CngxChartLoading, CngxChartEmpty, CngxChart
|
|
447
512
|
*/
|
|
448
513
|
declare class CngxChartError {
|
|
@@ -456,8 +521,6 @@ declare class CngxChartError {
|
|
|
456
521
|
* connection error value via `$implicit` / `error`, mirroring
|
|
457
522
|
* {@link CngxChartErrorContext}. The connection channel is separate from
|
|
458
523
|
* the data `[state]` channel, so this context reflects `[connectionState]`.
|
|
459
|
-
*
|
|
460
|
-
* @category common/chart
|
|
461
524
|
*/
|
|
462
525
|
interface CngxChartConnectionContext extends CngxChartSlotContext {
|
|
463
526
|
readonly $implicit: unknown;
|
|
@@ -477,9 +540,8 @@ interface CngxChartConnectionContext extends CngxChartSlotContext {
|
|
|
477
540
|
* </cngx-chart>
|
|
478
541
|
* ```
|
|
479
542
|
*
|
|
480
|
-
* @category common/chart
|
|
481
543
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
482
|
-
* @since 0.
|
|
544
|
+
* @since 0.3.0
|
|
483
545
|
* @relatedTo CngxChartConnectionContext, CngxChartReconnecting, CngxChart
|
|
484
546
|
*/
|
|
485
547
|
declare class CngxChartConnectionError {
|
|
@@ -501,9 +563,8 @@ declare class CngxChartConnectionError {
|
|
|
501
563
|
* </cngx-chart>
|
|
502
564
|
* ```
|
|
503
565
|
*
|
|
504
|
-
* @category common/chart
|
|
505
566
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
506
|
-
* @since 0.
|
|
567
|
+
* @since 0.3.0
|
|
507
568
|
* @relatedTo CngxChartConnectionContext, CngxChartConnectionError, CngxChart
|
|
508
569
|
*/
|
|
509
570
|
declare class CngxChartReconnecting {
|
|
@@ -553,9 +614,8 @@ declare class CngxChartReconnecting {
|
|
|
553
614
|
* SR data-table (the `aria-describedby` channel the chart already owns),
|
|
554
615
|
* not on an element projected here.
|
|
555
616
|
*
|
|
556
|
-
* @category common/chart
|
|
557
617
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
558
|
-
* @since 0.
|
|
618
|
+
* @since 0.3.0
|
|
559
619
|
* @relatedTo CngxChartSlotContext, CngxChartLoading, CngxChartEmpty, CngxChartError, CngxChart
|
|
560
620
|
*/
|
|
561
621
|
declare class CngxChartOverlay {
|
|
@@ -564,101 +624,6 @@ declare class CngxChartOverlay {
|
|
|
564
624
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartOverlay, "ng-template[cngxChartOverlay]", never, {}, {}, never, never, true, never>;
|
|
565
625
|
}
|
|
566
626
|
|
|
567
|
-
/**
|
|
568
|
-
* Backend-agnostic geometry a layer atom publishes for rendering. A
|
|
569
|
-
* discriminated union: each variant carries exactly the primitives its
|
|
570
|
-
* kind needs, and nothing more. Both the SVG self-render path and the
|
|
571
|
-
* Canvas renderer paint against this same shape, so a single
|
|
572
|
-
* layer-authoring API drives either backend.
|
|
573
|
-
*
|
|
574
|
-
* Coordinates are already scale-projected (pixel space); `color` is
|
|
575
|
-
* `null` when the atom defers to its CSS custom property (the SVG path
|
|
576
|
-
* reads the var directly, the Canvas renderer resolves it via
|
|
577
|
-
* `getComputedStyle`).
|
|
578
|
-
*
|
|
579
|
-
* @category common/chart/layers
|
|
580
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
581
|
-
* @since 0.1.0
|
|
582
|
-
*/
|
|
583
|
-
type LayerGeometry = {
|
|
584
|
-
readonly kind: 'line' | 'area';
|
|
585
|
-
readonly d: string;
|
|
586
|
-
readonly color: string | null;
|
|
587
|
-
readonly strokeWidth: number | string | null;
|
|
588
|
-
readonly fill?: string | null;
|
|
589
|
-
readonly opacity?: number | null;
|
|
590
|
-
/**
|
|
591
|
-
* Optional point-marker pass a mark layer emits alongside its
|
|
592
|
-
* path - the scale-projected centres of the datapoints the layer
|
|
593
|
-
* chooses to mark (e.g. the lone datum of a warming series). Both
|
|
594
|
-
* the SVG template and the Canvas renderer paint these as small
|
|
595
|
-
* filled circles in the layer's resolved colour. Absent / empty
|
|
596
|
-
* when the layer draws no markers.
|
|
597
|
-
*/
|
|
598
|
-
readonly points?: readonly {
|
|
599
|
-
readonly cx: number;
|
|
600
|
-
readonly cy: number;
|
|
601
|
-
}[];
|
|
602
|
-
} | {
|
|
603
|
-
readonly kind: 'bar';
|
|
604
|
-
readonly rects: readonly {
|
|
605
|
-
readonly x: number;
|
|
606
|
-
readonly y: number;
|
|
607
|
-
readonly w: number;
|
|
608
|
-
readonly h: number;
|
|
609
|
-
readonly color: string | null;
|
|
610
|
-
}[];
|
|
611
|
-
} | {
|
|
612
|
-
readonly kind: 'scatter';
|
|
613
|
-
readonly marks: readonly {
|
|
614
|
-
readonly cx: number;
|
|
615
|
-
readonly cy: number;
|
|
616
|
-
readonly r: number;
|
|
617
|
-
readonly color: string | null;
|
|
618
|
-
}[];
|
|
619
|
-
} | {
|
|
620
|
-
readonly kind: 'threshold';
|
|
621
|
-
readonly x1: number;
|
|
622
|
-
readonly y1: number;
|
|
623
|
-
readonly x2: number;
|
|
624
|
-
readonly y2: number;
|
|
625
|
-
readonly color: string | null;
|
|
626
|
-
readonly dashed: boolean;
|
|
627
|
-
} | {
|
|
628
|
-
readonly kind: 'band';
|
|
629
|
-
readonly x: number;
|
|
630
|
-
readonly y: number;
|
|
631
|
-
readonly w: number;
|
|
632
|
-
readonly h: number;
|
|
633
|
-
readonly color: string | null;
|
|
634
|
-
readonly opacity: number | null;
|
|
635
|
-
};
|
|
636
|
-
/**
|
|
637
|
-
* Contract every layer atom (`[cngxLine]`, `[cngxBar]`, ...) self-provides
|
|
638
|
-
* via {@link CNGX_CHART_LAYER}. The chart shell and the Canvas renderer
|
|
639
|
-
* read layer geometry through this token instead of scraping the DOM.
|
|
640
|
-
*
|
|
641
|
-
* @category common/chart/layers
|
|
642
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
643
|
-
* @since 0.1.0
|
|
644
|
-
*/
|
|
645
|
-
interface CngxChartLayer {
|
|
646
|
-
/** The layer's scale-projected geometry, cascade-guarded by an `equal` fn. */
|
|
647
|
-
readonly geometry: Signal<LayerGeometry>;
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Injection token each layer atom provides via
|
|
651
|
-
* `{ provide: CNGX_CHART_LAYER, useExisting: CngxX }`. A
|
|
652
|
-
* `contentChildren(CNGX_CHART_LAYER, { descendants: true })` query on the
|
|
653
|
-
* chart shell collects every mounted layer's geometry through DI.
|
|
654
|
-
*
|
|
655
|
-
* @category common/chart/layers
|
|
656
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
657
|
-
* @since 0.1.0
|
|
658
|
-
* @relatedTo CngxLine, CngxArea, CngxBar, CngxScatter, CngxThreshold, CngxBand
|
|
659
|
-
*/
|
|
660
|
-
declare const CNGX_CHART_LAYER: InjectionToken<CngxChartLayer>;
|
|
661
|
-
|
|
662
627
|
/**
|
|
663
628
|
* Top-level chart container. Hosts an `<svg>` viewBox, applies
|
|
664
629
|
* {@link CngxResizeObserver} via `hostDirectives` to track its rendered
|
|
@@ -711,40 +676,50 @@ declare const CNGX_CHART_LAYER: InjectionToken<CngxChartLayer>;
|
|
|
711
676
|
* consumer restyling `--cngx-axis-font-size` gets labels at their own
|
|
712
677
|
* size inside a gutter sized for the default.
|
|
713
678
|
*
|
|
714
|
-
* @category common/chart
|
|
715
|
-
* @docsKind primary
|
|
716
679
|
* @wcag AA
|
|
717
680
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart.component.ts
|
|
718
|
-
* @since 0.
|
|
681
|
+
* @since 0.3.0
|
|
719
682
|
* @relatedTo CngxAxis, CngxLine, CngxArea, CngxBar, CngxChartLegend
|
|
720
683
|
*
|
|
721
|
-
* <example-url
|
|
722
|
-
* <example-url
|
|
723
|
-
* <example-url
|
|
724
|
-
* <example-url
|
|
725
|
-
* <example-url
|
|
726
|
-
* <example-url
|
|
727
|
-
* <example-url
|
|
728
|
-
* <example-url
|
|
684
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
685
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
686
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
687
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
688
|
+
* <example-url>/#/common/chart/primitives/overlay-aligned-to-the-plot</example-url>
|
|
689
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
690
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
691
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
729
692
|
* @slot cngxChartLoading Replaces the centred spinner shown during the first load.
|
|
730
693
|
* @slot cngxChartEmpty Rendered when the data resolves to nothing.
|
|
731
694
|
* @slot cngxChartError Rendered when the load fails; gets the error.
|
|
732
695
|
* @slot cngxChartConnectionError Rendered over the chart when the live connection drops.
|
|
733
696
|
* @slot cngxChartReconnecting Rendered over the chart while the connection retries.
|
|
734
697
|
* @slot cngxChartOverlay HTML layered over the marks in the content view; the chart insets it to the plot area, pointer-events off by default.
|
|
698
|
+
* @axis level organism
|
|
735
699
|
*/
|
|
736
700
|
declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, number> {
|
|
737
701
|
/**
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
* call `this.ctx.data<T>()` to narrow without per-site casts.
|
|
742
|
-
*
|
|
743
|
-
* @internal - alias for the public `data<U>()` method
|
|
702
|
+
* The rows the chart plots, bound as `[data]`; required. Layer atoms read them through the
|
|
703
|
+
* `data<U>()` method below, which narrows the row type without per-site casts, so consumer markup
|
|
704
|
+
* stays `<cngx-chart [data]="rows">`.
|
|
744
705
|
*/
|
|
745
706
|
readonly dataInput: _angular_core.InputSignal<readonly T[]>;
|
|
707
|
+
/**
|
|
708
|
+
* Fixed width of the chart in px, applied as the host's inline width and as the SVG viewBox width.
|
|
709
|
+
* Unset, the width is measured from the host; with `[height]` unset too the chart runs in
|
|
710
|
+
* responsive mode and fills its parent.
|
|
711
|
+
*/
|
|
746
712
|
readonly width: _angular_core.InputSignal<number | undefined>;
|
|
713
|
+
/**
|
|
714
|
+
* Fixed height of the chart in px, used as the SVG viewBox height. Unset, the height is measured
|
|
715
|
+
* from the host; with both `[width]` and `[height]` bound the host also gets `aspect-ratio: width
|
|
716
|
+
* / height`.
|
|
717
|
+
*/
|
|
747
718
|
readonly height: _angular_core.InputSignal<number | undefined>;
|
|
719
|
+
/**
|
|
720
|
+
* Value of the SVG `preserveAspectRatio` attribute, which decides how the viewBox is fitted when
|
|
721
|
+
* the host box has a different aspect ratio. Default `'xMidYMid meet'`.
|
|
722
|
+
*/
|
|
748
723
|
readonly preserveAspectRatio: _angular_core.InputSignal<string>;
|
|
749
724
|
/**
|
|
750
725
|
* Optional explicit `aria-label` override. When set, supersedes the
|
|
@@ -801,6 +776,8 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
801
776
|
private readonly axes;
|
|
802
777
|
private readonly thresholds;
|
|
803
778
|
private readonly layers;
|
|
779
|
+
private readonly layerHosts;
|
|
780
|
+
private readonly layerElements;
|
|
804
781
|
protected readonly i18n: Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
805
782
|
protected readonly dataTableId: string;
|
|
806
783
|
protected readonly hatchId: string;
|
|
@@ -990,6 +967,14 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
990
967
|
* element-wise-equal and the paint cascade short-circuits.
|
|
991
968
|
*/
|
|
992
969
|
protected readonly geometries: Signal<readonly LayerGeometry[]>;
|
|
970
|
+
/**
|
|
971
|
+
* Forced-colors series step per layer, the rule the Canvas backend
|
|
972
|
+
* paints by. Element-wise guarded: a data tick re-emits the same steps,
|
|
973
|
+
* so the layers' `data-cngx-series-step` bindings stay untouched.
|
|
974
|
+
*/
|
|
975
|
+
private readonly seriesSteps;
|
|
976
|
+
/** See {@link CngxChartContext.seriesStepOf}. */
|
|
977
|
+
seriesStepOf(layer: CngxChartLayer): number | null;
|
|
993
978
|
protected readonly viewBox: Signal<string>;
|
|
994
979
|
private readonly xScaleCache;
|
|
995
980
|
private readonly yScaleCache;
|
|
@@ -1071,7 +1056,7 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
1071
1056
|
*/
|
|
1072
1057
|
protected readonly tableActive: Signal<boolean>;
|
|
1073
1058
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChart<any>, never>;
|
|
1074
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChart<any>, "cngx-chart", ["cngxChart"], { "dataInput": { "alias": "data"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "preserveAspectRatio": { "alias": "preserveAspectRatio"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "summaryAccessor": { "alias": "summaryAccessor"; "required": false; "isSignal": true; }; "accessibleTable": { "alias": "accessibleTable"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "connectionState": { "alias": "connectionState"; "required": false; "isSignal": true; }; }, {}, ["axes", "thresholds", "layers", "loadingSlot", "emptySlot", "errorSlot", "connectionErrorSlot", "reconnectingSlot", "overlaySlot", "overlaySlots"], ["*"], true, [{ directive: typeof i1.CngxResizeObserver; inputs: {}; outputs: {}; }]>;
|
|
1059
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChart<any>, "cngx-chart", ["cngxChart"], { "dataInput": { "alias": "data"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "preserveAspectRatio": { "alias": "preserveAspectRatio"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "summaryAccessor": { "alias": "summaryAccessor"; "required": false; "isSignal": true; }; "accessibleTable": { "alias": "accessibleTable"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "connectionState": { "alias": "connectionState"; "required": false; "isSignal": true; }; }, {}, ["axes", "thresholds", "layers", "layerHosts", "loadingSlot", "emptySlot", "errorSlot", "connectionErrorSlot", "reconnectingSlot", "overlaySlot", "overlaySlots"], ["*"], true, [{ directive: typeof i1.CngxResizeObserver; inputs: {}; outputs: {}; }]>;
|
|
1075
1060
|
}
|
|
1076
1061
|
|
|
1077
1062
|
/**
|
|
@@ -1081,8 +1066,7 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
1081
1066
|
* several keys, so a pack owns their words, their order and their list
|
|
1082
1067
|
* separator.
|
|
1083
1068
|
*
|
|
1084
|
-
* @
|
|
1085
|
-
* @since 0.1.0
|
|
1069
|
+
* @since 0.3.0
|
|
1086
1070
|
* @relatedTo CNGX_CHART_I18N
|
|
1087
1071
|
*/
|
|
1088
1072
|
interface CngxChartLanguageSection {
|
|
@@ -1125,8 +1109,7 @@ interface CngxChartLanguageSection {
|
|
|
1125
1109
|
* The English chart section: the single source of the chart's English copy.
|
|
1126
1110
|
* `CNGX_CHART_I18N` defaults to it.
|
|
1127
1111
|
*
|
|
1128
|
-
* @
|
|
1129
|
-
* @since 0.1.0
|
|
1112
|
+
* @since 0.3.0
|
|
1130
1113
|
* @relatedTo CNGX_CHART_I18N
|
|
1131
1114
|
*/
|
|
1132
1115
|
declare const CNGX_CHART_LANGUAGE_EN: CngxChartLanguageSection;
|
|
@@ -1140,8 +1123,6 @@ declare module '@cngx/core/i18n' {
|
|
|
1140
1123
|
* Summary input describing the chart's current data shape. Consumed by
|
|
1141
1124
|
* `CngxChartI18n.summary()` to produce the `aria-label` text the
|
|
1142
1125
|
* `<cngx-chart>` host announces to screen readers.
|
|
1143
|
-
*
|
|
1144
|
-
* @category common/chart/i18n
|
|
1145
1126
|
*/
|
|
1146
1127
|
interface CngxChartSummary {
|
|
1147
1128
|
readonly trend: 'up' | 'down' | 'flat';
|
|
@@ -1154,8 +1135,6 @@ interface CngxChartSummary {
|
|
|
1154
1135
|
* i18n surface for `@cngx/common/chart`. Mirrors the `CNGX_RECYCLER_I18N`
|
|
1155
1136
|
* shape from `@cngx/common/data` - factory defaults supply English;
|
|
1156
1137
|
* consumers override per-app via {@link provideChartI18n}.
|
|
1157
|
-
*
|
|
1158
|
-
* @category common/chart/i18n
|
|
1159
1138
|
*/
|
|
1160
1139
|
interface CngxChartI18n {
|
|
1161
1140
|
readonly summary: (input: CngxChartSummary) => string;
|
|
@@ -1206,26 +1185,22 @@ interface CngxChartI18n {
|
|
|
1206
1185
|
* at its default still follows the app locale at the use site, including a
|
|
1207
1186
|
* runtime `CNGX_LOCALE` flip.
|
|
1208
1187
|
*
|
|
1209
|
-
* @category common/chart/i18n
|
|
1210
1188
|
* @wcag AA
|
|
1211
1189
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/i18n/chart-i18n.ts
|
|
1212
|
-
* @since 0.
|
|
1190
|
+
* @since 0.3.0
|
|
1213
1191
|
*/
|
|
1214
1192
|
declare const CNGX_CHART_I18N: InjectionToken<Signal<CngxChartI18n>>;
|
|
1215
1193
|
/**
|
|
1216
|
-
*
|
|
1194
|
+
* A label override feature of `provideChartI18n`.
|
|
1217
1195
|
*
|
|
1218
|
-
* @
|
|
1196
|
+
* @since 0.3.0
|
|
1197
|
+
* @relatedTo CNGX_CHART_I18N, withChartI18nLabels
|
|
1219
1198
|
*/
|
|
1220
|
-
type CngxChartI18nFeature = (
|
|
1221
|
-
readonly _target: 'i18n';
|
|
1222
|
-
};
|
|
1199
|
+
type CngxChartI18nFeature = (bundle: Signal<CngxChartI18n>) => Signal<CngxChartI18n>;
|
|
1223
1200
|
/**
|
|
1224
1201
|
* Override chart copy via a partial bundle - unset keys keep the language
|
|
1225
1202
|
* pack's copy, or the English default, and keep following the app locale.
|
|
1226
1203
|
* Pass a `Signal` to switch the language at runtime.
|
|
1227
|
-
*
|
|
1228
|
-
* @category common/chart/i18n
|
|
1229
1204
|
*/
|
|
1230
1205
|
declare function withChartI18nLabels(overrides: Partial<CngxChartI18n> | Signal<Partial<CngxChartI18n>>): CngxChartI18nFeature;
|
|
1231
1206
|
/**
|
|
@@ -1242,8 +1217,6 @@ declare function withChartI18nLabels(overrides: Partial<CngxChartI18n> | Signal<
|
|
|
1242
1217
|
* ),
|
|
1243
1218
|
* ]
|
|
1244
1219
|
* ```
|
|
1245
|
-
*
|
|
1246
|
-
* @category common/chart/i18n
|
|
1247
1220
|
*/
|
|
1248
1221
|
declare function provideChartI18n(...features: readonly CngxChartI18nFeature[]): Provider;
|
|
1249
1222
|
|
|
@@ -1254,9 +1227,8 @@ type Trend = 'up' | 'down' | 'flat';
|
|
|
1254
1227
|
* either the trend flipped, or the current value crossed a threshold.
|
|
1255
1228
|
* A discriminated union - each variant carries exactly its own fields.
|
|
1256
1229
|
*
|
|
1257
|
-
* @category common/chart
|
|
1258
1230
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/significant-change.ts
|
|
1259
|
-
* @since 0.
|
|
1231
|
+
* @since 0.3.0
|
|
1260
1232
|
*/
|
|
1261
1233
|
type CngxSignificantChange = {
|
|
1262
1234
|
readonly kind: 'trend-flip';
|
|
@@ -1284,9 +1256,8 @@ type CngxSignificantChange = {
|
|
|
1284
1256
|
*
|
|
1285
1257
|
* @param summary the chart's `CngxChartSummary` signal.
|
|
1286
1258
|
*
|
|
1287
|
-
* @category common/chart
|
|
1288
1259
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/significant-change.ts
|
|
1289
|
-
* @since 0.
|
|
1260
|
+
* @since 0.3.0
|
|
1290
1261
|
*/
|
|
1291
1262
|
declare function createSignificantChangeTracker(summary: Signal<CngxChartSummary>): Signal<CngxSignificantChange | null>;
|
|
1292
1263
|
|
|
@@ -1310,14 +1281,12 @@ declare function createSignificantChangeTracker(summary: Signal<CngxChartSummary
|
|
|
1310
1281
|
* <cngx-chart-announcer [cngxChartAnnouncer]="c" />
|
|
1311
1282
|
* ```
|
|
1312
1283
|
*
|
|
1313
|
-
* @category common/chart
|
|
1314
|
-
* @docsKind primary
|
|
1315
1284
|
* @wcag AA
|
|
1316
1285
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-announcer.component.ts
|
|
1317
|
-
* @since 0.
|
|
1286
|
+
* @since 0.3.0
|
|
1318
1287
|
* @relatedTo CngxChart, createSignificantChangeTracker
|
|
1319
1288
|
*
|
|
1320
|
-
* <example-url
|
|
1289
|
+
* <example-url>/#/common/chart/realtime/streaming-telemetry</example-url>
|
|
1321
1290
|
*/
|
|
1322
1291
|
declare class CngxChartAnnouncer {
|
|
1323
1292
|
/** The chart instance whose `significantChange()` this announcer voices. */
|
|
@@ -1339,16 +1308,12 @@ declare class CngxChartAnnouncer {
|
|
|
1339
1308
|
* Axis position. Top/bottom are X-axes; left/right are Y-axes. The
|
|
1340
1309
|
* parent `<cngx-chart>` collects content-child axes and routes their
|
|
1341
1310
|
* inputs to its `xScale` / `yScale` signals based on this discriminator.
|
|
1342
|
-
*
|
|
1343
|
-
* @category common/chart/axis
|
|
1344
1311
|
*/
|
|
1345
1312
|
type CngxAxisPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
1346
1313
|
/**
|
|
1347
1314
|
* Axis scale type. The chart's scale-builder picks the matching
|
|
1348
1315
|
* `create*Scale` factory at the boundary; the axis itself stays
|
|
1349
1316
|
* scale-implementation-agnostic.
|
|
1350
|
-
*
|
|
1351
|
-
* @category common/chart/axis
|
|
1352
1317
|
*/
|
|
1353
1318
|
type CngxAxisType = 'linear' | 'time' | 'band';
|
|
1354
1319
|
|
|
@@ -1374,9 +1339,8 @@ type CngxAxisType = 'linear' | 'time' | 'band';
|
|
|
1374
1339
|
* you draw yourself. Provide it with `useExisting` and the chart picks
|
|
1375
1340
|
* the directive up through its content query.
|
|
1376
1341
|
*
|
|
1377
|
-
* @category common/chart/axis
|
|
1378
1342
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/chart-axis.ts
|
|
1379
|
-
* @since 0.
|
|
1343
|
+
* @since 0.3.0
|
|
1380
1344
|
* @relatedTo CngxAxis, CngxAxisDomain, CngxChart
|
|
1381
1345
|
*/
|
|
1382
1346
|
interface CngxChartAxis {
|
|
@@ -1407,9 +1371,8 @@ interface CngxChartAxis {
|
|
|
1407
1371
|
* so a consumer-authored axis participates in scale building and plot
|
|
1408
1372
|
* insetting on equal terms with the ones the library ships.
|
|
1409
1373
|
*
|
|
1410
|
-
* @category common/chart/axis
|
|
1411
1374
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/chart-axis.ts
|
|
1412
|
-
* @since 0.
|
|
1375
|
+
* @since 0.3.0
|
|
1413
1376
|
* @relatedTo CngxChartAxis, CngxAxis, CngxAxisDomain
|
|
1414
1377
|
*/
|
|
1415
1378
|
declare const CNGX_CHART_AXIS: InjectionToken<CngxChartAxis>;
|
|
@@ -1477,25 +1440,47 @@ interface TickRendering {
|
|
|
1477
1440
|
* semantic data view lives on the parent chart's auto-Summary and
|
|
1478
1441
|
* Data Table.
|
|
1479
1442
|
*
|
|
1480
|
-
* @category common/chart/axis
|
|
1481
|
-
* @docsKind primary
|
|
1482
1443
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/axis.component.ts
|
|
1483
|
-
* @since 0.
|
|
1444
|
+
* @since 0.3.0
|
|
1484
1445
|
* @relatedTo CngxChart, CngxLine, CngxBar, CngxArea
|
|
1485
1446
|
*
|
|
1486
|
-
* <example-url
|
|
1487
|
-
* <example-url
|
|
1488
|
-
* <example-url
|
|
1489
|
-
* <example-url
|
|
1490
|
-
* <example-url
|
|
1491
|
-
* <example-url
|
|
1492
|
-
* <example-url
|
|
1447
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
1448
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
1449
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
1450
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
1451
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
1452
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
1453
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1493
1454
|
*/
|
|
1494
1455
|
declare class CngxAxis implements CngxChartAxis {
|
|
1456
|
+
/**
|
|
1457
|
+
* Required side of the plot the axis sits on: `'top'`, `'right'`, `'bottom'` or `'left'`. Top and
|
|
1458
|
+
* bottom axes supply the chart's x scale and left and right axes the y scale, and only the first
|
|
1459
|
+
* axis of each orientation drives its scale.
|
|
1460
|
+
*/
|
|
1495
1461
|
readonly position: _angular_core.InputSignal<CngxAxisPosition>;
|
|
1462
|
+
/**
|
|
1463
|
+
* Scale type: `'linear'` for numbers, `'time'` for Dates or timestamps, `'band'` for categories.
|
|
1464
|
+
* Default `'linear'`; it decides how `[domain]` maps to the chart scale and how ticks are
|
|
1465
|
+
* generated.
|
|
1466
|
+
*/
|
|
1496
1467
|
readonly type: _angular_core.InputSignal<CngxAxisType>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Values the scale spans. For linear and time axes the first and last entries are the two ends,
|
|
1470
|
+
* for band axes every entry is one category and one tick; fewer than two entries gives the chart
|
|
1471
|
+
* no scale for this axis. Unset draws the axis line without ticks.
|
|
1472
|
+
*/
|
|
1497
1473
|
readonly domain: _angular_core.InputSignal<readonly unknown[] | undefined>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Number of evenly spaced ticks, bound as `[ticks]`, generated across a linear or time domain with
|
|
1476
|
+
* both ends included. Default `5`; ignored on band axes, which tick every category.
|
|
1477
|
+
*/
|
|
1498
1478
|
readonly tickCount: _angular_core.InputSignal<number | undefined>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Formats a tick value into its label, `(v: unknown) => string`. The default formats numbers and
|
|
1481
|
+
* dates in the app locale (`CNGX_LOCALE`) and drops floating-point noise; the widest formatted
|
|
1482
|
+
* label also sizes the gutter the chart reserves for the axis.
|
|
1483
|
+
*/
|
|
1499
1484
|
readonly format: _angular_core.InputSignal<(v: unknown) => string>;
|
|
1500
1485
|
/**
|
|
1501
1486
|
* Render decorative gridlines extending from each tick across the
|
|
@@ -1518,6 +1503,13 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1518
1503
|
readonly axisLabel: _angular_core.InputSignal<string | null>;
|
|
1519
1504
|
private readonly ctx;
|
|
1520
1505
|
private readonly locale;
|
|
1506
|
+
private readonly host;
|
|
1507
|
+
/** Rendered font size of a tick label, `null` until read (and on the server). */
|
|
1508
|
+
private readonly tickFontPx;
|
|
1509
|
+
/** Rendered font size of the axis title, `null` until read. */
|
|
1510
|
+
private readonly titleFontPx;
|
|
1511
|
+
private readonly fontSize;
|
|
1512
|
+
private readonly titleFontSize;
|
|
1521
1513
|
/**
|
|
1522
1514
|
* The bound `[format]`, or the default tick formatter bound to the app
|
|
1523
1515
|
* locale (`CNGX_LOCALE`), so a locale flip re-formats the default labels.
|
|
@@ -1532,6 +1524,8 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1532
1524
|
* 3. Otherwise → empty array. Axis still renders the line.
|
|
1533
1525
|
*/
|
|
1534
1526
|
readonly tickValues: _angular_core.Signal<readonly unknown[]>;
|
|
1527
|
+
private readonly hasTicks;
|
|
1528
|
+
constructor();
|
|
1535
1529
|
/**
|
|
1536
1530
|
* How far this axis's decoration extends perpendicular to its own
|
|
1537
1531
|
* line, in viewBox user units. The parent chart reads it to size the
|
|
@@ -1551,10 +1545,14 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1551
1545
|
*
|
|
1552
1546
|
* Character width is an estimate ({@link CHAR_ADVANCE_RATIO}), which
|
|
1553
1547
|
* is the one value here that is not derived from state the axis
|
|
1554
|
-
* owns.
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1548
|
+
* owns. The font size it multiplies is the size the tick label and the
|
|
1549
|
+
* title render at, read once per axis after render (the declared
|
|
1550
|
+
* defaults until then and on the server, so SSR and the first frame
|
|
1551
|
+
* agree and an override moves the gutter one frame later). Everything
|
|
1552
|
+
* else comes from {@link tickValues} and {@link format}, which the
|
|
1553
|
+
* component already computes to render the labels themselves - so this
|
|
1554
|
+
* measures no text. A font-size custom property changed at runtime with
|
|
1555
|
+
* no resize and no re-render of the axis is not picked up.
|
|
1558
1556
|
*
|
|
1559
1557
|
* Acyclic by construction: {@link tickValues} reads `domain` /
|
|
1560
1558
|
* `ticks` / `type` and never the scale, so
|
|
@@ -1645,13 +1643,12 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1645
1643
|
* namespace. Nothing renders either way, but the host stays a legal SVG
|
|
1646
1644
|
* child.
|
|
1647
1645
|
*
|
|
1648
|
-
* @category common/chart/axis
|
|
1649
1646
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/axis-domain.ts
|
|
1650
|
-
* @since 0.
|
|
1647
|
+
* @since 0.3.0
|
|
1651
1648
|
* @relatedTo CngxAxis, CngxChart, CngxChartAxis
|
|
1652
1649
|
*
|
|
1653
|
-
* <example-url
|
|
1654
|
-
* <example-url
|
|
1650
|
+
* <example-url>/#/ui/chart-panel/basic/titled-panel-with-legend</example-url>
|
|
1651
|
+
* <example-url>/#/ui/chart-panel/slots/actions-and-footer</example-url>
|
|
1655
1652
|
*/
|
|
1656
1653
|
declare class CngxAxisDomain implements CngxChartAxis {
|
|
1657
1654
|
/** Which edge the scale this publishes belongs to. */
|
|
@@ -1681,8 +1678,6 @@ declare class CngxAxisDomain implements CngxChartAxis {
|
|
|
1681
1678
|
* intentionally unconstrained so the same field a consumer weights in the
|
|
1682
1679
|
* row can still carry their domain key (id, layer name, accessor return
|
|
1683
1680
|
* type, ...) for later interactions without a second lookup.
|
|
1684
|
-
*
|
|
1685
|
-
* @category common/chart/legend
|
|
1686
1681
|
*/
|
|
1687
1682
|
interface CngxChartLegendItem<T = unknown> {
|
|
1688
1683
|
readonly label: string;
|
|
@@ -1729,16 +1724,28 @@ interface CngxChartLegendItem<T = unknown> {
|
|
|
1729
1724
|
* (areas, thresholds, bands and axes do not count), so list the entries
|
|
1730
1725
|
* in the order of those layers.
|
|
1731
1726
|
*
|
|
1732
|
-
* @category common/chart/legend
|
|
1733
|
-
* @docsKind primary
|
|
1734
1727
|
* @wcag AA
|
|
1735
1728
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/legend/legend.component.ts
|
|
1736
|
-
* @since 0.
|
|
1729
|
+
* @since 0.3.0
|
|
1737
1730
|
* @relatedTo CngxChart, CngxLine, CngxBar
|
|
1731
|
+
* @axis level atom
|
|
1738
1732
|
*/
|
|
1739
1733
|
declare class CngxChartLegend<T = unknown> {
|
|
1734
|
+
/**
|
|
1735
|
+
* Required entries to list; each shows a colour swatch, its `label` and, when `value` is not null,
|
|
1736
|
+
* a trailing value (numbers in the app locale). A missing `color` leaves the swatch on the chart
|
|
1737
|
+
* primary token.
|
|
1738
|
+
*/
|
|
1740
1739
|
readonly items: _angular_core.InputSignal<readonly CngxChartLegendItem<T>[]>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Layout of the entries: `'horizontal'` wraps them in a row, `'vertical'` stacks them in a column.
|
|
1742
|
+
* Default `'horizontal'`.
|
|
1743
|
+
*/
|
|
1741
1744
|
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
1745
|
+
/**
|
|
1746
|
+
* Sets `justify-content` on the host to `flex-start`, `center` or `flex-end` for `'start'`,
|
|
1747
|
+
* `'center'` or `'end'`, along the main axis of the current orientation. Default `'start'`.
|
|
1748
|
+
*/
|
|
1742
1749
|
readonly align: _angular_core.InputSignal<"start" | "end" | "center">;
|
|
1743
1750
|
private readonly locale;
|
|
1744
1751
|
/** @internal Each item's value as display text; numbers in the app locale. */
|
|
@@ -1755,14 +1762,10 @@ declare class CngxChartLegend<T = unknown> {
|
|
|
1755
1762
|
* trailing close commands.
|
|
1756
1763
|
*
|
|
1757
1764
|
* Pure TS, no DOM dependency, no Angular dep.
|
|
1758
|
-
*
|
|
1759
|
-
* @category common/chart/path
|
|
1760
1765
|
*/
|
|
1761
1766
|
type CngxCurve = 'linear' | 'monotone';
|
|
1762
1767
|
/**
|
|
1763
1768
|
* Pixel-space point fed into {@link buildCurvePath}.
|
|
1764
|
-
*
|
|
1765
|
-
* @category common/chart/path
|
|
1766
1769
|
*/
|
|
1767
1770
|
interface PathPoint {
|
|
1768
1771
|
readonly x: number;
|
|
@@ -1778,28 +1781,20 @@ interface PathPoint {
|
|
|
1778
1781
|
* overshoots between data points.
|
|
1779
1782
|
* @returns The full path data starting with `M`. Returns `''` when
|
|
1780
1783
|
* the input is empty; `M x y` when the input has one point.
|
|
1781
|
-
*
|
|
1782
|
-
* @category common/chart/path
|
|
1783
1784
|
*/
|
|
1784
1785
|
declare function buildCurvePath(points: readonly PathPoint[], curve: CngxCurve): string;
|
|
1785
1786
|
|
|
1786
1787
|
/**
|
|
1787
1788
|
* Reads the Y value of a data row at index `i`.
|
|
1788
|
-
*
|
|
1789
|
-
* @category common/chart/path
|
|
1790
1789
|
*/
|
|
1791
1790
|
type LineYAccessor<T> = (d: T, i: number) => number;
|
|
1792
1791
|
/**
|
|
1793
1792
|
* Reads the X value of a data row at index `i`. Default behaviour
|
|
1794
1793
|
* (when omitted on a builder) is the row's positional index.
|
|
1795
|
-
*
|
|
1796
|
-
* @category common/chart/path
|
|
1797
1794
|
*/
|
|
1798
1795
|
type LineXAccessor<T> = (d: T, i: number) => XScaleInput;
|
|
1799
1796
|
/**
|
|
1800
1797
|
* Construction options for {@link createPathBuilder}.
|
|
1801
|
-
*
|
|
1802
|
-
* @category common/chart/path
|
|
1803
1798
|
*/
|
|
1804
1799
|
interface PathBuilderOptions<T> {
|
|
1805
1800
|
readonly y: LineYAccessor<T>;
|
|
@@ -1811,8 +1806,6 @@ interface PathBuilderOptions<T> {
|
|
|
1811
1806
|
* {@link PathBuilder.buildSegments}. `firstX` / `lastX` are the run's
|
|
1812
1807
|
* projected end coordinates, exposed so an area layer can close the
|
|
1813
1808
|
* run to its baseline without re-projecting the data.
|
|
1814
|
-
*
|
|
1815
|
-
* @category common/chart/path
|
|
1816
1809
|
*/
|
|
1817
1810
|
interface PathSegment {
|
|
1818
1811
|
readonly d: string;
|
|
@@ -1823,8 +1816,6 @@ interface PathSegment {
|
|
|
1823
1816
|
* Single-slot LRU cache around an SVG `d`-attribute builder. Returned
|
|
1824
1817
|
* by {@link createPathBuilder}; consumed by the `<cngx-line>` /
|
|
1825
1818
|
* `<cngx-area>` family.
|
|
1826
|
-
*
|
|
1827
|
-
* @category common/chart/path
|
|
1828
1819
|
*/
|
|
1829
1820
|
interface PathBuilder<T> {
|
|
1830
1821
|
/**
|
|
@@ -1875,8 +1866,6 @@ interface PathBuilder<T> {
|
|
|
1875
1866
|
* when the inputs to the `computed` are unchanged, two consecutive
|
|
1876
1867
|
* cascade ticks with the same `(y, x, curve)` produce the same
|
|
1877
1868
|
* builder instance.
|
|
1878
|
-
*
|
|
1879
|
-
* @category common/chart/path
|
|
1880
1869
|
*/
|
|
1881
1870
|
declare function createPathBuilder<T>(opts: PathBuilderOptions<T>): PathBuilder<T>;
|
|
1882
1871
|
|
|
@@ -1912,26 +1901,47 @@ interface PointMark {
|
|
|
1912
1901
|
* nothing. `[points]` controls this: `'auto'` (default) marks only the
|
|
1913
1902
|
* one-datum case, `'always'` marks every datum, `'never'` suppresses it.
|
|
1914
1903
|
*
|
|
1915
|
-
* @category common/chart/layers
|
|
1916
|
-
* @docsKind primary
|
|
1917
1904
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/line.component.ts
|
|
1918
|
-
* @since 0.
|
|
1905
|
+
* @since 0.3.0
|
|
1919
1906
|
* @relatedTo CngxArea, CngxScatter, CngxBar, CngxChart
|
|
1920
1907
|
*
|
|
1921
|
-
* <example-url
|
|
1922
|
-
* <example-url
|
|
1923
|
-
* <example-url
|
|
1924
|
-
* <example-url
|
|
1925
|
-
* <example-url
|
|
1926
|
-
* <example-url
|
|
1927
|
-
* <example-url
|
|
1908
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
1909
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
1910
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
1911
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
1912
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
1913
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
1914
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1928
1915
|
*/
|
|
1929
1916
|
declare class CngxLine<T = unknown> implements CngxChartLayer {
|
|
1917
|
+
/**
|
|
1918
|
+
* Reads the y value of each row as `(d, i) => number`, defaulting to `Number(d)`. The values form
|
|
1919
|
+
* the path.
|
|
1920
|
+
*/
|
|
1930
1921
|
readonly accessor: _angular_core.InputSignal<LineYAccessor<T>>;
|
|
1922
|
+
/**
|
|
1923
|
+
* Reads the x value of each row as `(d, i) => number | Date | string`. When unset the row index is
|
|
1924
|
+
* used.
|
|
1925
|
+
*/
|
|
1931
1926
|
readonly xAccessor: _angular_core.InputSignal<LineXAccessor<T> | undefined>;
|
|
1927
|
+
/**
|
|
1928
|
+
* CSS colour of the line stroke and its point markers, applied as an inline style and read by the
|
|
1929
|
+
* canvas renderer. Unset falls back to `--cngx-line-color`, then `--cngx-chart-primary`.
|
|
1930
|
+
*/
|
|
1932
1931
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
1932
|
+
/**
|
|
1933
|
+
* Stroke width of the line. A number is read as px and a string passes through as a CSS length;
|
|
1934
|
+
* unset falls back to `--cngx-line-stroke-width` (default `1.5px`).
|
|
1935
|
+
*/
|
|
1933
1936
|
readonly strokeWidth: _angular_core.InputSignal<string | number | null>;
|
|
1937
|
+
/**
|
|
1938
|
+
* Interpolation between points: `'linear'` joins them with straight segments, `'monotone'` with a
|
|
1939
|
+
* smooth curve that does not overshoot the data. Default `'linear'`.
|
|
1940
|
+
*/
|
|
1934
1941
|
readonly curve: _angular_core.InputSignal<CngxCurve>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
1944
|
+
*/
|
|
1935
1945
|
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
1936
1946
|
/**
|
|
1937
1947
|
* Point-marker mode. `'auto'` (default) draws a marker only when the
|
|
@@ -1941,6 +1951,17 @@ declare class CngxLine<T = unknown> implements CngxChartLayer {
|
|
|
1941
1951
|
*/
|
|
1942
1952
|
readonly points: _angular_core.InputSignal<"auto" | "always" | "never">;
|
|
1943
1953
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
|
|
1954
|
+
/**
|
|
1955
|
+
* Forced-colors series step from the chart's layer order, written to
|
|
1956
|
+
* `data-cngx-series-step` for the dash / hatch cycle in the styles.
|
|
1957
|
+
*/
|
|
1958
|
+
protected readonly seriesStep: _angular_core.Signal<number | null>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Inline style, not a presentation attribute: the `.cngx-line` class rule
|
|
1961
|
+
* beats an attribute. A number gets `px`; a string passes through as
|
|
1962
|
+
* written, so it carries its own unit.
|
|
1963
|
+
*/
|
|
1964
|
+
protected readonly strokeWidthStyle: _angular_core.Signal<string | null>;
|
|
1944
1965
|
private readonly builder;
|
|
1945
1966
|
private readonly resolvedData;
|
|
1946
1967
|
protected readonly d: _angular_core.Signal<string>;
|
|
@@ -1971,27 +1992,51 @@ declare class CngxLine<T = unknown> implements CngxChartLayer {
|
|
|
1971
1992
|
* nothing. `[points]` mirrors {@link CngxLine}: `'auto'` (default) marks
|
|
1972
1993
|
* only the one-datum case, `'always'` every datum, `'never'` none.
|
|
1973
1994
|
*
|
|
1974
|
-
* @category common/chart/layers
|
|
1975
|
-
* @docsKind primary
|
|
1976
1995
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/area.component.ts
|
|
1977
|
-
* @since 0.
|
|
1996
|
+
* @since 0.3.0
|
|
1978
1997
|
* @relatedTo CngxLine, CngxBand, CngxThreshold, CngxChart
|
|
1979
1998
|
*
|
|
1980
|
-
* <example-url
|
|
1981
|
-
* <example-url
|
|
1982
|
-
* <example-url
|
|
1983
|
-
* <example-url
|
|
1984
|
-
* <example-url
|
|
1985
|
-
* <example-url
|
|
1986
|
-
* <example-url
|
|
1999
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2000
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2001
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2002
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2003
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2004
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2005
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
1987
2006
|
*/
|
|
1988
2007
|
declare class CngxArea<T = unknown> implements CngxChartLayer {
|
|
2008
|
+
/**
|
|
2009
|
+
* Reads the y value of each row as `(d, i) => number`, defaulting to `Number(d)`. The values form
|
|
2010
|
+
* the upper edge of the filled area.
|
|
2011
|
+
*/
|
|
1989
2012
|
readonly accessor: _angular_core.InputSignal<LineYAccessor<T>>;
|
|
2013
|
+
/**
|
|
2014
|
+
* Reads the x value of each row as `(d, i) => number | Date | string`. When unset the row index is
|
|
2015
|
+
* used.
|
|
2016
|
+
*/
|
|
1990
2017
|
readonly xAccessor: _angular_core.InputSignal<LineXAccessor<T> | undefined>;
|
|
2018
|
+
/**
|
|
2019
|
+
* Fill opacity of the area, as a number or numeric string. Unset falls back to
|
|
2020
|
+
* `--cngx-area-opacity` (default `0.18`).
|
|
2021
|
+
*/
|
|
1991
2022
|
readonly opacity: _angular_core.InputSignal<string | number | null>;
|
|
2023
|
+
/**
|
|
2024
|
+
* CSS colour of the area fill and its point markers, applied as an inline style and read by the
|
|
2025
|
+
* canvas renderer. Unset falls back to `--cngx-area-fill`, then `--cngx-chart-primary`.
|
|
2026
|
+
*/
|
|
1992
2027
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2028
|
+
/**
|
|
2029
|
+
* Interpolation between points: `'linear'` joins them with straight segments, `'monotone'` with a
|
|
2030
|
+
* smooth curve that does not overshoot the data. Default `'linear'`.
|
|
2031
|
+
*/
|
|
1993
2032
|
readonly curve: _angular_core.InputSignal<CngxCurve>;
|
|
2033
|
+
/**
|
|
2034
|
+
* Y value the area is closed down to, projected through the chart's y scale. Default `0`.
|
|
2035
|
+
*/
|
|
1994
2036
|
readonly baseline: _angular_core.InputSignal<number>;
|
|
2037
|
+
/**
|
|
2038
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
2039
|
+
*/
|
|
1995
2040
|
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
1996
2041
|
/**
|
|
1997
2042
|
* Point-marker mode, mirroring {@link CngxLine}. `'auto'` (default)
|
|
@@ -2017,8 +2062,6 @@ declare class CngxArea<T = unknown> implements CngxChartLayer {
|
|
|
2017
2062
|
|
|
2018
2063
|
/**
|
|
2019
2064
|
* Reads the bar height (data-space Y) of a data row at index `i`.
|
|
2020
|
-
*
|
|
2021
|
-
* @category common/chart/layers
|
|
2022
2065
|
*/
|
|
2023
2066
|
type BarYAccessor<T> = (d: T, i: number) => number;
|
|
2024
2067
|
/** @internal */
|
|
@@ -2041,27 +2084,49 @@ interface BarRect {
|
|
|
2041
2084
|
*
|
|
2042
2085
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2043
2086
|
*
|
|
2044
|
-
* @category common/chart/layers
|
|
2045
|
-
* @docsKind primary
|
|
2046
2087
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/bar.component.ts
|
|
2047
|
-
* @since 0.
|
|
2088
|
+
* @since 0.3.0
|
|
2048
2089
|
* @relatedTo CngxLine, CngxArea, CngxStackedBar, CngxChart
|
|
2049
2090
|
*
|
|
2050
|
-
* <example-url
|
|
2051
|
-
* <example-url
|
|
2052
|
-
* <example-url
|
|
2053
|
-
* <example-url
|
|
2054
|
-
* <example-url
|
|
2055
|
-
* <example-url
|
|
2056
|
-
* <example-url
|
|
2091
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2092
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2093
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2094
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2095
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2096
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2097
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
2057
2098
|
*/
|
|
2058
2099
|
declare class CngxBar<T = unknown> implements CngxChartLayer {
|
|
2100
|
+
/**
|
|
2101
|
+
* Reads the y value of each row as `(d, i) => number`, defaulting to `Number(d)`. Each bar spans
|
|
2102
|
+
* from this value to `[baseline]`.
|
|
2103
|
+
*/
|
|
2059
2104
|
readonly accessor: _angular_core.InputSignal<BarYAccessor<T>>;
|
|
2105
|
+
/**
|
|
2106
|
+
* Fraction of each bar's slot left empty, clamped to 0-1 and split evenly on both sides of the
|
|
2107
|
+
* bar; a slot is the plot width divided by the row count. Default `0.1`.
|
|
2108
|
+
*/
|
|
2060
2109
|
readonly gap: _angular_core.InputSignal<number>;
|
|
2110
|
+
/**
|
|
2111
|
+
* Y value the bars are anchored to, projected through the chart's y scale; values below it hang
|
|
2112
|
+
* downward from it. Default `0`.
|
|
2113
|
+
*/
|
|
2061
2114
|
readonly baseline: _angular_core.InputSignal<number>;
|
|
2115
|
+
/**
|
|
2116
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
2117
|
+
*/
|
|
2062
2118
|
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
2119
|
+
/**
|
|
2120
|
+
* CSS colour of the bars, applied as an inline style and read by the canvas renderer. Unset falls
|
|
2121
|
+
* back to `--cngx-bar-color`, then `--cngx-chart-primary`.
|
|
2122
|
+
*/
|
|
2063
2123
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2064
2124
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
|
|
2125
|
+
/**
|
|
2126
|
+
* Forced-colors series step from the chart's layer order, written to
|
|
2127
|
+
* `data-cngx-series-step` for the dash / hatch cycle in the styles.
|
|
2128
|
+
*/
|
|
2129
|
+
protected readonly seriesStep: _angular_core.Signal<number | null>;
|
|
2065
2130
|
private readonly resolvedData;
|
|
2066
2131
|
protected readonly rects: _angular_core.Signal<readonly BarRect[]>;
|
|
2067
2132
|
readonly geometry: _angular_core.Signal<LayerGeometry>;
|
|
@@ -2071,14 +2136,10 @@ declare class CngxBar<T = unknown> implements CngxChartLayer {
|
|
|
2071
2136
|
|
|
2072
2137
|
/**
|
|
2073
2138
|
* Reads the data-space X value of a scatter row at index `i`.
|
|
2074
|
-
*
|
|
2075
|
-
* @category common/chart/layers
|
|
2076
2139
|
*/
|
|
2077
2140
|
type ScatterXAccessor<T> = (d: T, i: number) => XScaleInput;
|
|
2078
2141
|
/**
|
|
2079
2142
|
* Reads the data-space Y value of a scatter row at index `i`.
|
|
2080
|
-
*
|
|
2081
|
-
* @category common/chart/layers
|
|
2082
2143
|
*/
|
|
2083
2144
|
type ScatterYAccessor<T> = (d: T, i: number) => number;
|
|
2084
2145
|
/** @internal */
|
|
@@ -2094,27 +2155,47 @@ interface ScatterCircle {
|
|
|
2094
2155
|
*
|
|
2095
2156
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2096
2157
|
*
|
|
2097
|
-
* @category common/chart/layers
|
|
2098
|
-
* @docsKind primary
|
|
2099
2158
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/scatter.component.ts
|
|
2100
|
-
* @since 0.
|
|
2159
|
+
* @since 0.3.0
|
|
2101
2160
|
* @relatedTo CngxLine, CngxBar, CngxArea, CngxChart
|
|
2102
2161
|
*
|
|
2103
|
-
* <example-url
|
|
2104
|
-
* <example-url
|
|
2105
|
-
* <example-url
|
|
2106
|
-
* <example-url
|
|
2107
|
-
* <example-url
|
|
2108
|
-
* <example-url
|
|
2109
|
-
* <example-url
|
|
2162
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2163
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2164
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2165
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2166
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2167
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2168
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
2110
2169
|
*/
|
|
2111
2170
|
declare class CngxScatter<T = unknown> implements CngxChartLayer {
|
|
2171
|
+
/**
|
|
2172
|
+
* Required reader of the x value of each row, `(d, i) => number | Date | string`; scatter has no
|
|
2173
|
+
* index default.
|
|
2174
|
+
*/
|
|
2112
2175
|
readonly x: _angular_core.InputSignal<ScatterXAccessor<T>>;
|
|
2176
|
+
/**
|
|
2177
|
+
* Required reader of the y value of each row, `(d, i) => number`.
|
|
2178
|
+
*/
|
|
2113
2179
|
readonly y: _angular_core.InputSignal<ScatterYAccessor<T>>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Radius of every circle in chart units (px when the chart is not scaled down). Default `3`.
|
|
2182
|
+
*/
|
|
2114
2183
|
readonly radius: _angular_core.InputSignal<number>;
|
|
2184
|
+
/**
|
|
2185
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
2186
|
+
*/
|
|
2115
2187
|
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
2188
|
+
/**
|
|
2189
|
+
* CSS colour of the circles, applied as an inline style and read by the canvas renderer. Unset
|
|
2190
|
+
* falls back to `--cngx-scatter-color`, then `--cngx-chart-primary`.
|
|
2191
|
+
*/
|
|
2116
2192
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2117
2193
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<XScaleInput, number>;
|
|
2194
|
+
/**
|
|
2195
|
+
* Forced-colors series step from the chart's layer order, written to
|
|
2196
|
+
* `data-cngx-series-step` for the dash / hatch cycle in the styles.
|
|
2197
|
+
*/
|
|
2198
|
+
protected readonly seriesStep: _angular_core.Signal<number | null>;
|
|
2118
2199
|
private readonly resolvedData;
|
|
2119
2200
|
protected readonly circles: _angular_core.Signal<readonly ScatterCircle[]>;
|
|
2120
2201
|
readonly geometry: _angular_core.Signal<LayerGeometry>;
|
|
@@ -2133,24 +2214,38 @@ declare class CngxScatter<T = unknown> implements CngxChartLayer {
|
|
|
2133
2214
|
*
|
|
2134
2215
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2135
2216
|
*
|
|
2136
|
-
* @category common/chart/layers
|
|
2137
|
-
* @docsKind primary
|
|
2138
2217
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/threshold.component.ts
|
|
2139
|
-
* @since 0.
|
|
2218
|
+
* @since 0.3.0
|
|
2140
2219
|
* @relatedTo CngxBand, CngxChart, CngxLine
|
|
2141
2220
|
*
|
|
2142
|
-
* <example-url
|
|
2143
|
-
* <example-url
|
|
2144
|
-
* <example-url
|
|
2145
|
-
* <example-url
|
|
2146
|
-
* <example-url
|
|
2147
|
-
* <example-url
|
|
2148
|
-
* <example-url
|
|
2221
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2222
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2223
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2224
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2225
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2226
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2227
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
2149
2228
|
*/
|
|
2150
2229
|
declare class CngxThreshold implements CngxChartLayer {
|
|
2230
|
+
/**
|
|
2231
|
+
* Required y value of the horizontal reference line, projected through the chart's y scale. The
|
|
2232
|
+
* line spans the plot width.
|
|
2233
|
+
*/
|
|
2151
2234
|
readonly value: _angular_core.InputSignal<number>;
|
|
2235
|
+
/**
|
|
2236
|
+
* Optional text drawn just above the line near the plot's right edge, anchored at its end. Unset
|
|
2237
|
+
* draws no text.
|
|
2238
|
+
*/
|
|
2152
2239
|
readonly label: _angular_core.InputSignal<string | null>;
|
|
2240
|
+
/**
|
|
2241
|
+
* Draws the line with a `4 3` dash pattern instead of solid, in both the SVG and the canvas
|
|
2242
|
+
* renderer. Default `false`.
|
|
2243
|
+
*/
|
|
2153
2244
|
readonly dashed: _angular_core.InputSignal<boolean>;
|
|
2245
|
+
/**
|
|
2246
|
+
* CSS colour of the line, applied as an inline style and read by the canvas renderer. Unset falls
|
|
2247
|
+
* back to `--cngx-threshold-color`, then `--cngx-chart-danger`.
|
|
2248
|
+
*/
|
|
2154
2249
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2155
2250
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
|
|
2156
2251
|
protected readonly bounds: _angular_core.Signal<{
|
|
@@ -2173,25 +2268,42 @@ declare class CngxThreshold implements CngxChartLayer {
|
|
|
2173
2268
|
*
|
|
2174
2269
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2175
2270
|
*
|
|
2176
|
-
* @category common/chart/layers
|
|
2177
|
-
* @docsKind primary
|
|
2178
2271
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/band.component.ts
|
|
2179
|
-
* @since 0.
|
|
2272
|
+
* @since 0.3.0
|
|
2180
2273
|
* @relatedTo CngxThreshold, CngxArea, CngxChart
|
|
2181
2274
|
*
|
|
2182
|
-
* <example-url
|
|
2183
|
-
* <example-url
|
|
2184
|
-
* <example-url
|
|
2185
|
-
* <example-url
|
|
2186
|
-
* <example-url
|
|
2187
|
-
* <example-url
|
|
2188
|
-
* <example-url
|
|
2275
|
+
* <example-url>/#/common/chart/primitives/async-state-machine-on-the-primitive</example-url>
|
|
2276
|
+
* <example-url>/#/common/chart/primitives/combo-bars-moving-average-line</example-url>
|
|
2277
|
+
* <example-url>/#/common/chart/primitives/line-area-threshold-band</example-url>
|
|
2278
|
+
* <example-url>/#/common/chart/primitives/multi-series-line-axis-labels-legend</example-url>
|
|
2279
|
+
* <example-url>/#/common/chart/primitives/responsive-fills-parent-width</example-url>
|
|
2280
|
+
* <example-url>/#/common/chart/primitives/scatter-with-performance-zones</example-url>
|
|
2281
|
+
* <example-url>/#/common/chart/primitives/time-series-with-threshold-zones</example-url>
|
|
2189
2282
|
*/
|
|
2190
2283
|
declare class CngxBand implements CngxChartLayer {
|
|
2284
|
+
/**
|
|
2285
|
+
* Required y value of one edge of the band, projected through the chart's y scale. The rectangle
|
|
2286
|
+
* spans the plot width between `[from]` and `[to]`, given in either order.
|
|
2287
|
+
*/
|
|
2191
2288
|
readonly from: _angular_core.InputSignal<number>;
|
|
2289
|
+
/**
|
|
2290
|
+
* Required y value of the other edge of the band; see `[from]`.
|
|
2291
|
+
*/
|
|
2192
2292
|
readonly to: _angular_core.InputSignal<number>;
|
|
2293
|
+
/**
|
|
2294
|
+
* Optional text drawn inside the band, vertically centred and 4 units in from the plot's left
|
|
2295
|
+
* edge. Unset draws no text.
|
|
2296
|
+
*/
|
|
2193
2297
|
readonly label: _angular_core.InputSignal<string | null>;
|
|
2298
|
+
/**
|
|
2299
|
+
* Fill opacity of the band, as a number or numeric string. Unset falls back to
|
|
2300
|
+
* `--cngx-band-opacity` (default `0.12`).
|
|
2301
|
+
*/
|
|
2194
2302
|
readonly opacity: _angular_core.InputSignal<string | number | null>;
|
|
2303
|
+
/**
|
|
2304
|
+
* CSS colour of the band fill, applied as an inline style and read by the canvas renderer. Unset
|
|
2305
|
+
* falls back to `--cngx-band-color`, then `--cngx-chart-secondary`.
|
|
2306
|
+
*/
|
|
2195
2307
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2196
2308
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
|
|
2197
2309
|
protected readonly rect: _angular_core.Signal<{
|
|
@@ -2210,8 +2322,6 @@ declare class CngxBand implements CngxChartLayer {
|
|
|
2210
2322
|
* renderer reads scales / dimensions through the chart context and
|
|
2211
2323
|
* schedules its own teardown through the `DestroyRef` - it never injects
|
|
2212
2324
|
* the concrete `CngxChart` class.
|
|
2213
|
-
*
|
|
2214
|
-
* @category common/chart/renderer
|
|
2215
2325
|
*/
|
|
2216
2326
|
interface ChartRendererDeps {
|
|
2217
2327
|
readonly ctx: CngxChartContext;
|
|
@@ -2234,17 +2344,21 @@ interface ChartRendererDeps {
|
|
|
2234
2344
|
* The SVG backend is a passthrough (layer atoms self-render); the Canvas
|
|
2235
2345
|
* backend paints the geometries onto a `<canvas>` 2D context.
|
|
2236
2346
|
*
|
|
2237
|
-
* @category common/chart/renderer
|
|
2238
2347
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer.ts
|
|
2239
|
-
* @since 0.
|
|
2348
|
+
* @since 0.3.0
|
|
2240
2349
|
*/
|
|
2241
2350
|
interface CngxChartRenderer {
|
|
2242
2351
|
/** Which backend this instance is. */
|
|
2243
2352
|
readonly mode: 'svg' | 'canvas';
|
|
2244
2353
|
/** Attach to the chart host (insert a `<canvas>`, wire teardown, ...). */
|
|
2245
2354
|
mount(host: HTMLElement, ctx: CngxChartContext): void;
|
|
2246
|
-
/**
|
|
2247
|
-
|
|
2355
|
+
/**
|
|
2356
|
+
* Paint the current layer geometries. Called on every geometry emission.
|
|
2357
|
+
* `elements[i]`, when given, is the host element of the layer that emitted
|
|
2358
|
+
* `geometries[i]`; a backend that resolves CSS custom properties reads them
|
|
2359
|
+
* there, so a per-layer token override reaches it. A backend may ignore it.
|
|
2360
|
+
*/
|
|
2361
|
+
paint(geometries: readonly LayerGeometry[], elements?: readonly Element[]): void;
|
|
2248
2362
|
/** Detach and release resources. */
|
|
2249
2363
|
destroy(): void;
|
|
2250
2364
|
/** Drop any cached theme colors (called on layout/theming reflow). Optional. */
|
|
@@ -2257,9 +2371,8 @@ interface CngxChartRenderer {
|
|
|
2257
2371
|
* {@link CNGX_CHART_RENDERER_FACTORY} to add a third backend (WebGL, ...)
|
|
2258
2372
|
* without touching layer atoms.
|
|
2259
2373
|
*
|
|
2260
|
-
* @category common/chart/renderer
|
|
2261
2374
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer.ts
|
|
2262
|
-
* @since 0.
|
|
2375
|
+
* @since 0.3.0
|
|
2263
2376
|
*/
|
|
2264
2377
|
type CngxChartRendererFactory = (mode: 'svg' | 'canvas', deps: ChartRendererDeps) => CngxChartRenderer;
|
|
2265
2378
|
|
|
@@ -2273,9 +2386,8 @@ type CngxChartRendererFactory = (mode: 'svg' | 'canvas', deps: ChartRendererDeps
|
|
|
2273
2386
|
* @param _deps unused; kept for factory signature symmetry with
|
|
2274
2387
|
* {@link createCanvasRenderer}.
|
|
2275
2388
|
*
|
|
2276
|
-
* @category common/chart/renderer
|
|
2277
2389
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/svg-renderer.ts
|
|
2278
|
-
* @since 0.
|
|
2390
|
+
* @since 0.3.0
|
|
2279
2391
|
*/
|
|
2280
2392
|
declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
|
|
2281
2393
|
|
|
@@ -2285,8 +2397,13 @@ declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
|
|
|
2285
2397
|
* its 2D context: `Path2D` stroke/fill for line/area, per-mark loops for
|
|
2286
2398
|
* bar/scatter, `moveTo`/`lineTo` for threshold, `fillRect` for band.
|
|
2287
2399
|
*
|
|
2288
|
-
* Colors
|
|
2289
|
-
*
|
|
2400
|
+
* Colors and the numeric tokens (stroke width, opacities, point radius)
|
|
2401
|
+
* resolve through a closure-local cache keyed by layer element: the first
|
|
2402
|
+
* `paint()` reads each CSS custom property once per layer via
|
|
2403
|
+
* `getComputedStyle(layerHost)`, so a per-layer override (`style` on the
|
|
2404
|
+
* `<svg:g cngxLine>`) reaches the canvas exactly as it reaches the SVG marks,
|
|
2405
|
+
* and custom properties inherit, so a layer that sets nothing reads the chart
|
|
2406
|
+
* host's value. Without layer elements the chart host is read. Subsequent
|
|
2290
2407
|
* paints hit the cache, so the paint hot path performs zero synchronous
|
|
2291
2408
|
* DOM reads. {@link CngxChartRenderer.invalidateColorCache} clears it -
|
|
2292
2409
|
* the renderer controller calls it on a `dimensions()` change (a proxy
|
|
@@ -2320,13 +2437,10 @@ declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
|
|
|
2320
2437
|
* other engines are unverified, so the backend paints the probed values.
|
|
2321
2438
|
* The renderer controller watches `(forced-colors: active)` and
|
|
2322
2439
|
* `(prefers-color-scheme: dark)` and invalidates the colour cache before
|
|
2323
|
-
* repainting on a flip, so a contrast-theme switch repaints at once.
|
|
2324
|
-
* difference from SVG: a layer wrapped in an extra `<svg:g>` still counts
|
|
2325
|
-
* here, since the backend only sees the layer order.
|
|
2440
|
+
* repainting on a flip, so a contrast-theme switch repaints at once.
|
|
2326
2441
|
*
|
|
2327
|
-
* @category common/chart/renderer
|
|
2328
2442
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/canvas-renderer.ts
|
|
2329
|
-
* @since 0.
|
|
2443
|
+
* @since 0.3.0
|
|
2330
2444
|
*/
|
|
2331
2445
|
declare function createCanvasRenderer(deps: ChartRendererDeps): CngxChartRenderer;
|
|
2332
2446
|
|
|
@@ -2339,9 +2453,8 @@ declare function createCanvasRenderer(deps: ChartRendererDeps): CngxChartRendere
|
|
|
2339
2453
|
* bare provider) to tune the SVG/Canvas crossover for a given app's
|
|
2340
2454
|
* hardware profile.
|
|
2341
2455
|
*
|
|
2342
|
-
* @category common/chart/renderer
|
|
2343
2456
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-threshold.ts
|
|
2344
|
-
* @since 0.
|
|
2457
|
+
* @since 0.3.0
|
|
2345
2458
|
* @relatedTo provideChartRenderer, withChartRendererThreshold
|
|
2346
2459
|
*/
|
|
2347
2460
|
declare const CNGX_CHART_RENDERER_THRESHOLD: InjectionToken<number>;
|
|
@@ -2353,9 +2466,8 @@ declare const CNGX_CHART_RENDERER_THRESHOLD: InjectionToken<number>;
|
|
|
2353
2466
|
* (WebGL, ...) supplies a whole replacement via
|
|
2354
2467
|
* {@link withChartRendererFactory}.
|
|
2355
2468
|
*
|
|
2356
|
-
* @category common/chart/renderer
|
|
2357
2469
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2358
|
-
* @since 0.
|
|
2470
|
+
* @since 0.3.0
|
|
2359
2471
|
*/
|
|
2360
2472
|
declare const createDefaultChartRenderer: CngxChartRendererFactory;
|
|
2361
2473
|
/**
|
|
@@ -2364,17 +2476,14 @@ declare const createDefaultChartRenderer: CngxChartRendererFactory;
|
|
|
2364
2476
|
* {@link withChartRendererFactory} to add a backend without touching layer
|
|
2365
2477
|
* atoms.
|
|
2366
2478
|
*
|
|
2367
|
-
* @category common/chart/renderer
|
|
2368
2479
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2369
|
-
* @since 0.
|
|
2480
|
+
* @since 0.3.0
|
|
2370
2481
|
* @relatedTo provideChartRenderer, withChartRendererFactory
|
|
2371
2482
|
*/
|
|
2372
2483
|
declare const CNGX_CHART_RENDERER_FACTORY: InjectionToken<CngxChartRendererFactory>;
|
|
2373
2484
|
/**
|
|
2374
2485
|
* A single renderer-config override produced by a `with*` feature and
|
|
2375
2486
|
* folded by {@link provideChartRenderer}.
|
|
2376
|
-
*
|
|
2377
|
-
* @category common/chart/renderer
|
|
2378
2487
|
*/
|
|
2379
2488
|
interface CngxChartRendererFeature {
|
|
2380
2489
|
readonly providers: Provider[];
|
|
@@ -2382,9 +2491,8 @@ interface CngxChartRendererFeature {
|
|
|
2382
2491
|
/**
|
|
2383
2492
|
* Override the SVG->Canvas auto-switch cutoff (default `500`).
|
|
2384
2493
|
*
|
|
2385
|
-
* @category common/chart/renderer
|
|
2386
2494
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2387
|
-
* @since 0.
|
|
2495
|
+
* @since 0.3.0
|
|
2388
2496
|
*/
|
|
2389
2497
|
declare function withChartRendererThreshold(n: number): CngxChartRendererFeature;
|
|
2390
2498
|
/**
|
|
@@ -2392,9 +2500,8 @@ declare function withChartRendererThreshold(n: number): CngxChartRendererFeature
|
|
|
2392
2500
|
* third. Consumers wanting a heuristic swap supply a custom factory here
|
|
2393
2501
|
* (the heuristic-swap axis ships no dedicated token at v2).
|
|
2394
2502
|
*
|
|
2395
|
-
* @category common/chart/renderer
|
|
2396
2503
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2397
|
-
* @since 0.
|
|
2504
|
+
* @since 0.3.0
|
|
2398
2505
|
*/
|
|
2399
2506
|
declare function withChartRendererFactory(fn: CngxChartRendererFactory): CngxChartRendererFeature;
|
|
2400
2507
|
/**
|
|
@@ -2406,30 +2513,31 @@ declare function withChartRendererFactory(fn: CngxChartRendererFactory): CngxCha
|
|
|
2406
2513
|
* provideChartRenderer(withChartRendererThreshold(2000))
|
|
2407
2514
|
* ```
|
|
2408
2515
|
*
|
|
2409
|
-
* @category common/chart/renderer
|
|
2410
2516
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2411
|
-
* @since 0.
|
|
2517
|
+
* @since 0.3.0
|
|
2412
2518
|
* @relatedTo withChartRendererThreshold, withChartRendererFactory
|
|
2413
2519
|
*/
|
|
2414
2520
|
declare function provideChartRenderer(...features: CngxChartRendererFeature[]): Provider[];
|
|
2415
2521
|
|
|
2416
2522
|
/**
|
|
2417
2523
|
* Construction dependencies for {@link createChartRendererController}.
|
|
2418
|
-
*
|
|
2419
|
-
* @category common/chart/renderer
|
|
2420
2524
|
*/
|
|
2421
2525
|
interface ChartRendererControllerDeps {
|
|
2422
2526
|
readonly host: HTMLElement;
|
|
2423
2527
|
readonly ctx: CngxChartContext;
|
|
2424
2528
|
readonly mode: Signal<'svg' | 'canvas'>;
|
|
2425
2529
|
readonly geometries: Signal<readonly LayerGeometry[]>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Host element of each layer, in the order of {@link geometries}. Passed to
|
|
2532
|
+
* `paint()` as read, never tracked: a layer added, removed or reordered
|
|
2533
|
+
* already emits new geometries.
|
|
2534
|
+
*/
|
|
2535
|
+
readonly layerElements?: Signal<readonly Element[]>;
|
|
2426
2536
|
readonly factory: CngxChartRendererFactory;
|
|
2427
2537
|
readonly destroyRef: DestroyRef;
|
|
2428
2538
|
}
|
|
2429
2539
|
/**
|
|
2430
2540
|
* Handle returned by {@link createChartRendererController}.
|
|
2431
|
-
*
|
|
2432
|
-
* @category common/chart/renderer
|
|
2433
2541
|
*/
|
|
2434
2542
|
interface CngxChartRendererController {
|
|
2435
2543
|
readonly currentMode: Signal<'svg' | 'canvas'>;
|
|
@@ -2460,9 +2568,8 @@ interface CngxChartRendererController {
|
|
|
2460
2568
|
* calls directly - no DI token, since the only second consumer today is a
|
|
2461
2569
|
* test double, which injects a fake `factory` through the deps.
|
|
2462
2570
|
*
|
|
2463
|
-
* @category common/chart/renderer
|
|
2464
2571
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer-controller.ts
|
|
2465
|
-
* @since 0.
|
|
2572
|
+
* @since 0.3.0
|
|
2466
2573
|
*/
|
|
2467
2574
|
declare function createChartRendererController(deps: ChartRendererControllerDeps): CngxChartRendererController;
|
|
2468
2575
|
|
|
@@ -2480,24 +2587,53 @@ declare function createChartRendererController(deps: ChartRendererControllerDeps
|
|
|
2480
2587
|
* from the chart's auto-Summary; consumers can override via
|
|
2481
2588
|
* `[ariaLabel]`.
|
|
2482
2589
|
*
|
|
2483
|
-
* @category common/chart/presets
|
|
2484
|
-
* @docsKind primary
|
|
2485
2590
|
* @wcag AA
|
|
2486
2591
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/sparkline.component.ts
|
|
2487
|
-
* @since 0.
|
|
2592
|
+
* @since 0.3.0
|
|
2488
2593
|
* @relatedTo CngxMiniArea, CngxMiniBar, CngxChart
|
|
2489
2594
|
*
|
|
2490
|
-
* <example-url
|
|
2491
|
-
* <example-url
|
|
2492
|
-
* <example-url
|
|
2595
|
+
* <example-url>/#/common/chart/sparkline/async-state-machine</example-url>
|
|
2596
|
+
* <example-url>/#/common/chart/sparkline/basic-sparklines</example-url>
|
|
2597
|
+
* <example-url>/#/common/chart/sparkline/with-area-fill</example-url>
|
|
2598
|
+
* @axis level atom
|
|
2493
2599
|
*/
|
|
2494
2600
|
declare class CngxSparkline {
|
|
2601
|
+
/**
|
|
2602
|
+
* Required series of y values, drawn left to right at evenly spaced index positions. The vertical
|
|
2603
|
+
* scale spans the data minimum to maximum, padded by one unit either side when every value is
|
|
2604
|
+
* equal.
|
|
2605
|
+
*/
|
|
2495
2606
|
readonly data: _angular_core.InputSignal<readonly number[]>;
|
|
2607
|
+
/**
|
|
2608
|
+
* Width of the chart in px, also the width of the loading skeleton. Default `80`.
|
|
2609
|
+
*/
|
|
2496
2610
|
readonly width: _angular_core.InputSignal<number>;
|
|
2611
|
+
/**
|
|
2612
|
+
* Height of the chart in px, also the height of the loading skeleton. Default `24`.
|
|
2613
|
+
*/
|
|
2497
2614
|
readonly height: _angular_core.InputSignal<number>;
|
|
2615
|
+
/**
|
|
2616
|
+
* Stroke width of the line. A number is read as px and a string passes through as a CSS length;
|
|
2617
|
+
* unset falls back to `--cngx-line-stroke-width` (default `1.5px`).
|
|
2618
|
+
*/
|
|
2498
2619
|
readonly strokeWidth: _angular_core.InputSignal<string | number | null>;
|
|
2620
|
+
/**
|
|
2621
|
+
* Fills the area under the line, down to the lowest value of `[data]`, with the same colour as the
|
|
2622
|
+
* line. Default `false`.
|
|
2623
|
+
*/
|
|
2499
2624
|
readonly showArea: _angular_core.InputSignal<boolean>;
|
|
2625
|
+
/**
|
|
2626
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
2627
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
2628
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
2629
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
2630
|
+
* always draws.
|
|
2631
|
+
*/
|
|
2500
2632
|
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly number[]> | undefined>;
|
|
2633
|
+
/**
|
|
2634
|
+
* Accessible name of the chart, bound as `[aria-label]`; replaces the summary the chart generates
|
|
2635
|
+
* from the data. Unset or empty keeps that generated summary.
|
|
2636
|
+
*/
|
|
2501
2637
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2502
2638
|
private readonly preset;
|
|
2503
2639
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2523,22 +2659,48 @@ declare class CngxSparkline {
|
|
|
2523
2659
|
* `role="meter"`. A bound `[aria-label]` always wins and overrides the
|
|
2524
2660
|
* visible caption.
|
|
2525
2661
|
*
|
|
2526
|
-
* @category common/chart/presets
|
|
2527
|
-
* @docsKind primary
|
|
2528
2662
|
* @wcag AA
|
|
2529
2663
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/mini-bar.component.ts
|
|
2530
|
-
* @since 0.
|
|
2664
|
+
* @since 0.3.0
|
|
2531
2665
|
* @relatedTo CngxMiniArea, CngxSparkline, CngxDonut, CngxBullet
|
|
2532
2666
|
*
|
|
2533
|
-
* <example-url
|
|
2534
|
-
* <example-url
|
|
2667
|
+
* <example-url>/#/common/chart/mini-bar/async-state-machine</example-url>
|
|
2668
|
+
* <example-url>/#/common/chart/mini-bar/basic-readings</example-url>
|
|
2669
|
+
* @axis level atom
|
|
2535
2670
|
*/
|
|
2536
2671
|
declare class CngxMiniBar {
|
|
2672
|
+
/**
|
|
2673
|
+
* Required current reading. The fill width is its position between `[min]` and `[max]`, clamped to
|
|
2674
|
+
* 0-100%, and the value is exposed as `aria-valuenow`.
|
|
2675
|
+
*/
|
|
2537
2676
|
readonly value: _angular_core.InputSignal<number>;
|
|
2677
|
+
/**
|
|
2678
|
+
* Upper end of the track, exposed as `aria-valuemax`. Default `100`; a value not above `[min]`
|
|
2679
|
+
* draws an empty fill.
|
|
2680
|
+
*/
|
|
2538
2681
|
readonly max: _angular_core.InputSignal<number>;
|
|
2682
|
+
/**
|
|
2683
|
+
* Lower end of the track, exposed as `aria-valuemin`. Default `0`.
|
|
2684
|
+
*/
|
|
2539
2685
|
readonly min: _angular_core.InputSignal<number>;
|
|
2686
|
+
/**
|
|
2687
|
+
* Visible caption above the track, which also names the host (`aria-label`) when `[aria-label]` is
|
|
2688
|
+
* unbound. Unset shows no caption.
|
|
2689
|
+
*/
|
|
2540
2690
|
readonly label: _angular_core.InputSignal<string | null>;
|
|
2691
|
+
/**
|
|
2692
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
2693
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
2694
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
2695
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
2696
|
+
* always draws. `aria-valuenow`, `aria-valuemin` and `aria-valuemax` are set only while the
|
|
2697
|
+
* drawing shows.
|
|
2698
|
+
*/
|
|
2541
2699
|
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
2700
|
+
/**
|
|
2701
|
+
* Accessible name of the meter, bound as `[aria-label]` and set on the host. Unset falls back to
|
|
2702
|
+
* `[label]`; with neither the meter is unnamed and logs a dev-mode warning.
|
|
2703
|
+
*/
|
|
2542
2704
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2543
2705
|
private readonly preset;
|
|
2544
2706
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2566,21 +2728,44 @@ declare class CngxMiniBar {
|
|
|
2566
2728
|
* Use cases: budget variance ("$+45k over"), score deltas ("−12%
|
|
2567
2729
|
* vs target"), KPI swing visualisations.
|
|
2568
2730
|
*
|
|
2569
|
-
* @category common/chart/presets
|
|
2570
|
-
* @docsKind primary
|
|
2571
2731
|
* @wcag AA
|
|
2572
2732
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/deviation-bar.component.ts
|
|
2573
|
-
* @since 0.
|
|
2733
|
+
* @since 0.3.0
|
|
2574
2734
|
* @relatedTo CngxMiniBar, CngxBullet, CngxStackedBar
|
|
2575
2735
|
*
|
|
2576
|
-
* <example-url
|
|
2577
|
-
* <example-url
|
|
2736
|
+
* <example-url>/#/common/chart/deviation-bar/async-state-machine</example-url>
|
|
2737
|
+
* <example-url>/#/common/chart/deviation-bar/variance-readings</example-url>
|
|
2738
|
+
* @axis level atom
|
|
2578
2739
|
*/
|
|
2579
2740
|
declare class CngxDeviationBar {
|
|
2741
|
+
/**
|
|
2742
|
+
* Required current reading. The fill grows from the centre mark to the right when the value is
|
|
2743
|
+
* above `[baseline]` and to the left when below, and the value is exposed as `aria-valuenow`.
|
|
2744
|
+
*/
|
|
2580
2745
|
readonly value: _angular_core.InputSignal<number>;
|
|
2746
|
+
/**
|
|
2747
|
+
* Reference value shown at the centre mark of the track. Default `0`; the meter range exposed to
|
|
2748
|
+
* assistive technology is `baseline - magnitude` to `baseline + magnitude`.
|
|
2749
|
+
*/
|
|
2581
2750
|
readonly baseline: _angular_core.InputSignal<number>;
|
|
2751
|
+
/**
|
|
2752
|
+
* Distance from `[baseline]` to either end of the track, so a deviation of this size fills one
|
|
2753
|
+
* half and larger ones are clamped. Default `100`; 0 or less draws no fill.
|
|
2754
|
+
*/
|
|
2582
2755
|
readonly magnitude: _angular_core.InputSignal<number>;
|
|
2756
|
+
/**
|
|
2757
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
2758
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
2759
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
2760
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
2761
|
+
* always draws. `aria-valuenow`, `aria-valuemin` and `aria-valuemax` are set only while the
|
|
2762
|
+
* drawing shows.
|
|
2763
|
+
*/
|
|
2583
2764
|
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
2765
|
+
/**
|
|
2766
|
+
* Accessible name of the meter, bound as `[aria-label]` and set on the host. Unset leaves the
|
|
2767
|
+
* meter unnamed, which logs a dev-mode warning.
|
|
2768
|
+
*/
|
|
2584
2769
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2585
2770
|
private readonly preset;
|
|
2586
2771
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2618,22 +2803,47 @@ declare class CngxDeviationBar {
|
|
|
2618
2803
|
* Default viewBox 80×24. Theming via `--cngx-mini-area-color`
|
|
2619
2804
|
* (atom-local) → `--cngx-chart-primary` (chart-level) cascade.
|
|
2620
2805
|
*
|
|
2621
|
-
* @category common/chart/presets
|
|
2622
|
-
* @docsKind primary
|
|
2623
2806
|
* @wcag AA
|
|
2624
2807
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/mini-area.component.ts
|
|
2625
|
-
* @since 0.
|
|
2808
|
+
* @since 0.3.0
|
|
2626
2809
|
* @relatedTo CngxSparkline, CngxMiniBar, CngxChart
|
|
2627
2810
|
*
|
|
2628
|
-
* <example-url
|
|
2629
|
-
* <example-url
|
|
2811
|
+
* <example-url>/#/common/chart/mini-area/async-state-machine</example-url>
|
|
2812
|
+
* <example-url>/#/common/chart/mini-area/inline-area-trends</example-url>
|
|
2813
|
+
* @axis level atom
|
|
2630
2814
|
*/
|
|
2631
2815
|
declare class CngxMiniArea {
|
|
2816
|
+
/**
|
|
2817
|
+
* Required series of y values, drawn left to right at evenly spaced index positions. The vertical
|
|
2818
|
+
* scale spans the data minimum to maximum, padded by one unit either side when every value is
|
|
2819
|
+
* equal.
|
|
2820
|
+
*/
|
|
2632
2821
|
readonly data: _angular_core.InputSignal<readonly number[]>;
|
|
2822
|
+
/**
|
|
2823
|
+
* Width of the chart in px, also the width of the loading skeleton. Default `80`.
|
|
2824
|
+
*/
|
|
2633
2825
|
readonly width: _angular_core.InputSignal<number>;
|
|
2826
|
+
/**
|
|
2827
|
+
* Height of the chart in px, also the height of the loading skeleton. Default `24`.
|
|
2828
|
+
*/
|
|
2634
2829
|
readonly height: _angular_core.InputSignal<number>;
|
|
2830
|
+
/**
|
|
2831
|
+
* Fill opacity of the area, as a number or numeric string. Unset falls back to
|
|
2832
|
+
* `--cngx-area-opacity` (default `0.18`).
|
|
2833
|
+
*/
|
|
2635
2834
|
readonly opacity: _angular_core.InputSignal<string | number | null>;
|
|
2835
|
+
/**
|
|
2836
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
2837
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
2838
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
2839
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
2840
|
+
* always draws.
|
|
2841
|
+
*/
|
|
2636
2842
|
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly number[]> | undefined>;
|
|
2843
|
+
/**
|
|
2844
|
+
* Accessible name of the chart, bound as `[aria-label]`; replaces the summary the chart generates
|
|
2845
|
+
* from the data. Unset or empty keeps that generated summary.
|
|
2846
|
+
*/
|
|
2637
2847
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2638
2848
|
private readonly preset;
|
|
2639
2849
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2655,23 +2865,54 @@ declare class CngxMiniArea {
|
|
|
2655
2865
|
* same fallback `CngxMiniBar` uses. A bound `[aria-label]` always
|
|
2656
2866
|
* wins.
|
|
2657
2867
|
*
|
|
2658
|
-
* @category common/chart/presets
|
|
2659
|
-
* @docsKind primary
|
|
2660
2868
|
* @wcag AA
|
|
2661
2869
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/donut.component.ts
|
|
2662
|
-
* @since 0.
|
|
2870
|
+
* @since 0.3.0
|
|
2663
2871
|
* @relatedTo CngxBullet, CngxMiniBar, CngxDeviationBar
|
|
2664
2872
|
*
|
|
2665
|
-
* <example-url
|
|
2666
|
-
* <example-url
|
|
2873
|
+
* <example-url>/#/common/chart/donut/async-state-machine</example-url>
|
|
2874
|
+
* <example-url>/#/common/chart/donut/score-gauges</example-url>
|
|
2875
|
+
* @axis level atom
|
|
2667
2876
|
*/
|
|
2668
2877
|
declare class CngxDonut {
|
|
2878
|
+
/**
|
|
2879
|
+
* Required current reading. The foreground arc covers `value / max` of the ring, clamped to
|
|
2880
|
+
* 0-100%, running clockwise from 12 o'clock, and the value is exposed as `aria-valuenow`.
|
|
2881
|
+
*/
|
|
2669
2882
|
readonly value: _angular_core.InputSignal<number>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Value at which the ring is full, exposed as `aria-valuemax` (the minimum is fixed at 0). Default
|
|
2885
|
+
* `100`; 0 or less draws an empty ring.
|
|
2886
|
+
*/
|
|
2670
2887
|
readonly max: _angular_core.InputSignal<number>;
|
|
2888
|
+
/**
|
|
2889
|
+
* Outer diameter of the ring in px; sets the SVG width, height and viewBox and the size of the
|
|
2890
|
+
* loading skeleton. Default `48`.
|
|
2891
|
+
*/
|
|
2671
2892
|
readonly size: _angular_core.InputSignal<number>;
|
|
2893
|
+
/**
|
|
2894
|
+
* Stroke width of the ring and the arc in px; the radius is `(size - thickness) / 2`, so the
|
|
2895
|
+
* stroke stays inside `[size]`. Default `6`.
|
|
2896
|
+
*/
|
|
2672
2897
|
readonly thickness: _angular_core.InputSignal<number>;
|
|
2898
|
+
/**
|
|
2899
|
+
* Visible text centred inside the ring, which also names the host (`aria-label`) when
|
|
2900
|
+
* `[aria-label]` is unbound. Unset shows no text.
|
|
2901
|
+
*/
|
|
2673
2902
|
readonly label: _angular_core.InputSignal<string | null>;
|
|
2903
|
+
/**
|
|
2904
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
2905
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
2906
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
2907
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
2908
|
+
* always draws. `aria-valuenow`, `aria-valuemin` and `aria-valuemax` are set only while the
|
|
2909
|
+
* drawing shows.
|
|
2910
|
+
*/
|
|
2674
2911
|
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
2912
|
+
/**
|
|
2913
|
+
* Accessible name of the meter, bound as `[aria-label]` and set on the host. Unset falls back to
|
|
2914
|
+
* `[label]`; with neither the meter is unnamed and logs a dev-mode warning.
|
|
2915
|
+
*/
|
|
2675
2916
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2676
2917
|
private readonly preset;
|
|
2677
2918
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2698,8 +2939,6 @@ declare class CngxDonut {
|
|
|
2698
2939
|
* Bullet chart range entry - a colour band stretching from one value
|
|
2699
2940
|
* to another along the bullet's axis. Typical use: traffic-light
|
|
2700
2941
|
* bands ("good" / "fair" / "poor") behind the actual+target bar.
|
|
2701
|
-
*
|
|
2702
|
-
* @category common/chart/presets
|
|
2703
2942
|
*/
|
|
2704
2943
|
interface CngxBulletRange {
|
|
2705
2944
|
readonly from: number;
|
|
@@ -2720,22 +2959,51 @@ interface RangeRendering {
|
|
|
2720
2959
|
* `[actual]` filled bar, and a `[target]` vertical marker. Pure DOM,
|
|
2721
2960
|
* no SVG. Host carries `role="meter"`.
|
|
2722
2961
|
*
|
|
2723
|
-
* @category common/chart/presets
|
|
2724
|
-
* @docsKind primary
|
|
2725
2962
|
* @wcag AA
|
|
2726
2963
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/bullet.component.ts
|
|
2727
|
-
* @since 0.
|
|
2964
|
+
* @since 0.3.0
|
|
2728
2965
|
* @relatedTo CngxDonut, CngxMiniBar, CngxDeviationBar
|
|
2729
2966
|
*
|
|
2730
|
-
* <example-url
|
|
2731
|
-
* <example-url
|
|
2967
|
+
* <example-url>/#/common/chart/bullet/async-state-machine</example-url>
|
|
2968
|
+
* <example-url>/#/common/chart/bullet/performance-vs-target</example-url>
|
|
2969
|
+
* @axis level atom
|
|
2732
2970
|
*/
|
|
2733
2971
|
declare class CngxBullet {
|
|
2972
|
+
/**
|
|
2973
|
+
* Required current reading. The filled bar runs from 0 to this value, clamped to the scale
|
|
2974
|
+
* maximum, and the value is exposed as `aria-valuenow`.
|
|
2975
|
+
*/
|
|
2734
2976
|
readonly actual: _angular_core.InputSignal<number>;
|
|
2977
|
+
/**
|
|
2978
|
+
* Value of the vertical target marker, on the same 0 to maximum scale as the bar. Default `null`,
|
|
2979
|
+
* which does not hide the marker: it stays at the start of the track (0%).
|
|
2980
|
+
*/
|
|
2735
2981
|
readonly target: _angular_core.InputSignal<number | null>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Scale maximum, exposed as `aria-valuemax` (the minimum is fixed at 0). Default `null`, and a
|
|
2984
|
+
* value of 0 or less counts as unset: the maximum is then the largest of `[actual]`, `[target]`
|
|
2985
|
+
* and every range's `to`, or 1 when none is above 0.
|
|
2986
|
+
*/
|
|
2736
2987
|
readonly max: _angular_core.InputSignal<number | null>;
|
|
2988
|
+
/**
|
|
2989
|
+
* Background bands behind the bar, each `{ from, to, color?, label? }` on the same scale with
|
|
2990
|
+
* `from` and `to` in either order. Default empty; a band without `color` paints nothing, and
|
|
2991
|
+
* `label` is not drawn.
|
|
2992
|
+
*/
|
|
2737
2993
|
readonly ranges: _angular_core.InputSignal<readonly CngxBulletRange[]>;
|
|
2994
|
+
/**
|
|
2995
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
2996
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
2997
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
2998
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
2999
|
+
* always draws. `aria-valuenow`, `aria-valuemin` and `aria-valuemax` are set only while the
|
|
3000
|
+
* drawing shows.
|
|
3001
|
+
*/
|
|
2738
3002
|
readonly state: _angular_core.InputSignal<CngxAsyncState<number> | undefined>;
|
|
3003
|
+
/**
|
|
3004
|
+
* Accessible name of the meter, bound as `[aria-label]` and set on the host. Unset leaves the
|
|
3005
|
+
* meter unnamed, which logs a dev-mode warning.
|
|
3006
|
+
*/
|
|
2739
3007
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2740
3008
|
private readonly preset;
|
|
2741
3009
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2759,8 +3027,6 @@ declare class CngxBullet {
|
|
|
2759
3027
|
|
|
2760
3028
|
/**
|
|
2761
3029
|
* One segment in a stacked-bar series: a value, a label, optional colour.
|
|
2762
|
-
*
|
|
2763
|
-
* @category common/chart/presets
|
|
2764
3030
|
*/
|
|
2765
3031
|
interface CngxStackedSegment {
|
|
2766
3032
|
readonly value: number;
|
|
@@ -2783,20 +3049,41 @@ interface SegmentRendering {
|
|
|
2783
3049
|
* bounded reading; the SR description enumerates segments via the
|
|
2784
3050
|
* auto-generated `aria-label` (or the `[ariaLabel]` override).
|
|
2785
3051
|
*
|
|
2786
|
-
* @category common/chart/presets
|
|
2787
|
-
* @docsKind primary
|
|
2788
3052
|
* @wcag AA
|
|
2789
3053
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/stacked-bar.component.ts
|
|
2790
|
-
* @since 0.
|
|
3054
|
+
* @since 0.3.0
|
|
2791
3055
|
* @relatedTo CngxBar, CngxDeviationBar, CngxBullet
|
|
2792
3056
|
*
|
|
2793
|
-
* <example-url
|
|
2794
|
-
* <example-url
|
|
3057
|
+
* <example-url>/#/common/chart/stacked-bar/async-state-machine</example-url>
|
|
3058
|
+
* <example-url>/#/common/chart/stacked-bar/proportional-share-strips</example-url>
|
|
3059
|
+
* @axis level atom
|
|
2795
3060
|
*/
|
|
2796
3061
|
declare class CngxStackedBar {
|
|
3062
|
+
/**
|
|
3063
|
+
* Required segments drawn left to right in order, each `{ value, label, color? }` and sized as
|
|
3064
|
+
* `value / total` of the track. The label and value also feed each segment's `title` tooltip and
|
|
3065
|
+
* the generated `aria-label`; a segment without `color` uses `--cngx-stacked-bar-segment-color`.
|
|
3066
|
+
*/
|
|
2797
3067
|
readonly segments: _angular_core.InputSignal<readonly CngxStackedSegment[]>;
|
|
3068
|
+
/**
|
|
3069
|
+
* Value that fills the whole track. Default `null`, and a value of 0 or less counts as unset: the
|
|
3070
|
+
* total is then the sum of the segment values (1 when that is not above 0), and segments beyond a
|
|
3071
|
+
* smaller total are clipped by the track.
|
|
3072
|
+
*/
|
|
2798
3073
|
readonly total: _angular_core.InputSignal<number | null>;
|
|
3074
|
+
/**
|
|
3075
|
+
* Optional async state that picks the view: a skeleton with `aria-busy` on the host during the
|
|
3076
|
+
* first load, the built-in empty or error text after an empty or failed first load (copy from
|
|
3077
|
+
* `CNGX_CHART_I18N`), nothing while idle, the drawing otherwise. Only its status, first-load and
|
|
3078
|
+
* empty flags are read; the drawn values come from the preset's own inputs, and an unbound state
|
|
3079
|
+
* always draws. The host `aria-label` switches to the built-in loading, empty or error text while
|
|
3080
|
+
* the bar is loading, empty or failed.
|
|
3081
|
+
*/
|
|
2799
3082
|
readonly state: _angular_core.InputSignal<CngxAsyncState<readonly CngxStackedSegment[]> | undefined>;
|
|
3083
|
+
/**
|
|
3084
|
+
* Accessible name of the host (`role="img"`), bound as `[aria-label]`; replaces the generated
|
|
3085
|
+
* segment summary while the bar draws. Unset or empty keeps that summary.
|
|
3086
|
+
*/
|
|
2800
3087
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2801
3088
|
private readonly preset;
|
|
2802
3089
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|