ml-time-graph 1.7.2 → 1.9.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 +246 -8
- package/README.de.md +104 -11
- package/README.md +101 -11
- package/SKILLS.md +157 -4
- package/USAGE.md +400 -3
- package/dist/analyze/index.d.ts +54 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +131 -16
- package/dist/index.js +25 -28
- 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-CQhADkWB.d.ts} +72 -31
- package/dist/{series_renderer-COVNvq2x.d.ts → slug-aDUz3wBN.d.ts} +27 -2
- package/package.json +17 -13
|
@@ -11,17 +11,6 @@ interface DrawEffects {
|
|
|
11
11
|
shadowOffsetY?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
/*!
|
|
15
|
-
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
16
|
-
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
17
|
-
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
18
|
-
*/
|
|
19
|
-
/** Gradient-Stop */
|
|
20
|
-
interface GradientStop {
|
|
21
|
-
offset: number;
|
|
22
|
-
color: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
14
|
/*!
|
|
26
15
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
27
16
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
@@ -81,6 +70,17 @@ type Dashstyle_t = LineVariant;
|
|
|
81
70
|
interface DrawPath extends DrawEffects {
|
|
82
71
|
type: "path";
|
|
83
72
|
points: Point[];
|
|
73
|
+
/**
|
|
74
|
+
* CSS-Klasse am Pfad — `series-line` oder `series-fill`.
|
|
75
|
+
*
|
|
76
|
+
* Bisher trugen nur Gruppen eine Klasse; ein Pfad hatte allein seine id. Die
|
|
77
|
+
* gilt aber pro DOKUMENT: Zwei Diagramme auf einer Seite ergeben denselben
|
|
78
|
+
* Serienschluessel und damit dieselbe id, und `getElementById` trifft das
|
|
79
|
+
* erste. Mit der Klasse laesst sich im Container suchen statt im Dokument
|
|
80
|
+
* (`#chart-2 .series--temperatur .series-line`) — und im Gegensatz zum
|
|
81
|
+
* crc32 in der id kann ein Aufrufer sie hinschreiben.
|
|
82
|
+
*/
|
|
83
|
+
cssClass?: string;
|
|
84
84
|
smoothing?: boolean;
|
|
85
85
|
/**
|
|
86
86
|
* When `smoothing` is enabled, only apply the Catmull-Rom spline to the
|
|
@@ -91,6 +91,15 @@ interface DrawPath extends DrawEffects {
|
|
|
91
91
|
* Unset (or ≥ points.length) keeps the current behaviour: smooth all.
|
|
92
92
|
*/
|
|
93
93
|
smoothCount?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Schliesst den Streckenzug zum Anfangspunkt (`Z` im SVG).
|
|
96
|
+
*
|
|
97
|
+
* Fuer eine FLAECHE aendert das nichts -- SVG schliesst sie von selbst.
|
|
98
|
+
* Fuer den STRICH aendert es alles: Ohne `Z` fehlt die letzte Kante, und
|
|
99
|
+
* eine Raute, ein Dreieck oder ein Stern steht mit einer offenen Seite da.
|
|
100
|
+
* Genau so sahen die Marker seit ihrer Einfuehrung aus.
|
|
101
|
+
*/
|
|
102
|
+
closed?: boolean;
|
|
94
103
|
stroke?: string;
|
|
95
104
|
strokeWidth?: number;
|
|
96
105
|
fill?: string;
|
|
@@ -173,14 +182,7 @@ interface DrawText {
|
|
|
173
182
|
/** Optional SVG `id` attribute for this element. */
|
|
174
183
|
id?: string;
|
|
175
184
|
}
|
|
176
|
-
type
|
|
177
|
-
interface DrawGradient {
|
|
178
|
-
type: "gradient";
|
|
179
|
-
points: Point[];
|
|
180
|
-
stops: GradientStop[];
|
|
181
|
-
direction: DrawDirection_t;
|
|
182
|
-
}
|
|
183
|
-
type DrawGapType_t$1 = "dashed_border" | "empty" | "label";
|
|
185
|
+
type DrawGapType_t$1 = "dashed_border" | "empty" | "filled" | "label";
|
|
184
186
|
interface DrawGap {
|
|
185
187
|
type: "gap";
|
|
186
188
|
x1: number;
|
|
@@ -208,7 +210,7 @@ interface DrawGroup {
|
|
|
208
210
|
};
|
|
209
211
|
}
|
|
210
212
|
/** Union aller Commands */
|
|
211
|
-
type DrawCommand = DrawPath | DrawLine | DrawRect | DrawCircle | DrawText |
|
|
213
|
+
type DrawCommand = DrawPath | DrawLine | DrawRect | DrawCircle | DrawText | DrawGap | DrawGroup;
|
|
212
214
|
type LineParams = Omit<DrawLine, "type">;
|
|
213
215
|
type PathParams = Omit<DrawPath, "type">;
|
|
214
216
|
type RectParams = Omit<DrawRect, "type">;
|
|
@@ -237,7 +239,7 @@ type AxisPosition = "left" | "right";
|
|
|
237
239
|
/** Text anchor alignment. */
|
|
238
240
|
type LabelAnchor = "start" | "middle" | "end";
|
|
239
241
|
/** Gap rendering style. */
|
|
240
|
-
type DrawGapType_t = "dashed_border" | "empty" | "label";
|
|
242
|
+
type DrawGapType_t = "dashed_border" | "empty" | "filled" | "label";
|
|
241
243
|
|
|
242
244
|
/*!
|
|
243
245
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -281,6 +283,18 @@ type FillBound = "series" | "chartTop" | "chartBottom" | {
|
|
|
281
283
|
threshold: string;
|
|
282
284
|
} | {
|
|
283
285
|
value: number;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Eine ANDERE Messreihe, benannt ueber ihre `id` oder, ohne die, ihren
|
|
289
|
+
* `name`. Damit laesst sich zwischen zwei Kurven fuellen -- ein
|
|
290
|
+
* Toleranzkorridor, Soll gegen Ist, zwei Sensoren im Vergleich.
|
|
291
|
+
*
|
|
292
|
+
* Die fremde Kurve wird auf die Zeitpunkte DIESER Reihe interpoliert; wo sie
|
|
293
|
+
* keinen Wert hat -- eine Luecke, oder ausserhalb ihres Zeitraums --, bricht
|
|
294
|
+
* die Flaeche ab, genau wie eine Linie an einer Luecke abbricht.
|
|
295
|
+
*/
|
|
296
|
+
| {
|
|
297
|
+
series: string;
|
|
284
298
|
};
|
|
285
299
|
/**
|
|
286
300
|
* A fill region. `from` and `to` define the Y interval; the X range is always
|
|
@@ -323,7 +337,14 @@ type FillSpec = FillStyle | {
|
|
|
323
337
|
|
|
324
338
|
/** Label placement / styling inside a gap region. */
|
|
325
339
|
interface GapLabel {
|
|
326
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Where the label sits (default `'middle'`). The same five values a
|
|
342
|
+
* highlight's `labelPosition` takes, placed by the same rule:
|
|
343
|
+
* `'top'` | `'center'` (= `'middle'`) | `'bottom'` sit inside the plot area,
|
|
344
|
+
* `'above'` | `'below'` sit in the margin around it and never cover data —
|
|
345
|
+
* but they need `margin.top` / `margin.bottom` to have somewhere to go.
|
|
346
|
+
*/
|
|
347
|
+
baseline?: "top" | "center" | "middle" | "bottom" | "above" | "below";
|
|
327
348
|
rotate?: number;
|
|
328
349
|
color?: string;
|
|
329
350
|
fontSize?: number;
|
|
@@ -331,17 +352,33 @@ interface GapLabel {
|
|
|
331
352
|
/** Visual styling of a gap region. */
|
|
332
353
|
interface GapStyle {
|
|
333
354
|
/**
|
|
334
|
-
* - `'
|
|
335
|
-
* - `'dashed_border'` —
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
355
|
+
* - `'filled'` — the area in the fill colour, no edges.
|
|
356
|
+
* - `'dashed_border'` — the area **plus** two vertical dashed lines at its
|
|
357
|
+
* borders (the default). Not a frame: the top and
|
|
358
|
+
* bottom of a gap lie on the edge of the plot area,
|
|
359
|
+
* where they say nothing and sit on the axis. Only the
|
|
360
|
+
* vertical edges carry information — there the
|
|
361
|
+
* readings stop, and there they start again.
|
|
362
|
+
* - `'empty'` — nothing. The line breaks, that is all.
|
|
363
|
+
* - `'bridge_line'` — a dotted line between the last point before the gap
|
|
364
|
+
* and the first one after. Per-series only: a
|
|
365
|
+
* chart-wide region has no readings to span.
|
|
366
|
+
*
|
|
367
|
+
* These mean the same here and in `gaps.regions[].style`. Until 1.8.0 they
|
|
368
|
+
* did not: chart-wide, `'empty'` drew a filled area, and per-series,
|
|
369
|
+
* `'filled'` drew an *empty* rectangle with a frame.
|
|
341
370
|
*/
|
|
342
371
|
display?: "empty" | "dashed_border" | "filled" | "bridge_line";
|
|
343
372
|
fill?: FillStyle;
|
|
344
373
|
opacity?: number;
|
|
374
|
+
/**
|
|
375
|
+
* How the gap's label is set — alignment, rotation, colour, size.
|
|
376
|
+
*
|
|
377
|
+
* **Not the text.** A label needs something to say, and that comes from
|
|
378
|
+
* `gaps.regions[].label`: a region knows which gap it describes, a series
|
|
379
|
+
* style does not. So on a per-series gap this block currently has nothing
|
|
380
|
+
* to align — it takes effect only for gaps that carry a text.
|
|
381
|
+
*/
|
|
345
382
|
label?: GapLabel;
|
|
346
383
|
/** Optional bridge-line style; only used when `display: 'bridge_line'`. */
|
|
347
384
|
bridge?: {
|
|
@@ -602,7 +639,8 @@ interface Gap {
|
|
|
602
639
|
/** Hatch pattern for gap fill */
|
|
603
640
|
hatch?: HatchVariant;
|
|
604
641
|
fillOpacity?: number;
|
|
605
|
-
|
|
642
|
+
/** Same five values as a highlight's `labelPosition` — see `core/range_label.ts`. */
|
|
643
|
+
labelBaseline?: "top" | "center" | "middle" | "bottom" | "above" | "below";
|
|
606
644
|
rotate?: number;
|
|
607
645
|
style?: DrawGapType_t$1;
|
|
608
646
|
}
|
|
@@ -844,6 +882,8 @@ interface TimeScaleConfig {
|
|
|
844
882
|
range: [number, number];
|
|
845
883
|
/** Locale for i18n formatting (default: 'en-US') */
|
|
846
884
|
locale?: string;
|
|
885
|
+
/** IANA-Zone fuer die Beschriftung; ohne sie die Zone der Maschine. */
|
|
886
|
+
timeZone?: string;
|
|
847
887
|
}
|
|
848
888
|
/** Maps timestamps (ms) to pixel coordinates with automatic tick interval selection. */
|
|
849
889
|
declare class TimeScale implements Scale {
|
|
@@ -853,6 +893,7 @@ declare class TimeScale implements Scale {
|
|
|
853
893
|
invert(pixel: number): number;
|
|
854
894
|
domain(): [number, number];
|
|
855
895
|
range(): [number, number];
|
|
896
|
+
get timeZone(): string | undefined;
|
|
856
897
|
get locale(): string;
|
|
857
898
|
/**
|
|
858
899
|
* Pick the "nicest" time interval that yields roughly `targetTicks` ticks
|
|
@@ -897,4 +938,4 @@ declare class BandScale implements Scale {
|
|
|
897
938
|
positions(): Map<string, number>;
|
|
898
939
|
}
|
|
899
940
|
|
|
900
|
-
export { type DomainScaleConfig as $, type AnySeries as A, type SVGLineStyle as B, type SensorType as C, type DrawCommand as D, type EnumMap as E, type FillSpec as F, type Gap as G, type Highlight as H, type SeriesOverlay as I, type SeriesOverlayKind as J, type SeriesType as K, type LineVariant as L, type MarkerStyle as M, type ShadowStyle as N, type ThresholdLabelConfig as O, type PointStyleType as P, getLineStyle as Q, resolveDash as R, type SeriesStyle as S, type Threshold as T,
|
|
941
|
+
export { type DomainScaleConfig as $, type AnySeries as A, type SVGLineStyle as B, type SensorType as C, type DrawCommand as D, type EnumMap as E, type FillSpec as F, type Gap as G, type Highlight as H, type SeriesOverlay as I, type SeriesOverlayKind as J, type SeriesType as K, type LineVariant as L, type MarkerStyle as M, type ShadowStyle as N, type ThresholdLabelConfig as O, type PointStyleType as P, getLineStyle as Q, resolveDash as R, type SeriesStyle as S, type Threshold as T, type Point as U, BandScale as V, type AxisOrientation as W, type AxisPosition as X, type BandScaleConfig as Y, type CircleParams as Z, type Dashstyle_t as _, type GapsConfig as a, type DrawCircle as a0, type DrawGap as a1, type DrawGapType_t as a2, type DrawGroup as a3, type DrawLine as a4, type DrawPath as a5, type DrawRect as a6, type DrawText as a7, type LabelAnchor as a8, type LineParams as a9, type LinearScaleConfig as aa, type PathParams as ab, type RectParams as ac, type Scale as ad, type ScaleConfig as ae, TIME_INTERVALS as af, type TextParams as ag, type TimeScaleConfig as ah, getHatch as ai, type Annotation as b, type AnnotationBandConfig as c, TimeScale as d, LinearScale as e, type TimeSeries as f, type HatchVariant as g, type ThresholdLabelPosition as h, type AnnotationBandItem as i, type AggregatedPoint as j, type AggregatedSeries as k, type DataPoint as l, type AggregationConfig as m, type AggregationMode as n, type DataPointRef as o, type FillBound as p, type FillDirectionType as q, type FillRegion as r, type FillSide as s, type FillStyle as t, type GapConfig as u, type GapLabel as v, type GapRegion as w, type GapStyle as x, type LineDashStyle as y, type LineStyle as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DrawCommand, L as LineVariant, P as PointStyleType,
|
|
1
|
+
import { D as DrawCommand, L as LineVariant, P as PointStyleType, a3 as DrawGroup, j as AggregatedPoint, d as TimeScale, e as LinearScale, l as DataPoint } from './scale-CQhADkWB.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = "svg" | "canvas" | "none";
|
|
@@ -42,6 +42,15 @@ declare abstract class Renderer {
|
|
|
42
42
|
* Override individual values or mutate `theme` to restyle the chart globally.
|
|
43
43
|
*/
|
|
44
44
|
declare const theme: {
|
|
45
|
+
/**
|
|
46
|
+
* Schriftstapel fuer jeden Text im Diagramm.
|
|
47
|
+
*
|
|
48
|
+
* Metrikkompatibel gewaehlt, nicht nach Aussehen: Liberation Sans hat
|
|
49
|
+
* dieselben Vorschubbreiten wie Arial. Linux landet auf Liberation, Windows
|
|
50
|
+
* und macOS auf Arial bzw. Helvetica -- die Beschriftungen brauchen ueberall
|
|
51
|
+
* denselben Platz. DejaVu Sans waere deutlich breiter.
|
|
52
|
+
*/
|
|
53
|
+
readonly fontFamily: "Liberation Sans, Arial, Helvetica, sans-serif";
|
|
45
54
|
/** Default stroke color for series lines */
|
|
46
55
|
readonly stroke: "#4285f4";
|
|
47
56
|
/** Default line width in pixels */
|
|
@@ -404,4 +413,20 @@ declare function renderMarkers(points: DataPoint[], ctx: RenderingContext, style
|
|
|
404
413
|
declare function drawMarker(// NOSONAR
|
|
405
414
|
commands: DrawCommand[], id: string | undefined, shape: Exclude<PointStyleType, "none">, x: number, y: number, size: number, stroke: string, fill: string, sw: number): void;
|
|
406
415
|
|
|
407
|
-
|
|
416
|
+
/*!
|
|
417
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
418
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
419
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
420
|
+
*/
|
|
421
|
+
/**
|
|
422
|
+
* Turn a free-form name into an ASCII slug usable as an `id`/CSS-class
|
|
423
|
+
* suffix. Lowercased, non-alphanumeric runs collapsed to `-`, accents
|
|
424
|
+
* stripped, trimmed, capped at 50 chars. Empty input → `'unnamed'`.
|
|
425
|
+
*
|
|
426
|
+
* slugify('Temperatur (°C)') → 'temperatur-c'
|
|
427
|
+
* slugify('Signal A') → 'signal-a'
|
|
428
|
+
* slugify(' ') → 'unnamed'
|
|
429
|
+
*/
|
|
430
|
+
declare function slugify(s: string | undefined | null): string;
|
|
431
|
+
|
|
432
|
+
export { type LegendOrientation as L, type Marker as M, Renderer as R, type Theme as T, type LegendItem as a, type LayoutResult as b, type RenderOutput as c, drawMarker as d, slugify as e, Layout as f, getDefaultTheme as g, type LayoutConfig as h, type LegendConfig as i, renderArea as j, renderLegend as k, renderLine as l, measureLegend as m, renderMarkers as n, renderSplitLine as o, renderStep as p, renderZonedArea as q, resetDefaultTheme as r, setDefaultTheme as s, toStepData as t, toStepPoints as u };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-time-graph",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "TypeScript library for time-series
|
|
3
|
+
"version": "1.9.0",
|
|
4
|
+
"description": "TypeScript library for time-series charts with rich contextual annotation — telemetry, sensors, metrics, logs, finance. DOM-free SVG output, identical in the browser and on the server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -37,14 +37,6 @@
|
|
|
37
37
|
"GRAPH_JSON_STRUCTURE.md",
|
|
38
38
|
"LICENSE"
|
|
39
39
|
],
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "tsup",
|
|
42
|
-
"test": "vitest run",
|
|
43
|
-
"typecheck": "tsc --noEmit",
|
|
44
|
-
"prepublishOnly": "tsup",
|
|
45
|
-
"prepack": "node ../../scripts/sync-changelog.mjs",
|
|
46
|
-
"postpack": "node ../../scripts/sync-changelog.mjs --clean"
|
|
47
|
-
},
|
|
48
40
|
"keywords": [
|
|
49
41
|
"chart",
|
|
50
42
|
"time-series",
|
|
@@ -55,10 +47,17 @@
|
|
|
55
47
|
"sensor",
|
|
56
48
|
"monitoring",
|
|
57
49
|
"incident-analysis",
|
|
58
|
-
"mkt"
|
|
50
|
+
"mkt",
|
|
51
|
+
"annotations",
|
|
52
|
+
"telemetry",
|
|
53
|
+
"metrics",
|
|
54
|
+
"logs",
|
|
55
|
+
"observability",
|
|
56
|
+
"dataviz",
|
|
57
|
+
"visualization"
|
|
59
58
|
],
|
|
60
59
|
"devDependencies": {
|
|
61
|
-
"ml-time-analyze": "
|
|
60
|
+
"ml-time-analyze": "0.1.1"
|
|
62
61
|
},
|
|
63
62
|
"author": "Michael Lechner",
|
|
64
63
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -73,5 +72,10 @@
|
|
|
73
72
|
},
|
|
74
73
|
"engines": {
|
|
75
74
|
"node": ">=18"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsup",
|
|
78
|
+
"test": "vitest run",
|
|
79
|
+
"typecheck": "tsc --noEmit"
|
|
76
80
|
}
|
|
77
|
-
}
|
|
81
|
+
}
|