@altertable/data-app 0.72.0 → 0.74.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/AGENTS.md +5 -61
- package/CONTRIBUTING.md +130 -181
- package/README.md +3 -4
- package/REFERENCE.md +35 -345
- package/dist/chunks/contract-BeLPJwlO.js +558 -0
- package/dist/chunks/contract-BeLPJwlO.js.map +1 -0
- package/dist/chunks/contract-Di8SP74I.js +462 -0
- package/dist/chunks/contract-Di8SP74I.js.map +1 -0
- package/dist/chunks/diagnostics-BTZSlNtW.js +967 -0
- package/dist/chunks/diagnostics-BTZSlNtW.js.map +1 -0
- package/dist/chunks/format-BdFlv_xa.js +148 -0
- package/dist/chunks/format-BdFlv_xa.js.map +1 -0
- package/dist/chunks/operation-CSM9UmO3.js +134 -0
- package/dist/chunks/operation-CSM9UmO3.js.map +1 -0
- package/dist/chunks/request-body-H1qPmmTN.js +50 -0
- package/dist/chunks/request-body-H1qPmmTN.js.map +1 -0
- package/dist/client/index.js +273 -285
- package/dist/client/index.js.map +1 -13
- package/dist/core/appearance.js +171 -162
- package/dist/core/appearance.js.map +1 -10
- package/dist/core/config.js +49 -11
- package/dist/core/config.js.map +1 -9
- package/dist/core/contract.js +3 -73
- package/dist/core/format.js +1 -26
- package/dist/index.js +1 -12
- package/dist/internal.js +352 -397
- package/dist/internal.js.map +1 -15
- package/dist/server/index.js +85 -97
- package/dist/server/index.js.map +1 -10
- package/dist/types/chunks/appearance.d.ts +45 -0
- package/dist/types/chunks/contract.d.ts +720 -0
- package/dist/types/chunks/index.d.ts +240 -0
- package/dist/types/client/index.d.ts +3 -13
- package/dist/types/core/appearance.d.ts +2 -42
- package/dist/types/core/config.d.ts +36 -39
- package/dist/types/core/contract.d.ts +2 -114
- package/dist/types/core/format.d.ts +44 -17
- package/dist/types/index.d.ts +3 -3
- package/dist/types/internal.d.ts +312 -22
- package/dist/types/server/index.d.ts +15 -4
- package/docs/app-authoring.md +77 -128
- package/docs/client.md +29 -63
- package/docs/composition.md +44 -75
- package/docs/contract.md +60 -100
- package/docs/data-context.md +35 -61
- package/docs/diagnostics.md +45 -0
- package/docs/embed.md +86 -55
- package/docs/formatting-and-appearance.md +17 -38
- package/docs/hosted-apps.md +7 -14
- package/docs/layout.md +30 -47
- package/docs/local-data-apps.md +7 -7
- package/docs/react-embed.md +20 -26
- package/docs/react.md +10 -27
- package/docs/server-bun.md +2 -27
- package/docs/server.md +6 -12
- package/docs/stories-and-export.md +38 -40
- package/docs/styling.md +14 -22
- package/docs/ui-quality.md +5 -5
- package/docs/ui.md +93 -70
- package/docs/variables.md +142 -254
- package/docs/views.md +85 -116
- package/docs/widgets.md +100 -153
- package/docs/worker.md +15 -27
- package/package.json +3 -2
- package/dist/chunks/index-5a27erdg.js +0 -54
- package/dist/chunks/index-5a27erdg.js.map +0 -10
- package/dist/chunks/index-9yxr7nmm.js +0 -742
- package/dist/chunks/index-9yxr7nmm.js.map +0 -17
- package/dist/chunks/index-j5q5n3ra.js +0 -151
- package/dist/chunks/index-j5q5n3ra.js.map +0 -10
- package/dist/chunks/index-q75zm3a7.js +0 -153
- package/dist/chunks/index-q75zm3a7.js.map +0 -11
- package/dist/chunks/index-vhaec7m5.js +0 -30
- package/dist/chunks/index-vhaec7m5.js.map +0 -10
- package/dist/chunks/index-zp78caex.js +0 -1047
- package/dist/chunks/index-zp78caex.js.map +0 -19
- package/dist/core/contract.js.map +0 -9
- package/dist/core/format.js.map +0 -9
- package/dist/index.js.map +0 -9
- package/dist/types/client/annotations.d.ts +0 -27
- package/dist/types/client/data-client.d.ts +0 -43
- package/dist/types/client/download.d.ts +0 -5
- package/dist/types/client/iframe.d.ts +0 -59
- package/dist/types/client/location.d.ts +0 -13
- package/dist/types/client/logger.d.ts +0 -14
- package/dist/types/client/messages.d.ts +0 -7
- package/dist/types/client/navigation.d.ts +0 -15
- package/dist/types/client/transport.d.ts +0 -15
- package/dist/types/core/annotations.d.ts +0 -99
- package/dist/types/core/bridge-endpoint.d.ts +0 -21
- package/dist/types/core/bridge.d.ts +0 -172
- package/dist/types/core/data-view.d.ts +0 -46
- package/dist/types/core/date-format.d.ts +0 -24
- package/dist/types/core/date-range.d.ts +0 -20
- package/dist/types/core/dimension-source.d.ts +0 -64
- package/dist/types/core/dimension.d.ts +0 -71
- package/dist/types/core/facets.d.ts +0 -13
- package/dist/types/core/filters.d.ts +0 -45
- package/dist/types/core/invariant.d.ts +0 -2
- package/dist/types/core/keys.d.ts +0 -2
- package/dist/types/core/logger.d.ts +0 -12
- package/dist/types/core/messages.d.ts +0 -62
- package/dist/types/core/navigation.d.ts +0 -11
- package/dist/types/core/operation-types.d.ts +0 -80
- package/dist/types/core/operation.d.ts +0 -20
- package/dist/types/core/presentation.d.ts +0 -9
- package/dist/types/core/queries.d.ts +0 -84
- package/dist/types/core/reading.d.ts +0 -17
- package/dist/types/core/uuid.d.ts +0 -2
- package/dist/types/core/variables.d.ts +0 -133
- package/dist/types/server/handler.d.ts +0 -13
- package/dist/types/server/request-body.d.ts +0 -4
package/docs/server.md
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Import `createDataHandler()` and the `RequestAccess` type from
|
|
4
4
|
`@altertable/data-app/server`. The handler accepts a Web `Request` and returns a
|
|
5
|
-
`Promise<Response
|
|
6
|
-
React or the Bun local-development adapter.
|
|
5
|
+
`Promise<Response>` in Node or Bun.
|
|
7
6
|
|
|
8
7
|
```ts
|
|
9
8
|
import { createDataHandler } from '@altertable/data-app/server';
|
|
10
|
-
import { operations } from './operations';
|
|
9
|
+
import { operations } from './operations.ts';
|
|
11
10
|
|
|
12
11
|
export const handleDataRequest = createDataHandler(
|
|
13
12
|
operations,
|
|
@@ -36,12 +35,7 @@ See [operation contracts](contract.md), the [client](client.md), and the
|
|
|
36
35
|
|
|
37
36
|
## Request input limits
|
|
38
37
|
|
|
39
|
-
JSON request bodies are limited to
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
interrupted bodies return `400/invalid_input`; oversized bodies return
|
|
44
|
-
`413/input_too_large`.
|
|
45
|
-
|
|
46
|
-
`maxDurationMs` bounds execution after input parsing. It does not add a separate
|
|
47
|
-
body-read deadline. The hosting runtime controls the size of individual chunks.
|
|
38
|
+
JSON request bodies are limited to 16,384 encoded bytes. Oversized bodies return
|
|
39
|
+
`413/input_too_large`; invalid or interrupted bodies return `400/invalid_input`.
|
|
40
|
+
`maxDurationMs` bounds execution after parsing; configure body-read deadlines in
|
|
41
|
+
the hosting runtime.
|
|
@@ -1,52 +1,50 @@
|
|
|
1
1
|
# Stories and CSV export
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
the displayed snapshot
|
|
5
|
-
Setup and static screens use `<DataApp>` from
|
|
6
|
-
or pass a direct `CsvExport` object.
|
|
3
|
+
Supply `story` and `datasets` on `<DataApp>` from `@altertable/data-app-react`.
|
|
4
|
+
Both use the displayed snapshot, including during refresh or failure.
|
|
5
|
+
Setup and static screens use `<DataApp>` from `/ui` and may omit both.
|
|
7
6
|
|
|
8
7
|
## Present data with stories
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Continue the starter's `totalSamples` binding. Return one to four findings with a
|
|
10
|
+
headline, visual, and registered dataset or
|
|
11
|
+
metric as `evidence`. Reuse bindings and derive scope from the snapshot:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
```tsx
|
|
14
|
+
// ... sampleCountsView, sampleCounts, totalSamples, and sampleContent
|
|
15
|
+
function App() {
|
|
16
|
+
return (
|
|
17
|
+
<DataApp
|
|
18
|
+
view={sampleCountsView}
|
|
19
|
+
datasets={[sampleCounts]}
|
|
20
|
+
story={snapshot => {
|
|
21
|
+
const total = totalSamples.read(snapshot);
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
id: 'total-samples',
|
|
25
|
+
headline: `Total samples: ${formatMetric(total.value.current, totalSamples.definition.format)}`,
|
|
26
|
+
context: sampleCountsView.scope(snapshot),
|
|
27
|
+
visual: <MetricWidget metric={totalSamples} source={snapshot} />,
|
|
28
|
+
evidence: totalSamples,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<DataSection content={sampleContent} />
|
|
34
|
+
</DataApp>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
16
38
|
|
|
17
|
-
|
|
18
|
-
during refresh or failure. Derive the story from that snapshot so it agrees with
|
|
19
|
-
the visible exploration. Initial loading, empty results, and initial errors have
|
|
20
|
-
no story to present; the toolbar keeps its story action visible and disabled.
|
|
39
|
+
Keep the starter's `formatMetric()` import for formatted headlines.
|
|
21
40
|
|
|
22
41
|
## Export displayed data as CSV
|
|
23
42
|
|
|
24
|
-
Select all distinct named datasets from the displayed snapshot. One dataset downloads directly as CSV. Multiple
|
|
25
|
-
datasets offer individual CSV downloads and **Export all** as a ZIP archive.
|
|
26
|
-
While no displayed snapshot is available, the export action stays visible and disabled.
|
|
27
|
-
|
|
28
43
|
Declare [datasets](widgets.md#declare-datasets-and-metrics) once and pass
|
|
29
|
-
`datasets={[
|
|
30
|
-
|
|
31
|
-
displayed scope. List every distinct dataset the app shows.
|
|
32
|
-
|
|
33
|
-
Reuse bound metrics in story visuals:
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
story={snapshot => {
|
|
37
|
-
const totalReading = total.read(snapshot);
|
|
38
|
-
return [{
|
|
39
|
-
id: 'total',
|
|
40
|
-
headline: `Tracked identities: ${formatMetric(totalReading.value.current, total.definition.format)}`,
|
|
41
|
-
context: activityView.scope(snapshot),
|
|
42
|
-
visual: <MetricWidget metric={total} source={snapshot} />,
|
|
43
|
-
evidence: total,
|
|
44
|
-
}];
|
|
45
|
-
}}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Use the [format helpers](formatting-and-appearance.md) for story prose.
|
|
44
|
+
`datasets={[sampleCounts]}`. Include every distinct displayed dataset
|
|
45
|
+
at its displayed grain; reuse a dataset for visuals sharing the same rows.
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
One dataset downloads as CSV; multiple datasets offer individual downloads and
|
|
48
|
+
**Export all** as ZIP. Filenames use the displayed scope. Accessors must return
|
|
49
|
+
raw values: null and undefined export as empty cells, and measured zero stays
|
|
50
|
+
zero. Export handles quoting and spreadsheet formula protection.
|
package/docs/styling.md
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
# Styling
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Configure theme, palette, accent, typography, density, radius, and elevation through
|
|
8
|
-
`app.appearance`; see [appearance](formatting-and-appearance.md). Call
|
|
9
|
-
`injectDataAppStyles()` before mounting. Use one `<DataApp>` per document.
|
|
3
|
+
Keep default appearance unless customization is requested. Use components and
|
|
4
|
+
typed props first. Configure appearance once through
|
|
5
|
+
`dataApp.appearance`; see [formatting and appearance](formatting-and-appearance.md).
|
|
6
|
+
Call `injectDataAppStyles()` before mounting and use one `<DataApp>` per document.
|
|
10
7
|
|
|
11
8
|
## Customize
|
|
12
9
|
|
|
13
|
-
Add app-owned classes through `className
|
|
14
|
-
|
|
15
|
-
are listed in the [
|
|
10
|
+
Add app-owned classes through `className` and override public tokens. Render
|
|
11
|
+
package components; do not copy their classes or select private descendants.
|
|
12
|
+
Public hooks are listed in the [style contract](https://github.com/altertable-ai/data-app/blob/main/packages/data-app-react/src/style-contract.ts).
|
|
16
13
|
|
|
17
14
|
```css
|
|
18
15
|
.app-action {
|
|
@@ -21,18 +18,14 @@ are listed in the [typed contract](https://github.com/altertable-ai/data-app/blo
|
|
|
21
18
|
}
|
|
22
19
|
```
|
|
23
20
|
|
|
24
|
-
Type inline
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Menus and selection dropdowns share `--atbl-dropdown-padding`,
|
|
30
|
-
`--atbl-dropdown-item-padding-block`, `--atbl-dropdown-item-padding-inline`, and
|
|
31
|
-
`--atbl-dropdown-item-gap`. Their default padding follows the control density.
|
|
21
|
+
Type inline overrides with `DataAppStyle`. Give optional tokens a `var()` fallback.
|
|
22
|
+
Use `:root` for overrides shared with menus and overlays. Prefer `dataApp.appearance`
|
|
23
|
+
for brand and chart colors; pair accent overrides with a contrasting foreground.
|
|
24
|
+
Keep text inputs at least 16px on mobile.
|
|
32
25
|
|
|
33
26
|
## Native controls
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
Prefer package controls. For a custom native control:
|
|
36
29
|
|
|
37
30
|
```tsx
|
|
38
31
|
<button type="button" data-atbl-control="action" data-atbl-focus="ring">
|
|
@@ -40,6 +33,5 @@ Use package controls when possible. For a custom native control:
|
|
|
40
33
|
</button>
|
|
41
34
|
```
|
|
42
35
|
|
|
43
|
-
These hooks
|
|
44
|
-
|
|
45
|
-
[UI quality](ui-quality.md) for rendered verification.
|
|
36
|
+
These hooks style cursor and focus. Supply accessible names, disabled state, and
|
|
37
|
+
keyboard behavior, then verify [UI quality](ui-quality.md).
|
package/docs/ui-quality.md
CHANGED
|
@@ -13,8 +13,8 @@ Keep static context visible during loading. Skeletonize only dynamic content;
|
|
|
13
13
|
refresh, errors, and retry retain the displayed result and scope. Loading
|
|
14
14
|
geometry should match ready content.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
and
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
The SDK owns standard theme handling, responsive components, and keyboard/focus
|
|
17
|
+
behavior for its controls. Review app-owned content at its intended width with realistic labels
|
|
18
|
+
and values. When adding custom layout or CSS, check narrow and wide widths for
|
|
19
|
+
clipping and overflow; check custom colors in both themes and custom controls
|
|
20
|
+
with the keyboard.
|
package/docs/ui.md
CHANGED
|
@@ -10,36 +10,55 @@ frame for deliberately custom content. Use `<GettingStarted>` for
|
|
|
10
10
|
connection setup. Fetched data belongs to a declared view; avoid inventing
|
|
11
11
|
request states to populate a shell.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Direct `<DateRangePicker>`, `<DimensionPicker>`, and `useAppVariables()` support
|
|
17
|
-
custom control ownership. The caller supplies values and change handlers.
|
|
18
|
-
Custom tables use `<DataTable>` and its cell helpers; controls and overlays
|
|
19
|
-
include `<SearchField>`, `<ChoicePicker>`, `<Tabs>`, `<Sheet>`, and `<HelpPopover>`.
|
|
20
|
-
Horizontal `<TabList>` content scrolls with gradient cues at overflowing edges.
|
|
13
|
+
Custom controls own values and change handlers; use `useAppVariables()` for
|
|
14
|
+
custom URL state. Use `<DataTable>` for custom tables and `<Tabs>`, `<Sheet>`,
|
|
15
|
+
and `<HelpPopover>` for navigation and overlays.
|
|
21
16
|
|
|
22
17
|
Standalone `<AboutData>`, glossary components, and `<PresentStory>` support
|
|
23
18
|
custom inspection and presentation. Supply registered context and evidence, and
|
|
24
19
|
derive findings from the displayed data. Standard widgets and `<DataApp>`
|
|
25
20
|
already own these experiences.
|
|
26
21
|
|
|
27
|
-
For framework mounting, `<DataAppProvider app={
|
|
22
|
+
For framework mounting, `<DataAppProvider app={dataApp}>` supplies app identity, shared requests and one inspection sheet. Wrap custom shells in it; app components inherit identity and appearance.
|
|
28
23
|
Call `injectDataAppStyles()` before mounting either entry; imports do not install
|
|
29
24
|
styles.
|
|
30
25
|
|
|
26
|
+
## Custom activity labels
|
|
27
|
+
|
|
28
|
+
For a custom activity label, wrap `<ShimmerText>` in `<output>`:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { ShimmerText } from '@altertable/data-app-react/ui';
|
|
32
|
+
|
|
33
|
+
function LoadingLabel() {
|
|
34
|
+
return (
|
|
35
|
+
<output>
|
|
36
|
+
<ShimmerText>Loading results</ShimmerText>
|
|
37
|
+
</output>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
31
42
|
## Keyboard actions
|
|
32
43
|
|
|
33
44
|
Use `isPlainKeyEvent()` from `@altertable/data-app-react/ui` in custom key handlers so local actions
|
|
34
45
|
leave shortcut modifiers and IME composition untouched:
|
|
35
46
|
|
|
36
47
|
```tsx
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
function SearchInput() {
|
|
49
|
+
// ... submit handler
|
|
50
|
+
return (
|
|
51
|
+
<input
|
|
52
|
+
aria-label="Search"
|
|
53
|
+
onKeyDown={event => {
|
|
54
|
+
if (event.key === 'Enter' && isPlainKeyEvent(event.nativeEvent)) {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
submit();
|
|
57
|
+
}
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
43
62
|
```
|
|
44
63
|
|
|
45
64
|
Pass `{ allowShift: true }` when the handler also supports Shift gestures.
|
|
@@ -47,17 +66,13 @@ Pass `{ allowShift: true }` when the handler also supports Shift gestures.
|
|
|
47
66
|
## Choose a selection control
|
|
48
67
|
|
|
49
68
|
Use `<DimensionPicker>` for typed field filters and `<ChoicePicker>` for searchable
|
|
50
|
-
values.
|
|
51
|
-
values use checkbox indicators and keep the popup open. These pickers expose
|
|
52
|
-
listbox options, including search and loading feedback.
|
|
69
|
+
values.
|
|
53
70
|
|
|
54
71
|
Use `<MenuTrigger>`, `<MenuButton>`, `<MenuPopover>`, `<Menu>`, and `<MenuItem>`
|
|
55
72
|
for commands or short choice menus
|
|
56
73
|
such as sort order or display mode. Actions use `onAction`. Set
|
|
57
74
|
`selectionMode="single"` for mutually exclusive choices (radio menu items), or
|
|
58
|
-
`selectionMode="multiple"` for independent toggles (checkbox menu items).
|
|
59
|
-
support arrow keys, typeahead, Escape, and focus return to their trigger. Keep
|
|
60
|
-
search fields and other form inputs outside menus.
|
|
75
|
+
`selectionMode="multiple"` for independent toggles (checkbox menu items). Keep search fields and form inputs outside menus.
|
|
61
76
|
|
|
62
77
|
```tsx
|
|
63
78
|
<MenuTrigger>
|
|
@@ -81,11 +96,8 @@ search fields and other form inputs outside menus.
|
|
|
81
96
|
`<MenuButton>` accepts text or icons; give icon-only buttons an accessible name.
|
|
82
97
|
`<MenuPopover>` owns placement and popup styling.
|
|
83
98
|
|
|
84
|
-
Use `<MenuSection>`
|
|
85
|
-
|
|
86
|
-
by default; set `shouldCloseOnSelect={false}` for repeated toggles. Selection
|
|
87
|
-
indicators derive from the menu or section's selection mode; do not add checkbox
|
|
88
|
-
markup to single-choice items.
|
|
99
|
+
Use `<MenuSection>` for grouped choices and `<MenuSeparator>` between groups.
|
|
100
|
+
Selection indicators derive from `selectionMode`; do not add checkbox markup.
|
|
89
101
|
|
|
90
102
|
## Charts
|
|
91
103
|
|
|
@@ -97,10 +109,9 @@ so rows, loading state, evidence, and inspection come from that dataset.
|
|
|
97
109
|
Pass ordered items with unique, nonblank IDs and finite numbers. Bar and pie
|
|
98
110
|
values must be nonnegative. Use `formatValue` for domain formatting.
|
|
99
111
|
|
|
100
|
-
Line and area charts
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
the samples. Pie slices represent mutually exclusive parts of one total; shares
|
|
112
|
+
Line and area charts space samples equally; include missing periods and use
|
|
113
|
+
composed charts for irregular intervals. Distinguish missing observations from zero.
|
|
114
|
+
Pie slices represent mutually exclusive parts of one total; shares
|
|
104
115
|
use the sum of supplied items, so include Other when showing a subset of the
|
|
105
116
|
whole. Scatter points represent independent X/Y observations.
|
|
106
117
|
|
|
@@ -133,29 +144,44 @@ Use `<ComposedChart>` from `@altertable/data-app-react/ui` for multiple series o
|
|
|
133
144
|
standalone charts' themed series primitives; axes, scatter, tooltip, and reference
|
|
134
145
|
primitives are also available.
|
|
135
146
|
|
|
147
|
+
Declare shared measure semantics with `valueFormat` (currency, count, or ratio).
|
|
148
|
+
Numeric Y axes automatically use a common k/M/B/T scale and precision derived from
|
|
149
|
+
visible ticks; tooltips retain the measure format. Ratios use percentages without
|
|
150
|
+
compact scaling. Set an axis `tickFormatter` or tooltip `formatter` to override
|
|
151
|
+
presentation, including when different axes represent different units.
|
|
152
|
+
|
|
136
153
|
```tsx
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<ComposedChart
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
dataKey="
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
// ... revenueView and its revenue dataset
|
|
155
|
+
const revenueContent = revenueView.content(result => (
|
|
156
|
+
<VisualizationWidget dataset={revenue} source={result}>
|
|
157
|
+
{rows => (
|
|
158
|
+
<ComposedChart
|
|
159
|
+
data={rows}
|
|
160
|
+
ariaLabel="Monthly revenue and target in euros"
|
|
161
|
+
valueFormat={{ kind: 'currency', currency: 'EUR' }}
|
|
162
|
+
>
|
|
163
|
+
<ComposedChart.XAxis dataKey="month" />
|
|
164
|
+
<ComposedChart.YAxis />
|
|
165
|
+
<ComposedChart.Tooltip />
|
|
166
|
+
<ComposedChart.Legend />
|
|
167
|
+
<ComposedChart.Bar dataKey="revenue" name="Revenue (€)" />
|
|
168
|
+
<ComposedChart.Line
|
|
169
|
+
dataKey="target"
|
|
170
|
+
name="Target (€)"
|
|
171
|
+
stroke="var(--atbl-chart-2)"
|
|
172
|
+
/>
|
|
173
|
+
</ComposedChart>
|
|
174
|
+
)}
|
|
175
|
+
</VisualizationWidget>
|
|
176
|
+
));
|
|
153
177
|
```
|
|
154
178
|
|
|
155
179
|
For irregular time intervals, use `<ComposedChart.XAxis>` with ISO dates, zoned
|
|
156
180
|
ISO timestamps, or `Date` values; spacing follows elapsed time. Use `scale="utc"`
|
|
157
181
|
for epoch milliseconds, or `type="category"` to keep date-like labels categorical.
|
|
158
182
|
On UTC axes, supplied `ticks` and `tickFormatter` take precedence over automatic labels.
|
|
183
|
+
Axes with `<ComposedChart.Bar>` reserve half the smallest date interval at both ends
|
|
184
|
+
to keep edge bars inside the plot. An explicit `domain` overrides this spacing.
|
|
159
185
|
Preserve missing measures as `null` and choose `connectNulls` deliberately; do not
|
|
160
186
|
replace missing observations with zero.
|
|
161
187
|
|
|
@@ -169,10 +195,7 @@ its columns aligned with the displayed measures.
|
|
|
169
195
|
Include `<ComposedChart.Legend />` to derive labels and colored square markers from the series;
|
|
170
196
|
omit it when no legend is needed. For any chart, compose `<ChartLegend>` with
|
|
171
197
|
`<ChartLegend.Item>`, `<ChartLegend.Marker>`, and `<ChartLegend.Label>` using the
|
|
172
|
-
same names and colors as the plot.
|
|
173
|
-
shared with chart tooltips and funnel summaries. Pass `kind="square"` explicitly
|
|
174
|
-
when composing a marker.
|
|
175
|
-
`<PieChart>` includes a legend by default; `showLegend={false}` omits it.
|
|
198
|
+
same names and colors as the plot. `<PieChart>` includes a legend by default; `showLegend={false}` omits it.
|
|
176
199
|
|
|
177
200
|
Legends describe series; authored toggles or a composed legend's `onClick`
|
|
178
201
|
leave series visibility to the app.
|
|
@@ -196,33 +219,33 @@ filter declarations own URL state, validation, and operation meaning.
|
|
|
196
219
|
| `<DimensionPicker>` | Typed categorical predicates with fixed or facet options |
|
|
197
220
|
|
|
198
221
|
```tsx
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
222
|
+
function FilterChoices() {
|
|
223
|
+
// ... metric, statuses, and their change handlers
|
|
224
|
+
return (
|
|
225
|
+
<>
|
|
226
|
+
<RadioGroup label="Metric" value={metric} onChange={setMetric}>
|
|
227
|
+
<Radio value="orders">Orders</Radio>
|
|
228
|
+
<Radio value="revenue">Revenue</Radio>
|
|
229
|
+
</RadioGroup>
|
|
230
|
+
|
|
231
|
+
<CheckboxGroup label="Statuses" values={statuses} onChange={setStatuses}>
|
|
232
|
+
<Checkbox value="paid" label="Paid" />
|
|
233
|
+
<Checkbox value="pending" label="Pending" />
|
|
234
|
+
</CheckboxGroup>
|
|
235
|
+
</>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
208
238
|
```
|
|
209
239
|
|
|
210
|
-
A standalone `<Checkbox>` uses `checked` and `onChange`;
|
|
211
|
-
`value`. `<SegmentedControl>` accepts the same labeled options as `<Select>` and
|
|
212
|
-
keeps radio-group semantics. Numeric range controls retain invalid draft bounds
|
|
213
|
-
and emit only valid intervals. Numeric input and compact selects respect the
|
|
214
|
-
shared mobile text-size minimum.
|
|
240
|
+
A standalone `<Checkbox>` uses `checked` and `onChange`; group items use `value`.
|
|
215
241
|
|
|
216
242
|
Use `<FilterBar>` to arrange predicates and `<VariableBar>` for mixed app
|
|
217
243
|
parameters. Use `<FilterActions>` for Clear or paired Apply/Cancel actions on
|
|
218
244
|
app-owned drafts; provide the handlers for your applied state.
|
|
219
245
|
|
|
220
|
-
`<NumberFilterPicker>`
|
|
221
|
-
|
|
222
|
-
and `<NumberRangeField>` as inline input primitives when composing forms.
|
|
246
|
+
Use `<NumberFilterPicker>` for a numeric predicate popover or numeric fields
|
|
247
|
+
for inline forms.
|
|
223
248
|
|
|
224
249
|
Use `<Button variant="primary">` for the main committing action, such as Apply.
|
|
225
250
|
Use outline and ghost buttons for secondary actions.
|
|
226
|
-
Use `<Button variant="inline">` for actions within text or table cells.
|
|
227
|
-
control padding or background and underlines on hover. Keep button semantics for
|
|
228
|
-
opening a sheet; use links for navigation to a URL.
|
|
251
|
+
Use `<Button variant="inline">` for actions within text or table cells. Use buttons for opening sheets and links for URL navigation.
|