ml-time-graph 1.16.0 → 1.17.1

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 CHANGED
@@ -19,6 +19,87 @@ release notes, and every change is in `git log` in full.
19
19
 
20
20
  ---
21
21
 
22
+ ## [1.17.1] - 2026-10-07
23
+
24
+ ### Deprecated
25
+ - **`series.sensorType`** (TS and Go) — has no effect on the chart; use `enumMap` for state
26
+ series. Removed before 2.0.
27
+ - **Gap style `"label"`** in the flat form (`gaps: [{ style: "label" }]`) — use `"empty"` with
28
+ `label`. `warnings()` / `Warnings()` report it. Removed before 2.0.
29
+
30
+ ### Fixed
31
+ - **Markings outside the visible range were drawn into the margin** (TS and Go) — zoomed in,
32
+ an arrow starting before the window ran through the axis labels, and a marker or label just
33
+ after it stood half cut off in the margin. Markers, labels and points with a time outside
34
+ the time axis (or a value outside its value axis) are no longer drawn; lines, arrows and
35
+ rectangles reaching beyond the axes are clipped to the plot. In `annotations_demo` a
36
+ rectangle no longer covers a time label.
37
+ - **`autoMargin` blew up on such a marking** — it counted as needing room, the plot shrank,
38
+ the element moved further out: margins of 10⁹ px and an empty chart. It now measures only
39
+ what is drawn, and no side gets more than 40 % of width or height. Also fixes
40
+ `ml-time-graph-svelte`, which uses `autoMargin`.
41
+ - **`ml-time-graph-svelte` with `applyZoom={false}` kept a stale zoom** — after the app reset
42
+ the window itself, double-click and Esc reported `null` again and `followEnd` shifted the old
43
+ window. The held zoom now follows the app's `axes.x.domain`.
44
+ - **`ml-time-graph-svelte`: `valuePadding` added a right axis the app never configured** — it
45
+ now pads only axes that exist (with `axes.y`, only that list).
46
+ - **`ml-time-graph-svelte`: the value table dropped the unit** — tooltip and announcement used
47
+ the axis `format` ("7.2 °C"), the table wrote a bare number. All three now share one rule,
48
+ for every value (min/max, both ends of a band). `formatValue` gets the axis-formatted text
49
+ as `label` and the `axisIndex`, so it can rewrite the number and keep the unit.
50
+
51
+ ## [1.17.0] - 2026-10-07
52
+
53
+ ### Added
54
+ - **`ml-time-graph-svelte`** — new package, same version: `<TimeGraph>` (container width,
55
+ `autoMargin`, tooltip over `pointsAt` and by keyboard, hiding, zoom, `syncTime` for
56
+ dashboards, dark mode and `--mtg-*` CSS variables, light print, SVG/PNG export, loading and
57
+ empty states, value table for screen readers, SSR) and `<Legend>` (buttons, swatches in the
58
+ line's dash, width and marker). App-wide defaults (`setTimeGraphDefaults`: locale, time zone,
59
+ formats, texts, scheme), translatable `labels`, `formatValue`, `followEnd` for live data,
60
+ `printHidden`. Manual: the package README and handbook chapter 7.
61
+ - **`gaps.atEnd`** (TS and Go) — a device that went quiet gets a hatched region from its last
62
+ reading to now (`now` or the end of the time axis), when that is longer than `afterMs`.
63
+ Label with `{since}` / `{duration}` placeholders (TS also a function); per series
64
+ `gaps: { atEnd: false | { afterMs } }`.
65
+ - **`where` on a fill region** (TS and Go) — fill only where the two edges are more than
66
+ `exceeds` apart (`side`, `maxAgeMs`). Decided on the readings (straight / held), drawn
67
+ between the drawn curves; `warnings()` flags catmull-rom and akima, which can overshoot.
68
+ - **`axisGroups(items)`** (TS) — suggests which series share a value axis: same unit and
69
+ nearby ranges together, distant ranges apart. Returns `yAxisIndex` per series and `axes.y`.
70
+ - **`analyze.ComputeLimitExcursions` (Go)** — the Go counterpart of `computeLimitExcursions`:
71
+ episodes outside `[low, high]` and the time above/below, so screen and PDF report the same
72
+ duration. One shared fixture tests both.
73
+
74
+ ### Changed
75
+ - **Go rejects unknown and missing fields in options JSON** (server, CLI, `LoadOptions`, PDF) —
76
+ an error with the JSON path and the nearest correct name (`thresholds[0].lnie: unknown field
77
+ (did you mean "line"?)`), and `name`/`data` are required. TypeScript-only theme fields
78
+ (tooltip, minimap) are accepted. Before, a typo was silently ignored. Three test templates
79
+ carried such dead fields; the `thresholds_demo` label positions now actually apply.
80
+ - **Handbook** — demos appear as preview images that open the live demo instead of iframes;
81
+ new sections for the features of 1.13–1.17 and a chapter on the Svelte package.
82
+
83
+ ### Fixed
84
+ - **Several charts on one page wrote the same ids** (`series-pump` five times) — invalid HTML,
85
+ and `getElementById` found the wrong chart. New `idPrefix` option (TS and Go) prefixes every
86
+ id, and `SVGRenderer({ idPrefix })` / `SetIDPrefix` the `<defs>` ids; the Svelte component
87
+ sets one per instance.
88
+ - **Value axes around 1000 labelled several ticks "1.0k"** (a pressure axis 995–1030 hPa) —
89
+ the default format shortens to k/M only when the tick step allows it (k from a step of 100);
90
+ otherwise the number is written out: 1000, 1010, 1030.
91
+ - **The type declarations carried two different `SeriesStyle` interfaces** — go-to-definition
92
+ could land on the internal, flat one. It is now `FlatSeriesStyle` (as in Go); the public
93
+ `SeriesStyle` is unchanged.
94
+ - **Markers of a series with gaps repeated their ids** (TS) — numbered per run, so every gap
95
+ restarted at `-marker-0` and the ids differed from Go's. Now one marker group per series,
96
+ numbered across all runs, as in Go.
97
+ - **A gap/highlight label with `rotate: 'auto'` that fits neither across nor upright is left
98
+ out** (TS and Go) — in a small chart it stuck out over the axes, and `autoMargin` made room
99
+ for it until the plot area was gone.
100
+ - **Go measured range labels at the legend font size** for `rotate: 'auto'` — a 10 px gap label
101
+ near the limit turned in Go but not in TS.
102
+
22
103
  ## [1.16.0] - 2026-10-07
