ml-time-graph 1.24.0 → 1.26.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 +37 -0
- package/GRAPH_JSON_STRUCTURE.md +19 -0
- package/README.de.md +17 -0
- package/README.md +16 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -15
- package/dist/interaction/index.js +2 -2
- package/dist/internals.d.ts +16 -4
- package/dist/internals.js +15 -15
- package/dist/{marker_renderer-Dph9cKDY.d.ts → marker_renderer-DYSAkVgI.d.ts} +29 -1
- package/dist/{types-B9bbJxmn.d.ts → types-RAg4hLZA.d.ts} +32 -3
- package/options.schema.json +2931 -0
- package/package.json +4 -2
- package/skills/ml-time-graph/SKILL.md +3 -1
- package/skills/ml-time-graph/reference/axes.md +35 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-time-graph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "TypeScript library for time-series charts with rich contextual annotation — telemetry, sensors, metrics, logs, finance. DOM-free SVG output, identical in the browser and on the server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"./interaction": {
|
|
23
23
|
"types": "./dist/interaction/index.d.ts",
|
|
24
24
|
"import": "./dist/interaction/index.js"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"./options.schema.json": "./options.schema.json"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"dist",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"QUICKSTART_GRAPH_BUILDER.md",
|
|
37
38
|
"QUICKSTART_GRAPH_BUILDER.de.md",
|
|
38
39
|
"GRAPH_JSON_STRUCTURE.md",
|
|
40
|
+
"options.schema.json",
|
|
39
41
|
"LICENSE"
|
|
40
42
|
],
|
|
41
43
|
"keywords": [
|
|
@@ -77,6 +77,7 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
77
77
|
- `ml-time-graph`: Core chart rendering API — `mount`, `MLTimeGraph`, `SVGRenderer`, `GraphBuilder`, `attachTooltip`, input adapters (`toSeries`, `toDataPoints`), options layering (`mergeOptions`), types, and legend helpers (`resolveDash`, `getLineStyle`, `drawMarker`).
|
|
78
78
|
- `ml-time-graph/analyze`: Pure-math statistics companion — `aggregateBySlot`, `downsample` (LTTB), `detectGaps`, `rollingMkt`, `rollingStdDev`, `computeLimitExcursions`, `StatsAggregator`.
|
|
79
79
|
- `ml-time-graph/interaction`: Headless interaction primitives — `Zoom`, `Minimap`, and coordinate-based interaction state management.
|
|
80
|
+
- `ml-time-graph/options.schema.json`: JSON Schema (draft 2020-12) of the options in their JSON form. Validate generated or hand-written chart JSON against it before rendering; set `"$schema"` in a JSON file for editor completion.
|
|
80
81
|
- `ml-time-graph/internals`: Low-level building blocks for custom renderers — `DrawCommand` model, base `Renderer`, layout engine, scales, and axis renderers.
|
|
81
82
|
- `ml-time-graph-svelte` (separate package, same version): Svelte 5 components `<TimeGraph>` and `<Legend>` — container width, `autoMargin`, tooltip and keyboard, hiding, zoom, `syncTime` for dashboards, dark mode, export, print. `tooltip={false}` drops only the tooltip box. Its README is the manual.
|
|
82
83
|
|
|
@@ -84,7 +85,7 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
84
85
|
|
|
85
86
|
| Task | File |
|
|
86
87
|
| --- | --- |
|
|
87
|
-
| Several series, a second or third value axis, `axisGroups`, axis titles and `labelOffset`, margins, grid, minor ticks, time zone | [reference/axes.md](reference/axes.md) |
|
|
88
|
+
| Several series, a second or third value axis, `axisGroups`, axis titles and `labelOffset`, margins, grid, minor ticks, a logarithmic axis (`scale: 'log'`, light sensors), time zone | [reference/axes.md](reference/axes.md) |
|
|
88
89
|
| Threshold lines and zone colouring, filled areas between curve and threshold or between two series, `where`, `divergenceExcursions` | [reference/thresholds-and-fills.md](reference/thresholds-and-fills.md) |
|
|
89
90
|
| Missing data (`value: null`), gap regions and labels, `gaps.atEnd` for a device that went quiet, `holdToEnd` for a sensor that reports only on change | [reference/gaps.md](reference/gaps.md) |
|
|
90
91
|
| Arrows, labels and rectangles in data coordinates, time-range highlights, status bands (short events in long windows: `minItemWidth`), markers | [reference/annotations-and-markers.md](reference/annotations-and-markers.md) |
|
|
@@ -95,6 +96,7 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
95
96
|
|
|
96
97
|
## Traps (Read Before Coding)
|
|
97
98
|
|
|
99
|
+
- **There are no bar or column charts:** `seriesType` is `'line'`, `'area'` or `'step'` — nothing draws separate bars, groups them side by side or stacks them. For counts per interval (messages per 15 minutes, events per hour) use `seriesType: 'step'` with `style.fill`; it reads like a histogram, and several series overlay cleanly. Do not fake bars out of rectangle annotations.
|
|
98
100
|
- **Timestamps are numbers, not Date objects:** `time` is always milliseconds since Unix epoch (`number`). Passing a `Date` object fails typechecking or evaluates to `NaN`.
|
|
99
101
|
- **Margins are fixed unless you measure them:** The chart draws into `margin` (default `{ top: 20, right: 20, bottom: 40, left: 60 }`). A right Y-axis or a formatted unit (`120.5 °C`) does not fit into `right: 20`, and a clipped number is a wrong number (`120` clipped to `20`). Use `margin: 'auto'` — it measures the labels the chart actually draws (no DOM, a few ms), also in JSON for the Go port, the CLI and the PDF; `autoMargin(options)` returns the same numbers if you need them — or set the margins yourself.
|
|
100
102
|
- **Something you configured does not show up — ask `chart.warnings()`.** Drawing never throws for a threshold name with a typo, a fill bound naming an unknown series, `side` where it is ignored, two series sharing an id, or a deprecated field; it just leaves the thing out. `warnings()` (Go: `Warnings()`, same texts) lists exactly these. Thresholds are found by `id`, and by `name` only when they have no `id`.
|
|
@@ -68,6 +68,41 @@ travel in JSON, so the server cannot run yours. Same chart, two renderers, two l
|
|
|
68
68
|
the browser is the only renderer; use a generated table when both have to agree. `estimateMetrics`
|
|
69
69
|
(exported) reproduces the layout of versions before 1.10.0.
|
|
70
70
|
|
|
71
|
+
## Logarithmic value axis — `scale: 'log'`
|
|
72
|
+
For readings that span several orders of magnitude: illuminance (0.1 lx at night, 100,000 lx in
|
|
73
|
+
the sun), particle counts, vacuum pressure, concentrations. Every power of ten gets the same
|
|
74
|
+
height.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
axes: { left: { scale: 'log', min: 0.1 } }
|
|
78
|
+
axes: { left: { scale: 'log', domain: [1, 100000] } } // both edges fixed
|
|
79
|
+
axes: { left: { scale: 'log', min: 0.1, ticks: { minor: 1 }, grid: { major: {}, minor: {} } } }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **`min` is required** (or a fixed `domain` whose lower bound is above 0). A logarithmic axis
|
|
83
|
+
has no zero. Without a lower edge the axis **stays linear** and `chart.warnings()` says so —
|
|
84
|
+
the chart does not throw.
|
|
85
|
+
- **Readings below `min` — also 0 and negative ones — are drawn on the edge.** `warnings()`
|
|
86
|
+
reports how many. The edge does not move with the data, so tiles with the same `min` line up;
|
|
87
|
+
the upper edge follows the largest reading unless `domain` fixes it.
|
|
88
|
+
- **Only the picture changes.** Overlays (`movingAverage`, `stdDevBand`, `movingMkt`), aggregated
|
|
89
|
+
min/max/avg and everything in `ml-time-graph/analyze` still compute on the readings. Do not
|
|
90
|
+
take logarithms of your data first — the average of logarithms is not the logarithm of the
|
|
91
|
+
average.
|
|
92
|
+
- **Ticks:** one labelled tick per decade (0.1, 1, 10, 100, 1k, 10k); with far more decades than
|
|
93
|
+
`ticks.major` (default 6) every second or third. Under three decades: 1, 2 and 5 per decade.
|
|
94
|
+
Any `ticks.minor` above 0 (or a `grid.minor`) adds the unlabelled ticks at 2…9 of each decade —
|
|
95
|
+
the count is not used, they are never evenly spaced.
|
|
96
|
+
- **Labels are yours as on any axis:** `format: (v) => …` or `tickFormat: { unit, decimals }`.
|
|
97
|
+
The default writes `0.1`, `1`, `10`, `1k`, `1M`, and `1e-7` below a thousandth. `tickFormat`
|
|
98
|
+
applies the same `decimals` to every tick, so prefer `decimals: 0` or `format` on an axis
|
|
99
|
+
that runs from 0.1 to 100,000.
|
|
100
|
+
- Thresholds, zone colours, fills and markers work unchanged and sit on the drawn line. One
|
|
101
|
+
exception to know: `fill.where.exceeds` compares in units of the reading ("more than 50 lx
|
|
102
|
+
apart"), not in ratios.
|
|
103
|
+
- Per axis, not per chart: `axes.y[i].scale`. An axis whose series carry an `enumMap` ignores it
|
|
104
|
+
(`warnings()` reports that too). Same option in JSON for the Go port, the CLI and the PDF.
|
|
105
|
+
|
|
71
106
|
## Grid
|
|
72
107
|
`axes: { x: { grid: true } }` — a grid in both directions; one axis is enough. `grid: false` on
|
|
73
108
|
the other axis leaves that direction out; a `false` alone switches nothing on. `true` is short for
|