ml-time-graph 1.14.0 → 1.16.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 +47 -0
- package/USAGE.md +79 -18
- package/dist/index.d.ts +154 -19
- package/dist/index.js +33 -33
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +2 -2
- package/dist/internals.d.ts +4 -4
- package/dist/internals.js +4 -4
- package/dist/{marker_renderer-C5rNViFi.d.ts → marker_renderer-CN1N04nS.d.ts} +48 -3
- package/dist/{scale-CDPJGYpZ.d.ts → scale-kRRbXFik.d.ts} +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,53 @@ release notes, and every change is in `git log` in full.
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## [1.16.0] - 2026-10-07
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **`theme` per chart** (TS and Go JSON options) — this chart's colours over the global defaults,
|
|
26
|
+
without `setDefaultTheme`.
|
|
27
|
+
- **`legendItems()`: `seriesId` and `width`** — the key for `hidden`/`pointsAt` (the existing `id`
|
|
28
|
+
is its CSS slug) and the drawn line width, so `resolveDash(line, width)` matches the curve.
|
|
29
|
+
- **`zeigerImSvg(svg, clientX, clientY)`** — pointer to SVG coordinates at any scaling; used by
|
|
30
|
+
the built-in tooltip.
|
|
31
|
+
- **`includeThresholds` on a y axis** (TS and Go) — the automatic domain also covers the
|
|
32
|
+
thresholds drawn on that axis; `line: 'none'` ones do not count, an explicit `domain` wins.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- **`Theme` has ordinary field types** (`string`, `number`) instead of literal types —
|
|
36
|
+
`setDefaultTheme({ textColor: '#94a3b8' })` needs no cast.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- **The built-in tooltip (`attachTooltip`, `tooltip: { show: true }`) showed the wrong value on
|
|
40
|
+
step lines.** It searched the nearest sample by itself; it now goes through `pointsAt` — a step
|
|
41
|
+
line holds its value, enum series show their state. Samples carry `held`, `label` and the full
|
|
42
|
+
`point`; `points` passes options on; the header shows the cursor's time.
|
|
43
|
+
- **Fill region between series on different y axes** — the other series' edge was mapped with
|
|
44
|
+
this series' scale and missed its line; each edge now uses the scale of its own line.
|
|
45
|
+
- **Fill region to a step series** ramped into each jump instead of following the vertical;
|
|
46
|
+
the area now takes both values at the jump.
|
|
47
|
+
- **`legend: { position: 'below' }` covered the x-axis title** — both sat at the bottom edge;
|
|
48
|
+
the title now sits above the legend.
|
|
49
|
+
- **A grid line covered a threshold line at the same height** (in PDF completely) — the grid is
|
|
50
|
+
drawn after the series, thresholds before. The grid now leaves out lines under drawn thresholds.
|
|
51
|
+
- **Go wrote a tick at zero as `-0`** when the domain was padded below zero; now `0`, as in TS.
|
|
52
|
+
|
|
53
|
+
## [1.15.0] - 2026-10-07
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
- **`pointsAt`: `mode: 'hold'`** — the last measurement at or before the pointer, as a step line
|
|
57
|
+
draws it, marked `held: true` with the time it was measured; ends at gaps, at a break over
|
|
58
|
+
`gapThreshold` and after `maxAgeMs`. `modes` per series. Hits carry `color`, `line` and
|
|
59
|
+
`label` — the state name of an enum series, in TypeScript otherwise the axis' `format`.
|
|
60
|
+
- **`pointsAt({ overlays: true })`** — the overlays' values (moving average, MKT, standard
|
|
61
|
+
deviation band) after their series' hit, taken from what was drawn.
|
|
62
|
+
- **`chart.warnings()`** (TS) / **`Warnings()`** (Go) — configuration hints; today: two series
|
|
63
|
+
sharing an id.
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
- **`pointsAt` returns hits in series order**, not sorted by distance; a step line holds by
|
|
67
|
+
default instead of taking the nearest point. Feedback from the first user of 1.14.0.
|
|
68
|
+
|
|
22
69
|
## [1.14.0] - 2026-10-07
|
|
23
70
|
|
|
24
71
|
### Added
|
package/USAGE.md
CHANGED
|
@@ -480,6 +480,42 @@ widest stroke plus a little is a good rule of thumb. An explicit `domain` is lef
|
|
|
480
480
|
alone, and padding that does not fit the chart height is ignored rather than
|
|
481
481
|
producing an inverted scale.
|
|
482
482
|
|
|
483
|
+
### Thresholds in view — `includeThresholds`
|
|
484
|
+
|
|
485
|
+
The automatic domain follows the readings only. A limit at 10 °C next to readings of 2..7 °C
|
|
486
|
+
lies outside the chart and is clipped away — exactly the line the chart should show.
|
|
487
|
+
`includeThresholds` widens the domain to the thresholds drawn on that axis:
|
|
488
|
+
|
|
489
|
+
```ts
|
|
490
|
+
axes: { left: { includeThresholds: true, padding: 8 } }
|
|
491
|
+
thresholds: [
|
|
492
|
+
{ name: 'max', value: 10 }, // counts
|
|
493
|
+
{ name: 'min', value: 0, line: 'solid' }, // counts
|
|
494
|
+
{ name: 'ref', value: 20, line: 'none' }, // label/band only -- does not count
|
|
495
|
+
]
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
Only thresholds with `axisIndex` of that axis count, and only those that draw a line.
|
|
499
|
+
`padding` applies on top. An explicit `domain` is left alone. Off by default.
|
|
500
|
+
|
|
501
|
+
### Colours per chart — `theme`
|
|
502
|
+
|
|
503
|
+
`theme` in the options sets this chart's colours and sizes over the global defaults — a dark
|
|
504
|
+
chart next to a light one, or a light redraw for printing, without touching global state:
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
const dark = { textColor: '#94a3b8', axisColor: '#475569', gridStroke: '#334155', legendText: '#cbd5e1' };
|
|
508
|
+
new MLTimeGraph({ ...options, theme: isDark ? dark : undefined });
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
`setDefaultTheme(partial)` still changes the default for every chart (avoid it in a server
|
|
512
|
+
rendering several requests at once). The field names are the same as in the Go port's JSON
|
|
513
|
+
options; fields only the browser knows (`tooltip*`, `minimap*`) are ignored there.
|
|
514
|
+
|
|
515
|
+
To turn a pointer event into the SVG pixels that `pointsAt`, `invertTime` and `plotRect` speak,
|
|
516
|
+
use `zeigerImSvg(svg, e.clientX, e.clientY)` — correct at any scaling, `viewBox` or CSS
|
|
517
|
+
transform.
|
|
518
|
+
|
|
483
519
|
### Margins that fit — `autoMargin`
|
|
484
520
|
|
|
485
521
|
The chart draws into fixed margins. When they are too narrow, labels are cut, and a cut number
|
|
@@ -884,9 +920,10 @@ const { x, y } = chart.project(time, value, axis); // data → pixel
|
|
|
884
920
|
|
|
885
921
|
### Tooltips — `attachTooltip` (built-in)
|
|
886
922
|
|
|
887
|
-
One line wires a DOM tooltip that
|
|
888
|
-
|
|
889
|
-
|
|
923
|
+
One line wires a DOM tooltip that shows, per series, the value its line shows at the
|
|
924
|
+
cursor — found by [`pointsAt`](#points-under-the-pointer--pointsat-your-own-tooltip), so a
|
|
925
|
+
step line holds its value — draws a "pick" ring on each matched point, and **flips across
|
|
926
|
+
the cursor to stay inside the chart** (right/below in the left/top half, left/above past 50%):
|
|
890
927
|
|
|
891
928
|
```ts
|
|
892
929
|
import { mount, attachTooltip } from 'ml-time-graph';
|
|
@@ -903,10 +940,14 @@ detach(); // removes the listeners + pick markers
|
|
|
903
940
|
|
|
904
941
|
`attachTooltip(target, chart, options?)` returns a cleanup function. The `target`
|
|
905
942
|
must already contain the rendered `<svg>` (mount / render first). Each hover
|
|
906
|
-
yields one `TooltipSample` per series — `{ seriesIndex, series, time, value, x, y
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
943
|
+
yields one `TooltipSample` per series — `{ seriesIndex, series, time, value, x, y, held?,
|
|
944
|
+
label?, point }` (`point` is the full `pointsAt` hit) — and the cursor's time:
|
|
945
|
+
`format(samples, { time })`.
|
|
946
|
+
|
|
947
|
+
Options: `format` (HTML; default = the cursor's time as header + `name: value` rows, the
|
|
948
|
+
value as the axis writes it, a held value with its measuring time), `snapRadius` (px,
|
|
949
|
+
default ∞), `points` (passed on to `pointsAt`: `mode`, `modes`, `maxAgeMs`, `overlays`,
|
|
950
|
+
`hidden`), `className` (default `mlc-tooltip`), and
|
|
910
951
|
`showPicks` / `pickRadius` / `picksClassName` for the markers. Style the box via
|
|
911
952
|
the `.mlc-tooltip` CSS class — **don't set `transform`**; placement (incl. the
|
|
912
953
|
flip) is computed in JS.
|
|
@@ -919,19 +960,39 @@ data, not HTML. `chart.pointsAt(x, y, options?)` returns it, in SVG pixels, afte
|
|
|
919
960
|
|
|
920
961
|
```ts
|
|
921
962
|
chart.renderCommands();
|
|
922
|
-
const points = chart.pointsAt(px, py, {
|
|
923
|
-
// [{ seriesId, name, axisIndex, time, value, x, y, distance }, …]
|
|
963
|
+
const points = chart.pointsAt(px, py, { hidden: ['flow'] });
|
|
964
|
+
// [{ seriesId, name, axisIndex, time, value, held?, color, line?, label?, x, y, distance }, …]
|
|
924
965
|
```
|
|
925
966
|
|
|
926
|
-
The
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
-
|
|
933
|
-
|
|
934
|
-
-
|
|
967
|
+
**The rule: `pointsAt` returns what the drawn line shows at the pointer.** The same rules apply
|
|
968
|
+
in the Go port (`PointsAt`):
|
|
969
|
+
|
|
970
|
+
- **In series order**, at most one point per visible series — a tooltip's rows do not jump when
|
|
971
|
+
the pointer crosses between two curves. `distance` is in every hit; sort by it yourself if you
|
|
972
|
+
want the nearest first.
|
|
973
|
+
- **`mode: 'nearest'`** (default for ordinary lines): the point nearest in time, within `radius`
|
|
974
|
+
pixels horizontally (default 20).
|
|
975
|
+
- **`mode: 'hold'`** (default for a step line, `shape: 'step'`): the last measurement at or before
|
|
976
|
+
the pointer — a door open from minute 10 to 40 is open at minute 38. The held value comes with
|
|
977
|
+
`held: true` and `time` = when it was measured, so a tooltip can say "8.0 °C (measured 00:01)".
|
|
978
|
+
Holding ends where the line ends: at a gap marker (`value: null`), at a jump over the series'
|
|
979
|
+
`gapThreshold`, and after `maxAgeMs`. For a sensor that reports only on change, `mode: 'hold'`
|
|
980
|
+
gives its last measured value — draw it as a step line if the curve should show that too.
|
|
981
|
+
- `modes: { [seriesId]: 'hold' | 'nearest' }` overrides `mode` per series.
|
|
982
|
+
- Gaps, `synthetic` points and series listed in `hidden` (by `id`, or `name` when there is none)
|
|
983
|
+
do not count; an aggregated series gives its bucket — `min`, `max`, `avg`, `count`.
|
|
984
|
+
- `color` and `line` are the series' colour and line pattern, as in its legend entry. `label` is
|
|
985
|
+
the value as the axis writes it: the state name of an enum series (`enumMap`, also in Go), else
|
|
986
|
+
the value through the axis' `format` (TypeScript only — a format is a function and does not
|
|
987
|
+
travel as JSON).
|
|
988
|
+
- Outside the plot area there is nothing.
|
|
989
|
+
- **`overlays: true`** adds the overlays' values (moving average, MKT, standard deviation band),
|
|
990
|
+
each right after its series' hit and following the series' mode. They carry `overlayOf`,
|
|
991
|
+
`overlayIndex` and `overlayKind`; a band gives `low`/`high` and its mean as `value`. Off by
|
|
992
|
+
default — an overlay is no measurement. `limits` never count.
|
|
993
|
+
|
|
994
|
+
`chart.warnings()` lists configuration hints — today: two series sharing a `seriesId`, which
|
|
995
|
+
`hidden` and `pointsAt` cannot tell apart.
|
|
935
996
|
|
|
936
997
|
### Zoom / pan
|
|
937
998
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { M as MLTimeGraphOptions, L as LegendItem, R as Renderer, a as LayoutResult, b as Margin, A as AxesConfig, X as XAxisConfig, Y as YAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-
|
|
2
|
-
export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-
|
|
3
|
-
import {
|
|
4
|
-
export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as GapConfig, O as GapLabel, Q as GapRegion, U as GapStyle, G as GridLayer, V as LineShape, W as LineStyle, X as MarkerStyle, Y as MovingAverageType, Z as SVGLineStyle, _ as SensorType, $ as SeriesOverlay, a0 as SeriesOverlayKind, a1 as SeriesType, a2 as ShadowStyle, a3 as SolidDashStyle, a4 as ThresholdLabelConfig, a5 as getLineStyle, a6 as resolveDash } from './scale-
|
|
1
|
+
import { M as MLTimeGraphOptions, L as LegendItem, R as Renderer, a as LayoutResult, b as Margin, A as AxesConfig, X as XAxisConfig, Y as YAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-CN1N04nS.js';
|
|
2
|
+
export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-CN1N04nS.js';
|
|
3
|
+
import { e as AnySeries, i as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './scale-kRRbXFik.js';
|
|
4
|
+
export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as GapConfig, O as GapLabel, Q as GapRegion, U as GapStyle, G as GridLayer, V as LineShape, W as LineStyle, X as MarkerStyle, Y as MovingAverageType, Z as SVGLineStyle, _ as SensorType, $ as SeriesOverlay, a0 as SeriesOverlayKind, a1 as SeriesType, a2 as ShadowStyle, a3 as SolidDashStyle, a4 as ThresholdLabelConfig, a5 as getLineStyle, a6 as resolveDash } from './scale-kRRbXFik.js';
|
|
5
5
|
|
|
6
6
|
/*!
|
|
7
7
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -9,13 +9,15 @@ export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y
|
|
|
9
9
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/** How a series picks its point: the nearest in time, or the last one held. */
|
|
13
|
+
type PointsAtMode = "nearest" | "hold";
|
|
12
14
|
/** One series' point under the pointer. */
|
|
13
15
|
interface PointAt {
|
|
14
16
|
/** The series' `id`, or its `name` when it has none -- the key for `hidden`. */
|
|
15
17
|
seriesId: string;
|
|
16
18
|
name: string;
|
|
17
19
|
axisIndex: number;
|
|
18
|
-
/** Time of the
|
|
20
|
+
/** Time of the MEASUREMENT (ms) -- for a held value, when it was measured. */
|
|
19
21
|
time: number;
|
|
20
22
|
/** The measured value -- raw series only. */
|
|
21
23
|
value?: number;
|
|
@@ -24,7 +26,37 @@ interface PointAt {
|
|
|
24
26
|
max?: number;
|
|
25
27
|
avg?: number;
|
|
26
28
|
count?: number;
|
|
27
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* The value was measured before the pointer and is carried forward (mode
|
|
31
|
+
* `'hold'`) -- a tooltip can say "8.0 °C (measured 00:01)" instead of
|
|
32
|
+
* claiming a measurement at the pointer.
|
|
33
|
+
*/
|
|
34
|
+
held?: boolean;
|
|
35
|
+
/** The series' colour and line pattern, as in its legend entry. */
|
|
36
|
+
color: string;
|
|
37
|
+
line?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The value as the axis writes it: the state name of an enum series
|
|
40
|
+
* (`enumMap`, also in Go), else the value through the axis' `format` (TS
|
|
41
|
+
* only -- a format is a function and does not travel as JSON).
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Set on the hit of an OVERLAY (`overlays: true`): the series it belongs to,
|
|
46
|
+
* the overlay's position in `overlays` and its kind. `seriesId` is the
|
|
47
|
+
* series' too -- key a tooltip row by `seriesId` + `overlayIndex`.
|
|
48
|
+
*/
|
|
49
|
+
overlayOf?: string;
|
|
50
|
+
overlayIndex?: number;
|
|
51
|
+
overlayKind?: "movingAverage" | "movingMkt" | "stdDevBand";
|
|
52
|
+
/** The edges of a `stdDevBand` overlay; `value` is its moving mean. */
|
|
53
|
+
low?: number;
|
|
54
|
+
high?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Screen position in SVG pixels, on the series' line. For a held value
|
|
57
|
+
* that is the pointer's x -- the line runs there at the held value.
|
|
58
|
+
* For a bucket, `y` is its average.
|
|
59
|
+
*/
|
|
28
60
|
x: number;
|
|
29
61
|
y: number;
|
|
30
62
|
/** Distance to the pointer in pixels; for a bucket, to its min..max band. */
|
|
@@ -32,12 +64,27 @@ interface PointAt {
|
|
|
32
64
|
}
|
|
33
65
|
interface PointsAtOptions {
|
|
34
66
|
/**
|
|
35
|
-
* How far (horizontally, in pixels) a point may lie from the pointer
|
|
36
|
-
* Default: the theme's `tooltipSnapRadius` (20).
|
|
67
|
+
* How far (horizontally, in pixels) a point may lie from the pointer in
|
|
68
|
+
* mode `'nearest'`. Default: the theme's `tooltipSnapRadius` (20).
|
|
37
69
|
*/
|
|
38
70
|
radius?: number;
|
|
39
71
|
/** Series ids (see {@link PointAt.seriesId}) the user has hidden. */
|
|
40
72
|
hidden?: Iterable<string>;
|
|
73
|
+
/**
|
|
74
|
+
* How every series picks its point. Default: `'hold'` for a step line
|
|
75
|
+
* (`shape: 'step'`), else `'nearest'`.
|
|
76
|
+
*/
|
|
77
|
+
mode?: PointsAtMode;
|
|
78
|
+
/** Per series id, overriding `mode`. */
|
|
79
|
+
modes?: Record<string, PointsAtMode>;
|
|
80
|
+
/** In mode `'hold'`: how old a held value may be (ms). Default: no limit. */
|
|
81
|
+
maxAgeMs?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Also the overlays' values (moving average, MKT, standard deviation band),
|
|
84
|
+
* each after its series' hit. They are no measurement, so off by default.
|
|
85
|
+
* `limits` overlays never count -- they are fixed lines, not values in time.
|
|
86
|
+
*/
|
|
87
|
+
overlays?: boolean;
|
|
41
88
|
}
|
|
42
89
|
|
|
43
90
|
/*!
|
|
@@ -59,6 +106,10 @@ declare class MLTimeGraph {
|
|
|
59
106
|
* misst, und die Zusage "dasselbe JSON, dasselbe Bild" faellt.
|
|
60
107
|
*/
|
|
61
108
|
private readonly _textMetrics;
|
|
109
|
+
/** Das eigene Schema dieses Diagramms (Option `theme`), ueber dem globalen. */
|
|
110
|
+
private readonly _theme?;
|
|
111
|
+
/** Was die Overlays beim letzten renderCommands berechnet haben, je Reihe. */
|
|
112
|
+
private readonly _overlayWerte;
|
|
62
113
|
/** Serien auf die Zeichenflaeche beschneiden (Vorgabe: ja) — siehe options.ts. */
|
|
63
114
|
private readonly _clipSeries;
|
|
64
115
|
private readonly _markers;
|
|
@@ -116,8 +167,12 @@ declare class MLTimeGraph {
|
|
|
116
167
|
private _layoutMitLegende;
|
|
117
168
|
/**
|
|
118
169
|
* Compute the chart's renderer-agnostic draw commands.
|
|
170
|
+
*
|
|
171
|
+
* Mit dem eigenen Schema (Option `theme`), falls gesetzt -- wie alle
|
|
172
|
+
* oeffentlichen Wege, die Schemawerte lesen (legendItems, layout, pointsAt).
|
|
119
173
|
*/
|
|
120
174
|
renderCommands(): DrawCommand[];
|
|
175
|
+
private _zeichne;
|
|
121
176
|
/** Build the draw commands for a single series based on its type. */
|
|
122
177
|
/**
|
|
123
178
|
* Wie die Linie einer skalaren Reihe gezeichnet wird: ihr Grund-Eintrag,
|
|
@@ -131,6 +186,7 @@ declare class MLTimeGraph {
|
|
|
131
186
|
private _renderSeries;
|
|
132
187
|
private _interpolateValue;
|
|
133
188
|
legendItems(): LegendItem[];
|
|
189
|
+
private _legendeneintraege;
|
|
134
190
|
/**
|
|
135
191
|
* Die Farbe einer Reihe ohne eigene Angabe.
|
|
136
192
|
*
|
|
@@ -165,6 +221,14 @@ declare class MLTimeGraph {
|
|
|
165
221
|
};
|
|
166
222
|
get timeScale(): TimeScale | undefined;
|
|
167
223
|
get valueScales(): Map<number, LinearScale>;
|
|
224
|
+
/**
|
|
225
|
+
* Hints about the configuration that are not errors but cause surprises.
|
|
226
|
+
* Same texts in the Go port (`Warnings()`).
|
|
227
|
+
*
|
|
228
|
+
* Today: two series with the same `seriesId` (their `id`, or their `name`
|
|
229
|
+
* when they have none) -- `hidden` and `pointsAt` cannot tell them apart.
|
|
230
|
+
*/
|
|
231
|
+
warnings(): string[];
|
|
168
232
|
/**
|
|
169
233
|
* The points under the pointer at (x, y), in SVG pixels -- for a tooltip
|
|
170
234
|
* that gets data instead of HTML. Valid after `renderCommands()`, like
|
|
@@ -177,6 +241,7 @@ declare class MLTimeGraph {
|
|
|
177
241
|
* area there is nothing. Same rules in the Go port (`PointsAt`).
|
|
178
242
|
*/
|
|
179
243
|
pointsAt(x: number, y: number, options?: PointsAtOptions): PointAt[];
|
|
244
|
+
private _punkteAm;
|
|
180
245
|
invertTime(x: number): number;
|
|
181
246
|
invertValue(y: number, axisIndex?: number): number;
|
|
182
247
|
project(time: number, value: number, axisIndex?: number): {
|
|
@@ -219,20 +284,29 @@ declare function autoMargin(options: MLTimeGraphOptions, opts?: AutoMarginOption
|
|
|
219
284
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
220
285
|
*/
|
|
221
286
|
|
|
222
|
-
/**
|
|
287
|
+
/**
|
|
288
|
+
* A single sample at the cursor — one per series, found by `chart.pointsAt`:
|
|
289
|
+
* the value the drawn line shows there (a step line holds its last value).
|
|
290
|
+
*/
|
|
223
291
|
interface TooltipSample {
|
|
224
292
|
/** Index of the series in the chart's `series[]`. */
|
|
225
293
|
seriesIndex: number;
|
|
226
294
|
/** The series itself (for `.name`, `.style.line.color`, etc.). */
|
|
227
295
|
series: AnySeries;
|
|
228
|
-
/**
|
|
296
|
+
/** Time of the MEASUREMENT (ms) — for a held value, when it was measured. */
|
|
229
297
|
time: number;
|
|
230
298
|
/** Numeric value of the sample. For aggregated series this is the `avg`. */
|
|
231
299
|
value: number;
|
|
232
|
-
/** Pixel X of the sample in the rendered SVG. */
|
|
300
|
+
/** Pixel X of the sample in the rendered SVG (on the line). */
|
|
233
301
|
x: number;
|
|
234
302
|
/** Pixel Y of the sample in the rendered SVG. */
|
|
235
303
|
y: number;
|
|
304
|
+
/** The value was measured before the cursor and is carried forward. */
|
|
305
|
+
held?: boolean;
|
|
306
|
+
/** The value as the axis writes it (enum state, axis `format`). */
|
|
307
|
+
label?: string;
|
|
308
|
+
/** Everything `pointsAt` knows about the hit (colour, overlay, bucket …). */
|
|
309
|
+
point: PointAt;
|
|
236
310
|
}
|
|
237
311
|
/** Configuration for the DOM-attached tooltip helper. */
|
|
238
312
|
interface TooltipOptions {
|
|
@@ -244,13 +318,20 @@ interface TooltipOptions {
|
|
|
244
318
|
* `innerHTML`. If not given, a sensible default is used (time header
|
|
245
319
|
* + one row per series with `name: value`).
|
|
246
320
|
*/
|
|
247
|
-
format?: (samples: TooltipSample[]
|
|
321
|
+
format?: (samples: TooltipSample[], cursor: {
|
|
322
|
+
time: number;
|
|
323
|
+
}) => string;
|
|
248
324
|
/**
|
|
249
|
-
* Maximum cursor-to-sample distance in pixels for a sample to count
|
|
250
|
-
* Default: `Infinity` (always
|
|
251
|
-
* series, regardless of distance).
|
|
325
|
+
* Maximum cursor-to-sample distance in pixels for a sample to count
|
|
326
|
+
* (mode `'nearest'`). Default: `Infinity` (always the nearest sample of
|
|
327
|
+
* each series, regardless of distance).
|
|
252
328
|
*/
|
|
253
329
|
snapRadius?: number;
|
|
330
|
+
/**
|
|
331
|
+
* Passed on to `chart.pointsAt`: `mode`, `modes`, `maxAgeMs`, `overlays`,
|
|
332
|
+
* `hidden`. A step line holds its value by default.
|
|
333
|
+
*/
|
|
334
|
+
points?: Omit<PointsAtOptions, "radius">;
|
|
254
335
|
/** CSS class for the tooltip `<div>`. Default: `'mlc-tooltip'`. */
|
|
255
336
|
className?: string;
|
|
256
337
|
/**
|
|
@@ -265,10 +346,15 @@ interface TooltipOptions {
|
|
|
265
346
|
}
|
|
266
347
|
/**
|
|
267
348
|
* Attach an interactive tooltip to a rendered chart. Listens to mousemove
|
|
268
|
-
* on the chart's `<svg>` element,
|
|
269
|
-
* at the cursor
|
|
349
|
+
* on the chart's `<svg>` element, asks `chart.pointsAt` for the value each
|
|
350
|
+
* series' line shows at the cursor, and renders the result via the `format`
|
|
270
351
|
* callback into a positioned `<div>`.
|
|
271
352
|
*
|
|
353
|
+
* Until 1.15.0 this helper searched the nearest sample in time by itself --
|
|
354
|
+
* on a step line that is the wrong value (a door open from minute 10 to 40
|
|
355
|
+
* read "closed" at minute 38). Now it goes through `pointsAt`, the same rules
|
|
356
|
+
* as any own tooltip.
|
|
357
|
+
*
|
|
272
358
|
* Returns a cleanup function that removes the listeners and the tooltip
|
|
273
359
|
* element. Idempotent — calling cleanup twice is a no-op.
|
|
274
360
|
*
|
|
@@ -336,6 +422,55 @@ interface MountOptions extends MLTimeGraphOptions {
|
|
|
336
422
|
*/
|
|
337
423
|
declare function mount(target: HTMLElement | string, options?: MountOptions): MLTimeGraph;
|
|
338
424
|
|
|
425
|
+
/*!
|
|
426
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
427
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
428
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
429
|
+
*/
|
|
430
|
+
/** Das Noetigste eines SVG-Elements -- ein echtes `SVGSVGElement` passt. */
|
|
431
|
+
interface SvgFuerZeiger {
|
|
432
|
+
getScreenCTM?(): {
|
|
433
|
+
a: number;
|
|
434
|
+
b: number;
|
|
435
|
+
c: number;
|
|
436
|
+
d: number;
|
|
437
|
+
e: number;
|
|
438
|
+
f: number;
|
|
439
|
+
inverse(): {
|
|
440
|
+
a: number;
|
|
441
|
+
b: number;
|
|
442
|
+
c: number;
|
|
443
|
+
d: number;
|
|
444
|
+
e: number;
|
|
445
|
+
f: number;
|
|
446
|
+
};
|
|
447
|
+
} | null;
|
|
448
|
+
getBoundingClientRect(): {
|
|
449
|
+
left: number;
|
|
450
|
+
top: number;
|
|
451
|
+
width: number;
|
|
452
|
+
height: number;
|
|
453
|
+
};
|
|
454
|
+
viewBox?: {
|
|
455
|
+
baseVal: {
|
|
456
|
+
x: number;
|
|
457
|
+
y: number;
|
|
458
|
+
width: number;
|
|
459
|
+
height: number;
|
|
460
|
+
} | null;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* The pointer position in the SVG's own coordinates -- the pixels that
|
|
465
|
+
* `pointsAt`, `invertTime` and `plotRect` speak. Correct at any scaling,
|
|
466
|
+
* `viewBox` and CSS transform (via `getScreenCTM()`); without a screen
|
|
467
|
+
* matrix (not laid out yet) it falls back to `viewBox` and the element's box.
|
|
468
|
+
*/
|
|
469
|
+
declare function zeigerImSvg(svg: SvgFuerZeiger, clientX: number, clientY: number): {
|
|
470
|
+
x: number;
|
|
471
|
+
y: number;
|
|
472
|
+
};
|
|
473
|
+
|
|
339
474
|
/*!
|
|
340
475
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
341
476
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
@@ -957,6 +1092,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
|
|
|
957
1092
|
* Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
|
|
958
1093
|
* kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
|
|
959
1094
|
*/
|
|
960
|
-
declare const VERSION = "1.
|
|
1095
|
+
declare const VERSION = "1.16.0";
|
|
961
1096
|
|
|
962
|
-
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AutoMarginOptions, AxesConfig, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, type LimitStatsPoint, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, type MktPoint, type OptionsLayer, type PointAt, PointStyleType, type PointsAtOptions, RangeLabelPosition, SVGRenderer, SeriesStyle, SmoothingType, type StatsAggregatedPoint, type StdDevPoint, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
|
|
1097
|
+
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AutoMarginOptions, AxesConfig, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, type LimitStatsPoint, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, type MktPoint, type OptionsLayer, type PointAt, PointStyleType, type PointsAtOptions, RangeLabelPosition, SVGRenderer, SeriesStyle, SmoothingType, type StatsAggregatedPoint, type StdDevPoint, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };
|