23
104
 
24
105
  ### Added
@@ -145,7 +145,7 @@ A series is either a `TimeSeries` (individual samples) or an `AggregatedSeries`
145
145
  | `id` | `string` | Stable identifier (used by selection/highlight logic) |
146
146
  | `name` | `string` | Display name (legend, tooltips) |
147
147
  | `data` | `DataPoint[]` | Samples, sorted by time |
148
- | `sensorType` | `string` | Optional semantic type tag |
148
+ | `sensorType` | `string` | **Deprecated** — has no effect on the chart; use `enumMap` for state series. Will be removed before 2.0. |
149
149
  | `enumMap` | `Record<string \| number, string>` | Maps raw codes to labels, e.g. `{ "1": "running", "2": "stopped" }` |
150
150
  | `style` | `SeriesStyle` | Visual appearance (section 5) |
151
151
  | `overlays` | `SeriesOverlay[]` | Derived curves such as moving averages (section 6) |
@@ -429,7 +429,7 @@ Two equivalent forms; prefer `GapsConfig`.
429
429
  | `fillOpacity` | `number` | Background opacity |
430
430
  | `labelBaseline` | `'above' \| 'middle' \| 'below'` | Vertical label alignment — **note the value set differs from `AnnotationBandItem.labelBaseline`** |
431
431
  | `rotate` | `number` | Label rotation |
432
- | `style` | `'dashed_border' \| 'empty' \| 'label'` | Rendering mode |
432
+ | `style` | `'dashed_border' \| 'empty' \| 'label'` | Rendering mode. `'label'` is **deprecated** and will be removed before 2.0 — use `'empty'` with `label`. |
433
433
 
434
434
  ### 10b. Preferred config form (`gaps: GapsConfig`)
435
435
 
