@cngx/common 0.1.0-rc.8 → 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 +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- 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 +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- 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 +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- 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 +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -5
- 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 +434 -0
- package/theming/components/cngx-popover.css +37 -9
- 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 +488 -112
- 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 +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -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,11 +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
|
|
75
|
+
* an empty palette throws a `CngxRuntimeError` ([`CNGX1049`](/error-codes/cngx1049.md))
|
|
76
|
+
* synchronously at construction time.
|
|
84
77
|
* @returns Callable `(v: T) => string` returning the palette entry for
|
|
85
78
|
* `v`. Lookup of an unknown value returns the palette's first entry.
|
|
86
|
-
*
|
|
87
|
-
* @category common/chart/scales
|
|
88
79
|
*/
|
|
89
80
|
declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly string[]): (v: T) => string;
|
|
90
81
|
|
|
@@ -114,15 +105,11 @@ declare function createOrdinalScale<T>(domain: readonly T[], colors: readonly st
|
|
|
114
105
|
* area is computed against).
|
|
115
106
|
* @returns a fresh array of at most `targetSize` rows, or the input by
|
|
116
107
|
* reference when no reduction is needed.
|
|
117
|
-
*
|
|
118
|
-
* @category common/chart/buffer
|
|
119
108
|
*/
|
|
120
109
|
declare function downsampleLTTB<T>(data: readonly T[], targetSize: number, xAccessor: (d: T, i: number) => number, yAccessor: (d: T, i: number) => number): readonly T[];
|
|
121
110
|
|
|
122
111
|
/**
|
|
123
112
|
* Construction options for {@link injectChartBuffer}.
|
|
124
|
-
*
|
|
125
|
-
* @category common/chart/buffer
|
|
126
113
|
*/
|
|
127
114
|
interface ChartBufferOptions<T> {
|
|
128
115
|
/** Ring capacity - the maximum rows retained before eviction. */
|
|
@@ -141,8 +128,6 @@ interface ChartBufferOptions<T> {
|
|
|
141
128
|
* The realtime feed handle returned by {@link injectChartBuffer}. Bind
|
|
142
129
|
* `points` to a chart data input; drive it from any high-frequency producer
|
|
143
130
|
* via `push` / `pushBatch`.
|
|
144
|
-
*
|
|
145
|
-
* @category common/chart/buffer
|
|
146
131
|
*/
|
|
147
132
|
interface CngxChartBuffer<T> {
|
|
148
133
|
/**
|
|
@@ -192,27 +177,113 @@ interface CngxChartBuffer<T> {
|
|
|
192
177
|
* }
|
|
193
178
|
* }
|
|
194
179
|
* ```
|
|
195
|
-
*
|
|
196
|
-
* @category common/chart/buffer
|
|
197
180
|
*/
|
|
198
181
|
declare function injectChartBuffer<T>(opts: ChartBufferOptions<T>): CngxChartBuffer<T>;
|
|
199
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
|
+
|
|
200
275
|
/**
|
|
201
276
|
* Numeric input shape every concrete scale accepts. Linear scales take
|
|
202
277
|
* `number`, time scales take `Date | number`, band scales take `string`
|
|
203
278
|
* or arbitrary references via {@link createBandScale}'s generic. The
|
|
204
279
|
* union narrows at the layer atom (`[cngxLine]`, `[cngxBar]`, ...);
|
|
205
280
|
* the chart context surface stays scale-agnostic.
|
|
206
|
-
*
|
|
207
|
-
* @category common/chart
|
|
208
281
|
*/
|
|
209
282
|
type XScaleInput = number | Date | string;
|
|
210
283
|
/**
|
|
211
284
|
* Generic scale function shape. Maps a domain value of type `TIn` to a
|
|
212
285
|
* range value (typically a pixel coordinate). Mirrors the result type
|
|
213
286
|
* of every `create*Scale` factory in `@cngx/common/chart`.
|
|
214
|
-
*
|
|
215
|
-
* @category common/chart
|
|
216
287
|
*/
|
|
217
288
|
type ScaleFn<TIn> = (v: TIn) => number;
|
|
218
289
|
/**
|
|
@@ -229,8 +300,6 @@ type ScaleFn<TIn> = (v: TIn) => number;
|
|
|
229
300
|
* A collapsed plot (a box narrower than the room its axes need) reports
|
|
230
301
|
* `width` or `height` at or below `0`. Readers guard on the extent; the
|
|
231
302
|
* chart hands out its NOOP scale in the same case.
|
|
232
|
-
*
|
|
233
|
-
* @category common/chart
|
|
234
303
|
*/
|
|
235
304
|
interface CngxChartPlotArea {
|
|
236
305
|
readonly x0: number;
|
|
@@ -249,8 +318,6 @@ interface CngxChartPlotArea {
|
|
|
249
318
|
* boundary; layer atoms call `data<T>()` to narrow the array to their
|
|
250
319
|
* own `<T>` - the single boundary cast lives inside `CngxChart`'s
|
|
251
320
|
* `data<U>()` method, not at every consumer site.
|
|
252
|
-
*
|
|
253
|
-
* @category common/chart
|
|
254
321
|
*/
|
|
255
322
|
interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
256
323
|
readonly xScale: Signal<ScaleFn<TX>>;
|
|
@@ -283,6 +350,16 @@ interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
|
283
350
|
* SVG?", never "what mode am I in?".
|
|
284
351
|
*/
|
|
285
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;
|
|
286
363
|
}
|
|
287
364
|
/**
|
|
288
365
|
* Injection token consumed by every chart child (`[cngxAxis]`, layer
|
|
@@ -290,27 +367,25 @@ interface CngxChartContext<TX = XScaleInput, TY = number> {
|
|
|
290
367
|
* via `useExisting`; child queries narrow the generic on the consumer
|
|
291
368
|
* side.
|
|
292
369
|
*
|
|
293
|
-
* @category common/chart
|
|
294
370
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
295
|
-
* @since 0.
|
|
371
|
+
* @since 0.3.0
|
|
296
372
|
*/
|
|
297
373
|
declare const CNGX_CHART_CONTEXT: InjectionToken<CngxChartContext<XScaleInput, number>>;
|
|
298
374
|
/**
|
|
299
|
-
* Inject the parent chart's reactive context. Throws a
|
|
300
|
-
* error when the consumer is not mounted as a content child
|
|
301
|
-
* `<cngx-chart
|
|
302
|
-
*
|
|
303
|
-
*
|
|
375
|
+
* Inject the parent chart's reactive context. Throws a `CngxRuntimeError`
|
|
376
|
+
* with code [`CNGX1048`](/error-codes/cngx1048.md) when the consumer is not mounted as a content child
|
|
377
|
+
* of `<cngx-chart>`, in development and production alike. The `selector`
|
|
378
|
+
* argument is the consumer's public selector without brackets (`'cngxLine'`)
|
|
379
|
+
* and names it in the development message.
|
|
304
380
|
*
|
|
305
381
|
* Use it from custom layer directives mounted on `<svg:g>` hosts to
|
|
306
382
|
* read `plot`, the scales and `renderSvg` the same way the built-in
|
|
307
383
|
* layer atoms do.
|
|
308
384
|
*
|
|
309
|
-
* @category common/chart
|
|
310
385
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
311
|
-
* @since 0.
|
|
386
|
+
* @since 0.3.0
|
|
312
387
|
*/
|
|
313
|
-
declare function injectChartContext(
|
|
388
|
+
declare function injectChartContext(selector: string): CngxChartContext;
|
|
314
389
|
|
|
315
390
|
/**
|
|
316
391
|
* Common context shape passed into every chart slot template
|
|
@@ -332,8 +407,6 @@ declare function injectChartContext(consumerName: string): CngxChartContext;
|
|
|
332
407
|
* the exported `CHART_SMALL_BREAKPOINT_PX` constant (400).
|
|
333
408
|
* Container-size based, not viewport-based, so it works correctly
|
|
334
409
|
* inside dashboard cells of any size.
|
|
335
|
-
*
|
|
336
|
-
* @category common/chart
|
|
337
410
|
*/
|
|
338
411
|
interface CngxChartSlotContext {
|
|
339
412
|
readonly width: number;
|
|
@@ -360,8 +433,6 @@ interface CngxChartSlotContext {
|
|
|
360
433
|
/**
|
|
361
434
|
* Threshold (px) below which `CngxChartSlotContext.small` is true.
|
|
362
435
|
* Hardcoded for v1; later releases may make this a config token.
|
|
363
|
-
*
|
|
364
|
-
* @category common/chart
|
|
365
436
|
*/
|
|
366
437
|
declare const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
367
438
|
/**
|
|
@@ -380,9 +451,8 @@ declare const CHART_SMALL_BREAKPOINT_PX = 400;
|
|
|
380
451
|
* </cngx-chart>
|
|
381
452
|
* ```
|
|
382
453
|
*
|
|
383
|
-
* @category common/chart
|
|
384
454
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
385
|
-
* @since 0.
|
|
455
|
+
* @since 0.3.0
|
|
386
456
|
* @relatedTo CngxChartSlotContext, CngxChartEmpty, CngxChartError, CngxChart
|
|
387
457
|
*/
|
|
388
458
|
declare class CngxChartLoading {
|
|
@@ -405,9 +475,8 @@ declare class CngxChartLoading {
|
|
|
405
475
|
* </cngx-chart>
|
|
406
476
|
* ```
|
|
407
477
|
*
|
|
408
|
-
* @category common/chart
|
|
409
478
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
410
|
-
* @since 0.
|
|
479
|
+
* @since 0.3.0
|
|
411
480
|
* @relatedTo CngxChartSlotContext, CngxChartLoading, CngxChartError, CngxChart
|
|
412
481
|
*/
|
|
413
482
|
declare class CngxChartEmpty {
|
|
@@ -420,8 +489,6 @@ declare class CngxChartEmpty {
|
|
|
420
489
|
* common slot context with the live error value via `$implicit` and
|
|
421
490
|
* `error` keys, so consumers can render a typed message AND branch
|
|
422
491
|
* on chart size.
|
|
423
|
-
*
|
|
424
|
-
* @category common/chart
|
|
425
492
|
*/
|
|
426
493
|
interface CngxChartErrorContext extends CngxChartSlotContext {
|
|
427
494
|
readonly $implicit: unknown;
|
|
@@ -439,9 +506,8 @@ interface CngxChartErrorContext extends CngxChartSlotContext {
|
|
|
439
506
|
* </cngx-chart>
|
|
440
507
|
* ```
|
|
441
508
|
*
|
|
442
|
-
* @category common/chart
|
|
443
509
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
444
|
-
* @since 0.
|
|
510
|
+
* @since 0.3.0
|
|
445
511
|
* @relatedTo CngxChartErrorContext, CngxChartLoading, CngxChartEmpty, CngxChart
|
|
446
512
|
*/
|
|
447
513
|
declare class CngxChartError {
|
|
@@ -455,8 +521,6 @@ declare class CngxChartError {
|
|
|
455
521
|
* connection error value via `$implicit` / `error`, mirroring
|
|
456
522
|
* {@link CngxChartErrorContext}. The connection channel is separate from
|
|
457
523
|
* the data `[state]` channel, so this context reflects `[connectionState]`.
|
|
458
|
-
*
|
|
459
|
-
* @category common/chart
|
|
460
524
|
*/
|
|
461
525
|
interface CngxChartConnectionContext extends CngxChartSlotContext {
|
|
462
526
|
readonly $implicit: unknown;
|
|
@@ -476,9 +540,8 @@ interface CngxChartConnectionContext extends CngxChartSlotContext {
|
|
|
476
540
|
* </cngx-chart>
|
|
477
541
|
* ```
|
|
478
542
|
*
|
|
479
|
-
* @category common/chart
|
|
480
543
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
481
|
-
* @since 0.
|
|
544
|
+
* @since 0.3.0
|
|
482
545
|
* @relatedTo CngxChartConnectionContext, CngxChartReconnecting, CngxChart
|
|
483
546
|
*/
|
|
484
547
|
declare class CngxChartConnectionError {
|
|
@@ -500,9 +563,8 @@ declare class CngxChartConnectionError {
|
|
|
500
563
|
* </cngx-chart>
|
|
501
564
|
* ```
|
|
502
565
|
*
|
|
503
|
-
* @category common/chart
|
|
504
566
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
505
|
-
* @since 0.
|
|
567
|
+
* @since 0.3.0
|
|
506
568
|
* @relatedTo CngxChartConnectionContext, CngxChartConnectionError, CngxChart
|
|
507
569
|
*/
|
|
508
570
|
declare class CngxChartReconnecting {
|
|
@@ -552,9 +614,8 @@ declare class CngxChartReconnecting {
|
|
|
552
614
|
* SR data-table (the `aria-describedby` channel the chart already owns),
|
|
553
615
|
* not on an element projected here.
|
|
554
616
|
*
|
|
555
|
-
* @category common/chart
|
|
556
617
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/template-slots.ts
|
|
557
|
-
* @since 0.
|
|
618
|
+
* @since 0.3.0
|
|
558
619
|
* @relatedTo CngxChartSlotContext, CngxChartLoading, CngxChartEmpty, CngxChartError, CngxChart
|
|
559
620
|
*/
|
|
560
621
|
declare class CngxChartOverlay {
|
|
@@ -563,101 +624,6 @@ declare class CngxChartOverlay {
|
|
|
563
624
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxChartOverlay, "ng-template[cngxChartOverlay]", never, {}, {}, never, never, true, never>;
|
|
564
625
|
}
|
|
565
626
|
|
|
566
|
-
/**
|
|
567
|
-
* Backend-agnostic geometry a layer atom publishes for rendering. A
|
|
568
|
-
* discriminated union: each variant carries exactly the primitives its
|
|
569
|
-
* kind needs, and nothing more. Both the SVG self-render path and the
|
|
570
|
-
* Canvas renderer paint against this same shape, so a single
|
|
571
|
-
* layer-authoring API drives either backend.
|
|
572
|
-
*
|
|
573
|
-
* Coordinates are already scale-projected (pixel space); `color` is
|
|
574
|
-
* `null` when the atom defers to its CSS custom property (the SVG path
|
|
575
|
-
* reads the var directly, the Canvas renderer resolves it via
|
|
576
|
-
* `getComputedStyle`).
|
|
577
|
-
*
|
|
578
|
-
* @category common/chart/layers
|
|
579
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
580
|
-
* @since 0.1.0
|
|
581
|
-
*/
|
|
582
|
-
type LayerGeometry = {
|
|
583
|
-
readonly kind: 'line' | 'area';
|
|
584
|
-
readonly d: string;
|
|
585
|
-
readonly color: string | null;
|
|
586
|
-
readonly strokeWidth: number | string | null;
|
|
587
|
-
readonly fill?: string | null;
|
|
588
|
-
readonly opacity?: number | null;
|
|
589
|
-
/**
|
|
590
|
-
* Optional point-marker pass a mark layer emits alongside its
|
|
591
|
-
* path - the scale-projected centres of the datapoints the layer
|
|
592
|
-
* chooses to mark (e.g. the lone datum of a warming series). Both
|
|
593
|
-
* the SVG template and the Canvas renderer paint these as small
|
|
594
|
-
* filled circles in the layer's resolved colour. Absent / empty
|
|
595
|
-
* when the layer draws no markers.
|
|
596
|
-
*/
|
|
597
|
-
readonly points?: readonly {
|
|
598
|
-
readonly cx: number;
|
|
599
|
-
readonly cy: number;
|
|
600
|
-
}[];
|
|
601
|
-
} | {
|
|
602
|
-
readonly kind: 'bar';
|
|
603
|
-
readonly rects: readonly {
|
|
604
|
-
readonly x: number;
|
|
605
|
-
readonly y: number;
|
|
606
|
-
readonly w: number;
|
|
607
|
-
readonly h: number;
|
|
608
|
-
readonly color: string | null;
|
|
609
|
-
}[];
|
|
610
|
-
} | {
|
|
611
|
-
readonly kind: 'scatter';
|
|
612
|
-
readonly marks: readonly {
|
|
613
|
-
readonly cx: number;
|
|
614
|
-
readonly cy: number;
|
|
615
|
-
readonly r: number;
|
|
616
|
-
readonly color: string | null;
|
|
617
|
-
}[];
|
|
618
|
-
} | {
|
|
619
|
-
readonly kind: 'threshold';
|
|
620
|
-
readonly x1: number;
|
|
621
|
-
readonly y1: number;
|
|
622
|
-
readonly x2: number;
|
|
623
|
-
readonly y2: number;
|
|
624
|
-
readonly color: string | null;
|
|
625
|
-
readonly dashed: boolean;
|
|
626
|
-
} | {
|
|
627
|
-
readonly kind: 'band';
|
|
628
|
-
readonly x: number;
|
|
629
|
-
readonly y: number;
|
|
630
|
-
readonly w: number;
|
|
631
|
-
readonly h: number;
|
|
632
|
-
readonly color: string | null;
|
|
633
|
-
readonly opacity: number | null;
|
|
634
|
-
};
|
|
635
|
-
/**
|
|
636
|
-
* Contract every layer atom (`[cngxLine]`, `[cngxBar]`, ...) self-provides
|
|
637
|
-
* via {@link CNGX_CHART_LAYER}. The chart shell and the Canvas renderer
|
|
638
|
-
* read layer geometry through this token instead of scraping the DOM.
|
|
639
|
-
*
|
|
640
|
-
* @category common/chart/layers
|
|
641
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
642
|
-
* @since 0.1.0
|
|
643
|
-
*/
|
|
644
|
-
interface CngxChartLayer {
|
|
645
|
-
/** The layer's scale-projected geometry, cascade-guarded by an `equal` fn. */
|
|
646
|
-
readonly geometry: Signal<LayerGeometry>;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Injection token each layer atom provides via
|
|
650
|
-
* `{ provide: CNGX_CHART_LAYER, useExisting: CngxX }`. A
|
|
651
|
-
* `contentChildren(CNGX_CHART_LAYER, { descendants: true })` query on the
|
|
652
|
-
* chart shell collects every mounted layer's geometry through DI.
|
|
653
|
-
*
|
|
654
|
-
* @category common/chart/layers
|
|
655
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/chart-layer.ts
|
|
656
|
-
* @since 0.1.0
|
|
657
|
-
* @relatedTo CngxLine, CngxArea, CngxBar, CngxScatter, CngxThreshold, CngxBand
|
|
658
|
-
*/
|
|
659
|
-
declare const CNGX_CHART_LAYER: InjectionToken<CngxChartLayer>;
|
|
660
|
-
|
|
661
627
|
/**
|
|
662
628
|
* Top-level chart container. Hosts an `<svg>` viewBox, applies
|
|
663
629
|
* {@link CngxResizeObserver} via `hostDirectives` to track its rendered
|
|
@@ -710,40 +676,50 @@ declare const CNGX_CHART_LAYER: InjectionToken<CngxChartLayer>;
|
|
|
710
676
|
* consumer restyling `--cngx-axis-font-size` gets labels at their own
|
|
711
677
|
* size inside a gutter sized for the default.
|
|
712
678
|
*
|
|
713
|
-
* @category common/chart
|
|
714
|
-
* @docsKind primary
|
|
715
679
|
* @wcag AA
|
|
716
680
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart.component.ts
|
|
717
|
-
* @since 0.
|
|
681
|
+
* @since 0.3.0
|
|
718
682
|
* @relatedTo CngxAxis, CngxLine, CngxArea, CngxBar, CngxChartLegend
|
|
719
683
|
*
|
|
720
|
-
* <example-url
|
|
721
|
-
* <example-url
|
|
722
|
-
* <example-url
|
|
723
|
-
* <example-url
|
|
724
|
-
* <example-url
|
|
725
|
-
* <example-url
|
|
726
|
-
* <example-url
|
|
727
|
-
* <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>
|
|
728
692
|
* @slot cngxChartLoading Replaces the centred spinner shown during the first load.
|
|
729
693
|
* @slot cngxChartEmpty Rendered when the data resolves to nothing.
|
|
730
694
|
* @slot cngxChartError Rendered when the load fails; gets the error.
|
|
731
695
|
* @slot cngxChartConnectionError Rendered over the chart when the live connection drops.
|
|
732
696
|
* @slot cngxChartReconnecting Rendered over the chart while the connection retries.
|
|
733
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
|
|
734
699
|
*/
|
|
735
700
|
declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, number> {
|
|
736
701
|
/**
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
* call `this.ctx.data<T>()` to narrow without per-site casts.
|
|
741
|
-
*
|
|
742
|
-
* @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">`.
|
|
743
705
|
*/
|
|
744
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
|
+
*/
|
|
745
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
|
+
*/
|
|
746
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
|
+
*/
|
|
747
723
|
readonly preserveAspectRatio: _angular_core.InputSignal<string>;
|
|
748
724
|
/**
|
|
749
725
|
* Optional explicit `aria-label` override. When set, supersedes the
|
|
@@ -800,6 +776,8 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
800
776
|
private readonly axes;
|
|
801
777
|
private readonly thresholds;
|
|
802
778
|
private readonly layers;
|
|
779
|
+
private readonly layerHosts;
|
|
780
|
+
private readonly layerElements;
|
|
803
781
|
protected readonly i18n: Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
804
782
|
protected readonly dataTableId: string;
|
|
805
783
|
protected readonly hatchId: string;
|
|
@@ -989,6 +967,14 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
989
967
|
* element-wise-equal and the paint cascade short-circuits.
|
|
990
968
|
*/
|
|
991
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;
|
|
992
978
|
protected readonly viewBox: Signal<string>;
|
|
993
979
|
private readonly xScaleCache;
|
|
994
980
|
private readonly yScaleCache;
|
|
@@ -1070,7 +1056,7 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
1070
1056
|
*/
|
|
1071
1057
|
protected readonly tableActive: Signal<boolean>;
|
|
1072
1058
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChart<any>, never>;
|
|
1073
|
-
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: {}; }]>;
|
|
1074
1060
|
}
|
|
1075
1061
|
|
|
1076
1062
|
/**
|
|
@@ -1080,8 +1066,7 @@ declare class CngxChart<T = unknown> implements CngxChartContext<XScaleInput, nu
|
|
|
1080
1066
|
* several keys, so a pack owns their words, their order and their list
|
|
1081
1067
|
* separator.
|
|
1082
1068
|
*
|
|
1083
|
-
* @
|
|
1084
|
-
* @since 0.1.0
|
|
1069
|
+
* @since 0.3.0
|
|
1085
1070
|
* @relatedTo CNGX_CHART_I18N
|
|
1086
1071
|
*/
|
|
1087
1072
|
interface CngxChartLanguageSection {
|
|
@@ -1124,8 +1109,7 @@ interface CngxChartLanguageSection {
|
|
|
1124
1109
|
* The English chart section: the single source of the chart's English copy.
|
|
1125
1110
|
* `CNGX_CHART_I18N` defaults to it.
|
|
1126
1111
|
*
|
|
1127
|
-
* @
|
|
1128
|
-
* @since 0.1.0
|
|
1112
|
+
* @since 0.3.0
|
|
1129
1113
|
* @relatedTo CNGX_CHART_I18N
|
|
1130
1114
|
*/
|
|
1131
1115
|
declare const CNGX_CHART_LANGUAGE_EN: CngxChartLanguageSection;
|
|
@@ -1139,8 +1123,6 @@ declare module '@cngx/core/i18n' {
|
|
|
1139
1123
|
* Summary input describing the chart's current data shape. Consumed by
|
|
1140
1124
|
* `CngxChartI18n.summary()` to produce the `aria-label` text the
|
|
1141
1125
|
* `<cngx-chart>` host announces to screen readers.
|
|
1142
|
-
*
|
|
1143
|
-
* @category common/chart/i18n
|
|
1144
1126
|
*/
|
|
1145
1127
|
interface CngxChartSummary {
|
|
1146
1128
|
readonly trend: 'up' | 'down' | 'flat';
|
|
@@ -1153,8 +1135,6 @@ interface CngxChartSummary {
|
|
|
1153
1135
|
* i18n surface for `@cngx/common/chart`. Mirrors the `CNGX_RECYCLER_I18N`
|
|
1154
1136
|
* shape from `@cngx/common/data` - factory defaults supply English;
|
|
1155
1137
|
* consumers override per-app via {@link provideChartI18n}.
|
|
1156
|
-
*
|
|
1157
|
-
* @category common/chart/i18n
|
|
1158
1138
|
*/
|
|
1159
1139
|
interface CngxChartI18n {
|
|
1160
1140
|
readonly summary: (input: CngxChartSummary) => string;
|
|
@@ -1205,26 +1185,22 @@ interface CngxChartI18n {
|
|
|
1205
1185
|
* at its default still follows the app locale at the use site, including a
|
|
1206
1186
|
* runtime `CNGX_LOCALE` flip.
|
|
1207
1187
|
*
|
|
1208
|
-
* @category common/chart/i18n
|
|
1209
1188
|
* @wcag AA
|
|
1210
1189
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/i18n/chart-i18n.ts
|
|
1211
|
-
* @since 0.
|
|
1190
|
+
* @since 0.3.0
|
|
1212
1191
|
*/
|
|
1213
1192
|
declare const CNGX_CHART_I18N: InjectionToken<Signal<CngxChartI18n>>;
|
|
1214
1193
|
/**
|
|
1215
|
-
*
|
|
1194
|
+
* A label override feature of `provideChartI18n`.
|
|
1216
1195
|
*
|
|
1217
|
-
* @
|
|
1196
|
+
* @since 0.3.0
|
|
1197
|
+
* @relatedTo CNGX_CHART_I18N, withChartI18nLabels
|
|
1218
1198
|
*/
|
|
1219
|
-
type CngxChartI18nFeature = (
|
|
1220
|
-
readonly _target: 'i18n';
|
|
1221
|
-
};
|
|
1199
|
+
type CngxChartI18nFeature = (bundle: Signal<CngxChartI18n>) => Signal<CngxChartI18n>;
|
|
1222
1200
|
/**
|
|
1223
1201
|
* Override chart copy via a partial bundle - unset keys keep the language
|
|
1224
1202
|
* pack's copy, or the English default, and keep following the app locale.
|
|
1225
1203
|
* Pass a `Signal` to switch the language at runtime.
|
|
1226
|
-
*
|
|
1227
|
-
* @category common/chart/i18n
|
|
1228
1204
|
*/
|
|
1229
1205
|
declare function withChartI18nLabels(overrides: Partial<CngxChartI18n> | Signal<Partial<CngxChartI18n>>): CngxChartI18nFeature;
|
|
1230
1206
|
/**
|
|
@@ -1241,8 +1217,6 @@ declare function withChartI18nLabels(overrides: Partial<CngxChartI18n> | Signal<
|
|
|
1241
1217
|
* ),
|
|
1242
1218
|
* ]
|
|
1243
1219
|
* ```
|
|
1244
|
-
*
|
|
1245
|
-
* @category common/chart/i18n
|
|
1246
1220
|
*/
|
|
1247
1221
|
declare function provideChartI18n(...features: readonly CngxChartI18nFeature[]): Provider;
|
|
1248
1222
|
|
|
@@ -1253,9 +1227,8 @@ type Trend = 'up' | 'down' | 'flat';
|
|
|
1253
1227
|
* either the trend flipped, or the current value crossed a threshold.
|
|
1254
1228
|
* A discriminated union - each variant carries exactly its own fields.
|
|
1255
1229
|
*
|
|
1256
|
-
* @category common/chart
|
|
1257
1230
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/significant-change.ts
|
|
1258
|
-
* @since 0.
|
|
1231
|
+
* @since 0.3.0
|
|
1259
1232
|
*/
|
|
1260
1233
|
type CngxSignificantChange = {
|
|
1261
1234
|
readonly kind: 'trend-flip';
|
|
@@ -1283,9 +1256,8 @@ type CngxSignificantChange = {
|
|
|
1283
1256
|
*
|
|
1284
1257
|
* @param summary the chart's `CngxChartSummary` signal.
|
|
1285
1258
|
*
|
|
1286
|
-
* @category common/chart
|
|
1287
1259
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/significant-change.ts
|
|
1288
|
-
* @since 0.
|
|
1260
|
+
* @since 0.3.0
|
|
1289
1261
|
*/
|
|
1290
1262
|
declare function createSignificantChangeTracker(summary: Signal<CngxChartSummary>): Signal<CngxSignificantChange | null>;
|
|
1291
1263
|
|
|
@@ -1309,14 +1281,12 @@ declare function createSignificantChangeTracker(summary: Signal<CngxChartSummary
|
|
|
1309
1281
|
* <cngx-chart-announcer [cngxChartAnnouncer]="c" />
|
|
1310
1282
|
* ```
|
|
1311
1283
|
*
|
|
1312
|
-
* @category common/chart
|
|
1313
|
-
* @docsKind primary
|
|
1314
1284
|
* @wcag AA
|
|
1315
1285
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-announcer.component.ts
|
|
1316
|
-
* @since 0.
|
|
1286
|
+
* @since 0.3.0
|
|
1317
1287
|
* @relatedTo CngxChart, createSignificantChangeTracker
|
|
1318
1288
|
*
|
|
1319
|
-
* <example-url
|
|
1289
|
+
* <example-url>/#/common/chart/realtime/streaming-telemetry</example-url>
|
|
1320
1290
|
*/
|
|
1321
1291
|
declare class CngxChartAnnouncer {
|
|
1322
1292
|
/** The chart instance whose `significantChange()` this announcer voices. */
|
|
@@ -1338,16 +1308,12 @@ declare class CngxChartAnnouncer {
|
|
|
1338
1308
|
* Axis position. Top/bottom are X-axes; left/right are Y-axes. The
|
|
1339
1309
|
* parent `<cngx-chart>` collects content-child axes and routes their
|
|
1340
1310
|
* inputs to its `xScale` / `yScale` signals based on this discriminator.
|
|
1341
|
-
*
|
|
1342
|
-
* @category common/chart/axis
|
|
1343
1311
|
*/
|
|
1344
1312
|
type CngxAxisPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
1345
1313
|
/**
|
|
1346
1314
|
* Axis scale type. The chart's scale-builder picks the matching
|
|
1347
1315
|
* `create*Scale` factory at the boundary; the axis itself stays
|
|
1348
1316
|
* scale-implementation-agnostic.
|
|
1349
|
-
*
|
|
1350
|
-
* @category common/chart/axis
|
|
1351
1317
|
*/
|
|
1352
1318
|
type CngxAxisType = 'linear' | 'time' | 'band';
|
|
1353
1319
|
|
|
@@ -1373,9 +1339,8 @@ type CngxAxisType = 'linear' | 'time' | 'band';
|
|
|
1373
1339
|
* you draw yourself. Provide it with `useExisting` and the chart picks
|
|
1374
1340
|
* the directive up through its content query.
|
|
1375
1341
|
*
|
|
1376
|
-
* @category common/chart/axis
|
|
1377
1342
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/chart-axis.ts
|
|
1378
|
-
* @since 0.
|
|
1343
|
+
* @since 0.3.0
|
|
1379
1344
|
* @relatedTo CngxAxis, CngxAxisDomain, CngxChart
|
|
1380
1345
|
*/
|
|
1381
1346
|
interface CngxChartAxis {
|
|
@@ -1406,9 +1371,8 @@ interface CngxChartAxis {
|
|
|
1406
1371
|
* so a consumer-authored axis participates in scale building and plot
|
|
1407
1372
|
* insetting on equal terms with the ones the library ships.
|
|
1408
1373
|
*
|
|
1409
|
-
* @category common/chart/axis
|
|
1410
1374
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/chart-axis.ts
|
|
1411
|
-
* @since 0.
|
|
1375
|
+
* @since 0.3.0
|
|
1412
1376
|
* @relatedTo CngxChartAxis, CngxAxis, CngxAxisDomain
|
|
1413
1377
|
*/
|
|
1414
1378
|
declare const CNGX_CHART_AXIS: InjectionToken<CngxChartAxis>;
|
|
@@ -1476,25 +1440,47 @@ interface TickRendering {
|
|
|
1476
1440
|
* semantic data view lives on the parent chart's auto-Summary and
|
|
1477
1441
|
* Data Table.
|
|
1478
1442
|
*
|
|
1479
|
-
* @category common/chart/axis
|
|
1480
|
-
* @docsKind primary
|
|
1481
1443
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/axis.component.ts
|
|
1482
|
-
* @since 0.
|
|
1444
|
+
* @since 0.3.0
|
|
1483
1445
|
* @relatedTo CngxChart, CngxLine, CngxBar, CngxArea
|
|
1484
1446
|
*
|
|
1485
|
-
* <example-url
|
|
1486
|
-
* <example-url
|
|
1487
|
-
* <example-url
|
|
1488
|
-
* <example-url
|
|
1489
|
-
* <example-url
|
|
1490
|
-
* <example-url
|
|
1491
|
-
* <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>
|
|
1492
1454
|
*/
|
|
1493
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
|
+
*/
|
|
1494
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
|
+
*/
|
|
1495
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
|
+
*/
|
|
1496
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
|
+
*/
|
|
1497
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
|
+
*/
|
|
1498
1484
|
readonly format: _angular_core.InputSignal<(v: unknown) => string>;
|
|
1499
1485
|
/**
|
|
1500
1486
|
* Render decorative gridlines extending from each tick across the
|
|
@@ -1517,6 +1503,13 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1517
1503
|
readonly axisLabel: _angular_core.InputSignal<string | null>;
|
|
1518
1504
|
private readonly ctx;
|
|
1519
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;
|
|
1520
1513
|
/**
|
|
1521
1514
|
* The bound `[format]`, or the default tick formatter bound to the app
|
|
1522
1515
|
* locale (`CNGX_LOCALE`), so a locale flip re-formats the default labels.
|
|
@@ -1531,6 +1524,8 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1531
1524
|
* 3. Otherwise → empty array. Axis still renders the line.
|
|
1532
1525
|
*/
|
|
1533
1526
|
readonly tickValues: _angular_core.Signal<readonly unknown[]>;
|
|
1527
|
+
private readonly hasTicks;
|
|
1528
|
+
constructor();
|
|
1534
1529
|
/**
|
|
1535
1530
|
* How far this axis's decoration extends perpendicular to its own
|
|
1536
1531
|
* line, in viewBox user units. The parent chart reads it to size the
|
|
@@ -1550,10 +1545,14 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1550
1545
|
*
|
|
1551
1546
|
* Character width is an estimate ({@link CHAR_ADVANCE_RATIO}), which
|
|
1552
1547
|
* is the one value here that is not derived from state the axis
|
|
1553
|
-
* owns.
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
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.
|
|
1557
1556
|
*
|
|
1558
1557
|
* Acyclic by construction: {@link tickValues} reads `domain` /
|
|
1559
1558
|
* `ticks` / `type` and never the scale, so
|
|
@@ -1644,13 +1643,12 @@ declare class CngxAxis implements CngxChartAxis {
|
|
|
1644
1643
|
* namespace. Nothing renders either way, but the host stays a legal SVG
|
|
1645
1644
|
* child.
|
|
1646
1645
|
*
|
|
1647
|
-
* @category common/chart/axis
|
|
1648
1646
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/axis/axis-domain.ts
|
|
1649
|
-
* @since 0.
|
|
1647
|
+
* @since 0.3.0
|
|
1650
1648
|
* @relatedTo CngxAxis, CngxChart, CngxChartAxis
|
|
1651
1649
|
*
|
|
1652
|
-
* <example-url
|
|
1653
|
-
* <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>
|
|
1654
1652
|
*/
|
|
1655
1653
|
declare class CngxAxisDomain implements CngxChartAxis {
|
|
1656
1654
|
/** Which edge the scale this publishes belongs to. */
|
|
@@ -1680,8 +1678,6 @@ declare class CngxAxisDomain implements CngxChartAxis {
|
|
|
1680
1678
|
* intentionally unconstrained so the same field a consumer weights in the
|
|
1681
1679
|
* row can still carry their domain key (id, layer name, accessor return
|
|
1682
1680
|
* type, ...) for later interactions without a second lookup.
|
|
1683
|
-
*
|
|
1684
|
-
* @category common/chart/legend
|
|
1685
1681
|
*/
|
|
1686
1682
|
interface CngxChartLegendItem<T = unknown> {
|
|
1687
1683
|
readonly label: string;
|
|
@@ -1728,16 +1724,28 @@ interface CngxChartLegendItem<T = unknown> {
|
|
|
1728
1724
|
* (areas, thresholds, bands and axes do not count), so list the entries
|
|
1729
1725
|
* in the order of those layers.
|
|
1730
1726
|
*
|
|
1731
|
-
* @category common/chart/legend
|
|
1732
|
-
* @docsKind primary
|
|
1733
1727
|
* @wcag AA
|
|
1734
1728
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/legend/legend.component.ts
|
|
1735
|
-
* @since 0.
|
|
1729
|
+
* @since 0.3.0
|
|
1736
1730
|
* @relatedTo CngxChart, CngxLine, CngxBar
|
|
1731
|
+
* @axis level atom
|
|
1737
1732
|
*/
|
|
1738
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
|
+
*/
|
|
1739
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
|
+
*/
|
|
1740
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
|
+
*/
|
|
1741
1749
|
readonly align: _angular_core.InputSignal<"start" | "end" | "center">;
|
|
1742
1750
|
private readonly locale;
|
|
1743
1751
|
/** @internal Each item's value as display text; numbers in the app locale. */
|
|
@@ -1754,14 +1762,10 @@ declare class CngxChartLegend<T = unknown> {
|
|
|
1754
1762
|
* trailing close commands.
|
|
1755
1763
|
*
|
|
1756
1764
|
* Pure TS, no DOM dependency, no Angular dep.
|
|
1757
|
-
*
|
|
1758
|
-
* @category common/chart/path
|
|
1759
1765
|
*/
|
|
1760
1766
|
type CngxCurve = 'linear' | 'monotone';
|
|
1761
1767
|
/**
|
|
1762
1768
|
* Pixel-space point fed into {@link buildCurvePath}.
|
|
1763
|
-
*
|
|
1764
|
-
* @category common/chart/path
|
|
1765
1769
|
*/
|
|
1766
1770
|
interface PathPoint {
|
|
1767
1771
|
readonly x: number;
|
|
@@ -1777,28 +1781,20 @@ interface PathPoint {
|
|
|
1777
1781
|
* overshoots between data points.
|
|
1778
1782
|
* @returns The full path data starting with `M`. Returns `''` when
|
|
1779
1783
|
* the input is empty; `M x y` when the input has one point.
|
|
1780
|
-
*
|
|
1781
|
-
* @category common/chart/path
|
|
1782
1784
|
*/
|
|
1783
1785
|
declare function buildCurvePath(points: readonly PathPoint[], curve: CngxCurve): string;
|
|
1784
1786
|
|
|
1785
1787
|
/**
|
|
1786
1788
|
* Reads the Y value of a data row at index `i`.
|
|
1787
|
-
*
|
|
1788
|
-
* @category common/chart/path
|
|
1789
1789
|
*/
|
|
1790
1790
|
type LineYAccessor<T> = (d: T, i: number) => number;
|
|
1791
1791
|
/**
|
|
1792
1792
|
* Reads the X value of a data row at index `i`. Default behaviour
|
|
1793
1793
|
* (when omitted on a builder) is the row's positional index.
|
|
1794
|
-
*
|
|
1795
|
-
* @category common/chart/path
|
|
1796
1794
|
*/
|
|
1797
1795
|
type LineXAccessor<T> = (d: T, i: number) => XScaleInput;
|
|
1798
1796
|
/**
|
|
1799
1797
|
* Construction options for {@link createPathBuilder}.
|
|
1800
|
-
*
|
|
1801
|
-
* @category common/chart/path
|
|
1802
1798
|
*/
|
|
1803
1799
|
interface PathBuilderOptions<T> {
|
|
1804
1800
|
readonly y: LineYAccessor<T>;
|
|
@@ -1810,8 +1806,6 @@ interface PathBuilderOptions<T> {
|
|
|
1810
1806
|
* {@link PathBuilder.buildSegments}. `firstX` / `lastX` are the run's
|
|
1811
1807
|
* projected end coordinates, exposed so an area layer can close the
|
|
1812
1808
|
* run to its baseline without re-projecting the data.
|
|
1813
|
-
*
|
|
1814
|
-
* @category common/chart/path
|
|
1815
1809
|
*/
|
|
1816
1810
|
interface PathSegment {
|
|
1817
1811
|
readonly d: string;
|
|
@@ -1822,8 +1816,6 @@ interface PathSegment {
|
|
|
1822
1816
|
* Single-slot LRU cache around an SVG `d`-attribute builder. Returned
|
|
1823
1817
|
* by {@link createPathBuilder}; consumed by the `<cngx-line>` /
|
|
1824
1818
|
* `<cngx-area>` family.
|
|
1825
|
-
*
|
|
1826
|
-
* @category common/chart/path
|
|
1827
1819
|
*/
|
|
1828
1820
|
interface PathBuilder<T> {
|
|
1829
1821
|
/**
|
|
@@ -1874,8 +1866,6 @@ interface PathBuilder<T> {
|
|
|
1874
1866
|
* when the inputs to the `computed` are unchanged, two consecutive
|
|
1875
1867
|
* cascade ticks with the same `(y, x, curve)` produce the same
|
|
1876
1868
|
* builder instance.
|
|
1877
|
-
*
|
|
1878
|
-
* @category common/chart/path
|
|
1879
1869
|
*/
|
|
1880
1870
|
declare function createPathBuilder<T>(opts: PathBuilderOptions<T>): PathBuilder<T>;
|
|
1881
1871
|
|
|
@@ -1911,26 +1901,47 @@ interface PointMark {
|
|
|
1911
1901
|
* nothing. `[points]` controls this: `'auto'` (default) marks only the
|
|
1912
1902
|
* one-datum case, `'always'` marks every datum, `'never'` suppresses it.
|
|
1913
1903
|
*
|
|
1914
|
-
* @category common/chart/layers
|
|
1915
|
-
* @docsKind primary
|
|
1916
1904
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/line.component.ts
|
|
1917
|
-
* @since 0.
|
|
1905
|
+
* @since 0.3.0
|
|
1918
1906
|
* @relatedTo CngxArea, CngxScatter, CngxBar, CngxChart
|
|
1919
1907
|
*
|
|
1920
|
-
* <example-url
|
|
1921
|
-
* <example-url
|
|
1922
|
-
* <example-url
|
|
1923
|
-
* <example-url
|
|
1924
|
-
* <example-url
|
|
1925
|
-
* <example-url
|
|
1926
|
-
* <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>
|
|
1927
1915
|
*/
|
|
1928
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
|
+
*/
|
|
1929
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
|
+
*/
|
|
1930
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
|
+
*/
|
|
1931
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
|
+
*/
|
|
1932
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
|
+
*/
|
|
1933
1941
|
readonly curve: _angular_core.InputSignal<CngxCurve>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
1944
|
+
*/
|
|
1934
1945
|
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
1935
1946
|
/**
|
|
1936
1947
|
* Point-marker mode. `'auto'` (default) draws a marker only when the
|
|
@@ -1940,6 +1951,17 @@ declare class CngxLine<T = unknown> implements CngxChartLayer {
|
|
|
1940
1951
|
*/
|
|
1941
1952
|
readonly points: _angular_core.InputSignal<"auto" | "always" | "never">;
|
|
1942
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>;
|
|
1943
1965
|
private readonly builder;
|
|
1944
1966
|
private readonly resolvedData;
|
|
1945
1967
|
protected readonly d: _angular_core.Signal<string>;
|
|
@@ -1970,27 +1992,51 @@ declare class CngxLine<T = unknown> implements CngxChartLayer {
|
|
|
1970
1992
|
* nothing. `[points]` mirrors {@link CngxLine}: `'auto'` (default) marks
|
|
1971
1993
|
* only the one-datum case, `'always'` every datum, `'never'` none.
|
|
1972
1994
|
*
|
|
1973
|
-
* @category common/chart/layers
|
|
1974
|
-
* @docsKind primary
|
|
1975
1995
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/area.component.ts
|
|
1976
|
-
* @since 0.
|
|
1996
|
+
* @since 0.3.0
|
|
1977
1997
|
* @relatedTo CngxLine, CngxBand, CngxThreshold, CngxChart
|
|
1978
1998
|
*
|
|
1979
|
-
* <example-url
|
|
1980
|
-
* <example-url
|
|
1981
|
-
* <example-url
|
|
1982
|
-
* <example-url
|
|
1983
|
-
* <example-url
|
|
1984
|
-
* <example-url
|
|
1985
|
-
* <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>
|
|
1986
2006
|
*/
|
|
1987
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
|
+
*/
|
|
1988
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
|
+
*/
|
|
1989
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
|
+
*/
|
|
1990
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
|
+
*/
|
|
1991
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
|
+
*/
|
|
1992
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
|
+
*/
|
|
1993
2036
|
readonly baseline: _angular_core.InputSignal<number>;
|
|
2037
|
+
/**
|
|
2038
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
2039
|
+
*/
|
|
1994
2040
|
readonly data: _angular_core.InputSignal<readonly T[] | undefined>;
|
|
1995
2041
|
/**
|
|
1996
2042
|
* Point-marker mode, mirroring {@link CngxLine}. `'auto'` (default)
|
|
@@ -2016,8 +2062,6 @@ declare class CngxArea<T = unknown> implements CngxChartLayer {
|
|
|
2016
2062
|
|
|
2017
2063
|
/**
|
|
2018
2064
|
* Reads the bar height (data-space Y) of a data row at index `i`.
|
|
2019
|
-
*
|
|
2020
|
-
* @category common/chart/layers
|
|
2021
2065
|
*/
|
|
2022
2066
|
type BarYAccessor<T> = (d: T, i: number) => number;
|
|
2023
2067
|
/** @internal */
|
|
@@ -2040,27 +2084,49 @@ interface BarRect {
|
|
|
2040
2084
|
*
|
|
2041
2085
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2042
2086
|
*
|
|
2043
|
-
* @category common/chart/layers
|
|
2044
|
-
* @docsKind primary
|
|
2045
2087
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/bar.component.ts
|
|
2046
|
-
* @since 0.
|
|
2088
|
+
* @since 0.3.0
|
|
2047
2089
|
* @relatedTo CngxLine, CngxArea, CngxStackedBar, CngxChart
|
|
2048
2090
|
*
|
|
2049
|
-
* <example-url
|
|
2050
|
-
* <example-url
|
|
2051
|
-
* <example-url
|
|
2052
|
-
* <example-url
|
|
2053
|
-
* <example-url
|
|
2054
|
-
* <example-url
|
|
2055
|
-
* <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>
|
|
2056
2098
|
*/
|
|
2057
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
|
+
*/
|
|
2058
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
|
+
*/
|
|
2059
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
|
+
*/
|
|
2060
2114
|
readonly baseline: _angular_core.InputSignal<number>;
|
|
2115
|
+
/**
|
|
2116
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
2117
|
+
*/
|
|
2061
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
|
+
*/
|
|
2062
2123
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2063
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>;
|
|
2064
2130
|
private readonly resolvedData;
|
|
2065
2131
|
protected readonly rects: _angular_core.Signal<readonly BarRect[]>;
|
|
2066
2132
|
readonly geometry: _angular_core.Signal<LayerGeometry>;
|
|
@@ -2070,14 +2136,10 @@ declare class CngxBar<T = unknown> implements CngxChartLayer {
|
|
|
2070
2136
|
|
|
2071
2137
|
/**
|
|
2072
2138
|
* Reads the data-space X value of a scatter row at index `i`.
|
|
2073
|
-
*
|
|
2074
|
-
* @category common/chart/layers
|
|
2075
2139
|
*/
|
|
2076
2140
|
type ScatterXAccessor<T> = (d: T, i: number) => XScaleInput;
|
|
2077
2141
|
/**
|
|
2078
2142
|
* Reads the data-space Y value of a scatter row at index `i`.
|
|
2079
|
-
*
|
|
2080
|
-
* @category common/chart/layers
|
|
2081
2143
|
*/
|
|
2082
2144
|
type ScatterYAccessor<T> = (d: T, i: number) => number;
|
|
2083
2145
|
/** @internal */
|
|
@@ -2093,27 +2155,47 @@ interface ScatterCircle {
|
|
|
2093
2155
|
*
|
|
2094
2156
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2095
2157
|
*
|
|
2096
|
-
* @category common/chart/layers
|
|
2097
|
-
* @docsKind primary
|
|
2098
2158
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/scatter.component.ts
|
|
2099
|
-
* @since 0.
|
|
2159
|
+
* @since 0.3.0
|
|
2100
2160
|
* @relatedTo CngxLine, CngxBar, CngxArea, CngxChart
|
|
2101
2161
|
*
|
|
2102
|
-
* <example-url
|
|
2103
|
-
* <example-url
|
|
2104
|
-
* <example-url
|
|
2105
|
-
* <example-url
|
|
2106
|
-
* <example-url
|
|
2107
|
-
* <example-url
|
|
2108
|
-
* <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>
|
|
2109
2169
|
*/
|
|
2110
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
|
+
*/
|
|
2111
2175
|
readonly x: _angular_core.InputSignal<ScatterXAccessor<T>>;
|
|
2176
|
+
/**
|
|
2177
|
+
* Required reader of the y value of each row, `(d, i) => number`.
|
|
2178
|
+
*/
|
|
2112
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
|
+
*/
|
|
2113
2183
|
readonly radius: _angular_core.InputSignal<number>;
|
|
2184
|
+
/**
|
|
2185
|
+
* Rows this layer draws. When unset the layer reads the parent chart's `[data]`.
|
|
2186
|
+
*/
|
|
2114
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
|
+
*/
|
|
2115
2192
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2116
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>;
|
|
2117
2199
|
private readonly resolvedData;
|
|
2118
2200
|
protected readonly circles: _angular_core.Signal<readonly ScatterCircle[]>;
|
|
2119
2201
|
readonly geometry: _angular_core.Signal<LayerGeometry>;
|
|
@@ -2132,24 +2214,38 @@ declare class CngxScatter<T = unknown> implements CngxChartLayer {
|
|
|
2132
2214
|
*
|
|
2133
2215
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2134
2216
|
*
|
|
2135
|
-
* @category common/chart/layers
|
|
2136
|
-
* @docsKind primary
|
|
2137
2217
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/threshold.component.ts
|
|
2138
|
-
* @since 0.
|
|
2218
|
+
* @since 0.3.0
|
|
2139
2219
|
* @relatedTo CngxBand, CngxChart, CngxLine
|
|
2140
2220
|
*
|
|
2141
|
-
* <example-url
|
|
2142
|
-
* <example-url
|
|
2143
|
-
* <example-url
|
|
2144
|
-
* <example-url
|
|
2145
|
-
* <example-url
|
|
2146
|
-
* <example-url
|
|
2147
|
-
* <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>
|
|
2148
2228
|
*/
|
|
2149
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
|
+
*/
|
|
2150
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
|
+
*/
|
|
2151
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
|
+
*/
|
|
2152
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
|
+
*/
|
|
2153
2249
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2154
2250
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
|
|
2155
2251
|
protected readonly bounds: _angular_core.Signal<{
|
|
@@ -2172,25 +2268,42 @@ declare class CngxThreshold implements CngxChartLayer {
|
|
|
2172
2268
|
*
|
|
2173
2269
|
* Attribute-selector on `<svg:g>` - see {@link CngxLine} for why.
|
|
2174
2270
|
*
|
|
2175
|
-
* @category common/chart/layers
|
|
2176
|
-
* @docsKind primary
|
|
2177
2271
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/layers/band.component.ts
|
|
2178
|
-
* @since 0.
|
|
2272
|
+
* @since 0.3.0
|
|
2179
2273
|
* @relatedTo CngxThreshold, CngxArea, CngxChart
|
|
2180
2274
|
*
|
|
2181
|
-
* <example-url
|
|
2182
|
-
* <example-url
|
|
2183
|
-
* <example-url
|
|
2184
|
-
* <example-url
|
|
2185
|
-
* <example-url
|
|
2186
|
-
* <example-url
|
|
2187
|
-
* <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>
|
|
2188
2282
|
*/
|
|
2189
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
|
+
*/
|
|
2190
2288
|
readonly from: _angular_core.InputSignal<number>;
|
|
2289
|
+
/**
|
|
2290
|
+
* Required y value of the other edge of the band; see `[from]`.
|
|
2291
|
+
*/
|
|
2191
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
|
+
*/
|
|
2192
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
|
+
*/
|
|
2193
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
|
+
*/
|
|
2194
2307
|
readonly color: _angular_core.InputSignal<string | null>;
|
|
2195
2308
|
protected readonly ctx: _cngx_common_chart.CngxChartContext<_cngx_common_chart.XScaleInput, number>;
|
|
2196
2309
|
protected readonly rect: _angular_core.Signal<{
|
|
@@ -2209,8 +2322,6 @@ declare class CngxBand implements CngxChartLayer {
|
|
|
2209
2322
|
* renderer reads scales / dimensions through the chart context and
|
|
2210
2323
|
* schedules its own teardown through the `DestroyRef` - it never injects
|
|
2211
2324
|
* the concrete `CngxChart` class.
|
|
2212
|
-
*
|
|
2213
|
-
* @category common/chart/renderer
|
|
2214
2325
|
*/
|
|
2215
2326
|
interface ChartRendererDeps {
|
|
2216
2327
|
readonly ctx: CngxChartContext;
|
|
@@ -2233,17 +2344,21 @@ interface ChartRendererDeps {
|
|
|
2233
2344
|
* The SVG backend is a passthrough (layer atoms self-render); the Canvas
|
|
2234
2345
|
* backend paints the geometries onto a `<canvas>` 2D context.
|
|
2235
2346
|
*
|
|
2236
|
-
* @category common/chart/renderer
|
|
2237
2347
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer.ts
|
|
2238
|
-
* @since 0.
|
|
2348
|
+
* @since 0.3.0
|
|
2239
2349
|
*/
|
|
2240
2350
|
interface CngxChartRenderer {
|
|
2241
2351
|
/** Which backend this instance is. */
|
|
2242
2352
|
readonly mode: 'svg' | 'canvas';
|
|
2243
2353
|
/** Attach to the chart host (insert a `<canvas>`, wire teardown, ...). */
|
|
2244
2354
|
mount(host: HTMLElement, ctx: CngxChartContext): void;
|
|
2245
|
-
/**
|
|
2246
|
-
|
|
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;
|
|
2247
2362
|
/** Detach and release resources. */
|
|
2248
2363
|
destroy(): void;
|
|
2249
2364
|
/** Drop any cached theme colors (called on layout/theming reflow). Optional. */
|
|
@@ -2256,9 +2371,8 @@ interface CngxChartRenderer {
|
|
|
2256
2371
|
* {@link CNGX_CHART_RENDERER_FACTORY} to add a third backend (WebGL, ...)
|
|
2257
2372
|
* without touching layer atoms.
|
|
2258
2373
|
*
|
|
2259
|
-
* @category common/chart/renderer
|
|
2260
2374
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer.ts
|
|
2261
|
-
* @since 0.
|
|
2375
|
+
* @since 0.3.0
|
|
2262
2376
|
*/
|
|
2263
2377
|
type CngxChartRendererFactory = (mode: 'svg' | 'canvas', deps: ChartRendererDeps) => CngxChartRenderer;
|
|
2264
2378
|
|
|
@@ -2272,9 +2386,8 @@ type CngxChartRendererFactory = (mode: 'svg' | 'canvas', deps: ChartRendererDeps
|
|
|
2272
2386
|
* @param _deps unused; kept for factory signature symmetry with
|
|
2273
2387
|
* {@link createCanvasRenderer}.
|
|
2274
2388
|
*
|
|
2275
|
-
* @category common/chart/renderer
|
|
2276
2389
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/svg-renderer.ts
|
|
2277
|
-
* @since 0.
|
|
2390
|
+
* @since 0.3.0
|
|
2278
2391
|
*/
|
|
2279
2392
|
declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
|
|
2280
2393
|
|
|
@@ -2284,8 +2397,13 @@ declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
|
|
|
2284
2397
|
* its 2D context: `Path2D` stroke/fill for line/area, per-mark loops for
|
|
2285
2398
|
* bar/scatter, `moveTo`/`lineTo` for threshold, `fillRect` for band.
|
|
2286
2399
|
*
|
|
2287
|
-
* Colors
|
|
2288
|
-
*
|
|
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
|
|
2289
2407
|
* paints hit the cache, so the paint hot path performs zero synchronous
|
|
2290
2408
|
* DOM reads. {@link CngxChartRenderer.invalidateColorCache} clears it -
|
|
2291
2409
|
* the renderer controller calls it on a `dimensions()` change (a proxy
|
|
@@ -2319,13 +2437,10 @@ declare function createSvgRenderer(_deps: ChartRendererDeps): CngxChartRenderer;
|
|
|
2319
2437
|
* other engines are unverified, so the backend paints the probed values.
|
|
2320
2438
|
* The renderer controller watches `(forced-colors: active)` and
|
|
2321
2439
|
* `(prefers-color-scheme: dark)` and invalidates the colour cache before
|
|
2322
|
-
* repainting on a flip, so a contrast-theme switch repaints at once.
|
|
2323
|
-
* difference from SVG: a layer wrapped in an extra `<svg:g>` still counts
|
|
2324
|
-
* here, since the backend only sees the layer order.
|
|
2440
|
+
* repainting on a flip, so a contrast-theme switch repaints at once.
|
|
2325
2441
|
*
|
|
2326
|
-
* @category common/chart/renderer
|
|
2327
2442
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/canvas-renderer.ts
|
|
2328
|
-
* @since 0.
|
|
2443
|
+
* @since 0.3.0
|
|
2329
2444
|
*/
|
|
2330
2445
|
declare function createCanvasRenderer(deps: ChartRendererDeps): CngxChartRenderer;
|
|
2331
2446
|
|
|
@@ -2338,9 +2453,8 @@ declare function createCanvasRenderer(deps: ChartRendererDeps): CngxChartRendere
|
|
|
2338
2453
|
* bare provider) to tune the SVG/Canvas crossover for a given app's
|
|
2339
2454
|
* hardware profile.
|
|
2340
2455
|
*
|
|
2341
|
-
* @category common/chart/renderer
|
|
2342
2456
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-threshold.ts
|
|
2343
|
-
* @since 0.
|
|
2457
|
+
* @since 0.3.0
|
|
2344
2458
|
* @relatedTo provideChartRenderer, withChartRendererThreshold
|
|
2345
2459
|
*/
|
|
2346
2460
|
declare const CNGX_CHART_RENDERER_THRESHOLD: InjectionToken<number>;
|
|
@@ -2352,9 +2466,8 @@ declare const CNGX_CHART_RENDERER_THRESHOLD: InjectionToken<number>;
|
|
|
2352
2466
|
* (WebGL, ...) supplies a whole replacement via
|
|
2353
2467
|
* {@link withChartRendererFactory}.
|
|
2354
2468
|
*
|
|
2355
|
-
* @category common/chart/renderer
|
|
2356
2469
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2357
|
-
* @since 0.
|
|
2470
|
+
* @since 0.3.0
|
|
2358
2471
|
*/
|
|
2359
2472
|
declare const createDefaultChartRenderer: CngxChartRendererFactory;
|
|
2360
2473
|
/**
|
|
@@ -2363,17 +2476,14 @@ declare const createDefaultChartRenderer: CngxChartRendererFactory;
|
|
|
2363
2476
|
* {@link withChartRendererFactory} to add a backend without touching layer
|
|
2364
2477
|
* atoms.
|
|
2365
2478
|
*
|
|
2366
|
-
* @category common/chart/renderer
|
|
2367
2479
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2368
|
-
* @since 0.
|
|
2480
|
+
* @since 0.3.0
|
|
2369
2481
|
* @relatedTo provideChartRenderer, withChartRendererFactory
|
|
2370
2482
|
*/
|
|
2371
2483
|
declare const CNGX_CHART_RENDERER_FACTORY: InjectionToken<CngxChartRendererFactory>;
|
|
2372
2484
|
/**
|
|
2373
2485
|
* A single renderer-config override produced by a `with*` feature and
|
|
2374
2486
|
* folded by {@link provideChartRenderer}.
|
|
2375
|
-
*
|
|
2376
|
-
* @category common/chart/renderer
|
|
2377
2487
|
*/
|
|
2378
2488
|
interface CngxChartRendererFeature {
|
|
2379
2489
|
readonly providers: Provider[];
|
|
@@ -2381,9 +2491,8 @@ interface CngxChartRendererFeature {
|
|
|
2381
2491
|
/**
|
|
2382
2492
|
* Override the SVG->Canvas auto-switch cutoff (default `500`).
|
|
2383
2493
|
*
|
|
2384
|
-
* @category common/chart/renderer
|
|
2385
2494
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2386
|
-
* @since 0.
|
|
2495
|
+
* @since 0.3.0
|
|
2387
2496
|
*/
|
|
2388
2497
|
declare function withChartRendererThreshold(n: number): CngxChartRendererFeature;
|
|
2389
2498
|
/**
|
|
@@ -2391,9 +2500,8 @@ declare function withChartRendererThreshold(n: number): CngxChartRendererFeature
|
|
|
2391
2500
|
* third. Consumers wanting a heuristic swap supply a custom factory here
|
|
2392
2501
|
* (the heuristic-swap axis ships no dedicated token at v2).
|
|
2393
2502
|
*
|
|
2394
|
-
* @category common/chart/renderer
|
|
2395
2503
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2396
|
-
* @since 0.
|
|
2504
|
+
* @since 0.3.0
|
|
2397
2505
|
*/
|
|
2398
2506
|
declare function withChartRendererFactory(fn: CngxChartRendererFactory): CngxChartRendererFeature;
|
|
2399
2507
|
/**
|
|
@@ -2405,30 +2513,31 @@ declare function withChartRendererFactory(fn: CngxChartRendererFactory): CngxCha
|
|
|
2405
2513
|
* provideChartRenderer(withChartRendererThreshold(2000))
|
|
2406
2514
|
* ```
|
|
2407
2515
|
*
|
|
2408
|
-
* @category common/chart/renderer
|
|
2409
2516
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/renderer-factory.ts
|
|
2410
|
-
* @since 0.
|
|
2517
|
+
* @since 0.3.0
|
|
2411
2518
|
* @relatedTo withChartRendererThreshold, withChartRendererFactory
|
|
2412
2519
|
*/
|
|
2413
2520
|
declare function provideChartRenderer(...features: CngxChartRendererFeature[]): Provider[];
|
|
2414
2521
|
|
|
2415
2522
|
/**
|
|
2416
2523
|
* Construction dependencies for {@link createChartRendererController}.
|
|
2417
|
-
*
|
|
2418
|
-
* @category common/chart/renderer
|
|
2419
2524
|
*/
|
|
2420
2525
|
interface ChartRendererControllerDeps {
|
|
2421
2526
|
readonly host: HTMLElement;
|
|
2422
2527
|
readonly ctx: CngxChartContext;
|
|
2423
2528
|
readonly mode: Signal<'svg' | 'canvas'>;
|
|
2424
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[]>;
|
|
2425
2536
|
readonly factory: CngxChartRendererFactory;
|
|
2426
2537
|
readonly destroyRef: DestroyRef;
|
|
2427
2538
|
}
|
|
2428
2539
|
/**
|
|
2429
2540
|
* Handle returned by {@link createChartRendererController}.
|
|
2430
|
-
*
|
|
2431
|
-
* @category common/chart/renderer
|
|
2432
2541
|
*/
|
|
2433
2542
|
interface CngxChartRendererController {
|
|
2434
2543
|
readonly currentMode: Signal<'svg' | 'canvas'>;
|
|
@@ -2459,9 +2568,8 @@ interface CngxChartRendererController {
|
|
|
2459
2568
|
* calls directly - no DI token, since the only second consumer today is a
|
|
2460
2569
|
* test double, which injects a fake `factory` through the deps.
|
|
2461
2570
|
*
|
|
2462
|
-
* @category common/chart/renderer
|
|
2463
2571
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/chart-renderer-controller.ts
|
|
2464
|
-
* @since 0.
|
|
2572
|
+
* @since 0.3.0
|
|
2465
2573
|
*/
|
|
2466
2574
|
declare function createChartRendererController(deps: ChartRendererControllerDeps): CngxChartRendererController;
|
|
2467
2575
|
|
|
@@ -2479,24 +2587,53 @@ declare function createChartRendererController(deps: ChartRendererControllerDeps
|
|
|
2479
2587
|
* from the chart's auto-Summary; consumers can override via
|
|
2480
2588
|
* `[ariaLabel]`.
|
|
2481
2589
|
*
|
|
2482
|
-
* @category common/chart/presets
|
|
2483
|
-
* @docsKind primary
|
|
2484
2590
|
* @wcag AA
|
|
2485
2591
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/sparkline.component.ts
|
|
2486
|
-
* @since 0.
|
|
2592
|
+
* @since 0.3.0
|
|
2487
2593
|
* @relatedTo CngxMiniArea, CngxMiniBar, CngxChart
|
|
2488
2594
|
*
|
|
2489
|
-
* <example-url
|
|
2490
|
-
* <example-url
|
|
2491
|
-
* <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
|
|
2492
2599
|
*/
|
|
2493
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
|
+
*/
|
|
2494
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
|
+
*/
|
|
2495
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
|
+
*/
|
|
2496
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
|
+
*/
|
|
2497
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
|
+
*/
|
|
2498
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
|
+
*/
|
|
2499
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
|
+
*/
|
|
2500
2637
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2501
2638
|
private readonly preset;
|
|
2502
2639
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2522,22 +2659,48 @@ declare class CngxSparkline {
|
|
|
2522
2659
|
* `role="meter"`. A bound `[aria-label]` always wins and overrides the
|
|
2523
2660
|
* visible caption.
|
|
2524
2661
|
*
|
|
2525
|
-
* @category common/chart/presets
|
|
2526
|
-
* @docsKind primary
|
|
2527
2662
|
* @wcag AA
|
|
2528
2663
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/mini-bar.component.ts
|
|
2529
|
-
* @since 0.
|
|
2664
|
+
* @since 0.3.0
|
|
2530
2665
|
* @relatedTo CngxMiniArea, CngxSparkline, CngxDonut, CngxBullet
|
|
2531
2666
|
*
|
|
2532
|
-
* <example-url
|
|
2533
|
-
* <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
|
|
2534
2670
|
*/
|
|
2535
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
|
+
*/
|
|
2536
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
|
+
*/
|
|
2537
2681
|
readonly max: _angular_core.InputSignal<number>;
|
|
2682
|
+
/**
|
|
2683
|
+
* Lower end of the track, exposed as `aria-valuemin`. Default `0`.
|
|
2684
|
+
*/
|
|
2538
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
|
+
*/
|
|
2539
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
|
+
*/
|
|
2540
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
|
+
*/
|
|
2541
2704
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2542
2705
|
private readonly preset;
|
|
2543
2706
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2565,21 +2728,44 @@ declare class CngxMiniBar {
|
|
|
2565
2728
|
* Use cases: budget variance ("$+45k over"), score deltas ("−12%
|
|
2566
2729
|
* vs target"), KPI swing visualisations.
|
|
2567
2730
|
*
|
|
2568
|
-
* @category common/chart/presets
|
|
2569
|
-
* @docsKind primary
|
|
2570
2731
|
* @wcag AA
|
|
2571
2732
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/deviation-bar.component.ts
|
|
2572
|
-
* @since 0.
|
|
2733
|
+
* @since 0.3.0
|
|
2573
2734
|
* @relatedTo CngxMiniBar, CngxBullet, CngxStackedBar
|
|
2574
2735
|
*
|
|
2575
|
-
* <example-url
|
|
2576
|
-
* <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
|
|
2577
2739
|
*/
|
|
2578
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
|
+
*/
|
|
2579
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
|
+
*/
|
|
2580
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
|
+
*/
|
|
2581
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
|
+
*/
|
|
2582
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
|
+
*/
|
|
2583
2769
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2584
2770
|
private readonly preset;
|
|
2585
2771
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2617,22 +2803,47 @@ declare class CngxDeviationBar {
|
|
|
2617
2803
|
* Default viewBox 80×24. Theming via `--cngx-mini-area-color`
|
|
2618
2804
|
* (atom-local) → `--cngx-chart-primary` (chart-level) cascade.
|
|
2619
2805
|
*
|
|
2620
|
-
* @category common/chart/presets
|
|
2621
|
-
* @docsKind primary
|
|
2622
2806
|
* @wcag AA
|
|
2623
2807
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/mini-area.component.ts
|
|
2624
|
-
* @since 0.
|
|
2808
|
+
* @since 0.3.0
|
|
2625
2809
|
* @relatedTo CngxSparkline, CngxMiniBar, CngxChart
|
|
2626
2810
|
*
|
|
2627
|
-
* <example-url
|
|
2628
|
-
* <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
|
|
2629
2814
|
*/
|
|
2630
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
|
+
*/
|
|
2631
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
|
+
*/
|
|
2632
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
|
+
*/
|
|
2633
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
|
+
*/
|
|
2634
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
|
+
*/
|
|
2635
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
|
+
*/
|
|
2636
2847
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2637
2848
|
private readonly preset;
|
|
2638
2849
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2654,23 +2865,54 @@ declare class CngxMiniArea {
|
|
|
2654
2865
|
* same fallback `CngxMiniBar` uses. A bound `[aria-label]` always
|
|
2655
2866
|
* wins.
|
|
2656
2867
|
*
|
|
2657
|
-
* @category common/chart/presets
|
|
2658
|
-
* @docsKind primary
|
|
2659
2868
|
* @wcag AA
|
|
2660
2869
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/donut.component.ts
|
|
2661
|
-
* @since 0.
|
|
2870
|
+
* @since 0.3.0
|
|
2662
2871
|
* @relatedTo CngxBullet, CngxMiniBar, CngxDeviationBar
|
|
2663
2872
|
*
|
|
2664
|
-
* <example-url
|
|
2665
|
-
* <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
|
|
2666
2876
|
*/
|
|
2667
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
|
+
*/
|
|
2668
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
|
+
*/
|
|
2669
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
|
+
*/
|
|
2670
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
|
+
*/
|
|
2671
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
|
+
*/
|
|
2672
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
|
+
*/
|
|
2673
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
|
+
*/
|
|
2674
2916
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2675
2917
|
private readonly preset;
|
|
2676
2918
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2697,8 +2939,6 @@ declare class CngxDonut {
|
|
|
2697
2939
|
* Bullet chart range entry - a colour band stretching from one value
|
|
2698
2940
|
* to another along the bullet's axis. Typical use: traffic-light
|
|
2699
2941
|
* bands ("good" / "fair" / "poor") behind the actual+target bar.
|
|
2700
|
-
*
|
|
2701
|
-
* @category common/chart/presets
|
|
2702
2942
|
*/
|
|
2703
2943
|
interface CngxBulletRange {
|
|
2704
2944
|
readonly from: number;
|
|
@@ -2719,22 +2959,51 @@ interface RangeRendering {
|
|
|
2719
2959
|
* `[actual]` filled bar, and a `[target]` vertical marker. Pure DOM,
|
|
2720
2960
|
* no SVG. Host carries `role="meter"`.
|
|
2721
2961
|
*
|
|
2722
|
-
* @category common/chart/presets
|
|
2723
|
-
* @docsKind primary
|
|
2724
2962
|
* @wcag AA
|
|
2725
2963
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/bullet.component.ts
|
|
2726
|
-
* @since 0.
|
|
2964
|
+
* @since 0.3.0
|
|
2727
2965
|
* @relatedTo CngxDonut, CngxMiniBar, CngxDeviationBar
|
|
2728
2966
|
*
|
|
2729
|
-
* <example-url
|
|
2730
|
-
* <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
|
|
2731
2970
|
*/
|
|
2732
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
|
+
*/
|
|
2733
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
|
+
*/
|
|
2734
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
|
+
*/
|
|
2735
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
|
+
*/
|
|
2736
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
|
+
*/
|
|
2737
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
|
+
*/
|
|
2738
3007
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2739
3008
|
private readonly preset;
|
|
2740
3009
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|
|
@@ -2758,8 +3027,6 @@ declare class CngxBullet {
|
|
|
2758
3027
|
|
|
2759
3028
|
/**
|
|
2760
3029
|
* One segment in a stacked-bar series: a value, a label, optional colour.
|
|
2761
|
-
*
|
|
2762
|
-
* @category common/chart/presets
|
|
2763
3030
|
*/
|
|
2764
3031
|
interface CngxStackedSegment {
|
|
2765
3032
|
readonly value: number;
|
|
@@ -2782,20 +3049,41 @@ interface SegmentRendering {
|
|
|
2782
3049
|
* bounded reading; the SR description enumerates segments via the
|
|
2783
3050
|
* auto-generated `aria-label` (or the `[ariaLabel]` override).
|
|
2784
3051
|
*
|
|
2785
|
-
* @category common/chart/presets
|
|
2786
|
-
* @docsKind primary
|
|
2787
3052
|
* @wcag AA
|
|
2788
3053
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/presets/stacked-bar.component.ts
|
|
2789
|
-
* @since 0.
|
|
3054
|
+
* @since 0.3.0
|
|
2790
3055
|
* @relatedTo CngxBar, CngxDeviationBar, CngxBullet
|
|
2791
3056
|
*
|
|
2792
|
-
* <example-url
|
|
2793
|
-
* <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
|
|
2794
3060
|
*/
|
|
2795
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
|
+
*/
|
|
2796
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
|
+
*/
|
|
2797
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
|
+
*/
|
|
2798
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
|
+
*/
|
|
2799
3087
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
2800
3088
|
private readonly preset;
|
|
2801
3089
|
protected readonly i18n: _angular_core.Signal<Required<_cngx_common_chart.CngxChartI18n>>;
|