ml-time-graph 1.22.0 → 1.24.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 CHANGED
@@ -19,6 +19,36 @@ release notes, and every change is in `git log` in full.
19
19
 
20
20
  ---
21
21
 
22
+ ## [1.24.0] - 2026-11-06
23
+
24
+ ### Added
25
+ - **`legend.colors` on a series** (TS and Go) — the legend swatch shows several colours side by side,
26
+ e.g. the zones of a `colorByThresholds` line, instead of only its base colour. `legendItems()`
27
+ returns them as `colors`.
28
+
29
+ ## [1.23.0] - 2026-11-02
30
+
31
+ ### Added
32
+ - **`minItemWidth` on annotation bands** (TS and Go) — short events in long windows stay visible; a
33
+ narrower item widens around its centre.
34
+
35
+ ### Changed
36
+ - **The `gap` draw command** now draws its `label` with any style except `"empty"`. Affects only
37
+ hand-written command lists; charts do not produce this command.
38
+
39
+ ### Fixed
40
+ - **A series line with `width: 0` or style `"none"` is no longer drawn** (TS and Go); markers stay. It
41
+ used to come out at 1 px between the points. In TS, `"none"` works from JSON; the type offers
42
+ `line: false`.
43
+ - **`showInLegend: true` on an annotation band now lists it in the legend** (TS and Go). The field did
44
+ nothing before. The default is now documented as `false`, so existing charts do not change. Such a
45
+ band also appears in `legendItems()`, without a `seriesId`.
46
+
47
+ ### Removed
48
+ - **Gap style `"label"`** (TS and Go), deprecated since 1.17.1. Use `"empty"` with a `label`: it draws
49
+ the same. TypeScript no longer accepts the value; JSON that still has it keeps drawing as before,
50
+ and `warnings()` reports it.
51
+
22
52
  ## [1.22.0] - 2026-10-22
23
53
 
24
54
  ### Security
@@ -154,6 +154,7 @@ A series is either a `TimeSeries` (individual samples) or an `AggregatedSeries`
154
154
  | `yAxisIndex` | `number` | Which Y scale to draw on (`0` = left, `1` = right) |
155
155
  | `seriesType` | `'line' \| 'area' \| 'step'` | Render mode (default `'line'`) |
156
156
  | `colorByThresholds` | `string[]` | Colors applied segment-wise depending on which thresholds the values cross |
157
+ | `legend` | `{ colors?: string[] }` | Legend swatch in several colours side by side — e.g. the zone colours of a `colorByThresholds` line, which otherwise shows only its base colour. Also on aggregated series. Unreleased. |
157
158
 
158
159
  ### DataPoint
159
160
 
@@ -218,7 +219,7 @@ Applies to both series kinds and to overlay curves.
218
219
  | Field | Type | Description |
219
220
  |-------|------|-------------|
220
221
  | `id` | `string` | Stable style identifier |
221
- | `line` | `LineStyle \| LineStyle[] \| false` | Single style, per-segment array, or `false` (no line) |
222
+ | `line` | `LineStyle \| LineStyle[] \| false` | Single style, per-segment array, or `false` (no line). `width: 0` or `style: 'none'` on a `LineStyle` also draws no line (`'none'` from JSON; the TS type has `false` for it) |
222
223
  | `fill` | `FillSpec` | Area fill below/above the curve (section 5.1) |
223
224
  | `markers` | `MarkerStyle` | Per-point marker glyphs (distinct from reference markers, section 10) |
224
225
  | `shadow` | `ShadowStyle` | Soft shadow behind the line |
@@ -431,7 +432,7 @@ Two equivalent forms; prefer `GapsConfig`.
431
432
  | `fillOpacity` | `number` | Background opacity |
432
433
  | `labelBaseline` | `'above' \| 'middle' \| 'below'` | Vertical label alignment — **note the value set differs from `AnnotationBandItem.labelBaseline`** |
433
434
  | `rotate` | `number` | Label rotation |
