@umriss-ui/charts 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1215,8 +1215,10 @@ export declare function workingTimeTicks(input: CalendarInput, from: number, to:
1215
1215
  export declare function XAxis<T>(props: XAxisProps<T>): null;
1216
1216
 
1217
1217
  export declare interface XAxisProps<T> extends CommonProps_2<T> {
1218
- /** `"nice"` widens the data's extent to ticks, `"data"` keeps it, a pair is
1219
- fixed - the one a zoom passes back. */
1218
+ /** `"nice"` widens the data's extent to ticks - to named `ticks` where
1219
+ there are any, on a time axis to whole units of a step of hours or
1220
+ longer -, `"data"` keeps it, a pair is fixed - the one a zoom passes
1221
+ back. */
1220
1222
  domain?: "nice" | "data" | readonly [number, number];
1221
1223
  /** Which edge the axis stands at. A second x axis on the opposite edge is how
1222
1224
  a series counts in a unit of its own. */
package/docs/llms-full.md CHANGED
@@ -1,6 +1,6 @@
1
- # @umriss-ui/charts 0.8.0
1
+ # @umriss-ui/charts 0.8.2
2
2
 
3
- > Canvas charts for data-dense applications - few chart kinds, drawn well, fast.
3
+ > React canvas chart library for data-dense dashboards - line, area, bar, scatter, control and Pareto charts. Few chart kinds, drawn well, fast.
4
4
 
5
5
  Install with `pnpm add @umriss-ui/charts`. This text is generated from the package's demo (https://romanhaendler.github.io/umriss-ui/charts/): every page with its import line, its examples - the source exactly as it runs, with the package name where the demo imports its own source - its props tables generated from the code, and what it deliberately does not do. The pages index stands in https://romanhaendler.github.io/umriss-ui/charts/llms.txt.
6
6
 
@@ -523,7 +523,7 @@ What to know before the first chart.
523
523
 
524
524
  Install the package, draw a first chart and size it in its container. Read this once before the component pages; everything after it assumes it.
525
525
 
526
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/getting-started
526
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/getting-started/
527
527
 
528
528
  Install with `pnpm add @umriss-ui/charts`; React 18 or 19 is the only peer, 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.
529
529
 
@@ -633,7 +633,7 @@ Holds the rows and draws the series on shared axes, one chart for every kind a s
633
633
  import { Chart } from "@umriss-ui/charts";
634
634
  ```
635
635
 
636
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/chart
636
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/chart/
637
637
 
638
638
  Series and axes are children, and their order in the JSX is the drawing order and the colour order. The marks are drawn on canvas; axes, legend and tooltip are elements a screen reader and a test can read (ADR-0001).
639
639
 
@@ -877,14 +877,11 @@ import { SERVICES, SUCCESS_BY_HOUR, type SuccessCell } from "./operations";
877
877
  const BATTERY = batteryDay("v2");
878
878
  const STATES = vehicleDay("v2");
879
879
 
880
- const timeOfDay = (v: number) =>
881
- new Date(v).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
882
-
883
880
  export default function BandsLimitsAndCells() {
884
881
  return (
885
882
  <div className="side-by-side">
886
883
  <Chart data={BATTERY} height={280} ariaLabel="An e-van's battery against its reserve, above its states" encoding="marks">
887
- <XAxis accessor={(d: BatteryPoint) => d.t} tickFormat={timeOfDay} label="Time" tickCount={4} />
884
+ <XAxis accessor={(d: BatteryPoint) => d.t} time label="Time" tickCount={4} />
888
885
  <YAxis accessor={(d: BatteryPoint) => d.charge ?? 0} domain={[-40, 100]} ticks={[0, 20, 40, 60, 80, 100]} label="%" />
889
886
  <YAxis id="lane" position="right" accessor={() => 0} domain={[0, 5]} ticks={[0.45]} tickFormat={() => "FP 377 K"} />
890
887
  <LimitBand from={10} to={20} severity="warning" label="Reserve" />
@@ -975,7 +972,7 @@ What a value is measured against: extent, ticks and labels, several axes per sid
975
972
  import { XAxis, YAxis, workingCalendar } from "@umriss-ui/charts";
976
973
  ```
977
974
 
978
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/axis
975
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/axis/
979
976
 
980
977
  Every scale is linear. Categories are numbers 0, 1, 2 … with a `tickFormat` that names them (ADR-0002); a working calendar maps time before it is drawn and marks every seam it took out (ADR-0001).
981
978
 
@@ -1216,7 +1213,7 @@ It imports `operations.ts` from beside itself; the file stands once, under "File
1216
1213
 
1217
1214
  | Prop | Type | Default | Description |
1218
1215
  |---|---|---|---|
1219
- | `domain` | `"nice" \| "data" \| readonly [number, number]` | — | `"nice"` widens the data's extent to ticks, `"data"` keeps it, a pair is fixed - the one a zoom passes back. |
1216
+ | `domain` | `"nice" \| "data" \| readonly [number, number]` | — | `"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 - the one a zoom passes back. |
1220
1217
  | `position` | `"bottom" \| "top"` | — | 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. |
1221
1218
  | `time` | `boolean` | — | The values are instants (milliseconds since the epoch): 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. `calendar` implies it. |
1222
1219
  | `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). |
@@ -1262,7 +1259,7 @@ Joins the readings of a series into a course (a line chart, a trend). Reach for
1262
1259
  import { Line } from "@umriss-ui/charts";
1263
1260
  ```
1264
1261
 
1265
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/line
1262
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/line/
1266
1263
 
1267
1264
  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.
1268
1265
 
@@ -1422,7 +1419,7 @@ A filled course (an area chart): down to zero for a quantity, between two edges
1422
1419
  import { Area } from "@umriss-ui/charts";
1423
1420
  ```
1424
1421
 
1425
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/area
1422
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/area/
1426
1423
 
1427
1424
  Without `baseline` the foot is 0 and stays in the y extent. A range's lower edge is the `baseline` accessor of the same series, not a second series - where either edge is missing, the fill has a hole.
1428
1425
 
@@ -1545,7 +1542,7 @@ Bars on the numeric x axis (a bar or column chart): one per category, grouped si
1545
1542
  import { Bar } from "@umriss-ui/charts";
1546
1543
  ```
1547
1544
 
1548
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/bar
1545
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/bar/
1549
1546
 
1550
1547
  A category is a position the axis places and a `tickFormat` names (ADR-0002). A bar's foot is 0, so one series carries both signs.
1551
1548
 
@@ -1728,7 +1725,7 @@ Single readings as points, joined by nothing (a scatter plot, dots). Reach for i
1728
1725
  import { Scatter } from "@umriss-ui/charts";
1729
1726
  ```
1730
1727
 
1731
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/scatter
1728
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/scatter/
1732
1729
 
1733
1730
  #### Examples
1734
1731
 
@@ -1817,7 +1814,7 @@ What something was doing over time, as a band of coloured segments (a status tim
1817
1814
  import { StateBand } from "@umriss-ui/charts";
1818
1815
  ```
1819
1816
 
1820
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/stateband
1817
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/stateband/
1821
1818
 
1822
1819
  The accessor returns a state's place in `states`, which fixes the order, the name and the colour in one place (ADR-0007). Each segment runs to the next reading; a `null` leaves a hole, never a colour for unknown.
1823
1820
 
@@ -1835,13 +1832,10 @@ import { VEHICLE_STATES, vehicleDay, type StatePoint } from "./logistics";
1835
1832
 
1836
1833
  const DAY = vehicleDay("v1");
1837
1834
 
1838
- const timeOfDay = (v: number) =>
1839
- new Date(v).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1840
-
1841
1835
  export default function OneVehicle() {
1842
1836
  return (
1843
1837
  <Chart data={DAY} height={150} ariaLabel="States of van FP 214 K through the day">
1844
- <XAxis accessor={(d: StatePoint) => d.t} tickFormat={timeOfDay} label="Time" />
1838
+ <XAxis accessor={(d: StatePoint) => d.t} time label="Time" />
1845
1839
  {/* Without a lane the band fills its y axis; one tick names it. */}
1846
1840
  <YAxis accessor={() => 0} domain={[0, 1]} ticks={[0.5]} tickFormat={() => "FP 214 K"} grid={false} />
1847
1841
  <StateBand accessor={(d: StatePoint) => d.state} states={VEHICLE_STATES} name="FP 214 K" />
@@ -1865,13 +1859,10 @@ import { VEHICLE_STATES, batteryDay, vehicleDay, type BatteryPoint, type StatePo
1865
1859
  const BATTERY = batteryDay("v2");
1866
1860
  const STATES = vehicleDay("v2");
1867
1861
 
1868
- const timeOfDay = (v: number) =>
1869
- new Date(v).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1870
-
1871
1862
  export default function UnderACourse() {
1872
1863
  return (
1873
1864
  <Chart data={BATTERY} height={320} ariaLabel="An e-van's charge above what it was doing">
1874
- <XAxis accessor={(d: BatteryPoint) => d.t} tickFormat={timeOfDay} label="Time" />
1865
+ <XAxis accessor={(d: BatteryPoint) => d.t} time label="Time" />
1875
1866
  <YAxis accessor={(d: BatteryPoint) => d.charge ?? 0} domain={[-40, 100]} ticks={[0, 25, 50, 75, 100]} label="Charge %" />
1876
1867
  {/* The lane: the bottom unit of five, the rest is room for the course. */}
1877
1868
  <YAxis id="lane" position="right" accessor={() => 0} domain={[0, 5]} ticks={[0.4]} tickFormat={() => "State"} />
@@ -1896,13 +1887,10 @@ import { VEHICLES, VEHICLE_STATES, vehicleDay, type StatePoint } from "./logisti
1896
1887
 
1897
1888
  const FLEET = VEHICLES.map((vehicle) => ({ vehicle, day: vehicleDay(vehicle.id) }));
1898
1889
 
1899
- const timeOfDay = (v: number) =>
1900
- new Date(v).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
1901
-
1902
1890
  export default function OneLaneEach() {
1903
1891
  return (
1904
1892
  <Chart data={FLEET[0]!.day} height={300} ariaLabel="The states of all eight vehicles through the day">
1905
- <XAxis accessor={(d: StatePoint) => d.t} tickFormat={timeOfDay} label="Time" />
1893
+ <XAxis accessor={(d: StatePoint) => d.t} time label="Time" />
1906
1894
  {/* Lane 0 lies at the bottom, so the first vehicle takes the top lane. */}
1907
1895
  <YAxis
1908
1896
  accessor={() => 0}
@@ -1959,7 +1947,7 @@ One value per cell across two axes (a heatmap), coloured by its limits or along
1959
1947
  import { Matrix, DEFAULT_GRADIENT } from "@umriss-ui/charts";
1960
1948
  ```
1961
1949
 
1962
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/matrix
1950
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/matrix/
1963
1951
 
1964
1952
  A cell without a value stays a hole, not a zero. The tooltip carries the value as text, since colour alone carries no number.
1965
1953
 
@@ -2050,7 +2038,7 @@ The limits a course is read against (a threshold, a reference line): a line abov
2050
2038
  import { LimitLine, LimitBand } from "@umriss-ui/charts";
2051
2039
  ```
2052
2040
 
2053
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/limitline
2041
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/limitline/
2054
2042
 
2055
2043
  A limit's tone follows its `severity`, never a colour of its own. The model is the one `@umriss-ui/core` uses for its verdicts, so a chart and a tile agree (ADR-0006).
2056
2044
 
@@ -2119,9 +2107,6 @@ import { VEHICLES, VEHICLE_STATES, batteryDay, vehicleDay, type BatteryPoint, ty
2119
2107
  const NORTH = VEHICLES.filter((vehicle) => vehicle.depot === "north");
2120
2108
  const BATTERY = batteryDay("v2");
2121
2109
 
2122
- const timeOfDay = (v: number) =>
2123
- new Date(v).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
2124
-
2125
2110
  /* The lanes: one domain unit per vehicle, the rest is room for the course.
2126
2111
  Lane 0 lies at the bottom, so the list runs from the bottom up. */
2127
2112
  const LANES = [...NORTH].reverse().map((vehicle) => ({ vehicle, day: vehicleDay(vehicle.id) }));
@@ -2129,7 +2114,7 @@ const LANES = [...NORTH].reverse().map((vehicle) => ({ vehicle, day: vehicleDay(
2129
2114
  export default function LimitsAndState() {
2130
2115
  return (
2131
2116
  <Chart data={BATTERY} height={340} ariaLabel="An e-van's charge against its limits, above the states of the North depot's vehicles">
2132
- <XAxis accessor={(d: BatteryPoint) => d.t} tickFormat={timeOfDay} label="Time" />
2117
+ <XAxis accessor={(d: BatteryPoint) => d.t} time label="Time" />
2133
2118
  <YAxis accessor={(d: BatteryPoint) => d.charge ?? 0} domain={[-100, 100]} ticks={[0, 20, 40, 60, 80, 100]} label="Charge %" />
2134
2119
  <YAxis
2135
2120
  id="lanes"
@@ -2234,7 +2219,7 @@ Centre line, control limits and the rule violations of a process (an SPC or Shew
2234
2219
  import { ControlChart, controlLimits, violations } from "@umriss-ui/charts";
2235
2220
  ```
2236
2221
 
2237
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/controlchart
2222
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/controlchart/
2238
2223
 
2239
2224
  Control limits are computed from a named reference window, never from what happens to be visible; specification limits are chosen and drawn with `LimitLine` (ADR-0008).
2240
2225
 
@@ -2372,7 +2357,7 @@ Causes sorted by weight with a cumulative line (a Pareto chart). Reach for it af
2372
2357
  import { pareto } from "@umriss-ui/charts";
2373
2358
  ```
2374
2359
 
2375
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/pareto
2360
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/pareto/
2376
2361
 
2377
2362
  `pareto()` sorts, adds up and folds the tail into one entry that stands last whatever its size; the bars, the line and the second axis are yours to compose.
2378
2363
 
@@ -2437,7 +2422,7 @@ What a hover reports and what the colours mean (a hover card, a key), and the va
2437
2422
  import { Tooltip, Legend, DataTable } from "@umriss-ui/charts";
2438
2423
  ```
2439
2424
 
2440
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/tooltip
2425
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/tooltip/
2441
2426
 
2442
2427
  The crosshair snaps to a reading, never between two. A legend without `onToggle` only explains; with it, it switches series on and off, and the state stays yours.
2443
2428
 
@@ -2547,7 +2532,7 @@ const month = (row: LedgerRow) => Number(row.month.slice(5)) - 1;
2547
2532
  function Marketing({ placement }: { placement?: "bottom" }) {
2548
2533
  return (
2549
2534
  <Chart data={MARKETING} height={220} ariaLabel={`Marketing's budget and forecast, legend ${placement ?? "above"}`}>
2550
- <XAxis accessor={month} tickFormat={(v) => MONTH_NAMES[v] ?? ""} tickCount={4} />
2535
+ <XAxis accessor={month} ticks={MONTH_NAMES.map((_, i) => i)} tickFormat={(v) => MONTH_NAMES[v] ?? ""} />
2551
2536
  <YAxis accessor={(d: LedgerRow) => d.forecast} label="€" />
2552
2537
  <Line accessor={(d: LedgerRow) => d.budget} name="Budget" />
2553
2538
  <Line accessor={(d: LedgerRow) => d.forecast} name="Forecast" />
@@ -2731,7 +2716,7 @@ Millions of points, measured in this browser rather than claimed: the time to pr
2731
2716
  import { Chart } from "@umriss-ui/charts";
2732
2717
  ```
2733
2718
 
2734
- Demo page: https://romanhaendler.github.io/umriss-ui/charts/#/benchmark
2719
+ Demo page: https://romanhaendler.github.io/umriss-ui/charts/benchmark/
2735
2720
 
2736
2721
  A hover redraws only the overlay layer, so the frame rate stays up over a million points. The figures in `packages/charts/docs/capabilities.md` come from here.
2737
2722
 
@@ -4495,7 +4480,7 @@ export interface AlertType {
4495
4480
 
4496
4481
  export const ALERT_TYPES: readonly AlertType[] = [
4497
4482
  { id: "checkout-latency", label: "Checkout · p95 latency above 300 ms", priority: "high" },
4498
- { id: "checkout-errors", label: "Checkout · error rate above 2 %", priority: "high" },
4483
+ { id: "checkout-errors", label: "Checkout · error rate above 2\u00a0%", priority: "high" },
4499
4484
  { id: "webhooks-queue", label: "Webhooks · queue older than 5 min", priority: "medium" },
4500
4485
  { id: "search-latency", label: "Search · p95 latency above 250 ms", priority: "medium" },
4501
4486
  { id: "images-disk", label: "Image service · disk 85 % full", priority: "low" },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@umriss-ui/charts",
3
- "version": "0.8.0",
4
- "description": "Canvas charts for data-dense applications - few chart kinds, drawn well, fast.",
3
+ "version": "0.8.2",
4
+ "description": "React canvas chart library for data-dense dashboards - line, area, bar, scatter, control and Pareto charts. Few chart kinds, drawn well, fast.",
5
5
  "license": "MIT",
6
6
  "author": "Roman Händler",
7
7
  "homepage": "https://romanhaendler.github.io/umriss-ui/charts/",
@@ -15,11 +15,18 @@
15
15
  },
16
16
  "keywords": [
17
17
  "react",
18
- "components",
19
- "ui",
20
- "umriss",
18
+ "react-charts",
21
19
  "charts",
22
- "canvas"
20
+ "chart-library",
21
+ "canvas",
22
+ "line-chart",
23
+ "bar-chart",
24
+ "scatter-plot",
25
+ "control-chart",
26
+ "pareto",
27
+ "dashboard",
28
+ "typescript",
29
+ "umriss"
23
30
  ],
24
31
  "type": "module",
25
32
  "files": [
@@ -63,7 +70,7 @@
63
70
  "vite": "^6.0.0",
64
71
  "vite-plugin-dts": "^4.3.0",
65
72
  "@umriss-ui/demo": "0.0.0",
66
- "@umriss-ui/core": "0.11.0"
73
+ "@umriss-ui/core": "0.16.0"
67
74
  },
68
75
  "scripts": {
69
76
  "props": "node --disable-warning=ExperimentalWarning --experimental-strip-types demo/props.ts",