@skyux/charts 14.6.2 → 14.8.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.
@@ -1,26 +1,421 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { TemplateRef } from '@angular/core';
3
+ import { ChartType, ChartConfiguration } from 'chart.js';
3
4
 
4
5
  /**
6
+ * Defines the category axis of a chart. Its categories are shared by every
7
+ * series plotted against it, and each series' values align to them by index.
8
+ *
5
9
  * @preview
10
+ */
11
+ declare class SkyChartAxisCategory {
12
+ /**
13
+ * The categories shared by every series plotted against this axis. Each
14
+ * series' values are aligned to these categories by index.
15
+ */
16
+ readonly categories: _angular_core.InputSignal<readonly (string | number)[]>;
17
+ /**
18
+ * Whether to hide the axis label.
19
+ */
20
+ readonly labelHidden: _angular_core.InputSignalWithTransform<boolean, unknown>;
21
+ /**
22
+ * The text of the axis label.
23
+ */
24
+ readonly labelText: _angular_core.InputSignal<string>;
25
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkyChartAxisCategory, never>;
26
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkyChartAxisCategory, "sky-chart-axis-category", never, { "categories": { "alias": "categories"; "required": true; "isSignal": true; }; "labelHidden": { "alias": "labelHidden"; "required": false; "isSignal": true; }; "labelText": { "alias": "labelText"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
27
+ }
28
+
29
+ /**
30
+ * How a chart formats its numeric values in axis labels, tooltips, and the
31
+ * data table. The `percent` format expects fractional values, so `0.25`
32
+ * displays as `25%`.
6
33
  *
7
- * The allowed heading levels for charts, corresponding to the semantic heading levels in HTML.
34
+ * @preview
8
35
  */
9
- type SkyChartHeadingLevel = 2 | 3 | 4 | 5;
36
+ type SkyChartValueFormat = 'currency' | 'number' | 'percent';
10
37
 
11
38
  /**
39
+ * The scale type for a chart value axis. Use `logarithmic` when values span
40
+ * several orders of magnitude; otherwise use the default `linear` scale. Note
41
+ * that the `logarithmic` scale cannot display zero or negative values.
42
+ *
12
43
  * @preview
44
+ */
45
+ type SkyChartValueScaleType = 'linear' | 'logarithmic';
46
+
47
+ /**
48
+ * Defines the value axis of a chart, which scales the plotted series and
49
+ * formats their values in axis labels, tooltips, and the data table.
13
50
  *
14
- * The allowed heading styles for charts, corresponding to the font styles defined in the SKY UX design system.
51
+ * @preview
15
52
  */
16
- type SkyChartHeadingStyle = 2 | 3 | 4 | 5;
53
+ declare class SkyChartAxisValue {
54
+ #private;
55
+ /**
56
+ * The ISO 4217 currency code used when `format` is `currency`. When unset,
57
+ * currency values format as `USD`.
58
+ */
59
+ readonly currencyCode: _angular_core.InputSignal<string | undefined>;
60
+ /**
61
+ * The number of decimal places to display. When unset, the format's
62
+ * locale-aware default is used (for example, two places for most
63
+ * currencies).
64
+ */
65
+ readonly digits: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
66
+ /**
67
+ * How to format the axis values in axis labels, tooltips, and the data table.
68
+ * The `percent` format expects fractional values, so `0.25` displays as
69
+ * `25%`.
70
+ * @default 'number'
71
+ */
72
+ readonly format: _angular_core.InputSignal<SkyChartValueFormat>;
73
+ /**
74
+ * Whether to hide the axis label.
75
+ */
76
+ readonly labelHidden: _angular_core.InputSignalWithTransform<boolean, unknown>;
77
+ /**
78
+ * The text of the axis label.
79
+ */
80
+ readonly labelText: _angular_core.InputSignal<string>;
81
+ /**
82
+ * The highest value to display on the axis. When unset, the axis scales to
83
+ * fit the plotted values.
84
+ */
85
+ readonly max: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
86
+ /**
87
+ * The lowest value to display on the axis. When unset, the axis scales to
88
+ * fit the plotted values.
89
+ */
90
+ readonly min: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
91
+ /**
92
+ * The scale type for the value axis.
93
+ * @default 'linear'
94
+ */
95
+ readonly scaleType: _angular_core.InputSignal<SkyChartValueScaleType>;
96
+ /**
97
+ * Formats a numeric value according to this axis's `format`, `currencyCode`,
98
+ * and the current locale.
99
+ * @internal
100
+ */
101
+ readonly formatValue: _angular_core.Signal<(value: number) => string>;
102
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkyChartAxisValue, never>;
103
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkyChartAxisValue, "sky-chart-axis-value", never, { "currencyCode": { "alias": "currencyCode"; "required": false; "isSignal": true; }; "digits": { "alias": "digits"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "labelHidden": { "alias": "labelHidden"; "required": false; "isSignal": true; }; "labelText": { "alias": "labelText"; "required": true; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "scaleType": { "alias": "scaleType"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
104
+ }
17
105
 
18
106
  /**
107
+ * A Chart.js configuration with a required `options` object. Plot components
108
+ * always build a complete `options`, so requiring it here keeps the render
109
+ * loop free of undefined checks.
110
+ * @internal
111
+ */
112
+ type SkyChartJsConfig<TType extends ChartType = ChartType> = ChartConfiguration<TType> & {
113
+ options: NonNullable<ChartConfiguration<TType>['options']>;
114
+ };
115
+
116
+ /**
117
+ * A tabular representation of a chart's plotted content, used to render the
118
+ * accessible data table.
119
+ * @internal
120
+ */
121
+ interface SkyChartTable {
122
+ /**
123
+ * The label of the category axis, shown as the corner header of the table.
124
+ */
125
+ categoryLabel: string;
126
+ /**
127
+ * The category values, shown as the table's row headers.
128
+ */
129
+ categories: readonly (string | number)[];
130
+ /**
131
+ * The plotted series, shown as the table's columns.
132
+ */
133
+ series: SkyChartTableSeries[];
134
+ }
135
+ /**
136
+ * A single series within a chart's tabular representation.
137
+ * @internal
138
+ */
139
+ interface SkyChartTableSeries {
140
+ /**
141
+ * The series label, shown as a column header.
142
+ */
143
+ label: string;
144
+ /**
145
+ * The series values, formatted for display and aligned to the categories by
146
+ * index.
147
+ */
148
+ values: readonly string[];
149
+ }
150
+
151
+ /**
152
+ * A localized, descriptive summary of a chart's plotted content, used as the
153
+ * accessible name of the chart figure. Each plot type supplies its own resource
154
+ * key and arguments so the wording can describe that type's shape (for example,
155
+ * a bar chart's series and categories).
156
+ * @internal
157
+ */
158
+ interface SkyChartAccessibleSummary {
159
+ /**
160
+ * The resource key of the localized summary sentence.
161
+ */
162
+ resourceKey: string;
163
+ /**
164
+ * The positional arguments for the localized summary sentence.
165
+ */
166
+ args: (string | number)[];
167
+ }
168
+
169
+ /**
170
+ * The resolved, themed styling for a chart, grouped by feature. Chart.js
171
+ * renders to a canvas that cannot read CSS custom properties, so every SKY
172
+ * theme token the library depends on is resolved here — and only here — to a
173
+ * concrete value. This keeps the full set of tokens auditable in one place.
174
+ *
175
+ * When the SKY theme styles are not loaded, strings resolve to empty strings —
176
+ * which Chart.js treats as unset, rendering with its own defaults — and numbers
177
+ * to `NaN`. Every value otherwise has a default defined in the
178
+ * `sky-default-overrides` mixin in `chart.scss`, which applies in every
179
+ * non-modern context; the modern theme supplies the `--sky-*` tokens directly.
180
+ * @internal
181
+ */
182
+ interface SkyChartThemeStyles {
183
+ font: {
184
+ family: string;
185
+ size: number;
186
+ weight: number;
187
+ emphasizedWeight: number;
188
+ };
189
+ text: {
190
+ color: string;
191
+ deemphasizedColor: string;
192
+ lineHeight: number;
193
+ };
194
+ height: {
195
+ /** The minimum chart height, in pixels. */
196
+ min: number;
197
+ /** The maximum chart height, in pixels. */
198
+ max: number;
199
+ /**
200
+ * The default chart height as a CSS `clamp()` expression, used by
201
+ * orientations whose height is not computed from their content.
202
+ */
203
+ default: string;
204
+ };
205
+ axis: {
206
+ lineColor: string;
207
+ gridlineColor: string;
208
+ tickLength: number;
209
+ /**
210
+ * The vertical gap between an axis title and its ticks.
211
+ */
212
+ titleGap: number;
213
+ };
214
+ series: {
215
+ categoricalPalette: string[];
216
+ };
217
+ /**
218
+ * The styling of the tooltip container and its contents.
219
+ */
220
+ tooltip: {
221
+ backgroundColor: string;
222
+ borderColor: string;
223
+ borderWidth: number;
224
+ cornerRadius: number;
225
+ inset: {
226
+ top: number;
227
+ right: number;
228
+ bottom: number;
229
+ left: number;
230
+ };
231
+ /**
232
+ * The size of the color-swatch icon beside each tooltip line.
233
+ */
234
+ iconSize: number;
235
+ /**
236
+ * The gap between the color-swatch icon and its text.
237
+ */
238
+ iconGap: number;
239
+ /**
240
+ * The vertical gap between the tooltip title or footer and its body.
241
+ */
242
+ titleGap: number;
243
+ /**
244
+ * The vertical gap between tooltip body lines.
245
+ */
246
+ bodyGap: number;
247
+ };
248
+ bar: {
249
+ borderColor: string;
250
+ borderRadius: number;
251
+ /** Bar-layout sizing for a vertical (column) chart, in pixels. */
252
+ vertical: {
253
+ baseBarThickness: number;
254
+ minBarThickness: number;
255
+ maxBarThickness: number;
256
+ };
257
+ /** Bar-layout sizing for a horizontal chart, in pixels. */
258
+ horizontal: {
259
+ minBarThickness: number;
260
+ maxBarThickness: number;
261
+ minCategoryGap: number;
262
+ };
263
+ };
264
+ }
265
+
266
+ /**
267
+ * Base class for chart plot components (for example, `sky-chart-bar`). Owns the
268
+ * bridge that publishes each plot's tabular representation to the accessible
269
+ * data table, so every plot type shares the same lifecycle. Subclasses
270
+ * implement `getChartTable`, `getAccessibleSummary`, and their own rendering.
271
+ *
272
+ * Plots must be rendered inside `sky-chart`: the wrapper provides the data
273
+ * table bridge and the default-theme styling the plot resolves its themed
274
+ * values from.
275
+ * @internal
276
+ */
277
+ declare abstract class SkyChartPlot {
278
+ #private;
279
+ constructor();
280
+ /**
281
+ * Builds the tabular representation of the plotted content for the accessible
282
+ * data table, or `undefined` when the plot has no data to represent.
283
+ */
284
+ protected abstract getChartTable(): SkyChartTable | undefined;
285
+ /**
286
+ * Builds the localized, descriptive summary used as the chart figure's
287
+ * accessible name, or `undefined` when the plot has no data to represent.
288
+ */
289
+ protected abstract getAccessibleSummary(): SkyChartAccessibleSummary | undefined;
290
+ /**
291
+ * Resolves the active theme's chart styling against this plot's element.
292
+ * Chart.js renders to a canvas that cannot read CSS variables, so themed
293
+ * tokens must be resolved to concrete values against the DOM.
294
+ */
295
+ protected getThemeStyles(): SkyChartThemeStyles;
296
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkyChartPlot, never>;
297
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SkyChartPlot, never, never, {}, {}, never, never, true, never>;
298
+ }
299
+
300
+ /**
301
+ * The orientation of a bar chart's bars.
302
+ *
19
303
  * @preview
304
+ */
305
+ type SkyChartBarOrientation = 'horizontal' | 'vertical';
306
+
307
+ /**
308
+ * A single value plotted by a bar chart series: a number renders a standard
309
+ * bar measured from the value axis's baseline, a `[start, end]` tuple renders
310
+ * a floating bar spanning the two values, and `null` renders a gap.
20
311
  *
312
+ * @preview
313
+ */
314
+ type SkyChartBarSeriesValue = number | readonly [number, number] | null;
315
+
316
+ /**
317
+ * Defines a single series of values to plot on a bar chart, aligned to the
318
+ * category axis by index.
319
+ *
320
+ * @preview
321
+ */
322
+ declare class SkyChartBarSeries {
323
+ /**
324
+ * The text that identifies this series in the legend and tooltips.
325
+ */
326
+ readonly labelText: _angular_core.InputSignal<string>;
327
+ /**
328
+ * The stack this series belongs to. When a bar chart's `seriesLayout`
329
+ * is `stacked`, series that share the same `stackId` value accumulate into
330
+ * a single bar per category, and series with different `stackId` values
331
+ * are placed side by side. Omit to stack every series into one bar per
332
+ * category. Has no effect when `seriesLayout` is `grouped`.
333
+ */
334
+ readonly stackId: _angular_core.InputSignal<string | undefined>;
335
+ /**
336
+ * The values for this series, aligned to the category axis categories by
337
+ * index. A number renders a standard bar measured from the value axis's
338
+ * baseline, a `[start, end]` tuple renders a floating bar spanning the two
339
+ * values, and a `null` value renders a gap in the chart and an empty cell
340
+ * in the data table.
341
+ */
342
+ readonly values: _angular_core.InputSignal<readonly SkyChartBarSeriesValue[]>;
343
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkyChartBarSeries, never>;
344
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkyChartBarSeries, "sky-chart-bar-series", never, { "labelText": { "alias": "labelText"; "required": true; "isSignal": true; }; "stackId": { "alias": "stackId"; "required": false; "isSignal": true; }; "values": { "alias": "values"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
345
+ }
346
+
347
+ /**
348
+ * How a bar chart arranges the bars of multiple series within each category.
349
+ * `grouped` places the series' bars side by side; `stacked` accumulates the
350
+ * bars into a single bar per category. Neither has a visible effect when the
351
+ * chart has a single series.
352
+ *
353
+ * @preview
354
+ */
355
+ type SkyChartBarSeriesLayout = 'grouped' | 'stacked';
356
+
357
+ /**
358
+ * Renders a bar chart from a category axis, a value axis, and one or more
359
+ * series.
360
+ *
361
+ * @preview
362
+ */
363
+ declare class SkyChartBar extends SkyChartPlot {
364
+ #private;
365
+ /**
366
+ * The orientation of the bars.
367
+ * @default 'vertical'
368
+ */
369
+ readonly orientation: _angular_core.InputSignal<SkyChartBarOrientation>;
370
+ /**
371
+ * How the bars of multiple series are arranged within each category.
372
+ * `grouped` places the series' bars side by side; `stacked` accumulates the
373
+ * bars into a single bar per category. When `stacked`, assign each series a
374
+ * `stackId` value to subdivide the bar into side-by-side stacks (grouped,
375
+ * stacked bars). This has no visible effect when the chart has a single
376
+ * series.
377
+ * @default 'grouped'
378
+ */
379
+ readonly seriesLayout: _angular_core.InputSignal<SkyChartBarSeriesLayout>;
380
+ protected readonly categoryAxis: _angular_core.Signal<SkyChartAxisCategory | undefined>;
381
+ protected readonly valueAxis: _angular_core.Signal<SkyChartAxisValue | undefined>;
382
+ protected readonly series: _angular_core.Signal<readonly SkyChartBarSeries[]>;
383
+ constructor();
384
+ protected readonly chartJsConfig: _angular_core.Signal<SkyChartJsConfig<"bar"> | undefined>;
385
+ /**
386
+ * The height to apply to the rendered chart. Chart.js runs with
387
+ * `maintainAspectRatio: false`, so its container must be given an explicit
388
+ * height. Vertical charts use the themed default; horizontal charts grow
389
+ * with their content so every bar stays legible.
390
+ */
391
+ protected readonly chartHeight: _angular_core.Signal<string>;
392
+ protected getChartTable(): SkyChartTable | undefined;
393
+ protected getAccessibleSummary(): SkyChartAccessibleSummary | undefined;
394
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkyChartBar, never>;
395
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkyChartBar, "sky-chart-bar", never, { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "seriesLayout": { "alias": "seriesLayout"; "required": false; "isSignal": true; }; }, {}, ["categoryAxis", "valueAxis", "series"], never, true, never>;
396
+ }
397
+
398
+ /**
399
+ * The allowed heading levels for charts, corresponding to the semantic heading levels in HTML.
400
+ *
401
+ * @preview
402
+ */
403
+ type SkyChartHeadingLevel = 2 | 3 | 4 | 5;
404
+
405
+ /**
406
+ * The allowed heading styles for charts, corresponding to the font styles defined in the SKY UX design system.
407
+ *
408
+ * @preview
409
+ */
410
+ type SkyChartHeadingStyle = 2 | 3 | 4 | 5;
411
+
412
+ /**
21
413
  * Provides a consistent heading, subheading, and layout wrapper for a chart.
414
+ *
415
+ * @preview
22
416
  */
23
417
  declare class SkyChart {
418
+ #private;
24
419
  /**
25
420
  * Whether to hide the chart's heading.
26
421
  */
@@ -56,17 +451,20 @@ declare class SkyChart {
56
451
  */
57
452
  readonly helpPopoverTitle: _angular_core.InputSignal<string | undefined>;
58
453
  /**
59
- * Whether to hide the chart's subheading.
454
+ * Whether the chart's data is being loaded. When `true`, a wait overlay
455
+ * covers the chart's content area, which reserves the default chart height
456
+ * while no plot is rendered. The heading and help button stay interactive.
457
+ * @default false
60
458
  */
61
- readonly subheadingHidden: _angular_core.InputSignalWithTransform<boolean, unknown>;
459
+ readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
62
460
  /**
63
461
  * The text to display as the chart's subheading.
64
462
  */
65
463
  readonly subheadingText: _angular_core.InputSignal<string | undefined>;
66
- protected readonly figureLabel: _angular_core.Signal<string>;
464
+ protected readonly figureLabel: _angular_core.Signal<string | null>;
67
465
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SkyChart, never>;
68
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkyChart, "sky-chart", never, { "headingHidden": { "alias": "headingHidden"; "required": false; "isSignal": true; }; "headingLevel": { "alias": "headingLevel"; "required": false; "isSignal": true; }; "headingStyle": { "alias": "headingStyle"; "required": false; "isSignal": true; }; "headingText": { "alias": "headingText"; "required": true; "isSignal": true; }; "helpKey": { "alias": "helpKey"; "required": false; "isSignal": true; }; "helpPopoverContent": { "alias": "helpPopoverContent"; "required": false; "isSignal": true; }; "helpPopoverTitle": { "alias": "helpPopoverTitle"; "required": false; "isSignal": true; }; "subheadingHidden": { "alias": "subheadingHidden"; "required": false; "isSignal": true; }; "subheadingText": { "alias": "subheadingText"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
466
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SkyChart, "sky-chart", never, { "headingHidden": { "alias": "headingHidden"; "required": false; "isSignal": true; }; "headingLevel": { "alias": "headingLevel"; "required": false; "isSignal": true; }; "headingStyle": { "alias": "headingStyle"; "required": false; "isSignal": true; }; "headingText": { "alias": "headingText"; "required": true; "isSignal": true; }; "helpKey": { "alias": "helpKey"; "required": false; "isSignal": true; }; "helpPopoverContent": { "alias": "helpPopoverContent"; "required": false; "isSignal": true; }; "helpPopoverTitle": { "alias": "helpPopoverTitle"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "subheadingText": { "alias": "subheadingText"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
69
467
  }
70
468
 
71
- export { SkyChart };
72
- export type { SkyChartHeadingLevel, SkyChartHeadingStyle };
469
+ export { SkyChart, SkyChartAxisCategory, SkyChartAxisValue, SkyChartBar, SkyChartBarSeries };
470
+ export type { SkyChartBarOrientation, SkyChartBarSeriesLayout, SkyChartBarSeriesValue, SkyChartHeadingLevel, SkyChartHeadingStyle, SkyChartValueFormat, SkyChartValueScaleType };