@umriss-ui/charts 0.8.1 → 0.9.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
@@ -37,6 +37,22 @@ declare interface ChartsWording {
37
37
  rowColumn: string;
38
38
  /** The table's caption: the visible stretch it lists, both ends formatted. */
39
39
  tableCaption: (from: string, to: string) => string;
40
+ /** A box's numbers, top to bottom as drawn: the tooltip's rows, the
41
+ readout's parts and the data table's columns (box-plot B9). */
42
+ upperWhisker: string;
43
+ upperQuartile: string;
44
+ median: string;
45
+ lowerQuartile: string;
46
+ lowerWhisker: string;
47
+ /** A box's outliers: the row's name, and the row's value - their count and
48
+ the first few values, the rest counted (box-plot B9). */
49
+ outliers: string;
50
+ /** A box's optional readings: its mean, its notch's two bounds as one row,
51
+ and how many values stand behind it. */
52
+ mean: string;
53
+ notch: string;
54
+ count: string;
55
+ outlierList: (values: readonly string[], more: number) => string;
40
56
  /** Added to the caption where the table shows the downsampled course (C2):
41
57
  how many readings its rows stand for. */
42
58
  downsampled: (readings: number) => string;
package/dist/index.d.ts CHANGED
@@ -190,6 +190,115 @@ export declare interface BarSeriesConfig<T = unknown> extends SeriesBase<T>, Sta
190
190
  barWidth: number;
191
191
  }
192
192
 
193
+ /** The named channels of a box: one number per point, NaN where the median
194
+ is a gap; and its outliers (ADR-0040). */
195
+ export declare interface BoxChannels extends BoxNumbers<Float64Array> {
196
+ /** Every box's outliers, flat, box after box; null without `outliers`. */
197
+ outliers: Float64Array | null;
198
+ /** Where each box's outliers begin, and one past the last: box i's stand
199
+ from outlierOffsets[i] to outlierOffsets[i + 1]. null without
200
+ `outliers`. */
201
+ outlierOffsets: Uint32Array | null;
202
+ /** The optional numbers, each null where not given. */
203
+ mean: Float64Array | null;
204
+ notchLower: Float64Array | null;
205
+ notchUpper: Float64Array | null;
206
+ count: Float64Array | null;
207
+ }
208
+
209
+ /** The optional numbers of a box (box-plot 04), by name. */
210
+ export declare interface BoxExtras<V = number> {
211
+ mean: V;
212
+ notchLower: V;
213
+ notchUpper: V;
214
+ count: V;
215
+ }
216
+
217
+ /** A box's further numbers beside its median, by name. */
218
+ export declare interface BoxNumbers<V = number> {
219
+ lowerQuartile: V;
220
+ upperQuartile: V;
221
+ lowerWhisker: V;
222
+ upperWhisker: V;
223
+ }
224
+
225
+ export declare function BoxPlot<T>(props: BoxPlotProps<T>): null;
226
+
227
+ export declare interface BoxPlotProps<T> {
228
+ /** The line across the box; null/undefined/NaN/±Infinity means a gap - no
229
+ box is drawn there, whatever the other numbers say (R-2.5). */
230
+ median: Accessor<T>;
231
+ /** The box's lower edge. */
232
+ lowerQuartile: Accessor<T>;
233
+ /** The box's upper edge. */
234
+ upperQuartile: Accessor<T>;
235
+ /** Where the lower whisker ends - the caller's rule, not the minimum. */
236
+ lowerWhisker: Accessor<T>;
237
+ /** Where the upper whisker ends - the caller's rule, not the maximum. */
238
+ upperWhisker: Accessor<T>;
239
+ /** The values beyond the whiskers, per box: an array, empty or missing
240
+ where there are none. Drawn with their box in its colour - one beyond
241
+ three IQR of the box's own quartiles as a ring -, read in its tooltip
242
+ and table row, never hit on their own (ADR-0040). */
243
+ outliers?: ListAccessor<T>;
244
+ /** The mean, drawn as a small ×: beside the median it shows a skew. */
245
+ mean?: Accessor<T>;
246
+ /** The notch's lower bound - usually of a confidence interval of the
247
+ median. Both bounds or neither: one alone warns in DEV and is not
248
+ drawn. */
249
+ notchLower?: Accessor<T>;
250
+ /** The notch's upper bound; see `notchLower`. */
251
+ notchUpper?: Accessor<T>;
252
+ /** How many values stand behind the box; read in the tooltip and the
253
+ table, not drawn. */
254
+ count?: Accessor<T>;
255
+ /** Binding to an x axis (R-4.12). */
256
+ xAxisId?: string;
257
+ /** Binding to a y axis (R-4.12). */
258
+ yAxisId?: string;
259
+ /** Series-own data; overrides the container data (R-2.4). */
260
+ data?: readonly T[];
261
+ /** The name in legend and tooltip. Without one the series is called
262
+ "Series n" and a warning stands in DEV. */
263
+ name?: string;
264
+ /** Not drawn, not hit and not counted for its axes' extent. Its legend
265
+ entry stays, drawn back. Controlled, typically from `Legend onToggle`. */
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. */
269
+ format?: (value: number) => string;
270
+ /** Any CSS colour value; without one the palette --uc-series-N. */
271
+ color?: string;
272
+ /** A role instead of a colour value; the theme resolves it. `color` beats
273
+ it. Set by the caller: a box out of its specification is the caller's
274
+ judgement, not the library's. */
275
+ tone?: "ok" | "warning" | "alarm";
276
+ /** Width as a fraction of the step, as a bar's: boxes and bars on one x axis
277
+ share this fraction and stand side by side. */
278
+ boxWidth?: number;
279
+ }
280
+
281
+ /** A box plot (CONTEXT.md: Box). The base accessor is the median; the four
282
+ further numbers are the caller's, computed by whatever method the caller
283
+ chose - the library draws them and computes none. */
284
+ export declare interface BoxSeriesConfig<T = unknown> extends SeriesBase<T> {
285
+ kind: "box";
286
+ lowerQuartile: Accessor<T>;
287
+ upperQuartile: Accessor<T>;
288
+ lowerWhisker: Accessor<T>;
289
+ upperWhisker: Accessor<T>;
290
+ /** The values beyond the whiskers, per box (ADR-0040). */
291
+ outliers?: ListAccessor<T>;
292
+ mean?: Accessor<T>;
293
+ /** Both bounds or neither (CONTEXT.md: Notch). */
294
+ notchLower?: Accessor<T>;
295
+ notchUpper?: Accessor<T>;
296
+ /** How many values stand behind the box; no y value. */
297
+ count?: Accessor<T>;
298
+ /** Width as a fraction of the step; boxes and bars on one x axis share it. */
299
+ boxWidth: number;
300
+ }
301
+
193
302
  /** The breaks in working time that lie within the extent [from, to] - what the
194
303
  axis must mark, in domain units. */