@@ -541,7 +541,7 @@ Available only through `GraphBuilder.setTooltip()` — not part of `MLTimeGraphO
541
541
 
542
542
  **GapStyle.display** (4): `empty`, `dashed_border`, `filled`, `bridge_line`
543
543
 
544
- **DrawGapType_t** (3) — legacy `Gap.style`: `dashed_border`, `empty`, `label`
544
+ **DrawGapType_t** (3) — legacy `Gap.style`: `dashed_border`, `empty`, `label` (deprecated, removed before 2.0)
545
545
 
546
546
  **FillSide:** `above`, `below`
547
547
 
package/README.de.md CHANGED
@@ -158,32 +158,6 @@ Sowohl die TypeScript- als auch die Go-Bibliothek:
158
158
 
159
159
  ---
160
160
 
161
- ## 🔭 Ausblick: kleinere SVGs
162
-
163
- Ein Diagramm trägt mehr Bytes mit sich, als es müsste. Gemessen an allen 41
164
- Vergleichsdiagrammen (234 KB): **36 % der Ausgabe sind Darstellungsattribute** — `stroke` an
165
- 1282 Elementen, `stroke-width` an 1256, `fill` an 973, jedes an jedem Kind wiederholt.
166
-
167
- SVG vererbt die meisten davon. Einmal an der `<g>` statt an jedem Kind, und dieselben Bilder
168
- werden **15,9 % kleiner — 37,2 KB**.
169
-
170
- Zwei Dinge, die naheliegen und nicht stimmen:
171
-
172
- - **Es ist keine CSS-Sache.** Kein `<style>`-Block, keine Klassenregeln, kein Präfix. Ein
173
- `<style>`-Block spräche etwa dieselbe Ersparnis, brächte aber drei Probleme mit: zwei Diagramme
174
- auf einer Seite gerieten sich über dieselben Regeln in die Quere, unsere Regeln konkurrierten
175
- mit dem Stilblatt des Aufrufers (heute schlägt jede seiner Regeln ein Darstellungsattribut),
176
- und erst dadurch bräuchten ids und Klassen einen Namensraum. Reine Vererbung hat nichts davon.
177
- - **Es sind keine 23 %.** Alles hochzuziehen ergäbe das, änderte aber das Bild: 579
178
- `<text>`-Elemente stehen in Gruppen mit Linien, und ein `stroke` an der Gruppe gäbe den
179
- Achsenbeschriftungen eine Kontur — Text ist gefüllt, nicht umrandet. Ein Attribut darf nur
180
- hoch, wenn jedes Kind ohne dieses Attribut davon wirklich unberührt bleibt. Diese Regel lässt
181
- 15,9 % übrig.
182
-
183
- Es greift in die Ausgabe jedes Diagramms ein, ist also nichts für eine Patch-Fassung.
184
-
185
- ---
186
-
187
161
  ## 🐞 Fehler gefunden?
188
162
 
189
163
  Issues liegen unter
@@ -304,11 +278,13 @@ ein Bildschirm oder ein Drucker auflöst — 0,001 px sind bei 300 dpi drei Taus
304
278
  Punktes — und es ist der Grund für die kleinen Dateien: ungekürzt brauchte dasselbe Diagramm
305
279
  921 KB.
306
280
 
307
- ## Ausblick / in Überlegung
281
+ ## Früher in Überlegung
308
282
 
309
- - svelte wrapper
283
+ Offen ist gerade nichts. Drei Punkte von hier sind erledigt und stehen jetzt woanders:
310
284
 
311
- Zwei Punkte von hier sind erledigt und stehen jetzt woanders:
285
+ - **Svelte-Wrapper** → [`ml-time-graph-svelte`](https://www.npmjs.com/package/ml-time-graph-svelte),
286
+ dieselbe Fassung wie dieses Paket; Anleitung in Kapitel 7 des
287
+ [Handbuchs](https://mlcgo.eu/books/mlctimegraph/).
312
288
 
313
289
  - **Woher kommen meine Daten?** → `toSeries` / `toDataPoints`, siehe oben beim Quickstart.
314
290
  - **„Live"-Darstellung** → `setData()` auf einer bestehenden Instanz, neu zeichnen, fertig.
package/README.md CHANGED
@@ -158,31 +158,6 @@ Both the TypeScript and Go libraries:
158
158
 
159
159
  ---
160
160
 
161
- ## 🔭 Outlook: smaller SVGs
162
-
163
- A chart's SVG carries more bytes than it needs to. Measured across all 41 reference charts
164
- (234 KB): **36 % of the output is presentation attributes** — `stroke` on 1282 elements,
165
- `stroke-width` on 1256, `fill` on 973, and so on, each one repeated on every child.
166
-
167
- SVG inherits most of them. Written once on the `<g>` instead of on every child, the same
168
- pictures come out **15.9 % smaller — 37.2 KB**.
169
-
170
- Two things that sound right and are not:
171
-
172
- - **It is not a CSS feature.** No `<style>` block, no class rules, no prefix. A `<style>` block
173
- would save about as much and bring three problems with it: two charts on one page would fight
174
- over the same rules, our rules would start competing with the caller's stylesheet (today every
175
- caller rule wins over a presentation attribute), and only then would ids and classes need
176
- namespacing. Plain inheritance has none of that.
177
- - **It is not 23 %.** Lifting everything would be, but it would change the picture: 579 `<text>`
178
- elements sit in groups with lines, and moving `stroke` up would give axis labels an outline —
179
- text is filled, not stroked. An attribute may only move up when every child without it is
180
- genuinely unaffected. That rule is what leaves 15.9 %.
181
-
182
- It touches the output of every chart, so it is not a patch release.
183
-
184
- ---
185
-
186
161
  ## 🐞 Found a bug?
187
162
 
188
163
  Issues live at
@@ -298,11 +273,13 @@ Coordinates are written with three decimals. That is far beyond what any screen
298
273
  resolves — 0.001 px is three thousandths of a point at 300 dpi — and it is what keeps the
299
274
  files small: written in full, that same chart took 921 KB.
300
275
 
301
- ## Outlook / under consideration
276
+ ## Formerly under consideration
302
277
 
303
- - Svelte wrapper
278
+ Nothing is open right now. Three items that used to sit here are done, and live elsewhere now:
304
279
 
305
- Two items that used to sit here are done, and live elsewhere now:
280
+ - **Svelte wrapper** → [`ml-time-graph-svelte`](https://www.npmjs.com/package/ml-time-graph-svelte),
281
+ same version as this package; manual in chapter 7 of the
282
+ [handbook](https://mlcgo.eu/books/mlctimegraph/).
306
283
 
307
284
  - **Where does my data come from?** → `toSeries` / `toDataPoints`, see the Quickstart above.
308
285
  - **"Live" rendering** → `setData()` on an existing instance, then re-render. No second chart,
package/SKILLS.md CHANGED
@@ -538,6 +538,6 @@ scratch image.
538
538
  still ships no click handler — you write one, and one on the chart is enough. `'separate'` remains
539
539
  the way when the legend belongs in HTML, or needs to do more than toggle.
540
540
  - **An annotation's `dash` takes a variant, not a pattern:** the type is `'dashed' | 'dotted'`. A raw SVG pattern like `'5,5'` is not rejected — it draws a solid line, in both libraries.
541
- - **One option is still accepted and does nothing:** `series.sensorType` is in the types and the parser reads it, but no renderer acts on it — in either library. Setting it to `'enum'` does not label the axis; that is `series.enumMap`, which 1.10.0 wired up. Until 1.10.0 this list also held `ticks.minor`, `grid.minor` and `enumMap` itself: three fields the types promised and both renderers swallowed. Nothing warns you; the picture just stays as it was.
541
+ - **One option is still accepted and does nothing:** `series.sensorType` is in the types and the parser reads it, but no renderer acts on it — in either library. Setting it to `'enum'` does not label the axis; that is `series.enumMap`, which 1.10.0 wired up. Since 1.17.1 it is marked **deprecated** and will be removed before 2.0; so is the flat gap style `'label'` (use `'empty'` with a `label`), which `warnings()` reports. Until 1.10.0 this list also held `ticks.minor`, `grid.minor` and `enumMap` itself: three fields the types promised and both renderers swallowed. Nothing warns you about `sensorType`; the picture just stays as it was.
542
542
  - **CSS classes are not namespaced:** the chart uses plain names like `.series` and `.time-axis`. Inline the SVG into a page whose stylesheet has a `.series` rule and that rule applies to the chart. Scope your own selectors, and suspect the host page when an embedded chart looks wrong but the standalone file does not.
543
543
  - **Hatch lines adapt to fill colour:** Hatch patterns inherit the opaque colour of the area they belong to (`opaqueColor(fill)`), while the backdrop stays translucent. An earlier default drew fixed blue lines (`#4D88FF`), which falsely signaled an extra state on incident charts where colour is semantic.
