ml-time-graph 1.10.0 → 1.12.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 +65 -0
- package/README.de.md +33 -3
- package/README.md +31 -2
- package/SKILLS.md +111 -0
- package/dist/analyze/index.d.ts +72 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +7 -288
- package/dist/index.js +9 -9
- package/dist/interaction/index.d.ts +1 -1
- package/dist/internals.d.ts +58 -7
- package/dist/internals.js +12 -12
- package/dist/{marker_renderer-D6rDW2Pe.d.ts → marker_renderer-D5TfGx8R.d.ts} +349 -2
- package/dist/{scale-B3MhoTu1.d.ts → scale-BStQU_t-.d.ts} +53 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,289 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
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-
|
|
5
|
-
|
|
6
|
-
/*!
|
|
7
|
-
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
8
|
-
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
9
|
-
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/** Tick density / sizing for one axis. */
|
|
13
|
-
interface TickConfig {
|
|
14
|
-
/** Target number of major (labelled) ticks. */
|
|
15
|
-
major?: number;
|
|
16
|
-
/** How many minor ticks to place between two major ticks. Default 0 = off. */
|
|
17
|
-
minor?: number;
|
|
18
|
-
/** Tick mark length in px. */
|
|
19
|
-
size?: number;
|
|
20
|
-
}
|
|
21
|
-
/** Grid line styling for one tick level. `false` disables that grid level. */
|
|
22
|
-
interface GridLineStyle {
|
|
23
|
-
color?: string;
|
|
24
|
-
width?: number;
|
|
25
|
-
style?: LineVariant;
|
|
26
|
-
opacity?: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Per-axis grid configuration. Each tick level (major / minor) can be styled
|
|
30
|
-
* independently or disabled. Defaults: major grid shown with theme colours,
|
|
31
|
-
* minor grid off.
|
|
32
|
-
*/
|
|
33
|
-
interface GridStyle {
|
|
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
|
-
*/
|
|
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;
|
|
64
|
-
}
|
|
65
|
-
/** Axis baseline + tick marks styling. */
|
|
66
|
-
interface AxisStyle {
|
|
67
|
-
color?: string;
|
|
68
|
-
width?: number;
|
|
69
|
-
}
|
|
70
|
-
/** Tick / axis-label text styling. */
|
|
71
|
-
interface AxisLabelsStyle {
|
|
72
|
-
color?: string;
|
|
73
|
-
fontSize?: number;
|
|
74
|
-
}
|
|
75
|
-
/** Configuration for one Y-axis (left or right). */
|
|
76
|
-
interface YAxisConfig {
|
|
77
|
-
/** Position is 'left' or 'right' to determine placement side. Defaults to 'left'. */
|
|
78
|
-
position?: AxisPosition;
|
|
79
|
-
/** Optional explicit horizontal pixel offset from chart edge (defaults to index * 50px). */
|
|
80
|
-
offset?: number;
|
|
81
|
-
/** Rotated label drawn next to the axis. */
|
|
82
|
-
label?: string;
|
|
83
|
-
/** Override the value domain. `'auto'` lets the chart compute it from data. */
|
|
84
|
-
domain?: [number, number] | "auto";
|
|
85
|
-
/**
|
|
86
|
-
* Extra room above and below the data, **in pixels**. Ignored when `domain`
|
|
87
|
-
* is set explicitly — then you decide the range.
|
|
88
|
-
*
|
|
89
|
-
* The computed domain ends exactly at the smallest and largest reading, and
|
|
90
|
-
* the plot is clipped to its rectangle. A line of width 10 at the maximum
|
|
91
|
-
* therefore loses half its stroke, and a marker half its disc. That is right
|
|
92
|
-
* for the *value* and wrong for the *picture*.
|
|
93
|
-
*
|
|
94
|
-
* Pixels rather than a share of the range: the cause is in pixels
|
|
95
|
-
* (`style.line.width`, `markers.size`), and the same number then works for a
|
|
96
|
-
* series in °C and one in kW. A rule of thumb is half the widest stroke plus
|
|
97
|
-
* a little — `padding: 8` covers a 10 px line and a size-6 marker.
|
|
98
|
-
*
|
|
99
|
-
* ```ts
|
|
100
|
-
* axes: { left: { padding: 8 } }
|
|
101
|
-
* axes: { left: { padding: { top: 24, bottom: 4 } } } // room for a label
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
padding?: number | {
|
|
105
|
-
top?: number;
|
|
106
|
-
bottom?: number;
|
|
107
|
-
};
|
|
108
|
-
/** Format a tick value into its label text. */
|
|
109
|
-
format?: (value: number) => string;
|
|
110
|
-
/** Tick density / sizing. */
|
|
111
|
-
ticks?: TickConfig;
|
|
112
|
-
/** Per-tick-level grid styling. */
|
|
113
|
-
grid?: GridStyle;
|
|
114
|
-
/** Axis baseline + tick marks styling. */
|
|
115
|
-
axis?: AxisStyle;
|
|
116
|
-
/** Tick label text styling. */
|
|
117
|
-
labels?: AxisLabelsStyle;
|
|
118
|
-
}
|
|
119
|
-
/** Configuration for the X (time) axis. */
|
|
120
|
-
interface XAxisConfig {
|
|
121
|
-
/** Label drawn below the axis. */
|
|
122
|
-
label?: string;
|
|
123
|
-
/** Override the time domain. `'auto'` lets the chart compute it from data. */
|
|
124
|
-
domain?: [number, number] | "auto";
|
|
125
|
-
/** Custom formatter for tick labels (called with a `Date`). */
|
|
126
|
-
format?: (d: Date) => string;
|
|
127
|
-
/** Tick density / sizing. */
|
|
128
|
-
ticks?: TickConfig;
|
|
129
|
-
/** Per-tick-level grid styling. */
|
|
130
|
-
grid?: GridStyle;
|
|
131
|
-
/** Axis baseline + tick marks styling. */
|
|
132
|
-
axis?: AxisStyle;
|
|
133
|
-
/** Tick label text styling. */
|
|
134
|
-
labels?: AxisLabelsStyle;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Top-level axes container on {@link MLTimeGraphOptions}.
|
|
138
|
-
* `left` and `right` correspond to `yAxisIndex: 0` and `yAxisIndex: 1` series.
|
|
139
|
-
* Additional axes can be defined in the `y` array, with indices mapping to series via `yAxisIndex`.
|
|
140
|
-
*/
|
|
141
|
-
interface AxesConfig {
|
|
142
|
-
x?: XAxisConfig;
|
|
143
|
-
left?: YAxisConfig;
|
|
144
|
-
right?: YAxisConfig;
|
|
145
|
-
/** Y specifies an arbitrary number of vertical axes, each mapped by its slice index. */
|
|
146
|
-
y?: YAxisConfig[];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/*!
|
|
150
|
-
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
151
|
-
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
152
|
-
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
/** Chart margins in pixels. */
|
|
156
|
-
interface Margin {
|
|
157
|
-
top: number;
|
|
158
|
-
right: number;
|
|
159
|
-
bottom: number;
|
|
160
|
-
left: number;
|
|
161
|
-
}
|
|
162
|
-
/** Legend placement position — inside or outside the chart area. */
|
|
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";
|
|
171
|
-
interface LegendOptions {
|
|
172
|
-
/** Show the legend (default false). */
|
|
173
|
-
show?: boolean;
|
|
174
|
-
/** Placement (default 'inside-right'). 'separate' draws nothing — read chart.legendItems() and render your own. */
|
|
175
|
-
position?: LegendPosition;
|
|
176
|
-
/** Item layout direction (default 'vertical'). */
|
|
177
|
-
orientation?: LegendOrientation;
|
|
178
|
-
}
|
|
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;
|
|
196
|
-
/** Chart dimensions */
|
|
197
|
-
width?: number;
|
|
198
|
-
height?: number;
|
|
199
|
-
/** Margins */
|
|
200
|
-
margin?: Margin;
|
|
201
|
-
/** Renderer (injected) */
|
|
202
|
-
renderer?: Renderer;
|
|
203
|
-
/** Time series data (raw or aggregated min/max/avg) */
|
|
204
|
-
series?: AnySeries[];
|
|
205
|
-
/**
|
|
206
|
-
* Clip series drawing to the plot area (default `true`).
|
|
207
|
-
*
|
|
208
|
-
* It matters only when data lies outside the axis domain — which happens as soon as you
|
|
209
|
-
* fix `axes.x.domain` and hand over a reading from just outside the window, so the curve
|
|
210
|
-
* runs to the edge instead of starting in mid-air. Without clipping, line and markers
|
|
211
|
-
* paint over the axis labels.
|
|
212
|
-
*
|
|
213
|
-
* Turn it off if you deliberately want a series to reach beyond the plot, or if the
|
|
214
|
-
* clip costs you: every clipped group gets a `clip-path`, and a browser may promote each
|
|
215
|
-
* to its own layer. With a handful of series that is nothing; with dozens on a slow
|
|
216
|
-
* machine it can be worth measuring.
|
|
217
|
-
*/
|
|
218
|
-
clipSeries?: boolean;
|
|
219
|
-
/** Locale for i18n (e.g. 'de-DE') */
|
|
220
|
-
locale?: string;
|
|
221
|
-
/**
|
|
222
|
-
* IANA time zone for the time axis, e.g. `'Europe/Berlin'` or `'UTC'`.
|
|
223
|
-
*
|
|
224
|
-
* Unset means the machine's zone — the behaviour up to 1.8.1, kept so that
|
|
225
|
-
* nothing changes for callers who never thought about it. But a browser sits
|
|
226
|
-
* in the reader's zone and a server almost always in UTC, so the *same* JSON
|
|
227
|
-
* labelled the same reading with different times depending on where it was
|
|
228
|
-
* drawn. That is the opposite of what a DOM-free renderer is for; set this
|
|
229
|
-
* whenever a chart is produced in one place and read in another.
|
|
230
|
-
*
|
|
231
|
-
* The tick *positions* never depended on it — they are epoch arithmetic. Only
|
|
232
|
-
* the labels do.
|
|
233
|
-
*/
|
|
234
|
-
timeZone?: string;
|
|
235
|
-
/**
|
|
236
|
-
* Font for every text in the chart, written into the SVG as `font-family`.
|
|
237
|
-
*
|
|
238
|
-
* Unset means the default stack below. Why name one at all: the SVG says
|
|
239
|
-
* nothing about fonts today, so a viewer picks its own, and the same chart
|
|
240
|
-
* has different label widths in a browser, in an email client and in a
|
|
241
|
-
* rasteriser. Naming a stack removes that variance.
|
|
242
|
-
*
|
|
243
|
-
* The default is chosen for **metric compatibility**, not looks: Liberation
|
|
244
|
-
* Sans was designed with the same advance widths as Arial, so Linux lands on
|
|
245
|
-
* Liberation, Windows and macOS on Arial or Helvetica, and the labels occupy
|
|
246
|
-
* the same space. A stack with DejaVu Sans would not do that — it is
|
|
247
|
-
* noticeably wider, and labels would collide differently.
|
|
248
|
-
*
|
|
249
|
-
* A CSS stack *is* "use it if installed, otherwise ours" — no extra
|
|
250
|
-
* mechanism needed.
|
|
251
|
-
*
|
|
252
|
-
* Note that the library never **measures** text (it renders DOM-free), so
|
|
253
|
-
* this does not change the layout: anchors and `text-anchor` stay where they
|
|
254
|
-
* are. It changes what the viewer draws. A much wider house font will
|
|
255
|
-
* therefore collide differently; that is on you.
|
|
256
|
-
*/
|
|
257
|
-
fontFamily?: string;
|
|
258
|
-
/** Integrated legend configuration */
|
|
259
|
-
legend?: LegendOptions;
|
|
260
|
-
/** Markers */
|
|
261
|
-
markers?: Marker[];
|
|
262
|
-
/** Threshold bands / lines / fills drawn behind the series */
|
|
263
|
-
thresholds?: Threshold[];
|
|
264
|
-
/** Highlighted time regions drawn behind the series */
|
|
265
|
-
highlights?: Highlight[];
|
|
266
|
-
/**
|
|
267
|
-
* Data-gap configuration. Two equivalent forms:
|
|
268
|
-
* - `Gap[]` — legacy: array of region objects with flat
|
|
269
|
-
* fill/hatch/labelBaseline/rotate fields.
|
|
270
|
-
* - {@link GapsConfig} — new (preferred): `{ regions?, autoDetect?,
|
|
271
|
-
* minGapMs?, style? }`, where `style` provides
|
|
272
|
-
* per-region fallbacks and `autoDetect` (TODO)
|
|
273
|
-
* will derive gaps from time spacing in
|
|
274
|
-
* Phase 3+. For now: typed but not yet acted on.
|
|
275
|
-
*/
|
|
276
|
-
gaps?: Gap[] | GapsConfig;
|
|
277
|
-
/** Free-form overlays (arrow, line, rect, point, label) in data coordinates */
|
|
278
|
-
annotations?: Annotation[];
|
|
279
|
-
/** Horizontal annotation bands below the chart (colored time ranges + labels) */
|
|
280
|
-
annotationBands?: AnnotationBandConfig[];
|
|
281
|
-
/**
|
|
282
|
-
* First-class axes configuration: per-axis `label`, `format`, `ticks`, `grid`,
|
|
283
|
-
* `axis`, `labels` (see USAGE.md, "Axes").
|
|
284
|
-
*/
|
|
285
|
-
axes?: AxesConfig;
|
|
286
|
-
}
|
|
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-D5TfGx8R.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-D5TfGx8R.js';
|
|
3
|
+
import { d as AnySeries, h as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, f as Gap, g as GapsConfig, e as Threshold, H as Highlight, i as AnnotationBandConfig, k as SeriesStyle, b as LineVariant, S as SmoothingType, F as FillSpec, l as TimeSeries, m as LineDashStyle, n as ThresholdFill, j 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-BStQU_t-.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-BStQU_t-.js';
|
|
287
5
|
|
|
288
6
|
/*!
|
|
289
7
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -310,6 +28,7 @@ declare class MLTimeGraph {
|
|
|
310
28
|
private readonly _thresholds;
|
|
311
29
|
private readonly _highlights;
|
|
312
30
|
private readonly _gaps;
|
|
31
|
+
private readonly _gapsBand?;
|
|
313
32
|
private readonly _gapsAutoDetect;
|
|
314
33
|
private readonly _gapsMinGapMs;
|
|
315
34
|
private _annotations;
|
|
@@ -1143,6 +862,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
|
|
|
1143
862
|
* Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
|
|
1144
863
|
* kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
|
|
1145
864
|
*/
|
|
1146
|
-
declare const VERSION = "1.
|
|
865
|
+
declare const VERSION = "1.12.0";
|
|
1147
866
|
|
|
1148
|
-
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries,
|
|
867
|
+
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, 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, PointStyleType, 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, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
|