@umriss-ui/charts 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -1
- package/README.md +8 -6
- package/dist/charts.css +1 -1
- package/dist/charts.js +2313 -2024
- package/dist/de.d.ts +19 -0
- package/dist/index.d.ts +460 -143
- package/dist/wording/de.d.ts +2 -0
- package/dist/wording/de.js +17 -6
- package/docs/llms-full.md +8945 -3231
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,32 +7,42 @@ import { ReactNode } from 'react';
|
|
|
7
7
|
data reference then. A native or bound function is compared by identity. */
|
|
8
8
|
export declare type Accessor<T> = (d: T, index: number) => number | null | undefined;
|
|
9
9
|
|
|
10
|
+
/** A series drawn as a filled area between its values and a baseline, 0
|
|
11
|
+
without one. Renders nothing itself: it registers with the surrounding
|
|
12
|
+
`Chart`. With `stack`, areas stand on each other. */
|
|
10
13
|
export declare function Area<T>(props: AreaProps<T>): null;
|
|
11
14
|
|
|
15
|
+
/** The props of `Area`. */
|
|
12
16
|
export declare interface AreaProps<T> {
|
|
13
|
-
/** Upper edge; null/undefined/NaN/±Infinity means a gap
|
|
17
|
+
/** Upper edge; null/undefined/NaN/±Infinity means a gap.
|
|
18
|
+
@remarks R-2.5 */
|
|
14
19
|
accessor: Accessor<T>;
|
|
15
|
-
/** Lower edge
|
|
16
|
-
|
|
20
|
+
/** Lower edge. In a `stack` the stack below is the lower edge, and this is
|
|
21
|
+
not read.
|
|
22
|
+
@default a fixed baseline at 0 */
|
|
17
23
|
baseline?: Accessor<T>;
|
|
18
|
-
/** Binding to an x axis
|
|
24
|
+
/** Binding to an x axis.
|
|
25
|
+
@remarks R-4.12 */
|
|
19
26
|
xAxisId?: string;
|
|
20
|
-
/** Binding to a y axis
|
|
27
|
+
/** Binding to a y axis.
|
|
28
|
+
@remarks R-4.12 */
|
|
21
29
|
yAxisId?: string;
|
|
22
|
-
/** Series-own data; overrides the container data
|
|
30
|
+
/** Series-own data; overrides the container data.
|
|
31
|
+
@remarks R-2.4 */
|
|
23
32
|
data?: readonly T[];
|
|
24
|
-
/** The name in legend and tooltip. Without one
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
34
|
+
unnamed series is a colour nobody can look up.
|
|
35
|
+
@default "Series n", after its place in the chart */
|
|
27
36
|
name?: string;
|
|
28
37
|
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
29
38
|
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
30
39
|
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
31
40
|
hidden?: boolean;
|
|
32
|
-
/** The value as the tooltip writes it
|
|
33
|
-
|
|
41
|
+
/** The value as the tooltip writes it.
|
|
42
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
34
43
|
format?: (value: number) => string;
|
|
35
|
-
/** Any CSS colour value
|
|
44
|
+
/** Any CSS colour value.
|
|
45
|
+
@default the palette's `--uc-series-N` */
|
|
36
46
|
color?: string;
|
|
37
47
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
38
48
|
it. */
|
|
@@ -52,11 +62,13 @@ export declare interface AreaProps<T> {
|
|
|
52
62
|
/** Width of the outline along the upper edge in CSS pixels; 0 leaves it
|
|
53
63
|
out. */
|
|
54
64
|
strokeWidth?: number;
|
|
55
|
-
/** Dash pattern of the outline as a run of lengths in CSS pixels
|
|
56
|
-
|
|
65
|
+
/** Dash pattern of the outline as a run of lengths in CSS pixels. The fill
|
|
66
|
+
stays whole.
|
|
67
|
+
@default a solid outline */
|
|
57
68
|
dash?: readonly number[];
|
|
58
69
|
}
|
|
59
70
|
|
|
71
|
+
/** An `Area` as the chart holds it once registered. */
|
|
60
72
|
export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
61
73
|
kind: "area";
|
|
62
74
|
/** Lower edge; without a value the fixed baseline 0. */
|
|
@@ -106,6 +118,7 @@ export declare interface Assessment {
|
|
|
106
118
|
deviation?: number;
|
|
107
119
|
}
|
|
108
120
|
|
|
121
|
+
/** An `XAxis` or `YAxis` as the chart holds it once registered. */
|
|
109
122
|
export declare interface AxisConfig<T = unknown> {
|
|
110
123
|
id: string;
|
|
111
124
|
orientation: AxisOrientation;
|
|
@@ -117,8 +130,9 @@ export declare interface AxisConfig<T = unknown> {
|
|
|
117
130
|
/** "visible" is a y axis' only: the extent of what its series show inside
|
|
118
131
|
their x axis' domain. */
|
|
119
132
|
domain: "nice" | "data" | "visible" | readonly [number, number];
|
|
120
|
-
/**
|
|
121
|
-
orientation
|
|
133
|
+
/** Whether the axis draws its grid lines.
|
|
134
|
+
@default only the first registered axis per orientation
|
|
135
|
+
@remarks R-4.15 */
|
|
122
136
|
grid?: boolean;
|
|
123
137
|
/** Fixed tick values instead of the 1-2-5 algorithm. For axes whose values are
|
|
124
138
|
not numbers but places: the lanes of a state stack, the categories of a
|
|
@@ -138,33 +152,46 @@ export declare interface AxisConfig<T = unknown> {
|
|
|
138
152
|
onDomainChange?: (domain: [number, number]) => void;
|
|
139
153
|
}
|
|
140
154
|
|
|
155
|
+
/** Whether an axis or a limit runs along x or along y. */
|
|
141
156
|
export declare type AxisOrientation = "x" | "y";
|
|
142
157
|
|
|
158
|
+
/** The edge of the plot an axis stands at: `bottom` or `top` for x, `left` or
|
|
159
|
+
`right` for y. */
|
|
143
160
|
export declare type AxisPosition = "bottom" | "top" | "left" | "right";
|
|
144
161
|
|
|
162
|
+
/** A series drawn as bars from 0 to its values, on the numeric x axis.
|
|
163
|
+
Several bar series on one x axis stand side by side, or on each other with
|
|
164
|
+
`stack`. Renders nothing itself: it registers with the surrounding
|
|
165
|
+
`Chart`. */
|
|
145
166
|
export declare function Bar<T>(props: BarProps<T>): null;
|
|
146
167
|
|
|
168
|
+
/** The props of `Bar`. */
|
|
147
169
|
export declare interface BarProps<T> {
|
|
148
|
-
/** Height; null/undefined/NaN/±Infinity means a gap
|
|
170
|
+
/** Height; null/undefined/NaN/±Infinity means a gap.
|
|
171
|
+
@remarks R-2.5 */
|
|
149
172
|
accessor: Accessor<T>;
|
|
150
|
-
/** Binding to an x axis
|
|
173
|
+
/** Binding to an x axis.
|
|
174
|
+
@remarks R-4.12 */
|
|
151
175
|
xAxisId?: string;
|
|
152
|
-
/** Binding to a y axis
|
|
176
|
+
/** Binding to a y axis.
|
|
177
|
+
@remarks R-4.12 */
|
|
153
178
|
yAxisId?: string;
|
|
154
|
-
/** Series-own data; overrides the container data
|
|
179
|
+
/** Series-own data; overrides the container data.
|
|
180
|
+
@remarks R-2.4 */
|
|
155
181
|
data?: readonly T[];
|
|
156
|
-
/** The name in legend and tooltip. Without one
|
|
157
|
-
|
|
158
|
-
|
|
182
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
183
|
+
unnamed series is a colour nobody can look up.
|
|
184
|
+
@default "Series n", after its place in the chart */
|
|
159
185
|
name?: string;
|
|
160
186
|
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
161
187
|
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
162
188
|
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
163
189
|
hidden?: boolean;
|
|
164
|
-
/** The value as the tooltip writes it
|
|
165
|
-
|
|
190
|
+
/** The value as the tooltip writes it.
|
|
191
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
166
192
|
format?: (value: number) => string;
|
|
167
|
-
/** Any CSS colour value
|
|
193
|
+
/** Any CSS colour value.
|
|
194
|
+
@default the palette's `--uc-series-N` */
|
|
168
195
|
color?: string;
|
|
169
196
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
170
197
|
it. */
|
|
@@ -184,12 +211,132 @@ export declare interface BarProps<T> {
|
|
|
184
211
|
barWidth?: number;
|
|
185
212
|
}
|
|
186
213
|
|
|
214
|
+
/** A `Bar` as the chart holds it once registered. */
|
|
187
215
|
export declare interface BarSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
188
216
|
kind: "bar";
|
|
189
217
|
/** Width as a fraction of the step; the group shares this fraction. */
|
|
190
218
|
barWidth: number;
|
|
191
219
|
}
|
|
192
220
|
|
|
221
|
+
/** The named channels of a box: one number per point, NaN where the median
|
|
222
|
+
is a gap; and its outliers (ADR-0040). */
|
|
223
|
+
export declare interface BoxChannels extends BoxNumbers<Float64Array> {
|
|
224
|
+
/** Every box's outliers, flat, box after box; null without `outliers`. */
|
|
225
|
+
outliers: Float64Array | null;
|
|
226
|
+
/** Where each box's outliers begin, and one past the last: box i's stand
|
|
227
|
+
from outlierOffsets[i] to outlierOffsets[i + 1]. null without
|
|
228
|
+
`outliers`. */
|
|
229
|
+
outlierOffsets: Uint32Array | null;
|
|
230
|
+
/** The optional numbers, each null where not given. */
|
|
231
|
+
mean: Float64Array | null;
|
|
232
|
+
notchLower: Float64Array | null;
|
|
233
|
+
notchUpper: Float64Array | null;
|
|
234
|
+
count: Float64Array | null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** The optional numbers of a box (box-plot 04), by name. */
|
|
238
|
+
export declare interface BoxExtras<V = number> {
|
|
239
|
+
mean: V;
|
|
240
|
+
notchLower: V;
|
|
241
|
+
notchUpper: V;
|
|
242
|
+
count: V;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** A box's further numbers beside its median, by name. */
|
|
246
|
+
export declare interface BoxNumbers<V = number> {
|
|
247
|
+
lowerQuartile: V;
|
|
248
|
+
upperQuartile: V;
|
|
249
|
+
lowerWhisker: V;
|
|
250
|
+
upperWhisker: V;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** A series drawn as a box per x: median, quartiles and whiskers, optionally
|
|
254
|
+
outliers, a mean and a notch. The caller brings every number - the library
|
|
255
|
+
computes none. Renders nothing itself: it registers with the surrounding
|
|
256
|
+
`Chart`. */
|
|
257
|
+
export declare function BoxPlot<T>(props: BoxPlotProps<T>): null;
|
|
258
|
+
|
|
259
|
+
/** The props of `BoxPlot`. */
|
|
260
|
+
export declare interface BoxPlotProps<T> {
|
|
261
|
+
/** The line across the box; null/undefined/NaN/±Infinity means a gap - no
|
|
262
|
+
box is drawn there, whatever the other numbers say.
|
|
263
|
+
@remarks R-2.5 */
|
|
264
|
+
median: Accessor<T>;
|
|
265
|
+
/** The box's lower edge. */
|
|
266
|
+
lowerQuartile: Accessor<T>;
|
|
267
|
+
/** The box's upper edge. */
|
|
268
|
+
upperQuartile: Accessor<T>;
|
|
269
|
+
/** Where the lower whisker ends - the caller's rule, not the minimum. */
|
|
270
|
+
lowerWhisker: Accessor<T>;
|
|
271
|
+
/** Where the upper whisker ends - the caller's rule, not the maximum. */
|
|
272
|
+
upperWhisker: Accessor<T>;
|
|
273
|
+
/** The values beyond the whiskers, per box: an array, empty or missing
|
|
274
|
+
where there are none. Drawn with their box in its colour - one beyond
|
|
275
|
+
three IQR of the box's own quartiles as a ring -, read in its tooltip
|
|
276
|
+
and table row, never hit on their own (ADR-0040). */
|
|
277
|
+
outliers?: ListAccessor<T>;
|
|
278
|
+
/** The mean, drawn as a small ×: beside the median it shows a skew. */
|
|
279
|
+
mean?: Accessor<T>;
|
|
280
|
+
/** The notch's lower bound - usually of a confidence interval of the
|
|
281
|
+
median. Both bounds or neither: one alone warns in DEV and is not
|
|
282
|
+
drawn. */
|
|
283
|
+
notchLower?: Accessor<T>;
|
|
284
|
+
/** The notch's upper bound; see `notchLower`. */
|
|
285
|
+
notchUpper?: Accessor<T>;
|
|
286
|
+
/** How many values stand behind the box; read in the tooltip and the
|
|
287
|
+
table, not drawn. */
|
|
288
|
+
count?: Accessor<T>;
|
|
289
|
+
/** Binding to an x axis.
|
|
290
|
+
@remarks R-4.12 */
|
|
291
|
+
xAxisId?: string;
|
|
292
|
+
/** Binding to a y axis.
|
|
293
|
+
@remarks R-4.12 */
|
|
294
|
+
yAxisId?: string;
|
|
295
|
+
/** Series-own data; overrides the container data.
|
|
296
|
+
@remarks R-2.4 */
|
|
297
|
+
data?: readonly T[];
|
|
298
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV.
|
|
299
|
+
@default "Series n", after its place in the chart */
|
|
300
|
+
name?: string;
|
|
301
|
+
/** Not drawn, not hit and not counted for its axes' extent. Its legend
|
|
302
|
+
entry stays, drawn back. Controlled, typically from `Legend onToggle`. */
|
|
303
|
+
hidden?: boolean;
|
|
304
|
+
/** Every number of the box as the tooltip and the table write it.
|
|
305
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
306
|
+
format?: (value: number) => string;
|
|
307
|
+
/** Any CSS colour value.
|
|
308
|
+
@default the palette's `--uc-series-N` */
|
|
309
|
+
color?: string;
|
|
310
|
+
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
311
|
+
it. Set by the caller: a box out of its specification is the caller's
|
|
312
|
+
judgement, not the library's. */
|
|
313
|
+
tone?: "ok" | "warning" | "alarm";
|
|
314
|
+
/** Width as a fraction of the step, as a bar's: boxes and bars on one x axis
|
|
315
|
+
share this fraction and stand side by side. */
|
|
316
|
+
boxWidth?: number;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** A box plot (CONTEXT.md: Box). The base accessor is the median; the four
|
|
320
|
+
further numbers are the caller's, computed by whatever method the caller
|
|
321
|
+
chose - the library draws them and computes none. */
|
|
322
|
+
export declare interface BoxSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
323
|
+
kind: "box";
|
|
324
|
+
lowerQuartile: Accessor<T>;
|
|
325
|
+
upperQuartile: Accessor<T>;
|
|
326
|
+
lowerWhisker: Accessor<T>;
|
|
327
|
+
upperWhisker: Accessor<T>;
|
|
328
|
+
/** The values beyond the whiskers, per box (ADR-0040). */
|
|
329
|
+
outliers?: ListAccessor<T>;
|
|
330
|
+
mean?: Accessor<T>;
|
|
331
|
+
/** Both bounds or neither (CONTEXT.md: Notch). */
|
|
332
|
+
notchLower?: Accessor<T>;
|
|
333
|
+
notchUpper?: Accessor<T>;
|
|
334
|
+
/** How many values stand behind the box; no y value. */
|
|
335
|
+
count?: Accessor<T>;
|
|
336
|
+
/** Width as a fraction of the step; boxes and bars on one x axis share it. */
|
|
337
|
+
boxWidth: number;
|
|
338
|
+
}
|
|
339
|
+
|
|
193
340
|
/** The breaks in working time that lie within the extent [from, to] - what the
|
|
194
341
|
axis must mark, in domain units. */
|
|
195
342
|
export declare function breaks(input: CalendarInput, from: number, to: number): number[];
|
|
@@ -202,27 +349,36 @@ export declare function calendarFrom(input: CalendarInput): WorkingCalendar;
|
|
|
202
349
|
axis, or the calendar built from it. */
|
|
203
350
|
export declare type CalendarInput = WorkingCalendar | readonly WorkingInterval[];
|
|
204
351
|
|
|
352
|
+
/** The container of a chart: it holds the data, measures the plot area and
|
|
353
|
+
draws on canvas whatever its children register - axes, series, limits,
|
|
354
|
+
legend and tooltip. The order of the children is the drawing order. */
|
|
205
355
|
export declare function Chart<T>(props: ChartProps<T>): ReactNode;
|
|
206
356
|
|
|
207
|
-
/** Measurements of the instrumentation for the benchmark page
|
|
357
|
+
/** Measurements of the instrumentation for the benchmark page.
|
|
358
|
+
@remarks R-5.1 */
|
|
208
359
|
export declare interface ChartPerf {
|
|
209
360
|
materializeMs: number;
|
|
210
361
|
seriesDrawMs: number;
|
|
211
362
|
points: number;
|
|
212
363
|
}
|
|
213
364
|
|
|
365
|
+
/** The props of `Chart`. */
|
|
214
366
|
export declare interface ChartProps<T> {
|
|
215
|
-
/** Shared data basis (required); access only through accessors
|
|
367
|
+
/** Shared data basis (required); access only through accessors.
|
|
368
|
+
@remarks R-2.4 */
|
|
216
369
|
data: readonly T[];
|
|
217
|
-
/** Width in CSS pixels, or `"100%"` for the host's
|
|
218
|
-
|
|
370
|
+
/** Width in CSS pixels, or `"100%"` for the host's: the chart measures its
|
|
371
|
+
host and follows it through a ResizeObserver.
|
|
372
|
+
@default "100%" */
|
|
219
373
|
width?: number | "100%";
|
|
220
|
-
/** Height in CSS pixels
|
|
221
|
-
|
|
374
|
+
/** Height in CSS pixels. Unlike the width, the chart does not take its
|
|
375
|
+
host's.
|
|
376
|
+
@default 300 */
|
|
222
377
|
height?: number;
|
|
223
378
|
/** Outer spacing of the plot area in CSS pixels. */
|
|
224
379
|
padding?: number | Partial<Padding>;
|
|
225
|
-
/** Required in DEV through a warning
|
|
380
|
+
/** Required in DEV through a warning.
|
|
381
|
+
@remarks R-7.6 */
|
|
226
382
|
ariaLabel?: string;
|
|
227
383
|
/** Goes to the root element, as it does everywhere in this workspace. */
|
|
228
384
|
className?: string;
|
|
@@ -232,32 +388,37 @@ export declare interface ChartProps<T> {
|
|
|
232
388
|
style?: CSSProperties;
|
|
233
389
|
/** Shown in the middle of the plot area when no visible series has a point
|
|
234
390
|
to show - no data, only gaps, or every series hidden. Axes and frame
|
|
235
|
-
stay.
|
|
391
|
+
stay.
|
|
392
|
+
@default the wording's `empty` */
|
|
236
393
|
empty?: ReactNode;
|
|
237
|
-
/** The chart's words (ADR-0031)
|
|
238
|
-
|
|
239
|
-
|
|
394
|
+
/** The chart's words (ADR-0031); entries left out fall back to English.
|
|
395
|
+
German: `GERMAN_CHARTS_WORDING` from `@umriss-ui/charts/wording/de`.
|
|
396
|
+
@default DEFAULT_CHARTS_WORDING */
|
|
240
397
|
wording?: Partial<ChartsWording>;
|
|
241
|
-
/** How series are told apart. `"color"
|
|
398
|
+
/** How series are told apart. `"color"`: by their colour.
|
|
242
399
|
`"marks"`: by a dash and a marker shape as well - a line, an area and a
|
|
243
400
|
scatter -, and by a hatch - a bar, a state, a matrix cell, a limit band -,
|
|
244
401
|
chosen by the same palette place as the colour, so that a reader who does
|
|
245
402
|
not see the colours still tells them apart; the legend's chips show the
|
|
246
|
-
same. A caller's own `dash` wins over the place's.
|
|
403
|
+
same. A caller's own `dash` wins over the place's.
|
|
404
|
+
@default "color" */
|
|
247
405
|
encoding?: "color" | "marks";
|
|
248
406
|
/** Charts with the same id share the pointer's x position, in domain units:
|
|
249
407
|
each draws its crosshair there, the tooltip stays with the chart under
|
|
250
408
|
the pointer. Zoom is not shared - give every chart the same controlled
|
|
251
409
|
`domain`. */
|
|
252
410
|
syncId?: string;
|
|
253
|
-
/** Instrumentation for the benchmark page
|
|
411
|
+
/** Instrumentation for the benchmark page; not needed otherwise.
|
|
412
|
+
@remarks R-5.1 */
|
|
254
413
|
onPerf?: (perf: ChartPerf) => void;
|
|
255
414
|
/** The axes, series and companions of this chart. They draw nothing
|
|
256
|
-
themselves: each registers its configuration and the scene draws it
|
|
257
|
-
|
|
415
|
+
themselves: each registers its configuration and the scene draws it,
|
|
416
|
+
and the order in the JSX is the drawing order.
|
|
417
|
+
@remarks R-2.1 */
|
|
258
418
|
children?: ReactNode;
|
|
259
419
|
}
|
|
260
420
|
|
|
421
|
+
/** Everything the charts put out as text. */
|
|
261
422
|
export declare interface ChartsWording {
|
|
262
423
|
/** What a screen reader calls the plot area that takes the keys
|
|
263
424
|
(`aria-roledescription`). */
|
|
@@ -297,38 +458,30 @@ export declare interface ChartsWording {
|
|
|
297
458
|
rowColumn: string;
|
|
298
459
|
/** The table's caption: the visible stretch it lists, both ends formatted. */
|
|
299
460
|
tableCaption: (from: string, to: string) => string;
|
|
461
|
+
/** A box's numbers, top to bottom as drawn: the tooltip's rows, the
|
|
462
|
+
readout's parts and the data table's columns (box-plot B9). */
|
|
463
|
+
upperWhisker: string;
|
|
464
|
+
upperQuartile: string;
|
|
465
|
+
median: string;
|
|
466
|
+
lowerQuartile: string;
|
|
467
|
+
lowerWhisker: string;
|
|
468
|
+
/** A box's outliers: the row's name, and the row's value - their count and
|
|
469
|
+
the first few values, the rest counted (box-plot B9). */
|
|
470
|
+
outliers: string;
|
|
471
|
+
/** A box's optional readings: its mean, its notch's two bounds as one row,
|
|
472
|
+
and how many values stand behind it. */
|
|
473
|
+
mean: string;
|
|
474
|
+
notch: string;
|
|
475
|
+
count: string;
|
|
476
|
+
outlierList: (values: readonly string[], more: number) => string;
|
|
300
477
|
/** Added to the caption where the table shows the downsampled course (C2):
|
|
301
478
|
how many readings its rows stand for. */
|
|
302
479
|
downsampled: (readings: number) => string;
|
|
303
480
|
}
|
|
304
481
|
|
|
305
|
-
declare interface CommonProps {
|
|
306
|
-
/** Axis
|
|
307
|
-
|
|
308
|
-
axisId?: string;
|
|
309
|
-
/** Whether the value lies on the x or on the y axis. Without one, y: a limit
|
|
310
|
-
is nearly always a value and not a moment. */
|
|
311
|
-
orientation?: "x" | "y";
|
|
312
|
-
/** Two severities, not five: five urgencies are five colours, and five colours
|
|
313
|
-
on a dense screen are noise. */
|
|
314
|
-
severity?: Severity;
|
|
315
|
-
/** What the value means. A line at 90 does not say what 90 is. */
|
|
316
|
-
label?: string;
|
|
317
|
-
/** Any CSS colour value, in place of the one the severity yields. A colour
|
|
318
|
-
handed in instead of a severity puts the rule in the application and the
|
|
319
|
-
presentation in the library, and the two drift apart as soon as a bound
|
|
320
|
-
moves - so this is for the case that has no severity, not for taste. */
|
|
321
|
-
color?: string;
|
|
322
|
-
/** Whether the value widens the axis extent, so that the limit is certainly
|
|
323
|
-
visible. Default true; the head of this file says why. */
|
|
324
|
-
inExtent?: boolean;
|
|
325
|
-
/** A chosen specification limit (the default) or a calculated control limit.
|
|
326
|
-
They look different because they mean different things (ADR-0008). */
|
|
327
|
-
role?: LimitRole;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
declare interface CommonProps_2<T> {
|
|
331
|
-
/** Axis id, through which series bind themselves (R-4.12). */
|
|
482
|
+
declare interface CommonProps<T> {
|
|
483
|
+
/** Axis id, through which series bind themselves.
|
|
484
|
+
@remarks R-4.12 */
|
|
332
485
|
id?: string;
|
|
333
486
|
/** Value access of this axis. Compared by its source text, as a series'
|
|
334
487
|
accessor is (`Accessor`) - with the same closure limit. */
|
|
@@ -342,7 +495,9 @@ declare interface CommonProps_2<T> {
|
|
|
342
495
|
a new text or remount. A bound `Intl.NumberFormat#format` is compared by
|
|
343
496
|
identity. */
|
|
344
497
|
tickFormat?: (v: number) => string;
|
|
345
|
-
/** Grid lines
|
|
498
|
+
/** Grid lines.
|
|
499
|
+
@default only on the first axis of its orientation
|
|
500
|
+
@remarks R-4.15 */
|
|
346
501
|
grid?: boolean;
|
|
347
502
|
/** Fixed tick values instead of the 1-2-5 algorithm. For axes whose values are
|
|
348
503
|
places and not numbers: the lanes of a state stack, the categories of a
|
|
@@ -350,8 +505,13 @@ declare interface CommonProps_2<T> {
|
|
|
350
505
|
ticks?: readonly number[];
|
|
351
506
|
}
|
|
352
507
|
|
|
508
|
+
/** A control chart inside a `Chart`: the values as a line, the control limits
|
|
509
|
+
and zones computed from them, and the points that break a rule marked.
|
|
510
|
+
It draws nothing of its own - it composes `Line`, `LimitLine` and
|
|
511
|
+
`Scatter`, so that limits, zones and violations come from the same values. */
|
|
353
512
|
export declare function ControlChart<T>(props: ControlChartProps<T>): ReactNode;
|
|
354
513
|
|
|
514
|
+
/** The props of `ControlChart`. */
|
|
355
515
|
export declare interface ControlChartProps<T> {
|
|
356
516
|
/** The values of the chart. */
|
|
357
517
|
accessor: Accessor<T>;
|
|
@@ -361,18 +521,21 @@ export declare interface ControlChartProps<T> {
|
|
|
361
521
|
/** Given, or from a named reference window - never tacitly from everything on
|
|
362
522
|
the screen (ADR-0008). */
|
|
363
523
|
origin: ControlLimitOrigin;
|
|
364
|
-
/** Binding to an x axis
|
|
524
|
+
/** Binding to an x axis.
|
|
525
|
+
@remarks R-4.12 */
|
|
365
526
|
xAxisId?: string;
|
|
366
|
-
/** Binding to a y axis
|
|
527
|
+
/** Binding to a y axis.
|
|
528
|
+
@remarks R-4.12 */
|
|
367
529
|
yAxisId?: string;
|
|
368
|
-
/** The name in legend and tooltip. Without one
|
|
369
|
-
|
|
370
|
-
|
|
530
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
531
|
+
unnamed series is a colour nobody can look up.
|
|
532
|
+
@default "Series n", after its place in the chart */
|
|
371
533
|
name?: string;
|
|
372
|
-
/** The value as the tooltip writes it - on the line and on the violations
|
|
373
|
-
|
|
534
|
+
/** The value as the tooltip writes it - on the line and on the violations.
|
|
535
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
374
536
|
format?: (value: number) => string;
|
|
375
|
-
/** Any CSS colour value
|
|
537
|
+
/** Any CSS colour value.
|
|
538
|
+
@default the palette's `--uc-series-N` */
|
|
376
539
|
color?: string;
|
|
377
540
|
/** A role instead of a colour value for the line; the theme resolves it.
|
|
378
541
|
The violations are always "alarm". */
|
|
@@ -382,15 +545,18 @@ export declare interface ControlChartProps<T> {
|
|
|
382
545
|
/** The faint zone lines at one and two sigma. Rule 4 is about the two-sigma
|
|
383
546
|
zone; without them a reader cannot check it. */
|
|
384
547
|
zoneLines?: boolean;
|
|
385
|
-
/**
|
|
386
|
-
|
|
548
|
+
/** Label of the upper control limit in the axis band. The package brings no
|
|
549
|
+
text along, not even "UCL" and "LCL".
|
|
550
|
+
@default no label */
|
|
387
551
|
labelUpper?: string;
|
|
388
552
|
/** The same for the lower control limit. Named separately because a chart may
|
|
389
|
-
well want one of the two labelled and not the other.
|
|
553
|
+
well want one of the two labelled and not the other.
|
|
554
|
+
@default no label */
|
|
390
555
|
labelLower?: string;
|
|
391
|
-
/** Name of the scatter of violations in the legend and the tooltip. Without
|
|
392
|
-
|
|
393
|
-
|
|
556
|
+
/** Name of the scatter of violations in the legend and the tooltip. Without
|
|
557
|
+
one a legend warns once in DEV. Before this, a German suffix stood on the
|
|
558
|
+
name of the chart.
|
|
559
|
+
@default "Series n", after its place in the chart */
|
|
394
560
|
violationName?: string;
|
|
395
561
|
/** The violations as data - they can be listed beside the chart as well as
|
|
396
562
|
marked on it. */
|
|
@@ -429,6 +595,10 @@ export declare interface ControlLimits {
|
|
|
429
595
|
chart then draws no line instead of bursting. */
|
|
430
596
|
export declare function controlLimits(values: readonly number[], origin: ControlLimitOrigin): ControlLimits;
|
|
431
597
|
|
|
598
|
+
/** The chart's values as a table, on demand: a key - in the legend where
|
|
599
|
+
there is one - opens a table of what the chart shows, one column per
|
|
600
|
+
visible series, in the tooltip's format. For a reader who wants every value
|
|
601
|
+
at once. Place it inside a `Chart`. */
|
|
432
602
|
export declare function DataTable(): ReactNode;
|
|
433
603
|
|
|
434
604
|
/** One table of the data table: the series of one x axis, or one matrix. Every
|
|
@@ -441,8 +611,13 @@ export declare interface DataTableGroup {
|
|
|
441
611
|
rows: readonly (readonly string[])[];
|
|
442
612
|
}
|
|
443
613
|
|
|
614
|
+
/** One day of 24 hours in milliseconds; across a clock change a calendar day
|
|
615
|
+
is an hour longer or shorter. */
|
|
444
616
|
export declare const DAY: number;
|
|
445
617
|
|
|
618
|
+
/** The instance shipped by default. English; German is
|
|
619
|
+
`GERMAN_CHARTS_WORDING` in `@umriss-ui/charts/wording/de`. A chart takes
|
|
620
|
+
its own through `wording`. */
|
|
446
621
|
export declare const DEFAULT_CHARTS_WORDING: ChartsWording;
|
|
447
622
|
|
|
448
623
|
/** Default gradient: a sequential set, light to dark, so that it stays readable
|
|
@@ -455,21 +630,27 @@ export declare const DEFAULT_GRADIENT: readonly string[];
|
|
|
455
630
|
lengths are therefore parameters. */
|
|
456
631
|
export declare const defaultRules: RuleOptions;
|
|
457
632
|
|
|
633
|
+
/** One hour in milliseconds. */
|
|
458
634
|
export declare const HOUR: number;
|
|
459
635
|
|
|
460
636
|
/** Explicit invalidation: devalue the cache, every living chart reads anew and
|
|
461
637
|
redraws. */
|
|
462
638
|
export declare function invalidateTheme(): void;
|
|
463
639
|
|
|
640
|
+
/** The legend of a chart: one entry per series, or per state of a state band.
|
|
641
|
+
Hovering an entry highlights its series; with `onToggle` a click hides and
|
|
642
|
+
shows it. */
|
|
464
643
|
export declare function Legend({ placement, onToggle }: LegendProps): ReactNode;
|
|
465
644
|
|
|
645
|
+
/** A `Legend` as the chart holds it once registered. */
|
|
466
646
|
export declare interface LegendConfig {
|
|
467
647
|
placement: "top" | "bottom";
|
|
468
648
|
}
|
|
469
649
|
|
|
650
|
+
/** The props of `Legend`. */
|
|
470
651
|
export declare interface LegendProps {
|
|
471
|
-
/** Which side of the plot area the legend stands on.
|
|
472
|
-
|
|
652
|
+
/** Which side of the plot area the legend stands on.
|
|
653
|
+
@default "top" */
|
|
473
654
|
placement?: "top" | "bottom";
|
|
474
655
|
/** Called with an entry's name when it is clicked - the series' name, or a
|
|
475
656
|
state's label. The caller flips `hidden` on the series it means. Without
|
|
@@ -487,15 +668,21 @@ export declare interface Limit {
|
|
|
487
668
|
severity: Severity;
|
|
488
669
|
}
|
|
489
670
|
|
|
671
|
+
/** A limit drawn as a band between two values of an axis - a tolerance or a
|
|
672
|
+
zone. Otherwise a `LimitLine`. */
|
|
490
673
|
export declare function LimitBand(props: LimitBandProps): null;
|
|
491
674
|
|
|
675
|
+
/** A `LimitBand` as the chart holds it once registered: the range from `from`
|
|
676
|
+
to `to`. */
|
|
492
677
|
export declare interface LimitBandConfig extends LimitBase {
|
|
493
678
|
kind: "band";
|
|
494
679
|
from: number;
|
|
495
680
|
to: number;
|
|
496
681
|
}
|
|
497
682
|
|
|
498
|
-
|
|
683
|
+
/** The props of `LimitBand`: a `LimitLine`'s, with a range in place of
|
|
684
|
+
`value`. */
|
|
685
|
+
export declare interface LimitBandProps extends LimitCommonProps {
|
|
499
686
|
/** Lower edge of the band, in domain units of its axis. */
|
|
500
687
|
from: number;
|
|
501
688
|
/** Upper edge, in domain units of its axis. A band drawn backwards (`from` above `to`) is drawn between
|
|
@@ -520,16 +707,54 @@ declare interface LimitBase {
|
|
|
520
707
|
inExtent: boolean;
|
|
521
708
|
}
|
|
522
709
|
|
|
710
|
+
declare interface LimitCommonProps {
|
|
711
|
+
/** Axis on which the value lies.
|
|
712
|
+
@default the first axis of the orientation */
|
|
713
|
+
axisId?: string;
|
|
714
|
+
/** Whether the value lies on the x or on the y axis - a limit is nearly
|
|
715
|
+
always a value and not a moment.
|
|
716
|
+
@default "y" */
|
|
717
|
+
orientation?: "x" | "y";
|
|
718
|
+
/** Two severities, not five: five urgencies are five colours, and five colours
|
|
719
|
+
on a dense screen are noise. */
|
|
720
|
+
severity?: Severity;
|
|
721
|
+
/** What the value means. A line at 90 does not say what 90 is. */
|
|
722
|
+
label?: string;
|
|
723
|
+
/** Any CSS colour value, in place of the one the severity yields. A colour
|
|
724
|
+
handed in instead of a severity puts the rule in the application and the
|
|
725
|
+
presentation in the library, and the two drift apart as soon as a bound
|
|
726
|
+
moves - so this is for the case that has no severity, not for taste.
|
|
727
|
+
The line or band takes it; its label keeps the axis's text colour, which
|
|
728
|
+
stays legible in both themes, and a short stroke before the text in the
|
|
729
|
+
line's pattern takes this colour. */
|
|
730
|
+
color?: string;
|
|
731
|
+
/** Whether the value widens the axis extent, so that the limit is certainly
|
|
732
|
+
visible.
|
|
733
|
+
@default true */
|
|
734
|
+
inExtent?: boolean;
|
|
735
|
+
/** A chosen specification limit or a calculated control limit. They look
|
|
736
|
+
different because they mean different things (ADR-0008).
|
|
737
|
+
@default "specification" */
|
|
738
|
+
role?: LimitRole;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/** Any registered limit, a line or a band, told apart by `kind`. */
|
|
523
742
|
export declare type LimitConfig = LimitLineConfig | LimitBandConfig;
|
|
524
743
|
|
|
744
|
+
/** A limit drawn as a line across the plot at one value of an axis - a
|
|
745
|
+
specification limit, or with `role` a control limit. Not a series: no data,
|
|
746
|
+
no legend entry, no hit. By default it widens its axis so that it is
|
|
747
|
+
always seen. */
|
|
525
748
|
export declare function LimitLine(props: LimitLineProps): null;
|
|
526
749
|
|
|
750
|
+
/** A `LimitLine` as the chart holds it once registered. */
|
|
527
751
|
export declare interface LimitLineConfig extends LimitBase {
|
|
528
752
|
kind: "line";
|
|
529
753
|
value: number;
|
|
530
754
|
}
|
|
531
755
|
|
|
532
|
-
|
|
756
|
+
/** The props of `LimitLine`. */
|
|
757
|
+
export declare interface LimitLineProps extends LimitCommonProps {
|
|
533
758
|
/** Where the line lies, in domain units of its axis. */
|
|
534
759
|
value: number;
|
|
535
760
|
}
|
|
@@ -554,8 +779,12 @@ export declare interface LimitSet {
|
|
|
554
779
|
target?: number;
|
|
555
780
|
}
|
|
556
781
|
|
|
782
|
+
/** A series drawn as a line through its values; a gap breaks it. Renders
|
|
783
|
+
nothing itself: it registers with the surrounding `Chart`. */
|
|
557
784
|
export declare function Line<T>(props: LineProps<T>): null;
|
|
558
785
|
|
|
786
|
+
/** The affine mapping from a domain onto a pixel range, and back; the scale
|
|
787
|
+
every axis of the library uses. */
|
|
559
788
|
export declare class LinearScale implements Scale {
|
|
560
789
|
readonly domain: readonly [number, number];
|
|
561
790
|
readonly range: readonly [number, number];
|
|
@@ -568,33 +797,40 @@ export declare class LinearScale implements Scale {
|
|
|
568
797
|
ticks(n: number): number[];
|
|
569
798
|
}
|
|
570
799
|
|
|
800
|
+
/** The props of `Line`. */
|
|
571
801
|
export declare interface LineProps<T> {
|
|
572
|
-
/** Y value; null/undefined/NaN/±Infinity means a gap
|
|
802
|
+
/** Y value; null/undefined/NaN/±Infinity means a gap.
|
|
803
|
+
@remarks R-2.5 */
|
|
573
804
|
accessor: Accessor<T>;
|
|
574
|
-
/** Binding to an x axis
|
|
805
|
+
/** Binding to an x axis.
|
|
806
|
+
@remarks R-4.12 */
|
|
575
807
|
xAxisId?: string;
|
|
576
|
-
/** Binding to a y axis
|
|
808
|
+
/** Binding to a y axis.
|
|
809
|
+
@remarks R-4.12 */
|
|
577
810
|
yAxisId?: string;
|
|
578
|
-
/** Series-own data; overrides the container data
|
|
811
|
+
/** Series-own data; overrides the container data.
|
|
812
|
+
@remarks R-2.4 */
|
|
579
813
|
data?: readonly T[];
|
|
580
|
-
/** The name in legend and tooltip. Without one
|
|
581
|
-
|
|
582
|
-
|
|
814
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
815
|
+
unnamed series is a colour nobody can look up.
|
|
816
|
+
@default "Series n", after its place in the chart */
|
|
583
817
|
name?: string;
|
|
584
818
|
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
585
819
|
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
586
820
|
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
587
821
|
hidden?: boolean;
|
|
588
|
-
/** The value as the tooltip writes it
|
|
589
|
-
|
|
822
|
+
/** The value as the tooltip writes it.
|
|
823
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
590
824
|
format?: (value: number) => string;
|
|
591
|
-
/** Any CSS colour value
|
|
825
|
+
/** Any CSS colour value.
|
|
826
|
+
@default the palette's `--uc-series-N` */
|
|
592
827
|
color?: string;
|
|
593
828
|
/** A role instead of a colour value; the theme resolves it. */
|
|
594
829
|
tone?: "ok" | "warning" | "alarm";
|
|
595
830
|
/** Line width in CSS pixels. */
|
|
596
831
|
strokeWidth?: number;
|
|
597
|
-
/** Dash pattern as a run of lengths in CSS pixels
|
|
832
|
+
/** Dash pattern as a run of lengths in CSS pixels.
|
|
833
|
+
@default a solid line */
|
|
598
834
|
dash?: readonly number[];
|
|
599
835
|
/** When the individual points are drawn as marks: `auto` every point up to
|
|
600
836
|
60 points and above that only a point between two gaps - it has no line
|
|
@@ -606,6 +842,7 @@ export declare interface LineProps<T> {
|
|
|
606
842
|
step?: boolean;
|
|
607
843
|
}
|
|
608
844
|
|
|
845
|
+
/** A `Line` as the chart holds it once registered. */
|
|
609
846
|
export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
610
847
|
kind: "line";
|
|
611
848
|
strokeWidth: number;
|
|
@@ -615,6 +852,10 @@ export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
|
615
852
|
step?: boolean;
|
|
616
853
|
}
|
|
617
854
|
|
|
855
|
+
/** A list per datum - a box's outliers (ADR-0040). null/undefined or an
|
|
856
|
+
empty array is none; a value that is not finite is left out. */
|
|
857
|
+
export declare type ListAccessor<T> = (d: T, index: number) => readonly number[] | null | undefined;
|
|
858
|
+
|
|
618
859
|
/** The local offset at an instant, as the shift of a grid that is to lie on
|
|
619
860
|
local time: `wallClock = offset + k · step`. Taken at one instant, it holds
|
|
620
861
|
for a grid up to the next clock change. */
|
|
@@ -624,23 +865,31 @@ export declare function localOffset(instant: number): number;
|
|
|
624
865
|
go it in one piece. Only the first n values are touched. */
|
|
625
866
|
export declare function mapSeries(input: CalendarInput, source: Float64Array, n: number, target: Float64Array): void;
|
|
626
867
|
|
|
627
|
-
/** Materialised series: the draw loop works only on this
|
|
628
|
-
Gaps (null/undefined/NaN/±Infinity out of the accessor) are encoded as NaN
|
|
629
|
-
|
|
868
|
+
/** Materialised series: the draw loop works only on this.
|
|
869
|
+
Gaps (null/undefined/NaN/±Infinity out of the accessor) are encoded as NaN.
|
|
870
|
+
@remarks R-2.7, R-2.5 */
|
|
630
871
|
export declare interface MaterializedSeries {
|
|
631
872
|
x: Float64Array;
|
|
632
873
|
y: Float64Array;
|
|
633
874
|
/** Lower edge, where the baseline is an accessor of its own; otherwise null.
|
|
634
|
-
A fixed baseline needs no channel - it is a number
|
|
875
|
+
A fixed baseline needs no channel - it is a number.
|
|
876
|
+
@remarks R-2.7 */
|
|
635
877
|
y0: Float64Array | null;
|
|
636
878
|
/** Value channel: the third value per point, which today only the matrix
|
|
637
879
|
needs. Named rather than overloading y0 - a property that only some kinds
|
|
638
880
|
carry does not belong in the shared type with a comment (ADR-0011). null
|
|
639
881
|
for every kind that does not use it. */
|
|
640
882
|
w: Float64Array | null;
|
|
883
|
+
/** A box's further numbers beside its median in y; null for every other
|
|
884
|
+
kind (ADR-0011). */
|
|
885
|
+
box: BoxChannels | null;
|
|
641
886
|
length: number;
|
|
642
887
|
}
|
|
643
888
|
|
|
889
|
+
/** A series drawn as a grid of coloured cells: the accessor gives the row,
|
|
890
|
+
`value` the colour - by the limits of an assessment or across a gradient.
|
|
891
|
+
A missing value is a hole, not a zero. Renders nothing itself: it registers
|
|
892
|
+
with the surrounding `Chart`. */
|
|
644
893
|
export declare function Matrix<T>(props: MatrixProps<T>): null;
|
|
645
894
|
|
|
646
895
|
/** How a matrix colours its cells. Discretely by assessment - the same limits
|
|
@@ -656,36 +905,46 @@ export declare type MatrixColoring = {
|
|
|
656
905
|
package does not have and is not to get (ADR-0011). Whoever wants a
|
|
657
906
|
finer gradation names more colours. */
|
|
658
907
|
stops: readonly string[];
|
|
659
|
-
/** Value range of the gradient
|
|
908
|
+
/** Value range of the gradient.
|
|
909
|
+
@default the range of the data */
|
|
660
910
|
range?: readonly [number, number];
|
|
661
911
|
};
|
|
662
912
|
|
|
913
|
+
/** The props of `Matrix`. */
|
|
663
914
|
export declare interface MatrixProps<T> {
|
|
664
915
|
/** Row position on the y axis. */
|
|
665
916
|
accessor: Accessor<T>;
|
|
666
917
|
/** The value that decides the colour. */
|
|
667
918
|
value: Accessor<T>;
|
|
668
|
-
/**
|
|
919
|
+
/** How the value colours a cell: by assessment against limits, or across
|
|
920
|
+
a gradient.
|
|
921
|
+
@default { kind: "gradient", stops: DEFAULT_GRADIENT } */
|
|
669
922
|
coloring?: MatrixColoring;
|
|
670
|
-
/** Binding to an x axis
|
|
923
|
+
/** Binding to an x axis.
|
|
924
|
+
@remarks R-4.12 */
|
|
671
925
|
xAxisId?: string;
|
|
672
|
-
/** Binding to a y axis
|
|
926
|
+
/** Binding to a y axis.
|
|
927
|
+
@remarks R-4.12 */
|
|
673
928
|
yAxisId?: string;
|
|
674
|
-
/** Series-own data; overrides the container data
|
|
929
|
+
/** Series-own data; overrides the container data.
|
|
930
|
+
@remarks R-2.4 */
|
|
675
931
|
data?: readonly T[];
|
|
676
|
-
/** The name in legend and tooltip. Without one
|
|
677
|
-
|
|
678
|
-
|
|
932
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
933
|
+
unnamed series is a colour nobody can look up.
|
|
934
|
+
@default "Series n", after its place in the chart */
|
|
679
935
|
name?: string;
|
|
680
936
|
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
681
937
|
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
682
938
|
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
683
939
|
hidden?: boolean;
|
|
684
|
-
/** The value as the tooltip writes it
|
|
685
|
-
|
|
940
|
+
/** The value as the tooltip writes it. The y axis' `tickFormat` writes the
|
|
941
|
+
row, not the value.
|
|
942
|
+
@default the built-in number format */
|
|
686
943
|
format?: (value: number) => string;
|
|
687
944
|
}
|
|
688
945
|
|
|
946
|
+
/** A `Matrix` as the chart holds it once registered: its base accessor is the
|
|
947
|
+
row, `value` the colour. */
|
|
689
948
|
export declare interface MatrixSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
690
949
|
kind: "matrix";
|
|
691
950
|
/** The value that decides the colour - the third channel (ADR-0011).
|
|
@@ -694,8 +953,10 @@ export declare interface MatrixSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
|
694
953
|
coloring: MatrixColoring;
|
|
695
954
|
}
|
|
696
955
|
|
|
956
|
+
/** One minute in milliseconds. */
|
|
697
957
|
export declare const MINUTE: number;
|
|
698
958
|
|
|
959
|
+
/** Space in CSS pixels on each side of a rectangle. */
|
|
699
960
|
export declare interface Padding {
|
|
700
961
|
top: number;
|
|
701
962
|
right: number;
|
|
@@ -716,6 +977,8 @@ export declare interface Padding {
|
|
|
716
977
|
which is the third biggest problem. */
|
|
717
978
|
export declare function pareto(items: readonly ParetoItem[], options?: ParetoSettings): ParetoResult;
|
|
718
979
|
|
|
980
|
+
/** What `pareto` assumes where a call says nothing: a cutoff of 80 %, and no
|
|
981
|
+
collecting of the tail. */
|
|
719
982
|
export declare const paretoDefaults: Omit<ParetoOptions, "remainderName">;
|
|
720
983
|
|
|
721
984
|
/** An item, the way it is drawn. */
|
|
@@ -741,23 +1004,28 @@ export declare interface ParetoItem {
|
|
|
741
1004
|
readonly value: number;
|
|
742
1005
|
}
|
|
743
1006
|
|
|
1007
|
+
/** The settings of `pareto`, complete; a call gives `ParetoSettings`. */
|
|
744
1008
|
export declare interface ParetoOptions {
|
|
745
1009
|
/** The share whose crossing is sought. Whoever lands exactly on it counts as
|
|
746
1010
|
the crossing: the question is "which reasons make up eighty per cent", and
|
|
747
|
-
whoever reaches eighty exactly belongs to them.
|
|
1011
|
+
whoever reaches eighty exactly belongs to them.
|
|
1012
|
+
@default 0.8 */
|
|
748
1013
|
readonly cutoff: number;
|
|
749
1014
|
/** How many items stay on their own. Everything behind that becomes a single
|
|
750
1015
|
entry. Beyond the number of items no remainder arises at all - not an empty
|
|
751
|
-
one.
|
|
1016
|
+
one.
|
|
1017
|
+
@default Infinity */
|
|
752
1018
|
readonly collectRank: number;
|
|
753
1019
|
/** Name of the collected remainder. `@umriss-ui/charts` has no wording module
|
|
754
1020
|
- every string it draws comes from the caller - and no module is introduced
|
|
755
|
-
for a single label.
|
|
756
|
-
|
|
757
|
-
|
|
1021
|
+
for a single label. Until library-audit 03 the name here was
|
|
1022
|
+
"Sonstige", the one German word the package brought along itself.
|
|
1023
|
+
@default none - the caller names it */
|
|
758
1024
|
readonly remainderName?: string;
|
|
759
1025
|
}
|
|
760
1026
|
|
|
1027
|
+
/** What `pareto` returns: the entries as they are drawn, their total and
|
|
1028
|
+
where the cutoff is crossed. */
|
|
761
1029
|
export declare interface ParetoResult {
|
|
762
1030
|
readonly entries: readonly ParetoEntry[];
|
|
763
1031
|
/** Total of the drawn entries - after collecting, the same as before. */
|
|
@@ -779,6 +1047,7 @@ export declare type ParetoSettings = {
|
|
|
779
1047
|
readonly remainderName: string;
|
|
780
1048
|
});
|
|
781
1049
|
|
|
1050
|
+
/** A rectangle in CSS pixels, from its top left corner. */
|
|
782
1051
|
export declare interface Rect {
|
|
783
1052
|
x: number;
|
|
784
1053
|
y: number;
|
|
@@ -811,6 +1080,8 @@ export declare interface RemovedSpan {
|
|
|
811
1080
|
without a style engine), a colour is given back as it stands. */
|
|
812
1081
|
export declare function resolveColours<K extends string>(root: Element, colours: Readonly<Record<K, string>>): Record<K, string>;
|
|
813
1082
|
|
|
1083
|
+
/** A chart's colours and fonts, resolved from the `--uc-*` tokens where the
|
|
1084
|
+
chart stands. */
|
|
814
1085
|
export declare interface ResolvedTheme {
|
|
815
1086
|
colorAxis: string;
|
|
816
1087
|
colorGrid: string;
|
|
@@ -867,6 +1138,8 @@ export declare function ruleTrend(values: readonly number[], length?: number): n
|
|
|
867
1138
|
that one is unremarkable and, marked, would look like a measurement error. */
|
|
868
1139
|
export declare function ruleTwoOfThree(values: readonly number[], limits: ControlLimits): number[];
|
|
869
1140
|
|
|
1141
|
+
/** The mapping of an axis' values onto pixels and back, with its ticks. Every
|
|
1142
|
+
scale of the library is affine; `LinearScale` implements it. */
|
|
870
1143
|
export declare interface Scale {
|
|
871
1144
|
domain: readonly [number, number];
|
|
872
1145
|
range: readonly [number, number];
|
|
@@ -884,29 +1157,37 @@ export declare interface Scale {
|
|
|
884
1157
|
ticks(n: number): number[];
|
|
885
1158
|
}
|
|
886
1159
|
|
|
1160
|
+
/** A series drawn as points only, one per value. Renders nothing itself: it
|
|
1161
|
+
registers with the surrounding `Chart`. */
|
|
887
1162
|
export declare function Scatter<T>(props: ScatterProps<T>): null;
|
|
888
1163
|
|
|
1164
|
+
/** The props of `Scatter`. */
|
|
889
1165
|
export declare interface ScatterProps<T> {
|
|
890
|
-
/** Y value; null/undefined/NaN/±Infinity means a gap
|
|
1166
|
+
/** Y value; null/undefined/NaN/±Infinity means a gap.
|
|
1167
|
+
@remarks R-2.5 */
|
|
891
1168
|
accessor: Accessor<T>;
|
|
892
|
-
/** Binding to an x axis
|
|
1169
|
+
/** Binding to an x axis.
|
|
1170
|
+
@remarks R-4.12 */
|
|
893
1171
|
xAxisId?: string;
|
|
894
|
-
/** Binding to a y axis
|
|
1172
|
+
/** Binding to a y axis.
|
|
1173
|
+
@remarks R-4.12 */
|
|
895
1174
|
yAxisId?: string;
|
|
896
|
-
/** Series-own data; overrides the container data
|
|
1175
|
+
/** Series-own data; overrides the container data.
|
|
1176
|
+
@remarks R-2.4 */
|
|
897
1177
|
data?: readonly T[];
|
|
898
|
-
/** The name in legend and tooltip. Without one
|
|
899
|
-
|
|
900
|
-
|
|
1178
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
1179
|
+
unnamed series is a colour nobody can look up.
|
|
1180
|
+
@default "Series n", after its place in the chart */
|
|
901
1181
|
name?: string;
|
|
902
1182
|
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
903
1183
|
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
904
1184
|
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
905
1185
|
hidden?: boolean;
|
|
906
|
-
/** The value as the tooltip writes it
|
|
907
|
-
|
|
1186
|
+
/** The value as the tooltip writes it.
|
|
1187
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
908
1188
|
format?: (value: number) => string;
|
|
909
|
-
/** Any CSS colour value
|
|
1189
|
+
/** Any CSS colour value.
|
|
1190
|
+
@default the palette's `--uc-series-N` */
|
|
910
1191
|
color?: string;
|
|
911
1192
|
/** A role instead of a colour value; the theme resolves it. */
|
|
912
1193
|
tone?: "ok" | "warning" | "alarm";
|
|
@@ -914,18 +1195,24 @@ export declare interface ScatterProps<T> {
|
|
|
914
1195
|
radius?: number;
|
|
915
1196
|
}
|
|
916
1197
|
|
|
1198
|
+
/** A `Scatter` as the chart holds it once registered. */
|
|
917
1199
|
export declare interface ScatterSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
918
1200
|
kind: "scatter";
|
|
919
1201
|
/** Point radius in CSS pixels. */
|
|
920
1202
|
radius: number;
|
|
921
1203
|
}
|
|
922
1204
|
|
|
1205
|
+
/** One second in milliseconds, the unit of a time axis. */
|
|
923
1206
|
export declare const SECOND = 1000;
|
|
924
1207
|
|
|
1208
|
+
/** What every series registers, whatever its kind: where its values come from,
|
|
1209
|
+
which axes it stands on, and how it is named and coloured. */
|
|
925
1210
|
export declare interface SeriesBase<T = unknown> {
|
|
926
|
-
/** Y value; null/undefined/NaN/±Infinity means a gap
|
|
1211
|
+
/** Y value; null/undefined/NaN/±Infinity means a gap.
|
|
1212
|
+
@remarks R-2.5 */
|
|
927
1213
|
accessor: Accessor<T>;
|
|
928
|
-
/** Series-own data; overrides the container data
|
|
1214
|
+
/** Series-own data; overrides the container data.
|
|
1215
|
+
@remarks R-2.4 */
|
|
929
1216
|
data?: readonly T[];
|
|
930
1217
|
xAxisId: string;
|
|
931
1218
|
yAxisId: string;
|
|
@@ -942,8 +1229,11 @@ export declare interface SeriesBase<T = unknown> {
|
|
|
942
1229
|
hidden?: boolean;
|
|
943
1230
|
}
|
|
944
1231
|
|
|
945
|
-
|
|
1232
|
+
/** Any registered series, told apart by `kind`. */
|
|
1233
|
+
export declare type SeriesConfig<T = unknown> = LineSeriesConfig<T> | AreaSeriesConfig<T> | BarSeriesConfig<T> | BoxSeriesConfig<T> | ScatterSeriesConfig<T> | StateSeriesConfig<T> | MatrixSeriesConfig<T>;
|
|
946
1234
|
|
|
1235
|
+
/** The kinds of series a chart draws: `line`, `area`, `bar`, `box`, `scatter`,
|
|
1236
|
+
`state` and `matrix`. The set is closed. */
|
|
947
1237
|
export declare type SeriesKind = SeriesConfig["kind"];
|
|
948
1238
|
|
|
949
1239
|
/** How seriously a violation weighs. Exactly two: one severity that advises and
|
|
@@ -976,6 +1266,7 @@ declare interface Stackable {
|
|
|
976
1266
|
reported, not until the axis' rounded end. */
|
|
977
1267
|
export declare function StateBand<T>(props: StateBandProps<T>): null;
|
|
978
1268
|
|
|
1269
|
+
/** The props of `StateBand`. */
|
|
979
1270
|
export declare interface StateBandProps<T> {
|
|
980
1271
|
/** Index of the state in `states`; null/undefined/NaN/±Infinity is a gap -
|
|
981
1272
|
and a gap stays a hole, it gets no colour for "unknown". A colour would
|
|
@@ -983,15 +1274,18 @@ export declare interface StateBandProps<T> {
|
|
|
983
1274
|
accessor: Accessor<T>;
|
|
984
1275
|
/** The closed set of states, in the order of their codes. */
|
|
985
1276
|
states: readonly StateEntry[];
|
|
986
|
-
/** Binding to an x axis
|
|
1277
|
+
/** Binding to an x axis.
|
|
1278
|
+
@remarks R-4.12 */
|
|
987
1279
|
xAxisId?: string;
|
|
988
|
-
/** Binding to a y axis
|
|
1280
|
+
/** Binding to a y axis.
|
|
1281
|
+
@remarks R-4.12 */
|
|
989
1282
|
yAxisId?: string;
|
|
990
|
-
/** Series-own data; overrides the container data
|
|
1283
|
+
/** Series-own data; overrides the container data.
|
|
1284
|
+
@remarks R-2.4 */
|
|
991
1285
|
data?: readonly T[];
|
|
992
|
-
/** The name in legend and tooltip. Without one
|
|
993
|
-
|
|
994
|
-
|
|
1286
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
1287
|
+
unnamed series is a colour nobody can look up.
|
|
1288
|
+
@default "Series n", after its place in the chart */
|
|
995
1289
|
name?: string;
|
|
996
1290
|
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
997
1291
|
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
@@ -1009,6 +1303,8 @@ export declare interface StateEntry {
|
|
|
1009
1303
|
color: string;
|
|
1010
1304
|
}
|
|
1011
1305
|
|
|
1306
|
+
/** A `StateBand` as the chart holds it once registered: its accessor yields
|
|
1307
|
+
an index into `states`. */
|
|
1012
1308
|
export declare interface StateSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
1013
1309
|
kind: "state";
|
|
1014
1310
|
/** The closed set of states. The accessor yields the index into it - a number,
|
|
@@ -1032,13 +1328,19 @@ export declare function subscribeTheme(notify: () => void): () => void;
|
|
|
1032
1328
|
day steps it continues in whole days. */
|
|
1033
1329
|
export declare function timeStep(span: number, count: number): number;
|
|
1034
1330
|
|
|
1331
|
+
/** Turns on the pointer's interaction with a chart: crosshair, hover markers
|
|
1332
|
+
and the tooltip, built in or from `render`. Without it the chart does not
|
|
1333
|
+
answer the pointer. */
|
|
1035
1334
|
export declare function Tooltip<T>(props: TooltipProps<T>): null;
|
|
1036
1335
|
|
|
1336
|
+
/** A `Tooltip` as the chart holds it once registered. */
|
|
1037
1337
|
export declare interface TooltipConfig<T = unknown> {
|
|
1038
1338
|
mode: "x" | "nearest";
|
|
1039
1339
|
render?: (hit: TooltipHit<T>) => ReactNode;
|
|
1040
1340
|
}
|
|
1041
1341
|
|
|
1342
|
+
/** What the pointer hit: the x value under it and one point per series there.
|
|
1343
|
+
A custom tooltip's `render` receives it. */
|
|
1042
1344
|
export declare interface TooltipHit<T = unknown> {
|
|
1043
1345
|
xValue: number;
|
|
1044
1346
|
points: readonly TooltipPoint<T>[];
|
|
@@ -1048,7 +1350,8 @@ export declare interface TooltipHit<T = unknown> {
|
|
|
1048
1350
|
yPx: number;
|
|
1049
1351
|
}
|
|
1050
1352
|
|
|
1051
|
-
/** One hit per series in the tooltip
|
|
1353
|
+
/** One hit per series in the tooltip.
|
|
1354
|
+
@remarks R-4.4 */
|
|
1052
1355
|
export declare interface TooltipPoint<T = unknown> {
|
|
1053
1356
|
seriesName: string;
|
|
1054
1357
|
color: string;
|
|
@@ -1074,14 +1377,21 @@ export declare interface TooltipPoint<T = unknown> {
|
|
|
1074
1377
|
to: number;
|
|
1075
1378
|
label: string;
|
|
1076
1379
|
};
|
|
1380
|
+
/** Only for a box: its further numbers; yValue is its median. Fields of
|
|
1381
|
+
their own for the reason `value` has one (ADR-0011). */
|
|
1382
|
+
box?: BoxNumbers & Partial<BoxExtras> & {
|
|
1383
|
+
/** As the caller gave them; only where the series has `outliers`. */
|
|
1384
|
+
outliers?: readonly number[];
|
|
1385
|
+
};
|
|
1077
1386
|
}
|
|
1078
1387
|
|
|
1388
|
+
/** The props of `Tooltip`. */
|
|
1079
1389
|
export declare interface TooltipProps<T> {
|
|
1080
1390
|
/** "x": every series at the x position; "nearest": only the nearest point. */
|
|
1081
1391
|
mode?: "x" | "nearest";
|
|
1082
|
-
/** Render prop for content of one's own
|
|
1083
|
-
|
|
1084
|
-
|
|
1392
|
+
/** Render prop for content of one's own. Compared by its source text, like
|
|
1393
|
+
`tickFormat` - with the same closure limit.
|
|
1394
|
+
@default the built-in tooltip */
|
|
1085
1395
|
render?: (hit: TooltipHit<T>) => ReactNode;
|
|
1086
1396
|
}
|
|
1087
1397
|
|
|
@@ -1212,9 +1522,13 @@ export declare interface WorkingTimeTick {
|
|
|
1212
1522
|
place the tick, the wall clock time to label it. */
|
|
1213
1523
|
export declare function workingTimeTicks(input: CalendarInput, from: number, to: number, step: number, offset?: number): WorkingTimeTick[];
|
|
1214
1524
|
|
|
1525
|
+
/** A horizontal axis: where a datum lies along x, its ticks, title and grid.
|
|
1526
|
+
A chart may have several; series bind to one by its `id`. With `time` or a
|
|
1527
|
+
`calendar` it reads instants, with `onDomainChange` it zooms. */
|
|
1215
1528
|
export declare function XAxis<T>(props: XAxisProps<T>): null;
|
|
1216
1529
|
|
|
1217
|
-
|
|
1530
|
+
/** The props of `XAxis`. */
|
|
1531
|
+
export declare interface XAxisProps<T> extends CommonProps<T> {
|
|
1218
1532
|
/** `"nice"` widens the data's extent to ticks - to named `ticks` where
|
|
1219
1533
|
there are any, on a time axis to whole units of a step of hours or
|
|
1220
1534
|
longer -, `"data"` keeps it, a pair is fixed - the one a zoom passes
|
|
@@ -1245,9 +1559,12 @@ export declare interface XAxisProps<T> extends CommonProps_2<T> {
|
|
|
1245
1559
|
onDomainChange?: (domain: [number, number]) => void;
|
|
1246
1560
|
}
|
|
1247
1561
|
|
|
1562
|
+
/** A vertical axis: the scale series draw their values on, its ticks, title
|
|
1563
|
+
and grid. A chart may have several; series bind to one by its `id`. */
|
|
1248
1564
|
export declare function YAxis<T>(props: YAxisProps<T>): null;
|
|
1249
1565
|
|
|
1250
|
-
|
|
1566
|
+
/** The props of `YAxis`. */
|
|
1567
|
+
export declare interface YAxisProps<T> extends CommonProps<T> {
|
|
1251
1568
|
/** As on the x axis, and `"visible"`: what the series show inside their x
|
|
1252
1569
|
axis' domain - a zoomed hour gets the hour's range, not the week's -,
|
|
1253
1570
|
widened to ticks as `"nice"` is. Where the x domain is not fixed that is
|