package/USAGE.md CHANGED
@@ -346,6 +346,33 @@ style: { fill: { regions: [
346
346
  ] } }
347
347
  ```
348
348
 
349
+ #### Only where two lines disagree — `where`
350
+
351
+ Two sensors that should read the same — top and bottom of a fridge — are two lines. The
352
+ stretch where they drift apart is the actual message, and `where` marks exactly that:
353
+
354
+ ```ts
355
+ { name: 'Top', data: top, style: { fill: { regions: [{
356
+ from: 'series', to: { series: 'Bottom' },
357
+ where: { exceeds: 2, maxAgeMs: 30 * 60_000 }, // |Bottom − Top| > 2, readings ≤ 30 min old
358
+ fill: { color: '#ef444433', hatch: 'classic-diagonal' },
359
+ }] } } },
360
+ { name: 'Bottom', data: bottom, style: { line: { shape: 'step' } } }, // reports on change only
361
+ ```
362
+
363
+ - **Strictly greater:** exactly `exceeds` apart counts as agreeing.
364
+ - `side: 'above'` / `'below'` — only where `to` lies more than `exceeds` above / below
365
+ `from`; default `'both'`.
366
+ - `maxAgeMs` — where one side's last reading is older, there is no statement and no area
367
+ (as `holdAlign` does). A gap ends the area.
368
+ - **Decided on the readings, drawn on the lines.** The windows are found on the readings
369
+ joined by straight lines — a step holds its value and jumps at the timestamp, the same
370
+ basis as `divergenceExcursions`. The area itself is the usual one between the *drawn*
371
+ curves, clipped to those windows with vertical edges. A sensor that reports on change
372
+ should therefore be drawn as a step: then line and decision agree exactly.
373
+ - Smoothed lines work. `monotone` stays within the readings, so the edges sit on the line;
374
+ `catmull-rom` and `akima` can overshoot, and `warnings()` says so.
375
+
349
376
  ## Legend
350
377
 
351
378
  ```ts
