tinybase 8.5.0-beta.2 → 8.5.0-beta.4
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/@types/ui-react-dom-charts/index.d.ts +369 -49
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +396 -70
- package/common/index.js +1 -1
- package/common/with-schemas/index.js +1 -1
- package/index.js +3 -2
- package/mergeable-store/index.js +3 -2
- package/mergeable-store/with-schemas/index.js +3 -2
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/persisters/index.js +1 -1
- package/min/persisters/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/index.js +1 -1
- package/min/persisters/persister-electric-sql/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-libsql/index.js +1 -1
- package/min/persisters/persister-libsql/index.js.gz +0 -0
- package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-postgres/index.js +1 -1
- package/min/persisters/persister-postgres/index.js.gz +0 -0
- package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-powersync/index.js +1 -1
- package/min/persisters/persister-powersync/index.js.gz +0 -0
- package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/index.js +1 -1
- package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-remote/index.js +1 -1
- package/min/persisters/persister-remote/index.js.gz +0 -0
- package/min/persisters/persister-remote/with-schemas/index.js +1 -1
- package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/index.js +1 -1
- package/min/persisters/persister-sqlite3/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
- package/min/persisters/with-schemas/index.js +1 -1
- package/min/persisters/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/index.js +1 -1
- package/min/synchronizers/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/with-schemas/index.js +1 -1
- package/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom-charts/index.js +1 -1
- package/min/ui-react-dom-charts/index.js.gz +0 -0
- package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
- package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +7 -6
- package/omni/with-schemas/index.js +7 -6
- package/package.json +10 -10
- package/persisters/index.js +1 -1
- package/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/persisters/persister-durable-object-sql-storage/index.js +1 -1
- package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
- package/persisters/persister-electric-sql/index.js +1 -1
- package/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/persisters/persister-expo-sqlite/index.js +1 -1
- package/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/persisters/persister-libsql/index.js +1 -1
- package/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/persisters/persister-pglite/index.js +1 -1
- package/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/persisters/persister-postgres/index.js +1 -1
- package/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/persisters/persister-powersync/index.js +1 -1
- package/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/persisters/persister-react-native-sqlite/index.js +1 -1
- package/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
- package/persisters/persister-remote/index.js +3 -3
- package/persisters/persister-remote/with-schemas/index.js +3 -3
- package/persisters/persister-sqlite-bun/index.js +1 -1
- package/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
- package/persisters/persister-sqlite-wasm/index.js +1 -1
- package/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/persisters/persister-sqlite3/index.js +1 -1
- package/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/persisters/with-schemas/index.js +1 -1
- package/readme.md +13 -13
- package/releases.md +57 -57
- package/synchronizers/index.js +2 -1
- package/synchronizers/synchronizer-broadcast-channel/index.js +2 -1
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +2 -1
- package/synchronizers/synchronizer-local/index.js +2 -1
- package/synchronizers/synchronizer-local/with-schemas/index.js +2 -1
- package/synchronizers/synchronizer-ws-client/index.js +2 -1
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +2 -1
- package/synchronizers/synchronizer-ws-server/index.js +2 -1
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +2 -1
- package/synchronizers/synchronizer-ws-server-durable-object/index.js +2 -1
- package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +2 -1
- package/synchronizers/with-schemas/index.js +2 -1
- package/ui-react-dom-charts/index.js +753 -306
- package/ui-react-dom-charts/with-schemas/index.js +753 -306
- package/with-schemas/index.js +3 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The ui-react-dom-charts module of the TinyBase project provides components
|
|
3
|
-
*
|
|
2
|
+
* The ui-react-dom-charts module of the TinyBase project provides components to
|
|
3
|
+
* make it easy to create web-based reactive charts with Store and Queries
|
|
4
4
|
* objects.
|
|
5
5
|
*
|
|
6
6
|
* The components in this module use the react-dom module and so are not
|
|
7
7
|
* appropriate for environments like React Native (although those in the
|
|
8
8
|
* lower-level ui-react module are).
|
|
9
9
|
*
|
|
10
|
-
* For a full list of SVG class names that can be styled with CSS, see the
|
|
11
|
-
*
|
|
10
|
+
* For a full list of SVG class names that can be styled with CSS, see the Using
|
|
11
|
+
* Charts guide.
|
|
12
12
|
* @packageDocumentation
|
|
13
13
|
* @module ui-react-dom-charts
|
|
14
14
|
* @since v8.5.0
|
|
@@ -22,8 +22,8 @@ import type {
|
|
|
22
22
|
} from '../ui-react/index.d.ts';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* The ChartProps type describes the props that are used to configure the
|
|
26
|
-
*
|
|
25
|
+
* The ChartProps type describes the props that are used to configure the chart
|
|
26
|
+
* element that renders a chart.
|
|
27
27
|
* @category Configuration
|
|
28
28
|
* @since v8.5.0
|
|
29
29
|
*/
|
|
@@ -39,12 +39,12 @@ export type ChartProps = {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* The
|
|
42
|
+
* The TableSourceProps type describes the props that bind a chart to a
|
|
43
43
|
* Table in a Store.
|
|
44
44
|
* @category Configuration
|
|
45
45
|
* @since v8.5.0
|
|
46
46
|
*/
|
|
47
|
-
export type
|
|
47
|
+
export type TableSourceProps = {
|
|
48
48
|
/**
|
|
49
49
|
* The Id of the Table in the Store to chart.
|
|
50
50
|
* @category Prop
|
|
@@ -73,12 +73,12 @@ export type ChartTableSourceProps = {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* The
|
|
76
|
+
* The QuerySourceProps type describes the props that bind a chart to a
|
|
77
77
|
* Query in a Queries object.
|
|
78
78
|
* @category Configuration
|
|
79
79
|
* @since v8.5.0
|
|
80
80
|
*/
|
|
81
|
-
export type
|
|
81
|
+
export type QuerySourceProps = {
|
|
82
82
|
/**
|
|
83
83
|
* The Id of the query in the Queries object to chart.
|
|
84
84
|
* @category Prop
|
|
@@ -107,18 +107,20 @@ export type ChartQuerySourceProps = {
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* The
|
|
111
|
-
* BarChart component to Cell values in TinyBase data. An x Cell
|
|
112
|
-
* finite number, string, or boolean. A y Cell value must be a
|
|
110
|
+
* The BindingProps type describes the props that bind a LineChart
|
|
111
|
+
* component or BarChart component to Cell values in TinyBase data. An x Cell
|
|
112
|
+
* value can be a finite number, string, or boolean. A y Cell value must be a
|
|
113
|
+
* finite number.
|
|
113
114
|
* @category Configuration
|
|
114
115
|
* @since v8.5.0
|
|
115
116
|
*/
|
|
116
|
-
export type
|
|
117
|
+
export type BindingProps = {
|
|
117
118
|
/**
|
|
118
119
|
* The Id of the Cell that provides each data point's x value. Finite numbers
|
|
119
|
-
* can be used as continuous x values in line charts,
|
|
120
|
-
*
|
|
121
|
-
* as `true` and
|
|
120
|
+
* can be used as continuous linear x values in line charts, ISO date strings
|
|
121
|
+
* can be used as time x values, and other strings and booleans are used as
|
|
122
|
+
* category values. Boolean category labels are rendered as `true` and
|
|
123
|
+
* `false`.
|
|
122
124
|
* @category Prop
|
|
123
125
|
* @since v8.5.0
|
|
124
126
|
*/
|
|
@@ -158,13 +160,13 @@ export type ChartBindingProps = {
|
|
|
158
160
|
};
|
|
159
161
|
|
|
160
162
|
/**
|
|
161
|
-
* The
|
|
162
|
-
*
|
|
163
|
-
*
|
|
163
|
+
* The SeriesProps type describes the props that bind a chart series to Cell
|
|
164
|
+
* values in TinyBase data. An x Cell value can be a finite number, string, or
|
|
165
|
+
* boolean. A y Cell value must be a finite number.
|
|
164
166
|
* @category Configuration
|
|
165
167
|
* @since v8.5.0
|
|
166
168
|
*/
|
|
167
|
-
export type
|
|
169
|
+
export type SeriesProps = {
|
|
168
170
|
/**
|
|
169
171
|
* An optional string that will be added to the class attribute of the series'
|
|
170
172
|
* SVG group element.
|
|
@@ -174,9 +176,10 @@ export type ChartSeriesProps = {
|
|
|
174
176
|
readonly className?: string;
|
|
175
177
|
/**
|
|
176
178
|
* The Id of the Cell that provides each data point's x value. Finite numbers
|
|
177
|
-
* can be used as continuous x values in line series,
|
|
178
|
-
*
|
|
179
|
-
* as `true` and
|
|
179
|
+
* can be used as continuous linear x values in line series, ISO date strings
|
|
180
|
+
* can be used as time x values, and other strings and booleans are used as
|
|
181
|
+
* category values. Boolean category labels are rendered as `true` and
|
|
182
|
+
* `false`.
|
|
180
183
|
* @category Prop
|
|
181
184
|
* @since v8.5.0
|
|
182
185
|
*/
|
|
@@ -222,16 +225,275 @@ export type ChartSeriesProps = {
|
|
|
222
225
|
readonly limit?: number;
|
|
223
226
|
};
|
|
224
227
|
|
|
228
|
+
/**
|
|
229
|
+
* The XAxisScale type describes how x-axis values should be interpreted:
|
|
230
|
+
* `auto`, `category`, `linear`, or `time`.
|
|
231
|
+
* @category Configuration
|
|
232
|
+
* @since v8.5.0
|
|
233
|
+
*/
|
|
234
|
+
export type XAxisScale = 'auto' | 'category' | 'linear' | 'time';
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The TimestampUnit type describes the unit used by numeric timestamp values on
|
|
238
|
+
* a time x axis: `millisecond` or `second`.
|
|
239
|
+
* @category Configuration
|
|
240
|
+
* @since v8.5.0
|
|
241
|
+
*/
|
|
242
|
+
export type TimestampUnit = 'millisecond' | 'second';
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The TimeValue type describes values that can be used for explicit bounds and
|
|
246
|
+
* ticks on a time x axis: numbers, ISO date strings, or Date objects.
|
|
247
|
+
* @category Configuration
|
|
248
|
+
* @since v8.5.0
|
|
249
|
+
*/
|
|
250
|
+
export type TimeValue = number | string | Date;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The BaseXAxisProps type describes props shared by all x-axis configurations.
|
|
254
|
+
* @category Configuration
|
|
255
|
+
* @since v8.5.0
|
|
256
|
+
*/
|
|
257
|
+
export type BaseXAxisProps = {
|
|
258
|
+
/**
|
|
259
|
+
* An optional string that will be added to the class attribute of the x-axis
|
|
260
|
+
* SVG group element.
|
|
261
|
+
* @category Prop
|
|
262
|
+
* @since v8.5.0
|
|
263
|
+
*/
|
|
264
|
+
readonly className?: string;
|
|
265
|
+
/**
|
|
266
|
+
* An optional title to use for the x axis, defaulting to the x Cell Id, or to
|
|
267
|
+
* a combined title when multiple series use different x Cell Ids.
|
|
268
|
+
* @category Prop
|
|
269
|
+
* @since v8.5.0
|
|
270
|
+
*/
|
|
271
|
+
readonly title?: string;
|
|
272
|
+
/**
|
|
273
|
+
* An optional preferred number of ticks to render on a continuous x axis.
|
|
274
|
+
*
|
|
275
|
+
* The actual number of ticks may vary so that labels remain readable.
|
|
276
|
+
* @category Prop
|
|
277
|
+
* @since v8.5.0
|
|
278
|
+
*/
|
|
279
|
+
readonly tickCount?: number;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The LinearXAxisProps type describes x-axis configuration for automatically
|
|
284
|
+
* inferred, categorical, and linear axes.
|
|
285
|
+
* @category Configuration
|
|
286
|
+
* @since v8.5.0
|
|
287
|
+
*/
|
|
288
|
+
export type LinearXAxisProps = BaseXAxisProps & {
|
|
289
|
+
/**
|
|
290
|
+
* An optional scale to use for the x axis.
|
|
291
|
+
*
|
|
292
|
+
* The default `auto` scale infers linear axes from numeric line-series x
|
|
293
|
+
* values, time axes from ISO date strings, and category axes otherwise. Use
|
|
294
|
+
* `time` explicitly for numeric Unix timestamp values.
|
|
295
|
+
* @category Prop
|
|
296
|
+
* @since v8.5.0
|
|
297
|
+
*/
|
|
298
|
+
readonly scale?: 'auto' | 'category' | 'linear';
|
|
299
|
+
/**
|
|
300
|
+
* The unit for numeric timestamp values on a time x axis.
|
|
301
|
+
*
|
|
302
|
+
* This prop is ignored unless the scale prop is `time`, and defaults to
|
|
303
|
+
* `millisecond`.
|
|
304
|
+
* @category Prop
|
|
305
|
+
* @since v8.5.0
|
|
306
|
+
*/
|
|
307
|
+
readonly timestampUnit?: never;
|
|
308
|
+
/**
|
|
309
|
+
* An optional minimum x-axis bound for continuous numeric or time x values.
|
|
310
|
+
*
|
|
311
|
+
* This prop is ignored when the x axis is categorical.
|
|
312
|
+
* @category Prop
|
|
313
|
+
* @since v8.5.0
|
|
314
|
+
*/
|
|
315
|
+
readonly min?: number;
|
|
316
|
+
/**
|
|
317
|
+
* An optional maximum x-axis bound for continuous numeric or time x values.
|
|
318
|
+
*
|
|
319
|
+
* This prop is ignored when the x axis is categorical.
|
|
320
|
+
* @category Prop
|
|
321
|
+
* @since v8.5.0
|
|
322
|
+
*/
|
|
323
|
+
readonly max?: number;
|
|
324
|
+
/**
|
|
325
|
+
* Optional tick values to use for a continuous numeric or time x axis.
|
|
326
|
+
*
|
|
327
|
+
* This prop is ignored when the x axis is categorical.
|
|
328
|
+
* @category Prop
|
|
329
|
+
* @since v8.5.0
|
|
330
|
+
*/
|
|
331
|
+
readonly ticks?: readonly number[];
|
|
332
|
+
/**
|
|
333
|
+
* An optional function for formatting x-axis tick labels.
|
|
334
|
+
*
|
|
335
|
+
* It receives the original tick value for category axes, the numeric tick
|
|
336
|
+
* value for linear axes, or a Date object for time axes. For time axes, the
|
|
337
|
+
* normalized epoch millisecond timestamp is provided as a second argument.
|
|
338
|
+
* @category Prop
|
|
339
|
+
* @since v8.5.0
|
|
340
|
+
*/
|
|
341
|
+
readonly tickFormatter?: (tick: boolean | number | string) => string;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* The TimeXAxisProps type describes x-axis configuration for time axes.
|
|
346
|
+
* @category Configuration
|
|
347
|
+
* @since v8.5.0
|
|
348
|
+
*/
|
|
349
|
+
export type TimeXAxisProps = BaseXAxisProps & {
|
|
350
|
+
/**
|
|
351
|
+
* An optional scale to use for the x axis.
|
|
352
|
+
*
|
|
353
|
+
* The default `auto` scale infers linear axes from numeric line-series x
|
|
354
|
+
* values, time axes from ISO date strings, and category axes otherwise. Use
|
|
355
|
+
* `time` explicitly for numeric Unix timestamp values.
|
|
356
|
+
* @category Prop
|
|
357
|
+
* @since v8.5.0
|
|
358
|
+
*/
|
|
359
|
+
readonly scale: 'time';
|
|
360
|
+
/**
|
|
361
|
+
* The unit for numeric timestamp values on a time x axis.
|
|
362
|
+
*
|
|
363
|
+
* This prop is ignored unless the scale prop is `time`, and defaults to
|
|
364
|
+
* `millisecond`.
|
|
365
|
+
* @category Prop
|
|
366
|
+
* @since v8.5.0
|
|
367
|
+
*/
|
|
368
|
+
readonly timestampUnit?: TimestampUnit;
|
|
369
|
+
/**
|
|
370
|
+
* An optional minimum x-axis bound for continuous numeric or time x values.
|
|
371
|
+
*
|
|
372
|
+
* This prop is ignored when the x axis is categorical.
|
|
373
|
+
* @category Prop
|
|
374
|
+
* @since v8.5.0
|
|
375
|
+
*/
|
|
376
|
+
readonly min?: TimeValue;
|
|
377
|
+
/**
|
|
378
|
+
* An optional maximum x-axis bound for continuous numeric or time x values.
|
|
379
|
+
*
|
|
380
|
+
* This prop is ignored when the x axis is categorical.
|
|
381
|
+
* @category Prop
|
|
382
|
+
* @since v8.5.0
|
|
383
|
+
*/
|
|
384
|
+
readonly max?: TimeValue;
|
|
385
|
+
/**
|
|
386
|
+
* Optional tick values to use for a continuous numeric or time x axis.
|
|
387
|
+
*
|
|
388
|
+
* This prop is ignored when the x axis is categorical.
|
|
389
|
+
* @category Prop
|
|
390
|
+
* @since v8.5.0
|
|
391
|
+
*/
|
|
392
|
+
readonly ticks?: readonly TimeValue[];
|
|
393
|
+
/**
|
|
394
|
+
* An optional function for formatting x-axis tick labels.
|
|
395
|
+
*
|
|
396
|
+
* It receives the original tick value for category axes, the numeric tick
|
|
397
|
+
* value for linear axes, or a Date object for time axes. For time axes, the
|
|
398
|
+
* normalized epoch millisecond timestamp is provided as a second argument.
|
|
399
|
+
* @category Prop
|
|
400
|
+
* @since v8.5.0
|
|
401
|
+
*/
|
|
402
|
+
readonly tickFormatter?: (tick: Date, timestamp: number) => string;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* The XAxisProps type describes the props that configure the x axis of a
|
|
407
|
+
* CartesianChart component, LineChart component, or BarChart component.
|
|
408
|
+
*
|
|
409
|
+
* The x axis is inferred by default. Use an XAxis component child when you
|
|
410
|
+
* want to override its title, scale, continuous bounds, tick values, tick
|
|
411
|
+
* count, tick labels, or SVG class name.
|
|
412
|
+
* @category Configuration
|
|
413
|
+
* @since v8.5.0
|
|
414
|
+
*/
|
|
415
|
+
export type XAxisProps = LinearXAxisProps | TimeXAxisProps;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* The YAxisProps type describes the props that configure the y axis of a
|
|
419
|
+
* CartesianChart component.
|
|
420
|
+
*
|
|
421
|
+
* The y axis is inferred by default. Use a YAxis component child when you want
|
|
422
|
+
* to override its title, numeric bounds, tick values, tick count, tick labels,
|
|
423
|
+
* or SVG class name.
|
|
424
|
+
* @category Configuration
|
|
425
|
+
* @since v8.5.0
|
|
426
|
+
*/
|
|
427
|
+
export type YAxisProps = {
|
|
428
|
+
/**
|
|
429
|
+
* An optional string that will be added to the class attribute of the y-axis
|
|
430
|
+
* SVG group element.
|
|
431
|
+
* @category Prop
|
|
432
|
+
* @since v8.5.0
|
|
433
|
+
*/
|
|
434
|
+
readonly className?: string;
|
|
435
|
+
/**
|
|
436
|
+
* An optional title to use for the y axis, defaulting to the y Cell Id, y
|
|
437
|
+
* series label, or a combined title when multiple series use different y Cell
|
|
438
|
+
* Ids or labels.
|
|
439
|
+
* @category Prop
|
|
440
|
+
* @since v8.5.0
|
|
441
|
+
*/
|
|
442
|
+
readonly title?: string;
|
|
443
|
+
/**
|
|
444
|
+
* An optional minimum y-axis bound.
|
|
445
|
+
* @category Prop
|
|
446
|
+
* @since v8.5.0
|
|
447
|
+
*/
|
|
448
|
+
readonly min?: number;
|
|
449
|
+
/**
|
|
450
|
+
* An optional maximum y-axis bound.
|
|
451
|
+
* @category Prop
|
|
452
|
+
* @since v8.5.0
|
|
453
|
+
*/
|
|
454
|
+
readonly max?: number;
|
|
455
|
+
/**
|
|
456
|
+
* Optional numeric tick values to use for the y axis.
|
|
457
|
+
* @category Prop
|
|
458
|
+
* @since v8.5.0
|
|
459
|
+
*/
|
|
460
|
+
readonly ticks?: readonly number[];
|
|
461
|
+
/**
|
|
462
|
+
* An optional preferred number of ticks to render on the y axis.
|
|
463
|
+
*
|
|
464
|
+
* The actual number of ticks may vary so that labels remain readable.
|
|
465
|
+
* @category Prop
|
|
466
|
+
* @since v8.5.0
|
|
467
|
+
*/
|
|
468
|
+
readonly tickCount?: number;
|
|
469
|
+
/**
|
|
470
|
+
* An optional function for formatting y-axis tick labels.
|
|
471
|
+
*
|
|
472
|
+
* It receives the numeric tick value.
|
|
473
|
+
* @category Prop
|
|
474
|
+
* @since v8.5.0
|
|
475
|
+
*/
|
|
476
|
+
readonly tickFormatter?: (tick: number) => string;
|
|
477
|
+
};
|
|
478
|
+
|
|
225
479
|
/**
|
|
226
480
|
* The CartesianChart component renders a chart frame and provides TinyBase
|
|
227
|
-
* source and layout context to
|
|
481
|
+
* source and layout context to LineSeries component and BarSeries component
|
|
482
|
+
* children.
|
|
483
|
+
*
|
|
484
|
+
* See the Composing Charts (React) demo for this component in action:
|
|
228
485
|
*
|
|
229
|
-
*
|
|
486
|
+
* 
|
|
488
|
+
*
|
|
489
|
+
* The series children declare their own xCellId and yCellId bindings. The
|
|
490
|
+
* optional XAxis component and YAxis component children can be used to
|
|
491
|
+
* configure axis titles, bounds, ticks, and tick formatting.
|
|
230
492
|
* @category Store components
|
|
231
493
|
* @since v8.5.0
|
|
232
494
|
* @example
|
|
233
|
-
* This example creates a Store and renders two LineSeries
|
|
234
|
-
* CartesianChart.
|
|
495
|
+
* This example creates a Store and renders two LineSeries component children
|
|
496
|
+
* in a CartesianChart component.
|
|
235
497
|
*
|
|
236
498
|
* ```jsx
|
|
237
499
|
* import React from 'react';
|
|
@@ -266,35 +528,87 @@ export type ChartSeriesProps = {
|
|
|
266
528
|
* ```
|
|
267
529
|
*/
|
|
268
530
|
export function CartesianChart(
|
|
269
|
-
props: (
|
|
531
|
+
props: (TableSourceProps | QuerySourceProps) &
|
|
270
532
|
ChartProps & {readonly children?: ReactNode},
|
|
271
533
|
): ComponentReturnType;
|
|
272
534
|
|
|
273
535
|
/**
|
|
274
|
-
* The
|
|
275
|
-
* component
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
536
|
+
* The XAxis component configures the x axis of a CartesianChart component,
|
|
537
|
+
* LineChart component, or BarChart component.
|
|
538
|
+
*
|
|
539
|
+
* It is a configuration child rather than a separately rendered SVG element:
|
|
540
|
+
* include zero or one XAxis component in a chart's children. If omitted, the x
|
|
541
|
+
* axis is inferred from the chart's series.
|
|
542
|
+
*
|
|
543
|
+
* See the Axis Overrides (React) demo for this component in action:
|
|
544
|
+
*
|
|
545
|
+
* 
|
|
279
547
|
* @category Store components
|
|
280
548
|
* @since v8.5.0
|
|
281
549
|
*/
|
|
282
|
-
export function
|
|
550
|
+
export function XAxis(props: XAxisProps): ComponentReturnType;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* The YAxis component configures the y axis of a CartesianChart component.
|
|
554
|
+
*
|
|
555
|
+
* It is a configuration child rather than a separately rendered SVG element:
|
|
556
|
+
* include zero or one YAxis component in a CartesianChart component's children.
|
|
557
|
+
* If omitted, the y axis is inferred from the chart's series.
|
|
558
|
+
*
|
|
559
|
+
* See the Axis Overrides (React) demo for this component in action:
|
|
560
|
+
*
|
|
561
|
+
* 
|
|
563
|
+
* @category Store components
|
|
564
|
+
* @since v8.5.0
|
|
565
|
+
*/
|
|
566
|
+
export function YAxis(props: YAxisProps): ComponentReturnType;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* The LineSeries component renders a line series in a CartesianChart component.
|
|
570
|
+
* If every x value in every series is a finite number, the x axis is rendered
|
|
571
|
+
* as a continuous linear scale. ISO date strings are inferred as a time scale.
|
|
572
|
+
* Other strings and booleans are rendered categorically. When sortCellId is
|
|
573
|
+
* omitted, rows are sorted by xCellId.
|
|
574
|
+
*
|
|
575
|
+
* See the Composing Charts (React) demo for this component in action:
|
|
576
|
+
*
|
|
577
|
+
* 
|
|
579
|
+
* @category Store components
|
|
580
|
+
* @since v8.5.0
|
|
581
|
+
*/
|
|
582
|
+
export function LineSeries(props: SeriesProps): ComponentReturnType;
|
|
283
583
|
|
|
284
584
|
/**
|
|
285
585
|
* The BarSeries component renders a bar series in a CartesianChart component.
|
|
286
|
-
* Its x values are
|
|
287
|
-
* numbers.
|
|
586
|
+
* Its x values are rendered categorically by default, even when they are finite
|
|
587
|
+
* numbers. Add an XAxis component with a `linear` or `time` scale to position
|
|
588
|
+
* bars continuously. Boolean category labels are rendered as `true` and
|
|
589
|
+
* `false`.
|
|
590
|
+
*
|
|
591
|
+
* See the Composing Charts (React) demo for this component in action:
|
|
592
|
+
*
|
|
593
|
+
* 
|
|
288
595
|
* @category Store components
|
|
289
596
|
* @since v8.5.0
|
|
290
597
|
*/
|
|
291
|
-
export function BarSeries(props:
|
|
598
|
+
export function BarSeries(props: SeriesProps): ComponentReturnType;
|
|
292
599
|
|
|
293
600
|
/**
|
|
294
601
|
* The LineChart component renders a line chart from TinyBase data. If every x
|
|
295
|
-
* value is a finite number, the x axis is rendered as a continuous
|
|
296
|
-
* scale.
|
|
297
|
-
*
|
|
602
|
+
* value is a finite number, the x axis is rendered as a continuous linear
|
|
603
|
+
* scale. ISO date strings are inferred as a time scale. Other strings and
|
|
604
|
+
* booleans are rendered categorically. Add XAxis component and YAxis component
|
|
605
|
+
* children to override axis configuration. When sortCellId is omitted, rows are
|
|
606
|
+
* sorted by xCellId.
|
|
607
|
+
*
|
|
608
|
+
* See the <LineChart /> (React) demo for this component in action:
|
|
609
|
+
*
|
|
610
|
+
* 
|
|
298
612
|
* @category Store components
|
|
299
613
|
* @since v8.5.0
|
|
300
614
|
* @example
|
|
@@ -333,15 +647,21 @@ export function BarSeries(props: ChartSeriesProps): ComponentReturnType;
|
|
|
333
647
|
* ```
|
|
334
648
|
*/
|
|
335
649
|
export function LineChart(
|
|
336
|
-
props: (
|
|
337
|
-
|
|
338
|
-
ChartProps,
|
|
650
|
+
props: (TableSourceProps | QuerySourceProps) &
|
|
651
|
+
BindingProps &
|
|
652
|
+
ChartProps & {readonly children?: ReactNode},
|
|
339
653
|
): ComponentReturnType;
|
|
340
654
|
|
|
341
655
|
/**
|
|
342
656
|
* The BarChart component renders a bar chart from TinyBase data. Its x values
|
|
343
|
-
* are
|
|
344
|
-
*
|
|
657
|
+
* are rendered categorically by default, even when they are finite numbers. Add
|
|
658
|
+
* an XAxis component with a `linear` or `time` scale to position bars
|
|
659
|
+
* continuously. Boolean category labels are rendered as `true` and `false`.
|
|
660
|
+
*
|
|
661
|
+
* See the Sorting And Types (React) demo for this component in action:
|
|
662
|
+
*
|
|
663
|
+
* 
|
|
345
665
|
* @category Store components
|
|
346
666
|
* @since v8.5.0
|
|
347
667
|
* @example
|
|
@@ -381,7 +701,7 @@ export function LineChart(
|
|
|
381
701
|
* ```
|
|
382
702
|
*/
|
|
383
703
|
export function BarChart(
|
|
384
|
-
props: (
|
|
385
|
-
|
|
386
|
-
ChartProps,
|
|
704
|
+
props: (TableSourceProps | QuerySourceProps) &
|
|
705
|
+
BindingProps &
|
|
706
|
+
ChartProps & {readonly children?: ReactNode},
|
|
387
707
|
): ComponentReturnType;
|