434
- | `style` | `'dashed_border' \| 'empty' \| 'label'` | Rendering mode. `'label'` is **deprecated** and will be removed before 2.0 — use `'empty'` with `label`. |
435
+ | `style` | `'dashed_border' \| 'empty' \| 'filled'` | Rendering mode. `'label'` was removed — use `'empty'` with `label`; JSON that still has it draws like `'empty'` and `warnings()` reports it. |
435
436
 
436
437
  ### 10b. Preferred config form (`gaps: GapsConfig`)
437
438
 
@@ -479,7 +480,8 @@ Bands rendered in a dedicated strip *outside* the plot area, useful for shift/ph
479
480
  | `height` | `number` | `12` | Strip height in px |
480
481
  | `spacing` | `number` | `0` | Extra spacing below the strip, px |
481
482
  | `showAxis` | `boolean` | `false` | Draw a dedicated axis with band tick labels |
482
- | `showInLegend` | `boolean` | `true` | Include in the legend |
483
+ | `showInLegend` | `boolean` | `false` | List in the legend, with the colour of its first item; the legend itself still needs `legend.show` |
484
+ | `minItemWidth` | `number` | `1` | Smallest item width in px; a narrower item widens around its centre and claims no duration |
483
485
  | `background` | `string` | transparent | Strip background color |
484
486
  | `items` | `AnnotationBandItem[]` | **required** | Individual windows inside the strip |
485
487
  | `labels` | `'all' \| 'fit' \| { mode, keep? }` | `'all'` | `'fit'`: draw only the item labels that fit side by side (see below) |
@@ -556,7 +558,7 @@ covered — the label moves past its tick labels. Axis titles on that side keep
556
558
 
557
559
  **GapStyle.display** (4): `empty`, `dashed_border`, `filled`, `bridge_line`
558
560
 
559
- **DrawGapType_t** (3) — legacy `Gap.style`: `dashed_border`, `empty`, `label` (deprecated, removed before 2.0)
561
+ **DrawGapType_t** (3) — legacy `Gap.style`: `dashed_border`, `empty`, `filled`
560
562
 
561
563
  **FillSide:** `above`, `below`
562
564
 
package/README.de.md CHANGED
@@ -16,6 +16,9 @@ Browser und im Backend.
16
16
  > sechzehn Seiten, jede Karte mit Code- und Werte-Reiter, nichts zu installieren. Dieselben Seiten