@@ -462,6 +489,26 @@ and it is the default: a filled area down to the baseline would otherwise swallo
462
489
  Set `grid: { ..., layer: 'back' }` when you want exactly that — the grid behind the data, covered
463
490
  by an opaque fill. Markers, annotations and labels come after the grid in both cases.
464
491
 
492
+ ### Which series share an axis — `axisGroups`
493
+
494
+ Grouping by unit alone is wrong for multi-channel devices: −75 °C, 5 °C and 23 °C on one
495
+ 80 K scale flatten the two warmer curves into lines. One axis per series is the opposite
496
+ mistake: three fridges at 2–8 °C on three scales. `axisGroups` suggests the middle — same
497
+ unit **and** nearby ranges share an axis; a gap larger than the larger range gets its own:
498
+
499
+ ```ts
500
+ import { axisGroups } from 'ml-time-graph';
501
+
502
+ const { indices, axes } = axisGroups(probes.map((p) => ({ unit: p.unit, data: p.data })));
503
+ new MLTimeGraph({
504
+ series: probes.map((p, i) => ({ name: p.name, data: p.data, yAxisIndex: indices[i] })),
505
+ axes: { y: axes }, // [{ position: 'left', label: '°C' }, { position: 'right', … }]
506
+ });
507
+ ```
508
+
509
+ A pure function — nothing is applied for you, and the input order is kept so axes do not jump
510
+ when a series is added. Pass `min`/`max` instead of `data` when you know them.
511
+
465
512
  ### Room at the edge — `padding`
466
513
 
