ml-time-graph 1.9.1 → 1.10.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 +86 -0
- package/SKILLS.md +84 -3
- package/USAGE.md +14 -0
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +113 -17
- package/dist/index.js +24 -24
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +1 -1
- package/dist/internals.d.ts +146 -45
- package/dist/internals.js +20 -20
- package/dist/{slug-aDUz3wBN.d.ts → marker_renderer-D6rDW2Pe.d.ts} +71 -85
- package/dist/{scale-CQhADkWB.d.ts → scale-B3MhoTu1.d.ts} +183 -68
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,92 @@ release notes, and every change is in `git log` in full.
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## [1.10.0] - 2026-10-05
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **Real text widths.** Labels and legends are measured with the advance widths of the default
|
|
26
|
+
font stack (`Liberation Sans, Arial, Helvetica` — metric-compatible), shipped as a table in both
|
|
27
|
+
libraries. The old estimate of 0.6 em per character was up to ±60 % off; digits alone were 7.9 %
|
|
28
|
+
too wide. Charts therefore reserve less room than before: expect slightly wider plot areas.
|
|
29
|
+
- **Minor ticks and a minor grid.** `axes.<axis>.ticks.minor` places that many ticks between two
|
|
30
|
+
major ones, `axes.<axis>.grid.minor` draws the matching lines — half as strong as the major grid
|
|
31
|
+
unless you say otherwise. Both fields were declared in both libraries since forever and read by
|
|
32
|
+
neither. `grid.minor` on its own means one tick per major interval.
|
|
33
|
+
- **Legend above and below the plot.** `legend.position: 'above' | 'below'` lays the entries out
|
|
34
|
+
horizontally and wraps them into as many rows as they need; the chart reserves exactly that
|
|
35
|
+
height. Neither existed before, for one reason: without real text widths there is no way to tell
|
|
36
|
+
how many entries fit a row. A horizontal legend now wraps instead of running off the canvas.
|
|
37
|
+
- **Two splines that do not overshoot.** `style.line.smoothingType` picks how a smoothed line
|
|
38
|
+
gets from point to point. `'catmull-rom'` stays the default and nothing changes without it.
|
|
39
|
+
`'monotone'` (Fritsch-Carlson) never leaves the span between two readings — humidity that sits
|
|
40
|
+
at 100 % stays at 100 % instead of bulging to 103 %, and the same goes for tank levels or
|
|
41
|
+
anything else with a ceiling. `'akima'` takes its slope from five points and weights it against
|
|
42
|
+
edges, so a flat run stays flat until the drop arrives instead of swinging up to meet it. Both
|
|
43
|
+
matter most for sensors that only transmit on change. `smoothing: true` is still the switch; a
|
|
44
|
+
type on its own draws straight segments.
|
|
45
|
+
- **`axes.<axis>.grid.layer`** decides whether the grid is drawn behind the data or over it.
|
|
46
|
+
`'front'` is the default and the behaviour the library always had: after the series, so a filled
|
|
47
|
+
area down to the baseline does not hide it, while markers, annotations and labels stay on top.
|
|
48
|
+
`'back'` draws it first of all — the choice when an opaque fill is meant to cover it. As with the
|
|
49
|
+
grid style, `axes.x` wins over `axes.left`; the switch sets the whole grid, not one axis.
|
|
50
|
+
- **`textMetrics`** lets you measure yourself — a browser-side `measureText`, or a table generated
|
|
51
|
+
for your own font with `node scripts/gen-text-metrics.mjs --font <file.ttf>`. A measuring callback
|
|
52
|
+
cannot travel in JSON, so the Go port cannot follow it: using one leaves the parity between the
|
|
53
|
+
two libraries, deliberately. `estimateMetrics` reproduces the pre-1.10.0 layout.
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- **Both libraries now draw in the same order.** The Go port put the grid under the series where
|
|
57
|
+
the TypeScript one puts it over them, and the time axis over the highlights where the other has
|
|
58
|
+
them over the axis: 33 of 56 templates came out as two different pictures from the same input.
|
|
59
|
+
Nobody saw it, because the parity suite compared the elements as a SET and not their order. It
|
|
60
|
+
compares the order now, and 56 of 56 agree. If you render server-side and client-side and the two
|
|
61
|
+
looked subtly different, this is why.
|
|
62
|
+
- **A smoothed line no longer loops back in time.** With two readings on the same millisecond the
|
|
63
|
+
Catmull-Rom control point landed left of the segment start, so the curve ran a little way into
|
|
64
|
+
the past before continuing. Control points are now kept inside their segment's time span; evenly
|
|
65
|
+
spaced data is unaffected (one reference chart changed by 3.7 px, invisible side by side).
|
|
66
|
+
- **A fill region pointing at a threshold or series that does not exist is now reported by the Go
|
|
67
|
+
side too.** TypeScript throws; the port silently skipped the region and drew a plausible chart
|
|
68
|
+
with one area missing. `chart.Validate(opts)` is a separate step — the CLI aborts with the
|
|
69
|
+
message, the HTTP endpoint answers 400, and embedding code can call it or not.
|
|
70
|
+
- **Aggregated series are drawn as bands by the Go port too.** `showAs` other than `'minmaxavg'`
|
|
71
|
+
produced a single average line there while TypeScript drew one rectangle per slot — two different
|
|
72
|
+
pictures from the same JSON. `avgLine` and `countOpacity` now work in both; a Go series whose
|
|
73
|
+
`style.fill` is a colour no longer gets an extra filled area underneath.
|
|
74
|
+
- The two-line marker shapes (`cross`, `plus`) gave both of their lines the same SVG `id` when the
|
|
75
|
+
series carried a `style.id`. Duplicate ids make `url(#…)` and `getElementById` hit the first one
|
|
76
|
+
only; the second line now carries `<id>-2`.
|
|
77
|
+
- **Series without an explicit colour now take the theme palette in TypeScript too.** The Go port
|
|
78
|
+
always did; TypeScript gave every one of them the same `theme.stroke`, so five unstyled series
|
|
79
|
+
were five blue lines with five identical legend swatches — and the same JSON came out of the two
|
|
80
|
+
libraries differently. A single-series chart is unchanged: `palette[0]` *is* `theme.stroke`.
|
|
81
|
+
- Annotation labels at the edge of the time window flip their anchor inward instead of running
|
|
82
|
+
over the axis labels. An explicit `anchor` still wins. Annotations are deliberately not clipped —
|
|
83
|
+
a cut-off word is worse than an overlapping one.
|
|
84
|
+
- A threshold whose value lies outside the value domain no longer draws its label. Its line was
|
|
85
|
+
always clipped away; since 1.9.1 clamped labels into the plot, the text alone remained and
|
|
86
|
+
claimed a boundary that is not drawn. A threshold exactly *on* the domain edge still gets one —
|
|
87
|
+
that is the normal case when the scale comes from the data.
|
|
88
|
+
|
|
89
|
+
### Removed
|
|
90
|
+
- `fill.hatchColor` and `fill.hatchWidth`. Declared in both libraries, read by neither — and by
|
|
91
|
+
design: a hatch is drawn in the colour of the area it belongs to, so that a hatched red zone
|
|
92
|
+
reads as red. The demos set `hatchColor` to exactly the colour they already got.
|
|
93
|
+
- `FillDirectionType` (`'toMin' | 'toMax'`). A May-2026 sketch that was never wired to anything —
|
|
94
|
+
filling relative to the line is expressed by `fill.regions[].from/to` with `'chartTop'` /
|
|
95
|
+
`'chartBottom'`, and an aggregated series fills with `fillToMin` / `fillToMax`. Both are tested;
|
|
96
|
+
the type only looked like a feature.
|
|
97
|
+
|
|
98
|
+
### Changed
|
|
99
|
+
- `DataPoint.synthetic` is now set by the TypeScript side too, on the points the library computes
|
|
100
|
+
itself (threshold intersections, gap edges) — the Go port always did. Its doc no longer promises
|
|
101
|
+
renderer behaviour that was never implemented: nothing in either library acts on the flag; it is
|
|
102
|
+
a marker for whoever reads the processed data.
|
|
103
|
+
- **Go, source-breaking in a minor — deliberately.** `renderer.MeasureLegend`, `renderer.LabelWidth`
|
|
104
|
+
and `renderer.RenderLegend` take the text metric as an extra argument; pass `nil` for the shipped
|
|
105
|
+
default. These three are internals of the rendering path rather than part of the charting API, and
|
|
106
|
+
a 2.0 would promise far more than this release delivers. If you call them, add the argument.
|
|
107
|
+
|
|
22
108
|
## [1.9.1] - 2026-09-23
|
|
23
109
|
|
|
24
110
|
### Fixed
|
package/SKILLS.md
CHANGED
|
@@ -209,7 +209,10 @@ markers: [
|
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
### Axes & Margins
|
|
212
|
-
The layout engine
|
|
212
|
+
The layout engine does not call into the DOM, but it does know how wide text is: the advance
|
|
213
|
+
widths of the default font stack (`Liberation Sans, Arial, Helvetica` — the three are
|
|
214
|
+
metric-compatible) ship with both libraries. Margins still have to be large enough for your
|
|
215
|
+
labels; the library reserves room inside them, it does not grow them.
|
|
213
216
|
And because the computed domain ends exactly on the smallest and largest reading, a thick line
|
|
214
217
|
or a marker at the extreme loses half of itself to the clip — `padding` adds room **in pixels**
|
|
215
218
|
(the cause is in pixels: `line.width`, `markers.size`), without giving up the automatic domain:
|
|
@@ -226,6 +229,83 @@ axes: {
|
|
|
226
229
|
}
|
|
227
230
|
```
|
|
228
231
|
|
|
232
|
+
Using a different font? Either generate the table for it
|
|
233
|
+
(`node scripts/gen-text-metrics.mjs --font YourFont.ttf`, in the repository) or measure yourself:
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
const canvas = document.createElement('canvas').getContext('2d')!;
|
|
237
|
+
new MLTimeGraph({
|
|
238
|
+
fontFamily: 'Inter, sans-serif',
|
|
239
|
+
textMetrics: (text, fontSize) => {
|
|
240
|
+
canvas.font = `${fontSize}px Inter, sans-serif`;
|
|
241
|
+
return canvas.measureText(text).width;
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**A measuring callback leaves the parity with the Go port, deliberately** — a function does not
|
|
247
|
+
travel in JSON, so the server cannot run yours. Same chart, two renderers, two layouts. Use it when
|
|
248
|
+
the browser is the only renderer; use a generated table when both have to agree. `estimateMetrics`
|
|
249
|
+
(exported) reproduces the layout of versions before 1.10.0.
|
|
250
|
+
|
|
251
|
+
### Minor Ticks & Grid
|
|
252
|
+
```ts
|
|
253
|
+
axes: {
|
|
254
|
+
x: { grid: { major: {}, minor: { color: '#eee', style: 'dashed' } }, ticks: { minor: 1 } },
|
|
255
|
+
left: { grid: { major: {}, minor: {} }, ticks: { major: 5, minor: 3 } },
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
`ticks.minor` is how many ticks sit **between** two major ones (3 → quarters). `grid.minor` draws
|
|
259
|
+
the matching lines, by default at half the strength of the major grid; setting it without
|
|
260
|
+
`ticks.minor` means one. One minor style governs both directions — `axes.x` wins over `axes.left`,
|
|
261
|
+
same as for the major grid.
|
|
262
|
+
|
|
263
|
+
### Smoothing — which spline
|
|
264
|
+
```ts
|
|
265
|
+
style: { line: { smoothing: true, smoothingType: 'monotone' } }
|
|
266
|
+
```
|
|
267
|
+
`'catmull-rom'` is the default: soft, cheap, and it **overshoots** — between two readings it
|
|
268
|
+
draws values that neither of them is. On a chart of measurements that is the picture claiming
|
|
269
|
+
something the sensor never reported.
|
|
270
|
+
|
|
271
|
+
`'monotone'` (Fritsch-Carlson) never leaves the span between two readings. Use it for anything
|
|
272
|
+
with a ceiling or a floor: humidity at 100 %, tank levels, battery charge, percentages.
|
|
273
|
+
|
|
274
|
+
`'akima'` takes its slope from five points and weights it against the change on the other side,
|
|
275
|
+
so a long flat run stays flat right up to an edge. Use it for sensors that only transmit on
|
|
276
|
+
change — a cliff in the data is a real event, not a reason to draw a wave before it.
|
|
277
|
+
|
|
278
|
+
`smoothing: true` remains the switch; `smoothingType` on its own draws straight segments. A step
|
|
279
|
+
shape is never smoothed, whatever you set.
|
|
280
|
+
|
|
281
|
+
If you write your own renderer against the draw commands, read `smoothingType` off the path and
|
|
282
|
+
pass it on — in Go that is `SmoothPathWith`, not `SmoothPath`, which always takes Catmull-Rom.
|
|
283
|
+
Drop it and the same chart comes out as one curve from your renderer and another from the SVG,
|
|
284
|
+
with nothing to warn you: this is exactly what happened to the PDF output in 1.10.0.
|
|
285
|
+
|
|
286
|
+
### Grid in front or behind — `grid.layer`
|
|
287
|
+
```ts
|
|
288
|
+
axes: { x: { grid: { major: {}, layer: 'back' } }, left: { grid: { major: {} } } }
|
|
289
|
+
```
|
|
290
|
+
By default the grid is drawn **after** the series (`layer: 'front'`): a filled area down to the
|
|
291
|
+
baseline does not hide it, and its lines stay visible over the curve. Markers, annotations and
|
|
292
|
+
labels are drawn later still and stay on top either way.
|
|
293
|
+
|
|
294
|
+
`'back'` draws it first of all, before highlights and thresholds — the choice when an opaque fill
|
|
295
|
+
is *meant* to cover it, or when a faint raster behind the data is enough. One setting governs the
|
|
296
|
+
whole grid; `axes.x` wins over `axes.left`, same as for the style.
|
|
297
|
+
|
|
298
|
+
### Legend Placement
|
|
299
|
+
`inside-left` / `inside-right` draw over the plot, `outside-left` / `outside-right` beside it,
|
|
300
|
+
`above` / `below` as a horizontal strip that wraps into as many rows as the entries need — the
|
|
301
|
+
chart reserves exactly that much height. `separate` draws nothing and hands you
|
|
302
|
+
`chart.legendItems()` to build your own.
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
legend: { show: true, position: 'below' }, // waagerecht, bricht um
|
|
306
|
+
legend: { show: true, position: 'above', orientation: 'vertical' }, // Säule, wenn du darauf bestehst
|
|
307
|
+
```
|
|
308
|
+
|
|
229
309
|
### Tooltips & Interactive Projections
|
|
230
310
|
Attach DOM tooltips or use pixel/data coordinate projections:
|
|
231
311
|
```ts
|
|
@@ -330,8 +410,9 @@ scratch image.
|
|
|
330
410
|
- **`resolveDash()` vs `getLineStyle()`:** `dashed` and `dotted` predate the scalable dash table and keep fixed SVG patterns (`"4,4"` and `"2,4"`) in the renderer for backwards compatibility. `getLineStyle()` returns the scalable table (`"6, 4"` for width 2). Anyone rendering custom legend swatches must call `resolveDash(variant, width)` so the swatch matches what is actually drawn.
|
|
331
411
|
- **Markers do not inherit `line.width`:** `style.markers` carries its own pen — `strokeWidth`, `stroke`, `fill`. That is usually what you want (a 10 px line with 10 px marker outlines is a blob), but it means a marker stays hairline-thin when the line gets thick, and nothing tells you. Set `markers.strokeWidth` explicitly whenever `line.width` leaves the default.
|
|
332
412
|
- **Marker suppression at threshold:** `style.markers.threshold` (and default `theme.pointThreshold = 100`) hides point markers when series sample count exceeds it to prevent visual crowding. Crucially, `chart.legendItems()` also omits the `marker` property when points are suppressed, because a symbol in the legend missing from the curve states something untrue.
|
|
333
|
-
- **Built-in legend is static SVG:** Built-in legends (`inside-right`,
|
|
413
|
+
- **Built-in legend is static SVG:** Built-in legends (`inside-right`, `above`, `below`, …) are
|
|
414
|
+
non-interactive SVG elements. For interactive series toggling or HTML layout below the chart, use `legend: { position: 'separate' }` and render HTML buttons from `chart.legendItems()` using `drawMarker()` and `SVGRenderer` or `resolveDash()`.
|
|
334
415
|
- **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.
|
|
335
|
-
- **
|
|
416
|
+
- **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.
|
|
336
417
|
- **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.
|
|
337
418
|
- **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
|
@@ -320,6 +320,15 @@ style: {
|
|
|
320
320
|
A threshold bound cuts the vertical jump at the reading's timestamp, so the part
|
|
321
321
|
above a limit is a rectangle, not a triangle. Steps are never smoothed: a
|
|
322
322
|
`smoothing: true` next to `shape: 'step'` is ignored for both line and fill.
|
|
323
|
+
|
|
324
|
+
**Which spline does the smoothing** is `smoothingType`, next to `smoothing`.
|
|
325
|
+
The default `'catmull-rom'` overshoots: between two readings it draws values
|
|
326
|
+
that neither of them is, which on a measurement chart is the picture claiming
|
|
327
|
+
something the sensor never reported. `'monotone'` (Fritsch-Carlson) stays
|
|
328
|
+
inside the span between two readings — use it wherever the value has a ceiling
|
|
329
|
+
or a floor, such as humidity at 100 %. `'akima'` weights its slope against
|
|
330
|
+
edges, so a flat run stays flat until the drop arrives — use it for sensors
|
|
331
|
+
that only transmit on change. See `demos/smoothing.html`.
|
|
323
332
|
(Before 1.7.0 the area ran as a ramp underneath the staircase — see
|
|
324
333
|
`demos/steps.html`.)
|
|
325
334
|
|
|
@@ -441,6 +450,11 @@ both get one; leave it out and there is none. (Before 1.5.1 the Go port drew a g
|
|
|
441
450
|
nothing was configured while the TypeScript side drew none — the same JSON gave two
|
|
442
451
|
different charts.)
|
|
443
452
|
|
|
453
|
+
**The grid is drawn over the series, not under it.** That is what `grid.layer: 'front'` means,
|
|
454
|
+
and it is the default: a filled area down to the baseline would otherwise swallow the lines.
|
|
455
|
+
Set `grid: { ..., layer: 'back' }` when you want exactly that — the grid behind the data, covered
|
|
456
|
+
by an opaque fill. Markers, annotations and labels come after the grid in both cases.
|
|
457
|
+
|
|
444
458
|
### Room at the edge — `padding`
|
|
445
459
|
|
|
446
460
|
The computed domain ends exactly at the smallest and largest reading, and the plot
|
package/dist/analyze/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var k=class{static interpolateDataPoint(n,i,l){return {time:n.time+Math.round(l*(i.time-n.time)),value:(n.value??0)+l*((i.value??0)-(n.value??0))}}static interpolateAggregatedPoint(n,i,l){let u=(e,t)=>e!==null&&t!==null?e+l*(t-e):null;return {time:n.time+l*(i.time-n.time),min:u(n.min,i.min),max:u(n.max,i.max),avg:u(n.avg,i.avg),count:Math.round(n.count+l*(i.count-n.count))}}static getRuns(n,i,l=0){let u=[...n].sort((r,o)=>r.time-o.time),e=[],t=[],a=null;for(let r of u){let o=i(r),m=l>0&&a&&r.time-a.time>l;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(r),a=r;}return t.length&&e.push(t),e}static splitByBoundaries(n,i,l,u){if(n.length===0)return [];if(i.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...i].sort((m,s)=>m-s),t=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],r=m=>{let s=0;for(let f=0;f<e.length&&m>=e[f];f++)s=f+1;return s},o=[n[0]];for(let m=1;m<n.length;m++){let s=n[m-1],f=n[m],g=l(s),d=l(f),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let b=g;for(let v of p){let x=(v-g)/(d-g),h=u(s,f,x);o.push(h);let c=r((b+v)/2);t.push({data:o,zoneIndex:c,zoneLow:a(c)}),o=[h],b=v;}(p.length===0||p[p.length-1]!==d)&&o.push(f);}if(o.length>1||n.length===1){let m=l(o[0]),s=l(o[o.length-1]),f=r((m+s)/2);t.push({data:o,zoneIndex:f,zoneLow:a(f)});}return t}static splitByThreshold(n,i,l,u){let e=this.splitByBoundaries(n,[i],l,u),t={above:[],below:[]};for(let a of e)a.zoneIndex===0?t.below.push(a.data):t.above.push(a.data);return t}},H={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},D=8.314462618,
|
|
1
|
+
var k=class{static interpolateDataPoint(n,i,l){return {time:n.time+Math.round(l*(i.time-n.time)),value:(n.value??0)+l*((i.value??0)-(n.value??0)),synthetic:true}}static interpolateAggregatedPoint(n,i,l){let u=(e,t)=>e!==null&&t!==null?e+l*(t-e):null;return {time:n.time+l*(i.time-n.time),min:u(n.min,i.min),max:u(n.max,i.max),avg:u(n.avg,i.avg),count:Math.round(n.count+l*(i.count-n.count))}}static getRuns(n,i,l=0){let u=[...n].sort((r,o)=>r.time-o.time),e=[],t=[],a=null;for(let r of u){let o=i(r),m=l>0&&a&&r.time-a.time>l;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(r),a=r;}return t.length&&e.push(t),e}static splitByBoundaries(n,i,l,u){if(n.length===0)return [];if(i.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...i].sort((m,s)=>m-s),t=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],r=m=>{let s=0;for(let f=0;f<e.length&&m>=e[f];f++)s=f+1;return s},o=[n[0]];for(let m=1;m<n.length;m++){let s=n[m-1],f=n[m],g=l(s),d=l(f),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let b=g;for(let v of p){let x=(v-g)/(d-g),h=u(s,f,x);o.push(h);let c=r((b+v)/2);t.push({data:o,zoneIndex:c,zoneLow:a(c)}),o=[h],b=v;}(p.length===0||p[p.length-1]!==d)&&o.push(f);}if(o.length>1||n.length===1){let m=l(o[0]),s=l(o[o.length-1]),f=r((m+s)/2);t.push({data:o,zoneIndex:f,zoneLow:a(f)});}return t}static splitByThreshold(n,i,l,u){let e=this.splitByBoundaries(n,[i],l,u),t={above:[],below:[]};for(let a of e)a.zoneIndex===0?t.below.push(a.data):t.above.push(a.data);return t}},H={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},D=8.314462618,y=273.15;function N(n,i,l,u=1){let e=i.filter(h=>h.value!==null&&h.value!==void 0&&!Number.isNaN(h.value)).map(h=>h.value);if(!e.length)return {time:n,min:null,max:null,avg:null,mkt:null,deltaMkt:null,stdDev:null,minutesAboveHigh:l?0:null,minutesBelowLow:l?0:null,count:0};let t=1/0,a=-1/0,r=0;for(let h of e)h<t&&(t=h),h>a&&(a=h),r+=h;let o=r/e.length,m=l?0:null,s=l?0:null;if(l)for(let h=0;h<i.length;h++){let c=i[h];if(c.value!==null&&c.value!==void 0){let M=i[h+1],w=(M?M.time-c.time:0)/(1e3*60);c.value>l.limitHigh&&(m+=w),c.value<l.limitLow&&(s+=w);}}let f=0,g=0,d=(l?.activationEnergy??83144)/D;for(let h of e){f+=Math.pow(h-o,2);let c=h+y;g+=Math.exp(-d/c);}let p=f/e.length,b=Math.sqrt(p),v=null,x=null;if(e.length>=u){let h=g/e.length,c=d/-Math.log(h);v=Number((c-y).toFixed(2)),x=Number((v-o).toFixed(2));}return {time:n,min:Number(t.toFixed(2)),max:Number(a.toFixed(2)),avg:Number(o.toFixed(2)),mkt:v,deltaMkt:x,stdDev:Number(b.toFixed(2)),minutesAboveHigh:m!==null?Number(m.toFixed(1)):null,minutesBelowLow:s!==null?Number(s.toFixed(1)):null,count:e.length}}function A(n,i="hourly",l,u,e=1){if(!n.length)return [];let t=i==="hourly"?36e5:i==="daily"?864e5:l??3600*1e3,a=[...n].sort((s,f)=>s.time-f.time),r=[],o=a[0].time,m=[];for(let s of a){for(;s.time-o>=t;)r.push(N(o,m,u,e)),o+=t,m=[];m.push(s);}return r.push(N(o,m,u,e)),r}function S(n,i){let l=1/0,u=-1/0,e=0;for(let a of i)a<l&&(l=a),a>u&&(u=a),e+=a;let t=e/i.length;return {time:n,min:l,max:u,avg:t,count:i.length}}function z(n,i=6e4){if(n.length<2)return [];let l=[...n].sort((e,t)=>e.time-t.time),u=[];for(let e=1;e<l.length;e++)l[e].time-l[e-1].time>i&&u.push({startTime:l[e-1].time,endTime:l[e].time});return u}function B(n){let i=[],l=0,u=0,e=0,t=0;for(let a of n)a.count>0&&(e++,a.minutesAboveHigh&&(l+=a.minutesAboveHigh),a.stdDev&&a.stdDev>u&&(u=a.stdDev),a.deltaMkt&&a.deltaMkt>2&&t++);return e===0?[]:(l>120&&i.push({type:"critical",message:`Kritische Gesamtbelastung: Das Produkt war im gesamten Zeitraum insgesamt ${Math.round(l)} Minuten zu warm.`,metric:"Total Excursion Time"}),t>e*.15&&i.push({type:"warning",message:"Frequent thermal shocks detected. The kinetic temperature deviates strongly from the average (possible regular door openings).",metric:"Delta MKT Instability"}),u>4&&i.push({type:"warning",message:`High instability measured. Maximum standard deviation was ${u}\xB0C. The cooling system controls imprecisely.`,metric:"Standard Deviation Peak"}),i)}function _(n,i){if(n.length<=i)return n;let l=[],u=Math.ceil(n.length/i);l.push(n[0]);for(let e=1;e<n.length;e+=u)l.push(n[Math.min(e,n.length-1)]);return l}function C(n,i="hourly",l){let u={limitLow:l.low,limitHigh:l.high,activationEnergy:l.activationEnergy};return A(n,i,l.interval,u,l.minCountForMkt??1)}var P=class{static compute(n){let i=n.map(r=>r.value).filter(r=>r!==null).sort((r,o)=>r-o);if(i.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let l=i.length,u=i.reduce((r,o)=>r+o,0)/l,e=l%2===1?i[Math.floor(l/2)]:(i[l/2-1]+i[l/2])/2,t=i.reduce((r,o)=>r+Math.pow(o-u,2),0)/l,a=Math.sqrt(t);return {min:i[0],max:i[l-1],avg:u,mean:u,median:e,stdDev:a,count:l}}static computeInRange(n,i,l){let u=n.filter(e=>e.time>=i&&e.time<=l);return this.compute(u)}};function q(n,i){let l=typeof n=="number"?n:n.mean,u=typeof n=="number"?i??NaN:n.stdDev;return !Number.isFinite(l)||!Number.isFinite(u)||l===0?null:Math.abs(u/l)*100}var G=83144;function L(n,i=83144){let l=i/8.314,u=0,e=0;for(let a of n)a!==null&&(u+=Math.exp(-l/(a+273.15)),e++);if(e===0)return null;let t=u/e;return l/-Math.log(t)-273.15}function R(n,i,l=83144){let u=new Array(n.length),e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=a-i;for(;e<t&&n[e].time<r;)e++;let o=n.slice(e,t+1).map(s=>s.value),m=L(o,l);u[t]={time:a,value:m,synthetic:true};}return u}function E(n){let i=0,l=0;for(let t of n)t!==null&&(i+=t,l++);if(l===0)return null;let u=i/l,e=0;for(let t of n){if(t===null)continue;let a=t-u;e+=a*a;}return Math.sqrt(e/l)}function F(n){let i=0,l=0;for(let t of n)t!==null&&(i+=t,l++);if(l<2)return null;let u=i/l,e=0;for(let t of n){if(t===null)continue;let a=t-u;e+=a*a;}return Math.sqrt(e/(l-1))}function V(n,i,l=false){let u=new Array(n.length),e=0,t=l?F:E;for(let a=0;a<n.length;a++){let r=n[a].time,o=r-i;for(;e<a&&n[e].time<o;)e++;let m=n.slice(e,a+1).map(f=>f.value),s=t(m);u[a]={time:r,value:s,synthetic:true};}return u}function K(n,i){let l=new Array(n.length),u=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-i;for(;u<e&&n[u].time<a;)u++;let r=0,o=0;for(let m=u;m<=e;m++){let s=n[m].value;s!==null&&(r+=s,o++);}l[e]={time:t,value:o===0?null:r/o,synthetic:true};}return l}function O(n,i){let l=new Array(n.length),u=null,e=0;for(let t=0;t<n.length;t++){let a=n[t].time,r=n[t].value;if(r===null){l[t]={time:a,value:u,synthetic:true};continue}if(u===null||i<=0)u=r;else {let o=1-Math.exp(-(a-e)/i);u=r*o+u*(1-o);}e=a,l[t]={time:a,value:u,synthetic:true};}return l}function U(n,i){let{high:l,low:u}=i,e={msAboveHigh:0,msBelowLow:0,globalMax:null,globalMin:null,excursions:[]},t=null;for(let a=0;a<n.length;a++){let r=n[a];if(r.value===null){t&&(e.excursions.push(t),t=null);continue}(e.globalMax===null||r.value>e.globalMax)&&(e.globalMax=r.value),(e.globalMin===null||r.value<e.globalMin)&&(e.globalMin=r.value);let o=l!==void 0&&r.value>l,m=u!==void 0&&r.value<u,s=o?"above":m?"below":null,f=n[a-1];if(f&&f.value!==null&&s!==null){let g=r.time-f.time;s==="above"?e.msAboveHigh+=g:e.msBelowLow+=g;}if(s===null){t&&(e.excursions.push(t),t=null);continue}t&&t.side===s?(t.endTime=r.time,t.durationMs=t.endTime-t.startTime,(s==="above"&&r.value>t.extremum||s==="below"&&r.value<t.extremum)&&(t.extremum=r.value)):(t&&e.excursions.push(t),t={startTime:r.time,endTime:r.time,side:s,extremum:r.value,durationMs:0});}return t&&e.excursions.push(t),e}function Y(n){if(n.length===0)return [];let i=new Map;for(let u of n)for(let e of u.data){if(e.value===null)continue;let t=i.get(e.time);t||(t=[],i.set(e.time,t)),t.push({name:u.name,value:e.value});}let l=[];for(let u of [...i.keys()].sort((e,t)=>e-t)){let e=i.get(u);if(e.length===0){l.push({time:u,min:null,max:null,delta:null,minSensor:null,maxSensor:null});continue}let t=e[0],a=e[0];for(let r=1;r<e.length;r++)e[r].value<t.value&&(t=e[r]),e[r].value>a.value&&(a=e[r]);l.push({time:u,min:t.value,max:a.value,delta:e.length<2?null:a.value-t.value,minSensor:t.name,maxSensor:a.name});}return l}function $(n){let i=[];for(let e of n){let t=0,a=0,r=1/0,o=-1/0;for(let m of e.data)m.value!==null&&(t+=m.value,a++,m.value<r&&(r=m.value),m.value>o&&(o=m.value));a!==0&&i.push({name:e.name,mean:t/a,min:r,max:o,count:a});}if(i.length===0)return {sensors:[],hottest:null,coldest:null,meanDelta:null};let l=i[0],u=i[0];for(let e=1;e<i.length;e++)i[e].mean>l.mean&&(l=i[e]),i[e].mean<u.mean&&(u=i[e]);return {sensors:i,hottest:l,coldest:u,meanDelta:l.mean-u.mean}}function T(n){let i=0,l=0,u=0,e=0,t=0;for(let m of n)m.value!==null&&(i++,l+=m.time,u+=m.value,e+=m.time*m.value,t+=m.time*m.time);if(i<2)return null;let a=i*t-l*l;if(a===0)return null;let r=(i*e-l*u)/a,o=(u-r*l)/i;return {slope:r,intercept:o,n:i}}function I(n,i){if(n.length===0)return null;let l=n[n.length-1].time,u=l-i,e=n.filter(t=>t.time>=u&&t.time<=l);return T(e)}function W(n,i){let l=[],u=0;for(let e=0;e<n.length;e++){let t=n[e].time,a=t-i;for(;u<n.length&&n[u].time<a;)u++;let r=T(n.slice(u,e+1));l.push({time:t,fit:r});}return l}function Z(n,i,l={}){let u=l.lookbackMs??9e5,e=l.side??"either";if(n.length===0)return null;let t=n[n.length-1];if(t.value===null)return null;let a=I(n,u);if(!a||a.slope===0)return null;let r=a.slope>0&&t.value<i,o=a.slope<0&&t.value>i;if(e==="above"&&!r||e==="below"&&!o||e==="either"&&!r&&!o)return null;let m=(i-a.intercept)/a.slope,s=m-t.time;return s<=0?null:{msUntil:s,eta:m,fit:a,currentValue:t.value}}function j(n,i={}){let l=i.refTempCelsius??121.11,u=i.zValueKelvin??10,e=0;for(let t=0;t<n.length-1;t++){let a=n[t],r=n[t+1];if(a.value===null||r.value===null)continue;let o=(r.time-a.time)/6e4;if(o<=0)continue;let m=Math.pow(10,(a.value-l)/u),s=Math.pow(10,(r.value-l)/u);e+=(m+s)/2*o;}return e}/*!
|
|
2
2
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
3
3
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
4
4
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
@@ -12,4 +12,4 @@ var k=class{static interpolateDataPoint(n,i,l){return {time:n.time+Math.round(l*
|
|
|
12
12
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
13
13
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
14
14
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
15
|
-
*/export{G as DEFAULT_ACTIVATION_ENERGY,H as PRODUCT_PROFILES,k as SeriesProcessor,
|
|
15
|
+
*/export{G as DEFAULT_ACTIVATION_ENERGY,H as PRODUCT_PROFILES,k as SeriesProcessor,P as StatsAggregator,A as aggregateBySlot,C as aggregateWithStats,B as analyzeLongTermTrends,U as computeLimitExcursions,S as createAggr,I as currentTrend,z as detectGaps,_ as downsample,j as f0Sterilization,$ as hotColdSpots,T as linearFit,L as mkt,Z as predictTimeToThreshold,O as rollingEma,K as rollingMean,R as rollingMkt,V as rollingStdDev,W as rollingTrend,F as sampleStdDev,Y as spatialDelta,E as stdDev,q as varianceCoefficient};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LegendOrientation, R as Renderer, M as Marker, a as LegendItem, b as LayoutResult, c as RenderOutput } from './
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { L as LegendOrientation, T as TextMetrics, R as Renderer, M as Marker, a as LegendItem, b as LayoutResult, c as RenderOutput } from './marker_renderer-D6rDW2Pe.js';
|
|
2
|
+
export { d as Theme, e as drawMarker, f as estimateMetrics, g as getDefaultTheme, l as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, h as slugify } from './marker_renderer-D6rDW2Pe.js';
|
|
3
|
+
import { b as LineVariant, G as GridLayer, A as AxisPosition, d as AnySeries, e as Threshold, f as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, a as DrawCommand, T as TimeScale, L as LinearScale, k as SeriesStyle, S as SmoothingType, F as FillSpec, l as TimeSeries, m as LineDashStyle, n as ThresholdFill, H 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-B3MhoTu1.js';
|
|
4
|
+
export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, 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, 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-B3MhoTu1.js';
|
|
5
5
|
|
|
6
6
|
/*!
|
|
7
7
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -32,7 +32,35 @@ interface GridLineStyle {
|
|
|
32
32
|
*/
|
|
33
33
|
interface GridStyle {
|
|
34
34
|
major?: GridLineStyle | false;
|
|
35
|
+
/**
|
|
36
|
+
* Zwischengitter -- die Linien zwischen den Hauptlinien.
|
|
37
|
+
*
|
|
38
|
+
* Wieviele es sind, sagt `ticks.minor`; steht dort nichts, ist EINE je
|
|
39
|
+
* Hauptabstand gemeint. Ohne eigene `opacity` sind sie halb so kraeftig wie
|
|
40
|
+
* das Hauptgitter: ein Zwischengitter in voller Staerke macht aus der
|
|
41
|
+
* Orientierung ein zweites Raster.
|
|
42
|
+
*
|
|
43
|
+
* **Eine Angabe gilt fuer beide Richtungen.** Wie beim Hauptgitter gewinnt
|
|
44
|
+
* `axes.x.grid.minor`, sonst `axes.left.grid.minor` -- ein Gitter mit zwei
|
|
45
|
+
* Stilen waere zwei Gitter.
|
|
46
|
+
*/
|
|
35
47
|
minor?: GridLineStyle | false;
|
|
48
|
+
/**
|
|
49
|
+
* Wann das Gitter gezeichnet wird.
|
|
50
|
+
*
|
|
51
|
+
* `'front'` (Vorgabe) heisst: NACH den Serien -- eine Flaeche bis zur
|
|
52
|
+
* Grundlinie verdeckt es dann nicht, und die Linien des Gitters liegen
|
|
53
|
+
* sichtbar ueber der Kurve. Marker, Annotationen und Beschriftungen kommen
|
|
54
|
+
* trotzdem darueber.
|
|
55
|
+
*
|
|
56
|
+
* `'back'` zeichnet es als ERSTES, noch vor Highlights und Schwellenwerten.
|
|
57
|
+
* Das ist die Wahl, wenn eine deckende Flaeche das Gitter verschlucken SOLL
|
|
58
|
+
* -- oder wenn ein feines Raster hinter den Daten genuegt.
|
|
59
|
+
*
|
|
60
|
+
* Eine Angabe gilt fuer das ganze Gitter; wie beim Stil gewinnt `axes.x`
|
|
61
|
+
* vor `axes.left`.
|
|
62
|
+
*/
|
|
63
|
+
layer?: GridLayer;
|
|
36
64
|
}
|
|
37
65
|
/** Axis baseline + tick marks styling. */
|
|
38
66
|
interface AxisStyle {
|
|
@@ -47,7 +75,7 @@ interface AxisLabelsStyle {
|
|
|
47
75
|
/** Configuration for one Y-axis (left or right). */
|
|
48
76
|
interface YAxisConfig {
|
|
49
77
|
/** Position is 'left' or 'right' to determine placement side. Defaults to 'left'. */
|
|
50
|
-
position?:
|
|
78
|
+
position?: AxisPosition;
|
|
51
79
|
/** Optional explicit horizontal pixel offset from chart edge (defaults to index * 50px). */
|
|
52
80
|
offset?: number;
|
|
53
81
|
/** Rotated label drawn next to the axis. */
|
|
@@ -132,7 +160,14 @@ interface Margin {
|
|
|
132
160
|
left: number;
|
|
133
161
|
}
|
|
134
162
|
/** Legend placement position — inside or outside the chart area. */
|
|
135
|
-
type LegendPosition = "inside-right" | "inside-left" | "outside-right" | "outside-left"
|
|
163
|
+
type LegendPosition = "inside-right" | "inside-left" | "outside-right" | "outside-left"
|
|
164
|
+
/**
|
|
165
|
+
* Ueber bzw. unter der Zeichenflaeche, waagerecht und ueber mehrere Zeilen
|
|
166
|
+
* umgebrochen. Bis 1.10.0 gab es beides nicht, und zwar aus einem Grund: Ohne
|
|
167
|
+
* echte Textbreiten laesst sich nicht ausrechnen, wieviele Eintraege in eine
|
|
168
|
+
* Zeile passen und wieviel Hoehe zu reservieren ist.
|
|
169
|
+
*/
|
|
170
|
+
| "above" | "below" | "separate";
|
|
136
171
|
interface LegendOptions {
|
|
137
172
|
/** Show the legend (default false). */
|
|
138
173
|
show?: boolean;
|
|
@@ -142,6 +177,22 @@ interface LegendOptions {
|
|
|
142
177
|
orientation?: LegendOrientation;
|
|
143
178
|
}
|
|
144
179
|
interface MLTimeGraphOptions {
|
|
180
|
+
/**
|
|
181
|
+
* Womit Textbreiten gerechnet werden (Legende, Achsentitel, Raender).
|
|
182
|
+
*
|
|
183
|
+
* Vorgabe ist `liberationMetrics` -- die mitgelieferte Vorschubtabelle des
|
|
184
|
+
* Stapels `Liberation Sans, Arial, Helvetica`. Sie liegt BEI, statt gemessen
|
|
185
|
+
* zu werden: eine Messung im Browser (Canvas `measureText`) und eine im
|
|
186
|
+
* Go-Port stimmen nicht aufs Pixel ueberein, und dann haengt das Bild davon
|
|
187
|
+
* ab, wer es zeichnet.
|
|
188
|
+
*
|
|
189
|
+
* Eigene Schrift? Dann entweder die Tabelle dafuer erzeugen
|
|
190
|
+
* (`node scripts/gen-text-metrics.mjs --font deine.ttf`) oder hier messen --
|
|
191
|
+
* etwa ueber Canvas im Browser. Mit dem zweiten Weg verlaesst du die
|
|
192
|
+
* Paritaet zwischen den beiden Bibliotheken, und zwar bewusst: eine Funktion
|
|
193
|
+
* steht in keinem JSON, der Go-Port kann sie nicht nachbilden.
|
|
194
|
+
*/
|
|
195
|
+
textMetrics?: TextMetrics;
|
|
145
196
|
/** Chart dimensions */
|
|
146
197
|
width?: number;
|
|
147
198
|
height?: number;
|
|
@@ -247,6 +298,12 @@ declare class MLTimeGraph {
|
|
|
247
298
|
private readonly _timeZone?;
|
|
248
299
|
private readonly _fontFamily?;
|
|
249
300
|
private readonly _legend?;
|
|
301
|
+
/**
|
|
302
|
+
* Womit Textbreiten gerechnet werden. Vorgabe ist die mitgelieferte Tabelle,
|
|
303
|
+
* nicht eine Messung beim Aufrufer -- sonst haengt das Bild davon ab, WER
|
|
304
|
+
* misst, und die Zusage "dasselbe JSON, dasselbe Bild" faellt.
|
|
305
|
+
*/
|
|
306
|
+
private readonly _textMetrics;
|
|
250
307
|
/** Serien auf die Zeichenflaeche beschneiden (Vorgabe: ja) — siehe options.ts. */
|
|
251
308
|
private readonly _clipSeries;
|
|
252
309
|
private readonly _markers;
|
|
@@ -298,6 +355,37 @@ declare class MLTimeGraph {
|
|
|
298
355
|
private _renderSeries;
|
|
299
356
|
private _interpolateValue;
|
|
300
357
|
legendItems(): LegendItem[];
|
|
358
|
+
/**
|
|
359
|
+
* Die Farbe einer Reihe ohne eigene Angabe.
|
|
360
|
+
*
|
|
361
|
+
* Bis 1.10.0 nahm die TS-Seite hier `theme.stroke` -- fuer JEDE Reihe
|
|
362
|
+
* dieselbe. Fuenf Reihen ohne Farbangabe waren fuenf blaue Linien, und die
|
|
363
|
+
* Legende zeigte fuenfmal dasselbe Kaestchen.
|
|
364
|
+
*
|
|
365
|
+
* Der Go-Port nimmt seit jeher `theme.Palette[i]`. Die Paritaet hat das nie
|
|
366
|
+
* gesehen, weil KEINE Vorlage zwei Reihen ohne Farbe hat -- und bei einer
|
|
367
|
+
* einzigen sind beide gleich, denn palette[0] IST theme.stroke. Wieder: was
|
|
368
|
+
* keine Vorlage zeigt, prueft nichts (edge_serien_ohne_farbe).
|
|
369
|
+
*/
|
|
370
|
+
private _palettenFarbe;
|
|
371
|
+
/**
|
|
372
|
+
* Die Zustaende der Reihen an EINER Achse, aufsteigend -- oder undefined,
|
|
373
|
+
* wenn keine Reihe dort eine `enumMap` hat.
|
|
374
|
+
*
|
|
375
|
+
* Mehrere Reihen auf derselben Achse duerfen verschiedene Karten mitbringen;
|
|
376
|
+
* zusammengelegt wird die Vereinigung, damit kein Zustand ohne Strich bleibt.
|
|
377
|
+
*/
|
|
378
|
+
private _zustaendeVon;
|
|
379
|
+
/**
|
|
380
|
+
* Beschriftung eines Zustands; unbekannte Werte behalten ihre Zahl.
|
|
381
|
+
*
|
|
382
|
+
* Nennen zwei Reihen denselben Wert verschieden -- eine Pumpe "Running", ein
|
|
383
|
+
* Ventil "Open" --, gewinnt die ERSTE. Das ist keine Loesung des Konflikts,
|
|
384
|
+
* sondern eine feste Regel dafuer: eine Achse hat EIN Vokabular, und wer zwei
|
|
385
|
+
* braucht, braucht zwei Achsen. Vorher gewann die zuletzt genannte Reihe, und
|
|
386
|
+
* die Achse trug eine Mischung aus beiden.
|
|
387
|
+
*/
|
|
388
|
+
private _zustandName;
|
|
301
389
|
private _legendItems;
|
|
302
390
|
get renderer(): Renderer | undefined;
|
|
303
391
|
get layout(): LayoutResult;
|
|
@@ -578,8 +666,16 @@ declare class TimeSeriesBuilder {
|
|
|
578
666
|
setStyle(style: SeriesStyle): this;
|
|
579
667
|
/** Shortcut to apply custom stroke styling (color, width, dash style). */
|
|
580
668
|
setLineStyle(color: string, width: number, style?: LineVariant): this;
|
|
581
|
-
/**
|
|
582
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Configures spline interpolation (smoothing) on the series path.
|
|
671
|
+
*
|
|
672
|
+
* The second argument picks the spline. Leave it out for Catmull-Rom, the
|
|
673
|
+
* default: soft, but it overshoots. `'monotone'` never leaves the span
|
|
674
|
+
* between two readings — the right choice for anything with a ceiling, such
|
|
675
|
+
* as humidity at 100 %. `'akima'` stays flat ahead of an edge instead of
|
|
676
|
+
* swinging up to meet it.
|
|
677
|
+
*/
|
|
678
|
+
setSmoothing(smooth: boolean, type?: SmoothingType): this;
|
|
583
679
|
/** Assigns the area fill specification. */
|
|
584
680
|
setFill(fill: FillSpec): this;
|
|
585
681
|
/** Sets a custom identifier for the series path. */
|
|
@@ -605,9 +701,9 @@ declare class ThresholdBuilder {
|
|
|
605
701
|
/** Sets the threshold boundary color. */
|
|
606
702
|
setColor(color: string): this;
|
|
607
703
|
/** Configures the line type (solid, dashed, dotted, none). */
|
|
608
|
-
setLine(style:
|
|
704
|
+
setLine(style: LineDashStyle): this;
|
|
609
705
|
/** Configures half-plane fills (above, below, none) and opacity. */
|
|
610
|
-
setFill(fillType:
|
|
706
|
+
setFill(fillType: ThresholdFill, opacity: number): this;
|
|
611
707
|
/** Configures a hatch pattern style for the fill. */
|
|
612
708
|
setFillHatch(hatch: HatchVariant): this;
|
|
613
709
|
/** Configures the labels parameters. */
|
|
@@ -639,7 +735,7 @@ declare class MarkerBuilder {
|
|
|
639
735
|
/** Sets the shape of the point marker (circle, square, cross, star, arrow, none). */
|
|
640
736
|
setPointStyle(style: PointStyleType): this;
|
|
641
737
|
/** Sets the type of vertical projection line (full, to-value, to-top, none). */
|
|
642
|
-
setLineStyle(style:
|
|
738
|
+
setLineStyle(style: MarkerLineStyle): this;
|
|
643
739
|
/** Targets a specific series by index for interpolation. */
|
|
644
740
|
setSeriesIndex(idx: number): this;
|
|
645
741
|
/** Compiles and returns the Marker object. */
|
|
@@ -665,7 +761,7 @@ declare class HighlightBuilder {
|
|
|
665
761
|
/** Sets the opacity. */
|
|
666
762
|
setOpacity(opacity: number): this;
|
|
667
763
|
/** Sets the label alignment (top, center, bottom, above, below). */
|
|
668
|
-
setLabelPosition(pos:
|
|
764
|
+
setLabelPosition(pos: RangeLabelPosition): this;
|
|
669
765
|
/** Sets the text rotation in degrees. */
|
|
670
766
|
setRotate(rotate: number): this;
|
|
671
767
|
/** Compiles and returns the Highlight object. */
|
|
@@ -713,11 +809,11 @@ declare class AnnotationBuilder {
|
|
|
713
809
|
/** Sets the point radius (point only). */
|
|
714
810
|
setRadius(radius: number): this;
|
|
715
811
|
/** Sets the point shape (point only). */
|
|
716
|
-
setShape(shape:
|
|
812
|
+
setShape(shape: AnnotationPointShape): this;
|
|
717
813
|
/** Sets the label text (label only). */
|
|
718
814
|
setText(text: string): this;
|
|
719
815
|
/** Sets the text anchor (label only). */
|
|
720
|
-
setAnchor(anchor:
|
|
816
|
+
setAnchor(anchor: LabelAnchor): this;
|
|
721
817
|
/** Sets the horizontal offset (label only). */
|
|
722
818
|
setDx(dx: number): this;
|
|
723
819
|
/** Sets the vertical offset (label only). */
|
|
@@ -772,7 +868,7 @@ declare class AnnotationBandItemBuilder {
|
|
|
772
868
|
/** Sets the border stroke width. */
|
|
773
869
|
setStrokeWidth(w: number): this;
|
|
774
870
|
/** Sets the text label and optional label formatting fields. */
|
|
775
|
-
setLabel(lbl: string, fontSize?: number, fill?: string, baseline?:
|
|
871
|
+
setLabel(lbl: string, fontSize?: number, fill?: string, baseline?: TextBaseline): this;
|
|
776
872
|
/** Compiles and returns the AnnotationBandItem object. */
|
|
777
873
|
build(): AnnotationBandItem;
|
|
778
874
|
}
|
|
@@ -1047,6 +1143,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
|
|
|
1047
1143
|
* Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
|
|
1048
1144
|
* kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
|
|
1049
1145
|
*/
|
|
1050
|
-
declare const VERSION = "1.
|
|
1146
|
+
declare const VERSION = "1.10.0";
|
|
1051
1147
|
|
|
1052
|
-
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnySeries, type AxesConfig, type AxisLabelsStyle, type AxisStyle, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, type GridLineStyle, type GridStyle, HatchVariant, Highlight, HighlightBuilder, LegendItem, type LegendOptions, LegendOrientation, type LegendPosition, type LimitStatsPoint, LineVariant, MLTimeGraph, type MLTimeGraphOptions, type Margin, Marker, MarkerBuilder, type MktPoint, type OptionsLayer, PointStyleType, SVGRenderer, SeriesStyle, type StatsAggregatedPoint, type StdDevPoint, Threshold, ThresholdBuilder, ThresholdLabelPosition, type TickConfig, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, type XAxisConfig, type YAxisConfig, attachTooltip, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
|
|
1148
|
+
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AxesConfig, type AxisLabelsStyle, AxisPosition, type AxisStyle, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, GridLayer, type GridLineStyle, type GridStyle, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, type LegendOptions, LegendOrientation, type LegendPosition, type LimitStatsPoint, LineDashStyle, LineVariant, MLTimeGraph, type MLTimeGraphOptions, type Margin, Marker, MarkerBuilder, MarkerLineStyle, type MktPoint, type OptionsLayer, PointStyleType, RangeLabelPosition, SVGRenderer, SeriesStyle, SmoothingType, type StatsAggregatedPoint, type StdDevPoint, TextBaseline, TextMetrics, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, type TickConfig, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, type XAxisConfig, type YAxisConfig, attachTooltip, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
|