17
17
  > stecken im [Handbuch](https://mlcgo.eu/books/mlctimegraph/).
18
18
 
19
+ > ✏️ **[Selbst bearbeiten: Playground](https://play.mlcgo.eu/ml-time-graph)** — Beispiele im Browser
20
+ > ändern, mit Autovervollständigung und Typprüfung, und das Ergebnis als Link teilen.
21
+
19
22
  > 🤖 **Sie arbeiten mit einem KI-Assistenten?** Das Paket bringt einen Agent-Skill mit,
20
23
  > **[skills/ml-time-graph/SKILL.md](https://gitlab.com/mlc0911/mlctimegraph/-/blob/main/packages/ml-time-graph/skills/ml-time-graph/SKILL.md)** — nach `npm install` liegt er unter
21
24
  > `node_modules/ml-time-graph/skills/ml-time-graph/`. Kopieren Sie den Ordner in das
package/README.md CHANGED
@@ -16,6 +16,9 @@ backend.
16
16
  > pages, every card with a Code and a Values tab, nothing to install. The same pages are embedded
17
17
  > in the [handbook](https://mlcgo.eu/books/mlctimegraph/).
18
18
 
19
+ > ✏️ **[Edit and run it: playground](https://play.mlcgo.eu/ml-time-graph)** — change an example in
20
+ > the browser, with autocompletion and type checks, and share the result as a link.
21
+
19
22
  > 🤖 **Working with an AI coding assistant?** The package ships an agent skill,
20
23
  > **[skills/ml-time-graph/SKILL.md](https://gitlab.com/mlc0911/mlctimegraph/-/blob/main/packages/ml-time-graph/skills/ml-time-graph/SKILL.md)** — after `npm install` it sits at
21
24
  > `node_modules/ml-time-graph/skills/ml-time-graph/`. Copy that folder into your agent's skills
package/USAGE.md CHANGED
@@ -100,7 +100,7 @@ See `demos/adapters.html` — the same chart from four input shapes.
100
100
 
101
101
  Visual styling lives in a nested `style` block — `line`, `fill`, `markers`, `shadow`,
102
102
  `gap`. Any combination is allowed: set `line` for a line, add `fill` for an area
103
- underneath, add `markers` for points, set `style.line: false` for points only.
103
+ underneath, add `markers` for points, set `style.line: false` (or `width: 0`) for points only.
104
104
 
105
105
  ```ts
106
106
  // Raw line
@@ -257,6 +257,10 @@ new MLTimeGraph({
257
257
  leaving it out.
258
258
  - `colorByThresholds: string[]` colours the line by zone — base colour below the
259
259
  lowest threshold, then each threshold's colour for values above it.
260
+ - The legend shows such a series in its base colour only — the colour of the *lowest*
261
+ zone. Give it `legend: { colors: ['#2563eb', '#16a34a', '#dc2626'] }` and the swatch
262
+ shows all of them side by side, left to right. A legend you draw yourself gets them
263
+ from `legendItems()` as `colors`; `color` stays the base colour.
260
264
 
261
265
  ### Data outside the axis range
262
266
 
@@ -403,6 +407,10 @@ interface LegendItem {
403
407
  }
404
408
  ```
405
409
 
410
+ An annotation band with `showInLegend: true` is listed after the series. Its `id` starts with
411
+ `band-`, it has no `seriesId`, and no series group belongs to it, so a click handler that hides
412
+ series has to skip it.
413
+
406
414
  Draw the swatch through the same renderer the chart uses, so it cannot drift from the
407
415
  curve it names — a 22×10 line with the series' dashes and, if there is one, its marker:
408
416
 
@@ -1101,8 +1109,8 @@ look different from what you meant. Same texts in Go (`Warnings()`):
1101
1109
  - `side` on a fill region that is not "line against a fixed bound", and `outer` without `side`
1102
1110
  — both are ignored there;
1103
1111
  - `where` on a smoothing that can overshoot (`catmull-rom`, `akima`);
1104
- - deprecated settings (`style: "label"` on a gap, `series.style.gap.label`, `series.sensorType`
1105
- other than `"numeric"`).
1112
+ - removed or deprecated settings (`style: "label"` on a gap, `series.style.gap.label`,
1113
+ `series.sensorType` other than `"numeric"`).
1106
1114
 
1107
1115
  Call it while you author a chart, or log it once; it costs a pass over the options.
1108
1116
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { M as MLTimeGraphOptions, L as LegendItem, 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-tiiLQTL8.js';
1
+ import { M as MLTimeGraphOptions, L as LegendItem, 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-Dph9cKDY.js';
2
2
  import { Renderer, LayoutResult } from './internals.js';
3
- export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as TickFormat, n as drawMarker, o as estimateMetrics, p as getDefaultTheme, q as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, t as slugify } from './marker_renderer-tiiLQTL8.js';
4
- import { e as AnySeries, i as Annotation, a as DrawCommand, 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-Bo9798aK.js';
3
+ export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as TickFormat, n as drawMarker, o as estimateMetrics, p as getDefaultTheme, q as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, t as slugify } from './marker_renderer-Dph9cKDY.js';
4
+ import { e as AnySeries, i as Annotation, a as DrawCommand, 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-B9bbJxmn.js';
5
5
  import { TimeScale, LinearScale } from './internals.js';
6
- export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationBandLabels, z as AnnotationKind, B as AxisOrientation, A as AxisPosition, C as DataPointRef, E as EnumMap, I as FillBound, J as FillRegion, K as FillSide, N as FillStyle, O as FillWhere, Q as GapBand, U as GapConfig, V as GapLabel, W as GapRegion, X as GapStyle, Y as GapsAtEnd, G as GridLayer, Z as LineShape, _ as LineStyle, $ as MarkerStyle, a0 as MovingAverageType, a1 as SVGLineStyle, a2 as SensorType, a3 as SeriesGapStyle, a4 as SeriesGaps, a5 as SeriesOverlay, a6 as SeriesOverlayKind, a7 as SeriesType, a8 as ShadowStyle, a9 as SolidDashStyle, aa as ThresholdLabelConfig, ab as getLineStyle, ac as resolveDash } from './types-Bo9798aK.js';
6
+ export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationBandLabels, z as AnnotationKind, B as AxisOrientation, A as AxisPosition, C as DataPointRef, E as EnumMap, I as FillBound, J as FillRegion, K as FillSide, N as FillStyle, O as FillWhere, Q as GapBand, U as GapConfig, V as GapLabel, W as GapRegion, X as GapStyle, Y as GapsAtEnd, G as GridLayer, Z as LineShape, _ as LineStyle, $ as MarkerStyle, a0 as MovingAverageType, a1 as SVGLineStyle, a2 as SensorType, a3 as SeriesGapStyle, a4 as SeriesGaps, a5 as SeriesLegend, a6 as SeriesOverlay, a7 as SeriesOverlayKind, a8 as SeriesType, a9 as ShadowStyle, aa as SolidDashStyle, ab as ThresholdLabelConfig, ac as getLineStyle, ad as resolveDash } from './types-B9bbJxmn.js';
7
7
 
8
8
  /*!
9
9
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -208,6 +208,12 @@ declare class MLTimeGraph {
208
208
  private _reihenKontext;
209
209
  legendItems(): LegendItem[];
210
210
  private _legendeneintraege;
211
+ /**
212
+ * Die Baender mit ausdruecklichem `showInLegend`. Getrennt von `_legendItems`, denn
213
+ * pointsAt greift dort je Reihe ueber den Index zu.
214
+ * Gegenstueck: bandLegendenEintraege in go-time-graph/pkg/chart/legende.go.
215
+ */
216
+ private _bandLegendItems;
211
217
  /**
212
218
  * Die Farbe einer Reihe ohne eigene Angabe.
213
219
  *
@@ -850,8 +856,10 @@ declare class AnnotationBandBuilder {
850
856
  setHatch(hatch: HatchVariant): this;
851
857
  /** Sets whether to draw a time axis under the band. */
852
858
  setShowAxis(show: boolean): this;
853
- /** Sets whether the band is listed in the chart legend. */
859
+ /** Sets whether the band is listed in the chart legend (default false). */
854
860
  setShowInLegend(show: boolean): this;
861
+ /** Sets the smallest width in pixels an item is drawn with; narrower ones widen around their centre. */
862
+ setMinItemWidth(px: number): this;
855
863
  /**
856
864
  * Sets which item labels are drawn: `"all"` (default) or `"fit"` — only those that fit
857
865
  * side by side; `keep` picks the label that is always drawn.
@@ -1167,7 +1175,7 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
1167
1175
  * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
1168
1176
  * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
1169
1177
  */
1170
- declare const VERSION = "1.22.0";
1178
+ declare const VERSION = "1.24.0";
1171
1179
 
1172
1180
  export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, AxesConfig, DataPoint, DrawCommand, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, PointStyleType, RangeLabelPosition, RenderOutput, SVGRenderer, SeriesStyle, SmoothingType, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, TimeSeries, TimeSeriesBuilder, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, axisGroups, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };
1173
1181
  export type { AutoMarginOptions, AxisGroupInput, AxisGroups, FieldAccessor, FillBetweenThresholdsInput, LimitStatsPoint, MktPoint, OptionsLayer, PointAt, PointsAtOptions, StatsAggregatedPoint, StdDevPoint, TimeInput, ToDataPointsSpec, TooltipOptions, TooltipSample };