467
514
  The computed domain ends exactly at the smallest and largest reading, and the plot
@@ -761,6 +808,38 @@ band. And a gap band's default fill is white at 15% opacity, which is
761
808
  invisible on a white chart; `style: 'dashed_border'` draws the edges you can
762
809
  actually see, or give the region its own `fill`.
763
810
 
811
+ ### A device that went quiet — `gaps.atEnd`
812
+
813
+ A line that simply ends says nothing; in monitoring, a sensor that stopped reporting is the
814
+ most important news on the screen. `gaps.atEnd` marks it: when a series' last reading lies
815
+ more than `afterMs` before *now*, a hatched region runs from that reading to now.
816
+
817
+ ```ts
818
+ gaps: {
819
+ atEnd: {
820
+ afterMs: 30 * 60_000, // the device's "no data" threshold
821
+ label: 'keine Daten seit {since} ({duration})', // -> "keine Daten seit 14:32 (38 min)"
822
+ // now: Date.now(), // default: end of the time axis
823
+ },
824
+ },
825
+ series: [
826
+ { name: 'Fridge', data },
827
+ { name: 'Door', data: door, gaps: { atEnd: false } }, // reports on change only
828
+ { name: 'Freezer', data: freezer, gaps: { atEnd: { afterMs: 3_600_000 } } }, // own threshold
829
+ ]
830
+ ```
831
+
832
+ - **Now** is passed in or is the end of the time axis — the library reads no clock, so
833
+ screen, PDF and tests agree.
834
+ - **Strictly greater:** exactly `afterMs` old is not an outage yet. A series with no reading
835
+ in the window gets no region; series that went quiet at the same moment share one.
836
+ - **Text:** none unless you give one. `{since}` is the time in the chart's format (`locale`,
837
+ `timeZone`), with the date when it was another day than now; `{duration}` is
838
+ language-neutral (`45 min`, `3 h 12 min`, `2 d 4 h`). In TypeScript `label` can also be
839
+ `(sinceMs, durationMs) => string`; JSON (Go) takes the placeholder string.
840
+ - **Look:** hatched with dashed edges, the label turns when it does not fit. `atEnd.style`
841
+ changes it; the chart-wide `gaps.style` does not apply here (its `band` does).
842
+
764
843
  ## Statistic overlays
765
844
 
766
845
  Computed at render time from the series' raw data; each overlay has its own
