@umriss-ui/charts 0.10.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 +122 -0
- package/README.md +22 -6
- package/dist/charts.css +1 -1
- package/dist/charts.js +2781 -2515
- package/dist/de.d.ts +8 -0
- package/dist/index.d.ts +245 -173
- package/dist/wording/de.js +11 -8
- package/docs/llms-full.md +2380 -1535
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
/** Value access of a series. Compared by its source text, not its identity - an
|
|
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
|
-
/** 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. */
|
|
13
|
-
export declare function Area<T>(props: AreaProps<T>): null;
|
|
14
|
-
|
|
15
4
|
/** The props of `Area`. */
|
|
16
5
|
export declare interface AreaProps<T> {
|
|
17
|
-
/** Upper edge
|
|
6
|
+
/** Upper edge - a number field of the row or a function of it;
|
|
7
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
18
8
|
@remarks R-2.5 */
|
|
19
|
-
|
|
20
|
-
/** Lower edge. In a `stack` the stack below is the lower edge, and this is
|
|
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
|
|
21
11
|
not read.
|
|
22
12
|
@default a fixed baseline at 0 */
|
|
23
|
-
baseline?:
|
|
13
|
+
baseline?: Value<T>;
|
|
24
14
|
/** Binding to an x axis.
|
|
25
15
|
@remarks R-4.12 */
|
|
26
16
|
xAxisId?: string;
|
|
@@ -34,10 +24,6 @@ export declare interface AreaProps<T> {
|
|
|
34
24
|
unnamed series is a colour nobody can look up.
|
|
35
25
|
@default "Series n", after its place in the chart */
|
|
36
26
|
name?: string;
|
|
37
|
-
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
38
|
-
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
39
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
40
|
-
hidden?: boolean;
|
|
41
27
|
/** The value as the tooltip writes it.
|
|
42
28
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
43
29
|
format?: (value: number) => string;
|
|
@@ -72,7 +58,7 @@ export declare interface AreaProps<T> {
|
|
|
72
58
|
export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
73
59
|
kind: "area";
|
|
74
60
|
/** Lower edge; without a value the fixed baseline 0. */
|
|
75
|
-
baseline?:
|
|
61
|
+
baseline?: ValueFunction<T>;
|
|
76
62
|
/** Opacity of the fill; the outline stays fully opaque. */
|
|
77
63
|
fillOpacity: number;
|
|
78
64
|
strokeWidth: number;
|
|
@@ -123,7 +109,9 @@ export declare interface AxisConfig<T = unknown> {
|
|
|
123
109
|
id: string;
|
|
124
110
|
orientation: AxisOrientation;
|
|
125
111
|
position: AxisPosition;
|
|
126
|
-
|
|
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;
|
|
127
115
|
label?: string;
|
|
128
116
|
tickCount?: number;
|
|
129
117
|
tickFormat?: (v: number) => string;
|
|
@@ -147,9 +135,12 @@ export declare interface AxisConfig<T = unknown> {
|
|
|
147
135
|
calendar?: readonly WorkingInterval[];
|
|
148
136
|
/** y axes only: this axis' ticks on the first y axis' grid. */
|
|
149
137
|
alignTicks?: boolean;
|
|
150
|
-
/** x axes only:
|
|
151
|
-
|
|
152
|
-
|
|
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;
|
|
153
144
|
}
|
|
154
145
|
|
|
155
146
|
/** Whether an axis or a limit runs along x or along y. */
|
|
@@ -159,17 +150,15 @@ export declare type AxisOrientation = "x" | "y";
|
|
|
159
150
|
`right` for y. */
|
|
160
151
|
export declare type AxisPosition = "bottom" | "top" | "left" | "right";
|
|
161
152
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
164
|
-
`stack`. Renders nothing itself: it registers with the surrounding
|
|
165
|
-
`Chart`. */
|
|
166
|
-
export declare function Bar<T>(props: BarProps<T>): null;
|
|
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]>>;
|
|
167
155
|
|
|
168
156
|
/** The props of `Bar`. */
|
|
169
157
|
export declare interface BarProps<T> {
|
|
170
|
-
/** Height
|
|
158
|
+
/** Height - a number field of the row or a function of it;
|
|
159
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
171
160
|
@remarks R-2.5 */
|
|
172
|
-
|
|
161
|
+
value: Value<T>;
|
|
173
162
|
/** Binding to an x axis.
|
|
174
163
|
@remarks R-4.12 */
|
|
175
164
|
xAxisId?: string;
|
|
@@ -183,10 +172,6 @@ export declare interface BarProps<T> {
|
|
|
183
172
|
unnamed series is a colour nobody can look up.
|
|
184
173
|
@default "Series n", after its place in the chart */
|
|
185
174
|
name?: string;
|
|
186
|
-
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
187
|
-
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
188
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
189
|
-
hidden?: boolean;
|
|
190
175
|
/** The value as the tooltip writes it.
|
|
191
176
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
192
177
|
format?: (value: number) => string;
|
|
@@ -250,42 +235,37 @@ export declare interface BoxNumbers<V = number> {
|
|
|
250
235
|
upperWhisker: V;
|
|
251
236
|
}
|
|
252
237
|
|
|
253
|
-
/**
|
|
254
|
-
|
|
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`. */
|
|
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. */
|
|
260
240
|
export declare interface BoxPlotProps<T> {
|
|
261
241
|
/** The line across the box; null/undefined/NaN/±Infinity means a gap - no
|
|
262
242
|
box is drawn there, whatever the other numbers say.
|
|
263
243
|
@remarks R-2.5 */
|
|
264
|
-
median:
|
|
244
|
+
median: Value<T>;
|
|
265
245
|
/** The box's lower edge. */
|
|
266
|
-
lowerQuartile:
|
|
246
|
+
lowerQuartile: Value<T>;
|
|
267
247
|
/** The box's upper edge. */
|
|
268
|
-
upperQuartile:
|
|
248
|
+
upperQuartile: Value<T>;
|
|
269
249
|
/** Where the lower whisker ends - the caller's rule, not the minimum. */
|
|
270
|
-
lowerWhisker:
|
|
250
|
+
lowerWhisker: Value<T>;
|
|
271
251
|
/** Where the upper whisker ends - the caller's rule, not the maximum. */
|
|
272
|
-
upperWhisker:
|
|
252
|
+
upperWhisker: Value<T>;
|
|
273
253
|
/** The values beyond the whiskers, per box: an array, empty or missing
|
|
274
254
|
where there are none. Drawn with their box in its colour - one beyond
|
|
275
255
|
three IQR of the box's own quartiles as a ring -, read in its tooltip
|
|
276
256
|
and table row, never hit on their own (ADR-0040). */
|
|
277
|
-
outliers?:
|
|
257
|
+
outliers?: ListValue<T>;
|
|
278
258
|
/** The mean, drawn as a small ×: beside the median it shows a skew. */
|
|
279
|
-
mean?:
|
|
259
|
+
mean?: Value<T>;
|
|
280
260
|
/** The notch's lower bound - usually of a confidence interval of the
|
|
281
261
|
median. Both bounds or neither: one alone warns in DEV and is not
|
|
282
262
|
drawn. */
|
|
283
|
-
notchLower?:
|
|
263
|
+
notchLower?: Value<T>;
|
|
284
264
|
/** The notch's upper bound; see `notchLower`. */
|
|
285
|
-
notchUpper?:
|
|
265
|
+
notchUpper?: Value<T>;
|
|
286
266
|
/** How many values stand behind the box; read in the tooltip and the
|
|
287
267
|
table, not drawn. */
|
|
288
|
-
count?:
|
|
268
|
+
count?: Value<T>;
|
|
289
269
|
/** Binding to an x axis.
|
|
290
270
|
@remarks R-4.12 */
|
|
291
271
|
xAxisId?: string;
|
|
@@ -298,9 +278,6 @@ export declare interface BoxPlotProps<T> {
|
|
|
298
278
|
/** The name in legend and tooltip. Without one a warning stands in DEV.
|
|
299
279
|
@default "Series n", after its place in the chart */
|
|
300
280
|
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
281
|
/** Every number of the box as the tooltip and the table write it.
|
|
305
282
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
306
283
|
format?: (value: number) => string;
|
|
@@ -321,18 +298,18 @@ export declare interface BoxPlotProps<T> {
|
|
|
321
298
|
chose - the library draws them and computes none. */
|
|
322
299
|
export declare interface BoxSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
323
300
|
kind: "box";
|
|
324
|
-
lowerQuartile:
|
|
325
|
-
upperQuartile:
|
|
326
|
-
lowerWhisker:
|
|
327
|
-
upperWhisker:
|
|
301
|
+
lowerQuartile: ValueFunction<T>;
|
|
302
|
+
upperQuartile: ValueFunction<T>;
|
|
303
|
+
lowerWhisker: ValueFunction<T>;
|
|
304
|
+
upperWhisker: ValueFunction<T>;
|
|
328
305
|
/** The values beyond the whiskers, per box (ADR-0040). */
|
|
329
|
-
outliers?:
|
|
330
|
-
mean?:
|
|
306
|
+
outliers?: ListFunction<T>;
|
|
307
|
+
mean?: ValueFunction<T>;
|
|
331
308
|
/** Both bounds or neither (CONTEXT.md: Notch). */
|
|
332
|
-
notchLower?:
|
|
333
|
-
notchUpper?:
|
|
309
|
+
notchLower?: ValueFunction<T>;
|
|
310
|
+
notchUpper?: ValueFunction<T>;
|
|
334
311
|
/** How many values stand behind the box; no y value. */
|
|
335
|
-
count?:
|
|
312
|
+
count?: ValueFunction<T>;
|
|
336
313
|
/** Width as a fraction of the step; boxes and bars on one x axis share it. */
|
|
337
314
|
boxWidth: number;
|
|
338
315
|
}
|
|
@@ -349,10 +326,58 @@ export declare function calendarFrom(input: CalendarInput): WorkingCalendar;
|
|
|
349
326
|
axis, or the calendar built from it. */
|
|
350
327
|
export declare type CalendarInput = WorkingCalendar | readonly WorkingInterval[];
|
|
351
328
|
|
|
352
|
-
/**
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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
|
+
}
|
|
356
381
|
|
|
357
382
|
/** Measurements of the instrumentation for the benchmark page.
|
|
358
383
|
@remarks R-5.1 */
|
|
@@ -362,11 +387,9 @@ export declare interface ChartPerf {
|
|
|
362
387
|
points: number;
|
|
363
388
|
}
|
|
364
389
|
|
|
365
|
-
/** The props of `Chart`.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
@remarks R-2.4 */
|
|
369
|
-
data: readonly T[];
|
|
390
|
+
/** The props of `Chart`. Its rows are not among them: `useChart(rows)` binds
|
|
391
|
+
them (ADR-0048). */
|
|
392
|
+
export declare interface ChartProps {
|
|
370
393
|
/** Width in CSS pixels, or `"100%"` for the host's: the chart measures its
|
|
371
394
|
host and follows it through a ResizeObserver.
|
|
372
395
|
@default "100%" */
|
|
@@ -405,8 +428,9 @@ export declare interface ChartProps<T> {
|
|
|
405
428
|
encoding?: "color" | "marks";
|
|
406
429
|
/** Charts with the same id share the pointer's x position, in domain units:
|
|
407
430
|
each draws its crosshair there, the tooltip stays with the chart under
|
|
408
|
-
the pointer. Zoom is not shared
|
|
409
|
-
`
|
|
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`). */
|
|
410
434
|
syncId?: string;
|
|
411
435
|
/** Instrumentation for the benchmark page; not needed otherwise.
|
|
412
436
|
@remarks R-5.1 */
|
|
@@ -448,6 +472,14 @@ export declare interface ChartsWording {
|
|
|
448
472
|
walkHelp: string;
|
|
449
473
|
/** The keys that zoom and pan it - only where the chart can be zoomed. */
|
|
450
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;
|
|
451
483
|
/** The data table's disclosure key, closed and open (charts-alternatives
|
|
452
484
|
C1). */
|
|
453
485
|
showData: string;
|
|
@@ -479,13 +511,21 @@ export declare interface ChartsWording {
|
|
|
479
511
|
downsampled: (readings: number) => string;
|
|
480
512
|
}
|
|
481
513
|
|
|
482
|
-
|
|
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[];
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
declare interface CommonProps {
|
|
483
526
|
/** Axis id, through which series bind themselves.
|
|
484
527
|
@remarks R-4.12 */
|
|
485
528
|
id?: string;
|
|
486
|
-
/** Value access of this axis. Compared by its source text, as a series'
|
|
487
|
-
accessor is (`Accessor`) - with the same closure limit. */
|
|
488
|
-
accessor: (d: T, index: number) => number;
|
|
489
529
|
/** Axis title. */
|
|
490
530
|
label?: string;
|
|
491
531
|
/** Target value; the 1-2-5 algorithm may deviate. */
|
|
@@ -513,8 +553,9 @@ export declare function ControlChart<T>(props: ControlChartProps<T>): ReactNode;
|
|
|
513
553
|
|
|
514
554
|
/** The props of `ControlChart`. */
|
|
515
555
|
export declare interface ControlChartProps<T> {
|
|
516
|
-
/** The values of the chart
|
|
517
|
-
|
|
556
|
+
/** The values of the chart - a number field of its `data`'s rows or a
|
|
557
|
+
function of them. */
|
|
558
|
+
value: Value<T>;
|
|
518
559
|
/** Required: the limits arise out of these values, not out of what happens to
|
|
519
560
|
be visible. */
|
|
520
561
|
data: readonly T[];
|
|
@@ -630,6 +671,27 @@ export declare const DEFAULT_GRADIENT: readonly string[];
|
|
|
630
671
|
lengths are therefore parameters. */
|
|
631
672
|
export declare const defaultRules: RuleOptions;
|
|
632
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
|
+
|
|
633
695
|
/** One hour in milliseconds. */
|
|
634
696
|
export declare const HOUR: number;
|
|
635
697
|
|
|
@@ -638,9 +700,12 @@ export declare const HOUR: number;
|
|
|
638
700
|
export declare function invalidateTheme(): void;
|
|
639
701
|
|
|
640
702
|
/** The legend of a chart: one entry per series, or per state of a state band.
|
|
641
|
-
Hovering an entry highlights its series;
|
|
642
|
-
|
|
643
|
-
|
|
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;
|
|
644
709
|
|
|
645
710
|
/** A `Legend` as the chart holds it once registered. */
|
|
646
711
|
export declare interface LegendConfig {
|
|
@@ -652,10 +717,6 @@ export declare interface LegendProps {
|
|
|
652
717
|
/** Which side of the plot area the legend stands on.
|
|
653
718
|
@default "top" */
|
|
654
719
|
placement?: "top" | "bottom";
|
|
655
|
-
/** Called with an entry's name when it is clicked - the series' name, or a
|
|
656
|
-
state's label. The caller flips `hidden` on the series it means. Without
|
|
657
|
-
it the legend is not clickable. */
|
|
658
|
-
onToggle?: (name: string) => void;
|
|
659
720
|
}
|
|
660
721
|
|
|
661
722
|
/** A bound: a value, a side and a severity. No more - a tolerance band is
|
|
@@ -779,10 +840,6 @@ export declare interface LimitSet {
|
|
|
779
840
|
target?: number;
|
|
780
841
|
}
|
|
781
842
|
|
|
782
|
-
/** A series drawn as a line through its values; a gap breaks it. Renders
|
|
783
|
-
nothing itself: it registers with the surrounding `Chart`. */
|
|
784
|
-
export declare function Line<T>(props: LineProps<T>): null;
|
|
785
|
-
|
|
786
843
|
/** The affine mapping from a domain onto a pixel range, and back; the scale
|
|
787
844
|
every axis of the library uses. */
|
|
788
845
|
export declare class LinearScale implements Scale {
|
|
@@ -799,9 +856,10 @@ export declare class LinearScale implements Scale {
|
|
|
799
856
|
|
|
800
857
|
/** The props of `Line`. */
|
|
801
858
|
export declare interface LineProps<T> {
|
|
802
|
-
/** Y value
|
|
859
|
+
/** Y value - a number field of the row or a function of it;
|
|
860
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
803
861
|
@remarks R-2.5 */
|
|
804
|
-
|
|
862
|
+
value: Value<T>;
|
|
805
863
|
/** Binding to an x axis.
|
|
806
864
|
@remarks R-4.12 */
|
|
807
865
|
xAxisId?: string;
|
|
@@ -815,10 +873,6 @@ export declare interface LineProps<T> {
|
|
|
815
873
|
unnamed series is a colour nobody can look up.
|
|
816
874
|
@default "Series n", after its place in the chart */
|
|
817
875
|
name?: string;
|
|
818
|
-
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
819
|
-
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
820
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
821
|
-
hidden?: boolean;
|
|
822
876
|
/** The value as the tooltip writes it.
|
|
823
877
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
824
878
|
format?: (value: number) => string;
|
|
@@ -852,9 +906,18 @@ export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
|
852
906
|
step?: boolean;
|
|
853
907
|
}
|
|
854
908
|
|
|
855
|
-
/**
|
|
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
|
|
856
916
|
empty array is none; a value that is not finite is left out. */
|
|
857
|
-
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>;
|
|
858
921
|
|
|
859
922
|
/** The local offset at an instant, as the shift of a grid that is to lie on
|
|
860
923
|
local time: `wallClock = offset + k · step`. Taken at one instant, it holds
|
|
@@ -875,7 +938,7 @@ export declare interface MaterializedSeries {
|
|
|
875
938
|
A fixed baseline needs no channel - it is a number.
|
|
876
939
|
@remarks R-2.7 */
|
|
877
940
|
y0: Float64Array | null;
|
|
878
|
-
/**
|
|
941
|
+
/** Level channel: the third value per point, which today only the matrix
|
|
879
942
|
needs. Named rather than overloading y0 - a property that only some kinds
|
|
880
943
|
carry does not belong in the shared type with a comment (ADR-0011). null
|
|
881
944
|
for every kind that does not use it. */
|
|
@@ -886,12 +949,6 @@ export declare interface MaterializedSeries {
|
|
|
886
949
|
length: number;
|
|
887
950
|
}
|
|
888
951
|
|
|
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`. */
|
|
893
|
-
export declare function Matrix<T>(props: MatrixProps<T>): null;
|
|
894
|
-
|
|
895
952
|
/** How a matrix colours its cells. Discretely by assessment - the same limits
|
|
896
953
|
that colour a tile - or across a gradient. */
|
|
897
954
|
export declare type MatrixColoring = {
|
|
@@ -912,11 +969,13 @@ export declare type MatrixColoring = {
|
|
|
912
969
|
|
|
913
970
|
/** The props of `Matrix`. */
|
|
914
971
|
export declare interface MatrixProps<T> {
|
|
915
|
-
/** Row position on the y axis
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
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
|
|
920
979
|
a gradient.
|
|
921
980
|
@default { kind: "gradient", stops: DEFAULT_GRADIENT } */
|
|
922
981
|
coloring?: MatrixColoring;
|
|
@@ -933,29 +992,30 @@ export declare interface MatrixProps<T> {
|
|
|
933
992
|
unnamed series is a colour nobody can look up.
|
|
934
993
|
@default "Series n", after its place in the chart */
|
|
935
994
|
name?: string;
|
|
936
|
-
/**
|
|
937
|
-
|
|
938
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
939
|
-
hidden?: boolean;
|
|
940
|
-
/** The value as the tooltip writes it. The y axis' `tickFormat` writes the
|
|
941
|
-
row, not the value.
|
|
995
|
+
/** The level as the tooltip writes it. The y axis' `tickFormat` writes the
|
|
996
|
+
row, not the level.
|
|
942
997
|
@default the built-in number format */
|
|
943
998
|
format?: (value: number) => string;
|
|
944
999
|
}
|
|
945
1000
|
|
|
946
1001
|
/** A `Matrix` as the chart holds it once registered: its base accessor is the
|
|
947
|
-
row, `
|
|
1002
|
+
row, `level` the colour. */
|
|
948
1003
|
export declare interface MatrixSeriesConfig<T = unknown> extends SeriesBase<T> {
|
|
949
1004
|
kind: "matrix";
|
|
950
|
-
/** The
|
|
951
|
-
The base accessor yields the row position, not this
|
|
952
|
-
|
|
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>;
|
|
953
1008
|
coloring: MatrixColoring;
|
|
954
1009
|
}
|
|
955
1010
|
|
|
956
1011
|
/** One minute in milliseconds. */
|
|
957
1012
|
export declare const MINUTE: number;
|
|
958
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
|
+
|
|
959
1019
|
/** Space in CSS pixels on each side of a rectangle. */
|
|
960
1020
|
export declare interface Padding {
|
|
961
1021
|
top: number;
|
|
@@ -1157,15 +1217,12 @@ export declare interface Scale {
|
|
|
1157
1217
|
ticks(n: number): number[];
|
|
1158
1218
|
}
|
|
1159
1219
|
|
|
1160
|
-
/** A series drawn as points only, one per value. Renders nothing itself: it
|
|
1161
|
-
registers with the surrounding `Chart`. */
|
|
1162
|
-
export declare function Scatter<T>(props: ScatterProps<T>): null;
|
|
1163
|
-
|
|
1164
1220
|
/** The props of `Scatter`. */
|
|
1165
1221
|
export declare interface ScatterProps<T> {
|
|
1166
|
-
/** Y value
|
|
1222
|
+
/** Y value - a number field of the row or a function of it;
|
|
1223
|
+
null/undefined/NaN/±Infinity means a gap.
|
|
1167
1224
|
@remarks R-2.5 */
|
|
1168
|
-
|
|
1225
|
+
value: Value<T>;
|
|
1169
1226
|
/** Binding to an x axis.
|
|
1170
1227
|
@remarks R-4.12 */
|
|
1171
1228
|
xAxisId?: string;
|
|
@@ -1179,10 +1236,6 @@ export declare interface ScatterProps<T> {
|
|
|
1179
1236
|
unnamed series is a colour nobody can look up.
|
|
1180
1237
|
@default "Series n", after its place in the chart */
|
|
1181
1238
|
name?: string;
|
|
1182
|
-
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
1183
|
-
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
1184
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
1185
|
-
hidden?: boolean;
|
|
1186
1239
|
/** The value as the tooltip writes it.
|
|
1187
1240
|
@default the y axis' `tickFormat`, else the built-in number format */
|
|
1188
1241
|
format?: (value: number) => string;
|
|
@@ -1210,7 +1263,7 @@ export declare const SECOND = 1000;
|
|
|
1210
1263
|
export declare interface SeriesBase<T = unknown> {
|
|
1211
1264
|
/** Y value; null/undefined/NaN/±Infinity means a gap.
|
|
1212
1265
|
@remarks R-2.5 */
|
|
1213
|
-
accessor:
|
|
1266
|
+
accessor: ValueFunction<T>;
|
|
1214
1267
|
/** Series-own data; overrides the container data.
|
|
1215
1268
|
@remarks R-2.4 */
|
|
1216
1269
|
data?: readonly T[];
|
|
@@ -1225,8 +1278,6 @@ export declare interface SeriesBase<T = unknown> {
|
|
|
1225
1278
|
For series that mean something rather than just being the next one - the
|
|
1226
1279
|
violating points of a control chart, say. `color` beats it. */
|
|
1227
1280
|
tone?: "ok" | "warning" | "alarm";
|
|
1228
|
-
/** Not drawn, not hit, not in its axes' extent; its legend entry stays. */
|
|
1229
|
-
hidden?: boolean;
|
|
1230
1281
|
}
|
|
1231
1282
|
|
|
1232
1283
|
/** Any registered series, told apart by `kind`. */
|
|
@@ -1258,20 +1309,13 @@ declare interface Stackable {
|
|
|
1258
1309
|
normalize?: boolean;
|
|
1259
1310
|
}
|
|
1260
1311
|
|
|
1261
|
-
/** A band of states: each point's state holds from its x until the next
|
|
1262
|
-
point's. The last one holds until the latest reading of the chart - the
|
|
1263
|
-
last x of any visible series on the same x axis - and where the band itself
|
|
1264
|
-
reports last, one median step of its own x values past its last point;
|
|
1265
|
-
never beyond the x domain. A state is claimed for as long as it was
|
|
1266
|
-
reported, not until the axis' rounded end. */
|
|
1267
|
-
export declare function StateBand<T>(props: StateBandProps<T>): null;
|
|
1268
|
-
|
|
1269
1312
|
/** The props of `StateBand`. */
|
|
1270
1313
|
export declare interface StateBandProps<T> {
|
|
1271
|
-
/** 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 -
|
|
1272
1316
|
and a gap stays a hole, it gets no colour for "unknown". A colour would
|
|
1273
1317
|
be a claim about the interval. */
|
|
1274
|
-
|
|
1318
|
+
value: Value<T>;
|
|
1275
1319
|
/** The closed set of states, in the order of their codes. */
|
|
1276
1320
|
states: readonly StateEntry[];
|
|
1277
1321
|
/** Binding to an x axis.
|
|
@@ -1287,10 +1331,6 @@ export declare interface StateBandProps<T> {
|
|
|
1287
1331
|
unnamed series is a colour nobody can look up.
|
|
1288
1332
|
@default "Series n", after its place in the chart */
|
|
1289
1333
|
name?: string;
|
|
1290
|
-
/** Not drawn, not hit and not counted for its axes' extent - a fixed
|
|
1291
|
-
`domain` keeps the axis still. Its legend entry stays, drawn back.
|
|
1292
|
-
Controlled: the caller sets it, typically from `Legend onToggle`. */
|
|
1293
|
-
hidden?: boolean;
|
|
1294
1334
|
/** Lower edge of the lane in domain units of the y axis. */
|
|
1295
1335
|
laneFrom?: number;
|
|
1296
1336
|
/** Upper edge of the lane in domain units of the y axis. */
|
|
@@ -1363,11 +1403,11 @@ export declare interface TooltipPoint<T = unknown> {
|
|
|
1363
1403
|
yValue: number;
|
|
1364
1404
|
datum: T;
|
|
1365
1405
|
index: number;
|
|
1366
|
-
/** Only for the matrix:
|
|
1406
|
+
/** Only for the matrix: its level, out of the level channel. It stands here and
|
|
1367
1407
|
not in yValue, because yValue is the position on the y axis - for a matrix
|
|
1368
1408
|
therefore the row. Putting both into one field would be exactly the
|
|
1369
1409
|
overloading ADR-0011 is written against. */
|
|
1370
|
-
|
|
1410
|
+
level?: number;
|
|
1371
1411
|
/** Only for state series: the section being pointed at.
|
|
1372
1412
|
A duration does not stand here - it is the difference of two numbers the
|
|
1373
1413
|
entry already carries, and formatting it would presuppose knowing what the
|
|
@@ -1378,7 +1418,7 @@ export declare interface TooltipPoint<T = unknown> {
|
|
|
1378
1418
|
label: string;
|
|
1379
1419
|
};
|
|
1380
1420
|
/** Only for a box: its further numbers; yValue is its median. Fields of
|
|
1381
|
-
their own for the reason `
|
|
1421
|
+
their own for the reason `level` has one (ADR-0011). */
|
|
1382
1422
|
box?: BoxNumbers & Partial<BoxExtras> & {
|
|
1383
1423
|
/** As the caller gave them; only where the series has `outliers`. */
|
|
1384
1424
|
outliers?: readonly number[];
|
|
@@ -1430,6 +1470,26 @@ export declare function toWorkingTime(wallClock: number, input: CalendarInput):
|
|
|
1430
1470
|
itself is carried as a gap and is never drawn and never hit. */
|
|
1431
1471
|
export declare function toWorkingTimeClamped(wallClock: number, input: CalendarInput): number;
|
|
1432
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
|
+
|
|
1433
1493
|
/** What a value is. Four outcomes, not three.
|
|
1434
1494
|
|
|
1435
1495
|
`unknown` is an outcome of its own and not a `null` return: a `null`
|
|
@@ -1522,17 +1582,19 @@ export declare interface WorkingTimeTick {
|
|
|
1522
1582
|
place the tick, the wall clock time to label it. */
|
|
1523
1583
|
export declare function workingTimeTicks(input: CalendarInput, from: number, to: number, step: number, offset?: number): WorkingTimeTick[];
|
|
1524
1584
|
|
|
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. */
|
|
1528
|
-
export declare function XAxis<T>(props: XAxisProps<T>): null;
|
|
1529
|
-
|
|
1530
1585
|
/** The props of `XAxis`. */
|
|
1531
|
-
export declare interface XAxisProps<T> extends CommonProps
|
|
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);
|
|
1532
1593
|
/** `"nice"` widens the data's extent to ticks - to named `ticks` where
|
|
1533
1594
|
there are any, on a time axis to whole units of a step of hours or
|
|
1534
|
-
longer -, `"data"` keeps it, a pair is fixed
|
|
1535
|
-
|
|
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. */
|
|
1536
1598
|
domain?: "nice" | "data" | readonly [number, number];
|
|
1537
1599
|
/** Which edge the axis stands at. A second x axis on the opposite edge is how
|
|
1538
1600
|
a series counts in a unit of its own. */
|
|
@@ -1550,21 +1612,24 @@ export declare interface XAxisProps<T> extends CommonProps<T> {
|
|
|
1550
1612
|
removed span gets a break mark. The scale stays affine; the mapping happens
|
|
1551
1613
|
in materialisation (ADR-0001). */
|
|
1552
1614
|
calendar?: readonly WorkingInterval[];
|
|
1553
|
-
/** Zoom and pan
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
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;
|
|
1560
1628
|
}
|
|
1561
1629
|
|
|
1562
|
-
/**
|
|
1563
|
-
|
|
1564
|
-
export declare
|
|
1565
|
-
|
|
1566
|
-
/** The props of `YAxis`. */
|
|
1567
|
-
export declare interface YAxisProps<T> extends CommonProps<T> {
|
|
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 {
|
|
1568
1633
|
/** As on the x axis, and `"visible"`: what the series show inside their x
|
|
1569
1634
|
axis' domain - a zoomed hour gets the hour's range, not the week's -,
|
|
1570
1635
|
widened to ticks as `"nice"` is. Where the x domain is not fixed that is
|
|
@@ -1591,4 +1656,11 @@ export declare interface Zone {
|
|
|
1591
1656
|
reader cannot check it against a chart that does not show it. */
|
|
1592
1657
|
export declare function zones(limits: ControlLimits, multiples?: readonly number[]): Zone[];
|
|
1593
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
|
+
|
|
1594
1666
|
export { }
|