swiftplot 0.1.1 → 0.3.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.
Files changed (95) hide show
  1. package/README.md +71 -47
  2. package/dist/chart.d.ts +4 -0
  3. package/dist/chart.js +171 -86
  4. package/dist/charts/build.d.ts +52 -0
  5. package/dist/charts/build.js +63 -0
  6. package/dist/charts/candlestick.d.ts +8 -0
  7. package/dist/charts/candlestick.js +105 -0
  8. package/dist/charts/combo.d.ts +8 -0
  9. package/dist/charts/combo.js +50 -0
  10. package/dist/charts/controller.d.ts +2 -2
  11. package/dist/charts/controller.js +2 -2
  12. package/dist/charts/defaults.d.ts +10 -2
  13. package/dist/charts/defaults.js +67 -6
  14. package/dist/charts/distribution.d.ts +15 -0
  15. package/dist/charts/distribution.js +178 -0
  16. package/dist/charts/fields.d.ts +33 -3
  17. package/dist/charts/fields.js +150 -66
  18. package/dist/charts/flow.d.ts +15 -0
  19. package/dist/charts/flow.js +189 -0
  20. package/dist/charts/heatmap.d.ts +9 -0
  21. package/dist/charts/heatmap.js +104 -0
  22. package/dist/charts/index.d.ts +8 -1
  23. package/dist/charts/index.js +7 -0
  24. package/dist/charts/parts.d.ts +23 -0
  25. package/dist/charts/parts.js +66 -0
  26. package/dist/charts/radar.d.ts +7 -0
  27. package/dist/charts/radar.js +77 -0
  28. package/dist/charts/types.d.ts +562 -23
  29. package/dist/charts/xy.d.ts +35 -25
  30. package/dist/charts/xy.js +327 -126
  31. package/dist/features/animate.d.ts +10 -1
  32. package/dist/features/animate.js +3 -3
  33. package/dist/features/brush.d.ts +3 -1
  34. package/dist/features/brush.js +2 -1
  35. package/dist/features/legend.d.ts +1 -3
  36. package/dist/features/legend.js +4 -5
  37. package/dist/features/tooltip.d.ts +10 -2
  38. package/dist/features/tooltip.js +12 -10
  39. package/dist/features/zoom.d.ts +1 -0
  40. package/dist/features/zoom.js +22 -4
  41. package/dist/index.d.ts +2 -0
  42. package/dist/index.js +1 -0
  43. package/dist/marks/arcs.d.ts +10 -4
  44. package/dist/marks/arcs.js +2 -1
  45. package/dist/marks/area.d.ts +9 -8
  46. package/dist/marks/area.js +2 -2
  47. package/dist/marks/bar.d.ts +18 -10
  48. package/dist/marks/bar.js +5 -5
  49. package/dist/marks/box.d.ts +7 -1
  50. package/dist/marks/box.js +2 -8
  51. package/dist/marks/candlestick.d.ts +22 -0
  52. package/dist/marks/candlestick.js +133 -0
  53. package/dist/marks/common.d.ts +18 -0
  54. package/dist/marks/common.js +14 -0
  55. package/dist/marks/dots.d.ts +6 -5
  56. package/dist/marks/dots.js +3 -1
  57. package/dist/marks/errorBars.d.ts +9 -4
  58. package/dist/marks/errorBars.js +21 -1
  59. package/dist/marks/funnel.d.ts +8 -3
  60. package/dist/marks/funnel.js +2 -1
  61. package/dist/marks/heatmap.d.ts +8 -7
  62. package/dist/marks/line.d.ts +8 -6
  63. package/dist/marks/radar.d.ts +9 -2
  64. package/dist/marks/radar.js +9 -2
  65. package/dist/marks/radialBars.d.ts +12 -5
  66. package/dist/marks/rule.d.ts +19 -0
  67. package/dist/marks/rule.js +4 -1
  68. package/dist/marks/sankey.d.ts +14 -2
  69. package/dist/marks/sankey.js +4 -1
  70. package/dist/marks/sunburst.d.ts +5 -0
  71. package/dist/marks/sunburst.js +2 -1
  72. package/dist/marks/ticks.d.ts +4 -1
  73. package/dist/marks/tree.d.ts +14 -6
  74. package/dist/marks/tree.js +6 -3
  75. package/dist/marks/treemap.d.ts +5 -0
  76. package/dist/marks/treemap.js +7 -2
  77. package/dist/paint.d.ts +6 -1
  78. package/dist/paint.js +6 -1
  79. package/dist/scale.d.ts +1 -1
  80. package/dist/scale.js +4 -3
  81. package/dist/scales/band.d.ts +3 -0
  82. package/dist/scales/band.js +5 -1
  83. package/dist/scales/bare.d.ts +4 -1
  84. package/dist/scales/bare.js +4 -1
  85. package/dist/scales/color.d.ts +2 -0
  86. package/dist/scales/log.d.ts +8 -1
  87. package/dist/scales/log.js +3 -2
  88. package/dist/scales/time.d.ts +7 -0
  89. package/dist/scales/time.js +3 -1
  90. package/dist/text.d.ts +8 -0
  91. package/dist/text.js +33 -0
  92. package/dist/transforms.d.ts +11 -7
  93. package/dist/transforms.js +8 -7
  94. package/dist/types.d.ts +44 -13
  95. package/package.json +2 -2
@@ -1,104 +1,643 @@
1
1
  import type { AnimateOptions } from '../features/animate.js';
2
+ import type { BrushOptions } from '../features/brush.js';
2
3
  import type { LegendOptions } from '../features/legend.js';
3
4
  import type { ZoomOptions } from '../features/zoom.js';
4
5
  import type { LineOptions } from '../marks/line.js';