195
304
  export declare function breaks(input: CalendarInput, from: number, to: number): number[];
@@ -297,6 +406,22 @@ export declare interface ChartsWording {
297
406
  rowColumn: string;
298
407
  /** The table's caption: the visible stretch it lists, both ends formatted. */
299
408
  tableCaption: (from: string, to: string) => string;
409
+ /** A box's numbers, top to bottom as drawn: the tooltip's rows, the
410
+ readout's parts and the data table's columns (box-plot B9). */
411
+ upperWhisker: string;
412
+ upperQuartile: string;
413
+ median: string;
414
+ lowerQuartile: string;
415
+ lowerWhisker: string;
416
+ /** A box's outliers: the row's name, and the row's value - their count and
417
+ the first few values, the rest counted (box-plot B9). */
418
+ outliers: string;
419
+ /** A box's optional readings: its mean, its notch's two bounds as one row,
420
+ and how many values stand behind it. */
421
+ mean: string;
422
+ notch: string;
423
+ count: string;
424
+ outlierList: (values: readonly string[], more: number) => string;
300
425
  /** Added to the caption where the table shows the downsampled course (C2):
301
426
  how many readings its rows stand for. */
302
427
  downsampled: (readings: number) => string;
@@ -615,6 +740,10 @@ export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
615
740
  step?: boolean;
616
741
  }
617
742
 
743
+ /** A list per datum - a box's outliers (ADR-0040). null/undefined or an
744
+ empty array is none; a value that is not finite is left out. */
745
+ export declare type ListAccessor<T> = (d: T, index: number) => readonly number[] | null | undefined;
746
+
618
747
  /** The local offset at an instant, as the shift of a grid that is to lie on
619
748
  local time: `wallClock = offset + k · step`. Taken at one instant, it holds
620
749
  for a grid up to the next clock change. */
@@ -638,6 +767,9 @@ export declare interface MaterializedSeries {
638
767
  carry does not belong in the shared type with a comment (ADR-0011). null
639
768
  for every kind that does not use it. */
640
769
  w: Float64Array | null;
770
+ /** A box's further numbers beside its median in y; null for every other
771
+ kind (ADR-0011). */
772
+ box: BoxChannels | null;
641
773
  length: number;
642
774
  }
