@umriss-ui/charts 0.6.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/dist/de.d.ts CHANGED
@@ -18,10 +18,28 @@ declare interface ChartsWording {
18
18
  value: string;
19
19
  x: string;
20
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;
21
26
  /** The keys that walk the chart. */
22
27
  walkHelp: string;
23
28
  /** The keys that zoom and pan it - only where the chart can be zoomed. */
24
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;
25
43
  }
26
44
 
27
45
  export declare const GERMAN_CHARTS_WORDING: ChartsWording;
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;
@@ -217,6 +238,13 @@ export declare interface ChartProps<T> {
217
238
  fall back to English. German: `GERMAN_CHARTS_WORDING` from
218
239
  `@umriss-ui/charts/wording/de`. */
219
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";
220
248
  /** Charts with the same id share the pointer's x position, in domain units:
221
249
  each draws its crosshair there, the tooltip stays with the chart under
222
250
  the pointer. Zoom is not shared - give every chart the same controlled
@@ -250,10 +278,28 @@ export declare interface ChartsWording {
250
278
  value: string;
251
279
  x: string;
252
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;
253
286
  /** The keys that walk the chart. */
254
287
  walkHelp: string;
255
288
  /** The keys that zoom and pan it - only where the chart can be zoomed. */
256
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;
257
303
  }
258
304
 
259
305
  declare interface CommonProps {
@@ -383,6 +429,18 @@ export declare interface ControlLimits {
383
429
  chart then draws no line instead of bursting. */
384
430
  export declare function controlLimits(values: readonly number[], origin: ControlLimitOrigin): ControlLimits;
385
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
+
386
444
  export declare const DAY: number;
387
445
 
388
446
  export declare const DEFAULT_CHARTS_WORDING: ChartsWording;
@@ -833,6 +891,9 @@ export declare interface ResolvedTheme {
833
891
  font: string;
834
892
  fontMono: string;
835
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;
836
897
  }
837
898
 
838
899
  /** Name of a rule, the way it is switched on and off in `violations`. */
@@ -962,6 +1023,15 @@ export declare type Side = "upper" | "lower";
962
1023
  baseline has been handed down as a centre line and a control limit. */
963
1024
  export declare function sigmaFromLimit(center: number, upper: number): number;
964
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
+
965
1035
  /** A band of states: each point's state holds from its x until the next
966
1036
  point's. The last one holds until the latest reading of the chart - the
967
1037
  last x of any visible series on the same x axis - and where the band itself
@@ -1049,6 +1119,8 @@ export declare interface TooltipPoint<T = unknown> {
1049
1119
  /** The point's x value on its own x axis - with several x axes it can
1050
1120
  differ from the hit's. */
1051
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. */
1052
1124
  yValue: number;
1053
1125
  datum: T;
1054
1126
  index: number;
@@ -1,13 +1,21 @@
1
- const t = {
1
+ const i = {
2
2
  roleDescription: "Diagramm",
3
3
  empty: "Keine Daten",
4
4
  seriesList: (e) => `${e.length === 1 ? "1 Serie" : `${e.length} Serien`}: ${e.join(", ")}.`,
5
5
  visibleRange: (e, n) => `Von ${e} bis ${n}.`,
6
- seriesExtent: (e, n, i) => `${e} von ${n} bis ${i}.`,
7
- readout: (e, n) => [`${e}.`, ...n.map((i) => `${i.name} ${i.value}${i.x === "" ? "" : ` bei ${i.x}`}.`)].join(" "),
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} %`,
8
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.",
9
- zoomHelp: "Plus und Minus zoomen, Umschalt mit Pfeil links oder rechts verschiebt, 0 zeigt alles."
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.`
10
18
  };
11
19
  export {
12
- t as GERMAN_CHARTS_WORDING
20
+ i as GERMAN_CHARTS_WORDING
13
21
  };