@umriss-ui/charts 0.3.2 → 0.4.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/index.d.ts CHANGED
@@ -1,12 +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. */
4
8
  export declare type Accessor<T> = (d: T, index: number) => number | null | undefined;
5
9
 
6
10
  export declare function Area<T>(props: AreaProps<T>): null;
7
11
 
8
12
  export declare interface AreaProps<T> {
9
- /** Upper edge; null/undefined/NaN means a gap (R-2.5). */
13
+ /** Upper edge; null/undefined/NaN/±Infinity means a gap (R-2.5). */
10
14
  accessor: Accessor<T>;
11
15
  /** Lower edge; without a value the fixed baseline 0. */
12
16
  baseline?: Accessor<T>;
@@ -20,12 +24,26 @@ export declare interface AreaProps<T> {
20
24
  "Series n" and a warning stands in DEV - an unnamed series is a colour
21
25
  nobody can look up. */
22
26
  name?: string;
27
+ /** Not drawn, not hit and not counted for its axes' extent - a fixed
28
+ `domain` keeps the axis still. Its legend entry stays, drawn back.
29
+ Controlled: the caller sets it, typically from `Legend onToggle`. */
30
+ hidden?: boolean;
31
+ /** The value as the tooltip writes it; without one the y axis' `tickFormat`,
32
+ then the default. */
33
+ format?: (value: number) => string;
23
34
  /** Any CSS colour value; without one the palette --uc-series-N. */
24
35
  color?: string;
25
- /** Opacity of the fill; the outline stays fully opaque. */
36
+ /** A role instead of a colour value; the theme resolves it. `color` beats
37
+ it. */
38
+ tone?: "ok" | "warning" | "alarm";
39
+ /** Opacity of the fill, from 0 to 1; the outline stays fully opaque. */
26
40
  fillOpacity?: number;
27
- /** Width of the outline along the upper edge; 0 leaves it out. */
41
+ /** Width of the outline along the upper edge in CSS pixels; 0 leaves it
42
+ out. */
28
43
  strokeWidth?: number;
44
+ /** Dash pattern of the outline as a run of lengths in CSS pixels; without
45
+ one a solid outline. The fill stays whole. */
46
+ dash?: readonly number[];
29
47
  }
30
48
 
31
49
  export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T> {
@@ -35,6 +53,8 @@ export declare interface AreaSeriesConfig<T = unknown> extends SeriesBase<T> {
35
53
  /** Opacity of the fill; the outline stays fully opaque. */
36
54
  fillOpacity: number;
37
55
  strokeWidth: number;
56
+ /** Dash pattern of the outline. */
57
+ dash?: readonly number[];
38
58
  }
39
59
 
40
60
  /** What the value is, given the limit set. A pure function of the two.
@@ -83,7 +103,9 @@ export declare interface AxisConfig<T = unknown> {
83
103
  label?: string;
84
104
  tickCount?: number;
85
105
  tickFormat?: (v: number) => string;
86
- domain: "nice" | "data" | readonly [number, number];
106
+ /** "visible" is a y axis' only: the extent of what its series show inside
107
+ their x axis' domain. */
108
+ domain: "nice" | "data" | "visible" | readonly [number, number];
87
109
  /** undefined = the default per R-4.15 (only the first registered axis per
88
110
  orientation). */
89
111
  grid?: boolean;
@@ -91,10 +113,18 @@ export declare interface AxisConfig<T = unknown> {
91
113
  not numbers but places: the lanes of a state stack, the categories of a
92
114
  Pareto. */
93
115
  ticks?: readonly number[];
116
+ /** The values are instants in milliseconds: ticks on local boundaries,
117
+ labels by level. A calendar implies it. */
118
+ time?: boolean;
94
119
  /** Operating calendar: the intervals in which time counts. With it,
95
120
  materialisation maps wall clock time onto operating time before the scale
96
121
  calculates - the scale stays affine (ADR-0001). */
97
122
  calendar?: readonly OperatingInterval[];
123
+ /** y axes only: this axis' ticks on the first y axis' grid. */
124
+ alignTicks?: boolean;
125
+ /** x axes only: where wheel, drag, pinch and double click propose a
126
+ domain. Without it the axis does not zoom. */
127
+ onDomainChange?: (domain: [number, number]) => void;
98
128
  }
99
129
 
100
130
  export declare type AxisOrientation = "x" | "y";
@@ -104,7 +134,7 @@ export declare type AxisPosition = "bottom" | "top" | "left" | "right";
104
134
  export declare function Bar<T>(props: BarProps<T>): null;
105
135
 
106
136
  export declare interface BarProps<T> {
107
- /** Height; null/undefined/NaN means a gap (R-2.5). */
137
+ /** Height; null/undefined/NaN/±Infinity means a gap (R-2.5). */
108
138
  accessor: Accessor<T>;
109
139
  /** Binding to an x axis (R-4.12). */
110
140
  xAxisId?: string;
@@ -116,8 +146,18 @@ export declare interface BarProps<T> {
116
146
  "Series n" and a warning stands in DEV - an unnamed series is a colour
117
147
  nobody can look up. */
118
148
  name?: string;
149
+ /** Not drawn, not hit and not counted for its axes' extent - a fixed
150
+ `domain` keeps the axis still. Its legend entry stays, drawn back.
151
+ Controlled: the caller sets it, typically from `Legend onToggle`. */
152
+ hidden?: boolean;
153
+ /** The value as the tooltip writes it; without one the y axis' `tickFormat`,
154
+ then the default. */
155
+ format?: (value: number) => string;
119
156
  /** Any CSS colour value; without one the palette --uc-series-N. */
120
157
  color?: string;
158
+ /** A role instead of a colour value; the theme resolves it. `color` beats
159
+ it. */
160
+ tone?: "ok" | "warning" | "alarm";
121
161
  /** Width as a fraction of the step; just under 1, so that neighbours do not
122
162
  touch. Several bar series share this fraction. */
123
163
  barWidth?: number;
@@ -156,8 +196,8 @@ export declare interface ChartProps<T> {
156
196
  /** Width in CSS pixels, or `"100%"` for the host's. Without a value the chart
157
197
  measures its host and follows it through a ResizeObserver. */
158
198
  width?: number | "100%";
159
- /** Height in CSS pixels. Without a value the chart takes its host's, which
160
- then has to have one - a chart in a box of height 0 draws nothing. */
199
+ /** Height in CSS pixels; 300 without a value. Unlike the width, the chart
200
+ does not take its host's. */
161
201
  height?: number;
162
202
  /** Outer spacing of the plot area in CSS pixels. */
163
203
  padding?: number | Partial<Padding>;
@@ -169,6 +209,16 @@ export declare interface ChartProps<T> {
169
209
  here: a height set past the component is a height the scene does not know
170
210
  about. */
171
211
  style?: CSSProperties;
212
+ /** Shown in the middle of the plot area when no visible series has a point
213
+ to show - no data, only gaps, or every series hidden. Axes and frame
214
+ stay. Without a value "No data"; any other language or wording is the
215
+ caller's. */
216
+ empty?: ReactNode;
217
+ /** Charts with the same id share the pointer's x position, in domain units:
218
+ each draws its crosshair there, the tooltip stays with the chart under
219
+ the pointer. Zoom is not shared - give every chart the same controlled
220
+ `domain`. */
221
+ syncId?: string;
172
222
  /** Instrumentation for the benchmark page (R-5.1); not needed otherwise. */
173
223
  onPerf?: (perf: ChartPerf) => void;
174
224
  /** The axes, series and companions of this chart. They draw nothing
@@ -178,7 +228,8 @@ export declare interface ChartProps<T> {
178
228
  }
179
229
 
180
230
  declare interface CommonProps {
181
- /** Axis on which the value lies. */
231
+ /** Axis on which the value lies. Without one, the first axis of the
232
+ orientation. */
182
233
  axisId?: string;
183
234
  /** Whether the value lies on the x or on the y axis. Without one, y: a limit
184
235
  is nearly always a value and not a moment. */
@@ -204,14 +255,18 @@ declare interface CommonProps {
204
255
  declare interface CommonProps_2<T> {
205
256
  /** Axis id, through which series bind themselves (R-4.12). */
206
257
  id?: string;
207
- /** Value access of this axis. */
258
+ /** Value access of this axis. Compared by its source text, as a series'
259
+ accessor is (`Accessor`) - with the same closure limit. */
208
260
  accessor: (d: T, index: number) => number;
209
261
  /** Axis title. */
210
262
  label?: string;
211
263
  /** Target value; the 1-2-5 algorithm may deviate. */
212
264
  tickCount?: number;
265
+ /** Label of a tick. Compared by its source text: one that reads a changed
266
+ closure variable under the same text does not relabel the axis - give it
267
+ a new text or remount. A bound `Intl.NumberFormat#format` is compared by
268
+ identity. */
213
269
  tickFormat?: (v: number) => string;
214
- domain?: "nice" | "data" | readonly [number, number];
215
270
  /** Grid lines; the default follows R-4.15. */
216
271
  grid?: boolean;
217
272
  /** Fixed tick values instead of the 1-2-5 algorithm. For axes whose values are
@@ -239,8 +294,14 @@ export declare interface ControlChartProps<T> {
239
294
  "Series n" and a warning stands in DEV - an unnamed series is a colour
240
295
  nobody can look up. */
241
296
  name?: string;
297
+ /** The value as the tooltip writes it - on the line and on the violations;
298
+ without one the y axis' `tickFormat`, then the default. */
299
+ format?: (value: number) => string;
242
300
  /** Any CSS colour value; without one the palette --uc-series-N. */
243
301
  color?: string;
302
+ /** A role instead of a colour value for the line; the theme resolves it.
303
+ The violations are always "alarm". */
304
+ tone?: "ok" | "warning" | "alarm";
244
305
  /** Switchable one by one; run lengths are parameters. */
245
306
  rules?: Partial<RuleOptions>;
246
307
  /** The faint zone lines at one and two sigma. Rule 4 is about the two-sigma
@@ -311,7 +372,7 @@ export declare const HOUR: number;
311
372
  redraws. */
312
373
  export declare function invalidateTheme(): void;
313
374
 
314
- export declare function Legend({ placement }: LegendProps): ReactNode;
375
+ export declare function Legend({ placement, onToggle }: LegendProps): ReactNode;
315
376
 
316
377
  export declare interface LegendConfig {
317
378
  placement: "top" | "bottom";
@@ -321,6 +382,10 @@ export declare interface LegendProps {
321
382
  /** Which side of the plot area the legend stands on. Without a value, above
322
383
  it. */
323
384
  placement?: "top" | "bottom";
385
+ /** Called with an entry's name when it is clicked - the series' name, or a
386
+ state's label. The caller flips `hidden` on the series it means. Without
387
+ it the legend is not clickable. */
388
+ onToggle?: (name: string) => void;
324
389
  }
325
390
 
326
391
  /** A bound: a value, a side and a severity. No more - a tolerance band is
@@ -344,14 +409,15 @@ export declare interface LimitBandConfig extends LimitBase {
344
409
  export declare interface LimitBandProps extends CommonProps {
345
410
  /** Lower edge of the band, in domain units of its axis. */
346
411
  from: number;
347
- /** Upper edge. A band drawn backwards (`from` above `to`) is drawn between
412
+ /** Upper edge, in domain units of its axis. A band drawn backwards (`from` above `to`) is drawn between
348
413
  the two all the same - the pair is a range, not a direction. */
349
414
  to: number;
350
415
  }
351
416
 
352
417
  declare interface LimitBase {
353
- /** Axis on which the value lies. */
354
- axisId: string;
418
+ /** Axis on which the value lies; without one, the first axis of its
419
+ orientation (charts-fixes 08). */
420
+ axisId?: string;
355
421
  orientation: AxisOrientation;
356
422
  severity: Severity;
357
423
  role: LimitRole;
@@ -414,7 +480,7 @@ export declare class LinearScale implements Scale {
414
480
  }
415
481
 
416
482
  export declare interface LineProps<T> {
417
- /** Y value; null/undefined/NaN means a gap (R-2.5). */
483
+ /** Y value; null/undefined/NaN/±Infinity means a gap (R-2.5). */
418
484
  accessor: Accessor<T>;
419
485
  /** Binding to an x axis (R-4.12). */
420
486
  xAxisId?: string;
@@ -426,6 +492,13 @@ export declare interface LineProps<T> {
426
492
  "Series n" and a warning stands in DEV - an unnamed series is a colour
427
493
  nobody can look up. */
428
494
  name?: string;
495
+ /** Not drawn, not hit and not counted for its axes' extent - a fixed
496
+ `domain` keeps the axis still. Its legend entry stays, drawn back.
497
+ Controlled: the caller sets it, typically from `Legend onToggle`. */
498
+ hidden?: boolean;
499
+ /** The value as the tooltip writes it; without one the y axis' `tickFormat`,
500
+ then the default. */
501
+ format?: (value: number) => string;
429
502
  /** Any CSS colour value; without one the palette --uc-series-N. */
430
503
  color?: string;
431
504
  /** A role instead of a colour value; the theme resolves it. */
@@ -434,9 +507,14 @@ export declare interface LineProps<T> {
434
507
  strokeWidth?: number;
435
508
  /** Dash pattern as a run of lengths in CSS pixels; without one a solid line. */
436
509
  dash?: readonly number[];
437
- /** When the individual points are drawn as marks: `auto` from a density at
438
- which they no longer run into each other, `always`, `never`. */
510
+ /** When the individual points are drawn as marks: `auto` every point up to
511
+ 60 points and above that only a point between two gaps - it has no line
512
+ to be seen by - `always`, or `never`, not even that one. */
439
513
  markers?: "auto" | "always" | "never";
514
+ /** Sample-and-hold: each value holds as a horizontal until the next sample
515
+ and jumps there - a set point, a digital signal. A gap ends the hold at
516
+ its x. The tooltip reports the sample the hold began with. */
517
+ step?: boolean;
440
518
  }
441
519
 
442
520
  export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
@@ -444,14 +522,22 @@ export declare interface LineSeriesConfig<T = unknown> extends SeriesBase<T> {
444
522
  strokeWidth: number;
445
523
  dash?: readonly number[];
446
524
  markers: "auto" | "always" | "never";
525
+ /** Sample-and-hold: each value holds until the next sample. */
526
+ step?: boolean;
447
527
  }
448
528
 
529
+ /** The local offset at an instant, as the shift of a grid that is to lie on
530
+ local time: `wallClock = offset + k · step`. Taken at one instant, it holds
531
+ for a grid up to the next clock change. */
532
+ export declare function localOffset(instant: number): number;
533
+
449
534
  /** Map a whole series inwards - the route materialisation takes when it wants to
450
535
  go it in one piece. Only the first n values are touched. */
451
536
  export declare function mapSeries(input: CalendarInput, source: Float64Array, n: number, target: Float64Array): void;
452
537
 
453
538
  /** Materialised series: the draw loop works only on this (R-2.7).
454
- Gaps (null/undefined/NaN out of the accessor) are encoded as NaN (R-2.5). */
539
+ Gaps (null/undefined/NaN/±Infinity out of the accessor) are encoded as NaN
540
+ (R-2.5). */
455
541
  export declare interface MaterializedSeries {
456
542
  x: Float64Array;
457
543
  y: Float64Array;
@@ -463,9 +549,6 @@ export declare interface MaterializedSeries {
463
549
  carry does not belong in the shared type with a comment (ADR-0011). null
464
550
  for every kind that does not use it. */
465
551
  w: Float64Array | null;
466
- /** Second x channel: the end of a span. Named for the same reason.
467
- NaN here does not mean a gap but open (ADR-0011). */
468
- x1: Float64Array | null;
469
552
  length: number;
470
553
  }
471
554
 
@@ -505,6 +588,13 @@ export declare interface MatrixProps<T> {
505
588
  "Series n" and a warning stands in DEV - an unnamed series is a colour
506
589
  nobody can look up. */
507
590
  name?: string;
591
+ /** Not drawn, not hit and not counted for its axes' extent - a fixed
592
+ `domain` keeps the axis still. Its legend entry stays, drawn back.
593
+ Controlled: the caller sets it, typically from `Legend onToggle`. */
594
+ hidden?: boolean;
595
+ /** The value as the tooltip writes it; without one the default. The y
596
+ axis' `tickFormat` writes the row, not the value. */
597
+ format?: (value: number) => string;
508
598
  }
509
599
 
510
600
  export declare interface MatrixSeriesConfig<T = unknown> extends SeriesBase<T> {
@@ -769,7 +859,7 @@ export declare interface Scale {
769
859
  export declare function Scatter<T>(props: ScatterProps<T>): null;
770
860
 
771
861
  export declare interface ScatterProps<T> {
772
- /** Y value; null/undefined/NaN means a gap (R-2.5). */
862
+ /** Y value; null/undefined/NaN/±Infinity means a gap (R-2.5). */
773
863
  accessor: Accessor<T>;
774
864
  /** Binding to an x axis (R-4.12). */
775
865
  xAxisId?: string;
@@ -781,6 +871,13 @@ export declare interface ScatterProps<T> {
781
871
  "Series n" and a warning stands in DEV - an unnamed series is a colour
782
872
  nobody can look up. */
783
873
  name?: string;
874
+ /** Not drawn, not hit and not counted for its axes' extent - a fixed
875
+ `domain` keeps the axis still. Its legend entry stays, drawn back.
876
+ Controlled: the caller sets it, typically from `Legend onToggle`. */
877
+ hidden?: boolean;
878
+ /** The value as the tooltip writes it; without one the y axis' `tickFormat`,
879
+ then the default. */
880
+ format?: (value: number) => string;
784
881
  /** Any CSS colour value; without one the palette --uc-series-N. */
785
882
  color?: string;
786
883
  /** A role instead of a colour value; the theme resolves it. */
@@ -798,21 +895,26 @@ export declare interface ScatterSeriesConfig<T = unknown> extends SeriesBase<T>
798
895
  export declare const SECOND = 1000;
799
896
 
800
897
  export declare interface SeriesBase<T = unknown> {
801
- /** Y value; null/undefined/NaN means a gap (R-2.5). */
898
+ /** Y value; null/undefined/NaN/±Infinity means a gap (R-2.5). */
802
899
  accessor: Accessor<T>;
803
900
  /** Series-own data; overrides the container data (R-2.4). */
804
901
  data?: readonly T[];
805
902
  xAxisId: string;
806
903
  yAxisId: string;
807
904
  name?: string;
905
+ /** The value in the tooltip; before the y axis' `tickFormat`. Compared by its
906
+ source text, as an accessor is. */
907
+ format?: (value: number) => string;
808
908
  color?: string;
809
909
  /** A role instead of a colour value: the theme resolves it, in both themes.
810
910
  For series that mean something rather than just being the next one - the
811
911
  violating points of a control chart, say. `color` beats it. */
812
912
  tone?: "ok" | "warning" | "alarm";
913
+ /** Not drawn, not hit, not in its axes' extent; its legend entry stays. */
914
+ hidden?: boolean;
813
915
  }
814
916
 
815
- export declare type SeriesConfig<T = unknown> = LineSeriesConfig<T> | AreaSeriesConfig<T> | BarSeriesConfig<T> | ScatterSeriesConfig<T> | StateSeriesConfig<T> | MatrixSeriesConfig<T> | SpanSeriesConfig<T>;
917
+ export declare type SeriesConfig<T = unknown> = LineSeriesConfig<T> | AreaSeriesConfig<T> | BarSeriesConfig<T> | ScatterSeriesConfig<T> | StateSeriesConfig<T> | MatrixSeriesConfig<T>;
816
918
 
817
919
  export declare type SeriesKind = SeriesConfig["kind"];
818
920
 
@@ -829,45 +931,18 @@ export declare type Side = "upper" | "lower";
829
931
  baseline has been handed down as a centre line and a control limit. */
830
932
  export declare function sigmaFromLimit(center: number, upper: number): number;
831
933
 
832
- export declare function Span<T>(props: SpanProps<T>): null;
833
-
834
- export declare interface SpanProps<T> {
835
- /** Lane position on the y axis. */
836
- accessor: Accessor<T>;
837
- /** End on the x axis. Missing means open: the span runs to the edge and is
838
- drawn as open - a running job is a fact one wants to see. */
839
- to: Accessor<T>;
840
- /** Binding to an x axis (R-4.12). */
841
- xAxisId?: string;
842
- /** Binding to a y axis (R-4.12). */
843
- yAxisId?: string;
844
- /** Series-own data; overrides the container data (R-2.4). */
845
- data?: readonly T[];
846
- /** The name in legend and tooltip. Without one the series is called
847
- "Series n" and a warning stands in DEV - an unnamed series is a colour
848
- nobody can look up. */
849
- name?: string;
850
- /** Any CSS colour value; without one the palette --uc-series-N. */
851
- color?: string;
852
- /** Height of a span as a fraction of one domain unit of the y axis. */
853
- height?: number;
854
- }
855
-
856
- export declare interface SpanSeriesConfig<T = unknown> extends SeriesBase<T> {
857
- kind: "span";
858
- /** End of the span on the x axis. Missing means open: the span runs to the end
859
- of the domain and is drawn as open. */
860
- to: Accessor<T>;
861
- /** Height of a span as a fraction of one domain unit of the y axis. */
862
- height?: number;
863
- }
864
-
934
+ /** A band of states: each point's state holds from its x until the next
935
+ point's. The last one holds until the latest reading of the chart - the
936
+ last x of any visible series on the same x axis - and where the band itself
937
+ reports last, one median step of its own x values past its last point;
938
+ never beyond the x domain. A state is claimed for as long as it was
939
+ reported, not until the axis' rounded end. */
865
940
  export declare function StateBand<T>(props: StateBandProps<T>): null;
866
941
 
867
942
  export declare interface StateBandProps<T> {
868
- /** Index of the state in `states`; null/undefined/NaN is a gap - and a gap
869
- stays a hole, it gets no colour for "unknown". A colour would be a claim
870
- about the interval. */
943
+ /** Index of the state in `states`; null/undefined/NaN/±Infinity is a gap -
944
+ and a gap stays a hole, it gets no colour for "unknown". A colour would
945
+ be a claim about the interval. */
871
946
  accessor: Accessor<T>;
872
947
  /** The closed set of states, in the order of their codes. */
873
948
  states: readonly StateEntry[];
@@ -881,6 +956,10 @@ export declare interface StateBandProps<T> {
881
956
  "Series n" and a warning stands in DEV - an unnamed series is a colour
882
957
  nobody can look up. */
883
958
  name?: string;
959
+ /** Not drawn, not hit and not counted for its axes' extent - a fixed
960
+ `domain` keeps the axis still. Its legend entry stays, drawn back.
961
+ Controlled: the caller sets it, typically from `Legend onToggle`. */
962
+ hidden?: boolean;
884
963
  /** Lower edge of the lane in domain units of the y axis. */
885
964
  laneFrom?: number;
886
965
  /** Upper edge of the lane in domain units of the y axis. */
@@ -936,6 +1015,9 @@ export declare interface TooltipHit<T = unknown> {
936
1015
  export declare interface TooltipPoint<T = unknown> {
937
1016
  seriesName: string;
938
1017
  color: string;
1018
+ /** The point's x value on its own x axis - with several x axes it can
1019
+ differ from the hit's. */
1020
+ xValue: number;
939
1021
  yValue: number;
940
1022
  datum: T;
941
1023
  index: number;
@@ -944,7 +1026,7 @@ export declare interface TooltipPoint<T = unknown> {
944
1026
  therefore the row. Putting both into one field would be exactly the
945
1027
  overloading ADR-0011 is written against. */
946
1028
  value?: number;
947
- /** Only for state series and spans: the section being pointed at.
1029
+ /** Only for state series: the section being pointed at.
948
1030
  A duration does not stand here - it is the difference of two numbers the
949
1031
  entry already carries, and formatting it would presuppose knowing what the
950
1032
  x axis means. The caller knows that, not this library. */
@@ -952,7 +1034,6 @@ export declare interface TooltipPoint<T = unknown> {
952
1034
  from: number;
953
1035
  to: number;
954
1036
  label: string;
955
- open: boolean;
956
1037
  };
957
1038
  }
958
1039
 
@@ -960,7 +1041,8 @@ export declare interface TooltipProps<T> {
960
1041
  /** "x": every series at the x position; "nearest": only the nearest point. */
961
1042
  mode?: "x" | "nearest";
962
1043
  /** Render prop for content of one's own; without it the built-in tooltip
963
- applies. */
1044
+ applies. Compared by its source text, like `tickFormat` - with the same
1045
+ closure limit. */
964
1046
  render?: (hit: TooltipHit<T>) => ReactNode;
965
1047
  }
966
1048
 
@@ -1030,19 +1112,47 @@ export declare function violations(values: readonly number[], limits: ControlLim
1030
1112
  export declare function XAxis<T>(props: XAxisProps<T>): null;
1031
1113
 
1032
1114
  export declare interface XAxisProps<T> extends CommonProps_2<T> {
1115
+ /** `"nice"` widens the data's extent to ticks, `"data"` keeps it, a pair is
1116
+ fixed - the one a zoom passes back. */
1117
+ domain?: "nice" | "data" | readonly [number, number];
1033
1118
  /** Which edge the axis stands at. A second x axis on the opposite edge is how
1034
1119
  a series counts in a unit of its own. */
1035
1120
  position?: "bottom" | "top";
1121
+ /** The values are instants (milliseconds since the epoch): ticks on local
1122
+ boundaries from the minute to the month, labels by level in en-GB with a
1123
+ 24-hour clock - `15:00`, `17 Mar`, `Mar 2026` - and the date on the first
1124
+ tick and on the first of a new day (`17 Mar 00:00`); a day tick there
1125
+ carries the year. The tooltip's x value carries the seconds where the
1126
+ readings lie less than a minute apart. Another language is a `tickFormat`,
1127
+ which is handed the instant. `calendar` implies it. */
1128
+ time?: boolean;
1036
1129
  /** Operating calendar: the intervals in which time counts. With it the axis
1037
1130
  stands in operating time - weekends and night shifts are out, and every
1038
1131
  removed span gets a break mark. The scale stays affine; the mapping happens
1039
1132
  in materialisation (ADR-0001). */
1040
1133
  calendar?: readonly OperatingInterval[];
1134
+ /** Zoom and pan, controlled: Ctrl or ⌘ with the wheel - and a pinch - zoom
1135
+ around the pointer, a drag, a horizontal wheel or Shift with the wheel pan,
1136
+ a double click proposes the whole data range. Each proposes a domain in
1137
+ the axis' units and changes nothing; the caller passes it back as
1138
+ `domain`, clamped as it likes. Without a handler the axis does not zoom,
1139
+ and the plain wheel always scrolls the page. */
1140
+ onDomainChange?: (domain: [number, number]) => void;
1041
1141
  }
1042
1142
 
1043
1143
  export declare function YAxis<T>(props: YAxisProps<T>): null;
1044
1144
 
1045
1145
  export declare interface YAxisProps<T> extends CommonProps_2<T> {
1146
+ /** As on the x axis, and `"visible"`: what the series show inside their x
1147
+ axis' domain - a zoomed hour gets the hour's range, not the week's -,
1148
+ widened to ticks as `"nice"` is. Where the x domain is not fixed that is
1149
+ every point. */
1150
+ domain?: "nice" | "data" | "visible" | readonly [number, number];
1151
+ /** On a further y axis: take the first y axis' tick count and widen this
1152
+ axis' domain until its ticks fall on that one's grid lines, the steps
1153
+ still 1-2-5 - one grid serves both. `tickCount` then does not apply; on
1154
+ the first y axis it changes nothing. */
1155
+ alignTicks?: boolean;
1046
1156
  /** Which edge the axis stands at. Several y axes per side are stacked
1047
1157
  outwards, so that extents of clearly different magnitude stay readable. */
1048
1158
  position?: "left" | "right";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/charts",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Canvas-based chart library - few chart kinds, uncompromisingly clean, high performance.",
5
5
  "license": "MIT",
6
6
  "author": "Roman Händler",
@@ -58,7 +58,7 @@
58
58
  "vite": "^6.0.0",
59
59
  "vite-plugin-dts": "^4.3.0",
60
60
  "@umriss-ui/demo": "0.0.0",
61
- "@umriss-ui/core": "0.3.2"
61
+ "@umriss-ui/core": "0.4.0"
62
62
  },
63
63
  "scripts": {
64
64
  "props": "node --disable-warning=ExperimentalWarning --experimental-strip-types demo/props.ts",