ml-time-graph 1.17.0 → 1.18.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 +81 -0
- package/GRAPH_JSON_STRUCTURE.md +6 -4
- package/README.de.md +6 -4
- package/README.md +5 -4
- package/SKILLS.md +9 -538
- package/USAGE.md +27 -2
- package/dist/index.d.ts +21 -16
- package/dist/index.js +41 -41
- package/dist/interaction/index.d.ts +1 -2
- package/dist/interaction/index.js +1 -1
- package/dist/internals.d.ts +16 -4
- package/dist/internals.js +19 -19
- package/dist/{marker_renderer-BsiVseet.d.ts → marker_renderer-BZMcTbHC.d.ts} +19 -3
- package/dist/{types-DdltSMkw.d.ts → types-CNIUKrmy.d.ts} +41 -2
- package/package.json +3 -2
- package/skills/ml-time-graph/SKILL.md +113 -0
- package/skills/ml-time-graph/reference/annotations-and-markers.md +63 -0
- package/skills/ml-time-graph/reference/axes.md +112 -0
- package/skills/ml-time-graph/reference/gaps.md +75 -0
- package/skills/ml-time-graph/reference/legend.md +57 -0
- package/skills/ml-time-graph/reference/rendering.md +84 -0
- package/skills/ml-time-graph/reference/series-styles.md +58 -0
- package/skills/ml-time-graph/reference/svelte.md +37 -0
- package/skills/ml-time-graph/reference/thresholds-and-fills.md +64 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Thresholds, zones and filled areas — ml-time-graph
|
|
2
|
+
|
|
3
|
+
Part of the `ml-time-graph` skill — back to [SKILL.md](../SKILL.md). The exhaustive reference
|
|
4
|
+
is `USAGE.md` in the package root ([USAGE.md](../../../USAGE.md)).
|
|
5
|
+
|
|
6
|
+
## Thresholds & Zone Colouring
|
|
7
|
+
Define thresholds once and reference them by name to colour lines or zones:
|
|
8
|
+
```ts
|
|
9
|
+
mount('#chart', {
|
|
10
|
+
thresholds: [
|
|
11
|
+
{ name: 'warn', value: 25, color: '#f59e0b', line: 'dashed', label: 'Warning' },
|
|
12
|
+
{ name: 'crit', value: 30, color: '#ef4444', line: 'solid', label: 'Critical' },
|
|
13
|
+
],
|
|
14
|
+
series: [{ name: 'Temp', data: tempData, colorByThresholds: ['warn', 'crit'] }],
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Filled Areas Between Curve and Threshold
|
|
19
|
+
Use `style.fill.regions` with bounds (`from`, `to`, `side`, optional `hatch`):
|
|
20
|
+
```ts
|
|
21
|
+
style: {
|
|
22
|
+
fill: {
|
|
23
|
+
regions: [
|
|
24
|
+
{ from: { threshold: 'warn' }, to: 'series', side: 'above', fill: { color: '#f59e0b33', hatch: 'classic-diagonal' } },
|
|
25
|
+
{ from: { threshold: 'crit' }, to: 'series', side: 'above', fill: '#ef444444' },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Only where two edges differ:** `where: { exceeds: 2 }` on a region between two series fills
|
|
32
|
+
only where they are more than 2 apart (`side: 'above' | 'below'`, `maxAgeMs`) — decided on the
|
|
33
|
+
readings, not on the smoothed curve. For two probes that should agree.
|
|
34
|
+
|
|
35
|
+
## Two probes that should agree — `divergenceExcursions`
|
|
36
|
+
```ts
|
|
37
|
+
import { divergenceExcursions } from 'ml-time-graph/analyze';
|
|
38
|
+
|
|
39
|
+
const episodes = divergenceExcursions(
|
|
40
|
+
[{ name: 'Oben', data: oben }, { name: 'Unten', data: unten }],
|
|
41
|
+
{ maxDelta: 2, minDurationMs: 30 * 60_000 },
|
|
42
|
+
);
|
|
43
|
+
// → [{ startTime, endTime, durationMs, peakDelta, peakTime, maxSensor, minSensor }]
|
|
44
|
+
```
|
|
45
|
+
Two sensors measuring the same thing: while they agree, all is well. Beyond `maxDelta` something
|
|
46
|
+
is wrong — one is icing up, one sits in the draught, one has drifted. **`maxSensor` is the half
|
|
47
|
+
you can act on**: *Unten is 4.5 °C warmer* sends someone to the right probe, *the difference was
|
|
48
|
+
4.5 °C* does not.
|
|
49
|
+
|
|
50
|
+
`minDurationMs` drops episodes shorter than that — a single sample over the limit is noise, not an
|
|
51
|
+
incident. A timestamp with fewer than two readings has no difference and ends an episode, the way
|
|
52
|
+
a gap does. Sensors are matched by timestamp without interpolation, so bring them to the same
|
|
53
|
+
cadence first.
|
|
54
|
+
|
|
55
|
+
Draw the result as highlights, with `rotate: 'auto'` so a long label in a short episode turns
|
|
56
|
+
upright instead of spilling over the data:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
highlights: episodes.map((e) => ({
|
|
60
|
+
startTime: e.startTime, endTime: e.endTime,
|
|
61
|
+
label: `${e.maxSensor} +${e.peakDelta.toFixed(1)} °C`,
|
|
62
|
+
labelPosition: 'top', rotate: 'auto',
|
|
63
|
+
}))
|
|
64
|
+
```
|