ml-time-graph 1.7.1 → 1.8.3
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 +809 -0
- package/QUICKSTART_GRAPH_BUILDER.de.md +1 -1
- package/README.de.md +125 -16
- package/README.md +122 -17
- package/SKILLS.md +157 -4
- package/USAGE.md +326 -3
- package/dist/analyze/index.d.ts +54 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +107 -7
- package/dist/index.js +27 -26
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +1 -1
- package/dist/internals.d.ts +104 -26
- package/dist/internals.js +15 -15
- package/dist/{scale-D6NtEaUB.d.ts → scale-CoTgJ27U.d.ts} +71 -12
- package/dist/{series_renderer-COVNvq2x.d.ts → slug-0lFk9pY7.d.ts} +18 -2
- package/package.json +19 -12
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `ml-time-graph` (TypeScript) and `go-time-graph` (Go) will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
Both libraries are released in lockstep on the same version number.
|
|
9
|
+
|
|
10
|
+
Note: references like `B-20260922-07` or `I-20260922-03` point into this project's own
|
|
11
|
+
backlog, which is not public — `B-` is a reported defect, `I-` an idea, and the digits are
|
|
12
|
+
the date it was filed plus a counter. They are kept here so that whoever works on the code
|
|
13
|
+
can find the discussion a change came out of. If you are reading from outside, ignore them:
|
|
14
|
+
every entry says on its own what changed and why.
|
|
15
|
+
|
|
16
|
+
Entries here are deliberately short — what changed, whether it affects you. The long form
|
|
17
|
+
of each one, with the measurements and the reasoning, lives in the project's internal
|
|
18
|
+
release notes, and every change is in `git log` in full.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## [1.8.3] - 2026-09-22
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **`timeZone` — the time axis in a zone you name, not the machine's.** `locale` said *how* a
|
|
26
|
+
time is written, nothing said **which**: both libraries formatted in the machine's zone, so
|
|
27
|
+
a browser and a UTC server labelled the same reading differently. Omitting it keeps the old
|
|
28
|
+
behaviour. Handled by `Intl` / `time.Location`, so DST and half-hour zones are right; the Go
|
|
29
|
+
port embeds `time/tzdata` (+0.4 MB). Unknown names are reported, not ignored. Labels only —
|
|
30
|
+
tick positions never move.
|
|
31
|
+
|
|
32
|
+
- **A fill region can reach another series: `{ series: '<id or name>' }`.** Previously a bound
|
|
33
|
+
could only be its own line, `chartTop` / `chartBottom`, a threshold or a fixed value — so
|
|
34
|
+
"the area between two curves" (tolerance corridor, target vs. actual) had no expression. The
|
|
35
|
+
reference curve is interpolated onto this series' timestamps; where it has a gap, the area
|
|
36
|
+
stops rather than bridging it. Unknown names raise an error.
|
|
37
|
+
|
|
38
|
+
- **Statistic overlays in the Go port, from a public maths package.** `series.overlays` existed
|
|
39
|
+
only in TypeScript. `go-time-graph/pkg/analyze` now exports `RollingMean`, `RollingEma`,
|
|
40
|
+
`RollingStdDev`, `RollingMkt`, `StdDev`, `SampleStdDev` and `Mkt` — public on purpose, so a
|
|
41
|
+
caller who only wants the numbers does not have to draw a chart. Bit-identical to the
|
|
42
|
+
TypeScript originals, verified at 17 significant digits.
|
|
43
|
+
|
|
44
|
+
- **`rollingMean` and `rollingEma` are public (`ml-time-graph/analyze`).** The rolling mean sat
|
|
45
|
+
as a private helper inside the overlay renderer, so an overlay could not be reproduced from
|
|
46
|
+
outside. It can now, and `tests/series/overlay_extern.test.ts` proves the geometry is
|
|
47
|
+
identical — the overlay is a convenience, not a second implementation.
|
|
48
|
+
|
|
49
|
+
- **`movingAverage` with `type: 'exponential'` now computes one.** It was accepted and quietly
|
|
50
|
+
drew the *simple* mean. `rollingEma` weights by elapsed time (`alpha = 1 - exp(-Δt/window)`),
|
|
51
|
+
not by a point count, which is what irregularly sampled sensor data needs. The older
|
|
52
|
+
count-based `MovingAvg.exponential()` is untouched.
|
|
53
|
+
|
|
54
|
+
- **`MovingAvg` is exported** from `ml-time-graph/internals`. It was in the source, in the
|
|
55
|
+
docs, and exported from nowhere — the documented import threw. Note it counts **points**
|
|
56
|
+
while `rollingMean` / `rollingEma` take a window in **milliseconds**.
|
|
57
|
+
|
|
58
|
+
- **`axes.<axis>.padding` — room for a thick line at the edge.** The domain ends exactly at the
|
|
59
|
+
extreme reading and the plot is clipped, so a 10 px line at the maximum lost half its stroke.
|
|
60
|
+
`padding` adds room in **pixels** (a number, or `{ top, bottom }`); an explicit `domain` is
|
|
61
|
+
left alone. Both libraries share the formula, held by `edge_axis_padding`.
|
|
62
|
+
|
|
63
|
+
- **Layered options — `-with` on both CLIs, `mergeOptions` in TypeScript.** Put the repeating
|
|
64
|
+
part of a chart (size, axes, legend, colours) in one file and lay it over the data:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
graph-cli -in readings.json -with house-theme.json -out chart.svg
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
One rule: **objects merge, everything else is replaced**, later layer wins. Arrays are
|
|
71
|
+
replaced deliberately — an appending theme would silently turn one curve into two. Both CLIs
|
|
72
|
+
warn when an overlay sets `series`.
|
|
73
|
+
|
|
74
|
+
- **Line and fill paths carry a class, not only an id** — `series-line` and `series-fill`. An
|
|
75
|
+
id is unique per *document*, so two charts on one page collide and `getElementById` returns
|
|
76
|
+
the wrong one. A class can be scoped (`#chart-2 .series--temperature .series-line`) and,
|
|
77
|
+
unlike the crc32 in the id, written down by hand.
|
|
78
|
+
|
|
79
|
+
- **Every SVG says what drew it:** `<!-- MLTimeGraph x.y.z -->` as the first child of the root.
|
|
80
|
+
Identical in both libraries, so the output stays byte-identical, and stripped by the golden
|
|
81
|
+
and parity tests so a release does not churn the comparison files. `VERSION` is exported from
|
|
82
|
+
the package root.
|
|
83
|
+
|
|
84
|
+
- **The SVG's CSS classes and `showAs` are documented.** The classes had been emitted for a
|
|
85
|
+
long time and written down nowhere; `showAs` appeared once, inside a code example.
|
|
86
|
+
`USAGE.md` now carries the full class table with the slug rule, and a section on aggregated
|
|
87
|
+
series. `slugify` is exported so you can build `.series--${slugify(name)}` yourself.
|
|
88
|
+
|
|
89
|
+
- **New demo cards.** *Two sensors compared* and *Tolerance corridor* on the Thresholds page
|
|
90
|
+
show the fill between two curves, each with an `annotationBands` strip naming the incident —
|
|
91
|
+
a sensor dropout, a corridor exit. Under *Main Demos*, the same aggregated data appears three
|
|
92
|
+
ways (`minmaxavg`, three plain series, `band`) with an outside legend, which is where the
|
|
93
|
+
difference shows: one entry against three.
|
|
94
|
+
|
|
95
|
+
- **The marker style block is documented, and the Style Editor exposes it.** `markers.strokeWidth`,
|
|
96
|
+
`stroke`, `fill` and `threshold` have always existed and never inherited `line.width`, but the
|
|
97
|
+
docs showed only `{ type, size }`. Nothing in the library changed.
|
|
98
|
+
|
|
99
|
+
- **The demo gallery uses `padding`** so cards stop showing the defect it fixes. Deliberately
|
|
100
|
+
not a library default: the library draws what the data gives, the air is a presentation
|
|
101
|
+
decision.
|
|
102
|
+
|
|
103
|
+
- **The package describes what it is for.** The npm description and README opened on sensors
|
|
104
|
+
and incident analysis — the origin, not the range. Both now name the data it draws and lead
|
|
105
|
+
with contextual annotation; `keywords` widened to match. No code changed.
|
|
106
|
+
|
|
107
|
+
### Changed
|
|
108
|
+
- **`display` on a gap means the same thing everywhere.** The four words were read differently
|
|
109
|
+
depending on where they were written — `filled` did not fill, `empty` was not empty, and
|
|
110
|
+
`filled` and `dashed_border` were indistinguishable. From now on, identically on both routes:
|
|
111
|
+
|
|
112
|
+
| `display` | draws |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `filled` | the area, no edges |
|
|
115
|
+
| `dashed_border` | the area plus two vertical dashed edges (default) |
|
|
116
|
+
| `empty` | nothing — the label stays |
|
|
117
|
+
| `bridge_line` | the connecting line (per-series only) |
|
|
118
|
+
|
|
119
|
+
**This changes existing charts that set `display`.**
|
|
120
|
+
|
|
121
|
+
- **A gap's label sits where a highlight's does**, from one shared function. `top` / `center` /
|
|
122
|
+
`bottom` sit inside the plot, `above` / `below` in the image margin. The gap's own rule had
|
|
123
|
+
two of three values wrong: `below` sat on the x-axis, `above` ended 1 px outside the SVG.
|
|
124
|
+
`middle` remains valid as the old name for `center`.
|
|
125
|
+
|
|
126
|
+
- **`display: 'dashed_border'` draws the two vertical edges, not a frame.** The top and bottom
|
|
127
|
+
edge of a gap lie on the plot boundary and say nothing; the vertical ones mark where the
|
|
128
|
+
readings stop and start again.
|
|
129
|
+
|
|
130
|
+
- **The Go renderer is five times faster than before this release**, and the SVG files are half
|
|
131
|
+
the size. Coordinates are written with three decimals — far beyond what any output resolves —
|
|
132
|
+
and formatted with integer arithmetic instead of `strconv.AppendFloat`'s shortest-form search,
|
|
133
|
+
which was 54 % of render time.
|
|
134
|
+
|
|
135
|
+
| points | before | after |
|
|
136
|
+
| -----: | -----: | ----: |
|
|
137
|
+
| 5,000 | 10.6 ms | 1.9 ms |
|
|
138
|
+
| 25,000 | 67.7 ms | 13 ms |
|
|
139
|
+
| 50,000 | 149.7 ms | 24 ms |
|
|
140
|
+
|
|
141
|
+
Allocations at 25,000 points fell from 175,796 to ~700: `pathD` fills one pre-sized buffer,
|
|
142
|
+
and `GetRuns` returns windows instead of copies. Output stayed byte-identical throughout —
|
|
143
|
+
that was the condition, and no golden changed. `pkg/chart/bench_test.go` keeps the measurement.
|
|
144
|
+
|
|
145
|
+
Both libraries now funnel every number through one `fnum`; Go replicates JavaScript's
|
|
146
|
+
rounding on purpose, including `-0` and half-away-from-zero, pinned by `runde_test.go`.
|
|
147
|
+
|
|
148
|
+
### Fixed
|
|
149
|
+
- **Two charts on one page clipped each other.** Every chart wrote `<clipPath id="clip-plot">`,
|
|
150
|
+
and an SVG id is valid across the whole document — so every chart after the first was clipped
|
|
151
|
+
to the first one's rectangle, cutting the top off taller curves. Hatch patterns, shadow
|
|
152
|
+
filters and gradients collided the same way. Every generated `<defs>` id now carries a key
|
|
153
|
+
derived from its content, identically in both libraries. Example images and all 48 handbook
|
|
154
|
+
figures regenerated.
|
|
155
|
+
|
|
156
|
+
- **The same `id` appeared several times in one chart.** TypeScript restarted the line-segment
|
|
157
|
+
counter at every data run; Go gave every piece of a split fill region the same id. The parity
|
|
158
|
+
test could not see it because a normalisation rule **stripped every `id` before comparing** —
|
|
159
|
+
a rule whose reason had disappeared long before. That rule is gone, ids are part of the
|
|
160
|
+
comparison now, and a new test counts duplicates in both libraries (with `xmllint` as an
|
|
161
|
+
independent second opinion where installed).
|
|
162
|
+
|
|
163
|
+
- **The Go port drew no free annotations at all.** `annotations` was read, stored and never
|
|
164
|
+
rendered — a chart that showed an arrow in the browser came back from the server without it.
|
|
165
|
+
It survived because no parity template used `annotations`; the fix therefore started with
|
|
166
|
+
`test_data/annotations_demo.json`, which made the gap visible as 30 missing elements.
|
|
167
|
+
|
|
168
|
+
- **The Go port ignored `series.style.gap`.** Parsed, never read, while TypeScript drew the
|
|
169
|
+
region. Same blind spot: no template used it. `series_gap_style` now puts all four `display`
|
|
170
|
+
values side by side. Per-series gaps also stopped having a drawing path of their own — they
|
|
171
|
+
go through the same `renderGaps` as chart-wide ones.
|
|
172
|
+
|
|
173
|
+
- **The parity suite depended on the developer's timezone.** Both libraries format labels in
|
|
174
|
+
the machine's zone, so the goldens only matched where they were written — the first CI run
|
|
175
|
+
failed all 38 templates. Tests are pinned to UTC now (`vitest.config.ts`, `TestMain`) and the
|
|
176
|
+
goldens regenerated; checked under three zones. The underlying gap is fixed by `timeZone`
|
|
177
|
+
above (B-20260922-07).
|
|
178
|
+
|
|
179
|
+
- **A fill region with two unresolvable bounds killed the Go process.** A nil-pointer panic,
|
|
180
|
+
reachable from `cmd/server` with a plain misconfiguration (`to: { threshold: '<unknown>' }`).
|
|
181
|
+
Such a region is now simply not drawn. The divergence underneath stays open: TypeScript
|
|
182
|
+
throws where Go carries on, and `RenderCommands()` has no error channel (B-20260922-06).
|
|
183
|
+
|
|
184
|
+
- **A threshold's CSS class differed between the libraries.** TypeScript slugified the name,
|
|
185
|
+
Go took it raw, so `Warning Low` became `.threshold--warning-low` in one and three classes in
|
|
186
|
+
the other. Hidden by another normalisation rule that slugified *both* sides before comparing.
|
|
187
|
+
Rule gone, Go slugifies, divergences now fail the test.
|
|
188
|
+
|
|
189
|
+
- **Six marker shapes were drawn with one side open.** `diamond`, `triangle`, `triangle-down`,
|
|
190
|
+
`star`, `hexagon` and `hourglass` never closed their path, so the fill looked right and the
|
|
191
|
+
stroke was missing its last edge — since the shapes were added in May. Both libraries made the
|
|
192
|
+
identical mistake, which is why the comparison could not see it. `arrow` stays open on
|
|
193
|
+
purpose.
|
|
194
|
+
|
|
195
|
+
- **A `rect` annotation's `hatch` was accepted and dropped.** The type offered it, neither
|
|
196
|
+
renderer passed it on. Both do now, and `annotations_demo` carries a hatched rect.
|
|
197
|
+
|
|
198
|
+
- **An aggregated series had no colour in the legend.** The legend read only `style.line.color`,
|
|
199
|
+
so two bands stood side by side with identical grey swatches. Both libraries now fall back to
|
|
200
|
+
the band's `avgColor`.
|
|
201
|
+
|
|
202
|
+
- **The Go library printed debug output on almost every render.** `FillSpec.UnmarshalJSON`
|
|
203
|
+
carried a `fmt.Printf("DEBUG …")` in its *expected* fallback branch, so any config using the
|
|
204
|
+
`fill: '#colour'` shorthand wrote to the caller's stdout — noise in someone else's log when
|
|
205
|
+
running as a server.
|
|
206
|
+
|
|
207
|
+
- **German strings where a user can see them, in Go.** Four error messages and six parity
|
|
208
|
+
templates whose labels are rendered into the SVG. Comments and commit messages stay German;
|
|
209
|
+
the rule is about what the reader sees.
|
|
210
|
+
|
|
211
|
+
- **The dev server showed the last build, not the work in progress.** `pnpm dev` ran
|
|
212
|
+
`vite demos`, which makes vite look for its config *in* `demos/` — so the repository's
|
|
213
|
+
`vite.config.ts` and its aliases were never loaded and `ml-time-graph` resolved to whatever
|
|
214
|
+
`dist` was lying around. The production build always used `src`, so the two could disagree.
|
|
215
|
+
`pnpm dev` is plain `vite` now; the config sets the root itself.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## [1.7.2] - 2026-09-21
|
|
220
|
+
|
|
221
|
+
### Added
|
|
222
|
+
- **The changelog ships with the npm package.** Until now a consumer got no history at all —
|
|
223
|
+
the file lives in the repository root, and npm does not publish anything outside the package
|
|
224
|
+
directory. A `prepack` step copies it in and `postpack` removes it again, so the copy is a
|
|
225
|
+
build artifact rather than a second document: it cannot drift, which is exactly how the two
|
|
226
|
+
per-package changelogs ended up claiming for five releases that the library had stopped at
|
|
227
|
+
1.2.0.
|
|
228
|
+
- **The handbook covers the input adapters** (`book/{de,en}/chapters/02_first_curve.md`). The
|
|
229
|
+
chapter already told the reader that `time` is a number in milliseconds and not a `Date` —
|
|
230
|
+
which is exactly the moment they look at their own rows and wonder. It now answers that in
|
|
231
|
+
the same breath, including why the core stays strict while the edge gives.
|
|
232
|
+
|
|
233
|
+
### Added
|
|
234
|
+
- **`CONTRIBUTING.md` and GitLab issue templates** (Bug, Parity, Feature). The library is
|
|
235
|
+
downloaded and used often enough now that reports arrive from people who cannot be asked
|
|
236
|
+
three follow-up questions. The Bug template asks for the chart options, because with them a
|
|
237
|
+
report becomes a failing test in minutes. **Parity** is a template of its own on purpose:
|
|
238
|
+
"TypeScript and Go draw different pictures from the same options" is the one defect class the
|
|
239
|
+
parity harness cannot find by itself, and it needs exactly the material a parity template is
|
|
240
|
+
built from. Both package READMEs now name the reporting route.
|
|
241
|
+
- **`scripts/make-book-images.mjs` — the handbook figures are a build artifact now.** 48 files
|
|
242
|
+
(24 templates, dark and light) that had been hand-made and inherited ever since. The
|
|
243
|
+
generator renders them from the same `go-time-graph/test_data/*.json` the parity harness
|
|
244
|
+
uses, so the handbook shows exactly the charts that are checked. Proof that the
|
|
245
|
+
reconstruction is faithful: 46 of the 48 come out byte-identical to what was committed. The
|
|
246
|
+
other two are `threshold_no_label`, where the committed image predates the 1.6.0 fix and was
|
|
247
|
+
still missing the axis tick that fix restored — the handbook had been showing the bug.
|
|
248
|
+
- **`scripts/make-examples.mjs` — the gallery images are a build artifact now**, and there is a
|
|
249
|
+
fourth one: `ex4.svg` shows **annotation bands**. A state is not a measurement; it does not
|
|
250
|
+
belong in the plot as a fourth curve but as a strip *below* it, where it covers nothing and
|
|
251
|
+
you read in one line **when** something applied.
|
|
252
|
+
|
|
253
|
+
### Fixed
|
|
254
|
+
- **`ex1.svg` in the README showed a defect that 1.6.0 had fixed.** The image dated from
|
|
255
|
+
17 June and was never regenerated: a dip that starts and ends *on* the warning threshold was
|
|
256
|
+
drawn in the colour of the zone above it. Under the heading "zoned colouring", the picture
|
|
257
|
+
advertised the feature and displayed its bug. The series has been recovered from the old SVG
|
|
258
|
+
(the axes carry their scale, so the readings invert cleanly) and re-rendered — same chart,
|
|
259
|
+
correct colours, verified segment by segment against the threshold pixels. `ex2.svg` carried
|
|
260
|
+
`idfunction now() { [native code] }1` in its element ids, from a `Date.now` passed without the
|
|
261
|
+
call. An image nobody can regenerate ages quietly; these now come from the script, rendered
|
|
262
|
+
out of `dist/` — what the package actually ships.
|
|
263
|
+
- **Two gallery captions described something else than the image showed** (`ex1` was credited
|
|
264
|
+
with threshold fills it does not have; `ex2` is a min/max/avg band, not multi-zone fills).
|
|
265
|
+
- **The `SKILLS.md` link in both READMEs returned 404 on npmjs.com.** It was a *relative* link,
|
|
266
|
+
and npm rewrites those against the `repository` field into a path GitLab does not serve. The
|
|
267
|
+
file is right there in the package, but the place people actually click is the npm page.
|
|
268
|
+
Both READMEs now link absolutely, like every other link in them; each one was checked
|
|
269
|
+
afterwards and returns 200.
|
|
270
|
+
- **`homepage` in `package.json` pointed at GitHub** (`github.com/mlc0911/mlctimegraph`), which
|
|
271
|
+
is a 404 — the project lives on GitLab. That is the "Homepage" link in the npm sidebar, so
|
|
272
|
+
the first link a visitor takes was broken.
|
|
273
|
+
- **The product page metadata (`mlcprodweb/meta.yaml`) said 1.5.2** — five releases behind,
|
|
274
|
+
because `release.mjs` did not know about the file. It does now, so the page cannot fall
|
|
275
|
+
behind again. The same entry claimed 13 demos; there are 15.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## [1.7.1] - 2026-09-21
|
|
280
|
+
|
|
281
|
+
### Fixed
|
|
282
|
+
- **`toStepData` / `toStepPoints` are now actually exported** (via `ml-time-graph/internals`).
|
|
283
|
+
1.7.0 announced the staircase geometry as public so that a second output path would draw the
|
|
284
|
+
same step instead of deriving it again — and then shipped it reachable from nowhere. The Go
|
|
285
|
+
port had it right (`renderer.ToStepData`), which is exactly the asymmetry that lets two
|
|
286
|
+
derivations of the same step drift apart.
|
|
287
|
+
- **The link to the Go port in both READMEs returned 403.** It carried the Go *module path*
|
|
288
|
+
(`gitlab.com/mlc0911/mlctimegraph/go-time-graph`) as if it were a web address. `go get`
|
|
289
|
+
resolves it because the Go tooling appends `?go-get=1` and GitLab answers with a meta tag; a
|
|
290
|
+
browser gets no such treatment and GitLab reads the path as namespace/group/project. A
|
|
291
|
+
subdirectory needs the `/-/tree/<branch>/` form. Every absolute link in the published docs was
|
|
292
|
+
checked afterwards — all of them resolve.
|
|
293
|
+
|
|
294
|
+
### Removed
|
|
295
|
+
- **`packages/ml-time-graph/CHANGELOG.md` and `go-time-graph/CHANGELOG.md`.** Both stopped at
|
|
296
|
+
1.2.0 in August and had been telling readers ever since that the library stood still — while
|
|
297
|
+
five releases went out. Every entry in them was a word-for-word duplicate of this file, and
|
|
298
|
+
nothing linked to them. Both libraries ship in lockstep on one version number, so one
|
|
299
|
+
changelog is the honest number of changelogs. The READMEs now link here.
|
|
300
|
+
|
|
301
|
+
### Added
|
|
302
|
+
- **The PDF companion is mentioned in the package README** (and in `README.de.md` and
|
|
303
|
+
`SKILLS.md`). [mlctimegraph-pdf](https://gitlab.com/mlc0911/mlctimegraphpdf) is the second
|
|
304
|
+
consumer of the same draw commands and writes native PDF vectors — until now it was only
|
|
305
|
+
named in the monorepo README, which npm readers never see. Listed with what it is: 0.2.0, not
|
|
306
|
+
1.0, and a fill on a path still renders opaque and without its hatch there.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## [1.7.0] - 2026-09-21
|
|
311
|
+
|
|
312
|
+
### Fixed
|
|
313
|
+
- **Filled steps (`shape: "step"` + `style.fill`):** The area was built from the raw readings
|
|
314
|
+
and ran as a **ramp** underneath a step line — a triangle missing below every step, one too
|
|
315
|
+
many above it. That is precisely what a step is there to prevent for state-like quantities
|
|
316
|
+
(runtime, stage, operating mode): the fill claimed values nobody measured between two
|
|
317
|
+
readings, so a filled staircase could not be drawn at all. The step is now formed **in data
|
|
318
|
+
space**, before anything is split or drawn (`toStepData` / `ToStepData`): line, area and
|
|
319
|
+
hatch all use the same sequence of points. Both libraries had the same gap — a defect both
|
|
320
|
+
sides share is invisible to a parity comparison until a template shows it. The new
|
|
321
|
+
`step_filled` template shows it.
|
|
322
|
+
- **Zone colours on a step (`colorByThresholds` + `shape: "step"`):** The colour change sat at
|
|
323
|
+
the **interpolated** crossing time, with a horizontal piece at threshold level in between
|
|
324
|
+
that does not exist in the data. The boundary now cuts the vertical jump itself, at the
|
|
325
|
+
reading's timestamp.
|
|
326
|
+
- **No smoothing on a step:** A `smoothing: true` alongside `shape: "step"` is now ignored for
|
|
327
|
+
the line *and* the fill, instead of rounding off the very corners that make the step.
|
|
328
|
+
- **`style.line` as an array (`LineStyle[]`) — one spelling, two pictures:** "A step outline
|
|
329
|
+
plus a smoothed trend line" has been documented all along (USAGE.md, "Series"), and neither
|
|
330
|
+
library delivered it. TypeScript emitted N paths but never read `shape` there, so both layers
|
|
331
|
+
came out as ramps. Go read the shape of the FIRST entry and drew exactly ONE line; the second
|
|
332
|
+
layer was missing entirely. Both now draw N layers, each **in its own shape**: an entry
|
|
333
|
+
without a `shape` is a straight line and does not inherit the first one's step — otherwise
|
|
334
|
+
that exact combination would not be expressible. `seriesType: 'step'` still applies to every
|
|
335
|
+
layer without a shape of its own, and the first entry is the series' shape (fill, zones,
|
|
336
|
+
markers). The new `line_overlay` template holds both sides together.
|
|
337
|
+
- **`line: false` in the Go port:** The field was never read — an explicitly disabled line was
|
|
338
|
+
drawn anyway, which made ghost series impossible.
|
|
339
|
+
- **`opacity` on a line (Go):** was discarded and always written as 1. The value now passes
|
|
340
|
+
through per layer, as it does in TypeScript — the whole point of the array form, letting the
|
|
341
|
+
upper layer show the one below, depended on it.
|
|
342
|
+
- **Per-layer colour (Go):** Every layer would have carried the first entry's colour. The zone
|
|
343
|
+
colour (`colorByThresholds`) still wins over the layer's own colour.
|
|
344
|
+
|
|
345
|
+
### Added
|
|
346
|
+
- **Demo `demos/adapters.html` — "Input Adapters":** one chart built from tuples, a REST payload
|
|
347
|
+
in Unix seconds, a CSV export of strings with an empty cell, and a nested document.
|
|
348
|
+
- **Demo `demos/steps.html` — "Filled Steps":** the area under the staircase, the area against
|
|
349
|
+
a limit, enum states, and a step with a smoothed trend line on top — each with the optional
|
|
350
|
+
hatch, plus a step ↔ line switch.
|
|
351
|
+
- **Parity templates `step_filled` and `line_overlay`:** a filled step with two regions and
|
|
352
|
+
hatching; a step with a smoothed trend line above it. 34 templates now stand at 0/0.
|
|
353
|
+
- **`LineShape` (TS) / `LineStyleSpec.IsArray`, `FlatSeriesStyle.Opacity`, `IDSuffix` (Go):**
|
|
354
|
+
the types that make the array form distinguishable in the first place — `line: [{…}]` and
|
|
355
|
+
`line: {…}` hand out different SVG ids (`-line-<segment>-<layer>` vs `-line-<segment>`), and
|
|
356
|
+
without that field the port could not have told one form from the other.
|
|
357
|
+
- **`toStepData` (TS) / `renderer.ToStepData` (Go):** the staircase geometry as data — public,
|
|
358
|
+
so a second output path draws the same step instead of deriving it again.
|
|
359
|
+
- **`toDataPoints(rows, spec?)` and `toSeries(name, rows, spec?)` — input adapters.** `DataPoint`
|
|
360
|
+
stays strict, because scales, run splitting, zone cuts, the tooltip and the Go port all read
|
|
361
|
+
those two fields; widening the core would push that variance through every one of them. The
|
|
362
|
+
give belongs at the boundary, and until now every caller wrote that `.map()` themselves. The
|
|
363
|
+
adapter takes `[time, value]` tuples, objects with foreign field names (`{ time: 'ts', value:
|
|
364
|
+
'val' }`) and accessor functions for anything nested. Numeric timestamps are milliseconds
|
|
365
|
+
unless `timeUnit: 's'` or `'auto'` says otherwise — and `'auto'` deliberately leaves a relative
|
|
366
|
+
time base (0, 1000, 2000 …) alone instead of shifting it by a factor of 1000. ISO strings and
|
|
367
|
+
`Date`s are recognised on their own, numeric strings are converted, and a missing reading
|
|
368
|
+
(`null`, `undefined`, `NaN`, `''`) becomes a **gap** rather than a zero — a chart must not
|
|
369
|
+
claim a value the sensor never reported. Anything genuinely broken throws and names the row.
|
|
370
|
+
See the new `demos/adapters.html`: the same chart from four input shapes.
|
|
371
|
+
|
|
372
|
+
### Changed
|
|
373
|
+
- **`API_DESIGN.md` is no longer part of the npm package** and is now `DESIGN_NOTES.md`. It
|
|
374
|
+
called itself "API reference (v1.0.0)" but was a **target** design from the cleanup phase: it
|
|
375
|
+
described a `Series { points }` without `seriesType` that never existed, `view` instead of
|
|
376
|
+
`showAs`, two Y axes instead of arbitrarily many, a `src/analyze/` (long since its own
|
|
377
|
+
package) and CJS exports (the library is ESM only). Anyone typing out its examples got code
|
|
378
|
+
that does not compile — and it shipped in every tarball since 1.0.0. What is kept is what was
|
|
379
|
+
recorded nowhere else: principles P1–P9 and the resolved decisions Q1–Q11 with their
|
|
380
|
+
reasoning, each with today's status beside it, including where that status contradicts the
|
|
381
|
+
decision. The phase-by-phase cleanup log is condensed to one paragraph; the full version
|
|
382
|
+
lives in the git history. `USAGE.md` is the user documentation, the generated types are
|
|
383
|
+
binding.
|
|
384
|
+
- **Six `§` references in the source pointed nowhere** — the numbering had shifted, so "fills
|
|
385
|
+
§6" landed on the axes and "theme §12" on the options. They now name a section in `USAGE.md`
|
|
386
|
+
instead of a number that moves again with the next insertion.
|
|
387
|
+
- **`QUICKSTART_GRAPH_BUILDER.md`, `QUICKSTART_GRAPH_BUILDER.de.md` and
|
|
388
|
+
`GRAPH_JSON_STRUCTURE.md` now ship with the npm package** (20 files instead of 17). They used
|
|
389
|
+
to live in the repository only, while linking `USAGE.md` and each other — whoever unpacked
|
|
390
|
+
the package had neither the graph-builder walkthrough nor the full JSON form. Every link
|
|
391
|
+
inside the tarball now resolves to a file inside it. A link to a `GRAPH_JSON_STRUCTURE.de.md`
|
|
392
|
+
that never existed turned up on the way; it points at the English version now.
|
|
393
|
+
|
|
394
|
+
### Removed
|
|
395
|
+
- **`API_DESIGN.md.merged` and `chunks/API_DESIGN-part-*.md`:** md-splitter working files,
|
|
396
|
+
committed by accident — a second copy of the same text that had already started to diverge.
|
|
397
|
+
`chunks/` and `*.md.merged` are in `.gitignore` now.
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## [1.6.0] - 2026-09-21
|
|
402
|
+
|
|
403
|
+
### Added
|
|
404
|
+
- **Automatic gap detection in Go (`gaps.autoDetect`):** The Go port now supports
|
|
405
|
+
`gaps.autoDetect: true` with configurable `minGapMs`, matching TypeScript parity.
|
|
406
|
+
- **Marker `lineStyle: "none"`:** Added support for standalone point markers without
|
|
407
|
+
projection lines.
|
|
408
|
+
- **Companion project for PDF output:** [mlctimegraph-pdf](https://gitlab.com/mlc0911/mlctimegraphpdf)
|
|
409
|
+
consumes the same draw commands and writes native PDF vectors — no browser, no SVG parsing.
|
|
410
|
+
Linked from the README as the worked example of what the command-based engine is for.
|
|
411
|
+
- **`renderer.SmoothPath` (Go):** The Catmull-Rom geometry behind smoothed lines is now
|
|
412
|
+
exported as `SmoothPath(points, smoothing, smoothCount) (segments, straight)`, returning
|
|
413
|
+
cubic Bézier segments plus the remaining straight points. The SVG renderer uses the same
|
|
414
|
+
function, so a second output format (PDF) draws the identical curve instead of
|
|
415
|
+
re-deriving it. Control-point rounding is part of the result, not of the SVG formatting.
|
|
416
|
+
- **`ZoneLow` / `zoneLow` on `SplitSegment`:** Explicit lower boundary field on segments
|
|
417
|
+
produced by `splitByBoundaries` / `SplitByBoundaries` in both TypeScript and Go.
|
|
418
|
+
- **12 Edge-Case Fixtures & Golden Templates:** Added comprehensive parity templates
|
|
419
|
+
covering unsorted thresholds, gap detection, steep crossings, step threshold splits,
|
|
420
|
+
single-point aggregations, separate legends, constant values, duplicate timestamps,
|
|
421
|
+
and annotation band overflows (32 total parity test suites passing with 0 diffs).
|
|
422
|
+
|
|
423
|
+
- **`title` on annotation band items:** An item can carry a hover tooltip, rendered as an
|
|
424
|
+
SVG `<title>` child of its rectangle (`SetTitle(...)` in Go, `title` in TypeScript).
|
|
425
|
+
It holds the detail that does not fit as a printed label — a full id, exact times, a
|
|
426
|
+
duration. Interactive only: PDF and raster output drop it, so a chart must stay readable
|
|
427
|
+
without it. `<title>` makes the rectangle a paired element; items without one are
|
|
428
|
+
unchanged and still self-closing.
|
|
429
|
+
|
|
430
|
+
### Changed
|
|
431
|
+
- **`legend.position: "separate"` renders no SVG overlay in Go:** In parity with TypeScript,
|
|
432
|
+
a separate legend delegates rendering entirely to external HTML/DOM callers.
|
|
433
|
+
- **`gapThreshold` actively breaks lines in Go:** `style.line.gapThreshold` in Go now splits
|
|
434
|
+
series segments when time differences exceed the threshold, matching TypeScript behaviour.
|
|
435
|
+
|
|
436
|
+
### Fixed
|
|
437
|
+
- **An annotation band item shorter than one pixel was not drawn at all.** Both ports
|
|
438
|
+
skipped it (`if endX - startX < 1`), and how short that is depends entirely on the
|
|
439
|
+
window: half a minute in a six-hour chart of 800px, a quarter of an **hour** in a
|
|
440
|
+
seven-day one. A five-minute outage was simply absent from the weekly view — not
|
|
441
|
+
shortened, not a hairline: gone. For a chart used as evidence that is the one failure
|
|
442
|
+
mode that must not exist, because a reader cannot notice what was never drawn. Such an
|
|
443
|
+
item is now drawn one pixel wide, clamped to stay inside the plot. One pixel claims no
|
|
444
|
+
duration — the exact times are the item's own data — it says “here was something”.
|
|
445
|
+
Items lying entirely outside the window are still dropped; that is a different
|
|
446
|
+
statement. Found in mlcsensormonitor on 20.09.2026, on a report with 32 events in six
|
|
447
|
+
hours.
|
|
448
|
+
|
|
449
|
+
- **Thresholds without `label` no longer suppress axis ticks:** Suppressing ticks required an
|
|
450
|
+
explicit label string; unlabelled thresholds no longer trigger nil pointer crashes in Go or
|
|
451
|
+
suppress neighbouring axis tick values.
|
|
452
|
+
- **Multi-axis marker projection targeting correct value scale:** Standalone markers targeting
|
|
453
|
+
series on secondary or arbitrary Y-axes (`seriesIndex > 0`) now map against the target series'
|
|
454
|
+
scale instead of erroneously projecting onto axis 0.
|
|
455
|
+
- **Zoned line coloring with unsorted thresholds:** Zone colors are now resolved using `ZoneLow`
|
|
456
|
+
and the highest reached boundary, rather than the caller's input slice ordering.
|
|
457
|
+
- **Zoned fills for dips and peaks returning to the same threshold:** Corrected `above` / `below`
|
|
458
|
+
determination for segments whose endpoints start and end on the boundary value.
|
|
459
|
+
- **Duplicate boundary intersection points:** Eliminated duplicate points and empty 2-point
|
|
460
|
+
segments in `splitByBoundaries` (TS) and `SplitByBoundaries` (Go) when crossing values coincide.
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## [1.5.2] - 2026-09-19
|
|
465
|
+
|
|
466
|
+
### Fixed
|
|
467
|
+
- **A dip that returns to the same threshold was coloured as if it were above it.**
|
|
468
|
+
`colorByThresholds` derived a segment's zone from the *mean of its endpoints*. A
|
|
469
|
+
spike below the lowest threshold starts and ends exactly ON it, so the mean landed
|
|
470
|
+
on the boundary and `>=` counted it as “above”: the whole excursion was drawn in
|
|
471
|
+
the colour of the zone above, while the markers of the same points carried the
|
|
472
|
+
right one. On a chart used as evidence, green where it was not in order is the
|
|
473
|
+
worst statement a picture can make. The zone now comes from the split itself
|
|
474
|
+
(`splitByBoundaries` already computes it from the crossing).
|
|
475
|
+
|
|
476
|
+
- **`FillRegion.outer` limits a fill; it no longer filters it.** It used to drop
|
|
477
|
+
every sub-segment that ran past the outer bound. For a zone corridor — “fill
|
|
478
|
+
between the line and the warning limit, but never past the hard limit” — that
|
|
479
|
+
tore a HOLE exactly where the excursion was worst. It now clamps: the fill stops
|
|
480
|
+
at the bound and what lies beyond belongs to the next region. Anyone who really
|
|
481
|
+
wants to filter can say so with two regions.
|
|
482
|
+
|
|
483
|
+
Both found in mlcsensormonitor on 19.09.2026, both invisible until a fixture
|
|
484
|
+
provoked them: no template had data crossing a colour threshold and returning, and
|
|
485
|
+
none used `outer` at all. The new fixture `fill_outer_clamp` covers both. No
|
|
486
|
+
existing golden changed.
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## [1.5.1] - 2026-09-19
|
|
491
|
+
|
|
492
|
+
### Fixed
|
|
493
|
+
- **The Go port drew a grid when none was configured**, while TypeScript drew
|
|
494
|
+
none — the same JSON produced two different charts. Now both follow the
|
|
495
|
+
TypeScript rule: a grid appears only when `axes.x.grid.major` or
|
|
496
|
+
`axes.left.grid.major` is set, and setting either gives both axes one.
|
|
497
|
+
|
|
498
|
+
It went unnoticed for as long as it did because *every* fixture set the grid
|
|
499
|
+
explicitly; it surfaced the moment a new one left it out (19.09.2026). No
|
|
500
|
+
existing golden changed — which is the proof that only the previously
|
|
501
|
+
undefined case is affected. The new fixture `grid_default` pins it.
|
|
502
|
+
|
|
503
|
+
**If you use the Go port and rely on the implicit grid, set it explicitly**
|
|
504
|
+
before upgrading: `axes: { x: { grid: { major: {} } }, left: { grid: { major: {} } } }`.
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## [1.5.0] - 2026-09-19
|
|
509
|
+
|
|
510
|
+
### Changed
|
|
511
|
+
- **A series is clipped to the plot area** (`clipSeries`, default `true`; set it to
|
|
512
|
+
`false` to opt out — every clipped group carries a `clip-path` and a browser may
|
|
513
|
+
give it its own layer, which is nothing for a handful of series and worth
|
|
514
|
+
measuring for dozens). Only thresholds were clipped before,
|
|
515
|
+
because series data is practically always inside the domain — with an automatic
|
|
516
|
+
domain it cannot be otherwise. The moment a caller *fixes* the time axis and
|
|
517
|
+
passes points outside it (the last reading before the window, so the curve runs
|
|
518
|
+
to the edge instead of starting in mid-air), the series painted into the axis
|
|
519
|
+
gutter: line and markers sat on top of the axis labels. A canvas that does not
|
|
520
|
+
keep to its own bounds makes every fixed range unusable. TS and Go; the fixture
|
|
521
|
+
goldens gained the clip and nothing else. Two new fixtures (`series_clip`,
|
|
522
|
+
`series_clip_off`) pin both switch positions — until now no fixture had data
|
|
523
|
+
outside its range, which is why nobody noticed. A demo card shows both side by
|
|
524
|
+
side (Styles → “Clipping against a fixed time axis”).
|
|
525
|
+
- **A threshold is no longer labelled with its own name.** Leaving `label` out used
|
|
526
|
+
to mean “paint the name”. But `name` is an IDENTIFIER — it wires
|
|
527
|
+
`colorByThresholds`, fill regions and CSS classes — so an invisible anchor
|
|
528
|
+
(`line: 'none'`, used to colour a line by zone) shouted its internal name into
|
|
529
|
+
the chart: `z_hi`, `w_lo` right next to real captions like “Grenze ↑ 8”. That is
|
|
530
|
+
not a default, it is a leak. Now: nothing given, nothing drawn. `label: true`
|
|
531
|
+
asks for the name explicitly, a string or `{ text }` sets your own, and
|
|
532
|
+
`label: false` keeps working. TS and Go, one contract.
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## [1.4.0] - 2026-09-18
|
|
537
|
+
|
|
538
|
+
### Added
|
|
539
|
+
- **`getLineStyle` and `drawMarker` are public** (TypeScript). Both were internal,
|
|
540
|
+
and both are exactly what a caller needs to draw its **own** legend: a swatch
|
|
541
|
+
has to show the same dash pattern and the same symbol as the curve it names.
|
|
542
|
+
The built-in legend is left/right only and not clickable, so callers do draw
|
|
543
|
+
their own — and until now each of them re-implemented the dash table on the
|
|
544
|
+
outside. Such a copy drifts silently: the swatch then advertises a line the
|
|
545
|
+
chart does not contain, which only shows up on a black-and-white print, where
|
|
546
|
+
colour no longer tells the series apart. `drawMarker` emits `DrawCommand`s;
|
|
547
|
+
feed them to the already-exported `SVGRenderer` for SVG. The Go port keeps both
|
|
548
|
+
helpers internal for now; no renderer changed for this one.
|
|
549
|
+
- **`opaqueColor` / `hasAlpha`** (TypeScript, `patterns/hatch.js`): the two colour
|
|
550
|
+
rules the hatch derivation below is built on, exported so a caller can follow
|
|
551
|
+
the same rule. Mirrored 1:1 in Go (`pkg/renderer`, unexported).
|
|
552
|
+
- **`resolveDash(variant, strokeWidth?, dashed?)`** (TypeScript): what the renderer
|
|
553
|
+
*actually* draws, including the two historical exceptions — `dashed` and `dotted`
|
|
554
|
+
keep their fixed `"4,4"` / `"2,4"` patterns, everything else comes from the
|
|
555
|
+
scale-aware table. It used to be a private method of `SVGRenderer`, so a caller
|
|
556
|
+
drawing its own legend had to re-derive it and got `getLineStyle`'s `"6, 4"` for
|
|
557
|
+
`dashed`: a swatch dashed 6-on-4 beside a curve dashed 4-on-4. The renderer now
|
|
558
|
+
calls the exported function — one rule, one place. Output is byte-identical.
|
|
559
|
+
- **`LegendItem` carries `line` and `marker`** (TS + Go): the line variant of the
|
|
560
|
+
series and its marker shape, so `chart.legendItems()` is enough to draw a legend
|
|
561
|
+
that matches the curves. `marker` is omitted when the chart does not actually
|
|
562
|
+
draw one (a series whose `markers.threshold` hides them above n samples) —
|
|
563
|
+
a symbol in the legend that is missing from the chart states something untrue.
|
|
564
|
+
Both fields are optional and the built-in legend ignores them: nothing rendered
|
|
565
|
+
changes.
|
|
566
|
+
- **`LegendItem` and `DrawCommand` are exported from the main entry.** Both are
|
|
567
|
+
the types of main-entry functions (`chart.legendItems()`, `drawMarker`), so the
|
|
568
|
+
recipe below could not be written in typed code without them. The rest of the
|
|
569
|
+
DrawCommand model stays behind `/internals`.
|
|
570
|
+
- **Docs: „Drawing your own legend"** — USAGE.md gets the recipe and the reason a
|
|
571
|
+
coloured block stops working as soon as series differ by more than colour (any
|
|
572
|
+
print, any red-green deficiency); the manual (`book/`, chapter 4) gets the same
|
|
573
|
+
in prose. The legend demo now draws the swatch that way and hides a series on
|
|
574
|
+
click — it used to demonstrate the coloured block.
|
|
575
|
+
|
|
576
|
+
### Changed
|
|
577
|
+
- **A hatch now takes the colour of the area it marks** (TS + Go). The pattern
|
|
578
|
+
lines were always `#4D88FF` — blue hatching on a red zone, on charts whose
|
|
579
|
+
colours *are* the statement. An extra colour there does not decorate, it says
|
|
580
|
+
something, and what it said was nothing. The lines now use the fill's colour at
|
|
581
|
+
full strength; a translucent fill stays the backdrop as given, an opaque one is
|
|
582
|
+
drawn at 30 % so the lines have something to stand out against. A caller that
|
|
583
|
+
wants a different line colour still passes one to `getHatch`.
|
|
584
|
+
|
|
585
|
+
`getHatch`'s `linecolor` parameter therefore no longer defaults to blue — it is
|
|
586
|
+
optional, and left out means "derive from the fill". The only fixture affected
|
|
587
|
+
is `hatch_patterns`; its Go golden was regenerated and parity re-checked.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## [1.3.3] - 2026-09-04
|
|
592
|
+
|
|
593
|
+
> **1.3.2 was skipped.** The tags `v1.3.2` and `go-time-graph/v1.3.2` were pushed by
|
|
594
|
+
> mistake onto the commit *before* the version bump. `proxy.golang.org` had already
|
|
595
|
+
> fetched them, and its content is immutable — moving them would have caused checksum
|
|
596
|
+
> errors for everyone who had pulled the module. So the Go tag `v1.3.2` exists and
|
|
597
|
+
> carries every change of this release; only `pkg/version.Version` still reports 1.3.1
|
|
598
|
+
> there. There is no 1.3.2 on npm.
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
### Added
|
|
602
|
+
- **`scripts/render-book-images.mts`**: renders every fixture twice — light and
|
|
603
|
+
dark — into `book/images/`. There was no script at all before; the eighteen
|
|
604
|
+
figures in the manual were hand-copied Go goldens, which is why they were
|
|
605
|
+
stale the moment a renderer changed and why every one of them carried the
|
|
606
|
+
white background the golden test paints (`SetBackgroundColor("white")`) — a
|
|
607
|
+
white box on mlcgo.eu's dark pages. Both sets now come out of one run:
|
|
608
|
+
missing one of them would show a gap, not the other version.
|
|
609
|
+
|
|
610
|
+
### Fixed
|
|
611
|
+
- **`setDefaultTheme()` only half worked (TS)**: `style/resolver.ts` read the
|
|
612
|
+
runtime theme, the other 132 accesses in the render path read the static
|
|
613
|
+
object from `theme/defaults.ts` — so setting a theme changed the series
|
|
614
|
+
colour and left the axes, grid, labels and legend alone. Worse than no theme
|
|
615
|
+
at all, and the documented example in `theme/runtime.ts` promised the
|
|
616
|
+
opposite. The `theme` facade now reads the runtime value.
|
|
617
|
+
- **`seriesType: "step"` drew a ramp, in both libraries (TS + Go)**: the older,
|
|
618
|
+
documented way to ask for a step chart was assigned, described in the model
|
|
619
|
+
docs — and read by nobody on the render path. Go never looked at
|
|
620
|
+
`SeriesType`; in TS `style/resolver.ts` knew the mapping but `MLTimeGraph`
|
|
621
|
+
took a different route and never asked it. `style.line.shape: "step"` was the
|
|
622
|
+
only thing that worked. The canonical `step_sensor` example therefore drew
|
|
623
|
+
diagonal transitions instead of steps — and the parity check could not see
|
|
624
|
+
it, because both libraries were wrong in the same way. A comparison of two
|
|
625
|
+
implementations finds no fault they share.
|
|
626
|
+
|
|
627
|
+
## [1.3.1] - 2026-09-04
|
|
628
|
+
|
|
629
|
+
### Fixed
|
|
630
|
+
- **Crash on a threshold without a label (Go)**: `Threshold.Label` is a pointer
|
|
631
|
+
and `nil` is the normal case — a threshold configured without an explicit
|
|
632
|
+
label. The tick-suppression pass added in 1.3.0 dereferenced it unchecked, so
|
|
633
|
+
`RenderCommands` panicked on every such chart. Found while integrating 1.3.0
|
|
634
|
+
into mlcsensor; a regression test now covers it.
|
|
635
|
+
- **A threshold without a label drew nothing in the Go port (Go)**: `nil` was
|
|
636
|
+
read as "no label" while the TypeScript side has always read it as "label
|
|
637
|
+
from the threshold's name" (`threshold_renderer.ts`: `if (t.label !== false)`
|
|
638
|
+
with `labelObj?.text ?? t.name`). The same JSON therefore produced a labelled
|
|
639
|
+
line in the browser and a bare one on the server — in the most common
|
|
640
|
+
configuration of all. Only an explicit `label: false` suppresses it now.
|
|
641
|
+
New fixture `threshold_no_label` covers the case in the parity test, which is
|
|
642
|
+
why nobody noticed: every existing fixture sets a label.
|
|
643
|
+
|
|
644
|
+
## [1.3.0] - 2026-09-04
|
|
645
|
+
|
|
646
|
+
Includes everything that was bumped to 1.2.1 and 1.2.2 in `package.json` but never tagged and never
|
|
647
|
+
published — npm and the Go module both went from 1.2.0 straight to this release.
|
|
648
|
+
|
|
649
|
+
This release **changes what is drawn**, on both sides. Most of it is a rendering difference between
|
|
650
|
+
the two libraries being removed — the same JSON now produces the same chart in TypeScript and in Go
|
|
651
|
+
across all thirteen reference configurations, checked element by element on every test run. The
|
|
652
|
+
visible changes are listed under *Changed* and *Fixed*; the one to read before upgrading is the new
|
|
653
|
+
id scheme.
|
|
654
|
+
|
|
655
|
+
### Added
|
|
656
|
+
- **Marker shapes `plus`, `triangle-down`, `hexagon`, `hourglass` and `line-horizontal` for series,
|
|
657
|
+
in both libraries**: they only ever existed in the TypeScript annotation renderer. A series could
|
|
658
|
+
not use them, and the Go port did not know them at all — a `pointStyle: "hexagon"` silently fell
|
|
659
|
+
through to a circle there.
|
|
660
|
+
|
|
661
|
+
### Changed
|
|
662
|
+
- **Series id scheme (TS + Go, breaking)**: the prefix of every element id of a series was a
|
|
663
|
+
timestamp in TS (`id1788523516216-…`, different on every render) and the raw series name in Go
|
|
664
|
+
(`Temperatur (min/max/avg)-…` — with spaces and parentheses, not a valid id). Both sides now
|
|
665
|
+
derive it the same way: an explicit `id` from the configuration verbatim, otherwise
|
|
666
|
+
`s-<crc32 of the name>`. The same checksum in both languages, so a chart rendered on the server
|
|
667
|
+
and one rendered in the browser address the same elements. **If you select elements by id, your
|
|
668
|
+
selectors need updating.**
|
|
669
|
+
- **One marker drawing routine instead of two (TS)**: `annotation/marker.ts` kept its own. The same
|
|
670
|
+
`pointStyle` looked different depending on where it came from, and an annotation point had no
|
|
671
|
+
outline while a series point did. Annotations now use the same routine as series, which gives an
|
|
672
|
+
annotation point a 1.5px outline — 0.75px larger than before, and exactly what the Go port has
|
|
673
|
+
always drawn.
|
|
674
|
+
- **Per-series group in the Go port (Go)**: the port set no id on the `<g>` and wrote the raw name
|
|
675
|
+
into the class attribute — `class="series series-Solid Line"` is in fact three classes. Now as in
|
|
676
|
+
TS: `<g class="series series--solid-line" id="series-solid-line">`, so a whole measurement series
|
|
677
|
+
can be shown or hidden through one selector.
|
|
678
|
+
- **Axis stroke width (TS)**: `axes.*.axis.width` now defaults to `1` instead of `undefined`, so
|
|
679
|
+
the SVG carries `stroke-width="1"` on the axis line and its ticks. The Go port has always used
|
|
680
|
+
that default. The line looks the same — 1 is the SVG default — but the two outputs no longer
|
|
681
|
+
differ on every axis line, and an inherited `line { stroke-width: … }` from the embedding page no
|
|
682
|
+
longer drags the axis along.
|
|
683
|
+
- **Tooltip performance (from 1.2.1)**: `mousemove` is coalesced through `requestAnimationFrame`,
|
|
684
|
+
and `Intl` formatters are cached (`src/intl_cache.ts`).
|
|
685
|
+
- **Cleanup (from 1.2.2)**: refactoring for large time series, generated docs, formatting.
|
|
686
|
+
|
|
687
|
+
### Fixed
|
|
688
|
+
- **`showAs: "minmaxavg"` in the Go port (Go)**: the port never evaluated `showAs`. An aggregated
|
|
689
|
+
series was reduced to its averages and drawn as one ordinary line in the default colour — no
|
|
690
|
+
boundaries, no fill, and `minColor`, `maxColor`, `avgColor`, `avgDashed`, `fillToMax`,
|
|
691
|
+
`fillToMin` were all ignored. The same JSON produced two entirely different pictures.
|
|
692
|
+
`renderer.RenderMinMaxAvg` now draws what the TypeScript side draws.
|
|
693
|
+
- **Marker lines and labels in the Go port (Go)**: `YRange` arrives as `[bottom, top]`, but the
|
|
694
|
+
names in the marker renderer were assigned by position — and were therefore swapped. A
|
|
695
|
+
`to-value` line ran from the top edge down to the point instead of up from the baseline,
|
|
696
|
+
`to-top` the other way round, and a marker label ended up at `yTop - 6`, i.e. **below** the plot
|
|
697
|
+
area (y=354 instead of y=14).
|
|
698
|
+
- **`style.line.shape: "step"` (TS)**: the type knew the field and `renderStep()` existed — nobody
|
|
699
|
+
in `MLTimeGraph` ever read it. A series configured as a step chart came out as a straight line in
|
|
700
|
+
the browser while the Go port drew the steps.
|
|
701
|
+
- **`colorByThresholds` against an explicit line colour (TS)**: the zone colour only applied when
|
|
702
|
+
no `style.line.color` was set, which made the option silently useless in almost every real
|
|
703
|
+
configuration. The base colour is now the default that the zone colour overrides, as in the Go
|
|
704
|
+
port.
|
|
705
|
+
- **Threshold references by id (TS)**: the lookup table was keyed by name only. A `fillSpec`
|
|
706
|
+
referring to a threshold by its `id` did not find it and threw — `thresholds_fill_demo` could not
|
|
707
|
+
be rendered in TypeScript at all, while the port produced the chart. The key is now the id, else
|
|
708
|
+
the name, as in the port and as for a threshold's CSS class.
|
|
709
|
+
- **Axis titles in the Go port (Go)**: `axes.{left,right,x}.label` was never drawn — the field
|
|
710
|
+
exists in the model, nobody read it. A chart with "Temp (°C)" on the left axis came out of the
|
|
711
|
+
backend without that title.
|
|
712
|
+
- **Grid style in the Go port (Go)**: `axes.*.grid.major.{color,width,opacity,style}` was ignored,
|
|
713
|
+
the port always used the theme values. A dashed grid at half opacity came out as a solid line at
|
|
714
|
+
full opacity.
|
|
715
|
+
- **Tick labels overprinted by threshold labels (Go)**: a threshold at 20 carrying a label
|
|
716
|
+
("WARNING HIGH (20°C)") and the axis tick at the same height ("20") were drawn on top of each
|
|
717
|
+
other. The axis could prevent that all along — `ValueAxisConfig.SuppressLabelsNear` exists — but
|
|
718
|
+
nobody filled it in. The TypeScript side has done so since 7859993.
|
|
719
|
+
- **Marker stroke width and colour in the Go port (Go)**: `style.markers.stroke`, `.fill` and
|
|
720
|
+
`.strokeWidth` were not passed through at all — a configured marker colour had no effect — and
|
|
721
|
+
without one the stroke width was missing entirely instead of the theme's 1.5.
|
|
722
|
+
- **Duplicate ids on aggregated series (TS + Go)**: a minmaxavg series with a data gap is split
|
|
723
|
+
into several runs, and every run received the same ids — `<id>-max-line-0` appeared twice in one
|
|
724
|
+
document. Ids have to be unique: `getElementById` otherwise returns whichever element it finds
|
|
725
|
+
first, and `#id` in a stylesheet matches only one of the two. The fills now carry the run index
|
|
726
|
+
themselves (`-fillToMax-<run>-fill-0`), the lines get it through the segment index `renderLine`
|
|
727
|
+
appends anyway (`-max-line-0`, `-max-line-1`). Side effect: all fills now sit behind all lines
|
|
728
|
+
instead of only behind those of their own run.
|
|
729
|
+
- **Series id (TS)**: `"id" + Date.now + …` — without the parentheses. Every series without an id
|
|
730
|
+
of its own was therefore called `idfunction now() { [native code] }<n>`; with spaces and braces
|
|
731
|
+
that is not a valid id, and those elements were reachable neither through `getElementById` nor
|
|
732
|
+
through a CSS selector.
|
|
733
|
+
- **Gap labels (TS)**: the SVG renderer wrote `textBaseline="middle"` — that is the Canvas API
|
|
734
|
+
name; in SVG the attribute is called `dominant-baseline`. The browser ignored it silently and the
|
|
735
|
+
label sat vertically off its intended position. The Go port was never affected.
|
|
736
|
+
- **Alignment of text edges (TS + Go)**: `textBaseline: "top" | "bottom"` was passed through to
|
|
737
|
+
`dominant-baseline` unchanged. Those are not valid values there, the browser fell back to `auto`,
|
|
738
|
+
and the label sat on its baseline instead of at the intended edge. Both libraries now map to
|
|
739
|
+
`text-top` / `text-bottom`.
|
|
740
|
+
- **Star shape of annotation markers (TS)**: an annotation's star was drawn with inner radius 0.4,
|
|
741
|
+
a series' star with 0.5 — the same `pointStyle: "star"` looked different depending on where it
|
|
742
|
+
came from. Both are 0.5 now, as in the Go port.
|
|
743
|
+
- **Hatch pattern numbering (Go)**: the port counted from 1, the TypeScript side from 0 — the same
|
|
744
|
+
drawing referred to `hatch-dots-0` in the browser and `hatch-dots-1` on the server.
|
|
745
|
+
- **Mini axis of an annotation band in the Go port (Go)**: it was written into the band as loose
|
|
746
|
+
lines instead of its own `annotation-band-axis` group, as the TypeScript side does — it could not
|
|
747
|
+
be addressed as a whole.
|
|
748
|
+
- **Smoothing control points (TS)**: after rounding to two decimals the renderer truncated again at
|
|
749
|
+
three (`Math.trunc(x * 1000) / 1000`). That could not improve anything but could make it worse:
|
|
750
|
+
259.83 is not exact in binary, times 1000 gives 259829.99999999997, and out came 259.829. The
|
|
751
|
+
step is gone.
|
|
752
|
+
- **Zone crossing timestamps (TS)**: rounded to whole milliseconds. The Go port cannot do otherwise
|
|
753
|
+
— its timestamp is an `int64` — and without the rounding the crossing points of the two libraries
|
|
754
|
+
drifted apart from the sixth decimal onwards.
|
|
755
|
+
- **Large data series (from 1.2.1)**: `Math.min(...arr)` / `Math.max(...arr)` replaced with
|
|
756
|
+
explicit loops. The spread blows the call stack on long series
|
|
757
|
+
(`RangeError: Maximum call stack size exceeded`).
|
|
758
|
+
|
|
759
|
+
## [1.2.0] - 2026-08-28
|
|
760
|
+
|
|
761
|
+
### Added
|
|
762
|
+
- **Configurable Axis Offsets**: Added `offset?: number` (TS) and `Offset *float64` (Go) to `YAxisConfig` for explicit pixel placement of stacked vertical axes, eliminating label collisions when using custom units/formatters.
|
|
763
|
+
- **Go Interactive Coordinate Math**: Added `Project(timeMs, value, axisIndex)`, `InvertTime(px)`, and `InvertValue(py, axisIndex)` methods to Go's `MLTimeGraph` for 1:1 parity with the TypeScript interactive calculations.
|
|
764
|
+
- **Fluent Builder Extensions**:
|
|
765
|
+
- TypeScript `TimeSeriesBuilder`: Added `setYAxisIndex()`, `setColor()`, and `setData()`.
|
|
766
|
+
- Go `GraphBuilder` & `TimeSeriesBuilder`: Added `AddSeries()`, `SetYAxis()`, `SetYAxisIndex()`, `SetLineColor()`, and `SetColor()`.
|
|
767
|
+
- **Interactive Multi-Axis Demo**: Added comprehensive multi-axis examples to the demo gallery (`demos/src/demos/multi-axis.ts`), including an Environmental Station (4 axes: 2 left, 2 right) and Industrial Telemetry Dashboard (4 axes: 1 left, 3 right stacked) with external HTML legends.
|
|
768
|
+
|
|
769
|
+
### Fixed
|
|
770
|
+
- **Time-Axis Baseline Span**: Fixed horizontal time-axis baseline rendering in both TypeScript (`TimeAxis.render`) and Go (`TimeAxis.Render`) to span the complete chart plot width (`[x0, x1]`) instead of cutting off at the last tick coordinate.
|
|
771
|
+
- **Multi-Axis Placement Parity**: Fixed an issue where vertical axes with index $\ge 2$ were forced to the right side; both engines now respect `position: "left" | "right"` for any index.
|
|
772
|
+
- **Demo Container Widths**: Adjusted zoom and rolling MKT demo charts to fit within card container boundaries with dynamic viewBox ratio calculations for brush interactions.
|
|
773
|
+
- **Internationalization**: Translated all German UI text, demo titles, descriptions, and code comments to English.
|
|
774
|
+
|
|
775
|
+
### Changed
|
|
776
|
+
- **Modularized Graph Builders**: Refactored monolithic `graph_builder.ts` into modular classes under `packages/ml-time-graph/src/builders/`.
|
|
777
|
+
- **Modularized Spatial Math**: Refactored `spatial.ts` in `ml-time-analyze` into a structured module under `src/spatial/`.
|
|
778
|
+
- **Code Formatting**: Adopted Prettier across all TypeScript and JavaScript sources.
|
|
779
|
+
- **Documentation**: Updated `USAGE.md`, `BUILDER.md`, `JSON_CONFIG.md`, `API_REFERENCE.md`, and READMEs with multi-axis and coordinate conversion guides.
|
|
780
|
+
|
|
781
|
+
---
|
|
782
|
+
|
|
783
|
+
## [1.1.1] - 2026-08-28
|
|
784
|
+
|
|
785
|
+
### Added
|
|
786
|
+
- **`attachTooltip` Documentation & API**: Detailed usage guide for tooltip integration, hover picks, and server-side DOM-free SVG export.
|
|
787
|
+
- **`SKILLS.md` Guide**: 60-second architecture map and workflow guide for developers and agents.
|
|
788
|
+
|
|
789
|
+
### Fixed
|
|
790
|
+
- **Tooltip Viewport Flipping**: Improved tooltip positioning to flip automatically across cursor axes when nearing plot area edges.
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
## [1.1.0] - 2026-08-28
|
|
795
|
+
|
|
796
|
+
### Added
|
|
797
|
+
- **Go Locale-Aware Time Formatting**: Added dependency-free i18n date/time formatting for Go (`en-US`, `de-DE`, `fr-FR`, `es-ES`, etc.).
|
|
798
|
+
|
|
799
|
+
### Fixed
|
|
800
|
+
- **Value Axis Tick De-duplication**: Resolved duplicate rounded tick labels on value axes with small numeric domains.
|
|
801
|
+
- **Annotation Band Vertical Alignment**: Centered labels vertically within annotation bands across TypeScript and Go.
|
|
802
|
+
|
|
803
|
+
---
|
|
804
|
+
|
|
805
|
+
## [1.0.7] - 2026-08-28
|
|
806
|
+
|
|
807
|
+
### Added
|
|
808
|
+
- **Lockstep Release Workflow**: Unified versioning across `packages/ml-time-graph` and `go-time-graph`.
|
|
809
|
+
- **SVG Baseline Gallery**: Comprehensive golden rendering test suite for Go chart rendering.
|