643
775
 
@@ -942,7 +1074,7 @@ export declare interface SeriesBase<T = unknown> {
942
1074
  hidden?: boolean;
943
1075
  }
944
1076
 
945
- export declare type SeriesConfig<T = unknown> = LineSeriesConfig<T> | AreaSeriesConfig<T> | BarSeriesConfig<T> | ScatterSeriesConfig<T> | StateSeriesConfig<T> | MatrixSeriesConfig<T>;
1077
+ export declare type SeriesConfig<T = unknown> = LineSeriesConfig<T> | AreaSeriesConfig<T> | BarSeriesConfig<T> | BoxSeriesConfig<T> | ScatterSeriesConfig<T> | StateSeriesConfig<T> | MatrixSeriesConfig<T>;
946
1078
 
947
1079
  export declare type SeriesKind = SeriesConfig["kind"];
948
1080
 
@@ -1074,6 +1206,12 @@ export declare interface TooltipPoint<T = unknown> {
1074
1206
  to: number;
1075
1207
  label: string;
1076
1208
  };
1209
+ /** Only for a box: its further numbers; yValue is its median. Fields of
1210
+ their own for the reason `value` has one (ADR-0011). */
1211
+ box?: BoxNumbers & Partial<BoxExtras> & {
1212
+ /** As the caller gave them; only where the series has `outliers`. */
1213
+ outliers?: readonly number[];
1214
+ };
1077
1215
  }
1078
1216
 
1079
1217
  export declare interface TooltipProps<T> {
@@ -1215,8 +1353,10 @@ export declare function workingTimeTicks(input: CalendarInput, from: number, to:
1215
1353
  export declare function XAxis<T>(props: XAxisProps<T>): null;
1216
1354
 
1217
1355
  export declare interface XAxisProps<T> extends CommonProps_2<T> {
1218
- /** `"nice"` widens the data's extent to ticks, `"data"` keeps it, a pair is
1219
- fixed - the one a zoom passes back. */
1356
+ /** `"nice"` widens the data's extent to ticks - to named `ticks` where
1357
+ 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 - the one a zoom passes
1359
+ back. */
1220
1360
  domain?: "nice" | "data" | readonly [number, number];
1221
1361
  /** Which edge the axis stands at. A second x axis on the opposite edge is how
1222
1362
  a series counts in a unit of its own. */
@@ -1,10 +1,10 @@
1
- const i = {
1
+ const n = {
2
2
  roleDescription: "Diagramm",
3
3
  empty: "Keine Daten",
4
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(" "),
5
+ visibleRange: (e, t) => `Von ${e} bis ${t}.`,
6
+ seriesExtent: (e, t, i) => `${e} von ${t} bis ${i}.`,
7
+ readout: (e, t) => [`${e}.`, ...t.map((i) => `${i.name} ${i.value}${i.x === "" ? "" : ` bei ${i.x}`}.`)].join(" "),
8
8
  stackTotal: "Summe",
9
9
  percent: (e) => `${e} %`,
10
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.",
@@ -13,9 +13,20 @@ const i = {
13
13
  hideData: "Daten verbergen",
14
14
  positionColumn: "Position",
15
15
  rowColumn: "Zeile",
16
- tableCaption: (e, n) => `Werte von ${e} bis ${n}.`,
16
+ tableCaption: (e, t) => `Werte von ${e} bis ${t}.`,
17
+ upperWhisker: "Oberer Whisker",
18
+ upperQuartile: "Oberes Quartil",
19
+ median: "Median",
20
+ lowerQuartile: "Unteres Quartil",
21
+ lowerWhisker: "Unterer Whisker",
22
+ outliers: "Ausreißer",
23
+ mean: "Mittelwert",
24
+ // As "Whisker": the term of the trade, not "Kerbe" (CONTEXT.md: Notch).
25
+ notch: "Notch",
26
+ count: "n",
27
+ outlierList: (e, t) => `${e.length + t}: ${e.join(", ")}${t > 0 ? ` und ${t} weitere` : ""}`,
17
28
  downsampled: (e) => `Ausgedünnt aus ${e.toLocaleString("de-DE")} Messwerten: erster, kleinster, größter und letzter Wert je Abschnitt.`
18
29
  };
19
30
  export {
20
- i as GERMAN_CHARTS_WORDING
31
+ n as GERMAN_CHARTS_WORDING
21
32
  };