6
+ import type { Nested } from '../marks/tree.js';
7
+ import type { Gradient, Paint } from '../paint.js';
8
+ import type { ColorScale } from '../scales/color.js';
5
9
  import type { TimeOptions } from '../scales/time.js';
6
10
  import type { Theme } from '../theme.js';
7
- import type { Axis, Options } from '../types.js';
11
+ import type { Axis, Col, Options } from '../types.js';
8
12
  import type { Accessor, Data } from './source.js';
9
- export type YAxisProps = {
13
+ type AxisProps = {
14
+ /** The axis title; the field's name by default, none for the row index, an accessor or several y fields. */
10
15
  label?: string;
11
- domain?: Axis['domain'];
16
+ };
17
+ export type YAxisProps = AxisProps & {
18
+ /** Ticks at the multiples of this, thinned to every k-th when their labels do not fit. */
12
19
  step?: number;
20
+ /** The text of each tick, and of the values in the tooltip. */
13
21
  format?: (v: number) => string;
22
+ /** Which series the automatic extent covers: those shown, all of them, or those inside the x window. @default 'shown' */
14
23
  fit?: Axis['fit'];
24
+ /** 'nice' widens the extent to whole steps, 'data' keeps it exact. @default 'nice' */
25
+ domain?: Axis['domain'];
15
26
  };
16
- export type XAxisProps = YAxisProps & {
27
+ export type XAxisProps = AxisProps & {
28
+ /** On numbers, ticks at the multiples of this, thinned to every k-th when their labels do not fit; dates, text and bars ignore it. */
29
+ step?: number;
30
+ /** On numbers and dates, the text of each tick and of x in a scatter's or histogram's tooltip; text and bars ignore it. */
31
+ format?: (v: number) => string;
32
+ /** On numbers and dates, which series the automatic extent covers: those shown or all of them; text and bars ignore it. @default 'shown' */
33
+ fit?: Axis['fit'];
34
+ /** On numbers 'nice' (the default) widens to whole steps and 'data' keeps it exact; dates fit the data unless given `[from, to]` in ms; text and bars ignore it. */
35
+ domain?: Axis['domain'];
36
+ /** Reads dates without a zone, and labels the axis, in UTC; `false` uses local time, except on bars, which are always UTC. @default true */
17
37
  utc?: boolean;
38
+ /** Puts date ticks on the boundaries of this unit; left out, the step is chosen for the span shown. */
18
39
  unit?: TimeOptions['unit'];
40
+ /** With `unit`, a tick every this many units. @default 1 */
19
41
  every?: number;
20
42
  };
21
- export type Base = {
22
- dataVersion?: number;
43
+ export type Axes = {
44
+ /** Settings for the x axis; which apply depends on whether x is numbers, dates or text. */
23
45
  xAxis?: XAxisProps;
46
+ /** Settings for the y axis. */
24
47
  yAxis?: YAxisProps;
48
+ /** Zoom and pan, or their options. @default false */
49
+ zoom?: boolean | ZoomOptions;
50
+ /** The part of each axis shown, in its values; kept by the chart unless given. */
51
+ view?: Options['view'];
52
+ /** Called with the window shown once zoom or pan has moved it; never for update(). */
53
+ onViewChange?: Options['onViewChange'];
54
+ };
55
+ type ScaledYAxisProps = YAxisProps & {
56
+ /** 'log' spaces equal ratios equally; a value at or below zero is then a gap, and `step` does not apply. @default 'linear' */
57
+ scale?: 'linear' | 'log';
58
+ };
59
+ export type ScaledAxes = {
60
+ /** Settings for the y axis. */
61
+ yAxis?: ScaledYAxisProps;
62
+ /** Settings for the right-hand axis of `y2`, which is drawn only with it. */
63
+ y2Axis?: ScaledYAxisProps;
64
+ };
65
+ /** A date, as a Date, in ms or as an ISO string, a number, or a category: whichever the x axis shows. */
66
+ export type XValue = number | string | Date;
67
+ type Rule = {
68
+ /** Written beside the line, where it fits. */
69
+ text?: string;
70
+ /** Draws the line dashed. @default false */
71
+ dashed?: boolean;
72
+ /** A CSS colour; the theme's text colour when left out. */
73
+ color?: string;
74
+ } & ({
75
+ /** Where the line stands on the x axis; one not on it is not drawn. */
76
+ x: XValue;
77
+ y?: never;
78
+ } | {
79
+ /** Where the line lies on the y axis. */
80
+ y: number;
81
+ x?: never;
82
+ });
83
+ type Zone = {
84
+ /** Written in the band's top left corner, where it fits. */
85
+ text?: string;
86
+ /** A CSS colour, drawn faint; the theme's muted colour when left out. */
87
+ color?: string;
88
+ } & ({
89
+ /** The band's two edges on the x axis; two categories cover both in full. */
90
+ x: readonly [XValue, XValue];
91
+ y?: never;
92
+ } | {
93
+ /** The band's two edges on the y axis. */
94
+ y: readonly [number, number];
95
+ x?: never;
96
+ });
97
+ type Brush = {
98
+ /** The axes a drag marks out a range on. @default 'x' */
99
+ axes?: BrushOptions['axes'];
100
+ };
101
+ export type Overlays = {
102
+ /** Lines across the plot over the data, each `{ x }` or `{ y }` with an optional `text`, `dashed` and `color`. */
103
+ rules?: readonly Rule[];
104
+ /** Shaded bands under the data, each `{ x: [from, to] }` or `{ y: [from, to] }` with an optional `text` and `color`. */
105
+ zones?: readonly Zone[];
106
+ /** A drag marks out a range, on x unless `{ axes }` says otherwise; with `zoom`, its release shows the range. @default false */
107
+ brush?: boolean | Brush;
108
+ /** Called with the range brushed, in axis values, on release, and with null once a range left standing is cleared. */
109
+ onBrush?: BrushOptions['onSelect'];
110
+ };
111
+ export type SecondAxis = {
112
+ /** Settings for the right-hand axis of `y2`, which is drawn only with it. */
113
+ y2Axis?: YAxisProps;
114
+ };
115
+ export type Base = {
116
+ /** Bump after changing the data in place, so that it is converted again. */
117
+ dataVersion?: number;
118
+ /** Series colours in order; `palette`, or `paletteDark` on the dark theme, by default. */
25
119
  colors?: readonly string[];
120
+ /** 'auto' follows the CSS `color-scheme` of the chart's element. @default 'auto' */
26
121
  theme?: 'auto' | 'light' | 'dark' | Theme;
122
+ /** The hover tooltip, with each value in the format of its axis, else two decimals at most. @default true */
27
123
  tooltip?: boolean;
124
+ /** The legend, which hides and shows series, or its options; shown with two or more series. @default true */
28
125
  legend?: boolean | LegendOptions;
29
- zoom?: boolean | ZoomOptions;
126
+ /** Animation, or its options. @default false */
30
127
  animate?: boolean | AnimateOptions;
128
+ /** Width in CSS pixels; the chart follows its container when it is left out. */
31
129
  width?: number;
130
+ /** Height in CSS pixels; the chart follows its container when it is left out. */
32
131
  height?: number;
132
+ /** CSS pixels around the plot area; a side left out is sized from the labels. */
33
133
  margin?: Options['margin'];
134
+ /** What assistive technology reads for the chart; by default the axis labels and the series names. */
34
135
  description?: string;
35
- view?: Options['view'];
36
- onViewChange?: Options['onViewChange'];
136
+ /** The series not drawn, by name; kept by the chart unless given. */
37
137
  hidden?: string[];
138
+ /** Called with the hidden series once the legend has changed them; never for update(). */
38
139
  onHiddenChange?: Options['onHiddenChange'];
140
+ /** Rows the app has picked out: bars and dots outline them, while a line or an area redraws its series. */
39
141
  selected?: Options['selected'];
142
+ /** Called for a click on the plot with what is within 20 px of it, or null, and the values there. */
40
143
  onClick?: Options['onClick'];
144
+ /** A pointer to show as if the user's were there, such as another chart's. */
41
145
  pointer?: Options['pointer'];
146
+ /** Called as the user's pointer moves over the plot, and with null as it leaves; never for update(). */
42
147
  onPointerChange?: Options['onPointerChange'];
43
148
  };
44
149
  type Name<T> = keyof T & string;
45
150
  type OneOrMore<T> = T | readonly T[];
46
- type NumberKey<R> = {
47
- [K in Name<R>]: NonNullable<R[K]> extends number ? K : never;
151
+ type NumberKey<R, N = number> = {
152
+ [K in Name<R>]: NonNullable<R[K]> extends N ? K : never;
48
153
  }[Name<R>];
49
- type NumberColumn<C> = {
50
- [K in Name<C>]: C[K] extends ArrayLike<infer V> ? (NonNullable<V> extends number ? K : never) : never;
154
+ type NumberColumn<C, N = number> = {
155
+ [K in Name<C>]: C[K] extends ArrayLike<infer V> ? (NonNullable<V> extends N ? K : never) : never;
51
156
  }[Name<C>];
52
157
  export type Field<R> = Name<R> | Accessor<R>;
53
158
  export type YField<R> = NumberKey<R> | Accessor<R>;
54
159
  /** The pairs tuple lets an array literal of pairs be inferred as tuples rather than as rows. */
55
160
  export type Input = Data | readonly (readonly [unknown, unknown])[];
56
- export type RowProps<R> = Base & {
161
+ export type RowProps<R> = Axes & SecondAxis & Base & {
162
+ /** Row objects; missing, null or empty draws an empty frame. */
57
163
  data?: readonly R[] | null;
164
+ /** The x field, by name or as an accessor `(row, index) => value`; guessed when left out. */
58
165
  x?: Field<R>;
166
+ /** The field or fields of numbers drawn, one series each, by name or accessor; guessed when left out. */
59
167
  y?: OneOrMore<YField<R>>;
168
+ /** The field or fields of numbers drawn against a right-hand axis, one more series each, by name or accessor; never guessed, and not with `series` or `errorBars`. */
169
+ y2?: OneOrMore<YField<R>>;
170
+ /** For long data, the field whose distinct values each give a series. */
60
171
  series?: Field<R>;
61
172
  };
62
- export type ColumnProps<C> = Base & {
173
+ export type ColumnProps<C> = Axes & SecondAxis & Base & {
174
+ /** An object of columns, arrays or typed arrays of one length; missing, null or empty draws an empty frame. */
63
175
  data?: C | null;
176
+ /** The x column, by name; guessed when left out. */
64
177
  x?: Name<C>;
178
+ /** The column or columns of numbers drawn, one series each; guessed when left out. */
65
179
  y?: OneOrMore<NumberColumn<C>>;
180
+ /** The column or columns of numbers drawn against a right-hand axis, one more series each; never guessed, and not with `series` or `errorBars`. */
181
+ y2?: OneOrMore<NumberColumn<C>>;
182
+ /** For long data, the column whose distinct values each give a series. */
66
183
  series?: Name<C>;
67
184
  };
68
185
  type Positional = {
69
186
  x?: never;
70
187
  y?: never;
188
+ y2?: never;
189
+ y2Axis?: never;
71
190
  series?: never;
72
191
  };
73
- export type NumberProps = Base & Positional & {
192
+ export type NumberProps = Axes & Base & Positional & {
193
+ /** Numbers drawn against their index as the series `value`; missing, null or empty draws an empty frame. */
74
194
  data?: ArrayLike<number | null | undefined> | null;
75
195
  };
76
- export type PairProps = Base & Positional & {
196
+ export type PairProps = Axes & Base & Positional & {
197
+ /** `[x, y]` pairs drawn as the series `y`; a row of any other length throws. */
77
198
  data?: readonly (readonly unknown[])[] | null;
78
199
  };
79
200
  /** Before any data is given the fields cannot be checked. */
80
- type LooseProps = Base & {
201
+ type LooseProps = Axes & SecondAxis & Base & {
81
202
  data?: null;
82
203
  x?: string;
83
204
  y?: OneOrMore<string>;
205
+ y2?: OneOrMore<string>;
84
206
  series?: string;
85
207
  };
86
208
  export type Props<D> = {
87
209
  data?: D | null;
88
210
  } & (0 extends 1 & D ? LooseProps : [D] extends [ArrayLike<number | null | undefined>] ? NumberProps : [D] extends [readonly (readonly unknown[])[]] ? PairProps : [D] extends [readonly (infer R)[]] ? RowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? ColumnProps<D> : LooseProps);
89
211
  type Curve = {
212
+ /** How the points are joined: straight, stepped or smooth. @default 'linear' */
90
213
  curve?: LineOptions['curve'];
214
+ /** Draws straight across a missing value instead of leaving a gap. @default false */
91
215
  join?: boolean;
92
216
  };
93
- export type LineProps<D> = Props<D> & Curve;
94
- export type AreaProps<D> = Props<D> & Curve & {
217
+ export type ErrorBars<F> = {
218
+ /** The field of numbers each error bar starts at, as a value on the y axis and not a distance from y; a row without it has no bar. */
219
+ low: F;
220
+ /** The field of numbers each error bar ends at, as a value on the y axis. */
221
+ high: F;
222
+ /** Half the length of the line across each end, in CSS pixels; 0 leaves the bare bar. @default 4 */
223
+ cap?: number;
224
+ /** The width of the lines in CSS pixels. @default 1 */
225
+ width?: number;
226
+ };
227
+ export type ErrorBarsOn<F> = ErrorBars<F> & {
228
+ /** The axis low and high are values on, the bars running along it. @default 'x' with a text y, else 'y' */
229
+ axis?: 'x' | 'y';
230
+ };
231
+ export type LineProps<D> = Props<D> & ScaledAxes & Overlays & Curve & {
232
+ /** Shades the area under each line down to the bottom of the plot: `true` for a faint fade of its colour, or a gradient. @default false */
233
+ fill?: boolean | Gradient;
234
+ /** An upright bar from low to high at each x, under the line and in its colour; takes one y, with series or without. */
235
+ errorBars?: ErrorBars<NonNullable<Exclude<Props<D>['y'], readonly unknown[]>>>;
236
+ };
237
+ export type AreaProps<D> = Props<D> & Overlays & Curve & {
238
+ /** Stacks the series of each y axis, a missing value counting as zero; unstacked areas overlap, half transparent. @default false */
95
239
  stack?: boolean;
96
240
  };
97
- export type BarProps<D> = Props<D> & {
241
+ export type BarProps<D> = Props<D> & Overlays & {
242
+ /** Stacks the series, not with `y2`; unstacked bars stand side by side. @default false */
98
243
  stack?: boolean;
244
+ /** An upright bar from low to high over each bar, in the text colour; takes one y, and no stacked series. */
245
+ errorBars?: ErrorBars<NonNullable<Exclude<Props<D>['y'], readonly unknown[]>>>;
99
246
  };
100
- export type ScatterProps<D> = Props<D> & {
101
- y?: Exclude<Props<D>['y'], readonly unknown[]>;
247
+ type NotNumbersOrText<D> = [D] extends [readonly (infer R)[]] ? Exclude<Name<R>, NumberKey<R, number | string>> : [D] extends [Record<string, ArrayLike<unknown>>] ? Exclude<Name<D>, NumberColumn<D, number | string>> : never;
248
+ export type ScatterProps<D> = {
249
+ /** Row objects, an object of columns, numbers or pairs; missing, null or empty draws an empty frame. */
250
+ data?: D | null;
251
+ } & Omit<Props<D>, 'y'> & ScaledAxes & Overlays & {
252
+ /** The one y field, of numbers, or of text for a band per category in order of first appearance, by name or, on rows, an accessor; the next number field when left out. A text y takes only `label` from `yAxis`. */
253
+ y?: Exclude<Props<D>['x'], NotNumbersOrText<D>>;
254
+ /** A tick is an upright line that answers no tooltip, click or selection, and takes no `ring` and no field of `r`. @default 'dot' */
255
+ shape?: 'dot' | 'tick';
256
+ /** The dot radius in CSS pixels, or a field of radii, where a row with a missing r is dropped; how far a tick reaches above and below its point. @default 4 */
102
257
  r?: number | NonNullable<Exclude<Props<D>['y'], readonly unknown[]>>;
258
+ /** The dots' opacity, from 0 to 1. @default 1 */
259
+ alpha?: number;
260
+ /** Draws each dot as a ring of its colour this many CSS pixels wide; filled when left out. */
261
+ ring?: number;
262
+ /** A bar from low to high at each dot, under the dots and in their colour: upright, or lying down with `axis: 'x'` or a text y, where low and high are values on the x axis and x is numbers; takes one y, with series or without. */
263
+ errorBars?: ErrorBarsOn<NonNullable<Exclude<Props<D>['y'], readonly unknown[]>>>;
264
+ };
265
+ export type PartRowProps<R> = Base & {
266
+ /** Row objects, one part each; missing, null or empty draws an empty frame. */
267
+ data?: readonly R[] | null;
268
+ /** The field that names each part, by name or as an accessor `(row, index) => value`; the first text field when left out. */
269
+ label?: Field<R>;
270
+ /** The field of numbers the parts stand for, by name or accessor; the only number field when left out. */
271
+ value?: YField<R>;
272
+ };
273
+ export type PartColumnProps<C> = Base & {
274
+ /** An object of columns, arrays or typed arrays of one length, a part per index; missing, null or empty draws an empty frame. */
275
+ data?: C | null;
276
+ /** The column that names each part; the first text column when left out. */
277
+ label?: Name<C>;
278
+ /** The column of numbers the parts stand for; the only number column when left out. */
279
+ value?: NumberColumn<C>;
280
+ };
281
+ type PositionalPart = {
282
+ label?: never;
283
+ value?: never;
284
+ };
285
+ export type PartNumberProps = Base & PositionalPart & {
286
+ /** Numbers, one unnamed part each; missing, null or empty draws an empty frame. */
287
+ data?: ArrayLike<number | null | undefined> | null;
288
+ };
289
+ export type PartPairProps = Base & PositionalPart & {
290
+ /** `[label, value]` pairs, one part each; a row of any other length throws. */
291
+ data?: readonly (readonly unknown[])[] | null;
292
+ };
293
+ type LoosePartProps = Base & {
294
+ data?: null;
295
+ label?: string;
296
+ value?: string;
297
+ };
298
+ export type PartProps<D> = {
299
+ data?: D | null;
300
+ } & (0 extends 1 & D ? LoosePartProps : [D] extends [ArrayLike<number | null | undefined>] ? PartNumberProps : [D] extends [readonly (readonly unknown[])[]] ? PartPairProps : [D] extends [readonly (infer R)[]] ? PartRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? PartColumnProps<D> : LoosePartProps);
301
+ export type PieProps<D> = PartProps<D> & {
302
+ /** The hole's share of the radius, from 0 to 1; above 0 the pie is a donut. @default 0 */
303
+ inner?: number;
304
+ /** Writes each slice's share on it, where there is room. @default true */
305
+ text?: boolean;
306
+ /** Each slice starts at this opacity, from 0 to 1, and reaches its full colour at its end; solid when left out. */
307
+ sweep?: number;
308
+ };
309
+ export type FunnelProps<D> = PartProps<D> & {
310
+ /** Writes each stage's name and its share of the first stage. @default true */
311
+ text?: boolean;
312
+ /** One blend over the whole funnel in place of a colour per stage. */
313
+ fill?: Gradient;
314
+ };
315
+ export type RadialBarProps<D> = PartProps<D> & {
316
+ /** What three quarters of a turn stand for, capping larger values; the largest rounded up when left out. */
317
+ max?: number;
318
+ /** Each bar starts at this opacity, from 0 to 1, and reaches its full colour at its end; solid when left out. */
319
+ sweep?: number;
320
+ /** The share of the radius left empty in the middle. @default 0.3 */
321
+ inner?: number;
322
+ };
323
+ export type RadarRowProps<R> = Base & {
324
+ /** Row objects, one spoke each; missing, null or empty draws an empty frame. */
325
+ data?: readonly R[] | null;
326
+ /** The field that names each spoke, by name or as an accessor `(row, index) => value`; the first text field when left out. */
327
+ x?: Field<R>;
328
+ /** The field or fields of numbers drawn, one shape each, by name or accessor; every number field left when left out. */
329
+ y?: OneOrMore<YField<R>>;
330
+ };
331
+ export type RadarColumnProps<C> = Base & {
332
+ /** An object of columns, arrays or typed arrays of one length, a spoke per index; missing, null or empty draws an empty frame. */
333
+ data?: C | null;
334
+ /** The column that names each spoke; the first text column when left out. */
335
+ x?: Name<C>;
336
+ /** The column or columns of numbers drawn, one shape each; every number column left when left out. */
337
+ y?: OneOrMore<NumberColumn<C>>;
338
+ };
339
+ type PositionalRadar = {
340
+ x?: never;
341
+ y?: never;
342
+ };
343
+ export type RadarNumberProps = Base & PositionalRadar & {
344
+ /** Numbers, one unnamed spoke each, drawn as the shape `value`; missing, null or empty draws an empty frame. */
345
+ data?: ArrayLike<number | null | undefined> | null;
346
+ };
347
+ export type RadarPairProps = Base & PositionalRadar & {
348
+ /** `[name, value]` pairs, one spoke each, drawn as the shape `y`; a row of any other length throws. */
349
+ data?: readonly (readonly unknown[])[] | null;
350
+ };
351
+ type LooseRadarProps = Base & {
352
+ data?: null;
353
+ x?: string;
354
+ y?: OneOrMore<string>;
355
+ };
356
+ export type RadarProps<D> = {
357
+ data?: D | null;
358
+ } & (0 extends 1 & D ? LooseRadarProps : [D] extends [ArrayLike<number | null | undefined>] ? RadarNumberProps : [D] extends [readonly (readonly unknown[])[]] ? RadarPairProps : [D] extends [readonly (infer R)[]] ? RadarRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? RadarColumnProps<D> : LooseRadarProps) & {
359
+ /** What the rim stands for, capping larger values; the largest rounded up to a whole step when left out. */
360
+ max?: number;
361
+ /** The opacity of each shape's filling, from 0 to 1; 0 leaves only the outline. @default 0.15 */
362
+ fill?: number;
363
+ };
364
+ export type HeatmapRowProps<R> = Base & {
365
+ /** Row objects, one cell each, a later row for the same cell winning; a grid over 10,000,000 cells throws; missing, null or empty draws an empty frame. */
366
+ data?: readonly R[] | null;
367
+ /** The field whose distinct values are the columns, text in order of first appearance, numbers and dates ascending, by name or as an accessor `(row, index) => value`; the first field of text or dates left when left out. */
368
+ x?: Field<R>;
369
+ /** The field whose distinct values are the rows of the grid, from the bottom up, text in order of first appearance, numbers and dates ascending, by name or accessor; the next field of text or dates when left out. */
370
+ y?: Field<R>;
371
+ /** The field of numbers the cells are coloured by, by name or accessor; the only number field left when left out. */
372
+ value?: YField<R>;
373
+ };
374
+ export type HeatmapColumnProps<C> = Base & {
375
+ /** An object of columns, arrays or typed arrays of one length, a cell per index, a later one for the same cell winning; a grid over 10,000,000 cells throws; missing, null or empty draws an empty frame. */
376
+ data?: C | null;
377
+ /** The column whose distinct values are the columns of the grid, text in order of first appearance, numbers and dates ascending; the first column of text or dates left when left out. */
378
+ x?: Name<C>;
379
+ /** The column whose distinct values are the rows of the grid, from the bottom up, text in order of first appearance, numbers and dates ascending; the next column of text or dates when left out. */
380
+ y?: Name<C>;
381
+ /** The column of numbers the cells are coloured by; the only number column left when left out. */
382
+ value?: NumberColumn<C>;
383
+ };
384
+ type LooseHeatmapProps = Base & {
385
+ data?: readonly never[] | null;
386
+ x?: string;
387
+ y?: string;
388
+ value?: string;
389
+ };
390
+ export type HeatmapProps<D> = {
391
+ data?: D | null;
392
+ } & (0 extends 1 & D ? LooseHeatmapProps : [D] extends [ArrayLike<number | null | undefined> | readonly (readonly unknown[])[]] ? LooseHeatmapProps : [D] extends [readonly (infer R)[]] ? HeatmapRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? HeatmapColumnProps<D> : LooseHeatmapProps) & {
393
+ /** The colours the values run through; from pale to dark blue over the values drawn when left out. */
394
+ color?: ColorScale;
395
+ /** Not used: the cells take their colours from `color`. */
396
+ colors?: readonly string[];
397
+ /** The strip of colours with the lowest and the highest value, or the legend's options. @default true */
398
+ legend?: boolean | LegendOptions;
399
+ /** The x axis, which names every column. */
400
+ xAxis?: AxisProps;
401
+ /** The y axis, which names every row of the grid. */
402
+ yAxis?: AxisProps;
403
+ };
404
+ type HistogramBase = Omit<Axes, 'xAxis'> & Base & {
405
+ /** Settings for the x axis of the values counted. */
406
+ xAxis?: Omit<XAxisProps, 'utc' | 'unit' | 'every'>;
407
+ };
408
+ export type HistogramRowProps<R> = HistogramBase & {
409
+ /** Row objects; missing, null or empty draws an empty frame. */
410
+ data?: readonly R[] | null;
411
+ /** The field of numbers counted, by name or as an accessor `(row, index) => value`; the only number field when left out. */
412
+ x?: YField<R>;
413
+ };
414
+ export type HistogramColumnProps<C> = HistogramBase & {
415
+ /** An object of columns, arrays or typed arrays of one length; missing, null or empty draws an empty frame. */
416
+ data?: C | null;
417
+ /** The column of numbers counted; the only number column when left out. */
418
+ x?: NumberColumn<C>;
419
+ };
420
+ export type HistogramNumberProps = HistogramBase & {
421
+ /** Numbers to count; missing, null or empty draws an empty frame. */
422
+ data?: ArrayLike<number | null | undefined> | null;
423
+ /** Not used: the numbers are the values counted. */
424
+ x?: never;
425
+ };
426
+ type LooseHistogramProps = HistogramBase & {
427
+ data?: readonly never[] | null;
428
+ x?: string;
429
+ };
430
+ export type HistogramProps<D> = {
431
+ data?: D | null;
432
+ } & (0 extends 1 & D ? LooseHistogramProps : [D] extends [ArrayLike<number | null | undefined>] ? HistogramNumberProps : [D] extends [readonly (readonly unknown[])[]] ? LooseHistogramProps : [D] extends [readonly (infer R)[]] ? HistogramRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? HistogramColumnProps<D> : LooseHistogramProps) & {
433
+ /** How many equal bins span the values, at most 1,000,000, or the bin edges in ascending order; Sturges' rule when left out. */
434
+ bins?: number | Col;
435
+ /** The bars' colour, as the first of a list. */
436
+ colors?: readonly string[];
437
+ /** The y axis of the counts, titled `count` unless given a label. */
438
+ yAxis?: YAxisProps;
439
+ };
440
+ type BoxPlotBase = Base & {
441
+ /** What the boxes are filled with: a colour, drawn faint, or a blend down each box; faint in the boxes' colour when left out. */
442
+ fill?: Paint;
443
+ /** The boxes' colour, as the first of a list. */
444
+ colors?: readonly string[];
445
+ /** The x axis, which names every box. */
446
+ xAxis?: AxisProps;
447
+ /** Settings for the y axis. */
448
+ yAxis?: YAxisProps;
449
+ };
450
+ export type BoxPlotRowProps<R> = BoxPlotBase & {
451
+ /** Row objects, one value each; missing, null or empty draws an empty frame. */
452
+ data?: readonly R[] | null;
453
+ /** The field whose distinct values each give a box, in order of first appearance, by name or as an accessor `(row, index) => value`; the only text field when left out, where its values repeat; one box with no text field, or null. */
454
+ x?: Field<R> | null;
455
+ /** The field of numbers the boxes sum up, by name or accessor; the only number field when left out. */
456
+ y?: YField<R>;
457
+ };
458
+ export type BoxPlotColumnProps<C> = BoxPlotBase & {
459
+ /** An object of columns, arrays or typed arrays of one length; missing, null or empty draws an empty frame. */
460
+ data?: C | null;
461
+ /** The column whose distinct values each give a box, in order of first appearance; the only text column when left out, where its values repeat; one box with no text column, or null. */
462
+ x?: Name<C> | null;
463
+ /** The column of numbers the boxes sum up; the only number column when left out. */
464
+ y?: NumberColumn<C>;
465
+ };
466
+ type PositionalBoxPlot = {
467
+ x?: never;
468
+ y?: never;
469
+ };
470
+ export type BoxPlotNumberProps = BoxPlotBase & PositionalBoxPlot & {
471
+ /** Numbers, drawn as one box; missing, null or empty draws an empty frame. */
472
+ data?: ArrayLike<number | null | undefined> | null;
473
+ };
474
+ export type BoxPlotPairProps = BoxPlotBase & PositionalBoxPlot & {
475
+ /** `[group, value]` pairs; a row of any other length throws. */
476
+ data?: readonly (readonly unknown[])[] | null;
477
+ };
478
+ type LooseBoxPlotProps = BoxPlotBase & {
479
+ data?: null;
480
+ x?: string | null;
481
+ y?: string;
482
+ };
483
+ export type BoxPlotProps<D> = {
484
+ data?: D | null;
485
+ } & (0 extends 1 & D ? LooseBoxPlotProps : [D] extends [ArrayLike<number | null | undefined>] ? BoxPlotNumberProps : [D] extends [readonly (readonly unknown[])[]] ? BoxPlotPairProps : [D] extends [readonly (infer R)[]] ? BoxPlotRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? BoxPlotColumnProps<D> : LooseBoxPlotProps);
486
+ type CandlestickBase = Axes & Base & {
487
+ /** The colour of a candle whose close is not below its open; the first of `colors` when left out. */
488
+ up?: string;
489
+ /** The colour of a candle whose close is below its open; the first of `colors` when left out. */
490
+ down?: string;
491
+ /** The candles' colour where `up` or `down` is left out, as the first of a list. */
492
+ colors?: readonly string[];
493
+ /** The x axis: dates, a category per candle for text, or a scale of numbers. */
494
+ xAxis?: XAxisProps;
495
+ };
496
+ export type CandlestickRowProps<R> = CandlestickBase & {
497
+ /** Row objects, one candle each; missing, null or empty draws an empty frame. */
498
+ data?: readonly R[] | null;
499
+ /** Where each candle stands, by name or as an accessor `(row, index) => value`; the first field of dates, else of text, when left out. */
500
+ x?: Field<R>;
501
+ /** The field of prices each candle opens at, by name or accessor; the one called open, in any case, when left out. */
502
+ open?: YField<R>;
503
+ /** The field of highest prices, by name or accessor; the one called high, in any case, when left out. */
504
+ high?: YField<R>;
505
+ /** The field of lowest prices, by name or accessor; the one called low, in any case, when left out. */
506
+ low?: YField<R>;
507
+ /** The field of prices each candle closes at, by name or accessor; the one called close, in any case, when left out. */
508
+ close?: YField<R>;
509
+ };
510
+ export type CandlestickColumnProps<C> = CandlestickBase & {
511
+ /** An object of columns, arrays or typed arrays of one length, a candle per index; missing, null or empty draws an empty frame. */
512
+ data?: C | null;
513
+ /** The column of where each candle stands; the first column of dates, else of text, when left out. */
514
+ x?: Name<C>;
515
+ /** The column of prices each candle opens at; the one called open, in any case, when left out. */
516
+ open?: NumberColumn<C>;
517
+ /** The column of highest prices; the one called high, in any case, when left out. */
518
+ high?: NumberColumn<C>;
519
+ /** The column of lowest prices; the one called low, in any case, when left out. */
520
+ low?: NumberColumn<C>;
521
+ /** The column of prices each candle closes at; the one called close, in any case, when left out. */
522
+ close?: NumberColumn<C>;
523
+ };
524
+ type LooseCandlestickProps = CandlestickBase & {
525
+ data?: readonly never[] | null;
526
+ x?: string;
527
+ open?: string;
528
+ high?: string;
529
+ low?: string;
530
+ close?: string;
531
+ };
532
+ export type CandlestickProps<D> = {
533
+ data?: D | null;
534
+ } & (0 extends 1 & D ? LooseCandlestickProps : [D] extends [ArrayLike<number | null | undefined> | readonly (readonly unknown[])[]] ? LooseCandlestickProps : [D] extends [readonly (infer R)[]] ? CandlestickRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? CandlestickColumnProps<D> : LooseCandlestickProps);
535
+ type ComboBase = Axes & ScaledAxes & Overlays & Base & {
536
+ /** Series colours in the order `lines`, `bars`, `y2Lines`, `y2Bars`; `palette`, or `paletteDark` on the dark theme, by default. */
537
+ colors?: readonly string[];
538
+ /** Stacks the bars, not with both `bars` and `y2Bars`; unstacked bars stand side by side. @default false */
539
+ stack?: boolean;
540
+ /** Settings for the x axis: a category per row for text, else a scale of dates or numbers, on which the bars of one x take 0.6 of the smallest gap. */
541
+ xAxis?: XAxisProps;
542
+ /** Settings for the y axis; a log scale is for lines alone. */
543
+ yAxis?: ScaledYAxisProps;
544
+ /** Settings for the right-hand axis of `y2Lines` and `y2Bars`, drawn only with one of them; a log scale is for lines alone. */
545
+ y2Axis?: ScaledYAxisProps;
546
+ };
547
+ export type ComboRowProps<R> = ComboBase & {
548
+ /** Row objects; missing, null or empty draws an empty frame. */
549
+ data?: readonly R[] | null;
550
+ /** The x field, by name or as an accessor `(row, index) => value`; the first field of dates, else of text, else of numbers left, else the row index, when left out. */
551
+ x?: Field<R>;
552
+ /** The field or fields of numbers drawn as lines, by name or accessor. */
553
+ lines?: OneOrMore<YField<R>>;
554
+ /** The field or fields of numbers drawn as bars, by name or accessor. */
555
+ bars?: OneOrMore<YField<R>>;
556
+ /** The field or fields of numbers drawn as lines against a right-hand axis, by name or accessor. */
557
+ y2Lines?: OneOrMore<YField<R>>;
558
+ /** The field or fields of numbers drawn as bars against a right-hand axis, by name or accessor. */
559
+ y2Bars?: OneOrMore<YField<R>>;
560
+ };
561
+ export type ComboColumnProps<C> = ComboBase & {
562
+ /** An object of columns, arrays or typed arrays of one length; missing, null or empty draws an empty frame. */
563
+ data?: C | null;
564
+ /** The x column; the first column of dates, else of text, else of numbers left, else the row index, when left out. */
565
+ x?: Name<C>;
566
+ /** The column or columns of numbers drawn as lines. */
567
+ lines?: OneOrMore<NumberColumn<C>>;
568
+ /** The column or columns of numbers drawn as bars. */
569
+ bars?: OneOrMore<NumberColumn<C>>;
570
+ /** The column or columns of numbers drawn as lines against a right-hand axis. */
571
+ y2Lines?: OneOrMore<NumberColumn<C>>;
572
+ /** The column or columns of numbers drawn as bars against a right-hand axis. */
573
+ y2Bars?: OneOrMore<NumberColumn<C>>;
574
+ };
575
+ type LooseComboProps = ComboBase & {
576
+ data?: readonly never[] | null;
577
+ x?: string;
578
+ lines?: OneOrMore<string>;
579
+ bars?: OneOrMore<string>;
580
+ y2Lines?: OneOrMore<string>;
581
+ y2Bars?: OneOrMore<string>;
582
+ };
583
+ export type ComboProps<D> = {
584
+ data?: D | null;
585
+ } & (0 extends 1 & D ? LooseComboProps : [D] extends [ArrayLike<number | null | undefined> | readonly (readonly unknown[])[]] ? LooseComboProps : [D] extends [readonly (infer R)[]] ? ComboRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? ComboColumnProps<D> : LooseComboProps);
586
+ type SankeyBase = Base & {
587
+ /** The nodes' colours in the order the links first name them, repeated when there are fewer. */
588
+ colors?: readonly string[];
589
+ /** Each ribbon runs from the colour of the node it leaves into the colour of the one it reaches. @default false */
590
+ blend?: boolean;
591
+ /** Writes the node names beside the nodes. @default true */
592
+ text?: boolean;
593
+ /** Not used: the nodes are named on the chart. */
594
+ legend?: boolean | LegendOptions;
595
+ };
596
+ export type SankeyRowProps<R> = SankeyBase & {
597
+ /** Row objects, one link each, a row without a source or a target dropped; missing, null or empty draws an empty frame. */
598
+ data?: readonly R[] | null;
599
+ /** The field that names the node each link leaves, by name or as an accessor `(row, index) => value`; the first text field left when left out. */
600
+ source?: Field<R>;
601
+ /** The field that names the node each link reaches, by name or accessor; the next text field when left out. */
602
+ target?: Field<R>;
603
+ /** The field of numbers the ribbons are as wide as, by name or accessor; the only number field left when left out. */
604
+ value?: YField<R>;
605
+ };
606
+ export type SankeyColumnProps<C> = SankeyBase & {
607
+ /** An object of columns, arrays or typed arrays of one length, a link per index, one without a source or a target dropped; missing, null or empty draws an empty frame. */
608
+ data?: C | null;
609
+ /** The column that names the node each link leaves; the first text column left when left out. */
610
+ source?: Name<C>;
611
+ /** The column that names the node each link reaches; the next text column when left out. */
612
+ target?: Name<C>;
613
+ /** The column of numbers the ribbons are as wide as; the only number column left when left out. */
614
+ value?: NumberColumn<C>;
615
+ };
616
+ type LooseSankeyProps = SankeyBase & {
617
+ data?: readonly never[] | null;
618
+ source?: string;
619
+ target?: string;
620
+ value?: string;
621
+ };
622
+ export type SankeyProps<D> = {
623
+ data?: D | null;
624
+ } & (0 extends 1 & D ? LooseSankeyProps : [D] extends [ArrayLike<number | null | undefined> | readonly (readonly unknown[])[]] ? LooseSankeyProps : [D] extends [readonly (infer R)[]] ? SankeyRowProps<R> : [D] extends [Record<string, ArrayLike<unknown>>] ? SankeyColumnProps<D> : LooseSankeyProps);
625
+ type TreeProps = Base & {
626
+ /** A root `{ name, value, children }`, or a list of roots, where only a node without children counts by its value; missing, null or empty draws an empty frame. */
627
+ data?: Nested | readonly Nested[] | null;
628
+ /** A colour for each root, or for each child of a single root, repeated when there are fewer. */
629
+ colors?: readonly string[];
630
+ /** Writes each node's name on it, where there is room. @default true */
631
+ text?: boolean;
632
+ /** Not used: the nodes are named on the chart. */
633
+ legend?: boolean | LegendOptions;
634
+ };
635
+ export type TreemapProps = TreeProps & {
636
+ /** Each branch starts at this opacity, from 0 to 1, at its top and reaches its full colour at the bottom; solid when left out. */
637
+ shade?: number;
638
+ };
639
+ export type SunburstProps = TreeProps & {
640
+ /** Each branch runs smoothly from its full colour at the centre to this opacity at the rim; lighter ring by ring when left out. */
641
+ shade?: number;
103
642
  };
104
643
  export {};