ml-time-graph 1.0.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/LICENSE +32 -0
- package/MKT_AGGREGATE.md +154 -0
- package/README.de.md +154 -0
- package/README.md +152 -0
- package/USAGE.md +343 -0
- package/dist/aggregated_subtypes-DZNZyFTX.d.ts +43 -0
- package/dist/analyze/index.d.ts +296 -0
- package/dist/analyze/index.js +574 -0
- package/dist/index.d.ts +481 -0
- package/dist/index.js +3432 -0
- package/dist/interaction/index.d.ts +141 -0
- package/dist/interaction/index.js +438 -0
- package/dist/internals.d.ts +899 -0
- package/dist/internals.js +2465 -0
- package/dist/layout-Sc5UkC0r.d.ts +246 -0
- package/dist/scale-Cbr0KpPz.d.ts +824 -0
- package/package.json +85 -0
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
import { M as Marker } from './layout-Sc5UkC0r.js';
|
|
2
|
+
export { L as Layout, a as LayoutConfig, b as LayoutResult, c as LegendConfig, d as LegendItem, e as LegendOrientation, f as Renderer, m as measureLegend, r as renderLegend, t as theme } from './layout-Sc5UkC0r.js';
|
|
3
|
+
import { A as AggregatedPoint, ae as TimeScale, W as LinearScale, $ as PointStyleType, p as DrawCommand, l as DataPoint, ab as Threshold, J as Gap, P as HatchVariant, Q as Highlight, e as Annotation, E as EnumMap, B as BandScale, _ as Point, g as AnnotationBandItem, V as LineVariant, H as FillSpec, N as GapStyle, ag as TimeSeries } from './scale-Cbr0KpPz.js';
|
|
4
|
+
export { i as AxisOrientation, j as AxisPosition, k as BandScaleConfig, C as CircleParams, D as Dashstyle_t, n as DomainScaleConfig, o as DrawCircle, q as DrawGap, r as DrawGapType_t, s as DrawGradient, t as DrawGroup, u as DrawLine, v as DrawPath, w as DrawRect, x as DrawText, R as LabelAnchor, T as LineParams, X as LinearScaleConfig, Z as PathParams, a0 as RectParams, a1 as Scale, a2 as ScaleConfig, a9 as TIME_INTERVALS, aa as TextParams, af as TimeScaleConfig, ah as getHatch } from './scale-Cbr0KpPz.js';
|
|
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
|
+
/**
|
|
13
|
+
* Flat style configuration for series rendering.
|
|
14
|
+
* All fields are optional — defaults are applied internally via `resolveStyle()`.
|
|
15
|
+
*/
|
|
16
|
+
interface SeriesStyle {
|
|
17
|
+
/** Stroke color. */
|
|
18
|
+
stroke?: string;
|
|
19
|
+
/** Stroke width in pixels. */
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
/** Enable Catmull-Rom smoothing. */
|
|
22
|
+
smoothing?: boolean;
|
|
23
|
+
/** Enable dashed line style. */
|
|
24
|
+
dashed?: boolean;
|
|
25
|
+
/** Fill colour (hex, rgba, or `url(#gradient-id)`). */
|
|
26
|
+
fill?: string;
|
|
27
|
+
/** Hatch pattern for fill (default: none). */
|
|
28
|
+
hatch?: string;
|
|
29
|
+
/** Data-point marker style. */
|
|
30
|
+
pointStyle?: PointStyleType;
|
|
31
|
+
/** Marker size (radius or half-width). */
|
|
32
|
+
pointSize?: number;
|
|
33
|
+
/** Marker outline colour. Default: same as the line's stroke (per-point). */
|
|
34
|
+
pointStroke?: string;
|
|
35
|
+
/** Marker fill colour. Default: same as the line's stroke. */
|
|
36
|
+
pointFill?: string;
|
|
37
|
+
/** Marker outline width. Default: 1.5. */
|
|
38
|
+
pointStrokeWidth?: number;
|
|
39
|
+
/** Shadow color. */
|
|
40
|
+
shadowColor?: string;
|
|
41
|
+
/** Shadow blur in pixels. */
|
|
42
|
+
shadowBlur?: number;
|
|
43
|
+
/** Shadow X offset. */
|
|
44
|
+
shadowOffsetX?: number;
|
|
45
|
+
/** Shadow Y offset. */
|
|
46
|
+
shadowOffsetY?: number;
|
|
47
|
+
/** SVG id prefix for all elements generated by this style. */
|
|
48
|
+
id?: string;
|
|
49
|
+
}
|
|
50
|
+
interface RenderingContext {
|
|
51
|
+
timeScale: TimeScale;
|
|
52
|
+
valueScale: LinearScale;
|
|
53
|
+
}
|
|
54
|
+
/** Render segments as continuous lines (standard or smoothed). */
|
|
55
|
+
declare function renderLine(segments: {
|
|
56
|
+
data: DataPoint[];
|
|
57
|
+
color?: string;
|
|
58
|
+
}[], ctx: RenderingContext, style: SeriesStyle): DrawCommand[];
|
|
59
|
+
/** Render segments as step-functions. */
|
|
60
|
+
declare function renderStep(segments: {
|
|
61
|
+
data: DataPoint[];
|
|
62
|
+
color?: string;
|
|
63
|
+
}[], ctx: RenderingContext, style: SeriesStyle): DrawCommand[];
|
|
64
|
+
/** Render segments as a filled area between two values (e.g. min/max band). */
|
|
65
|
+
declare function renderArea(segments: {
|
|
66
|
+
data: AggregatedPoint[];
|
|
67
|
+
color?: string;
|
|
68
|
+
}[], ctx: RenderingContext, style: SeriesStyle, yLow: (p: AggregatedPoint) => number, yHigh: (p: AggregatedPoint) => number): DrawCommand[];
|
|
69
|
+
/**
|
|
70
|
+
* Complex area renderer that splits a run by value boundaries (thresholds)
|
|
71
|
+
* and renders the resulting zones as separate filled areas.
|
|
72
|
+
*/
|
|
73
|
+
declare function renderZonedArea<T>(run: T[], ctx: RenderingContext, options: {
|
|
74
|
+
boundaries: number[];
|
|
75
|
+
yLow: (p: T) => number;
|
|
76
|
+
yHigh: (p: T) => number;
|
|
77
|
+
getValue: (p: T) => number;
|
|
78
|
+
interpolate: (p1: T, p2: T, t: number) => T;
|
|
79
|
+
getColor: (zoneIndex: number) => string | undefined;
|
|
80
|
+
getHatch?: (zoneIndex: number) => string | undefined;
|
|
81
|
+
}, style?: SeriesStyle): DrawCommand[];
|
|
82
|
+
/**
|
|
83
|
+
* Render a line series split by a threshold value, allowing different styles
|
|
84
|
+
* for parts above and below that value.
|
|
85
|
+
*/
|
|
86
|
+
declare function renderSplitLine(run: DataPoint[], threshold: number, ctx: RenderingContext, styles: {
|
|
87
|
+
above?: SeriesStyle;
|
|
88
|
+
below?: SeriesStyle;
|
|
89
|
+
}): DrawCommand[];
|
|
90
|
+
/** Render point markers for segments. */
|
|
91
|
+
declare function renderMarkers$1(points: DataPoint[], ctx: RenderingContext, style: SeriesStyle, getColor: (p: DataPoint) => string): DrawCommand[];
|
|
92
|
+
|
|
93
|
+
/*!
|
|
94
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
95
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
96
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/** Configuration for background grid lines (horizontal and vertical). */
|
|
100
|
+
interface GridConfig {
|
|
101
|
+
/** Vertical grid lines (X-axis ticks) */
|
|
102
|
+
xTicks?: number[];
|
|
103
|
+
/** Horizontal grid lines (Y-axis ticks) */
|
|
104
|
+
yTicks?: number[];
|
|
105
|
+
/** Chart area boundaries */
|
|
106
|
+
xRange: [number, number];
|
|
107
|
+
yRange: [number, number];
|
|
108
|
+
/** Visual style */
|
|
109
|
+
stroke?: string;
|
|
110
|
+
strokeWidth?: number;
|
|
111
|
+
dashed?: boolean;
|
|
112
|
+
opacity?: number;
|
|
113
|
+
}
|
|
114
|
+
/** Render background grid lines (horizontal and vertical) for the chart area. */
|
|
115
|
+
declare function renderGrid(config: GridConfig): DrawCommand[];
|
|
116
|
+
|
|
117
|
+
/*!
|
|
118
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
119
|
+
* MIT with Attribution: free use incl. commercial must have visible credit to
|
|
120
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/** Configuration for rendering threshold lines, fills, and labels. */
|
|
124
|
+
interface ThresholdRenderConfig {
|
|
125
|
+
/** Threshold definitions to draw. */
|
|
126
|
+
thresholds: Threshold[];
|
|
127
|
+
/** Value scale for Y-axis mapping. */
|
|
128
|
+
valueScale: LinearScale;
|
|
129
|
+
/** Pixel X range of the chart area. */
|
|
130
|
+
xRange: [number, number];
|
|
131
|
+
}
|
|
132
|
+
/** Render named thresholds as horizontal lines, half-plane fills, and labels. */
|
|
133
|
+
declare function renderThresholds(config: ThresholdRenderConfig): DrawCommand[];
|
|
134
|
+
|
|
135
|
+
/*!
|
|
136
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
137
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
138
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
/** Configuration for rendering data gaps (dashed borders, empty regions, or labels). */
|
|
142
|
+
interface GapRenderConfig {
|
|
143
|
+
/** Gaps to render */
|
|
144
|
+
gaps: Gap[];
|
|
145
|
+
/** Time scale for X-axis mapping */
|
|
146
|
+
timeScale: TimeScale;
|
|
147
|
+
/** Pixel Y range of the chart area */
|
|
148
|
+
yRange: [number, number];
|
|
149
|
+
/** Background fill color (default: theme.gapFill). */
|
|
150
|
+
fill?: string;
|
|
151
|
+
/** Hatch pattern for gap fill */
|
|
152
|
+
hatch?: HatchVariant;
|
|
153
|
+
/** Fill opacity (default: theme.gapFillOpacity, 0.15). */
|
|
154
|
+
fillOpacity?: number;
|
|
155
|
+
/** Border stroke color (default: theme.gapStroke). */
|
|
156
|
+
stroke?: string;
|
|
157
|
+
/** Border stroke width in pixels (default: 1). */
|
|
158
|
+
strokeWidth?: number;
|
|
159
|
+
/** Render borders as dashed lines (default true). */
|
|
160
|
+
dashed?: boolean;
|
|
161
|
+
/** Font size for gap labels in pixels (default: theme.gapFontSize). */
|
|
162
|
+
fontSize?: number;
|
|
163
|
+
/** Text color for gap labels (default: theme.gapFontColor). */
|
|
164
|
+
fontFill?: string;
|
|
165
|
+
/** Label position: 'above' (above plot), 'middle' (center of plot), or 'below' (below plot). */
|
|
166
|
+
labelBaseline?: 'above' | 'middle' | 'below';
|
|
167
|
+
/** Rotation angle for labels in degrees (default: none). */
|
|
168
|
+
labelRotate?: number;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Render data gaps as dashed borders, fills, or labels. Labels are positioned
|
|
172
|
+
* based on baseline: 'above' (above plot), 'middle' (center), 'below' (below plot).
|
|
173
|
+
*/
|
|
174
|
+
declare function renderGaps(config: GapRenderConfig): DrawCommand[];
|
|
175
|
+
|
|
176
|
+
/*!
|
|
177
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
178
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
179
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/** Configuration for rendering markers (circles, vertical lines, labels). */
|
|
183
|
+
interface MarkerRenderConfig {
|
|
184
|
+
/** Markers to render */
|
|
185
|
+
markers: Marker[];
|
|
186
|
+
/** Time scale for X-axis mapping */
|
|
187
|
+
timeScale: TimeScale;
|
|
188
|
+
/** Value scale for Y-axis mapping */
|
|
189
|
+
valueScale: LinearScale;
|
|
190
|
+
/** Pixel Y range of the chart area [top, bottom] */
|
|
191
|
+
yRange?: [number, number];
|
|
192
|
+
}
|
|
193
|
+
/** Renders markers (point circles, vertical lines, and labels) at specific time/value positions. */
|
|
194
|
+
declare function renderMarkers(config: MarkerRenderConfig): DrawCommand[];
|
|
195
|
+
|
|
196
|
+
/*!
|
|
197
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
198
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
199
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/** Configuration for rendering time-range highlights as colored bands. */
|
|
203
|
+
interface HighlightRenderConfig {
|
|
204
|
+
/** Highlights to render */
|
|
205
|
+
highlights: Highlight[];
|
|
206
|
+
/** Time scale for X-axis mapping */
|
|
207
|
+
timeScale: TimeScale;
|
|
208
|
+
/** Pixel Y range of the chart area */
|
|
209
|
+
yRange: [number, number];
|
|
210
|
+
/** Total SVG height — needed to place a 'below' label in the bottom margin */
|
|
211
|
+
height?: number;
|
|
212
|
+
}
|
|
213
|
+
/** Render time-range highlights as colored bands with optional labels. */
|
|
214
|
+
declare function renderHighlights(config: HighlightRenderConfig): DrawCommand[];
|
|
215
|
+
|
|
216
|
+
/*!
|
|
217
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
218
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
219
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
/** Configuration for rendering free-form annotations (arrow, line, rect, point, label). */
|
|
223
|
+
interface AnnotationRenderConfig {
|
|
224
|
+
annotations: Annotation[];
|
|
225
|
+
timeScale: TimeScale;
|
|
226
|
+
/** Value scales per y-axis index (0 = left, 1 = right). */
|
|
227
|
+
valueScales: Map<number, LinearScale>;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Render free-form annotations (arrow, line, rect, point, label) given in
|
|
231
|
+
* data coordinates by projecting each point to pixels via the chart's scales.
|
|
232
|
+
*/
|
|
233
|
+
declare function renderAnnotations(config: AnnotationRenderConfig): DrawCommand[];
|
|
234
|
+
|
|
235
|
+
/*!
|
|
236
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
237
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
238
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
239
|
+
*/
|
|
240
|
+
/** Clipping rectangle defined by pixel coordinates and dimensions. */
|
|
241
|
+
interface ClipRegion {
|
|
242
|
+
/** Clipping rectangle */
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
width: number;
|
|
246
|
+
height: number;
|
|
247
|
+
}
|
|
248
|
+
declare class Clip {
|
|
249
|
+
#private;
|
|
250
|
+
constructor();
|
|
251
|
+
/** Add a clipping region */
|
|
252
|
+
add(region: ClipRegion): void;
|
|
253
|
+
/** Clear all clipping regions */
|
|
254
|
+
clear(): void;
|
|
255
|
+
/** Check if a point is within the clipping regions */
|
|
256
|
+
isInside(x: number, y: number): boolean;
|
|
257
|
+
/** Generate SVG clipPath element */
|
|
258
|
+
toSVGClipPath(id?: string): string;
|
|
259
|
+
/** Get current clipping regions */
|
|
260
|
+
get regions(): ClipRegion[];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Color specification for axis elements (baseline, ticks, labels). */
|
|
264
|
+
interface AxisColorspec {
|
|
265
|
+
axisColor: string;
|
|
266
|
+
tickColor: string;
|
|
267
|
+
textColor: string;
|
|
268
|
+
textSize: number;
|
|
269
|
+
/** Optional stroke-width for the axis baseline + tick marks (px). Default: SVG default (1). */
|
|
270
|
+
axisWidth?: number;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/*!
|
|
274
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
275
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
276
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
/** Configuration for time axis with automatic tick placement and formatting. */
|
|
280
|
+
interface TimeAxisConfig {
|
|
281
|
+
/** Locale for i18n formatting (default: 'en-US') */
|
|
282
|
+
locale?: string;
|
|
283
|
+
/** Custom format callback override */
|
|
284
|
+
format?: (date: Date) => string;
|
|
285
|
+
/** Minimum number of ticks */
|
|
286
|
+
minTicks?: number;
|
|
287
|
+
/** Maximum number of ticks */
|
|
288
|
+
maxTicks?: number;
|
|
289
|
+
/** Pixel Y-coordinate where axis labels are drawn */
|
|
290
|
+
y?: number;
|
|
291
|
+
/** Chart area X range */
|
|
292
|
+
xRange: [number, number];
|
|
293
|
+
/** Time domain (milliseconds) */
|
|
294
|
+
domain: [number, number];
|
|
295
|
+
/** Optional axis colours */
|
|
296
|
+
colors?: AxisColorspec;
|
|
297
|
+
}
|
|
298
|
+
/** Tick information for time axis with computed pixel positions and labels. */
|
|
299
|
+
interface TickInfo {
|
|
300
|
+
/** Timestamp of this tick */
|
|
301
|
+
time: number;
|
|
302
|
+
/** Pixel X position */
|
|
303
|
+
x: number;
|
|
304
|
+
/** Formatted label */
|
|
305
|
+
label: string;
|
|
306
|
+
}
|
|
307
|
+
/** Renders a time axis with automatic tick placement, anti-overlap, and i18n formatting. */
|
|
308
|
+
declare class TimeAxis {
|
|
309
|
+
#private;
|
|
310
|
+
constructor(config: TimeAxisConfig);
|
|
311
|
+
get scale(): TimeScale;
|
|
312
|
+
get axisColor(): string;
|
|
313
|
+
get tickColor(): string;
|
|
314
|
+
get textColor(): string;
|
|
315
|
+
get textSize(): number;
|
|
316
|
+
/**
|
|
317
|
+
* Generate properly spaced, formatted ticks for the time axis.
|
|
318
|
+
* Applies anti-overlap: if ticks are too close, every-other is skipped.
|
|
319
|
+
*/
|
|
320
|
+
generateTicks(): TickInfo[];
|
|
321
|
+
/** Pick the right date format based on the tick interval. */
|
|
322
|
+
tickLabel(time: number): string;
|
|
323
|
+
/** Remove ticks that would overlap (minimum 60px spacing). */
|
|
324
|
+
antiOverlap(ticks: TickInfo[]): TickInfo[];
|
|
325
|
+
/** Render axis baseline + tick marks as draw commands. */
|
|
326
|
+
render(): DrawCommand[];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/*!
|
|
330
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
331
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
332
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
/** Configuration for value axis with nice number tick placement. */
|
|
336
|
+
interface ValueAxisConfig {
|
|
337
|
+
domain: [number, number];
|
|
338
|
+
range: [number, number];
|
|
339
|
+
/** Custom format callback for tick labels */
|
|
340
|
+
format?: (value: number) => string;
|
|
341
|
+
/** Number of ticks */
|
|
342
|
+
ticks?: number;
|
|
343
|
+
/** Pixel X-coordinate where axis is drawn */
|
|
344
|
+
x?: number;
|
|
345
|
+
/** Orientation: vertical (left/right) or horizontal (bottom) */
|
|
346
|
+
orientation?: "vertical" | "horizontal";
|
|
347
|
+
/** Position for vertical orientation */
|
|
348
|
+
position?: "left" | "right";
|
|
349
|
+
colors?: AxisColorspec;
|
|
350
|
+
}
|
|
351
|
+
/** Tick information for value axis with computed positions and formatted labels. */
|
|
352
|
+
interface ValueTickInfo {
|
|
353
|
+
/** Data value at this tick */
|
|
354
|
+
value: number;
|
|
355
|
+
/** Pixel coordinate (Y for vertical, X for horizontal) */
|
|
356
|
+
position: number;
|
|
357
|
+
/** Formatted label */
|
|
358
|
+
label: string;
|
|
359
|
+
}
|
|
360
|
+
/** Renders a value axis with nice-number tick placement (supports vertical and horizontal). */
|
|
361
|
+
declare class ValueAxis {
|
|
362
|
+
#private;
|
|
363
|
+
constructor(config: ValueAxisConfig);
|
|
364
|
+
get scale(): LinearScale;
|
|
365
|
+
get axisColor(): string;
|
|
366
|
+
get tickColor(): string;
|
|
367
|
+
get textColor(): string;
|
|
368
|
+
get textSize(): number;
|
|
369
|
+
/** Generate nicely-spaced tick values. */
|
|
370
|
+
generateTicks(): ValueTickInfo[];
|
|
371
|
+
/** Render axis as draw commands. */
|
|
372
|
+
render(): DrawCommand[];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/*!
|
|
376
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
377
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
378
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
/** Configuration for enum (categorical) axis. */
|
|
382
|
+
interface EnumAxisConfig {
|
|
383
|
+
/** Map from enum value to display label */
|
|
384
|
+
enumMap: EnumMap;
|
|
385
|
+
/** Pixel Y range for the axis bands */
|
|
386
|
+
range: [number, number];
|
|
387
|
+
/** Pixel X position of the axis */
|
|
388
|
+
x?: number;
|
|
389
|
+
/** Show human-readable labels instead of raw values */
|
|
390
|
+
showLabels?: boolean;
|
|
391
|
+
/** Auto-assign colors per enum value */
|
|
392
|
+
autoColor?: boolean;
|
|
393
|
+
/** Which values should be treated as gaps (not rendered) */
|
|
394
|
+
gapValues?: number[];
|
|
395
|
+
}
|
|
396
|
+
/** Tick information for enum axis, including computed positions and colors. */
|
|
397
|
+
interface EnumTickInfo {
|
|
398
|
+
value: number;
|
|
399
|
+
label: string;
|
|
400
|
+
y: number;
|
|
401
|
+
color?: string;
|
|
402
|
+
isGap: boolean;
|
|
403
|
+
}
|
|
404
|
+
/** Renders an enum (categorical) axis with labeled ticks and optional auto-coloring. */
|
|
405
|
+
declare class EnumAxis {
|
|
406
|
+
#private;
|
|
407
|
+
constructor(config: EnumAxisConfig);
|
|
408
|
+
get scale(): BandScale;
|
|
409
|
+
/** Get all enum ticks with labels, positions, colors. */
|
|
410
|
+
generateTicks(): EnumTickInfo[];
|
|
411
|
+
/** Get color for a specific enum value. */
|
|
412
|
+
colorFor(value: number): string | undefined;
|
|
413
|
+
/** Render enum axis labels as draw commands. */
|
|
414
|
+
render(): DrawCommand[];
|
|
415
|
+
/** Map an enum value to its pixel position. */
|
|
416
|
+
map(value: number): number;
|
|
417
|
+
/** Check if a value should be treated as a gap. */
|
|
418
|
+
isGap(value: number): boolean;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
interface BaseConfig {
|
|
422
|
+
/** SVG id prefix for elements. Generated ids: `<id>-slot-<index>`, `<id>-avg-<index>`. */
|
|
423
|
+
id?: string;
|
|
424
|
+
timeScale: TimeScale;
|
|
425
|
+
}
|
|
426
|
+
declare abstract class Series<T> {
|
|
427
|
+
#private;
|
|
428
|
+
static uidcnt: number;
|
|
429
|
+
constructor(config: BaseConfig, data?: T[]);
|
|
430
|
+
get id(): string;
|
|
431
|
+
get timeScale(): TimeScale;
|
|
432
|
+
get data(): T[];
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/*!
|
|
436
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
437
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
438
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
439
|
+
*/
|
|
440
|
+
|
|
441
|
+
/** Configuration for rendering a continuous line chart series. */
|
|
442
|
+
interface LineSeriesConfig {
|
|
443
|
+
/** Data points to render */
|
|
444
|
+
data: DataPoint[];
|
|
445
|
+
/** Time scale for X-axis mapping */
|
|
446
|
+
timeScale: TimeScale;
|
|
447
|
+
/** Value scale for Y-axis mapping */
|
|
448
|
+
valueScale: LinearScale;
|
|
449
|
+
/** Enable curve smoothing (Catmull-Rom spline) */
|
|
450
|
+
smoothing?: boolean;
|
|
451
|
+
/** Stroke color */
|
|
452
|
+
stroke?: string;
|
|
453
|
+
/** Stroke width in pixels */
|
|
454
|
+
strokeWidth?: number;
|
|
455
|
+
/** Enable dashed line style */
|
|
456
|
+
dashed?: boolean;
|
|
457
|
+
/** Marker style for data points */
|
|
458
|
+
pointStyle?: PointStyleType;
|
|
459
|
+
/** Marker size (radius or half-width) */
|
|
460
|
+
pointSize?: number;
|
|
461
|
+
/** Maximum number of points to show markers for */
|
|
462
|
+
pointThreshold?: number;
|
|
463
|
+
/** Maximum time gap (ms) between points before breaking the line. 0 = disabled. */
|
|
464
|
+
gapThreshold?: number;
|
|
465
|
+
/** Shadow color */
|
|
466
|
+
shadowColor?: string;
|
|
467
|
+
/** Shadow blur in pixels */
|
|
468
|
+
shadowBlur?: number;
|
|
469
|
+
/** Shadow X offset in pixels */
|
|
470
|
+
shadowOffsetX?: number;
|
|
471
|
+
/** Shadow Y offset in pixels */
|
|
472
|
+
shadowOffsetY?: number;
|
|
473
|
+
/** SVG id prefix for elements. Generated ids: `<id>-line`, `<id>-marker`. */
|
|
474
|
+
id?: string;
|
|
475
|
+
}
|
|
476
|
+
/** Renders a continuous line chart from time-series data, with optional smoothing (Catmull-Rom spline). */
|
|
477
|
+
declare class LineSeries extends Series<DataPoint> {
|
|
478
|
+
#private;
|
|
479
|
+
constructor(config: LineSeriesConfig);
|
|
480
|
+
/** Convert non-null data points to pixel coordinates (sorted by X). */
|
|
481
|
+
points(): (Point & {
|
|
482
|
+
time: number;
|
|
483
|
+
})[];
|
|
484
|
+
render(): DrawCommand[];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/*!
|
|
488
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
489
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
490
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
491
|
+
*/
|
|
492
|
+
|
|
493
|
+
/** Configuration for rendering a step chart series. */
|
|
494
|
+
interface StepSeriesConfig {
|
|
495
|
+
data: DataPoint[];
|
|
496
|
+
timeScale: TimeScale;
|
|
497
|
+
valueScale: LinearScale;
|
|
498
|
+
stroke?: string;
|
|
499
|
+
strokeWidth?: number;
|
|
500
|
+
/** SVG id prefix for elements. Generated ids: `<id>-line`. */
|
|
501
|
+
id?: string;
|
|
502
|
+
}
|
|
503
|
+
/** Renders a step chart from time-series data (horizontal-then-vertical transitions). */
|
|
504
|
+
declare class StepSeries extends Series<DataPoint> {
|
|
505
|
+
#private;
|
|
506
|
+
constructor(config: StepSeriesConfig);
|
|
507
|
+
/**
|
|
508
|
+
* Convert (non-null) data points to step-style pixel coordinates.
|
|
509
|
+
* Each data point generates two corners (horizontal then vertical).
|
|
510
|
+
*/
|
|
511
|
+
points(): Point[];
|
|
512
|
+
render(): DrawCommand[];
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/*!
|
|
516
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
517
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
518
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
519
|
+
*/
|
|
520
|
+
|
|
521
|
+
/** Configuration for rendering band charts from aggregated data. */
|
|
522
|
+
interface BandSeriesConfig extends BaseConfig {
|
|
523
|
+
data: AggregatedPoint[];
|
|
524
|
+
timeScale: TimeScale;
|
|
525
|
+
valueScale: LinearScale;
|
|
526
|
+
/** Fill color for the band */
|
|
527
|
+
fill?: string;
|
|
528
|
+
/** Hatch pattern for the band fill */
|
|
529
|
+
hatch?: string;
|
|
530
|
+
/** Opacity based on count (0-1) */
|
|
531
|
+
countOpacity?: boolean;
|
|
532
|
+
/** Show average line inside band */
|
|
533
|
+
avgLine?: boolean;
|
|
534
|
+
/** Average line color */
|
|
535
|
+
avgLineColor?: string;
|
|
536
|
+
/** Width of each band in pixels (0 = auto from timeScale) */
|
|
537
|
+
bandWidth?: number;
|
|
538
|
+
}
|
|
539
|
+
/** Renders aggregated data as colored rectangles (bands) per time slot, with optional avg lines. */
|
|
540
|
+
declare class BandSeries extends Series<AggregatedPoint> {
|
|
541
|
+
#private;
|
|
542
|
+
constructor(config: BandSeriesConfig);
|
|
543
|
+
/** Calculate opacity from count (normalized 0.2-1.0) */
|
|
544
|
+
opacity(count: number): number;
|
|
545
|
+
/** Render bands as draw commands */
|
|
546
|
+
render(): DrawCommand[];
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/*!
|
|
550
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
551
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
552
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
553
|
+
*/
|
|
554
|
+
|
|
555
|
+
/** Configuration for rendering min/max/avg lines from aggregated data. */
|
|
556
|
+
interface MinMaxAvgConfig {
|
|
557
|
+
/** Aggregated points (min/max/avg per time slot). */
|
|
558
|
+
data: AggregatedPoint[];
|
|
559
|
+
/** Time scale for X-axis mapping */
|
|
560
|
+
timeScale: TimeScale;
|
|
561
|
+
/** Value scale for Y-axis mapping */
|
|
562
|
+
valueScale: LinearScale;
|
|
563
|
+
/** Stroke color for the min line (default blue) */
|
|
564
|
+
minColor?: string;
|
|
565
|
+
/** Stroke color for the max line (default red) */
|
|
566
|
+
maxColor?: string;
|
|
567
|
+
/** Stroke color for the avg line (default slate) */
|
|
568
|
+
avgColor?: string;
|
|
569
|
+
/** Render the avg line dashed (default true) */
|
|
570
|
+
avgDashed?: boolean;
|
|
571
|
+
/** Fill color for the area between avg and max (optional, use rgba/8-digit hex) */
|
|
572
|
+
fillToMax?: string;
|
|
573
|
+
/** Hatch pattern for fillToMax */
|
|
574
|
+
fillToMaxHatch?: HatchVariant;
|
|
575
|
+
/** Fill color for the area between avg and min (optional) */
|
|
576
|
+
fillToMin?: string;
|
|
577
|
+
/** Hatch pattern for fillToMin */
|
|
578
|
+
fillToMinHatch?: HatchVariant;
|
|
579
|
+
/** Catmull-Rom smoothing for the lines */
|
|
580
|
+
smoothing?: boolean;
|
|
581
|
+
/** Stroke width in px (default 2) */
|
|
582
|
+
strokeWidth?: number;
|
|
583
|
+
/** SVG id prefix for elements. Generated ids: `<id>-max`, `<id>-min`, `<id>-avg`, `<id>-fillToMax`, `<id>-fillToMin`. */
|
|
584
|
+
id?: string;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Draws min / max / avg of an aggregated series as three continuous lines over
|
|
588
|
+
* time, with an optional translucent fill between avg and the min/max envelope.
|
|
589
|
+
* A slot whose stats are `null` is treated as a gap and breaks the lines/fill.
|
|
590
|
+
*/
|
|
591
|
+
declare class MinMaxAvgSeries extends Series<AggregatedPoint> {
|
|
592
|
+
#private;
|
|
593
|
+
constructor(config: MinMaxAvgConfig);
|
|
594
|
+
render(): DrawCommand[];
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/*!
|
|
598
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
599
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
600
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
/** A value boundary with the color used for the zone at/above it. */
|
|
604
|
+
interface Zone {
|
|
605
|
+
value: number;
|
|
606
|
+
color: string;
|
|
607
|
+
}
|
|
608
|
+
/** Fill the area between the line and a threshold value, on one side. */
|
|
609
|
+
interface ZonedFill {
|
|
610
|
+
value: number;
|
|
611
|
+
side: "above" | "below";
|
|
612
|
+
color: string;
|
|
613
|
+
hatch?: string;
|
|
614
|
+
}
|
|
615
|
+
/** Configuration for rendering zoned line charts with per-segment colors and optional fills. */
|
|
616
|
+
interface ZonedLineConfig {
|
|
617
|
+
data: DataPoint[];
|
|
618
|
+
timeScale: TimeScale;
|
|
619
|
+
valueScale: LinearScale;
|
|
620
|
+
/** Color below the lowest zone boundary (and when there are no zones). */
|
|
621
|
+
baseColor?: string;
|
|
622
|
+
/** Zone boundaries (any order); each color applies to values ≥ its value. */
|
|
623
|
+
zones?: Zone[];
|
|
624
|
+
/** Optional fill between the line and a threshold value. */
|
|
625
|
+
fill?: ZonedFill;
|
|
626
|
+
strokeWidth?: number;
|
|
627
|
+
smoothing?: boolean;
|
|
628
|
+
/** Max time gap (ms) before the line breaks; 0 = off. */
|
|
629
|
+
gapThreshold?: number;
|
|
630
|
+
pointStyle?: PointStyleType;
|
|
631
|
+
pointSize?: number;
|
|
632
|
+
pointThreshold?: number;
|
|
633
|
+
/** SVG id prefix for elements. */
|
|
634
|
+
id?: string;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Line series whose colour follows value zones (boundaries → colours), with an
|
|
638
|
+
* optional translucent fill to a threshold. Breaks at `value: null` gaps and at
|
|
639
|
+
* time jumps larger than `gapThreshold`.
|
|
640
|
+
*/
|
|
641
|
+
declare class ZonedLineSeries extends Series<DataPoint> {
|
|
642
|
+
#private;
|
|
643
|
+
constructor(config: ZonedLineConfig);
|
|
644
|
+
render(): DrawCommand[];
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/*!
|
|
648
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
649
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
650
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
651
|
+
*/
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Horizontal annotation band below the main chart.
|
|
655
|
+
* Shares the chart time scale, renders colored time ranges with optional labels,
|
|
656
|
+
* and optionally a time axis. Standalone (not a `Series` subclass) because it
|
|
657
|
+
* does not need data iteration, gap detection, or y-scaling.
|
|
658
|
+
*/
|
|
659
|
+
declare class AnnotationBandSeries {
|
|
660
|
+
#private;
|
|
661
|
+
constructor(config: {
|
|
662
|
+
name: string;
|
|
663
|
+
showAxis: boolean;
|
|
664
|
+
items: AnnotationBandItem[];
|
|
665
|
+
timeScale: TimeScale;
|
|
666
|
+
background?: string;
|
|
667
|
+
hatch?: HatchVariant;
|
|
668
|
+
}, xRange: [number, number], y: number, height: number);
|
|
669
|
+
/** Render the band as colored rects with labels, optionally with a time axis. */
|
|
670
|
+
render(): DrawCommand[];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/*!
|
|
674
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
675
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
676
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
677
|
+
*/
|
|
678
|
+
|
|
679
|
+
/** Position for statistic labels on the chart. */
|
|
680
|
+
type StatLabelPosition = 'start' | 'end' | 'center' | 'both';
|
|
681
|
+
/** Configuration for statistics overlay (min, max, avg, median lines with labels). */
|
|
682
|
+
interface StatsOverlayConfig {
|
|
683
|
+
/** Data points to compute stats from */
|
|
684
|
+
data: DataPoint[];
|
|
685
|
+
/** Value scale for Y-axis mapping */
|
|
686
|
+
valueScale: LinearScale;
|
|
687
|
+
/** Pixel X range of chart */
|
|
688
|
+
xRange: [number, number];
|
|
689
|
+
/** Which stats to show */
|
|
690
|
+
showMin?: boolean;
|
|
691
|
+
showMax?: boolean;
|
|
692
|
+
showAvg?: boolean;
|
|
693
|
+
showMedian?: boolean;
|
|
694
|
+
/** Label position */
|
|
695
|
+
labelPosition?: StatLabelPosition;
|
|
696
|
+
/** Line color */
|
|
697
|
+
lineColor?: string;
|
|
698
|
+
/** Label color */
|
|
699
|
+
labelColor?: string;
|
|
700
|
+
}
|
|
701
|
+
/** Renders horizontal stat lines (min/max/avg/median) with labels on the chart. */
|
|
702
|
+
declare class StatsOverlay {
|
|
703
|
+
#private;
|
|
704
|
+
constructor(config: StatsOverlayConfig);
|
|
705
|
+
/** Render stats as horizontal lines with labels. */
|
|
706
|
+
render(): DrawCommand[];
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/*!
|
|
710
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
711
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
712
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
713
|
+
*/
|
|
714
|
+
/**
|
|
715
|
+
* Time formatter with i18n support.
|
|
716
|
+
* Uses Intl.DateTimeFormat with locale fallback.
|
|
717
|
+
*/
|
|
718
|
+
interface TimeFormatOptions {
|
|
719
|
+
/** Locale (default: 'en-US') */
|
|
720
|
+
locale?: string;
|
|
721
|
+
/** Fallback locales */
|
|
722
|
+
fallbackLocales?: string[];
|
|
723
|
+
/** Duration-based format selection */
|
|
724
|
+
autoFormat?: boolean;
|
|
725
|
+
}
|
|
726
|
+
declare class TimeFormatter {
|
|
727
|
+
#private;
|
|
728
|
+
constructor(opts?: TimeFormatOptions);
|
|
729
|
+
/**
|
|
730
|
+
* Format a timestamp.
|
|
731
|
+
* Auto-selects format options based on the time difference if autoFormat is enabled.
|
|
732
|
+
*/
|
|
733
|
+
format(timestamp: number, opts?: Intl.DateTimeFormatOptions, referenceTime?: number): string;
|
|
734
|
+
/** Format a time range display */
|
|
735
|
+
formatRange(start: number, end: number): string;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/*!
|
|
739
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
740
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
741
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
742
|
+
*/
|
|
743
|
+
/**
|
|
744
|
+
* Value formatter with configurable units.
|
|
745
|
+
*/
|
|
746
|
+
interface ValueFormatOptions {
|
|
747
|
+
/** Unit suffix (e.g., '°C', '%', 'mmHg') */
|
|
748
|
+
unit?: string;
|
|
749
|
+
/** Decimal places */
|
|
750
|
+
decimals?: number;
|
|
751
|
+
/** Compact large numbers (k, M, B) */
|
|
752
|
+
compact?: boolean;
|
|
753
|
+
/** Custom format callback */
|
|
754
|
+
custom?: (value: number) => string;
|
|
755
|
+
}
|
|
756
|
+
declare class ValueFormatter {
|
|
757
|
+
#private;
|
|
758
|
+
readonly _compact: boolean;
|
|
759
|
+
constructor(opts?: ValueFormatOptions);
|
|
760
|
+
/** Format a single value */
|
|
761
|
+
format(value: number): string;
|
|
762
|
+
/** Format a range of values */
|
|
763
|
+
formatRange(min: number, max: number): string;
|
|
764
|
+
/** Create a formatter for a specific unit */
|
|
765
|
+
static unit(unit: string, decimals?: number): ValueFormatter;
|
|
766
|
+
/** Temperature formatter */
|
|
767
|
+
static temperature(unit?: '°C' | '°F'): ValueFormatter;
|
|
768
|
+
/** Percentage formatter */
|
|
769
|
+
static percentage(): ValueFormatter;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/*!
|
|
773
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
774
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
775
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Enum formatter: maps enum values to human-readable labels.
|
|
780
|
+
*/
|
|
781
|
+
interface EnumFormatterOptions {
|
|
782
|
+
/** Enum value → label mapping */
|
|
783
|
+
map?: EnumMap;
|
|
784
|
+
/** Fallback when value is not in map */
|
|
785
|
+
fallback?: (value: number) => string;
|
|
786
|
+
/** Show raw value alongside label */
|
|
787
|
+
showValue?: boolean;
|
|
788
|
+
}
|
|
789
|
+
declare class EnumFormatter {
|
|
790
|
+
#private;
|
|
791
|
+
constructor(opts?: EnumFormatterOptions);
|
|
792
|
+
/** Format an enum value */
|
|
793
|
+
format(value: number): string;
|
|
794
|
+
/** Check if value exists in map */
|
|
795
|
+
has(value: number): boolean;
|
|
796
|
+
/** Get all mapped labels */
|
|
797
|
+
labels(): string[];
|
|
798
|
+
/** Get all mapped values */
|
|
799
|
+
values(): number[];
|
|
800
|
+
/** Create formatter from label config strings */
|
|
801
|
+
static fromLabels(labels: string[], showValue?: boolean): EnumFormatter;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/*!
|
|
805
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
806
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
807
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
interface FormatterRegistry {
|
|
811
|
+
time: TimeFormatter;
|
|
812
|
+
value: ValueFormatter;
|
|
813
|
+
enum: EnumFormatter;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Formatter registry for default formatters.
|
|
817
|
+
* Provides singleton-style access to formatters.
|
|
818
|
+
*/
|
|
819
|
+
declare const Formatters: FormatterRegistry;
|
|
820
|
+
|
|
821
|
+
/*!
|
|
822
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
823
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
824
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
825
|
+
*/
|
|
826
|
+
|
|
827
|
+
/** Fully-resolved single line — all fields filled with defaults. */
|
|
828
|
+
interface ResolvedLine {
|
|
829
|
+
color: string;
|
|
830
|
+
width: number;
|
|
831
|
+
style: LineVariant;
|
|
832
|
+
smoothing: boolean;
|
|
833
|
+
shape: "line" | "step";
|
|
834
|
+
gapThreshold: number;
|
|
835
|
+
opacity: number;
|
|
836
|
+
}
|
|
837
|
+
/** Fully-resolved marker — present only when a non-`none` shape is set. */
|
|
838
|
+
interface ResolvedMarker {
|
|
839
|
+
type: Exclude<PointStyleType, "none">;
|
|
840
|
+
size: number;
|
|
841
|
+
stroke: string;
|
|
842
|
+
fill: string;
|
|
843
|
+
strokeWidth: number;
|
|
844
|
+
/** Hide markers when the series has more than this many samples. */
|
|
845
|
+
threshold?: number;
|
|
846
|
+
}
|
|
847
|
+
/** Fully-resolved shadow — present only when a non-transparent colour is set. */
|
|
848
|
+
interface ResolvedShadow {
|
|
849
|
+
color: string;
|
|
850
|
+
blur: number;
|
|
851
|
+
offsetX: number;
|
|
852
|
+
offsetY: number;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* The renderer-facing resolved style for a single raw `TimeSeries`. Every
|
|
856
|
+
* field has its theme default applied; absent layers (markers, shadow) come
|
|
857
|
+
* back as `undefined` so renderers can skip them cheaply.
|
|
858
|
+
*/
|
|
859
|
+
interface ResolvedSeriesStyle {
|
|
860
|
+
lines: ResolvedLine[];
|
|
861
|
+
fill?: FillSpec;
|
|
862
|
+
markers?: ResolvedMarker;
|
|
863
|
+
shadow?: ResolvedShadow;
|
|
864
|
+
gap?: GapStyle;
|
|
865
|
+
id?: string;
|
|
866
|
+
}
|
|
867
|
+
/** Build the resolved-line array. Empty array = no lines drawn. */
|
|
868
|
+
declare function resolveLines(series: TimeSeries): ResolvedLine[];
|
|
869
|
+
/** Resolve markers, or `undefined` if no marker should be drawn. */
|
|
870
|
+
declare function resolveMarkers(series: TimeSeries): ResolvedMarker | undefined;
|
|
871
|
+
/** Resolve shadow, or `undefined` if no shadow should be drawn. */
|
|
872
|
+
declare function resolveShadow(series: TimeSeries): ResolvedShadow | undefined;
|
|
873
|
+
/** Resolve gap style (pass-through). */
|
|
874
|
+
declare function resolveGap(series: TimeSeries): GapStyle | undefined;
|
|
875
|
+
/** Resolve the FillSpec (pass-through). */
|
|
876
|
+
declare function resolveFill(series: TimeSeries): FillSpec | undefined;
|
|
877
|
+
/**
|
|
878
|
+
* Resolve the full style for a raw {@link TimeSeries}. Renderers should call
|
|
879
|
+
* this once per series and read only from the returned object.
|
|
880
|
+
*/
|
|
881
|
+
declare function resolveSeriesStyle(series: TimeSeries): ResolvedSeriesStyle;
|
|
882
|
+
|
|
883
|
+
/*!
|
|
884
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
885
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
886
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
887
|
+
*/
|
|
888
|
+
/**
|
|
889
|
+
* Turn a free-form name into an ASCII slug usable as an `id`/CSS-class
|
|
890
|
+
* suffix. Lowercased, non-alphanumeric runs collapsed to `-`, accents
|
|
891
|
+
* stripped, trimmed, capped at 50 chars. Empty input → `'unnamed'`.
|
|
892
|
+
*
|
|
893
|
+
* slugify('Temperatur (°C)') → 'temperatur-c'
|
|
894
|
+
* slugify('Signal A') → 'signal-a'
|
|
895
|
+
* slugify(' ') → 'unnamed'
|
|
896
|
+
*/
|
|
897
|
+
declare function slugify(s: string | undefined | null): string;
|
|
898
|
+
|
|
899
|
+
export { AnnotationBandSeries, type AnnotationRenderConfig, BandScale, BandSeries, type BandSeriesConfig, Clip, type ClipRegion, DrawCommand, EnumAxis, type EnumAxisConfig, EnumFormatter, type EnumFormatterOptions, type EnumTickInfo, Formatters, type GapRenderConfig, type GridConfig, type HighlightRenderConfig, LineSeries, type LineSeriesConfig, LinearScale, type MarkerRenderConfig, type MinMaxAvgConfig, MinMaxAvgSeries, type ResolvedLine, type ResolvedMarker, type ResolvedSeriesStyle, type ResolvedShadow, type StatLabelPosition, StatsOverlay, type StatsOverlayConfig, StepSeries, type StepSeriesConfig, type ThresholdRenderConfig, type TickInfo, TimeAxis, type TimeAxisConfig, type TimeFormatOptions, TimeFormatter, TimeScale, ValueAxis, type ValueAxisConfig, type ValueFormatOptions, ValueFormatter, type ValueTickInfo, type Zone, type ZonedFill, type ZonedLineConfig, ZonedLineSeries, renderAnnotations, renderArea, renderGaps, renderGrid, renderHighlights, renderLine, renderMarkers, renderMarkers$1 as renderSeriesMarkers, renderSplitLine, renderStep, renderThresholds, renderZonedArea, resolveFill, resolveGap, resolveLines, resolveMarkers, resolveSeriesStyle, resolveShadow, slugify };
|