ml-time-graph 1.0.0 → 1.0.2
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/API_DESIGN.md +1211 -0
- package/dist/analyze/index.d.ts +272 -46
- package/dist/analyze/index.js +11 -570
- package/dist/index.d.ts +144 -9
- package/dist/index.js +57 -3420
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +2 -435
- package/dist/internals.d.ts +20 -5
- package/dist/internals.js +40 -2455
- package/dist/{layout-Sc5UkC0r.d.ts → layout-CkEYYdSw.d.ts} +1 -1
- package/dist/{scale-Cbr0KpPz.d.ts → scale-O3OLrmn5.d.ts} +37 -15
- package/package.json +65 -80
- package/dist/aggregated_subtypes-DZNZyFTX.d.ts +0 -43
- /package/{MKT_AGGREGATE.md → docs/MKT_AGGREGATE.md} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as DrawCommand, s as DrawGroup, _ as PointStyleType } from './scale-O3OLrmn5.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = 'svg' | 'canvas' | 'none';
|
|
@@ -53,6 +53,15 @@ interface DrawPath extends DrawEffects {
|
|
|
53
53
|
type: 'path';
|
|
54
54
|
points: Point[];
|
|
55
55
|
smoothing?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* When `smoothing` is enabled, only apply the Catmull-Rom spline to the
|
|
58
|
+
* first `smoothCount` points; the remaining points connect with straight
|
|
59
|
+
* `L` commands. Used by fill polygons: the data-following top curve should
|
|
60
|
+
* be smoothed, but the flat baseline must stay straight — otherwise the
|
|
61
|
+
* spline rounds the corners and bulges past the start/end data points.
|
|
62
|
+
* Unset (or ≥ points.length) keeps the current behaviour: smooth all.
|
|
63
|
+
*/
|
|
64
|
+
smoothCount?: number;
|
|
56
65
|
stroke?: string;
|
|
57
66
|
strokeWidth?: number;
|
|
58
67
|
fill?: string;
|
|
@@ -454,17 +463,6 @@ interface DataPoint {
|
|
|
454
463
|
*/
|
|
455
464
|
synthetic?: boolean;
|
|
456
465
|
}
|
|
457
|
-
/**
|
|
458
|
-
* Limits + activation energy for pre-computed slot-level statistics (MKT,
|
|
459
|
-
* minutes-above/below). When passed to `aggregateBySlot`, the returned
|
|
460
|
-
* slots are widened to `StatsAggregatedPoint`. At render time, an
|
|
461
|
-
* equivalent on-the-fly variant is the `limits` / `movingMkt` overlay.
|
|
462
|
-
*/
|
|
463
|
-
interface AggregationThresholds {
|
|
464
|
-
limitLow: number;
|
|
465
|
-
limitHigh: number;
|
|
466
|
-
activationEnergy?: number;
|
|
467
|
-
}
|
|
468
466
|
/** Aggregierter Messwert pro Zeitslot (hourly/daily/custom). */
|
|
469
467
|
interface AggregatedPoint {
|
|
470
468
|
/** Slot-Start-Zeit (ms) */
|
|
@@ -565,8 +563,20 @@ interface GapConfig {
|
|
|
565
563
|
minGapMs?: number;
|
|
566
564
|
gaps?: Gap[];
|
|
567
565
|
}
|
|
568
|
-
/** Possible positions for threshold labels
|
|
569
|
-
|
|
566
|
+
/** Possible positions for threshold labels.
|
|
567
|
+
*
|
|
568
|
+
* Inside the plot area:
|
|
569
|
+
* 'left' / 'right' — at the plot edge, INSIDE the rect (overlaps data if line is busy).
|
|
570
|
+
* 'above' / 'below' — above / below the threshold line, centred on the time domain.
|
|
571
|
+
* 'center' — middle of the threshold line, inside the plot.
|
|
572
|
+
*
|
|
573
|
+
* Outside the plot area (in the axis gutter, alongside the tick labels):
|
|
574
|
+
* 'outside-left' — to the LEFT of the plot rect.
|
|
575
|
+
* 'outside-right' — to the RIGHT of the plot rect.
|
|
576
|
+
* Use these for audit-style charts where the absolute threshold value
|
|
577
|
+
* must be readable without crossing the data line.
|
|
578
|
+
*/
|
|
579
|
+
type ThresholdLabelPosition = "left" | "right" | "above" | "below" | "center" | "outside-left" | "outside-right";
|
|
570
580
|
interface ThresholdLabelConfig {
|
|
571
581
|
/** Label text (default: the threshold's name). */
|
|
572
582
|
text?: string;
|
|
@@ -590,6 +600,12 @@ interface Threshold {
|
|
|
590
600
|
fillHatch?: HatchVariant;
|
|
591
601
|
fillOpacity?: number;
|
|
592
602
|
label?: false | string | ThresholdLabelConfig;
|
|
603
|
+
/**
|
|
604
|
+
* Which Y-axis this threshold's `value` is on. Default 0 (left).
|
|
605
|
+
* Set to 1 to anchor the threshold to the right Y-axis — e.g. a
|
|
606
|
+
* humidity threshold on a dual-axis temperature + humidity chart.
|
|
607
|
+
*/
|
|
608
|
+
axisIndex?: number;
|
|
593
609
|
/** Optional SVG id prefix for threshold elements. Generated ids: `<id>-line`, `<id>-fill`, `<id>-label`. */
|
|
594
610
|
id?: string;
|
|
595
611
|
shadowColor?: string;
|
|
@@ -620,10 +636,16 @@ interface DataPointRef {
|
|
|
620
636
|
/**
|
|
621
637
|
* A free-form, user-supplied overlay drawn in data coordinates (time/value).
|
|
622
638
|
* The chart projects it to pixels, so it tracks the data through zoom/resize.
|
|
623
|
-
*
|
|
639
|
+
*
|
|
640
|
+
* - `id` — stable handle for `disableAnnotation()` / `enableAnnotation()`
|
|
641
|
+
* and for the wrapper `<g id="annotation-{slug}">` in the SVG
|
|
642
|
+
* output (lets external code toggle visibility via CSS).
|
|
643
|
+
* - `title` — human-readable label, used by toggle panels / legends.
|
|
644
|
+
* Not drawn in the chart itself.
|
|
624
645
|
*/
|
|
625
646
|
type Annotation = {
|
|
626
647
|
id?: string;
|
|
648
|
+
title?: string;
|
|
627
649
|
} & ({
|
|
628
650
|
type: "line";
|
|
629
651
|
from: DataPointRef;
|
|
@@ -821,4 +843,4 @@ declare class BandScale implements Scale {
|
|
|
821
843
|
positions(): Map<string, number>;
|
|
822
844
|
}
|
|
823
845
|
|
|
824
|
-
export { type
|
|
846
|
+
export { type RectParams as $, type AggregatedPoint as A, BandScale as B, type CircleParams as C, type Dashstyle_t as D, type EnumMap as E, type FillBound as F, type FillSpec as G, type FillStyle as H, type Gap as I, type GapConfig as J, type GapLabel as K, type GapRegion as L, type GapStyle as M, type GapsConfig as N, type HatchVariant as O, type Highlight as P, type LabelAnchor as Q, type LineDashStyle as R, type LineParams as S, type LineStyle as T, type LineVariant as U, LinearScale as V, type LinearScaleConfig as W, type MarkerStyle as X, type PathParams as Y, type Point as Z, type PointStyleType as _, type AggregatedSeries as a, type Scale as a0, type ScaleConfig as a1, type SensorType as a2, type SeriesOverlay as a3, type SeriesOverlayKind as a4, type SeriesStyle as a5, type SeriesType as a6, type ShadowStyle as a7, TIME_INTERVALS as a8, type TextParams as a9, type Threshold as aa, type ThresholdLabelConfig as ab, type ThresholdLabelPosition as ac, TimeScale as ad, type TimeScaleConfig as ae, type TimeSeries as af, getHatch as ag, type AggregationConfig as b, type AggregationMode as c, type Annotation as d, type AnnotationBandConfig as e, type AnnotationBandItem as f, type AnySeries as g, type AxisOrientation as h, type AxisPosition as i, type BandScaleConfig as j, type DataPoint as k, type DataPointRef as l, type DomainScaleConfig as m, type DrawCircle as n, type DrawCommand as o, type DrawGap as p, type DrawGapType_t as q, type DrawGradient as r, type DrawGroup as s, type DrawLine as t, type DrawPath as u, type DrawRect as v, type DrawText as w, type FillDirectionType as x, type FillRegion as y, type FillSide as z };
|
package/package.json
CHANGED
|
@@ -1,85 +1,70 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"./internals": {
|
|
15
|
-
"types": "./dist/internals.d.ts",
|
|
16
|
-
"import": "./dist/internals.js"
|
|
17
|
-
},
|
|
18
|
-
"./analyze": {
|
|
19
|
-
"types": "./dist/analyze/index.d.ts",
|
|
20
|
-
"import": "./dist/analyze/index.js"
|
|
21
|
-
},
|
|
22
|
-
"./interaction": {
|
|
23
|
-
"types": "./dist/interaction/index.d.ts",
|
|
24
|
-
"import": "./dist/interaction/index.js"
|
|
25
|
-
}
|
|
2
|
+
"name": "ml-time-graph",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "TypeScript library for time-series chart rendering — DOM-free SVG output (works in the browser and on the server).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
26
13
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"README.de.md",
|
|
31
|
-
"USAGE.md",
|
|
32
|
-
"MKT_AGGREGATE.md",
|
|
33
|
-
"LICENSE"
|
|
34
|
-
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"dev": "vite demos",
|
|
37
|
-
"build": "tsup",
|
|
38
|
-
"build:demos": "tsc -p tsconfig.demos.json",
|
|
39
|
-
"test": "vitest",
|
|
40
|
-
"test:coverage": "vitest run --coverage",
|
|
41
|
-
"typecheck": "tsc --noEmit",
|
|
42
|
-
"typecheck:demos": "tsc -p tsconfig.demos.json",
|
|
43
|
-
"lint": "eslint .",
|
|
44
|
-
"prepublishOnly": "tsup"
|
|
14
|
+
"./internals": {
|
|
15
|
+
"types": "./dist/internals.d.ts",
|
|
16
|
+
"import": "./dist/internals.js"
|
|
45
17
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"typescript",
|
|
50
|
-
"svg",
|
|
51
|
-
"renderer",
|
|
52
|
-
"ssr",
|
|
53
|
-
"sensor",
|
|
54
|
-
"monitoring",
|
|
55
|
-
"incident-analysis",
|
|
56
|
-
"mkt"
|
|
57
|
-
],
|
|
58
|
-
"author": "Michael Lechner",
|
|
59
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
60
|
-
"homepage": "https://github.com/mlc0911/mlctimegraph",
|
|
61
|
-
"repository": {
|
|
62
|
-
"type": "git",
|
|
63
|
-
"url": "git+https://gitlab.com/mlc0911/mlctimegraph.git"
|
|
18
|
+
"./analyze": {
|
|
19
|
+
"types": "./dist/analyze/index.d.ts",
|
|
20
|
+
"import": "./dist/analyze/index.js"
|
|
64
21
|
},
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"engines": {
|
|
69
|
-
"node": ">=18"
|
|
70
|
-
},
|
|
71
|
-
"devDependencies": {
|
|
72
|
-
"@eslint/js": "^10.0.1",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^8.60.0",
|
|
74
|
-
"@typescript-eslint/parser": "^8.60.0",
|
|
75
|
-
"@vitest/coverage-v8": "^4.1.6",
|
|
76
|
-
"eslint": "^10.4.0",
|
|
77
|
-
"globals": "^17.6.0",
|
|
78
|
-
"jiti": "^2.7.0",
|
|
79
|
-
"tsup": "^8.5.1",
|
|
80
|
-
"typescript": "^6.0.3",
|
|
81
|
-
"typescript-eslint": "^8.60.0",
|
|
82
|
-
"vite": "^8.0.13",
|
|
83
|
-
"vitest": "^4.1.6"
|
|
22
|
+
"./interaction": {
|
|
23
|
+
"types": "./dist/interaction/index.d.ts",
|
|
24
|
+
"import": "./dist/interaction/index.js"
|
|
84
25
|
}
|
|
85
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"docs",
|
|
30
|
+
"README.md",
|
|
31
|
+
"README.de.md",
|
|
32
|
+
"USAGE.md",
|
|
33
|
+
"API_DESIGN.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"keywords": [
|
|
37
|
+
"chart",
|
|
38
|
+
"time-series",
|
|
39
|
+
"typescript",
|
|
40
|
+
"svg",
|
|
41
|
+
"renderer",
|
|
42
|
+
"ssr",
|
|
43
|
+
"sensor",
|
|
44
|
+
"monitoring",
|
|
45
|
+
"incident-analysis",
|
|
46
|
+
"mkt"
|
|
47
|
+
],
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"ml-time-analyze": "0.1.0"
|
|
50
|
+
},
|
|
51
|
+
"author": "Michael Lechner",
|
|
52
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
53
|
+
"homepage": "https://github.com/mlc0911/mlctimegraph",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://gitlab.com/mlc0911/mlctimegraph.git",
|
|
57
|
+
"directory": "packages/ml-time-graph"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://gitlab.com/mlc0911/mlctimegraph/-/issues"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=18"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsup",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"typecheck": "tsc --noEmit"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { A as AggregatedPoint } from './scale-Cbr0KpPz.js';
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
5
|
-
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
6
|
-
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/** Slot carrying a rolling Mean Kinetic Temperature value (USP <1079.2>). */
|
|
10
|
-
interface MktPoint extends AggregatedPoint {
|
|
11
|
-
/** Mean kinetic temperature for this slot. `null` = gap. */
|
|
12
|
-
mkt: number | null;
|
|
13
|
-
/** Delta vs the previous slot's MKT (optional). */
|
|
14
|
-
deltaMkt?: number | null;
|
|
15
|
-
}
|
|
16
|
-
/** Slot carrying the standard deviation of the samples in the window. */
|
|
17
|
-
interface StdDevPoint extends AggregatedPoint {
|
|
18
|
-
/** Standard deviation of the samples in this slot. `null` = gap. */
|
|
19
|
-
stdDev: number | null;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Slot carrying minutes-above-/below-limit statistics. At least one of
|
|
23
|
-
* `minutesAboveHigh` or `minutesBelowLow` must be set.
|
|
24
|
-
*/
|
|
25
|
-
interface LimitStatsPoint extends AggregatedPoint {
|
|
26
|
-
/** Minutes above the upper limit in this slot. */
|
|
27
|
-
minutesAboveHigh?: number | null;
|
|
28
|
-
/** Minutes below the lower limit in this slot. */
|
|
29
|
-
minutesBelowLow?: number | null;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The "full-stats" aggregated slot — combines all three specialised
|
|
33
|
-
* subtypes via intersection. This is what `aggregateBySlot(data, mode,
|
|
34
|
-
* thresholds)` returns when thresholds are provided: per-slot MKT (USP
|
|
35
|
-
* <1079.2>), standard deviation, and out-of-bounds minute counters.
|
|
36
|
-
*
|
|
37
|
-
* Prefer this typed alias over plain `AggregatedPoint` whenever you
|
|
38
|
-
* downstream-consume `aggregateBySlot`'s output and want guaranteed access
|
|
39
|
-
* to the stat fields.
|
|
40
|
-
*/
|
|
41
|
-
type StatsAggregatedPoint = MktPoint & StdDevPoint & LimitStatsPoint;
|
|
42
|
-
|
|
43
|
-
export type { LimitStatsPoint as L, MktPoint as M, StatsAggregatedPoint as S, StdDevPoint as a };
|
|
File without changes
|