@@ -1003,6 +1082,26 @@ interaction in your app, or pull the optional `Zoom` / `Minimap` helpers from th
1003
1082
  [`ml-time-graph/interaction`](#package-exports) subpath. See the demo gallery's
1004
1083
  "Fridge" (range slider) and "Interaction" pages.
1005
1084
 
1085
+ ### In Svelte — `ml-time-graph-svelte`
1086
+
1087
+ Everything in this section — width from the container, `autoMargin`, a tooltip over
1088
+ `pointsAt`, `zeigerImSvg`, a clickable legend, dark mode through `theme`, print, export —
1089
+ comes ready-made as a Svelte 5 component:
1090
+
1091
+ ```svelte
1092
+ <script lang="ts">
1093
+ import { TimeGraph, Legend } from "ml-time-graph-svelte";
1094
+ let hidden = $state(new Set<string>());
1095
+ let legend = $state([]);
1096
+ </script>
1097
+
1098
+ <Legend items={legend} bind:hidden />
1099
+ <TimeGraph {options} height={260} zoomable bind:hidden bind:legend />
1100
+ ```
1101
+
1102
+ `options` are exactly the options described here. The component's README is its manual;
1103
+ the demo pages `svelte.html` and `svelte_dashboard.html` show every feature with source.
1104
+
1006
1105
  ## Server-side rendering (Node)
1007
1106
 
1008
1107
  `SVGRenderer` needs no DOM, so the same code runs in Node — set explicit
@@ -1127,6 +1226,20 @@ build `.series--${slugify(name)}` from a name you hold.
1127
1226
  Reach for the `id` when there is one chart in the document, or when you have scoped the
1128
1227
  lookup yourself (`container.querySelector('#…')` rather than `document.getElementById`).
1129
1228
 
1229
+ **`idPrefix` removes the collision.** Give each chart on a page its own prefix, and pass the
1230
+ same one to the renderer so the `<defs>` (clip paths, hatch patterns, shadows) are covered
1231
+ too:
1232
+
1233
+ ```ts
1234
+ const chart = new MLTimeGraph({ ...options, idPrefix: 'fridge-2' });
1235
+ const svg = new SVGRenderer({ idPrefix: 'fridge-2' }).render(chart.renderCommands()).content;
1236
+ // → id="fridge-2-series-temperature", id="fridge-2-clip-plot-…"; classes unchanged
1237
+ ```
1238
+
1239
+ The prefix is stable as long as you pass the same one — do not generate it per render. The
1240
+ Go port takes the same `idPrefix` in its JSON options (server and CLI apply it to the defs
1241
+ as well). `ml-time-graph-svelte` gives every `<TimeGraph>` its own prefix automatically.
1242
+
1130
1243
  ### Provenance
1131
1244
 
1132
1245
  Every SVG names the library and version that drew it, as the first child of the root:
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { M as MLTimeGraphOptions, L as LegendItem, R as Renderer, a as LayoutResult, b as Margin, A as AxesConfig, X as XAxisConfig, Y as YAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-CN1N04nS.js';
2
- export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-CN1N04nS.js';
3
- import { e as AnySeries, i as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './scale-kRRbXFik.js';
4
- export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as GapConfig, O as GapLabel, Q as GapRegion, U as GapStyle, G as GridLayer, V as LineShape, W as LineStyle, X as MarkerStyle, Y as MovingAverageType, Z as SVGLineStyle, _ as SensorType, $ as SeriesOverlay, a0 as SeriesOverlayKind, a1 as SeriesType, a2 as ShadowStyle, a3 as SolidDashStyle, a4 as ThresholdLabelConfig, a5 as getLineStyle, a6 as resolveDash } from './scale-kRRbXFik.js';
1
+ import { M as MLTimeGraphOptions, L as LegendItem, R as Renderer, a as LayoutResult, b as Margin, Y as YAxisConfig, A as AxesConfig, X as XAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-VcAK5as0.js';
2
+ export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-VcAK5as0.js';
3
+ import { e as AnySeries, i as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './types-D7tmWwH9.js';
4
+ export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as FillWhere, O as GapConfig, Q as GapLabel, U as GapRegion, V as GapStyle, W as GapsAtEnd, G as GridLayer, X as LineShape, Y as LineStyle, Z as MarkerStyle, _ as MovingAverageType, $ as SVGLineStyle, a0 as SensorType, a1 as SeriesGaps, a2 as SeriesOverlay, a3 as SeriesOverlayKind, a4 as SeriesType, a5 as ShadowStyle, a6 as SolidDashStyle, a7 as ThresholdLabelConfig, a8 as getLineStyle, a9 as resolveDash } from './types-D7tmWwH9.js';
5
5
 
6
6
  /*!
7
7
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -95,6 +95,7 @@ interface PointsAtOptions {
95
95
 
96
96
  declare class MLTimeGraph {
97
97
  private readonly _layout;
98
+ private readonly _idPraefix?;
98
99
  private readonly _renderer?;
99
100
  private readonly _locale?;
100
101
  private readonly _timeZone?;
@@ -119,6 +120,7 @@ declare class MLTimeGraph {
119
120
  private readonly _gapsBand?;
120
121
  private readonly _gapsAutoDetect;
121
122
  private readonly _gapsMinGapMs;
123
+ private readonly _gapsAtEnd?;
122
124
  private _annotations;
123
125
  private readonly _annotationBands;
124
126
  private readonly _disabledAnnotations;
@@ -229,6 +231,14 @@ declare class MLTimeGraph {
229
231
  * when they have none) -- `hidden` and `pointsAt` cannot tell them apart.
230
232
  */
231
233
  warnings(): string[];
234
+ /**
235
+ * `where` an einer Flaeche entscheidet an den Messwerten. Ist eine der
236
+ * beiden Kurven mit catmull-rom oder akima geglaettet, kann sie ueber die
237
+ * Messwerte hinausschwingen -- dann trifft die Flaeche die Linie am Rand des
238
+ * Fensters nicht genau. 'monotone' schwingt nicht ueber. Gegenstueck:
239
+ * ueberschwinger in go-time-graph/pkg/chart/warnings.go.
240
+ */
241
+ private _ueberschwinger;
232
242
  /**
233
243
  * The points under the pointer at (x, y), in SVG pixels -- for a tooltip
234
244
  * that gets data instead of HTML. Valid after `renderCommands()`, like
@@ -278,6 +288,42 @@ interface AutoMarginOptions {
278
288
  */
279
289
  declare function autoMargin(options: MLTimeGraphOptions, opts?: AutoMarginOptions): Margin;
280
290
 
291
+ /*!
292
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
293
+ * MIT with Attribution: free use incl. commercial requires visible credit to
294
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
295
+ */
296
+
297
+ /** One series as far as the axis assignment cares. Give `min`/`max`, or `data`. */
298
+ interface AxisGroupInput {
299
+ /** The unit -- series with different units never share an axis. */
300
+ unit: string;
301
+ min?: number;
302
+ max?: number;
303
+ /** Instead of min/max: the readings (nulls are skipped). */
304
+ data?: ReadonlyArray<{
305
+ value?: number | null;
306
+ }>;
307
+ }
308
+ interface AxisGroups {
309
+ /** Per input, in input order: its axis (0 = first axis) -- use as `yAxisIndex`. */
310
+ indices: number[];
311
+ /** One entry per axis, for `axes.y`: the unit as label, first left, the others right. */
312
+ axes: YAxisConfig[];
313
+ }
314
+ /**
315
+ * Suggest which series share a value axis: same unit AND nearby ranges -- a
316
+ * gap larger than the larger range gets its own axis. Input order is kept, so
317
+ * axes do not jump when a series is added; a series without values joins the
318
+ * first axis of its unit. A pure function: nothing is applied to a chart.
319
+ *
320
+ * ```ts
321
+ * const { indices, axes } = axisGroups(series.map((s) => ({ unit: s.unit, data: s.data })));
322
+ * new MLTimeGraph({ series: series.map((s, i) => ({ ...s, yAxisIndex: indices[i] })), axes: { y: axes } });
323
+ * ```
324
+ */
325
+ declare function axisGroups(items: ReadonlyArray<AxisGroupInput>): AxisGroups;
326
+
281
327
  /*!
282
328
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
283
329
  * MIT with Attribution: free use incl. commercial requires visible credit to
@@ -835,6 +881,13 @@ declare class SVGRenderer extends Renderer {
835
881
  height?: number | string;
836
882
  /** Optional solid background colour, drawn as a full-size rect (e.g. "white"). */
837
883
  background?: string;
884
+ /**
885
+ * Prefix for the ids this renderer writes into `<defs>` (clip paths, hatch
886
+ * patterns, shadows). Pass the chart's `idPrefix` so two charts on one page
887
+ * share no id at all. Identical charts would otherwise both write
888
+ * `clip-plot-<hash>`.
889
+ */
890
+ idPrefix?: string;
838
891
  });
839
892
  /** Set a solid background colour, drawn as a full-size rect behind the chart. */
840
893
  setBackgroundColor(color: string): void;
@@ -1092,6 +1145,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
1092
1145
  * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
1093
1146
  * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
1094
1147
  */
1095
- declare const VERSION = "1.16.0";
1148
+ declare const VERSION = "1.17.1";
1096
1149
 
1097
- export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AutoMarginOptions, AxesConfig, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, type LimitStatsPoint, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, type MktPoint, type OptionsLayer, type PointAt, PointStyleType, type PointsAtOptions, RangeLabelPosition, SVGRenderer, SeriesStyle, SmoothingType, type StatsAggregatedPoint, type StdDevPoint, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };
1150
+ export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AutoMarginOptions, AxesConfig, type AxisGroupInput, type AxisGroups, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, type LimitStatsPoint, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, type MktPoint, type OptionsLayer, type PointAt, PointStyleType, type PointsAtOptions, RangeLabelPosition, SVGRenderer, SeriesStyle, SmoothingType, type StatsAggregatedPoint, type StdDevPoint, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, axisGroups, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };