@umriss-ui/charts 0.5.0 → 0.7.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 +114 -0
- package/README.md +27 -7
- package/dist/charts.css +1 -1
- package/dist/charts.js +2686 -1689
- package/dist/de.d.ts +47 -0
- package/dist/index.d.ts +108 -5
- package/dist/wording/de.d.ts +2 -0
- package/dist/wording/de.js +21 -0
- package/docs/llms-full.md +4031 -0
- package/package.json +7 -2
package/dist/de.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare interface ChartsWording {
|
|
2
|
+
/** What a screen reader calls the plot area that takes the keys
|
|
3
|
+
(`aria-roledescription`). */
|
|
4
|
+
roleDescription: string;
|
|
5
|
+
/** Shown in the plot area when no visible series has a point to show. */
|
|
6
|
+
empty: string;
|
|
7
|
+
/** The summary's visible series, by name. */
|
|
8
|
+
seriesList: (names: readonly string[]) => string;
|
|
9
|
+
/** The summary's visible stretch of the x axis, both ends formatted. */
|
|
10
|
+
visibleRange: (from: string, to: string) => string;
|
|
11
|
+
/** The summary's lowest and highest value of one series in that stretch. */
|
|
12
|
+
seriesExtent: (name: string, min: string, max: string) => string;
|
|
13
|
+
/** What is read after a key: the position, then each series with its value
|
|
14
|
+
(and its own x where it stands on another x axis), the emphasised one
|
|
15
|
+
first. */
|
|
16
|
+
readout: (x: string, rows: readonly {
|
|
17
|
+
name: string;
|
|
18
|
+
value: string;
|
|
19
|
+
x: string;
|
|
20
|
+
}[]) => string;
|
|
21
|
+
/** The last row of a stack in the tooltip and the readout: the sum of its
|
|
22
|
+
members at the point (charts-stacking K4). */
|
|
23
|
+
stackTotal: string;
|
|
24
|
+
/** A share in a normalised stack, its number already formatted (K5). */
|
|
25
|
+
percent: (value: string) => string;
|
|
26
|
+
/** The keys that walk the chart. */
|
|
27
|
+
walkHelp: string;
|
|
28
|
+
/** The keys that zoom and pan it - only where the chart can be zoomed. */
|
|
29
|
+
zoomHelp: string;
|
|
30
|
+
/** The data table's disclosure key, closed and open (charts-alternatives
|
|
31
|
+
C1). */
|
|
32
|
+
showData: string;
|
|
33
|
+
hideData: string;
|
|
34
|
+
/** The heading of the table's x column where its axis has no `label`, and
|
|
35
|
+
of a matrix' row column where its y axis has none. */
|
|
36
|
+
positionColumn: string;
|
|
37
|
+
rowColumn: string;
|
|
38
|
+
/** The table's caption: the visible stretch it lists, both ends formatted. */
|
|
39
|
+
tableCaption: (from: string, to: string) => string;
|
|
40
|
+
/** Added to the caption where the table shows the downsampled course (C2):
|
|
41
|
+
how many readings its rows stand for. */
|
|
42
|
+
downsampled: (readings: number) => string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare const GERMAN_CHARTS_WORDING: ChartsWording;
|
|
46
|
+
|
|
47
|
+
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ export declare function Area<T>(props: AreaProps<T>): null;
|
|
|
12
12
|
export declare interface AreaProps<T> {
|
|
13
13
|
/** Upper edge; null/undefined/NaN/±Infinity means a gap (R-2.5). */
|
|
14
14
|
accessor: Accessor<T>;
|
|
15
|
-
/** Lower edge; without a value the fixed baseline 0.
|
|
15
|
+
/** Lower edge; without a value the fixed baseline 0. In a `stack` the stack
|
|
16
|
+
below is the lower edge, and this is not read. */
|
|
16
17
|
baseline?: Accessor<T>;
|
|
17
18
|
/** Binding to an x axis (R-4.12). */
|
|
18
19
|
xAxisId?: string;
|
|
@@ -36,6 +37,16 @@ export declare interface AreaProps<T> {
|
|
|
36
37
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
37
38
|
it. */
|
|
38
39
|
tone?: "ok" | "warning" | "alarm";
|
|
40
|
+
/** The stack this series stands in: every Bar and Area with the same id on
|
|
41
|
+
the same x and y axis stands on the ones registered before it. A gap
|
|
42
|
+
stacks as zero; negative values stack downward from zero. The tooltip
|
|
43
|
+
names each series' own value and the stack's total. */
|
|
44
|
+
stack?: string;
|
|
45
|
+
/** On any member of a stack, every x of the stack sums to 100 %: each value
|
|
46
|
+
becomes its share, and the y axis reads in percent unless it has a
|
|
47
|
+
`tickFormat`. The total stays the readings' own sum, written in the
|
|
48
|
+
series' `format`. */
|
|
49
|
+
normalize?: boolean;
|
|
39
50
|
/** Opacity of the fill, from 0 to 1; the outline stays fully opaque. */
|
|
40
51
|
fillOpacity?: number;
|
|
41
52
|
/** Width of the outline along the upper edge in CSS pixels; 0 leaves it
|
|
@@ -46,7 +57,7 @@ export declare interface AreaProps<T> {
|
|
|
46
57
|
dash?: readonly number[];
|
|
47
58
|
}
|
|
48
59
|
|
|
49
|
-
export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T
|
|
60
|
+
export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
50
61
|
kind: "area";
|
|
51
62
|
/** Lower edge; without a value the fixed baseline 0. */
|
|
52
63
|
baseline?: Accessor<T>;
|
|
@@ -158,12 +169,22 @@ export declare interface BarProps<T> {
|
|
|
158
169
|
/** A role instead of a colour value; the theme resolves it. `color` beats
|
|
159
170
|
it. */
|
|
160
171
|
tone?: "ok" | "warning" | "alarm";
|
|
172
|
+
/** The stack this series stands in: every Bar and Area with the same id on
|
|
173
|
+
the same x and y axis stands on the ones registered before it. A gap
|
|
174
|
+
stacks as zero; negative values stack downward from zero. The tooltip
|
|
175
|
+
names each series' own value and the stack's total. */
|
|
176
|
+
stack?: string;
|
|
177
|
+
/** On any member of a stack, every x of the stack sums to 100 %: each value
|
|
178
|
+
becomes its share, and the y axis reads in percent unless it has a
|
|
179
|
+
`tickFormat`. The total stays the readings' own sum, written in the
|
|
180
|
+
series' `format`. */
|
|
181
|
+
normalize?: boolean;
|
|
161
182
|
/** Width as a fraction of the step; just under 1, so that neighbours do not
|
|
162
183
|
touch. Several bar series share this fraction. */
|
|
163
184
|
barWidth?: number;
|
|
164
185
|
}
|
|
165
186
|
|
|
166
|
-
export declare interface BarSeriesConfig<T = unknown> extends SeriesBase<T
|
|
187
|
+
export declare interface BarSeriesConfig<T = unknown> extends SeriesBase<T>, Stackable {
|
|
167
188
|
kind: "bar";
|
|
168
189
|
/** Width as a fraction of the step; the group shares this fraction. */
|
|
169
190
|
barWidth: number;
|
|
@@ -211,9 +232,19 @@ export declare interface ChartProps<T> {
|
|
|
211
232
|
style?: CSSProperties;
|
|
212
233
|
/** Shown in the middle of the plot area when no visible series has a point
|
|
213
234
|
to show - no data, only gaps, or every series hidden. Axes and frame
|
|
214
|
-
stay. Without a value
|
|
215
|
-
caller's. */
|
|
235
|
+
stay. Without a value the wording's `empty`; this prop wins over it. */
|
|
216
236
|
empty?: ReactNode;
|
|
237
|
+
/** The chart's words (ADR-0031): English without a value, entries left out
|
|
238
|
+
fall back to English. German: `GERMAN_CHARTS_WORDING` from
|
|
239
|
+
`@umriss-ui/charts/wording/de`. */
|
|
240
|
+
wording?: Partial<ChartsWording>;
|
|
241
|
+
/** How series are told apart. `"color"` (the default): by their colour.
|
|
242
|
+
`"marks"`: by a dash and a marker shape as well - a line, an area and a
|
|
243
|
+
scatter -, and by a hatch - a bar, a state, a matrix cell, a limit band -,
|
|
244
|
+
chosen by the same palette place as the colour, so that a reader who does
|
|
245
|
+
not see the colours still tells them apart; the legend's chips show the
|
|
246
|
+
same. A caller's own `dash` wins over the place's. */
|
|
247
|
+
encoding?: "color" | "marks";
|
|
217
248
|
/** Charts with the same id share the pointer's x position, in domain units:
|
|
218
249
|
each draws its crosshair there, the tooltip stays with the chart under
|
|
219
250
|
the pointer. Zoom is not shared - give every chart the same controlled
|
|
@@ -227,6 +258,50 @@ export declare interface ChartProps<T> {
|
|
|
227
258
|
children?: ReactNode;
|
|
228
259
|
}
|
|
229
260
|
|
|
261
|
+
export declare interface ChartsWording {
|
|
262
|
+
/** What a screen reader calls the plot area that takes the keys
|
|
263
|
+
(`aria-roledescription`). */
|
|
264
|
+
roleDescription: string;
|
|
265
|
+
/** Shown in the plot area when no visible series has a point to show. */
|
|
266
|
+
empty: string;
|
|
267
|
+
/** The summary's visible series, by name. */
|
|
268
|
+
seriesList: (names: readonly string[]) => string;
|
|
269
|
+
/** The summary's visible stretch of the x axis, both ends formatted. */
|
|
270
|
+
visibleRange: (from: string, to: string) => string;
|
|
271
|
+
/** The summary's lowest and highest value of one series in that stretch. */
|
|
272
|
+
seriesExtent: (name: string, min: string, max: string) => string;
|
|
273
|
+
/** What is read after a key: the position, then each series with its value
|
|
274
|
+
(and its own x where it stands on another x axis), the emphasised one
|
|
275
|
+
first. */
|
|
276
|
+
readout: (x: string, rows: readonly {
|
|
277
|
+
name: string;
|
|
278
|
+
value: string;
|
|
279
|
+
x: string;
|
|
280
|
+
}[]) => string;
|
|
281
|
+
/** The last row of a stack in the tooltip and the readout: the sum of its
|
|
282
|
+
members at the point (charts-stacking K4). */
|
|
283
|
+
stackTotal: string;
|
|
284
|
+
/** A share in a normalised stack, its number already formatted (K5). */
|
|
285
|
+
percent: (value: string) => string;
|
|
286
|
+
/** The keys that walk the chart. */
|
|
287
|
+
walkHelp: string;
|
|
288
|
+
/** The keys that zoom and pan it - only where the chart can be zoomed. */
|
|
289
|
+
zoomHelp: string;
|
|
290
|
+
/** The data table's disclosure key, closed and open (charts-alternatives
|
|
291
|
+
C1). */
|
|
292
|
+
showData: string;
|
|
293
|
+
hideData: string;
|
|
294
|
+
/** The heading of the table's x column where its axis has no `label`, and
|
|
295
|
+
of a matrix' row column where its y axis has none. */
|
|
296
|
+
positionColumn: string;
|
|
297
|
+
rowColumn: string;
|
|
298
|
+
/** The table's caption: the visible stretch it lists, both ends formatted. */
|
|
299
|
+
tableCaption: (from: string, to: string) => string;
|
|
300
|
+
/** Added to the caption where the table shows the downsampled course (C2):
|
|
301
|
+
how many readings its rows stand for. */
|
|
302
|
+
downsampled: (readings: number) => string;
|
|
303
|
+
}
|
|
304
|
+
|
|
230
305
|
declare interface CommonProps {
|
|
231
306
|
/** Axis on which the value lies. Without one, the first axis of the
|
|
232
307
|
orientation. */
|
|
@@ -354,8 +429,22 @@ export declare interface ControlLimits {
|
|
|
354
429
|
chart then draws no line instead of bursting. */
|
|
355
430
|
export declare function controlLimits(values: readonly number[], origin: ControlLimitOrigin): ControlLimits;
|
|
356
431
|
|
|
432
|
+
export declare function DataTable(): ReactNode;
|
|
433
|
+
|
|
434
|
+
/** One table of the data table: the series of one x axis, or one matrix. Every
|
|
435
|
+
cell is text already, in the format the tooltip writes. */
|
|
436
|
+
export declare interface DataTableGroup {
|
|
437
|
+
key: string;
|
|
438
|
+
caption: string;
|
|
439
|
+
columns: readonly string[];
|
|
440
|
+
/** The first cell of each row is its x - the row's heading. */
|
|
441
|
+
rows: readonly (readonly string[])[];
|
|
442
|
+
}
|
|
443
|
+
|
|
357
444
|
export declare const DAY: number;
|
|
358
445
|
|
|
446
|
+
export declare const DEFAULT_CHARTS_WORDING: ChartsWording;
|
|
447
|
+
|
|
359
448
|
/** Default gradient: a sequential set, light to dark, so that it stays readable
|
|
360
449
|
as an order of lightness even without colour. It is a default, not a
|
|
361
450
|
restriction - whoever has a scale of their own names it. */
|
|
@@ -802,6 +891,9 @@ export declare interface ResolvedTheme {
|
|
|
802
891
|
font: string;
|
|
803
892
|
fontMono: string;
|
|
804
893
|
series: readonly string[];
|
|
894
|
+
/** The page is in forced colours: every colour above is a system colour, and
|
|
895
|
+
the chart encodes by marks whatever its `encoding`. */
|
|
896
|
+
forced: boolean;
|
|
805
897
|
}
|
|
806
898
|
|
|
807
899
|
/** Name of a rule, the way it is switched on and off in `violations`. */
|
|
@@ -931,6 +1023,15 @@ export declare type Side = "upper" | "lower";
|
|
|
931
1023
|
baseline has been handed down as a centre line and a control limit. */
|
|
932
1024
|
export declare function sigmaFromLimit(center: number, upper: number): number;
|
|
933
1025
|
|
|
1026
|
+
/** What the two filled kinds share: a place in a stack (charts-stacking). */
|
|
1027
|
+
declare interface Stackable {
|
|
1028
|
+
/** The stack this series stands in: series with the same id, on the same x
|
|
1029
|
+
and y axis, stack in registration order (K1). */
|
|
1030
|
+
stack?: string;
|
|
1031
|
+
/** On any member, the whole stack sums to 100 at every x (K5). */
|
|
1032
|
+
normalize?: boolean;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
934
1035
|
/** A band of states: each point's state holds from its x until the next
|
|
935
1036
|
point's. The last one holds until the latest reading of the chart - the
|
|
936
1037
|
last x of any visible series on the same x axis - and where the band itself
|
|
@@ -1018,6 +1119,8 @@ export declare interface TooltipPoint<T = unknown> {
|
|
|
1018
1119
|
/** The point's x value on its own x axis - with several x axes it can
|
|
1019
1120
|
differ from the hit's. */
|
|
1020
1121
|
xValue: number;
|
|
1122
|
+
/** The point's y value; in a stack its own value, not its top - in a
|
|
1123
|
+
normalised stack its share in percent. */
|
|
1021
1124
|
yValue: number;
|
|
1022
1125
|
datum: T;
|
|
1023
1126
|
index: number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const i = {
|
|
2
|
+
roleDescription: "Diagramm",
|
|
3
|
+
empty: "Keine Daten",
|
|
4
|
+
seriesList: (e) => `${e.length === 1 ? "1 Serie" : `${e.length} Serien`}: ${e.join(", ")}.`,
|
|
5
|
+
visibleRange: (e, n) => `Von ${e} bis ${n}.`,
|
|
6
|
+
seriesExtent: (e, n, t) => `${e} von ${n} bis ${t}.`,
|
|
7
|
+
readout: (e, n) => [`${e}.`, ...n.map((t) => `${t.name} ${t.value}${t.x === "" ? "" : ` bei ${t.x}`}.`)].join(" "),
|
|
8
|
+
stackTotal: "Summe",
|
|
9
|
+
percent: (e) => `${e} %`,
|
|
10
|
+
walkHelp: "Pfeil links und rechts gehen durch die Werte, Pfeil hoch und runter wechseln die Serie, Pos1 und Ende springen zum ersten und letzten Wert, Escape hebt die Markierung auf.",
|
|
11
|
+
zoomHelp: "Plus und Minus zoomen, Umschalt mit Pfeil links oder rechts verschiebt, 0 zeigt alles.",
|
|
12
|
+
showData: "Daten zeigen",
|
|
13
|
+
hideData: "Daten verbergen",
|
|
14
|
+
positionColumn: "Position",
|
|
15
|
+
rowColumn: "Zeile",
|
|
16
|
+
tableCaption: (e, n) => `Werte von ${e} bis ${n}.`,
|
|
17
|
+
downsampled: (e) => `Ausgedünnt aus ${e.toLocaleString("de-DE")} Messwerten: erster, kleinster, größter und letzter Wert je Abschnitt.`
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
i as GERMAN_CHARTS_WORDING
|
|
21
|
+
};
|