@umriss-ui/charts 0.8.1 → 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,4 +1,4 @@
1
- # @umriss-ui/charts 0.8.1
1
+ # @umriss-ui/charts 0.8.2
2
2
 
3
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
 
@@ -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" />
@@ -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). |
@@ -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}
@@ -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"
@@ -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" />
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/charts",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
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",
@@ -70,7 +70,7 @@
70
70
  "vite": "^6.0.0",
71
71
  "vite-plugin-dts": "^4.3.0",
72
72
  "@umriss-ui/demo": "0.0.0",
73
- "@umriss-ui/core": "0.14.1"
73
+ "@umriss-ui/core": "0.16.0"
74
74
  },
75
75
  "scripts": {
76
76
  "props": "node --disable-warning=ExperimentalWarning --experimental-strip-types demo/props.ts",