@umriss-ui/charts 0.43.0 → 0.44.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/CHANGELOG.md +16 -0
- package/README.md +33 -2
- package/dist/charts.css +1 -1
- package/dist/charts.js +3423 -3172
- package/dist/de.d.ts +6 -0
- package/dist/index.d.ts +37 -8
- package/dist/wording/de.js +5 -2
- package/docs/llms-full.md +305 -75
- package/package.json +2 -2
package/docs/llms-full.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @umriss-ui/charts 0.
|
|
1
|
+
# @umriss-ui/charts 0.44.0
|
|
2
2
|
|
|
3
3
|
> React canvas chart library for data-dense dashboards - line, area, bar, box plot, scatter, control and Pareto charts. Few chart kinds, drawn well, fast.
|
|
4
4
|
|
|
@@ -1057,7 +1057,7 @@ npm install @umriss-ui/charts
|
|
|
1057
1057
|
|
|
1058
1058
|
The command installs the package alone: React 19 or newer is its only peer and stays the application's own, and the package depends on nothing else. The stylesheet comes with the JavaScript, so there is nothing to import - `@umriss-ui/charts/styles.css` is there for setups that link stylesheets by hand. Its colours, type and sizes are `--uc-` tokens that fall back onto core's; core's Theming page lists them all.
|
|
1059
1059
|
|
|
1060
|
-
A chart takes its container's width and follows it; give it a `height` (300 px without one). `useChart(rows)` hands out `Chart`, its axes and its series, typed at the row; each reads its value from a row through `value`, a field name or a function - a value that is `null`, `undefined` or not finite is a gap, never a zero.
|
|
1060
|
+
A chart takes its container's width and follows it; give it a `height` (300 px without one). `useChart(rows)` hands out `Chart`, its axes and its series, typed at the row; each reads its value from a row through `value`, a field name or a function - a value that is `null`, `undefined` or not finite is a gap, never a zero. The rows are one object per row in an array (also a series' own `data`); anything else is read as no rows, so the chart says "No data" and warns once in development, and `Array.from` makes rows of an Arrow table or a typed array. `undefined` while the rows load draws empty without a word.
|
|
1061
1061
|
|
|
1062
1062
|
An instant is a `Date`, milliseconds since 1970, or - where the x axis says `time` - the ISO string an API sends ([ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)). On a time axis the ticks stand on the viewer's local clock, so a day begins at local midnight. The words are English; German comes from `@umriss-ui/charts/wording/de`.
|
|
1063
1063
|
|
|
@@ -2134,6 +2134,82 @@ export default function SeriesFromLongRows() {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
```
|
|
2136
2136
|
|
|
2137
|
+
##### Hand over a picture
|
|
2138
|
+
|
|
2139
|
+
`toPng()` resolves to a PNG of the plot, its axes with their breaks, the limits and the legend, on the chart's own ground, in the scheme in use - without the tooltip or the crosshair, even with the pointer resting on the plot. What happens to it is the application's: here it is shown beside the chart.
|
|
2140
|
+
|
|
2141
|
+
```tsx
|
|
2142
|
+
import { useEffect, useState } from "react";
|
|
2143
|
+
import { Legend, LimitLine, Tooltip, useChart } from "@umriss-ui/charts";
|
|
2144
|
+
|
|
2145
|
+
const HOUR = 3_600_000;
|
|
2146
|
+
const START = Date.UTC(2026, 2, 17, 6);
|
|
2147
|
+
const READINGS = Array.from({ length: 48 }, (_, i) => ({
|
|
2148
|
+
t: START + i * (HOUR / 4),
|
|
2149
|
+
p95: Math.round(180 + 40 * Math.sin(i / 6) + ((i * 37) % 23)),
|
|
2150
|
+
p50: Math.round(110 + 25 * Math.sin(i / 5) + ((i * 17) % 11)),
|
|
2151
|
+
}));
|
|
2152
|
+
// Two shifts, with the hours between them taken off the axis.
|
|
2153
|
+
const SHIFTS = [
|
|
2154
|
+
{ from: START, to: START + 4 * HOUR },
|
|
2155
|
+
{ from: START + 8 * HOUR, to: START + 12 * HOUR },
|
|
2156
|
+
];
|
|
2157
|
+
|
|
2158
|
+
export default function Picture() {
|
|
2159
|
+
const { Chart, XAxis, YAxis, Line, toPng } = useChart(READINGS);
|
|
2160
|
+
const [url, setUrl] = useState<string | null>(null);
|
|
2161
|
+
const [marks, setMarks] = useState(true);
|
|
2162
|
+
const [failed, setFailed] = useState<string | null>(null);
|
|
2163
|
+
// The object URL lives as long as the picture shown.
|
|
2164
|
+
useEffect(() => () => (url === null ? undefined : URL.revokeObjectURL(url)), [url]);
|
|
2165
|
+
|
|
2166
|
+
return (
|
|
2167
|
+
<>
|
|
2168
|
+
<div className="demo-actions">
|
|
2169
|
+
<button type="button" className="demo-button" data-encoding aria-pressed={marks} onClick={() => setMarks(!marks)}>
|
|
2170
|
+
Marks
|
|
2171
|
+
</button>
|
|
2172
|
+
<button
|
|
2173
|
+
type="button"
|
|
2174
|
+
className="demo-button"
|
|
2175
|
+
data-picture
|
|
2176
|
+
onClick={() =>
|
|
2177
|
+
toPng().then(
|
|
2178
|
+
(blob) => {
|
|
2179
|
+
setFailed(null);
|
|
2180
|
+
setUrl(URL.createObjectURL(blob));
|
|
2181
|
+
},
|
|
2182
|
+
(error: Error) => setFailed(error.message),
|
|
2183
|
+
)
|
|
2184
|
+
}
|
|
2185
|
+
>
|
|
2186
|
+
Picture
|
|
2187
|
+
</button>
|
|
2188
|
+
</div>
|
|
2189
|
+
<div className="pair">
|
|
2190
|
+
<div>
|
|
2191
|
+
<p className="pair-caption">the chart</p>
|
|
2192
|
+
<Chart height={240} aria-label="Latency of Refunds" encoding={marks ? "marks" : "color"}>
|
|
2193
|
+
<XAxis value="t" time calendar={SHIFTS} />
|
|
2194
|
+
<YAxis label="ms" />
|
|
2195
|
+
<Line value="p95" name="Refunds p95" />
|
|
2196
|
+
<Line value="p50" name="Refunds p50" />
|
|
2197
|
+
<LimitLine value={240} severity="alarm" label="Too slow" />
|
|
2198
|
+
<Legend />
|
|
2199
|
+
<Tooltip />
|
|
2200
|
+
</Chart>
|
|
2201
|
+
</div>
|
|
2202
|
+
<div>
|
|
2203
|
+
<p className="pair-caption">the picture</p>
|
|
2204
|
+
{url !== null && <img src={url} alt="The picture of the chart" data-role="picture" style={{ width: "100%", height: "auto" }} />}
|
|
2205
|
+
{failed !== null && <p role="alert">{failed}</p>}
|
|
2206
|
+
</div>
|
|
2207
|
+
</div>
|
|
2208
|
+
</>
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
```
|
|
2212
|
+
|
|
2137
2213
|
#### When to use something else
|
|
2138
2214
|
|
|
2139
2215
|
- A single number with a small trend beside it → `Sparkline` or `Stat` from @umriss-ui/core
|
|
@@ -2169,14 +2245,14 @@ Under forced colours the chart draws in the system colours and tells its series
|
|
|
2169
2245
|
|---|---|---|---|
|
|
2170
2246
|
| `ref` | `Ref<HTMLDivElement>` | — | The root element, the `<div>` that `className`, `style`, `id` and the `data-*` attributes reach. |
|
|
2171
2247
|
| `width` | `number \| "100%"` | `"100%"` | Width in CSS pixels, or `"100%"` for the host's: the chart measures its host and follows it through a ResizeObserver.<br>Shown in: [Size a chart by its container (Installation)](#installation) |
|
|
2172
|
-
| `height` | `number` | fills the frame, at least 300 px | Height in CSS pixels, fixed. Left out, the chart fills its frame - a stretched grid cell, a card the grid stretches, a container of definite height - and never goes below 300 px, which is also its height in a frame without one. A different floor goes through `style`'s `minHeight` ([ADR-0050](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0050-a-chart-fills-its-frame-never-below-its-floor.md)).<br>Shown in: [Mix series kinds](#chart-1), [Say there is nothing to show](#chart-1), [Read it by keyboard and screen reader](#chart-1) and
|
|
2248
|
+
| `height` | `number` | fills the frame, at least 300 px | Height in CSS pixels, fixed. Left out, the chart fills its frame - a stretched grid cell, a card the grid stretches, a container of definite height - and never goes below 300 px, which is also its height in a frame without one. A different floor goes through `style`'s `minHeight` ([ADR-0050](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0050-a-chart-fills-its-frame-never-below-its-floor.md)).<br>Shown in: [Mix series kinds](#chart-1), [Say there is nothing to show](#chart-1), [Read it by keyboard and screen reader](#chart-1) and 78 more |
|
|
2173
2249
|
| `padding` | `number \| Partial<``Padding``>` | — | Outer spacing of the plot area in CSS pixels.<br>Shown in: [Fix the domain and name the ticks (Axis)](#axis) |
|
|
2174
2250
|
| `empty` | `ReactNode` | the wording's `empty` | Shown in the middle of the plot area when no visible series has a point to show - no data, only gaps, or every series hidden. Axes and frame stay. Not while `loading`.<br>Shown in: [Say there is nothing to show](#chart-1) |
|
|
2175
2251
|
| `loading` | `boolean` | `false` | The rows are on their way, as the table's `loading` says ([ADR-0042](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0042-a-rows-height-never-follows-what-it-shows.md)). A course already drawn stays: it dims after a moment and takes no pointer until the answer is in. Where there is nothing to show, the empty message waits. The plot is `aria-busy` meanwhile.<br>Shown in: [Show that rows are on their way](#chart-1) |
|
|
2176
2252
|
| `wording` | `Partial<``ChartsWording``>` | `DEFAULT_CHARTS_WORDING` | The chart's words ([ADR-0031](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0031-the-charts-carry-their-own-wording.md)); entries left out fall back to English. Its `locale` also formats every number and every date or time label the chart makes itself (`en-GB`, `de-DE`; the browser's language is not read) - a `tickFormat` or `format` of your own stays in charge of its axis or series. German: `GERMAN_CHARTS_WORDING` from `@umriss-ui/charts/wording/de`.<br>Shown in: [Read it by keyboard and screen reader](#chart-1) |
|
|
2177
|
-
| `encoding` | `"color" \| "marks"` | `"color"` | How series are told apart. `"color"`: by their colour. `"marks"`: by a dash and a marker shape as well - a line, an area and a scatter -, and by a hatch - a bar, a state, a matrix cell, a limit band -, chosen by the same palette place as the colour, so that a reader who does not see the colours still tells them apart; the legend's chips show the same. A caller's own `dash` wins over the place's.<br>Shown in: [Tell series apart without colour](#chart-1), [Mark every kind](#chart-1), [Mark bands, limits and cells](#chart-1) |
|
|
2253
|
+
| `encoding` | `"color" \| "marks"` | `"color"` | How series are told apart. `"color"`: by their colour. `"marks"`: by a dash and a marker shape as well - a line, an area and a scatter -, and by a hatch - a bar, a state, a matrix cell, a limit band -, chosen by the same palette place as the colour, so that a reader who does not see the colours still tells them apart; the legend's chips show the same. A caller's own `dash` wins over the place's.<br>Shown in: [Tell series apart without colour](#chart-1), [Mark every kind](#chart-1), [Mark bands, limits and cells](#chart-1) and 1 more |
|
|
2178
2254
|
| `syncId` | `string` | — | Charts with the same id share the pointer's x position, in domain units: each draws its crosshair there, the tooltip stays with the chart under the pointer. Zoom is not shared this way: charts zoom together by sending each other their view (`useChart`'s `onViewChange` and `setView`).<br>Shown in: [Keep charts in step (Zoom and pan)](#zoom-and-pan), [Watch latency against its objective (Scenarios)](#watch-latency-against-its-objective), [Hold the tile length in control (Scenarios)](#hold-the-tile-length-in-control) |
|
|
2179
|
-
| `children` | `ReactNode` | — | The axes, series and companions of this chart. They draw nothing themselves: each registers its configuration and the scene draws it, and the order in the JSX is the drawing order.<br>Shown in: [Mix series kinds](#chart-1), [Say there is nothing to show](#chart-1), [Read it by keyboard and screen reader](#chart-1) and
|
|
2255
|
+
| `children` | `ReactNode` | — | The axes, series and companions of this chart. They draw nothing themselves: each registers its configuration and the scene draws it, and the order in the JSX is the drawing order.<br>Shown in: [Mix series kinds](#chart-1), [Say there is nothing to show](#chart-1), [Read it by keyboard and screen reader](#chart-1) and 78 more |
|
|
2180
2256
|
|
|
2181
2257
|
###### Events
|
|
2182
2258
|
|
|
@@ -2184,12 +2260,6 @@ Under forced colours the chart draws in the system colours and tells its series
|
|
|
2184
2260
|
|---|---|---|---|
|
|
2185
2261
|
| `onPerf` | `(perf: ``ChartPerf``) => void` | — | Instrumentation for the benchmark page; not needed otherwise.<br>Shown in: [Measure a million points (Benchmark)](#benchmark), [Draw a week of seconds (Benchmark)](#benchmark) |
|
|
2186
2262
|
|
|
2187
|
-
###### Accessibility
|
|
2188
|
-
|
|
2189
|
-
| Prop | Type | Default | Description |
|
|
2190
|
-
|---|---|---|---|
|
|
2191
|
-
| `ariaLabel` | `string` | — | *Deprecated* since 0.43 - use `aria-label`. Accessible name of the plot. Without a name, `aria-label` or `aria-labelledby`, the chart warns in development. |
|
|
2192
|
-
|
|
2193
2263
|
###### Styling
|
|
2194
2264
|
|
|
2195
2265
|
| Prop | Type | Default | Description |
|
|
@@ -2230,6 +2300,9 @@ Everything the charts put out as text.
|
|
|
2230
2300
|
| `percent` *required* | `(value: string) => string` | — | A share in a normalised stack, its number already formatted. |
|
|
2231
2301
|
| `walkHelp` *required* | `string` | — | The keys that walk the chart. |
|
|
2232
2302
|
| `selectHelp` *required* | `string` | — | The key that reports the Active point - only where `onSelect` is given. |
|
|
2303
|
+
| `rangeStarted` *required* | `(from: string) => string` | — | Said when the keyboard sets the start of a range; the x value is written in the axis' format. |
|
|
2304
|
+
| `rangeMade` *required* | `(from: string, to: string) => string` | — | Said when the keyboard sets the end of a range. |
|
|
2305
|
+
| `rangeHelp` *required* | `string` | — | The key that marks a range - only where `onRange` is given and a tooltip stands. |
|
|
2233
2306
|
| `zoomHelp` *required* | `string` | — | The keys that zoom and pan it - only where the chart can be zoomed. |
|
|
2234
2307
|
| `legendHelp` *required* | `string` | — | The keys of the legend's entries - only where it has one to press. |
|
|
2235
2308
|
| `allShown` *required* | `string` | — | Read out where hiding would leave nothing to see, and every series is shown instead. |
|
|
@@ -2264,9 +2337,9 @@ Measurements of the instrumentation for the benchmark page.
|
|
|
2264
2337
|
#### Known limits
|
|
2265
2338
|
|
|
2266
2339
|
- No error state of its own: where the rows could not be loaded, show an `Alert` from @umriss-ui/core. Waiting for them is `loading`.
|
|
2267
|
-
- No pie, donut, radar or candlestick, no smoothing, animation or export, no WebGL ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
2340
|
+
- No pie, donut, radar or candlestick, no smoothing, animation or export, no WebGL ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md)).
|
|
2268
2341
|
|
|
2269
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
2342
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
2270
2343
|
|
|
2271
2344
|
### Axis
|
|
2272
2345
|
|
|
@@ -2938,15 +3011,15 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
2938
3011
|
|
|
2939
3012
|
| Prop | Type | Default | Description |
|
|
2940
3013
|
|---|---|---|---|
|
|
2941
|
-
| `value` *required* | `AxisField``<T> \| ((d: T, index: number) => ``AxisValue``)` | — | Where a row lies on this axis: a field of the row, compared by its name, or a function of it, compared by its source text as a series' is (`ValueFunction`) - with the same closure limit. A number is a position, a `Date` an instant, a string a category: every distinct one gets a place of its own, in the order the rows bring them, a tick and its name as the label ([ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)). The type decides, never the content - `"2024"` is a category, `2024` a number - and a row without a value has no place. The axis reads the rows of every series bound to it; where those bring their own `data`, name their row: `<XAxis<HourCount> value="hour" />`.<br>Shown in: [Fix the domain and name the ticks](#axis), [Add axes for other magnitudes](#axis), [Leave out the hours nobody works](#axis) and
|
|
2942
|
-
| `domain` | `"nice" \| "data" \| readonly [number, number] \| readonly [Date, Date]` | `"nice"` | `"nice"` widens the data's extent to ticks - to named `ticks` where there are any, on a time axis to whole units of a step of hours or longer -, `"data"` keeps it, a pair is fixed: numbers, on a time axis milliseconds or two `Date`s, on a category axis places. On a `zoomable` axis it is the start: what the axis shows while the chart's view names no span for it.<br>Shown in: [Bind every kind of series to a second axis](#axis), [Read it by keyboard and screen reader (Chart)](#chart-1), [Gestures and keys (Zoom and pan)](#zoom-and-pan) and
|
|
3014
|
+
| `value` *required* | `AxisField``<T> \| ((d: T, index: number) => ``AxisValue``)` | — | Where a row lies on this axis: a field of the row, compared by its name, or a function of it, compared by its source text as a series' is (`ValueFunction`) - with the same closure limit. A number is a position, a `Date` an instant, a string a category: every distinct one gets a place of its own, in the order the rows bring them, a tick and its name as the label ([ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)). The type decides, never the content - `"2024"` is a category, `2024` a number - and a row without a value has no place. The axis reads the rows of every series bound to it; where those bring their own `data`, name their row: `<XAxis<HourCount> value="hour" />`.<br>Shown in: [Fix the domain and name the ticks](#axis), [Add axes for other magnitudes](#axis), [Leave out the hours nobody works](#axis) and 78 more |
|
|
3015
|
+
| `domain` | `"nice" \| "data" \| readonly [number, number] \| readonly [Date, Date]` | `"nice"` | `"nice"` widens the data's extent to ticks - to named `ticks` where there are any, on a time axis to whole units of a step of hours or longer -, `"data"` keeps it, a pair is fixed: numbers, on a time axis milliseconds or two `Date`s, on a category axis places. On a `zoomable` axis it is the start: what the axis shows while the chart's view names no span for it.<br>Shown in: [Bind every kind of series to a second axis](#axis), [Read it by keyboard and screen reader (Chart)](#chart-1), [Gestures and keys (Zoom and pan)](#zoom-and-pan) and 12 more |
|
|
2943
3016
|
| `position` | `"bottom" \| "top"` | `"bottom"` | Which edge the axis stands at. A second x axis on the opposite edge is how a series counts in a unit of its own.<br>Shown in: [Add axes for other magnitudes](#axis), [Bind every kind of series to a second axis](#axis) |
|
|
2944
|
-
| `time` | `boolean` | — | The values are instants: milliseconds since the epoch, or with `time` said ISO 8601 strings as an API sends them, read by the platform's rule - a date with a time and no offset is local time, a date alone is UTC; a string that is none is not drawn. Rows that hold a `Date` put the axis in time without `time`. Ticks on local boundaries from the minute to the month, labels by level in en-GB with a 24-hour clock - `15:00`, `17 Mar`, `Mar 2026` - and the date on the first tick and on the first of a new day (`17 Mar 00:00`); a day tick there carries the year. The tooltip's x value carries the seconds where the readings lie less than a minute apart. Another language is a `tickFormat`, which is handed the instant in milliseconds. `calendar` implies it.<br>Shown in: [Align a second axis to the grid](#axis), [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation) and
|
|
2945
|
-
| `calendar` | `readonly ``WorkingInterval``[]` | — | Working calendar: the intervals in which time counts. With it the axis stands in working time - nights and weekends are out, and every removed span gets a break mark. The scale stays affine; the mapping happens in materialisation ([ADR-0001](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0001-affine-scale-contract.md)).<br>Shown in: [Leave out the hours nobody works](#axis) |
|
|
2946
|
-
| `zoomable` | `boolean` | `false` | Zoom and pan: Ctrl or ⌘ with the wheel - and a pinch - zoom around the pointer, a drag, a horizontal wheel or Shift with the wheel pan, a double click goes back to `domain`; with the focus on the chart, + and − zoom, Shift with ← or → pans and 0 goes back. The span shown is part of the chart's view, by this axis' `id` (`useChart`'s `initialView`, `onViewChange`, `setView`, `setDomain`). The plain wheel always scrolls the page.<br>Shown in: [Read it by keyboard and screen reader (Chart)](#chart-1), [Gestures and keys (Zoom and pan)](#zoom-and-pan), [Limit the zoom (Zoom and pan)](#zoom-and-pan) and
|
|
3017
|
+
| `time` | `boolean` | — | The values are instants: milliseconds since the epoch, or with `time` said ISO 8601 strings as an API sends them, read by the platform's rule - a date with a time and no offset is local time, a date alone is UTC; a string that is none is not drawn. Rows that hold a `Date` put the axis in time without `time`. Ticks on local boundaries from the minute to the month, labels by level in en-GB with a 24-hour clock - `15:00`, `17 Mar`, `Mar 2026` - and the date on the first tick and on the first of a new day (`17 Mar 00:00`); a day tick there carries the year. The tooltip's x value carries the seconds where the readings lie less than a minute apart. Another language is a `tickFormat`, which is handed the instant in milliseconds. `calendar` implies it.<br>Shown in: [Align a second axis to the grid](#axis), [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation) and 38 more |
|
|
3018
|
+
| `calendar` | `readonly ``WorkingInterval``[]` | — | Working calendar: the intervals in which time counts. With it the axis stands in working time - nights and weekends are out, and every removed span gets a break mark. The scale stays affine; the mapping happens in materialisation ([ADR-0001](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0001-affine-scale-contract.md)).<br>Shown in: [Leave out the hours nobody works](#axis), [Hand over a picture (Chart)](#chart-1) |
|
|
3019
|
+
| `zoomable` | `boolean` | `false` | Zoom and pan: Ctrl or ⌘ with the wheel - and a pinch - zoom around the pointer, a drag, a horizontal wheel or Shift with the wheel pan, a double click goes back to `domain`; with the focus on the chart, + and − zoom, Shift with ← or → pans and 0 goes back. The span shown is part of the chart's view, by this axis' `id` (`useChart`'s `initialView`, `onViewChange`, `setView`, `setDomain`). The plain wheel always scrolls the page.<br>Shown in: [Read it by keyboard and screen reader (Chart)](#chart-1), [Gestures and keys (Zoom and pan)](#zoom-and-pan), [Limit the zoom (Zoom and pan)](#zoom-and-pan) and 7 more |
|
|
2947
3020
|
| `zoomLimits` | `ZoomLimits` | at most the data's extent or this axis' own `domain`, whichever is wider, at least three data steps | The narrowest and the widest span zoom may reach, in the axis' units - milliseconds on a time axis.<br>Shown in: [Limit the zoom (Zoom and pan)](#zoom-and-pan) |
|
|
2948
3021
|
| `id` | `string` | `"x"` | Axis id, through which series bind themselves.<br>Shown in: [Add axes for other magnitudes](#axis), [Align a second axis to the grid](#axis), [Bind every kind of series to a second axis](#axis) and 7 more |
|
|
2949
|
-
| `label` | `string` | — | Axis title.<br>Shown in: [Fix the domain and name the ticks](#axis), [Add axes for other magnitudes](#axis), [Leave out the hours nobody works](#axis) and
|
|
3022
|
+
| `label` | `string` | — | Axis title.<br>Shown in: [Fix the domain and name the ticks](#axis), [Add axes for other magnitudes](#axis), [Leave out the hours nobody works](#axis) and 70 more |
|
|
2950
3023
|
| `tickCount` | `number` | — | Target value; the 1-2-5 algorithm may deviate.<br>Shown in: [Fix the domain and name the ticks](#axis), [Leave out the hours nobody works](#axis), [Mix series kinds (Chart)](#chart-1) and 8 more |
|
|
2951
3024
|
| `tickFormat` | `ValueFormat` | — | Label of a tick. Compared by its source text: one that reads a changed closure variable under the same text does not relabel the axis - give it a new text or remount. A bound `Intl.NumberFormat#format` is compared by identity. Or `NumberOptions`: Intl's options in the wording's locale, compared by value; the step's places stay unless the options set digits.<br>Shown in: [Fix the domain and name the ticks](#axis), [Leave out the hours nobody works](#axis), [Bind every kind of series to a second axis](#axis) and 21 more |
|
|
2952
3025
|
| `grid` | `boolean` | only on the first axis of its orientation | Grid lines.<br>Shown in: [One vehicle through the day (StateBand)](#stateband), [Give each one a lane (StateBand)](#stateband), [See where the vans stand idle (Scenarios)](#see-where-the-vans-stand-idle) |
|
|
@@ -2962,7 +3035,7 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
2962
3035
|
| `alignTicks` | `boolean` | — | On a further y axis: take the first y axis' tick count and widen this axis' domain until its ticks fall on that one's grid lines, the steps still 1-2-5 - one grid serves both. `tickCount` then does not apply; on the first y axis it changes nothing.<br>Shown in: [Align a second axis to the grid](#axis) |
|
|
2963
3036
|
| `position` | `"left" \| "right"` | `"left"` | Which edge the axis stands at. Several y axes per side are stacked outwards, so that extents of clearly different magnitude stay readable.<br>Shown in: [Add axes for other magnitudes](#axis), [Align a second axis to the grid](#axis), [Bind every kind of series to a second axis](#axis) and 7 more |
|
|
2964
3037
|
| `id` | `string` | `"y"` | Axis id, through which series bind themselves.<br>Shown in: [Add axes for other magnitudes](#axis), [Align a second axis to the grid](#axis), [Bind every kind of series to a second axis](#axis) and 7 more |
|
|
2965
|
-
| `label` | `string` | — | Axis title.<br>Shown in: [Fix the domain and name the ticks](#axis), [Add axes for other magnitudes](#axis), [Leave out the hours nobody works](#axis) and
|
|
3038
|
+
| `label` | `string` | — | Axis title.<br>Shown in: [Fix the domain and name the ticks](#axis), [Add axes for other magnitudes](#axis), [Leave out the hours nobody works](#axis) and 70 more |
|
|
2966
3039
|
| `tickCount` | `number` | — | Target value; the 1-2-5 algorithm may deviate.<br>Shown in: [Fix the domain and name the ticks](#axis), [Leave out the hours nobody works](#axis), [Mix series kinds (Chart)](#chart-1) and 8 more |
|
|
2967
3040
|
| `tickFormat` | `ValueFormat` | — | Label of a tick. Compared by its source text: one that reads a changed closure variable under the same text does not relabel the axis - give it a new text or remount. A bound `Intl.NumberFormat#format` is compared by identity. Or `NumberOptions`: Intl's options in the wording's locale, compared by value; the step's places stay unless the options set digits.<br>Shown in: [Fix the domain and name the ticks](#axis), [Leave out the hours nobody works](#axis), [Bind every kind of series to a second axis](#axis) and 21 more |
|
|
2968
3041
|
| `grid` | `boolean` | only on the first axis of its orientation | Grid lines.<br>Shown in: [One vehicle through the day (StateBand)](#stateband), [Give each one a lane (StateBand)](#stateband), [See where the vans stand idle (Scenarios)](#see-where-the-vans-stand-idle) |
|
|
@@ -3041,10 +3114,10 @@ nothing.
|
|
|
3041
3114
|
|
|
3042
3115
|
#### Known limits
|
|
3043
3116
|
|
|
3044
|
-
- No logarithmic and no band scale: compute the logarithm in `value`; a category is a place on the linear scale ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
3117
|
+
- No logarithmic and no band scale: compute the logarithm in `value`; a category is a place on the linear scale ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md), [ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)).
|
|
3045
3118
|
- umriss shows the reader's time ([ADR-0060](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0060-validation-and-a-layout-editor-are-never-time-zones-not-yet.md)).
|
|
3046
3119
|
|
|
3047
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
3120
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
3048
3121
|
|
|
3049
3122
|
### Zoom and pan
|
|
3050
3123
|
|
|
@@ -3572,8 +3645,63 @@ function Channel({ channel: c, peers }: { channel: (typeof CHANNELS)[number]; pe
|
|
|
3572
3645
|
}
|
|
3573
3646
|
```
|
|
3574
3647
|
|
|
3648
|
+
##### Mark a range
|
|
3649
|
+
|
|
3650
|
+
`onRange` hears a stretch the reader marked - Alt with a drag, or Space at one point and Space at another - once, on release, `from` before `to`. The chart keeps none: the range lives in the example's own state, and handing it back as `initialView` is the one line that zooms into it.
|
|
3651
|
+
|
|
3652
|
+
```tsx
|
|
3653
|
+
import { Button, Text } from "@umriss-ui/core";
|
|
3654
|
+
import { useState } from "react";
|
|
3655
|
+
import { Tooltip, useChart, type ChartRange } from "@umriss-ui/charts";
|
|
3656
|
+
|
|
3657
|
+
const HOUR = 3_600_000;
|
|
3658
|
+
const START = Date.UTC(2026, 2, 16);
|
|
3659
|
+
// Hourly p95 latency of one service over three days, as an API delivers it.
|
|
3660
|
+
const READINGS = Array.from({ length: 72 }, (_, i) => ({
|
|
3661
|
+
t: START + i * HOUR,
|
|
3662
|
+
p95: Math.round(220 + 60 * Math.sin(i / 4) + ((i * 37) % 29) + (i >= 40 && i < 46 ? 150 : 0)),
|
|
3663
|
+
}));
|
|
3664
|
+
|
|
3665
|
+
const when = (ms: number) => new Date(ms).toLocaleString("en-GB", { weekday: "short", hour: "2-digit", minute: "2-digit", timeZone: "UTC" });
|
|
3666
|
+
|
|
3667
|
+
export default function MarkARange() {
|
|
3668
|
+
const [range, setRange] = useState<ChartRange | null>(null);
|
|
3669
|
+
// `initialView` is read once, so a zoom into the range is a new chart that starts there.
|
|
3670
|
+
const [zoomed, setZoomed] = useState<ChartRange | null>(null);
|
|
3671
|
+
return (
|
|
3672
|
+
<>
|
|
3673
|
+
<Course key={zoomed === null ? "all" : `${zoomed.from}-${zoomed.to}`} zoomed={zoomed} onRange={setRange} />
|
|
3674
|
+
<Text as="p">{range === null ? "No range marked yet." : `Marked: ${when(range.from)} to ${when(range.to)} (UTC)`}</Text>
|
|
3675
|
+
<Button disabled={range === null} onClick={() => setZoomed(range)}>
|
|
3676
|
+
Zoom into it
|
|
3677
|
+
</Button>
|
|
3678
|
+
</>
|
|
3679
|
+
);
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
function Course({ zoomed, onRange }: { zoomed: ChartRange | null; onRange: (range: ChartRange) => void }) {
|
|
3683
|
+
const { Chart, XAxis, YAxis, Line } = useChart(READINGS, {
|
|
3684
|
+
onRange,
|
|
3685
|
+
initialView: zoomed === null ? undefined : { domains: { [zoomed.axisId]: [zoomed.from, zoomed.to] } },
|
|
3686
|
+
});
|
|
3687
|
+
return (
|
|
3688
|
+
<Chart height={240} aria-label="Hourly p95 latency over three days">
|
|
3689
|
+
<XAxis value="t" time domain="data" zoomable />
|
|
3690
|
+
<YAxis label="ms" />
|
|
3691
|
+
<Line value="p95" name="p95" />
|
|
3692
|
+
<Tooltip mode="x" />
|
|
3693
|
+
</Chart>
|
|
3694
|
+
);
|
|
3695
|
+
}
|
|
3696
|
+
```
|
|
3697
|
+
|
|
3575
3698
|
#### Keyboard
|
|
3576
3699
|
|
|
3700
|
+
| Key | Action |
|
|
3701
|
+
|---|---|
|
|
3702
|
+
| `Alt + drag` | Mark a range, where `onRange` is given and the x axis is `zoomable`; a plain drag pans. |
|
|
3703
|
+
| `Space` | Start a range at the active point; Space again ends it, Escape cancels. Needs a `Tooltip`. |
|
|
3704
|
+
|
|
3577
3705
|
The keys of [Chart](#chart-1) apply here.
|
|
3578
3706
|
|
|
3579
3707
|
#### API
|
|
@@ -3582,15 +3710,15 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
3582
3710
|
|
|
3583
3711
|
| Prop | Type | Default | Description |
|
|
3584
3712
|
|---|---|---|---|
|
|
3585
|
-
| `value` *required* | `AxisField``<T> \| ((d: T, index: number) => ``AxisValue``)` | — | Where a row lies on this axis: a field of the row, compared by its name, or a function of it, compared by its source text as a series' is (`ValueFunction`) - with the same closure limit. A number is a position, a `Date` an instant, a string a category: every distinct one gets a place of its own, in the order the rows bring them, a tick and its name as the label ([ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)). The type decides, never the content - `"2024"` is a category, `2024` a number - and a row without a value has no place. The axis reads the rows of every series bound to it; where those bring their own `data`, name their row: `<XAxis<HourCount> value="hour" />`.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and
|
|
3586
|
-
| `domain` | `"nice" \| "data" \| readonly [number, number] \| readonly [Date, Date]` | `"nice"` | `"nice"` widens the data's extent to ticks - to named `ticks` where there are any, on a time axis to whole units of a step of hours or longer -, `"data"` keeps it, a pair is fixed: numbers, on a time axis milliseconds or two `Date`s, on a category axis places. On a `zoomable` axis it is the start: what the axis shows while the chart's view names no span for it.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and
|
|
3713
|
+
| `value` *required* | `AxisField``<T> \| ((d: T, index: number) => ``AxisValue``)` | — | Where a row lies on this axis: a field of the row, compared by its name, or a function of it, compared by its source text as a series' is (`ValueFunction`) - with the same closure limit. A number is a position, a `Date` an instant, a string a category: every distinct one gets a place of its own, in the order the rows bring them, a tick and its name as the label ([ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)). The type decides, never the content - `"2024"` is a category, `2024` a number - and a row without a value has no place. The axis reads the rows of every series bound to it; where those bring their own `data`, name their row: `<XAxis<HourCount> value="hour" />`.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and 78 more |
|
|
3714
|
+
| `domain` | `"nice" \| "data" \| readonly [number, number] \| readonly [Date, Date]` | `"nice"` | `"nice"` widens the data's extent to ticks - to named `ticks` where there are any, on a time axis to whole units of a step of hours or longer -, `"data"` keeps it, a pair is fixed: numbers, on a time axis milliseconds or two `Date`s, on a category axis places. On a `zoomable` axis it is the start: what the axis shows while the chart's view names no span for it.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and 12 more |
|
|
3587
3715
|
| `position` | `"bottom" \| "top"` | `"bottom"` | Which edge the axis stands at. A second x axis on the opposite edge is how a series counts in a unit of its own.<br>Shown in: [Add axes for other magnitudes (Axis)](#axis), [Bind every kind of series to a second axis (Axis)](#axis) |
|
|
3588
|
-
| `time` | `boolean` | — | The values are instants: milliseconds since the epoch, or with `time` said ISO 8601 strings as an API sends them, read by the platform's rule - a date with a time and no offset is local time, a date alone is UTC; a string that is none is not drawn. Rows that hold a `Date` put the axis in time without `time`. Ticks on local boundaries from the minute to the month, labels by level in en-GB with a 24-hour clock - `15:00`, `17 Mar`, `Mar 2026` - and the date on the first tick and on the first of a new day (`17 Mar 00:00`); a day tick there carries the year. The tooltip's x value carries the seconds where the readings lie less than a minute apart. Another language is a `tickFormat`, which is handed the instant in milliseconds. `calendar` implies it.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and
|
|
3589
|
-
| `calendar` | `readonly ``WorkingInterval``[]` | — | Working calendar: the intervals in which time counts. With it the axis stands in working time - nights and weekends are out, and every removed span gets a break mark. The scale stays affine; the mapping happens in materialisation ([ADR-0001](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0001-affine-scale-contract.md)).<br>Shown in: [Leave out the hours nobody works (Axis)](#axis) |
|
|
3590
|
-
| `zoomable` | `boolean` | `false` | Zoom and pan: Ctrl or ⌘ with the wheel - and a pinch - zoom around the pointer, a drag, a horizontal wheel or Shift with the wheel pan, a double click goes back to `domain`; with the focus on the chart, + and − zoom, Shift with ← or → pans and 0 goes back. The span shown is part of the chart's view, by this axis' `id` (`useChart`'s `initialView`, `onViewChange`, `setView`, `setDomain`). The plain wheel always scrolls the page.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and
|
|
3716
|
+
| `time` | `boolean` | — | The values are instants: milliseconds since the epoch, or with `time` said ISO 8601 strings as an API sends them, read by the platform's rule - a date with a time and no offset is local time, a date alone is UTC; a string that is none is not drawn. Rows that hold a `Date` put the axis in time without `time`. Ticks on local boundaries from the minute to the month, labels by level in en-GB with a 24-hour clock - `15:00`, `17 Mar`, `Mar 2026` - and the date on the first tick and on the first of a new day (`17 Mar 00:00`); a day tick there carries the year. The tooltip's x value carries the seconds where the readings lie less than a minute apart. Another language is a `tickFormat`, which is handed the instant in milliseconds. `calendar` implies it.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and 38 more |
|
|
3717
|
+
| `calendar` | `readonly ``WorkingInterval``[]` | — | Working calendar: the intervals in which time counts. With it the axis stands in working time - nights and weekends are out, and every removed span gets a break mark. The scale stays affine; the mapping happens in materialisation ([ADR-0001](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0001-affine-scale-contract.md)).<br>Shown in: [Leave out the hours nobody works (Axis)](#axis), [Hand over a picture (Chart)](#chart-1) |
|
|
3718
|
+
| `zoomable` | `boolean` | `false` | Zoom and pan: Ctrl or ⌘ with the wheel - and a pinch - zoom around the pointer, a drag, a horizontal wheel or Shift with the wheel pan, a double click goes back to `domain`; with the focus on the chart, + and − zoom, Shift with ← or → pans and 0 goes back. The span shown is part of the chart's view, by this axis' `id` (`useChart`'s `initialView`, `onViewChange`, `setView`, `setDomain`). The plain wheel always scrolls the page.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and 7 more |
|
|
3591
3719
|
| `zoomLimits` | `ZoomLimits` | at most the data's extent or this axis' own `domain`, whichever is wider, at least three data steps | The narrowest and the widest span zoom may reach, in the axis' units - milliseconds on a time axis.<br>Shown in: [Limit the zoom](#zoom-and-pan) |
|
|
3592
3720
|
| `id` | `string` | `"x"` | Axis id, through which series bind themselves.<br>Shown in: [Add axes for other magnitudes (Axis)](#axis), [Align a second axis to the grid (Axis)](#axis), [Bind every kind of series to a second axis (Axis)](#axis) and 7 more |
|
|
3593
|
-
| `label` | `string` | — | Axis title.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and
|
|
3721
|
+
| `label` | `string` | — | Axis title.<br>Shown in: [Gestures and keys](#zoom-and-pan), [Limit the zoom](#zoom-and-pan), [Fit the y axis to what is visible](#zoom-and-pan) and 70 more |
|
|
3594
3722
|
| `tickCount` | `number` | — | Target value; the 1-2-5 algorithm may deviate.<br>Shown in: [Keep charts in step](#zoom-and-pan), [Fix the domain and name the ticks (Axis)](#axis), [Leave out the hours nobody works (Axis)](#axis) and 8 more |
|
|
3595
3723
|
| `tickFormat` | `ValueFormat` | — | Label of a tick. Compared by its source text: one that reads a changed closure variable under the same text does not relabel the axis - give it a new text or remount. A bound `Intl.NumberFormat#format` is compared by identity. Or `NumberOptions`: Intl's options in the wording's locale, compared by value; the step's places stay unless the options set digits.<br>Shown in: [Fix the domain and name the ticks (Axis)](#axis), [Leave out the hours nobody works (Axis)](#axis), [Bind every kind of series to a second axis (Axis)](#axis) and 21 more |
|
|
3596
3724
|
| `grid` | `boolean` | only on the first axis of its orientation | Grid lines.<br>Shown in: [One vehicle through the day (StateBand)](#stateband), [Give each one a lane (StateBand)](#stateband), [See where the vans stand idle (Scenarios)](#see-where-the-vans-stand-idle) |
|
|
@@ -3598,11 +3726,11 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
3598
3726
|
| `categories` | `readonly string[]` | — | The categories of the axis, in their order. Without it they stand in the order the rows first bring them. With it the list is the order and the extent: a category no row carries keeps its empty place, and a row whose category is not listed is not drawn - DEV names it. It makes the axis a category axis whatever the rows hold ([ADR-0052](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0052-a-chart-reads-its-rows-as-they-come.md)).<br>Shown in: [Fix the order and keep an empty place (Axis)](#axis) |
|
|
3599
3727
|
| `categoryLabel` | `(category: string) => string` | the category itself | What is written for a category - under its tick, in the tooltip, the readout and the data table - where the rows hold a key and not a name. Two categories may share a label and keep two places. Compared by its source text, as `tickFormat` is.<br>Shown in: [Fix the order and keep an empty place (Axis)](#axis), [Tell series apart without colour (Chart)](#chart-1), [Legend above or below (Legend)](#legend) and 1 more |
|
|
3600
3728
|
|
|
3601
|
-
##### `ChartOptions<Z = unknown>`
|
|
3729
|
+
##### `ChartOptions<Z = unknown, V extends number | string = number>`
|
|
3602
3730
|
|
|
3603
3731
|
| Prop | Type | Default | Description |
|
|
3604
3732
|
|---|---|---|---|
|
|
3605
|
-
| `initialView` | [`ChartView`](#view) | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The chart remembers none: where a view is kept is the application's decision.<br>Shown in: [Fit the y axis to what is visible](#zoom-and-pan), [Hide a series from the legend (Legend)](#legend) |
|
|
3733
|
+
| `initialView` | [`ChartView`](#view) | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The chart remembers none: where a view is kept is the application's decision.<br>Shown in: [Fit the y axis to what is visible](#zoom-and-pan), [Mark a range](#zoom-and-pan), [Hide a series from the legend (Legend)](#legend) |
|
|
3606
3734
|
|
|
3607
3735
|
###### Events
|
|
3608
3736
|
|
|
@@ -3610,6 +3738,7 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
3610
3738
|
|---|---|---|---|
|
|
3611
3739
|
| `onViewChange` | `(view: `[`ChartView`](#view)`) => void` | — | Every change the reader makes, once, always the whole view - the one to keep, or to hand another chart's `setView`. A pan or zoom is reported at most once per frame. Not called for the view the chart starts with, nor for one `setView` applies.<br>Shown in: [Keep charts in step](#zoom-and-pan), [Read it by keyboard and screen reader (Chart)](#chart-1) |
|
|
3612
3740
|
| `onSelect` | `(hit: ``TooltipHit``<Z>) => void` | — | The reader chose a point: a click on a hit (a tap too), or Enter on the Active point - the same hit the tooltip's `render` receives. Once per click; the end of a drag does not report, and the second click of a double click does not either. The chart holds no selection and draws none: what is chosen is the application's state. Needs a `<Tooltip>`, which makes the hits; the hit does not travel over `syncId`.<br>Shown in: [Choose a hit (Tooltip)](#tooltip), [Drill down from a year to its days (Tooltip)](#tooltip) |
|
|
3741
|
+
| `onRange` | `(range: ``ChartRange``<V>) => void` | — | The reader marked a stretch of an x axis: Alt with a drag where the chart zooms, a plain drag where it does not. Called once, on release - once per x axis -, with `from` not after `to`, in the axis' own values: numbers, milliseconds on a time axis, wall-clock instants on a calendar axis, and on a category axis the first and last category covered, as strings - say so in the handler's parameter, `ChartRange<string>`. A band covers the stretch while the pointer is down; the chart keeps no range and draws none afterwards, and it does not travel over `syncId`. A press that travels 4 px or less is a click and reaches `onSelect`; Escape and a cancelled pointer report nothing.<br>Shown in: [Mark a range](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
3613
3742
|
|
|
3614
3743
|
##### Types on this page
|
|
3615
3744
|
|
|
@@ -3681,6 +3810,19 @@ A custom tooltip's `render` receives it.
|
|
|
3681
3810
|
| `xPx` *required* | `number` | — | Pixel position of the crosshair (snapped to the data point). |
|
|
3682
3811
|
| `yPx` *required* | `number` | — | Pixel position of the primary hit. |
|
|
3683
3812
|
|
|
3813
|
+
###### `ChartRange<V extends number | string = number>`
|
|
3814
|
+
|
|
3815
|
+
A stretch of an x axis the reader marked (`onRange`): `from` is not after
|
|
3816
|
+
`to`, both in the axis' own values - numbers on a numeric or time axis
|
|
3817
|
+
(milliseconds). A caller that reads numbers takes the default and needs no
|
|
3818
|
+
cast; `V` is what a category axis widens it to.
|
|
3819
|
+
|
|
3820
|
+
| Prop | Type | Default | Description |
|
|
3821
|
+
|---|---|---|---|
|
|
3822
|
+
| `axisId` *required* | `string` | — | <br>Shown in: [Mark a range](#zoom-and-pan) |
|
|
3823
|
+
| `from` *required* | `V` | — | <br>Shown in: [Mark a range](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
3824
|
+
| `to` *required* | `V` | — | <br>Shown in: [Mark a range](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
3825
|
+
|
|
3684
3826
|
###### `NumberOptions`
|
|
3685
3827
|
|
|
3686
3828
|
The options of `Intl.NumberFormat`, plus `decimals` for a fixed number of
|
|
@@ -3734,7 +3876,7 @@ The optional numbers of a box by name.
|
|
|
3734
3876
|
|
|
3735
3877
|
- No zoom along y, no rectangle zoom and no navigator: the x span is the one zoom there is.
|
|
3736
3878
|
|
|
3737
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
3879
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
3738
3880
|
|
|
3739
3881
|
### View
|
|
3740
3882
|
|
|
@@ -3919,11 +4061,11 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
3919
4061
|
|
|
3920
4062
|
#### API
|
|
3921
4063
|
|
|
3922
|
-
##### `ChartOptions<Z = unknown>`
|
|
4064
|
+
##### `ChartOptions<Z = unknown, V extends number | string = number>`
|
|
3923
4065
|
|
|
3924
4066
|
| Prop | Type | Default | Description |
|
|
3925
4067
|
|---|---|---|---|
|
|
3926
|
-
| `initialView` | `ChartView` | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The chart remembers none: where a view is kept is the application's decision.<br>Shown in: [Fit the y axis to what is visible (Zoom and pan)](#zoom-and-pan), [Hide a series from the legend (Legend)](#legend) |
|
|
4068
|
+
| `initialView` | `ChartView` | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The chart remembers none: where a view is kept is the application's decision.<br>Shown in: [Fit the y axis to what is visible (Zoom and pan)](#zoom-and-pan), [Mark a range (Zoom and pan)](#zoom-and-pan), [Hide a series from the legend (Legend)](#legend) |
|
|
3927
4069
|
|
|
3928
4070
|
###### Events
|
|
3929
4071
|
|
|
@@ -3931,12 +4073,13 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
3931
4073
|
|---|---|---|---|
|
|
3932
4074
|
| `onViewChange` | `(view: ``ChartView``) => void` | — | Every change the reader makes, once, always the whole view - the one to keep, or to hand another chart's `setView`. A pan or zoom is reported at most once per frame. Not called for the view the chart starts with, nor for one `setView` applies.<br>Shown in: [Keep charts in step (Zoom and pan)](#zoom-and-pan), [Read it by keyboard and screen reader (Chart)](#chart-1) |
|
|
3933
4075
|
| `onSelect` | `(hit: ``TooltipHit``<Z>) => void` | — | The reader chose a point: a click on a hit (a tap too), or Enter on the Active point - the same hit the tooltip's `render` receives. Once per click; the end of a drag does not report, and the second click of a double click does not either. The chart holds no selection and draws none: what is chosen is the application's state. Needs a `<Tooltip>`, which makes the hits; the hit does not travel over `syncId`.<br>Shown in: [Choose a hit (Tooltip)](#tooltip), [Drill down from a year to its days (Tooltip)](#tooltip) |
|
|
4076
|
+
| `onRange` | `(range: ``ChartRange``<V>) => void` | — | The reader marked a stretch of an x axis: Alt with a drag where the chart zooms, a plain drag where it does not. Called once, on release - once per x axis -, with `from` not after `to`, in the axis' own values: numbers, milliseconds on a time axis, wall-clock instants on a calendar axis, and on a category axis the first and last category covered, as strings - say so in the handler's parameter, `ChartRange<string>`. A band covers the stretch while the pointer is down; the chart keeps no range and draws none afterwards, and it does not travel over `syncId`. A press that travels 4 px or less is a click and reaches `onSelect`; Escape and a cancelled pointer report nothing.<br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
3934
4077
|
|
|
3935
4078
|
##### `ChartView`
|
|
3936
4079
|
|
|
3937
4080
|
| Prop | Type | Default | Description |
|
|
3938
4081
|
|---|---|---|---|
|
|
3939
|
-
| `domains` | `AxisSpans` | — | The span each zoomable x axis shows, by axis `id` - a lone x axis is `"x"`. An axis absent here shows its own `domain`. An id that names no zoomable x axis falls out.<br>Shown in: [Fit the y axis to what is visible (Zoom and pan)](#zoom-and-pan) |
|
|
4082
|
+
| `domains` | `AxisSpans` | — | The span each zoomable x axis shows, by axis `id` - a lone x axis is `"x"`. An axis absent here shows its own `domain`. An id that names no zoomable x axis falls out.<br>Shown in: [Fit the y axis to what is visible (Zoom and pan)](#zoom-and-pan), [Mark a range (Zoom and pan)](#zoom-and-pan) |
|
|
3940
4083
|
| `hidden` | `readonly string[]` | — | The hidden series, by `name`; a series without one cannot be hidden. A name no series carries falls out.<br>Shown in: [Hide a series from the legend (Legend)](#legend) |
|
|
3941
4084
|
|
|
3942
4085
|
##### Types on this page
|
|
@@ -3953,6 +4096,19 @@ A custom tooltip's `render` receives it.
|
|
|
3953
4096
|
| `xPx` *required* | `number` | — | Pixel position of the crosshair (snapped to the data point). |
|
|
3954
4097
|
| `yPx` *required* | `number` | — | Pixel position of the primary hit. |
|
|
3955
4098
|
|
|
4099
|
+
###### `ChartRange<V extends number | string = number>`
|
|
4100
|
+
|
|
4101
|
+
A stretch of an x axis the reader marked (`onRange`): `from` is not after
|
|
4102
|
+
`to`, both in the axis' own values - numbers on a numeric or time axis
|
|
4103
|
+
(milliseconds). A caller that reads numbers takes the default and needs no
|
|
4104
|
+
cast; `V` is what a category axis widens it to.
|
|
4105
|
+
|
|
4106
|
+
| Prop | Type | Default | Description |
|
|
4107
|
+
|---|---|---|---|
|
|
4108
|
+
| `axisId` *required* | `string` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan) |
|
|
4109
|
+
| `from` *required* | `V` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
4110
|
+
| `to` *required* | `V` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
4111
|
+
|
|
3956
4112
|
###### `AxisSpans`
|
|
3957
4113
|
|
|
3958
4114
|
The span each zoomable x axis shows, by axis `id`, in the axis' units.
|
|
@@ -4003,7 +4159,7 @@ The optional numbers of a box by name.
|
|
|
4003
4159
|
|
|
4004
4160
|
- The active point and the open data table are not part of the view: they are where the reader is, not how the chart is looked at.
|
|
4005
4161
|
|
|
4006
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
4162
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
4007
4163
|
|
|
4008
4164
|
## Series
|
|
4009
4165
|
|
|
@@ -4019,6 +4175,8 @@ import { useChart } from "@umriss-ui/charts";
|
|
|
4019
4175
|
|
|
4020
4176
|
A missing reading breaks the line; nothing is drawn across a gap. With `step` a value holds until the next one, for things logged only when they change.
|
|
4021
4177
|
|
|
4178
|
+
A `value` given as a function is compared by its source text, so one that reads something outside its row (`(d) => d.duration * factor`) keeps its old course when that changes, and the development build warns once. Carry the value in the rows, or give the series a `key` that changes with it.
|
|
4179
|
+
|
|
4022
4180
|
#### Examples
|
|
4023
4181
|
|
|
4024
4182
|
##### One series
|
|
@@ -4469,11 +4627,11 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
4469
4627
|
|
|
4470
4628
|
| Prop | Type | Default | Description |
|
|
4471
4629
|
|---|---|---|---|
|
|
4472
|
-
| `value` *required* | `Value``<T>` | — | Y value - a number field of the row or a function of it; null/undefined/NaN/±Infinity means a gap.<br>Shown in: [One series](#line), [Several series and a gap](#line), [Hold a value until it changes](#line) and
|
|
4630
|
+
| `value` *required* | `Value``<T>` | — | Y value - a number field of the row or a function of it; null/undefined/NaN/±Infinity means a gap.<br>Shown in: [One series](#line), [Several series and a gap](#line), [Hold a value until it changes](#line) and 49 more |
|
|
4473
4631
|
| `xAxisId` | `string` | `"x"` | Binding to an x axis.<br>Shown in: [Add axes for other magnitudes (Axis)](#axis), [Bind every kind of series to a second axis (Axis)](#axis) |
|
|
4474
4632
|
| `yAxisId` | `string` | `"y"` | Binding to a y axis.<br>Shown in: [Hold a value until it changes](#line), [Add axes for other magnitudes (Axis)](#axis), [Align a second axis to the grid (Axis)](#axis) and 4 more |
|
|
4475
4633
|
| `data` | `readonly T[]` | — | Series-own data; overrides the container data.<br>Shown in: [Several series and a gap](#line), [Hold a value until it changes](#line), [Tell series apart without colour (Chart)](#chart-1) and 6 more |
|
|
4476
|
-
| `name` | `string` | "Series n", after its place in the chart | The name in legend and tooltip. Without one a warning stands in DEV - an unnamed series is a colour nobody can look up.<br>Shown in: [One series](#line), [Several series and a gap](#line), [Hold a value until it changes](#line) and
|
|
4634
|
+
| `name` | `string` | "Series n", after its place in the chart | The name in legend and tooltip. Without one a warning stands in DEV - an unnamed series is a colour nobody can look up.<br>Shown in: [One series](#line), [Several series and a gap](#line), [Hold a value until it changes](#line) and 49 more |
|
|
4477
4635
|
| `format` | `ValueFormat` | the y axis' `tickFormat`, else the built-in number format | The value as the tooltip writes it, as a function or `NumberOptions`.<br>Shown in: [Write each value in its unit (Tooltip)](#tooltip), [Show the values as a table (Tooltip)](#tooltip), [Table a long series (Tooltip)](#tooltip) and 1 more |
|
|
4478
4636
|
| `color` | `string` | the palette's `--uc-series-N` | Any CSS colour value.<br>Shown in: [Compare progress with a plan](#line), [Fix the domain and name the ticks (Axis)](#axis), [Watch latency against its objective (Scenarios)](#watch-latency-against-its-objective) and 1 more |
|
|
4479
4637
|
| `tone` | `"ok" \| "warning" \| "alarm"` | — | A role instead of a colour value; the theme resolves it.<br>Shown in: [Compare the budget with the forecast (Scenarios)](#compare-the-budget-with-the-forecast) |
|
|
@@ -4519,8 +4677,8 @@ type NumberField<T> = NoInfer<
|
|
|
4519
4677
|
A **value** computed from the row - the function form of `Value`.
|
|
4520
4678
|
Compared by its source text, not its identity - an inline function is new
|
|
4521
4679
|
on every render. Known limit: one that reads a
|
|
4522
|
-
changed closure variable under the same text is not run again
|
|
4523
|
-
|
|
4680
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
4681
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
4524
4682
|
|
|
4525
4683
|
```ts
|
|
4526
4684
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -4539,9 +4697,9 @@ nothing.
|
|
|
4539
4697
|
|
|
4540
4698
|
#### Known limits
|
|
4541
4699
|
|
|
4542
|
-
- No smoothing: a curve between two readings would invent values nobody measured ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
4700
|
+
- No smoothing: a curve between two readings would invent values nobody measured ([ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md)).
|
|
4543
4701
|
|
|
4544
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
4702
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
4545
4703
|
|
|
4546
4704
|
### Area
|
|
4547
4705
|
|
|
@@ -4997,8 +5155,8 @@ type NumberField<T> = NoInfer<
|
|
|
4997
5155
|
A **value** computed from the row - the function form of `Value`.
|
|
4998
5156
|
Compared by its source text, not its identity - an inline function is new
|
|
4999
5157
|
on every render. Known limit: one that reads a
|
|
5000
|
-
changed closure variable under the same text is not run again
|
|
5001
|
-
|
|
5158
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
5159
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
5002
5160
|
|
|
5003
5161
|
```ts
|
|
5004
5162
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -5241,6 +5399,45 @@ export default function Histogram() {
|
|
|
5241
5399
|
}
|
|
5242
5400
|
```
|
|
5243
5401
|
|
|
5402
|
+
##### Mark a range of bars
|
|
5403
|
+
|
|
5404
|
+
A category axis does not zoom, so a plain drag marks a range: `from` and `to` are the category names the rows hold, the earlier one first.
|
|
5405
|
+
|
|
5406
|
+
```tsx
|
|
5407
|
+
import { Text } from "@umriss-ui/core";
|
|
5408
|
+
import { useState } from "react";
|
|
5409
|
+
import { Tooltip, useChart, type ChartRange } from "@umriss-ui/charts";
|
|
5410
|
+
|
|
5411
|
+
// February's spend per cost centre, as the ledger sends it.
|
|
5412
|
+
const SPEND = [
|
|
5413
|
+
{ costCentre: "Sales", actual: 134_447 },
|
|
5414
|
+
{ costCentre: "Marketing", actual: 76_588 },
|
|
5415
|
+
{ costCentre: "Engineering", actual: 183_157 },
|
|
5416
|
+
{ costCentre: "Design", actual: 51_761 },
|
|
5417
|
+
{ costCentre: "Customer service", actual: 61_160 },
|
|
5418
|
+
{ costCentre: "Finance", actual: 46_353 },
|
|
5419
|
+
{ costCentre: "People", actual: 37_886 },
|
|
5420
|
+
{ costCentre: "IT", actual: 74_313 },
|
|
5421
|
+
{ costCentre: "Facilities", actual: 71_848 },
|
|
5422
|
+
];
|
|
5423
|
+
|
|
5424
|
+
export default function MarkARangeOfBars() {
|
|
5425
|
+
const [range, setRange] = useState<ChartRange<string> | null>(null);
|
|
5426
|
+
const { Chart, XAxis, YAxis, Bar } = useChart(SPEND, { onRange: setRange });
|
|
5427
|
+
return (
|
|
5428
|
+
<>
|
|
5429
|
+
<Chart height={260} aria-label="Actual spend per cost centre in February">
|
|
5430
|
+
<XAxis value="costCentre" />
|
|
5431
|
+
<YAxis label="€" />
|
|
5432
|
+
<Bar value="actual" name="Actual" />
|
|
5433
|
+
<Tooltip mode="x" />
|
|
5434
|
+
</Chart>
|
|
5435
|
+
<Text as="p">{range === null ? "Drag across the bars to mark a range." : `Marked: ${range.from} to ${range.to}`}</Text>
|
|
5436
|
+
</>
|
|
5437
|
+
);
|
|
5438
|
+
}
|
|
5439
|
+
```
|
|
5440
|
+
|
|
5244
5441
|
#### When to use something else
|
|
5245
5442
|
|
|
5246
5443
|
- Causes ranked by how much they contribute → Pareto
|
|
@@ -5255,11 +5452,11 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
5255
5452
|
|
|
5256
5453
|
| Prop | Type | Default | Description |
|
|
5257
5454
|
|---|---|---|---|
|
|
5258
|
-
| `value` *required* | `Value``<T>` | — | Height - a number field of the row or a function of it; null/undefined/NaN/±Infinity means a gap.<br>Shown in: [One bar per category](#bar), [Group bars side by side](#bar), [Show bars above and below zero](#bar) and
|
|
5455
|
+
| `value` *required* | `Value``<T>` | — | Height - a number field of the row or a function of it; null/undefined/NaN/±Infinity means a gap.<br>Shown in: [One bar per category](#bar), [Group bars side by side](#bar), [Show bars above and below zero](#bar) and 15 more |
|
|
5259
5456
|
| `xAxisId` | `string` | `"x"` | Binding to an x axis.<br>Shown in: [Bind every kind of series to a second axis (Axis)](#axis) |
|
|
5260
5457
|
| `yAxisId` | `string` | `"y"` | Binding to a y axis.<br>Shown in: [Bind every kind of series to a second axis (Axis)](#axis) |
|
|
5261
5458
|
| `data` | `readonly T[]` | — | Series-own data; overrides the container data.<br>Shown in: [Bind every kind of series to a second axis (Axis)](#axis) |
|
|
5262
|
-
| `name` | `string` | "Series n", after its place in the chart | The name in legend and tooltip. Without one a warning stands in DEV - an unnamed series is a colour nobody can look up.<br>Shown in: [One bar per category](#bar), [Group bars side by side](#bar), [Show bars above and below zero](#bar) and
|
|
5459
|
+
| `name` | `string` | "Series n", after its place in the chart | The name in legend and tooltip. Without one a warning stands in DEV - an unnamed series is a colour nobody can look up.<br>Shown in: [One bar per category](#bar), [Group bars side by side](#bar), [Show bars above and below zero](#bar) and 15 more |
|
|
5263
5460
|
| `format` | `ValueFormat` | the y axis' `tickFormat`, else the built-in number format | The value as the tooltip writes it, as a function or `NumberOptions`.<br>Shown in: [Show shares of a whole](#bar), [Compare the budget with the forecast (Scenarios)](#compare-the-budget-with-the-forecast) |
|
|
5264
5461
|
| `color` | `string` | the palette's `--uc-series-N` | Any CSS colour value.<br>Shown in: [Group bars side by side](#bar), [See where the vans stand idle (Scenarios)](#see-where-the-vans-stand-idle), [Compare the budget with the forecast (Scenarios)](#compare-the-budget-with-the-forecast) |
|
|
5265
5462
|
| `tone` | `"ok" \| "warning" \| "alarm"` | — | A role instead of a colour value; the theme resolves it. `color` beats it.<br>Shown in: [Compare the budget with the forecast (Scenarios)](#compare-the-budget-with-the-forecast) |
|
|
@@ -5304,8 +5501,8 @@ type NumberField<T> = NoInfer<
|
|
|
5304
5501
|
A **value** computed from the row - the function form of `Value`.
|
|
5305
5502
|
Compared by its source text, not its identity - an inline function is new
|
|
5306
5503
|
on every render. Known limit: one that reads a
|
|
5307
|
-
changed closure variable under the same text is not run again
|
|
5308
|
-
|
|
5504
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
5505
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
5309
5506
|
|
|
5310
5507
|
```ts
|
|
5311
5508
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -5326,7 +5523,7 @@ nothing.
|
|
|
5326
5523
|
|
|
5327
5524
|
- Horizontal bars are the next kind to come ([ADR-0059](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0059-the-set-of-chart-kinds-is-open.md)); until then a `Matrix` or a `Table` ranks by name.
|
|
5328
5525
|
|
|
5329
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
5526
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
5330
5527
|
|
|
5331
5528
|
### Scatter
|
|
5332
5529
|
|
|
@@ -5633,8 +5830,8 @@ type NumberField<T> = NoInfer<
|
|
|
5633
5830
|
A **value** computed from the row - the function form of `Value`.
|
|
5634
5831
|
Compared by its source text, not its identity - an inline function is new
|
|
5635
5832
|
on every render. Known limit: one that reads a
|
|
5636
|
-
changed closure variable under the same text is not run again
|
|
5637
|
-
|
|
5833
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
5834
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
5638
5835
|
|
|
5639
5836
|
```ts
|
|
5640
5837
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -6193,8 +6390,8 @@ type NumberField<T> = NoInfer<
|
|
|
6193
6390
|
A **value** computed from the row - the function form of `Value`.
|
|
6194
6391
|
Compared by its source text, not its identity - an inline function is new
|
|
6195
6392
|
on every render. Known limit: one that reads a
|
|
6196
|
-
changed closure variable under the same text is not run again
|
|
6197
|
-
|
|
6393
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
6394
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
6198
6395
|
|
|
6199
6396
|
```ts
|
|
6200
6397
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -6237,7 +6434,7 @@ nothing.
|
|
|
6237
6434
|
|
|
6238
6435
|
- No horizontal boxes, no violin or jittered points, no box width by count: a density is smoothing, a jitter a picture that does not repeat.
|
|
6239
6436
|
|
|
6240
|
-
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.
|
|
6437
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/charts-v0.44.0/docs/adr/0032-what-umriss-is-not.md).
|
|
6241
6438
|
|
|
6242
6439
|
### StateBand
|
|
6243
6440
|
|
|
@@ -6871,8 +7068,8 @@ type NumberField<T> = NoInfer<
|
|
|
6871
7068
|
A **value** computed from the row - the function form of `Value`.
|
|
6872
7069
|
Compared by its source text, not its identity - an inline function is new
|
|
6873
7070
|
on every render. Known limit: one that reads a
|
|
6874
|
-
changed closure variable under the same text is not run again
|
|
6875
|
-
|
|
7071
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
7072
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
6876
7073
|
|
|
6877
7074
|
```ts
|
|
6878
7075
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -7167,8 +7364,8 @@ type NumberField<T> = NoInfer<
|
|
|
7167
7364
|
A **value** computed from the row - the function form of `Value`.
|
|
7168
7365
|
Compared by its source text, not its identity - an inline function is new
|
|
7169
7366
|
on every render. Known limit: one that reads a
|
|
7170
|
-
changed closure variable under the same text is not run again
|
|
7171
|
-
|
|
7367
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
7368
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
7172
7369
|
|
|
7173
7370
|
```ts
|
|
7174
7371
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -8110,11 +8307,11 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
8110
8307
|
|
|
8111
8308
|
| Prop | Type | Default | Description |
|
|
8112
8309
|
|---|---|---|---|
|
|
8113
|
-
| `value` *required* | `number \| Date` | — | Where the line lies, in domain units of its axis; along a time axis an instant, in milliseconds or as a `Date`.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and
|
|
8310
|
+
| `value` *required* | `number \| Date` | — | Where the line lies, in domain units of its axis; along a time axis an instant, in milliseconds or as a `Date`.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and 12 more |
|
|
8114
8311
|
| `axisId` | `string` | the first axis of the orientation | Axis on which the value lies.<br>Shown in: [Sort causes and collect the tail (Pareto)](#pareto) |
|
|
8115
8312
|
| `orientation` | `"x" \| "y"` | `"y"` | Whether the value lies on the x or on the y axis - a limit is nearly always a value and not a moment.<br>Shown in: [Mark moments and windows along time](#limitline) |
|
|
8116
|
-
| `severity` | `Severity`<br>`"warning" \| "alarm"` | `"alarm"` | Two severities, not five: five urgencies are five colours, and five colours on a dense screen are noise.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and
|
|
8117
|
-
| `label` | `string` | — | What the value means. A line at 90 does not say what 90 is.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and
|
|
8313
|
+
| `severity` | `Severity`<br>`"warning" \| "alarm"` | `"alarm"` | Two severities, not five: five urgencies are five colours, and five colours on a dense screen are noise.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and 11 more |
|
|
8314
|
+
| `label` | `string` | — | What the value means. A line at 90 does not say what 90 is.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and 12 more |
|
|
8118
8315
|
| `color` | `string` | — | Any CSS colour value, in place of the one the severity yields. A colour handed in instead of a severity puts the rule in the application and the presentation in the library, and the two drift apart as soon as a bound moves - so this is for the case that has no severity, not for taste. The line or band takes it; its label keeps the axis's text colour, which stays legible in both themes, and a short stroke before the text in the line's pattern takes this colour.<br>Shown in: [Mark moments and windows along time](#limitline) |
|
|
8119
8316
|
| `inExtent` | `boolean` | `true` | Whether the value widens the axis extent, so that the limit is certainly visible.<br>Shown in: [Sort causes and collect the tail (Pareto)](#pareto), [Watch latency against its objective (Scenarios)](#watch-latency-against-its-objective), [Hold the tile length in control (Scenarios)](#hold-the-tile-length-in-control) |
|
|
8120
8317
|
|
|
@@ -8132,8 +8329,8 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
8132
8329
|
| `to` *required* | `number \| Date` | — | Upper edge, in domain units of its axis. A band drawn backwards (`from` above `to`) is drawn between the two all the same - the pair is a range, not a direction.<br>Shown in: [Lay a band under the series](#limitline), [Read limits above the states](#limitline), [Watch a kiln zone against its tolerance](#limitline) and 5 more |
|
|
8133
8330
|
| `axisId` | `string` | the first axis of the orientation | Axis on which the value lies.<br>Shown in: [Sort causes and collect the tail (Pareto)](#pareto) |
|
|
8134
8331
|
| `orientation` | `"x" \| "y"` | `"y"` | Whether the value lies on the x or on the y axis - a limit is nearly always a value and not a moment.<br>Shown in: [Mark moments and windows along time](#limitline) |
|
|
8135
|
-
| `severity` | `Severity`<br>`"warning" \| "alarm"` | `"warning"` | Two severities, not five: five urgencies are five colours, and five colours on a dense screen are noise.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and
|
|
8136
|
-
| `label` | `string` | — | What the value means. A line at 90 does not say what 90 is.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and
|
|
8332
|
+
| `severity` | `Severity`<br>`"warning" \| "alarm"` | `"warning"` | Two severities, not five: five urgencies are five colours, and five colours on a dense screen are noise.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and 11 more |
|
|
8333
|
+
| `label` | `string` | — | What the value means. A line at 90 does not say what 90 is.<br>Shown in: [Draw a limit](#limitline), [Lay a band under the series](#limitline), [Read limits above the states](#limitline) and 12 more |
|
|
8137
8334
|
| `color` | `string` | — | Any CSS colour value, in place of the one the severity yields. A colour handed in instead of a severity puts the rule in the application and the presentation in the library, and the two drift apart as soon as a bound moves - so this is for the case that has no severity, not for taste. The line or band takes it; its label keeps the axis's text colour, which stays legible in both themes, and a short stroke before the text in the line's pattern takes this colour.<br>Shown in: [Mark moments and windows along time](#limitline) |
|
|
8138
8335
|
| `inExtent` | `boolean` | `true` | Whether the value widens the axis extent, so that the limit is certainly visible.<br>Shown in: [Sort causes and collect the tail (Pareto)](#pareto), [Watch latency against its objective (Scenarios)](#watch-latency-against-its-objective), [Hold the tile length in control (Scenarios)](#hold-the-tile-length-in-control) |
|
|
8139
8336
|
|
|
@@ -8848,8 +9045,8 @@ type NumberField<T> = NoInfer<
|
|
|
8848
9045
|
A **value** computed from the row - the function form of `Value`.
|
|
8849
9046
|
Compared by its source text, not its identity - an inline function is new
|
|
8850
9047
|
on every render. Known limit: one that reads a
|
|
8851
|
-
changed closure variable under the same text is not run again
|
|
8852
|
-
|
|
9048
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
9049
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
8853
9050
|
|
|
8854
9051
|
```ts
|
|
8855
9052
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|
|
@@ -9823,15 +10020,15 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
9823
10020
|
|
|
9824
10021
|
| Prop | Type | Default | Description |
|
|
9825
10022
|
|---|---|---|---|
|
|
9826
|
-
| `mode` | `"x" \| "nearest"` | `"x"` | "x": every series at the x position; "nearest": only the nearest point.<br>Shown in: [Report every series or the nearest](#tooltip), [Write the tooltip yourself](#tooltip), [Write each value in its unit](#tooltip) and
|
|
10023
|
+
| `mode` | `"x" \| "nearest"` | `"x"` | "x": every series at the x position; "nearest": only the nearest point.<br>Shown in: [Report every series or the nearest](#tooltip), [Write the tooltip yourself](#tooltip), [Write each value in its unit](#tooltip) and 64 more |
|
|
9827
10024
|
| `limits` | `boolean` | `false` | Adds a row for every labelled `LimitLine` and `LimitBand` on the hit's y axis - its label and value in that axis' format - to the built-in tooltip, and the same to what a key reads out. Limits are not series and stay out of the tooltip unless asked for.<br>Shown in: [Read the limits at the hit](#tooltip) |
|
|
9828
10025
|
| `render` | `(hit: ``TooltipHit``<T>) => ReactNode` | the built-in tooltip | Render prop for content of one's own. Compared by its source text, like `tickFormat` - with the same closure limit.<br>Shown in: [Write the tooltip yourself](#tooltip), [Fix the domain and name the ticks (Axis)](#axis) |
|
|
9829
10026
|
|
|
9830
|
-
##### `ChartOptions<Z = unknown>`
|
|
10027
|
+
##### `ChartOptions<Z = unknown, V extends number | string = number>`
|
|
9831
10028
|
|
|
9832
10029
|
| Prop | Type | Default | Description |
|
|
9833
10030
|
|---|---|---|---|
|
|
9834
|
-
| `initialView` | [`ChartView`](#view) | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The chart remembers none: where a view is kept is the application's decision.<br>Shown in: [Fit the y axis to what is visible (Zoom and pan)](#zoom-and-pan), [Hide a series from the legend (Legend)](#legend) |
|
|
10031
|
+
| `initialView` | [`ChartView`](#view) | — | The view to start from, read once when the hook first runs; a different value on a later render is ignored, as React ignores a changed `defaultValue`. To go to a view later, call `setView`. The chart remembers none: where a view is kept is the application's decision.<br>Shown in: [Fit the y axis to what is visible (Zoom and pan)](#zoom-and-pan), [Mark a range (Zoom and pan)](#zoom-and-pan), [Hide a series from the legend (Legend)](#legend) |
|
|
9835
10032
|
|
|
9836
10033
|
###### Events
|
|
9837
10034
|
|
|
@@ -9839,6 +10036,7 @@ The keys of [Chart](#chart-1) apply here.
|
|
|
9839
10036
|
|---|---|---|---|
|
|
9840
10037
|
| `onViewChange` | `(view: `[`ChartView`](#view)`) => void` | — | Every change the reader makes, once, always the whole view - the one to keep, or to hand another chart's `setView`. A pan or zoom is reported at most once per frame. Not called for the view the chart starts with, nor for one `setView` applies.<br>Shown in: [Keep charts in step (Zoom and pan)](#zoom-and-pan), [Read it by keyboard and screen reader (Chart)](#chart-1) |
|
|
9841
10038
|
| `onSelect` | `(hit: ``TooltipHit``<Z>) => void` | — | The reader chose a point: a click on a hit (a tap too), or Enter on the Active point - the same hit the tooltip's `render` receives. Once per click; the end of a drag does not report, and the second click of a double click does not either. The chart holds no selection and draws none: what is chosen is the application's state. Needs a `<Tooltip>`, which makes the hits; the hit does not travel over `syncId`.<br>Shown in: [Choose a hit](#tooltip), [Drill down from a year to its days](#tooltip) |
|
|
10039
|
+
| `onRange` | `(range: ``ChartRange``<V>) => void` | — | The reader marked a stretch of an x axis: Alt with a drag where the chart zooms, a plain drag where it does not. Called once, on release - once per x axis -, with `from` not after `to`, in the axis' own values: numbers, milliseconds on a time axis, wall-clock instants on a calendar axis, and on a category axis the first and last category covered, as strings - say so in the handler's parameter, `ChartRange<string>`. A band covers the stretch while the pointer is down; the chart keeps no range and draws none afterwards, and it does not travel over `syncId`. A press that travels 4 px or less is a click and reaches `onSelect`; Escape and a cancelled pointer report nothing.<br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
9842
10040
|
|
|
9843
10041
|
##### Types on this page
|
|
9844
10042
|
|
|
@@ -9854,6 +10052,19 @@ A custom tooltip's `render` receives it.
|
|
|
9854
10052
|
| `xPx` *required* | `number` | — | Pixel position of the crosshair (snapped to the data point). |
|
|
9855
10053
|
| `yPx` *required* | `number` | — | Pixel position of the primary hit. |
|
|
9856
10054
|
|
|
10055
|
+
###### `ChartRange<V extends number | string = number>`
|
|
10056
|
+
|
|
10057
|
+
A stretch of an x axis the reader marked (`onRange`): `from` is not after
|
|
10058
|
+
`to`, both in the axis' own values - numbers on a numeric or time axis
|
|
10059
|
+
(milliseconds). A caller that reads numbers takes the default and needs no
|
|
10060
|
+
cast; `V` is what a category axis widens it to.
|
|
10061
|
+
|
|
10062
|
+
| Prop | Type | Default | Description |
|
|
10063
|
+
|---|---|---|---|
|
|
10064
|
+
| `axisId` *required* | `string` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan) |
|
|
10065
|
+
| `from` *required* | `V` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
10066
|
+
| `to` *required* | `V` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
10067
|
+
|
|
9857
10068
|
###### `TooltipPoint<T = unknown>`
|
|
9858
10069
|
|
|
9859
10070
|
One hit per series in the tooltip.
|
|
@@ -10722,7 +10933,7 @@ identity over the renders -, the `view`, its `domains` and `hidden`, and
|
|
|
10722
10933
|
the setters that change them.
|
|
10723
10934
|
|
|
10724
10935
|
```ts
|
|
10725
|
-
function useChart<Z>(rows: readonly Z[], options?: ChartOptions<Z>): ChartParts<Z>;
|
|
10936
|
+
function useChart<Z, V extends number | string = number>(rows: readonly Z[], options?: ChartOptions<Z, V>): ChartParts<Z>;
|
|
10726
10937
|
```
|
|
10727
10938
|
|
|
10728
10939
|
Used on [Scenarios](#scenarios), [Installation](#installation), [Chart](#chart-1), [Axis](#axis), [Zoom and pan](#zoom-and-pan), [View](#view), [Line](#line), [Area](#area), [Bar](#bar), [Scatter](#scatter), [BoxPlot](#boxplot), [StateBand](#stateband), [Matrix](#matrix), [LimitLine](#limitline), [ControlChart](#controlchart), [Pareto](#pareto), [Tooltip](#tooltip), [Legend](#legend) and [Benchmark](#benchmark).
|
|
@@ -11328,12 +11539,12 @@ is typed by that `data` instead.
|
|
|
11328
11539
|
|
|
11329
11540
|
| Prop | Type | Default | Description |
|
|
11330
11541
|
|---|---|---|---|
|
|
11331
|
-
| `Chart` *required* | `(props: `[`ChartProps`](#chart-1)`) => ReactNode` | — | The chart over the hook's rows. One per `useChart`: it holds the view, and a second chart is a second call.<br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and
|
|
11332
|
-
| `XAxis` *required* | `<T = Z>(props: `[`XAxisProps`](#axis)`<T>) => null` | — | An x axis reads the rows of every series bound to it: the hook's, or with `<XAxis<Row>>` those the series bring as their own `data`.<br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and
|
|
11333
|
-
| `YAxis` *required* | `(props: `[`YAxisProps`](#axis)`) => null` | — | <br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and
|
|
11334
|
-
| `Line` *required* | `<T = Z>(props: `[`LineProps`](#line)`<T>) => null` | — | <br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and
|
|
11542
|
+
| `Chart` *required* | `(props: `[`ChartProps`](#chart-1)`) => ReactNode` | — | The chart over the hook's rows. One per `useChart`: it holds the view, and a second chart is a second call.<br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and 78 more |
|
|
11543
|
+
| `XAxis` *required* | `<T = Z>(props: `[`XAxisProps`](#axis)`<T>) => null` | — | An x axis reads the rows of every series bound to it: the hook's, or with `<XAxis<Row>>` those the series bring as their own `data`.<br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and 78 more |
|
|
11544
|
+
| `YAxis` *required* | `(props: `[`YAxisProps`](#axis)`) => null` | — | <br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and 78 more |
|
|
11545
|
+
| `Line` *required* | `<T = Z>(props: `[`LineProps`](#line)`<T>) => null` | — | <br>Shown in: [Draw a first chart (Installation)](#installation), [Size a chart by its container (Installation)](#installation), [Mix series kinds (Chart)](#chart-1) and 49 more |
|
|
11335
11546
|
| `Area` *required* | `<T = Z>(props: `[`AreaProps`](#area)`<T>) => null` | — | <br>Shown in: [Mix series kinds (Chart)](#chart-1), [Mark every kind (Chart)](#chart-1), [Bind every kind of series to a second axis (Axis)](#axis) and 5 more |
|
|
11336
|
-
| `Bar` *required* | `<T = Z>(props: `[`BarProps`](#bar)`<T>) => null` | — | <br>Shown in: [Mix series kinds (Chart)](#chart-1), [Mark every kind (Chart)](#chart-1), [Bind every kind of series to a second axis (Axis)](#axis) and
|
|
11547
|
+
| `Bar` *required* | `<T = Z>(props: `[`BarProps`](#bar)`<T>) => null` | — | <br>Shown in: [Mix series kinds (Chart)](#chart-1), [Mark every kind (Chart)](#chart-1), [Bind every kind of series to a second axis (Axis)](#axis) and 15 more |
|
|
11337
11548
|
| `Scatter` *required* | `<T = Z>(props: `[`ScatterProps`](#scatter)`<T>) => null` | — | <br>Shown in: [Mix series kinds (Chart)](#chart-1), [Mark every kind (Chart)](#chart-1), [Bind every kind of series to a second axis (Axis)](#axis) and 3 more |
|
|
11338
11549
|
| `StateBand` *required* | `<T = Z>(props: `[`StateBandProps`](#stateband)`<T> & ``OneLane``) => null` | — | <br>Shown in: [Mark bands, limits and cells (Chart)](#chart-1), [One vehicle through the day (StateBand)](#stateband), [Lay a state under a course (StateBand)](#stateband) and 4 more |
|
|
11339
11550
|
| `Matrix` *required* | `<T = Z>(props: `[`MatrixProps`](#matrix)`<T>) => null` | — | <br>Shown in: [Mark bands, limits and cells (Chart)](#chart-1), [Colour cells by their limits (Matrix)](#matrix), [Colour cells along a gradient (Matrix)](#matrix) and 1 more |
|
|
@@ -11346,6 +11557,7 @@ is typed by that `data` instead.
|
|
|
11346
11557
|
| `toggleSeries` *required* | `(name: string) => void` | — | Hides the series `name`, or shows it where it is hidden - as a click on its legend entry does. Hiding the last series visible shows all. |
|
|
11347
11558
|
| `showOnly` *required* | `(name: string) => void` | — | Hides every series but `name`; all are shown where none carries it.<br>Shown in: [Hide a series from the legend (Legend)](#legend) |
|
|
11348
11559
|
| `showAllSeries` *required* | `() => void` | — | Shows every series again.<br>Shown in: [Hide a series from the legend (Legend)](#legend) |
|
|
11560
|
+
| `toPng` *required* | `() => Promise<Blob>` | — | A PNG of the chart as it stands: the plot with its grid, series and limits, the axes with ticks, labels and titles, and the legend, on the chart's own ground in the colour scheme in use, at the chart's size on screen and at least twice its CSS pixels. Not in it: the tooltip, the crosshair and hover marks, the "Show all" button, the data key and its table, the screen-reader texts, and any title. Where the picture goes - a download, the clipboard, an upload - is the application's. Rejects with an `Error` when the chart is not on screen or has no size.<br>Shown in: [Hand over a picture (Chart)](#chart-1) |
|
|
11349
11561
|
|
|
11350
11562
|
Used on [Chart](#chart-1).
|
|
11351
11563
|
|
|
@@ -11365,6 +11577,21 @@ Used on [Benchmark](#benchmark).
|
|
|
11365
11577
|
|
|
11366
11578
|
Its table stands on [Chart](#chart-1).
|
|
11367
11579
|
|
|
11580
|
+
##### `ChartRange<V extends number | string = number>`
|
|
11581
|
+
|
|
11582
|
+
A stretch of an x axis the reader marked (`onRange`): `from` is not after
|
|
11583
|
+
`to`, both in the axis' own values - numbers on a numeric or time axis
|
|
11584
|
+
(milliseconds). A caller that reads numbers takes the default and needs no
|
|
11585
|
+
cast; `V` is what a category axis widens it to.
|
|
11586
|
+
|
|
11587
|
+
| Prop | Type | Default | Description |
|
|
11588
|
+
|---|---|---|---|
|
|
11589
|
+
| `axisId` *required* | `string` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan) |
|
|
11590
|
+
| `from` *required* | `V` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
11591
|
+
| `to` *required* | `V` | — | <br>Shown in: [Mark a range (Zoom and pan)](#zoom-and-pan), [Mark a range of bars (Bar)](#bar) |
|
|
11592
|
+
|
|
11593
|
+
Used on [Zoom and pan](#zoom-and-pan) and [Bar](#bar).
|
|
11594
|
+
|
|
11368
11595
|
##### `ChartsWording`
|
|
11369
11596
|
|
|
11370
11597
|
Everything the charts put out as text.
|
|
@@ -11383,6 +11610,9 @@ Everything the charts put out as text.
|
|
|
11383
11610
|
| `percent` *required* | `(value: string) => string` | — | A share in a normalised stack, its number already formatted. |
|
|
11384
11611
|
| `walkHelp` *required* | `string` | — | The keys that walk the chart. |
|
|
11385
11612
|
| `selectHelp` *required* | `string` | — | The key that reports the Active point - only where `onSelect` is given. |
|
|
11613
|
+
| `rangeStarted` *required* | `(from: string) => string` | — | Said when the keyboard sets the start of a range; the x value is written in the axis' format. |
|
|
11614
|
+
| `rangeMade` *required* | `(from: string, to: string) => string` | — | Said when the keyboard sets the end of a range. |
|
|
11615
|
+
| `rangeHelp` *required* | `string` | — | The key that marks a range - only where `onRange` is given and a tooltip stands. |
|
|
11386
11616
|
| `zoomHelp` *required* | `string` | — | The keys that zoom and pan it - only where the chart can be zoomed. |
|
|
11387
11617
|
| `legendHelp` *required* | `string` | — | The keys of the legend's entries - only where it has one to press. |
|
|
11388
11618
|
| `allShown` *required* | `string` | — | Read out where hiding would leave nothing to see, and every series is shown instead. |
|
|
@@ -12048,8 +12278,8 @@ Used on [Tooltip](#tooltip).
|
|
|
12048
12278
|
A **value** computed from the row - the function form of `Value`.
|
|
12049
12279
|
Compared by its source text, not its identity - an inline function is new
|
|
12050
12280
|
on every render. Known limit: one that reads a
|
|
12051
|
-
changed closure variable under the same text is not run again
|
|
12052
|
-
|
|
12281
|
+
changed closure variable under the same text is not run again, and DEV warns;
|
|
12282
|
+
carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity.
|
|
12053
12283
|
|
|
12054
12284
|
```ts
|
|
12055
12285
|
type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
|