@umriss-ui/charts 0.9.0 → 0.11.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 +193 -1
- package/README.md +27 -9
- package/dist/charts.css +1 -1
- package/dist/charts.js +2754 -2476
- package/dist/de.d.ts +11 -0
- package/dist/index.d.ts +527 -276
- package/dist/wording/de.d.ts +2 -0
- package/dist/wording/de.js +11 -8
- package/docs/llms-full.md +10172 -4188
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
inline accessor is new on every render. Known limit: one that reads a
|
|
6
|
-
changed closure variable under the same text is not run again; pass a new
|
|
7
|
-
data reference then. A native or bound function is compared by identity. */
|
|
8
|
-
export declare type Accessor<T> = (d: T, index: number) => number | null | undefined;
|
|
9
|
-
|
|
10
|
-
export declare function Area<T>(props: AreaProps<T>): null;
|
|
11
|
-
|
|
4
|
+
/** The props of `Area`. */
|
|
12
5
|
export declare interface AreaProps<T> {
|
|
13
|
-
/** Upper edge
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
/** Upper edge - a number field of the row or a function of it;
|
|
7
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
8
|
+
@remarks R-2.5 */
|
|
9
|
+
value: Value<T>;
|
|
10
|
+
/** Lower edge - a number field of the row or a function of it. In a `stack` the stack below is the lower edge, and this is
|
|
11
|
+
not read.
|
|
12
|
+
@default a fixed baseline at 0 */
|
|
13
|
+
baseline?: Value<T>;
|
|
14
|
+
/** Binding to an x axis.
|
|
15
|
+
@remarks R-4.12 */
|
|
19
16
|
xAxisId?: string;
|
|
20
|
-
/** Binding to a y axis
|
|
17
|
+
/** Binding to a y axis.
|
|
18
|
+
@remarks R-4.12 */
|
|
21
19
|
yAxisId?: string;
|
|
22
|
-
/** Series-own data; overrides the container data
|
|
20
|
+
/** Series-own data; overrides the container data.
|
|
21
|
+
@remarks R-2.4 */
|
|
23
22
|
data?: readonly T[];
|
|
24
|
-
/** The name in legend and tooltip. Without one
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
24
|
+
unnamed series is a colour nobody can look up.
|
|
25
|
+
@default "Series n", after its place in the chart */
|
|
27
26
|
name?: string;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
31
|
-
hidden?: boolean;
|
|
32
|
-
/** The value as the tooltip writes it; without one the y axis' `tickFormat`,
|
|
33
|
-
then the default. */
|
|
27
|
+
/** The value as the tooltip writes it.
|
|
28
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
34
29
|
format?: (value: number) => string;
|
|
35
|
-
/** Any CSS colour value
|
|
30
|
+
/** Any CSS colour value.
|
|
31
|
+
@default the palette's `--uc-series-N` */
|
|
36
32
|
color?: string;
|
|
37
33
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
38
34
|
it. */
|
|
@@ -52,15 +48,17 @@ export declare interface AreaProps<T> {
|
|
|
52
48
|
/** Width of the outline along the upper edge in CSS pixels; 0 leaves it
|
|
53
49
|
out. */
|
|
54
50
|
strokeWidth?: number;
|
|
55
|
-
/** Dash pattern of the outline as a run of lengths in CSS pixels
|
|
56
|
-
|
|
51
|
+
/** Dash pattern of the outline as a run of lengths in CSS pixels. The fill
|
|
52
|
+
stays whole.
|
|
53
|
+
@default a solid outline */
|
|
57
54
|
dash?: readonly number[];
|
|
58
55
|
}
|
|
59
56
|
|
|
57
|
+
/** An `Area` as the chart holds it once registered. */
|
|
60
58
|
export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
61
59
|
kind: "area";
|
|
62
60
|
/** Lower edge; without a value the fixed baseline 0. */
|
|
63
|
-
baseline?:
|
|
61
|
+
baseline?: ValueFunction<T>;
|
|
64
62
|
/** Opacity of the fill; the outline stays fully opaque. */
|
|
65
63
|
fillOpacity: number;
|
|
66
64
|
strokeWidth: number;
|
|
@@ -106,19 +104,23 @@ export declare interface Assessment {
|
|
|
106
104
|
deviation?: number;
|
|
107
105
|
}
|
|
108
106
|
|
|
107
|
+
/** An `XAxis` or `YAxis` as the chart holds it once registered. */
|
|
109
108
|
export declare interface AxisConfig<T = unknown> {
|
|
110
109
|
id: string;
|
|
111
110
|
orientation: AxisOrientation;
|
|
112
111
|
position: AxisPosition;
|
|
113
|
-
|
|
112
|
+
/** Where a row lies along the axis; an x axis' only - along y the series
|
|
113
|
+
place their rows. */
|
|
114
|
+
accessor?: (d: T, index: number) => number;
|
|
114
115
|
label?: string;
|
|
115
116
|
tickCount?: number;
|
|
116
117
|
tickFormat?: (v: number) => string;
|
|
117
118
|
/** "visible" is a y axis' only: the extent of what its series show inside
|
|
118
119
|
their x axis' domain. */
|
|
119
120
|
domain: "nice" | "data" | "visible" | readonly [number, number];
|
|
120
|
-
/**
|
|
121
|
-
orientation
|
|
121
|
+
/** Whether the axis draws its grid lines.
|
|
122
|
+
@default only the first registered axis per orientation
|
|
123
|
+
@remarks R-4.15 */
|
|
122
124
|
grid?: boolean;
|
|
123
125
|
/** Fixed tick values instead of the 1-2-5 algorithm. For axes whose values are
|
|
124
126
|
not numbers but places: the lanes of a state stack, the categories of a
|
|
@@ -133,38 +135,48 @@ export declare interface AxisConfig<T = unknown> {
|
|
|
133
135
|
calendar?: readonly WorkingInterval[];
|
|
134
136
|
/** y axes only: this axis' ticks on the first y axis' grid. */
|
|
135
137
|
alignTicks?: boolean;
|
|
136
|
-
/** x axes only:
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
/** x axes only: wheel, drag, pinch, double click and the zoom keys move
|
|
139
|
+
the span the chart's view holds for this axis (ADR-0047). */
|
|
140
|
+
zoomable?: boolean;
|
|
141
|
+
/** x axes only: the narrowest and the widest span zoom may reach.
|
|
142
|
+
@default at most the data's extent, at least three data steps */
|
|
143
|
+
zoomLimits?: ZoomLimits;
|
|
139
144
|
}
|
|
140
145
|
|
|
146
|
+
/** Whether an axis or a limit runs along x or along y. */
|
|
141
147
|
export declare type AxisOrientation = "x" | "y";
|
|
142
148
|
|
|
149
|
+
/** The edge of the plot an axis stands at: `bottom` or `top` for x, `left` or
|
|
150
|
+
`right` for y. */
|
|
143
151
|
export declare type AxisPosition = "bottom" | "top" | "left" | "right";
|
|
144
152
|
|
|
145
|
-
|
|
153
|
+
/** The span each zoomable x axis shows, by axis `id`, in the axis' units. */
|
|
154
|
+
export declare type AxisSpans = Readonly<Record<string, readonly [number, number]>>;
|
|
146
155
|
|
|
156
|
+
/** The props of `Bar`. */
|
|
147
157
|
export declare interface BarProps<T> {
|
|
148
|
-
/** Height
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
/** Height - a number field of the row or a function of it;
|
|
159
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
160
|
+
@remarks R-2.5 */
|
|
161
|
+
value: Value<T>;
|
|
162
|
+
/** Binding to an x axis.
|
|
163
|
+
@remarks R-4.12 */
|
|
151
164
|
xAxisId?: string;
|
|
152
|
-
/** Binding to a y axis
|
|
165
|
+
/** Binding to a y axis.
|
|
166
|
+
@remarks R-4.12 */
|
|
153
167
|
yAxisId?: string;
|
|
154
|
-
/** Series-own data; overrides the container data
|
|
168
|
+
/** Series-own data; overrides the container data.
|
|
169
|
+
@remarks R-2.4 */
|
|
155
170
|
data?: readonly T[];
|
|
156
|
-
/** The name in legend and tooltip. Without one
|
|
157
|
-
|
|
158
|
-
|
|
171
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
172
|
+
unnamed series is a colour nobody can look up.
|
|
173
|
+
@default "Series n", after its place in the chart */
|
|
159
174
|
name?: string;
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
163
|
-
hidden?: boolean;
|
|
164
|
-
/** The value as the tooltip writes it; without one the y axis' `tickFormat`,
|
|
165
|
-
then the default. */
|
|
175
|
+
/** The value as the tooltip writes it.
|
|
176
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
166
177
|
format?: (value: number) => string;
|
|
167
|
-
/** Any CSS colour value
|
|
178
|
+
/** Any CSS colour value.
|
|
179
|
+
@default the palette's `--uc-series-N` */
|
|
168
180
|
color?: string;
|
|
169
181
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
170
182
|
it. */
|
|
@@ -184,6 +196,7 @@ export declare interface BarProps<T> {
|
|
|
184
196
|
barWidth?: number;
|
|
185
197
|
}
|
|
186
198
|
|
|
199
|
+
/** A `Bar` as the chart holds it once registered. */
|
|
187
200
|
export declare interface BarSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
188
201
|
kind: "bar";
|
|
189
202
|
/** Width as a fraction of the step; the group shares this fraction. */
|
|
@@ -222,52 +235,54 @@ export declare interface BoxNumbers<V = number> {
|
|
|
222
235
|
upperWhisker: V;
|
|
223
236
|
}
|
|
224
237
|
|
|
225
|
-
|
|
226
|
-
|
|
238
|
+
/** The props of `BoxPlot`. Every number is a number field of the row or a
|
|
239
|
+
function of it; `outliers` a list field or a function. */
|
|
227
240
|
export declare interface BoxPlotProps<T> {
|
|
228
241
|
/** The line across the box; null/undefined/NaN/±Infinity means a gap - no
|
|
229
|
-
box is drawn there, whatever the other numbers say
|
|
230
|
-
|
|
242
|
+
box is drawn there, whatever the other numbers say.
|
|
243
|
+
@remarks R-2.5 */
|
|
244
|
+
median: Value<T>;
|
|
231
245
|
/** The box's lower edge. */
|
|
232
|
-
lowerQuartile:
|
|
246
|
+
lowerQuartile: Value<T>;
|
|
233
247
|
/** The box's upper edge. */
|
|
234
|
-
upperQuartile:
|
|
248
|
+
upperQuartile: Value<T>;
|
|
235
249
|
/** Where the lower whisker ends - the caller's rule, not the minimum. */
|
|
236
|
-
lowerWhisker:
|
|
250
|
+
lowerWhisker: Value<T>;
|
|
237
251
|
/** Where the upper whisker ends - the caller's rule, not the maximum. */
|
|
238
|
-
upperWhisker:
|
|
252
|
+
upperWhisker: Value<T>;
|
|
239
253
|
/** The values beyond the whiskers, per box: an array, empty or missing
|
|
240
254
|
where there are none. Drawn with their box in its colour - one beyond
|
|
241
255
|
three IQR of the box's own quartiles as a ring -, read in its tooltip
|
|
242
256
|
and table row, never hit on their own (ADR-0040). */
|
|
243
|
-
outliers?:
|
|
257
|
+
outliers?: ListValue<T>;
|
|
244
258
|
/** The mean, drawn as a small ×: beside the median it shows a skew. */
|
|
245
|
-
mean?:
|
|
259
|
+
mean?: Value<T>;
|
|
246
260
|
/** The notch's lower bound - usually of a confidence interval of the
|
|
247
261
|
median. Both bounds or neither: one alone warns in DEV and is not
|
|
248
262
|
drawn. */
|
|
249
|
-
notchLower?:
|
|
263
|
+
notchLower?: Value<T>;
|
|
250
264
|
/** The notch's upper bound; see `notchLower`. */
|
|
251
|
-
notchUpper?:
|
|
265
|
+
notchUpper?: Value<T>;
|
|
252
266
|
/** How many values stand behind the box; read in the tooltip and the
|
|
253
267
|
table, not drawn. */
|
|
254
|
-
count?:
|
|
255
|
-
/** Binding to an x axis
|
|
268
|
+
count?: Value<T>;
|
|
269
|
+
/** Binding to an x axis.
|
|
270
|
+
@remarks R-4.12 */
|
|
256
271
|
xAxisId?: string;
|
|
257
|
-
/** Binding to a y axis
|
|
272
|
+
/** Binding to a y axis.
|
|
273
|
+
@remarks R-4.12 */
|
|
258
274
|
yAxisId?: string;
|
|
259
|
-
/** Series-own data; overrides the container data
|
|
275
|
+
/** Series-own data; overrides the container data.
|
|
276
|
+
@remarks R-2.4 */
|
|
260
277
|
data?: readonly T[];
|
|
261
|
-
/** The name in legend and tooltip. Without one
|
|
262
|
-
"Series n"
|
|
278
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV.
|
|
279
|
+
@default "Series n", after its place in the chart */
|
|
263
280
|
name?: string;
|
|
264
|
-
/**
|
|
265
|
-
|
|
266
|
-
hidden?: boolean;
|
|
267
|
-
/** Every number of the box as the tooltip and the table write it; without
|
|
268
|
-
one the y axis' `tickFormat`, then the default. */
|
|
281
|
+
/** Every number of the box as the tooltip and the table write it.
|
|
282
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
269
283
|
format?: (value: number) => string;
|
|
270
|
-
/** Any CSS colour value
|
|
284
|
+
/** Any CSS colour value.
|
|
285
|
+
@default the palette's `--uc-series-N` */
|
|
271
286
|
color?: string;
|
|
272
287
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
273
288
|
it. Set by the caller: a box out of its specification is the caller's
|
|
@@ -283,18 +298,18 @@ export declare interface BoxPlotProps<T> {
|
|
|
283
298
|
chose - the library draws them and computes none. */
|
|
284
299
|
export declare interface BoxSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
285
300
|
kind: "box";
|
|
286
|
-
lowerQuartile:
|
|
287
|
-
upperQuartile:
|
|
288
|
-
lowerWhisker:
|
|
289
|
-
upperWhisker:
|
|
301
|
+
lowerQuartile: ValueFunction<T>;
|
|
302
|
+
upperQuartile: ValueFunction<T>;
|
|
303
|
+
lowerWhisker: ValueFunction<T>;
|
|
304
|
+
upperWhisker: ValueFunction<T>;
|
|
290
305
|
/** The values beyond the whiskers, per box (ADR-0040). */
|
|
291
|
-
outliers?:
|
|
292
|
-
mean?:
|
|
306
|
+
outliers?: ListFunction<T>;
|
|
307
|
+
mean?: ValueFunction<T>;
|
|
293
308
|
/** Both bounds or neither (CONTEXT.md: Notch). */
|
|
294
|
-
notchLower?:
|
|
295
|
-
notchUpper?:
|
|
309
|
+
notchLower?: ValueFunction<T>;
|
|
310
|
+
notchUpper?: ValueFunction<T>;
|
|
296
311
|
/** How many values stand behind the box; no y value. */
|
|
297
|
-
count?:
|
|
312
|
+
count?: ValueFunction<T>;
|
|
298
313
|
/** Width as a fraction of the step; boxes and bars on one x axis share it. */
|
|
299
314
|
boxWidth: number;
|
|
300
315
|
}
|
|
@@ -311,27 +326,82 @@ export declare function calendarFrom(input: CalendarInput): WorkingCalendar;
|
|
|
311
326
|
axis, or the calendar built from it. */
|
|
312
327
|
export declare type CalendarInput = WorkingCalendar | readonly WorkingInterval[];
|
|
313
328
|
|
|
314
|
-
|
|
329
|
+
/** What `useChart` takes besides the rows: the view to start from and the
|
|
330
|
+
handler that hears every change of it. */
|
|
331
|
+
export declare interface ChartOptions {
|
|
332
|
+
/** The view to start from, and to go to whenever one differing in content
|
|
333
|
+
from the last is handed in - the same view again changes nothing, and
|
|
334
|
+
what it leaves out is reset; one the chart reported itself, handed back
|
|
335
|
+
late, is its own state coming back and not gone to - two charts in step
|
|
336
|
+
do not jump back mid-pan. The chart remembers none: where a view is kept
|
|
337
|
+
is the application's decision. */
|
|
338
|
+
initialView?: ChartView;
|
|
339
|
+
/** Every change of the view, once, always the whole view - the one to keep,
|
|
340
|
+
or to hand another chart as its `initialView`. A pan or zoom is reported
|
|
341
|
+
at most once per frame. Not called for the view the chart starts with. */
|
|
342
|
+
onViewChange?: (view: ChartView) => void;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** What `useChart` hands back: the chart and its parts, typed at the row `Z`,
|
|
346
|
+
its view and the setters that change it. A series given `data` of its own
|
|
347
|
+
is typed by that `data` instead. */
|
|
348
|
+
export declare interface ChartParts<Z> {
|
|
349
|
+
/** The chart over the hook's rows. One per `useChart`: it holds the view,
|
|
350
|
+
and a second chart is a second call. */
|
|
351
|
+
Chart: (props: ChartProps) => ReactNode;
|
|
352
|
+
/** An x axis reads the rows of every series bound to it: the hook's, or
|
|
353
|
+
with `<XAxis<Row>>` those the series bring as their own `data`. */
|
|
354
|
+
XAxis: <T = Z>(props: XAxisProps<T>) => null;
|
|
355
|
+
YAxis: (props: YAxisProps) => null;
|
|
356
|
+
Line: <T = Z>(props: LineProps<T>) => null;
|
|
357
|
+
Area: <T = Z>(props: AreaProps<T>) => null;
|
|
358
|
+
Bar: <T = Z>(props: BarProps<T>) => null;
|
|
359
|
+
Scatter: <T = Z>(props: ScatterProps<T>) => null;
|
|
360
|
+
StateBand: <T = Z>(props: StateBandProps<T>) => null;
|
|
361
|
+
Matrix: <T = Z>(props: MatrixProps<T>) => null;
|
|
362
|
+
BoxPlot: <T = Z>(props: BoxPlotProps<T>) => null;
|
|
363
|
+
/** How the reader is looking at the chart. */
|
|
364
|
+
view: ChartView;
|
|
365
|
+
/** The span each zoomable x axis shows, by axis `id`; an axis absent shows
|
|
366
|
+
its own `domain`. */
|
|
367
|
+
domains: AxisSpans;
|
|
368
|
+
/** Puts a span in view on a zoomable x axis - a lone one is `"x"`; `null`
|
|
369
|
+
shows the axis' own `domain` again. */
|
|
370
|
+
setDomain: (axisId: string, span: readonly [number, number] | null) => void;
|
|
371
|
+
/** The hidden series, by `name`. */
|
|
372
|
+
hidden: readonly string[];
|
|
373
|
+
/** Hides the series `name`, or shows it where it is hidden - as a click on
|
|
374
|
+
its legend entry does. Hiding the last series visible shows all. */
|
|
375
|
+
toggleSeries: (name: string) => void;
|
|
376
|
+
/** Hides every series but `name`; all are shown where none carries it. */
|
|
377
|
+
showOnly: (name: string) => void;
|
|
378
|
+
/** Shows every series again. */
|
|
379
|
+
showAllSeries: () => void;
|
|
380
|
+
}
|
|
315
381
|
|
|
316
|
-
/** Measurements of the instrumentation for the benchmark page
|
|
382
|
+
/** Measurements of the instrumentation for the benchmark page.
|
|
383
|
+
@remarks R-5.1 */
|
|
317
384
|
export declare interface ChartPerf {
|
|
318
385
|
materializeMs: number;
|
|
319
386
|
seriesDrawMs: number;
|
|
320
387
|
points: number;
|
|
321
388
|
}
|
|
322
389
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
/** Width in CSS pixels, or `"100%"` for the host's
|
|
327
|
-
|
|
390
|
+
/** The props of `Chart`. Its rows are not among them: `useChart(rows)` binds
|
|
391
|
+
them (ADR-0048). */
|
|
392
|
+
export declare interface ChartProps {
|
|
393
|
+
/** Width in CSS pixels, or `"100%"` for the host's: the chart measures its
|
|
394
|
+
host and follows it through a ResizeObserver.
|
|
395
|
+
@default "100%" */
|
|
328
396
|
width?: number | "100%";
|
|
329
|
-
/** Height in CSS pixels
|
|
330
|
-
|
|
397
|
+
/** Height in CSS pixels. Unlike the width, the chart does not take its
|
|
398
|
+
host's.
|
|
399
|
+
@default 300 */
|
|
331
400
|
height?: number;
|
|
332
401
|
/** Outer spacing of the plot area in CSS pixels. */
|
|
333
402
|
padding?: number | Partial<Padding>;
|
|
334
|
-
/** Required in DEV through a warning
|
|
403
|
+
/** Required in DEV through a warning.
|
|
404
|
+
@remarks R-7.6 */
|
|
335
405
|
ariaLabel?: string;
|
|
336
406
|
/** Goes to the root element, as it does everywhere in this workspace. */
|
|
337
407
|
className?: string;
|
|
@@ -341,32 +411,38 @@ export declare interface ChartProps<T> {
|
|
|
341
411
|
style?: CSSProperties;
|
|
342
412
|
/** Shown in the middle of the plot area when no visible series has a point
|
|
343
413
|
to show - no data, only gaps, or every series hidden. Axes and frame
|
|
344
|
-
stay.
|
|
414
|
+
stay.
|
|
415
|
+
@default the wording's `empty` */
|
|
345
416
|
empty?: ReactNode;
|
|
346
|
-
/** The chart's words (ADR-0031)
|
|
347
|
-
|
|
348
|
-
|
|
417
|
+
/** The chart's words (ADR-0031); entries left out fall back to English.
|
|
418
|
+
German: `GERMAN_CHARTS_WORDING` from `@umriss-ui/charts/wording/de`.
|
|
419
|
+
@default DEFAULT_CHARTS_WORDING */
|
|
349
420
|
wording?: Partial<ChartsWording>;
|
|
350
|
-
/** How series are told apart. `"color"
|
|
421
|
+
/** How series are told apart. `"color"`: by their colour.
|
|
351
422
|
`"marks"`: by a dash and a marker shape as well - a line, an area and a
|
|
352
423
|
scatter -, and by a hatch - a bar, a state, a matrix cell, a limit band -,
|
|
353
424
|
chosen by the same palette place as the colour, so that a reader who does
|
|
354
425
|
not see the colours still tells them apart; the legend's chips show the
|
|
355
|
-
same. A caller's own `dash` wins over the place's.
|
|
426
|
+
same. A caller's own `dash` wins over the place's.
|
|
427
|
+
@default "color" */
|
|
356
428
|
encoding?: "color" | "marks";
|
|
357
429
|
/** Charts with the same id share the pointer's x position, in domain units:
|
|
358
430
|
each draws its crosshair there, the tooltip stays with the chart under
|
|
359
|
-
the pointer. Zoom is not shared
|
|
360
|
-
`
|
|
431
|
+
the pointer. Zoom is not shared this way: charts zoom together by
|
|
432
|
+
handing each other their view (`useChart`'s `initialView` and
|
|
433
|
+
`onViewChange`). */
|
|
361
434
|
syncId?: string;
|
|
362
|
-
/** Instrumentation for the benchmark page
|
|
435
|
+
/** Instrumentation for the benchmark page; not needed otherwise.
|
|
436
|
+
@remarks R-5.1 */
|
|
363
437
|
onPerf?: (perf: ChartPerf) => void;
|
|
364
438
|
/** The axes, series and companions of this chart. They draw nothing
|
|
365
|
-
themselves: each registers its configuration and the scene draws it
|
|
366
|
-
|
|
439
|
+
themselves: each registers its configuration and the scene draws it,
|
|
440
|
+
and the order in the JSX is the drawing order.
|
|
441
|
+
@remarks R-2.1 */
|
|
367
442
|
children?: ReactNode;
|
|
368
443
|
}
|
|
369
444
|
|
|
445
|
+
/** Everything the charts put out as text. */
|
|
370
446
|
export declare interface ChartsWording {
|
|
371
447
|
/** What a screen reader calls the plot area that takes the keys
|
|
372
448
|
(`aria-roledescription`). */
|
|
@@ -396,6 +472,14 @@ export declare interface ChartsWording {
|
|
|
396
472
|
walkHelp: string;
|
|
397
473
|
/** The keys that zoom and pan it - only where the chart can be zoomed. */
|
|
398
474
|
zoomHelp: string;
|
|
475
|
+
/** The keys of the legend's entries - only where it has one to press. */
|
|
476
|
+
legendHelp: string;
|
|
477
|
+
/** Read out where hiding would leave nothing to see, and every series is
|
|
478
|
+
shown instead. */
|
|
479
|
+
allShown: string;
|
|
480
|
+
/** The control over a zoomed plot that brings every zoomed axis back to
|
|
481
|
+
its own domain (component-view 04). */
|
|
482
|
+
showAll: string;
|
|
399
483
|
/** The data table's disclosure key, closed and open (charts-alternatives
|
|
400
484
|
C1). */
|
|
401
485
|
showData: string;
|
|
@@ -427,37 +511,21 @@ export declare interface ChartsWording {
|
|
|
427
511
|
downsampled: (readings: number) => string;
|
|
428
512
|
}
|
|
429
513
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
severity?: Severity;
|
|
440
|
-
/** What the value means. A line at 90 does not say what 90 is. */
|
|
441
|
-
label?: string;
|
|
442
|
-
/** Any CSS colour value, in place of the one the severity yields. A colour
|
|
443
|
-
handed in instead of a severity puts the rule in the application and the
|
|
444
|
-
presentation in the library, and the two drift apart as soon as a bound
|
|
445
|
-
moves - so this is for the case that has no severity, not for taste. */
|
|
446
|
-
color?: string;
|
|
447
|
-
/** Whether the value widens the axis extent, so that the limit is certainly
|
|
448
|
-
visible. Default true; the head of this file says why. */
|
|
449
|
-
inExtent?: boolean;
|
|
450
|
-
/** A chosen specification limit (the default) or a calculated control limit.
|
|
451
|
-
They look different because they mean different things (ADR-0008). */
|
|
452
|
-
role?: LimitRole;
|
|
514
|
+
/** How a reader is looking at a chart. Whatever is at its default is absent. */
|
|
515
|
+
export declare interface ChartView {
|
|
516
|
+
/** The span each zoomable x axis shows, by axis `id` - a lone x axis is
|
|
517
|
+
`"x"`. An axis absent here shows its own `domain`. An id that names no
|
|
518
|
+
zoomable x axis falls out. */
|
|
519
|
+
domains?: AxisSpans;
|
|
520
|
+
/** The hidden series, by `name`; a series without one cannot be hidden. A
|
|
521
|
+
name no series carries falls out. */
|
|
522
|
+
hidden?: readonly string[];
|
|
453
523
|
}
|
|
454
524
|
|
|
455
|
-
declare interface
|
|
456
|
-
/** Axis id, through which series bind themselves
|
|
525
|
+
declare interface CommonProps {
|
|
526
|
+
/** Axis id, through which series bind themselves.
|
|
527
|
+
@remarks R-4.12 */
|
|
457
528
|
id?: string;
|
|
458
|
-
/** Value access of this axis. Compared by its source text, as a series'
|
|
459
|
-
accessor is (`Accessor`) - with the same closure limit. */
|
|
460
|
-
accessor: (d: T, index: number) => number;
|
|
461
529
|
/** Axis title. */
|
|
462
530
|
label?: string;
|
|
463
531
|
/** Target value; the 1-2-5 algorithm may deviate. */
|
|
@@ -467,7 +535,9 @@ declare interface CommonProps_2<T> {
|
|
|
467
535
|
a new text or remount. A bound `Intl.NumberFormat#format` is compared by
|
|
468
536
|
identity. */
|
|
469
537
|
tickFormat?: (v: number) => string;
|
|
470
|
-
/** Grid lines
|
|
538
|
+
/** Grid lines.
|
|
539
|
+
@default only on the first axis of its orientation
|
|
540
|
+
@remarks R-4.15 */
|
|
471
541
|
grid?: boolean;
|
|
472
542
|
/** Fixed tick values instead of the 1-2-5 algorithm. For axes whose values are
|
|
473
543
|
places and not numbers: the lanes of a state stack, the categories of a
|
|
@@ -475,29 +545,38 @@ declare interface CommonProps_2<T> {
|
|
|
475
545
|
ticks?: readonly number[];
|
|
476
546
|
}
|
|
477
547
|
|
|
548
|
+
/** A control chart inside a `Chart`: the values as a line, the control limits
|
|
549
|
+
and zones computed from them, and the points that break a rule marked.
|
|
550
|
+
It draws nothing of its own - it composes `Line`, `LimitLine` and
|
|
551
|
+
`Scatter`, so that limits, zones and violations come from the same values. */
|
|
478
552
|
export declare function ControlChart<T>(props: ControlChartProps<T>): ReactNode;
|
|
479
553
|
|
|
554
|
+
/** The props of `ControlChart`. */
|
|
480
555
|
export declare interface ControlChartProps<T> {
|
|
481
|
-
/** The values of the chart
|
|
482
|
-
|
|
556
|
+
/** The values of the chart - a number field of its `data`'s rows or a
|
|
557
|
+
function of them. */
|
|
558
|
+
value: Value<T>;
|
|
483
559
|
/** Required: the limits arise out of these values, not out of what happens to
|
|
484
560
|
be visible. */
|
|
485
561
|
data: readonly T[];
|
|
486
562
|
/** Given, or from a named reference window - never tacitly from everything on
|
|
487
563
|
the screen (ADR-0008). */
|
|
488
564
|
origin: ControlLimitOrigin;
|
|
489
|
-
/** Binding to an x axis
|
|
565
|
+
/** Binding to an x axis.
|
|
566
|
+
@remarks R-4.12 */
|
|
490
567
|
xAxisId?: string;
|
|
491
|
-
/** Binding to a y axis
|
|
568
|
+
/** Binding to a y axis.
|
|
569
|
+
@remarks R-4.12 */
|
|
492
570
|
yAxisId?: string;
|
|
493
|
-
/** The name in legend and tooltip. Without one
|
|
494
|
-
|
|
495
|
-
|
|
571
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
572
|
+
unnamed series is a colour nobody can look up.
|
|
573
|
+
@default "Series n", after its place in the chart */
|
|
496
574
|
name?: string;
|
|
497
|
-
/** The value as the tooltip writes it - on the line and on the violations
|
|
498
|
-
|
|
575
|
+
/** The value as the tooltip writes it - on the line and on the violations.
|
|
576
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
499
577
|
format?: (value: number) => string;
|
|
500
|
-
/** Any CSS colour value
|
|
578
|
+
/** Any CSS colour value.
|
|
579
|
+
@default the palette's `--uc-series-N` */
|
|
501
580
|
color?: string;
|
|
502
581
|
/** A role instead of a colour value for the line; the theme resolves it.
|
|
503
582
|
The violations are always "alarm". */
|
|
@@ -507,15 +586,18 @@ export declare interface ControlChartProps<T> {
|
|
|
507
586
|
/** The faint zone lines at one and two sigma. Rule 4 is about the two-sigma
|
|
508
587
|
zone; without them a reader cannot check it. */
|
|
509
588
|
zoneLines?: boolean;
|
|
510
|
-
/**
|
|
511
|
-
|
|
589
|
+
/** Label of the upper control limit in the axis band. The package brings no
|
|
590
|
+
text along, not even "UCL" and "LCL".
|
|
591
|
+
@default no label */
|
|
512
592
|
labelUpper?: string;
|
|
513
593
|
/** The same for the lower control limit. Named separately because a chart may
|
|
514
|
-
well want one of the two labelled and not the other.
|
|
594
|
+
well want one of the two labelled and not the other.
|
|
595
|
+
@default no label */
|
|
515
596
|
labelLower?: string;
|
|
516
|
-
/** Name of the scatter of violations in the legend and the tooltip. Without
|
|
517
|
-
|
|
518
|
-
|
|
597
|
+
/** Name of the scatter of violations in the legend and the tooltip. Without
|
|
598
|
+
one a legend warns once in DEV. Before this, a German suffix stood on the
|
|
599
|
+
name of the chart.
|
|
600
|
+
@default "Series n", after its place in the chart */
|
|
519
601
|
violationName?: string;
|
|
520
602
|
/** The violations as data - they can be listed beside the chart as well as
|
|
521
603
|
marked on it. */
|
|
@@ -554,6 +636,10 @@ export declare interface ControlLimits {
|
|
|
554
636
|
chart then draws no line instead of bursting. */
|
|
555
637
|
export declare function controlLimits(values: readonly number[], origin: ControlLimitOrigin): ControlLimits;
|
|
556
638
|
|
|
639
|
+
/** The chart's values as a table, on demand: a key - in the legend where
|
|
640
|
+
there is one - opens a table of what the chart shows, one column per
|
|
641
|
+
visible series, in the tooltip's format. For a reader who wants every value
|
|
642
|
+
at once. Place it inside a `Chart`. */
|
|
557
643
|
export declare function DataTable(): ReactNode;
|
|
558
644
|
|
|
559
645
|
/** One table of the data table: the series of one x axis, or one matrix. Every
|
|
@@ -566,8 +652,13 @@ export declare interface DataTableGroup {
|
|
|
566
652
|
rows: readonly (readonly string[])[];
|
|
567
653
|
}
|
|
568
654
|
|
|
655
|
+
/** One day of 24 hours in milliseconds; across a clock change a calendar day
|
|
656
|
+
is an hour longer or shorter. */
|
|
569
657
|
export declare const DAY: number;
|
|
570
658
|
|
|
659
|
+
/** The instance shipped by default. English; German is
|
|
660
|
+
`GERMAN_CHARTS_WORDING` in `@umriss-ui/charts/wording/de`. A chart takes
|
|
661
|
+
its own through `wording`. */
|
|
571
662
|
export declare const DEFAULT_CHARTS_WORDING: ChartsWording;
|
|
572
663
|
|
|
573
664
|
/** Default gradient: a sequential set, light to dark, so that it stays readable
|
|
@@ -580,26 +671,52 @@ export declare const DEFAULT_GRADIENT: readonly string[];
|
|
|
580
671
|
lengths are therefore parameters. */
|
|
581
672
|
export declare const defaultRules: RuleOptions;
|
|
582
673
|
|
|
674
|
+
/** The views a component reported that may still come back, by their
|
|
675
|
+
content key - the chart's and the schedule's (ADR-0047), the table holding
|
|
676
|
+
a copy of its own. An application keeping the view hands
|
|
677
|
+
it back a frame or more late - by then a pan has moved on, and going to the
|
|
678
|
+
view handed in would jump back. So a view handed in that equals one
|
|
679
|
+
reported since the last one handed in, within a second, is the component's
|
|
680
|
+
own state coming back, not a view to go to. The echoes come in order: one drops
|
|
681
|
+
itself and every older report, a view from outside drops them all. The
|
|
682
|
+
second bounds the list where nothing is handed back, and lets such an
|
|
683
|
+
application still restore a view it kept. */
|
|
684
|
+
export declare class Echoes {
|
|
685
|
+
private reports;
|
|
686
|
+
/** Notes a view reported, by its key. */
|
|
687
|
+
reported(key: string): void;
|
|
688
|
+
/** Whether the view handed in is a report coming back. */
|
|
689
|
+
has(key: string): boolean;
|
|
690
|
+
/** Forgets what the view handed in answers. */
|
|
691
|
+
handed(key: string): void;
|
|
692
|
+
private at;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/** One hour in milliseconds. */
|
|
583
696
|
export declare const HOUR: number;
|
|
584
697
|
|
|
585
698
|
/** Explicit invalidation: devalue the cache, every living chart reads anew and
|
|
586
699
|
redraws. */
|
|
587
700
|
export declare function invalidateTheme(): void;
|
|
588
701
|
|
|
589
|
-
|
|
702
|
+
/** The legend of a chart: one entry per series, or per state of a state band.
|
|
703
|
+
Hovering an entry highlights its series; a click hides and shows it, a
|
|
704
|
+
state's entry the whole band - through the chart's view. A double click,
|
|
705
|
+
Alt+click or Shift+Enter shows only it, or all where it is the only one
|
|
706
|
+
visible. Nothing hides every series: what would shows all, and the live
|
|
707
|
+
region says so. */
|
|
708
|
+
export declare function Legend({ placement }: LegendProps): ReactNode;
|
|
590
709
|
|
|
710
|
+
/** A `Legend` as the chart holds it once registered. */
|
|
591
711
|
export declare interface LegendConfig {
|
|
592
712
|
placement: "top" | "bottom";
|
|
593
713
|
}
|
|
594
714
|
|
|
715
|
+
/** The props of `Legend`. */
|
|
595
716
|
export declare interface LegendProps {
|
|
596
|
-
/** Which side of the plot area the legend stands on.
|
|
597
|
-
|
|
717
|
+
/** Which side of the plot area the legend stands on.
|
|
718
|
+
@default "top" */
|
|
598
719
|
placement?: "top" | "bottom";
|
|
599
|
-
/** Called with an entry's name when it is clicked - the series' name, or a
|
|
600
|
-
state's label. The caller flips `hidden` on the series it means. Without
|
|
601
|
-
it the legend is not clickable. */
|
|
602
|
-
onToggle?: (name: string) => void;
|
|
603
720
|
}
|
|
604
721
|
|
|
605
722
|
/** A bound: a value, a side and a severity. No more - a tolerance band is
|
|
@@ -612,15 +729,21 @@ export declare interface Limit {
|
|
|
612
729
|
severity: Severity;
|
|
613
730
|
}
|
|
614
731
|
|
|
732
|
+
/** A limit drawn as a band between two values of an axis - a tolerance or a
|
|
733
|
+
zone. Otherwise a `LimitLine`. */
|
|
615
734
|
export declare function LimitBand(props: LimitBandProps): null;
|
|
616
735
|
|
|
736
|
+
/** A `LimitBand` as the chart holds it once registered: the range from `from`
|
|
737
|
+
to `to`. */
|
|
617
738
|
export declare interface LimitBandConfig extends LimitBase {
|
|
618
739
|
kind: "band";
|
|
619
740
|
from: number;
|
|
620
741
|
to: number;
|
|
621
742
|
}
|
|
622
743
|
|
|
623
|
-
|
|
744
|
+
/** The props of `LimitBand`: a `LimitLine`'s, with a range in place of
|
|
745
|
+
`value`. */
|
|
746
|
+
export declare interface LimitBandProps extends LimitCommonProps {
|
|
624
747
|
/** Lower edge of the band, in domain units of its axis. */
|
|
625
748
|
from: number;
|
|
626
749
|
/** Upper edge, in domain units of its axis. A band drawn backwards (`from` above `to`) is drawn between
|
|
@@ -645,16 +768,54 @@ declare interface LimitBase {
|
|
|
645
768
|
inExtent: boolean;
|
|
646
769
|
}
|
|
647
770
|
|
|
771
|
+
declare interface LimitCommonProps {
|
|
772
|
+
/** Axis on which the value lies.
|
|
773
|
+
@default the first axis of the orientation */
|
|
774
|
+
axisId?: string;
|
|
775
|
+
/** Whether the value lies on the x or on the y axis - a limit is nearly
|
|
776
|
+
always a value and not a moment.
|
|
777
|
+
@default "y" */
|
|
778
|
+
orientation?: "x" | "y";
|
|
779
|
+
/** Two severities, not five: five urgencies are five colours, and five colours
|
|
780
|
+
on a dense screen are noise. */
|
|
781
|
+
severity?: Severity;
|
|
782
|
+
/** What the value means. A line at 90 does not say what 90 is. */
|
|
783
|
+
label?: string;
|
|
784
|
+
/** Any CSS colour value, in place of the one the severity yields. A colour
|
|
785
|
+
handed in instead of a severity puts the rule in the application and the
|
|
786
|
+
presentation in the library, and the two drift apart as soon as a bound
|
|
787
|
+
moves - so this is for the case that has no severity, not for taste.
|
|
788
|
+
The line or band takes it; its label keeps the axis's text colour, which
|
|
789
|
+
stays legible in both themes, and a short stroke before the text in the
|
|
790
|
+
line's pattern takes this colour. */
|
|
791
|
+
color?: string;
|
|
792
|
+
/** Whether the value widens the axis extent, so that the limit is certainly
|
|
793
|
+
visible.
|
|
794
|
+
@default true */
|
|
795
|
+
inExtent?: boolean;
|
|
796
|
+
/** A chosen specification limit or a calculated control limit. They look
|
|
797
|
+
different because they mean different things (ADR-0008).
|
|
798
|
+
@default "specification" */
|
|
799
|
+
role?: LimitRole;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/** Any registered limit, a line or a band, told apart by `kind`. */
|
|
648
803
|
export declare type LimitConfig = LimitLineConfig | LimitBandConfig;
|
|
649
804
|
|
|
805
|
+
/** A limit drawn as a line across the plot at one value of an axis - a
|
|
806
|
+
specification limit, or with `role` a control limit. Not a series: no data,
|
|
807
|
+
no legend entry, no hit. By default it widens its axis so that it is
|
|
808
|
+
always seen. */
|
|
650
809
|
export declare function LimitLine(props: LimitLineProps): null;
|
|
651
810
|
|
|
811
|
+
/** A `LimitLine` as the chart holds it once registered. */
|
|
652
812
|
export declare interface LimitLineConfig extends LimitBase {
|
|
653
813
|
kind: "line";
|
|
654
814
|
value: number;
|
|
655
815
|
}
|
|
656
816
|
|
|
657
|
-
|
|
817
|
+
/** The props of `LimitLine`. */
|
|
818
|
+
export declare interface LimitLineProps extends LimitCommonProps {
|
|
658
819
|
/** Where the line lies, in domain units of its axis. */
|
|
659
820
|
value: number;
|
|
660
821
|
}
|
|
@@ -679,8 +840,8 @@ export declare interface LimitSet {
|
|
|
679
840
|
target?: number;
|
|
680
841
|
}
|
|
681
842
|
|
|
682
|
-
|
|
683
|
-
|
|
843
|
+
/** The affine mapping from a domain onto a pixel range, and back; the scale
|
|
844
|
+
every axis of the library uses. */
|
|
684
845
|
export declare class LinearScale implements Scale {
|
|
685
846
|
readonly domain: readonly [number, number];
|
|
686
847
|
readonly range: readonly [number, number];
|
|
@@ -693,33 +854,37 @@ export declare class LinearScale implements Scale {
|
|
|
693
854
|
ticks(n: number): number[];
|
|
694
855
|
}
|
|
695
856
|
|
|
857
|
+
/** The props of `Line`. */
|
|
696
858
|
export declare interface LineProps<T> {
|
|
697
|
-
/** Y value
|
|
698
|
-
|
|
699
|
-
|
|
859
|
+
/** Y value - a number field of the row or a function of it;
|
|
860
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
861
|
+
@remarks R-2.5 */
|
|
862
|
+
value: Value<T>;
|
|
863
|
+
/** Binding to an x axis.
|
|
864
|
+
@remarks R-4.12 */
|
|
700
865
|
xAxisId?: string;
|
|
701
|
-
/** Binding to a y axis
|
|
866
|
+
/** Binding to a y axis.
|
|
867
|
+
@remarks R-4.12 */
|
|
702
868
|
yAxisId?: string;
|
|
703
|
-
/** Series-own data; overrides the container data
|
|
869
|
+
/** Series-own data; overrides the container data.
|
|
870
|
+
@remarks R-2.4 */
|
|
704
871
|
data?: readonly T[];
|
|
705
|
-
/** The name in legend and tooltip. Without one
|
|
706
|
-
|
|
707
|
-
|
|
872
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
873
|
+
unnamed series is a colour nobody can look up.
|
|
874
|
+
@default "Series n", after its place in the chart */
|
|
708
875
|
name?: string;
|
|
709
|
-
/**
|
|
710
|
-
|
|
711
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
712
|
-
hidden?: boolean;
|
|
713
|
-
/** The value as the tooltip writes it; without one the y axis' `tickFormat`,
|
|
714
|
-
then the default. */
|
|
876
|
+
/** The value as the tooltip writes it.
|
|
877
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
715
878
|
format?: (value: number) => string;
|
|
716
|
-
/** Any CSS colour value
|
|
879
|
+
/** Any CSS colour value.
|
|
880
|
+
@default the palette's `--uc-series-N` */
|
|
717
881
|
color?: string;
|
|
718
882
|
/** A role instead of a colour value; the theme resolves it. */
|
|
719
883
|
tone?: "ok" | "warning" | "alarm";
|
|
720
884
|
/** Line width in CSS pixels. */
|
|
721
885
|
strokeWidth?: number;
|
|
722
|
-
/** Dash pattern as a run of lengths in CSS pixels
|
|
886
|
+
/** Dash pattern as a run of lengths in CSS pixels.
|
|
887
|
+
@default a solid line */
|
|
723
888
|
dash?: readonly number[];
|
|
724
889
|
/** When the individual points are drawn as marks: `auto` every point up to
|
|
725
890
|
60 points and above that only a point between two gaps - it has no line
|
|
@@ -731,6 +896,7 @@ export declare interface LineProps<T> {
|
|
|
731
896
|
step?: boolean;
|
|
732
897
|
}
|
|
733
898
|
|
|
899
|
+
/** A `Line` as the chart holds it once registered. */
|
|
734
900
|
export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
735
901
|
kind: "line";
|
|
736
902
|
strokeWidth: number;
|
|
@@ -740,9 +906,18 @@ export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
|
740
906
|
step?: boolean;
|
|
741
907
|
}
|
|
742
908
|
|
|
743
|
-
/**
|
|
909
|
+
/** The fields of a row whose value is a list of numbers, or absent. */
|
|
910
|
+
export declare type ListField<T> = NoInfer<{
|
|
911
|
+
[K in keyof T & string]-?: T[K] extends readonly number[] | null | undefined ? K : never;
|
|
912
|
+
}[keyof T & string]>;
|
|
913
|
+
|
|
914
|
+
/** A list computed from the row - a box's outliers (ADR-0040), the
|
|
915
|
+
function form of `ListValue`. null/undefined or an
|
|
744
916
|
empty array is none; a value that is not finite is left out. */
|
|
745
|
-
export declare type
|
|
917
|
+
export declare type ListFunction<T> = (d: T, index: number) => readonly number[] | null | undefined;
|
|
918
|
+
|
|
919
|
+
/** A list read from the row: the name of a list field or a function. */
|
|
920
|
+
export declare type ListValue<T> = ListField<T> | ListFunction<T>;
|
|
746
921
|
|
|
747
922
|
/** The local offset at an instant, as the shift of a grid that is to lie on
|
|
748
923
|
local time: `wallClock = offset + k · step`. Taken at one instant, it holds
|
|
@@ -753,16 +928,17 @@ export declare function localOffset(instant: number): number;
|
|
|
753
928
|
go it in one piece. Only the first n values are touched. */
|
|
754
929
|
export declare function mapSeries(input: CalendarInput, source: Float64Array, n: number, target: Float64Array): void;
|
|
755
930
|
|
|
756
|
-
/** Materialised series: the draw loop works only on this
|
|
757
|
-
Gaps (null/undefined/NaN/±Infinity out of the accessor) are encoded as NaN
|
|
758
|
-
|
|
931
|
+
/** Materialised series: the draw loop works only on this.
|
|
932
|
+
Gaps (null/undefined/NaN/±Infinity out of the accessor) are encoded as NaN.
|
|
933
|
+
@remarks R-2.7, R-2.5 */
|
|
759
934
|
export declare interface MaterializedSeries {
|
|
760
935
|
x: Float64Array;
|
|
761
936
|
y: Float64Array;
|
|
762
937
|
/** Lower edge, where the baseline is an accessor of its own; otherwise null.
|
|
763
|
-
A fixed baseline needs no channel - it is a number
|
|
938
|
+
A fixed baseline needs no channel - it is a number.
|
|
939
|
+
@remarks R-2.7 */
|
|
764
940
|
y0: Float64Array | null;
|
|
765
|
-
/**
|
|
941
|
+
/** Level channel: the third value per point, which today only the matrix
|
|
766
942
|
needs. Named rather than overloading y0 - a property that only some kinds
|
|
767
943
|
carry does not belong in the shared type with a comment (ADR-0011). null
|
|
768
944
|
for every kind that does not use it. */
|
|
@@ -773,8 +949,6 @@ export declare interface MaterializedSeries {
|
|
|
773
949
|
length: number;
|
|
774
950
|
}
|
|
775
951
|
|
|
776
|
-
export declare function Matrix<T>(props: MatrixProps<T>): null;
|
|
777
|
-
|
|
778
952
|
/** How a matrix colours its cells. Discretely by assessment - the same limits
|
|
779
953
|
that colour a tile - or across a gradient. */
|
|
780
954
|
export declare type MatrixColoring = {
|
|
@@ -788,46 +962,61 @@ export declare type MatrixColoring = {
|
|
|
788
962
|
package does not have and is not to get (ADR-0011). Whoever wants a
|
|
789
963
|
finer gradation names more colours. */
|
|
790
964
|
stops: readonly string[];
|
|
791
|
-
/** Value range of the gradient
|
|
965
|
+
/** Value range of the gradient.
|
|
966
|
+
@default the range of the data */
|
|
792
967
|
range?: readonly [number, number];
|
|
793
968
|
};
|
|
794
969
|
|
|
970
|
+
/** The props of `Matrix`. */
|
|
795
971
|
export declare interface MatrixProps<T> {
|
|
796
|
-
/** Row position on the y axis
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
972
|
+
/** Row position on the y axis - a number field of the row or a function
|
|
973
|
+
of it, as every series' y position. */
|
|
974
|
+
value: Value<T>;
|
|
975
|
+
/** The level that decides the colour - a number field of the row or a
|
|
976
|
+
function of it. A missing level is a hole, not a zero. */
|
|
977
|
+
level: Value<T>;
|
|
978
|
+
/** How the level colours a cell: by assessment against limits, or across
|
|
979
|
+
a gradient.
|
|
980
|
+
@default { kind: "gradient", stops: DEFAULT_GRADIENT } */
|
|
801
981
|
coloring?: MatrixColoring;
|
|
802
|
-
/** Binding to an x axis
|
|
982
|
+
/** Binding to an x axis.
|
|
983
|
+
@remarks R-4.12 */
|
|
803
984
|
xAxisId?: string;
|
|
804
|
-
/** Binding to a y axis
|
|
985
|
+
/** Binding to a y axis.
|
|
986
|
+
@remarks R-4.12 */
|
|
805
987
|
yAxisId?: string;
|
|
806
|
-
/** Series-own data; overrides the container data
|
|
988
|
+
/** Series-own data; overrides the container data.
|
|
989
|
+
@remarks R-2.4 */
|
|
807
990
|
data?: readonly T[];
|
|
808
|
-
/** The name in legend and tooltip. Without one
|
|
809
|
-
|
|
810
|
-
|
|
991
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
992
|
+
unnamed series is a colour nobody can look up.
|
|
993
|
+
@default "Series n", after its place in the chart */
|
|
811
994
|
name?: string;
|
|
812
|
-
/**
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
hidden?: boolean;
|
|
816
|
-
/** The value as the tooltip writes it; without one the default. The y
|
|
817
|
-
axis' `tickFormat` writes the row, not the value. */
|
|
995
|
+
/** The level as the tooltip writes it. The y axis' `tickFormat` writes the
|
|
996
|
+
row, not the level.
|
|
997
|
+
@default the built-in number format */
|
|
818
998
|
format?: (value: number) => string;
|
|
819
999
|
}
|
|
820
1000
|
|
|
1001
|
+
/** A `Matrix` as the chart holds it once registered: its base accessor is the
|
|
1002
|
+
row, `level` the colour. */
|
|
821
1003
|
export declare interface MatrixSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
822
1004
|
kind: "matrix";
|
|
823
|
-
/** The
|
|
824
|
-
The base accessor yields the row position, not this
|
|
825
|
-
|
|
1005
|
+
/** The level that decides the colour - the third channel (ADR-0011).
|
|
1006
|
+
The base accessor yields the row position, not this level. */
|
|
1007
|
+
level: ValueFunction<T>;
|
|
826
1008
|
coloring: MatrixColoring;
|
|
827
1009
|
}
|
|
828
1010
|
|
|
1011
|
+
/** One minute in milliseconds. */
|
|
829
1012
|
export declare const MINUTE: number;
|
|
830
1013
|
|
|
1014
|
+
/** The fields of a row whose value is a number, or absent. */
|
|
1015
|
+
export declare type NumberField<T> = NoInfer<{
|
|
1016
|
+
[K in keyof T & string]-?: T[K] extends number | null | undefined ? K : never;
|
|
1017
|
+
}[keyof T & string]>;
|
|
1018
|
+
|
|
1019
|
+
/** Space in CSS pixels on each side of a rectangle. */
|
|
831
1020
|
export declare interface Padding {
|
|
832
1021
|
top: number;
|
|
833
1022
|
right: number;
|
|
@@ -848,6 +1037,8 @@ export declare interface Padding {
|
|
|
848
1037
|
which is the third biggest problem. */
|
|
849
1038
|
export declare function pareto(items: readonly ParetoItem[], options?: ParetoSettings): ParetoResult;
|
|
850
1039
|
|
|
1040
|
+
/** What `pareto` assumes where a call says nothing: a cutoff of 80 %, and no
|
|
1041
|
+
collecting of the tail. */
|
|
851
1042
|
export declare const paretoDefaults: Omit<ParetoOptions, "remainderName">;
|
|
852
1043
|
|
|
853
1044
|
/** An item, the way it is drawn. */
|
|
@@ -873,23 +1064,28 @@ export declare interface ParetoItem {
|
|
|
873
1064
|
readonly value: number;
|
|
874
1065
|
}
|
|
875
1066
|
|
|
1067
|
+
/** The settings of `pareto`, complete; a call gives `ParetoSettings`. */
|
|
876
1068
|
export declare interface ParetoOptions {
|
|
877
1069
|
/** The share whose crossing is sought. Whoever lands exactly on it counts as
|
|
878
1070
|
the crossing: the question is "which reasons make up eighty per cent", and
|
|
879
|
-
whoever reaches eighty exactly belongs to them.
|
|
1071
|
+
whoever reaches eighty exactly belongs to them.
|
|
1072
|
+
@default 0.8 */
|
|
880
1073
|
readonly cutoff: number;
|
|
881
1074
|
/** How many items stay on their own. Everything behind that becomes a single
|
|
882
1075
|
entry. Beyond the number of items no remainder arises at all - not an empty
|
|
883
|
-
one.
|
|
1076
|
+
one.
|
|
1077
|
+
@default Infinity */
|
|
884
1078
|
readonly collectRank: number;
|
|
885
1079
|
/** Name of the collected remainder. `@umriss-ui/charts` has no wording module
|
|
886
1080
|
- every string it draws comes from the caller - and no module is introduced
|
|
887
|
-
for a single label.
|
|
888
|
-
|
|
889
|
-
|
|
1081
|
+
for a single label. Until library-audit 03 the name here was
|
|
1082
|
+
"Sonstige", the one German word the package brought along itself.
|
|
1083
|
+
@default none - the caller names it */
|
|
890
1084
|
readonly remainderName?: string;
|
|
891
1085
|
}
|
|
892
1086
|
|
|
1087
|
+
/** What `pareto` returns: the entries as they are drawn, their total and
|
|
1088
|
+
where the cutoff is crossed. */
|
|
893
1089
|
export declare interface ParetoResult {
|
|
894
1090
|
readonly entries: readonly ParetoEntry[];
|
|
895
1091
|
/** Total of the drawn entries - after collecting, the same as before. */
|
|
@@ -911,6 +1107,7 @@ export declare type ParetoSettings = {
|
|
|
911
1107
|
readonly remainderName: string;
|
|
912
1108
|
});
|
|
913
1109
|
|
|
1110
|
+
/** A rectangle in CSS pixels, from its top left corner. */
|
|
914
1111
|
export declare interface Rect {
|
|
915
1112
|
x: number;
|
|
916
1113
|
y: number;
|
|
@@ -943,6 +1140,8 @@ export declare interface RemovedSpan {
|
|
|
943
1140
|
without a style engine), a colour is given back as it stands. */
|
|
944
1141
|
export declare function resolveColours<K extends string>(root: Element, colours: Readonly<Record<K, string>>): Record<K, string>;
|
|
945
1142
|
|
|
1143
|
+
/** A chart's colours and fonts, resolved from the `--uc-*` tokens where the
|
|
1144
|
+
chart stands. */
|
|
946
1145
|
export declare interface ResolvedTheme {
|
|
947
1146
|
colorAxis: string;
|
|
948
1147
|
colorGrid: string;
|
|
@@ -999,6 +1198,8 @@ export declare function ruleTrend(values: readonly number[], length?: number): n
|
|
|
999
1198
|
that one is unremarkable and, marked, would look like a measurement error. */
|
|
1000
1199
|
export declare function ruleTwoOfThree(values: readonly number[], limits: ControlLimits): number[];
|
|
1001
1200
|
|
|
1201
|
+
/** The mapping of an axis' values onto pixels and back, with its ticks. Every
|
|
1202
|
+
scale of the library is affine; `LinearScale` implements it. */
|
|
1002
1203
|
export declare interface Scale {
|
|
1003
1204
|
domain: readonly [number, number];
|
|
1004
1205
|
range: readonly [number, number];
|
|
@@ -1016,29 +1217,30 @@ export declare interface Scale {
|
|
|
1016
1217
|
ticks(n: number): number[];
|
|
1017
1218
|
}
|
|
1018
1219
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1220
|
+
/** The props of `Scatter`. */
|
|
1021
1221
|
export declare interface ScatterProps<T> {
|
|
1022
|
-
/** Y value
|
|
1023
|
-
|
|
1024
|
-
|
|
1222
|
+
/** Y value - a number field of the row or a function of it;
|
|
1223
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
1224
|
+
@remarks R-2.5 */
|
|
1225
|
+
value: Value<T>;
|
|
1226
|
+
/** Binding to an x axis.
|
|
1227
|
+
@remarks R-4.12 */
|
|
1025
1228
|
xAxisId?: string;
|
|
1026
|
-
/** Binding to a y axis
|
|
1229
|
+
/** Binding to a y axis.
|
|
1230
|
+
@remarks R-4.12 */
|
|
1027
1231
|
yAxisId?: string;
|
|
1028
|
-
/** Series-own data; overrides the container data
|
|
1232
|
+
/** Series-own data; overrides the container data.
|
|
1233
|
+
@remarks R-2.4 */
|
|
1029
1234
|
data?: readonly T[];
|
|
1030
|
-
/** The name in legend and tooltip. Without one
|
|
1031
|
-
|
|
1032
|
-
|
|
1235
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
1236
|
+
unnamed series is a colour nobody can look up.
|
|
1237
|
+
@default "Series n", after its place in the chart */
|
|
1033
1238
|
name?: string;
|
|
1034
|
-
/**
|
|
1035
|
-
|
|
1036
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
1037
|
-
hidden?: boolean;
|
|
1038
|
-
/** The value as the tooltip writes it; without one the y axis' `tickFormat`,
|
|
1039
|
-
then the default. */
|
|
1239
|
+
/** The value as the tooltip writes it.
|
|
1240
|
+
@default the y axis' `tickFormat`, else the built-in number format */
|
|
1040
1241
|
format?: (value: number) => string;
|
|
1041
|
-
/** Any CSS colour value
|
|
1242
|
+
/** Any CSS colour value.
|
|
1243
|
+
@default the palette's `--uc-series-N` */
|
|
1042
1244
|
color?: string;
|
|
1043
1245
|
/** A role instead of a colour value; the theme resolves it. */
|
|
1044
1246
|
tone?: "ok" | "warning" | "alarm";
|
|
@@ -1046,18 +1248,24 @@ export declare interface ScatterProps<T> {
|
|
|
1046
1248
|
radius?: number;
|
|
1047
1249
|
}
|
|
1048
1250
|
|
|
1251
|
+
/** A `Scatter` as the chart holds it once registered. */
|
|
1049
1252
|
export declare interface ScatterSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
1050
1253
|
kind: "scatter";
|
|
1051
1254
|
/** Point radius in CSS pixels. */
|
|
1052
1255
|
radius: number;
|
|
1053
1256
|
}
|
|
1054
1257
|
|
|
1258
|
+
/** One second in milliseconds, the unit of a time axis. */
|
|
1055
1259
|
export declare const SECOND = 1000;
|
|
1056
1260
|
|
|
1261
|
+
/** What every series registers, whatever its kind: where its values come from,
|
|
1262
|
+
which axes it stands on, and how it is named and coloured. */
|
|
1057
1263
|
export declare interface SeriesBase<T = unknown> {
|
|
1058
|
-
/** Y value; null/undefined/NaN/±Infinity means a gap
|
|
1059
|
-
|
|
1060
|
-
|
|
1264
|
+
/** Y value; null/undefined/NaN/±Infinity means a gap.
|
|
1265
|
+
@remarks R-2.5 */
|
|
1266
|
+
accessor: ValueFunction<T>;
|
|
1267
|
+
/** Series-own data; overrides the container data.
|
|
1268
|
+
@remarks R-2.4 */
|
|
1061
1269
|
data?: readonly T[];
|
|
1062
1270
|
xAxisId: string;
|
|
1063
1271
|
yAxisId: string;
|
|
@@ -1070,12 +1278,13 @@ export declare interface SeriesBase<T = unknown> {
|
|
|
1070
1278
|
For series that mean something rather than just being the next one - the
|
|
1071
1279
|
violating points of a control chart, say. `color` beats it. */
|
|
1072
1280
|
tone?: "ok" | "warning" | "alarm";
|
|
1073
|
-
/** Not drawn, not hit, not in its axes' extent; its legend entry stays. */
|
|
1074
|
-
hidden?: boolean;
|
|
1075
1281
|
}
|
|
1076
1282
|
|
|
1283
|
+
/** Any registered series, told apart by `kind`. */
|
|
1077
1284
|
export declare type SeriesConfig<T = unknown> = LineSeriesConfig<T> | AreaSeriesConfig<T> | BarSeriesConfig<T> | BoxSeriesConfig<T> | ScatterSeriesConfig<T> | StateSeriesConfig<T> | MatrixSeriesConfig<T>;
|
|
1078
1285
|
|
|
1286
|
+
/** The kinds of series a chart draws: `line`, `area`, `bar`, `box`, `scatter`,
|
|
1287
|
+
`state` and `matrix`. The set is closed. */
|
|
1079
1288
|
export declare type SeriesKind = SeriesConfig["kind"];
|
|
1080
1289
|
|
|
1081
1290
|
/** How seriously a violation weighs. Exactly two: one severity that advises and
|
|
@@ -1100,35 +1309,28 @@ declare interface Stackable {
|
|
|
1100
1309
|
normalize?: boolean;
|
|
1101
1310
|
}
|
|
1102
1311
|
|
|
1103
|
-
/**
|
|
1104
|
-
point's. The last one holds until the latest reading of the chart - the
|
|
1105
|
-
last x of any visible series on the same x axis - and where the band itself
|
|
1106
|
-
reports last, one median step of its own x values past its last point;
|
|
1107
|
-
never beyond the x domain. A state is claimed for as long as it was
|
|
1108
|
-
reported, not until the axis' rounded end. */
|
|
1109
|
-
export declare function StateBand<T>(props: StateBandProps<T>): null;
|
|
1110
|
-
|
|
1312
|
+
/** The props of `StateBand`. */
|
|
1111
1313
|
export declare interface StateBandProps<T> {
|
|
1112
|
-
/** Index of the state in `states
|
|
1314
|
+
/** Index of the state in `states` - a number field of the row or a
|
|
1315
|
+
function of it; null/undefined/NaN/±Infinity is a gap -
|
|
1113
1316
|
and a gap stays a hole, it gets no colour for "unknown". A colour would
|
|
1114
1317
|
be a claim about the interval. */
|
|
1115
|
-
|
|
1318
|
+
value: Value<T>;
|
|
1116
1319
|
/** The closed set of states, in the order of their codes. */
|
|
1117
1320
|
states: readonly StateEntry[];
|
|
1118
|
-
/** Binding to an x axis
|
|
1321
|
+
/** Binding to an x axis.
|
|
1322
|
+
@remarks R-4.12 */
|
|
1119
1323
|
xAxisId?: string;
|
|
1120
|
-
/** Binding to a y axis
|
|
1324
|
+
/** Binding to a y axis.
|
|
1325
|
+
@remarks R-4.12 */
|
|
1121
1326
|
yAxisId?: string;
|
|
1122
|
-
/** Series-own data; overrides the container data
|
|
1327
|
+
/** Series-own data; overrides the container data.
|
|
1328
|
+
@remarks R-2.4 */
|
|
1123
1329
|
data?: readonly T[];
|
|
1124
|
-
/** The name in legend and tooltip. Without one
|
|
1125
|
-
|
|
1126
|
-
|
|
1330
|
+
/** The name in legend and tooltip. Without one a warning stands in DEV - an
|
|
1331
|
+
unnamed series is a colour nobody can look up.
|
|
1332
|
+
@default "Series n", after its place in the chart */
|
|
1127
1333
|
name?: string;
|
|
1128
|
-
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
1129
|
-
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
1130
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
1131
|
-
hidden?: boolean;
|
|
1132
1334
|
/** Lower edge of the lane in domain units of the y axis. */
|
|
1133
1335
|
laneFrom?: number;
|
|
1134
1336
|
/** Upper edge of the lane in domain units of the y axis. */
|
|
@@ -1141,6 +1343,8 @@ export declare interface StateEntry {
|
|
|
1141
1343
|
color: string;
|
|
1142
1344
|
}
|
|
1143
1345
|
|
|
1346
|
+
/** A `StateBand` as the chart holds it once registered: its accessor yields
|
|
1347
|
+
an index into `states`. */
|
|
1144
1348
|
export declare interface StateSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
1145
1349
|
kind: "state";
|
|
1146
1350
|
/** The closed set of states. The accessor yields the index into it - a number,
|
|
@@ -1164,13 +1368,19 @@ export declare function subscribeTheme(notify: () => void): () => void;
|
|
|
1164
1368
|
day steps it continues in whole days. */
|
|
1165
1369
|
export declare function timeStep(span: number, count: number): number;
|
|
1166
1370
|
|
|
1371
|
+
/** Turns on the pointer's interaction with a chart: crosshair, hover markers
|
|
1372
|
+
and the tooltip, built in or from `render`. Without it the chart does not
|
|
1373
|
+
answer the pointer. */
|
|
1167
1374
|
export declare function Tooltip<T>(props: TooltipProps<T>): null;
|
|
1168
1375
|
|
|
1376
|
+
/** A `Tooltip` as the chart holds it once registered. */
|
|
1169
1377
|
export declare interface TooltipConfig<T = unknown> {
|
|
1170
1378
|
mode: "x" | "nearest";
|
|
1171
1379
|
render?: (hit: TooltipHit<T>) => ReactNode;
|
|
1172
1380
|
}
|
|
1173
1381
|
|
|
1382
|
+
/** What the pointer hit: the x value under it and one point per series there.
|
|
1383
|
+
A custom tooltip's `render` receives it. */
|
|
1174
1384
|
export declare interface TooltipHit<T = unknown> {
|
|
1175
1385
|
xValue: number;
|
|
1176
1386
|
points: readonly TooltipPoint<T>[];
|
|
@@ -1180,7 +1390,8 @@ export declare interface TooltipHit<T = unknown> {
|
|
|
1180
1390
|
yPx: number;
|
|
1181
1391
|
}
|
|
1182
1392
|
|
|
1183
|
-
/** One hit per series in the tooltip
|
|
1393
|
+
/** One hit per series in the tooltip.
|
|
1394
|
+
@remarks R-4.4 */
|
|
1184
1395
|
export declare interface TooltipPoint<T = unknown> {
|
|
1185
1396
|
seriesName: string;
|
|
1186
1397
|
color: string;
|
|
@@ -1192,11 +1403,11 @@ export declare interface TooltipPoint<T = unknown> {
|
|
|
1192
1403
|
yValue: number;
|
|
1193
1404
|
datum: T;
|
|
1194
1405
|
index: number;
|
|
1195
|
-
/** Only for the matrix:
|
|
1406
|
+
/** Only for the matrix: its level, out of the level channel. It stands here and
|
|
1196
1407
|
not in yValue, because yValue is the position on the y axis - for a matrix
|
|
1197
1408
|
therefore the row. Putting both into one field would be exactly the
|
|
1198
1409
|
overloading ADR-0011 is written against. */
|
|
1199
|
-
|
|
1410
|
+
level?: number;
|
|
1200
1411
|
/** Only for state series: the section being pointed at.
|
|
1201
1412
|
A duration does not stand here - it is the difference of two numbers the
|
|
1202
1413
|
entry already carries, and formatting it would presuppose knowing what the
|
|
@@ -1207,19 +1418,20 @@ export declare interface TooltipPoint<T = unknown> {
|
|
|
1207
1418
|
label: string;
|
|
1208
1419
|
};
|
|
1209
1420
|
/** Only for a box: its further numbers; yValue is its median. Fields of
|
|
1210
|
-
their own for the reason `
|
|
1421
|
+
their own for the reason `level` has one (ADR-0011). */
|
|
1211
1422
|
box?: BoxNumbers & Partial<BoxExtras> & {
|
|
1212
1423
|
/** As the caller gave them; only where the series has `outliers`. */
|
|
1213
1424
|
outliers?: readonly number[];
|
|
1214
1425
|
};
|
|
1215
1426
|
}
|
|
1216
1427
|
|
|
1428
|
+
/** The props of `Tooltip`. */
|
|
1217
1429
|
export declare interface TooltipProps<T> {
|
|
1218
1430
|
/** "x": every series at the x position; "nearest": only the nearest point. */
|
|
1219
1431
|
mode?: "x" | "nearest";
|
|
1220
|
-
/** Render prop for content of one's own
|
|
1221
|
-
|
|
1222
|
-
|
|
1432
|
+
/** Render prop for content of one's own. Compared by its source text, like
|
|
1433
|
+
`tickFormat` - with the same closure limit.
|
|
1434
|
+
@default the built-in tooltip */
|
|
1223
1435
|
render?: (hit: TooltipHit<T>) => ReactNode;
|
|
1224
1436
|
}
|
|
1225
1437
|
|
|
@@ -1258,6 +1470,26 @@ export declare function toWorkingTime(wallClock: number, input: CalendarInput):
|
|
|
1258
1470
|
itself is carried as a gap and is never drawn and never hit. */
|
|
1259
1471
|
export declare function toWorkingTimeClamped(wallClock: number, input: CalendarInput): number;
|
|
1260
1472
|
|
|
1473
|
+
/** A chart over your rows: the parts it returns are typed at your row, so
|
|
1474
|
+
that a field name in `value` is checked by the compiler.
|
|
1475
|
+
@param rows The rows every series reads that brings no `data` of its own.
|
|
1476
|
+
@param options The view to start from and the handler of its changes.
|
|
1477
|
+
@returns `Chart`, `XAxis`, `YAxis` and every series kind - each keeps its
|
|
1478
|
+
identity over the renders -, the `view`, its `domains` and `hidden`, and
|
|
1479
|
+
the setters that change them. */
|
|
1480
|
+
export declare function useChart<Z>(rows: readonly Z[], options?: ChartOptions): ChartParts<Z>;
|
|
1481
|
+
|
|
1482
|
+
/** A value read from the row (ADR-0048): the name of a number field, compared
|
|
1483
|
+
by its name, or a function, compared by its source text (`ValueFunction`). */
|
|
1484
|
+
export declare type Value<T> = NumberField<T> | ValueFunction<T>;
|
|
1485
|
+
|
|
1486
|
+
/** A **value** computed from the row - the function form of `Value`.
|
|
1487
|
+
Compared by its source text, not its identity - an inline function is new
|
|
1488
|
+
on every render. Known limit: one that reads a
|
|
1489
|
+
changed closure variable under the same text is not run again; pass a new
|
|
1490
|
+
data reference then. A native or bound function is compared by identity. */
|
|
1491
|
+
export declare type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
1492
|
+
|
|
1261
1493
|
/** What a value is. Four outcomes, not three.
|
|
1262
1494
|
|
|
1263
1495
|
`unknown` is an outcome of its own and not a `null` return: a `null`
|
|
@@ -1350,13 +1582,19 @@ export declare interface WorkingTimeTick {
|
|
|
1350
1582
|
place the tick, the wall clock time to label it. */
|
|
1351
1583
|
export declare function workingTimeTicks(input: CalendarInput, from: number, to: number, step: number, offset?: number): WorkingTimeTick[];
|
|
1352
1584
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1585
|
+
/** The props of `XAxis`. */
|
|
1586
|
+
export declare interface XAxisProps<T> extends CommonProps {
|
|
1587
|
+
/** Where a row lies on this axis: a number field of the row, compared by
|
|
1588
|
+
its name, or a function of it, compared by its source text as a series'
|
|
1589
|
+
is (`ValueFunction`) - with the same closure limit. The axis reads the
|
|
1590
|
+
rows of every series bound to it; where those bring their own `data`, name
|
|
1591
|
+
their row: `<XAxis<HourCount> value="hour" />`. */
|
|
1592
|
+
value: NumberField<T> | ((d: T, index: number) => number);
|
|
1356
1593
|
/** `"nice"` widens the data's extent to ticks - to named `ticks` where
|
|
1357
1594
|
there are any, on a time axis to whole units of a step of hours or
|
|
1358
|
-
longer -, `"data"` keeps it, a pair is fixed
|
|
1359
|
-
|
|
1595
|
+
longer -, `"data"` keeps it, a pair is fixed. On a `zoomable` axis it is
|
|
1596
|
+
the start: what the axis shows while the chart's view names no span for
|
|
1597
|
+
it. */
|
|
1360
1598
|
domain?: "nice" | "data" | readonly [number, number];
|
|
1361
1599
|
/** Which edge the axis stands at. A second x axis on the opposite edge is how
|
|
1362
1600
|
a series counts in a unit of its own. */
|
|
@@ -1374,18 +1612,24 @@ export declare interface XAxisProps<T> extends CommonProps_2<T> {
|
|
|
1374
1612
|
removed span gets a break mark. The scale stays affine; the mapping happens
|
|
1375
1613
|
in materialisation (ADR-0001). */
|
|
1376
1614
|
calendar?: readonly WorkingInterval[];
|
|
1377
|
-
/** Zoom and pan
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1615
|
+
/** Zoom and pan: Ctrl or ⌘ with the wheel - and a pinch - zoom around the
|
|
1616
|
+
pointer, a drag, a horizontal wheel or Shift with the wheel pan, a double
|
|
1617
|
+
click goes back to `domain`; with the focus on the chart, + and − zoom,
|
|
1618
|
+
Shift with ← or → pans and 0 goes back. The span shown is part of the
|
|
1619
|
+
chart's view, by this axis' `id` (`useChart`'s `initialView`,
|
|
1620
|
+
`onViewChange`, `setDomain`). The plain wheel always scrolls the page.
|
|
1621
|
+
@default false */
|
|
1622
|
+
zoomable?: boolean;
|
|
1623
|
+
/** The narrowest and the widest span zoom may reach, in the axis' units -
|
|
1624
|
+
milliseconds on a time axis.
|
|
1625
|
+
@default at most the data's extent or this axis' own `domain`, whichever
|
|
1626
|
+
is wider, at least three data steps */
|
|
1627
|
+
zoomLimits?: ZoomLimits;
|
|
1384
1628
|
}
|
|
1385
1629
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
export declare interface YAxisProps
|
|
1630
|
+
/** The props of `YAxis`. It reads no value of its own: where a row lies
|
|
1631
|
+
along y is its series' `value`. */
|
|
1632
|
+
export declare interface YAxisProps extends CommonProps {
|
|
1389
1633
|
/** As on the x axis, and `"visible"`: what the series show inside their x
|
|
1390
1634
|
axis' domain - a zoomed hour gets the hour's range, not the week's -,
|
|
1391
1635
|
widened to ticks as `"nice"` is. Where the x domain is not fixed that is
|
|
@@ -1412,4 +1656,11 @@ export declare interface Zone {
|
|
|
1412
1656
|
reader cannot check it against a chart that does not show it. */
|
|
1413
1657
|
export declare function zones(limits: ControlLimits, multiples?: readonly number[]): Zone[];
|
|
1414
1658
|
|
|
1659
|
+
/** The narrowest and the widest span zoom may reach, in the axis' units - the
|
|
1660
|
+
schedule's shape. */
|
|
1661
|
+
export declare interface ZoomLimits {
|
|
1662
|
+
readonly min: number;
|
|
1663
|
+
readonly max: number;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1415
1666
|
export { }
|