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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DrawCommand, b as LineVariant, P as PointStyleType, c as DrawGroup, M as MarkerLineStyle, T as TimeScale, L as LinearScale, S as SmoothingType,
|
|
1
|
+
import { a as DrawCommand, b as LineVariant, P as PointStyleType, c as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, d as AnySeries, e as Threshold, H as Highlight, f as Gap, g as GapsConfig, h as Annotation, i as AnnotationBandConfig, T as TimeScale, L as LinearScale, S as SmoothingType, j as HatchVariant, D as DataPoint } from './scale-BStQU_t-.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = "svg" | "canvas" | "none";
|
|
@@ -255,6 +255,17 @@ declare const estimateMetrics: TextMetrics;
|
|
|
255
255
|
interface LegendItem {
|
|
256
256
|
name: string;
|
|
257
257
|
color: string;
|
|
258
|
+
/**
|
|
259
|
+
* Der stabile Schluessel der Serie -- derselbe, den ihre Gruppe im SVG
|
|
260
|
+
* traegt (`.series--<id>`, `#series-<id>`). Abgeleitet aus `series.id`,
|
|
261
|
+
* sonst aus dem Namen.
|
|
262
|
+
*
|
|
263
|
+
* Damit laesst sich ein Legendeneintrag auf seine Kurve zurueckfuehren, ohne
|
|
264
|
+
* ueber den Klarnamen zu gehen: ein Klick auf den Eintrag `legend-pumpe`
|
|
265
|
+
* schaltet `#series-pumpe`. Bis 1.12.0 fehlte er, und wer die Legende
|
|
266
|
+
* anklickbar machen wollte, musste sie selbst zeichnen.
|
|
267
|
+
*/
|
|
268
|
+
id?: string;
|
|
258
269
|
/**
|
|
259
270
|
* The series' line variant, for a caller drawing its own legend: the swatch
|
|
260
271
|
* has to show the same dashes as the curve it names, or it is wrong the moment
|
|
@@ -285,6 +296,17 @@ interface LegendConfig {
|
|
|
285
296
|
metrics?: TextMetrics;
|
|
286
297
|
/** Hoechstbreite einer waagerechten Zeile; darueber wird umgebrochen. */
|
|
287
298
|
maxBreite?: number;
|
|
299
|
+
/** Feld hinter der Legende -- Hintergrund und Rahmen. Ohne Angabe keines. */
|
|
300
|
+
box?: LegendBox;
|
|
301
|
+
/**
|
|
302
|
+
* Zusaetzliche Klasse an JEDEM Eintrag -- der Haken fuer eigenes Verhalten.
|
|
303
|
+
*
|
|
304
|
+
* Die Bibliothek bringt kein Anklicken mit; sie bringt etwas zum Anklicken.
|
|
305
|
+
* Mit `itemClass: "clickmetotoggle"` traegt jeder Eintrag diese Klasse, und
|
|
306
|
+
* ein Zeilen-Handler des Aufrufers findet ueber `#legend-<id>` die Serie
|
|
307
|
+
* `#series-<id>` und blendet sie aus.
|
|
308
|
+
*/
|
|
309
|
+
itemClass?: string;
|
|
288
310
|
}
|
|
289
311
|
/** Estimated pixel size of the legend box (for layout reservation). */
|
|
290
312
|
declare function measureLegend(items: LegendItem[], orientation?: LegendOrientation, metrics?: TextMetrics, maxBreite?: number): {
|
|
@@ -305,6 +327,331 @@ interface Marker {
|
|
|
305
327
|
seriesIndex?: number;
|
|
306
328
|
}
|
|
307
329
|
|
|
330
|
+
/*!
|
|
331
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
332
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
333
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
334
|
+
*/
|
|
335
|
+
|
|
336
|
+
/** Tick density / sizing for one axis. */
|
|
337
|
+
interface TickConfig {
|
|
338
|
+
/** Target number of major (labelled) ticks. */
|
|
339
|
+
major?: number;
|
|
340
|
+
/** How many minor ticks to place between two major ticks. Default 0 = off. */
|
|
341
|
+
minor?: number;
|
|
342
|
+
/** Tick mark length in px. */
|
|
343
|
+
size?: number;
|
|
344
|
+
}
|
|
345
|
+
/** Grid line styling for one tick level. `false` disables that grid level. */
|
|
346
|
+
interface GridLineStyle {
|
|
347
|
+
color?: string;
|
|
348
|
+
width?: number;
|
|
349
|
+
style?: LineVariant;
|
|
350
|
+
opacity?: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Per-axis grid configuration. Each tick level (major / minor) can be styled
|
|
354
|
+
* independently or disabled. Defaults: major grid shown with theme colours,
|
|
355
|
+
* minor grid off.
|
|
356
|
+
*/
|
|
357
|
+
interface GridStyle {
|
|
358
|
+
major?: GridLineStyle | false;
|
|
359
|
+
/**
|
|
360
|
+
* Zwischengitter -- die Linien zwischen den Hauptlinien.
|
|
361
|
+
*
|
|
362
|
+
* Wieviele es sind, sagt `ticks.minor`; steht dort nichts, ist EINE je
|
|
363
|
+
* Hauptabstand gemeint. Ohne eigene `opacity` sind sie halb so kraeftig wie
|
|
364
|
+
* das Hauptgitter: ein Zwischengitter in voller Staerke macht aus der
|
|
365
|
+
* Orientierung ein zweites Raster.
|
|
366
|
+
*
|
|
367
|
+
* **Eine Angabe gilt fuer beide Richtungen.** Wie beim Hauptgitter gewinnt
|
|
368
|
+
* `axes.x.grid.minor`, sonst `axes.left.grid.minor` -- ein Gitter mit zwei
|
|
369
|
+
* Stilen waere zwei Gitter.
|
|
370
|
+
*/
|
|
371
|
+
minor?: GridLineStyle | false;
|
|
372
|
+
/**
|
|
373
|
+
* Wann das Gitter gezeichnet wird.
|
|
374
|
+
*
|
|
375
|
+
* `'front'` (Vorgabe) heisst: NACH den Serien -- eine Flaeche bis zur
|
|
376
|
+
* Grundlinie verdeckt es dann nicht, und die Linien des Gitters liegen
|
|
377
|
+
* sichtbar ueber der Kurve. Marker, Annotationen und Beschriftungen kommen
|
|
378
|
+
* trotzdem darueber.
|
|
379
|
+
*
|
|
380
|
+
* `'back'` zeichnet es als ERSTES, noch vor Highlights und Schwellenwerten.
|
|
381
|
+
* Das ist die Wahl, wenn eine deckende Flaeche das Gitter verschlucken SOLL
|
|
382
|
+
* -- oder wenn ein feines Raster hinter den Daten genuegt.
|
|
383
|
+
*
|
|
384
|
+
* Eine Angabe gilt fuer das ganze Gitter; wie beim Stil gewinnt `axes.x`
|
|
385
|
+
* vor `axes.left`.
|
|
386
|
+
*/
|
|
387
|
+
layer?: GridLayer;
|
|
388
|
+
}
|
|
389
|
+
/** Axis baseline + tick marks styling. */
|
|
390
|
+
interface AxisStyle {
|
|
391
|
+
color?: string;
|
|
392
|
+
width?: number;
|
|
393
|
+
}
|
|
394
|
+
/** Tick / axis-label text styling. */
|
|
395
|
+
interface AxisLabelsStyle {
|
|
396
|
+
color?: string;
|
|
397
|
+
fontSize?: number;
|
|
398
|
+
}
|
|
399
|
+
/** Configuration for one Y-axis (left or right). */
|
|
400
|
+
interface YAxisConfig {
|
|
401
|
+
/** Position is 'left' or 'right' to determine placement side. Defaults to 'left'. */
|
|
402
|
+
position?: AxisPosition;
|
|
403
|
+
/** Optional explicit horizontal pixel offset from chart edge (defaults to index * 50px). */
|
|
404
|
+
offset?: number;
|
|
405
|
+
/** Rotated label drawn next to the axis. */
|
|
406
|
+
label?: string;
|
|
407
|
+
/** Override the value domain. `'auto'` lets the chart compute it from data. */
|
|
408
|
+
domain?: [number, number] | "auto";
|
|
409
|
+
/**
|
|
410
|
+
* Extra room above and below the data, **in pixels**. Ignored when `domain`
|
|
411
|
+
* is set explicitly — then you decide the range.
|
|
412
|
+
*
|
|
413
|
+
* The computed domain ends exactly at the smallest and largest reading, and
|
|
414
|
+
* the plot is clipped to its rectangle. A line of width 10 at the maximum
|
|
415
|
+
* therefore loses half its stroke, and a marker half its disc. That is right
|
|
416
|
+
* for the *value* and wrong for the *picture*.
|
|
417
|
+
*
|
|
418
|
+
* Pixels rather than a share of the range: the cause is in pixels
|
|
419
|
+
* (`style.line.width`, `markers.size`), and the same number then works for a
|
|
420
|
+
* series in °C and one in kW. A rule of thumb is half the widest stroke plus
|
|
421
|
+
* a little — `padding: 8` covers a 10 px line and a size-6 marker.
|
|
422
|
+
*
|
|
423
|
+
* ```ts
|
|
424
|
+
* axes: { left: { padding: 8 } }
|
|
425
|
+
* axes: { left: { padding: { top: 24, bottom: 4 } } } // room for a label
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
padding?: number | {
|
|
429
|
+
top?: number;
|
|
430
|
+
bottom?: number;
|
|
431
|
+
};
|
|
432
|
+
/** Format a tick value into its label text. */
|
|
433
|
+
format?: (value: number) => string;
|
|
434
|
+
/** Tick density / sizing. */
|
|
435
|
+
ticks?: TickConfig;
|
|
436
|
+
/** Per-tick-level grid styling. */
|
|
437
|
+
grid?: GridStyle;
|
|
438
|
+
/** Axis baseline + tick marks styling. */
|
|
439
|
+
axis?: AxisStyle;
|
|
440
|
+
/** Tick label text styling. */
|
|
441
|
+
labels?: AxisLabelsStyle;
|
|
442
|
+
}
|
|
443
|
+
/** Configuration for the X (time) axis. */
|
|
444
|
+
interface XAxisConfig {
|
|
445
|
+
/** Label drawn below the axis. */
|
|
446
|
+
label?: string;
|
|
447
|
+
/** Override the time domain. `'auto'` lets the chart compute it from data. */
|
|
448
|
+
domain?: [number, number] | "auto";
|
|
449
|
+
/** Custom formatter for tick labels (called with a `Date`). */
|
|
450
|
+
format?: (d: Date) => string;
|
|
451
|
+
/** Tick density / sizing. */
|
|
452
|
+
ticks?: TickConfig;
|
|
453
|
+
/** Per-tick-level grid styling. */
|
|
454
|
+
grid?: GridStyle;
|
|
455
|
+
/** Axis baseline + tick marks styling. */
|
|
456
|
+
axis?: AxisStyle;
|
|
457
|
+
/** Tick label text styling. */
|
|
458
|
+
labels?: AxisLabelsStyle;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Top-level axes container on {@link MLTimeGraphOptions}.
|
|
462
|
+
* `left` and `right` correspond to `yAxisIndex: 0` and `yAxisIndex: 1` series.
|
|
463
|
+
* Additional axes can be defined in the `y` array, with indices mapping to series via `yAxisIndex`.
|
|
464
|
+
*/
|
|
465
|
+
interface AxesConfig {
|
|
466
|
+
x?: XAxisConfig;
|
|
467
|
+
left?: YAxisConfig;
|
|
468
|
+
right?: YAxisConfig;
|
|
469
|
+
/** Y specifies an arbitrary number of vertical axes, each mapped by its slice index. */
|
|
470
|
+
y?: YAxisConfig[];
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/*!
|
|
474
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
475
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
476
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
477
|
+
*/
|
|
478
|
+
|
|
479
|
+
/** Chart margins in pixels. */
|
|
480
|
+
interface Margin {
|
|
481
|
+
top: number;
|
|
482
|
+
right: number;
|
|
483
|
+
bottom: number;
|
|
484
|
+
left: number;
|
|
485
|
+
}
|
|
486
|
+
/** Legend placement position — inside or outside the chart area. */
|
|
487
|
+
type LegendPosition = "inside-right" | "inside-left" | "outside-right" | "outside-left"
|
|
488
|
+
/**
|
|
489
|
+
* Ueber bzw. unter der Zeichenflaeche, waagerecht und ueber mehrere Zeilen
|
|
490
|
+
* umgebrochen. Bis 1.10.0 gab es beides nicht, und zwar aus einem Grund: Ohne
|
|
491
|
+
* echte Textbreiten laesst sich nicht ausrechnen, wieviele Eintraege in eine
|
|
492
|
+
* Zeile passen und wieviel Hoehe zu reservieren ist.
|
|
493
|
+
*/
|
|
494
|
+
| "above" | "below" | "separate";
|
|
495
|
+
/**
|
|
496
|
+
* Ein Feld hinter der Legende: Hintergrund und Rahmen.
|
|
497
|
+
*
|
|
498
|
+
* Gedacht fuer `inside-left` / `inside-right`. Dort liegt die Legende ueber den
|
|
499
|
+
* Daten, und ueber einer dichten Kurve oder einer gefuellten Flaeche ist sie
|
|
500
|
+
* schwer zu lesen -- genau dann traegt ein ruhiges Feld darunter.
|
|
501
|
+
*
|
|
502
|
+
* Wie beim Gitter entsteht es nur, wenn eines VERLANGT ist: `box: {}` genuegt
|
|
503
|
+
* und nimmt die Vorgaben.
|
|
504
|
+
*/
|
|
505
|
+
interface LegendBox {
|
|
506
|
+
/** Fuellfarbe (Vorgabe `#ffffff`). */
|
|
507
|
+
fill?: string;
|
|
508
|
+
/** Rahmenfarbe (Vorgabe `#cccccc`). `'none'` laesst den Rahmen weg. */
|
|
509
|
+
stroke?: string;
|
|
510
|
+
/** Rahmenstaerke in px (Vorgabe 1). */
|
|
511
|
+
strokeWidth?: number;
|
|
512
|
+
/** Abstand zwischen Feldrand und Eintraegen in px (Vorgabe 6). */
|
|
513
|
+
padding?: number;
|
|
514
|
+
/**
|
|
515
|
+
* Deckkraft des Feldes (Vorgabe 0,85).
|
|
516
|
+
*
|
|
517
|
+
* Nicht 1: unter einer Legende im Bild liegen Daten, und die sollen
|
|
518
|
+
* durchscheinen duerfen. Wer sie ganz verdecken will, setzt 1.
|
|
519
|
+
*/
|
|
520
|
+
opacity?: number;
|
|
521
|
+
}
|
|
522
|
+
interface LegendOptions {
|
|
523
|
+
/** Show the legend (default false). */
|
|
524
|
+
show?: boolean;
|
|
525
|
+
/** Placement (default 'inside-right'). 'separate' draws nothing — read chart.legendItems() and render your own. */
|
|
526
|
+
position?: LegendPosition;
|
|
527
|
+
/** Item layout direction (default 'vertical'). */
|
|
528
|
+
orientation?: LegendOrientation;
|
|
529
|
+
/**
|
|
530
|
+
* Hintergrund und Rahmen hinter der Legende. Ohne Angabe gibt es keines --
|
|
531
|
+
* so sah jede Legende vor 1.11.0 aus.
|
|
532
|
+
*/
|
|
533
|
+
box?: LegendBox;
|
|
534
|
+
/**
|
|
535
|
+
* Zusaetzliche CSS-Klasse an JEDEM Legendeneintrag.
|
|
536
|
+
*
|
|
537
|
+
* Die Bibliothek bringt kein Anklicken mit -- sie bringt etwas zum
|
|
538
|
+
* Anklicken. Jeder Eintrag steht ohnehin in einer eigenen Gruppe
|
|
539
|
+
* (`.legend-item`, `.legend-item--<id>`, `#legend-<id>`); mit
|
|
540
|
+
* `itemClass: 'clickmetotoggle'` bekommt er zusaetzlich die Klasse, an der
|
|
541
|
+
* ein Handler des Aufrufers haengt. Von `#legend-<id>` fuehrt der Weg zu
|
|
542
|
+
* `#series-<id>` -- derselbe Schluessel.
|
|
543
|
+
*/
|
|
544
|
+
itemClass?: string;
|
|
545
|
+
}
|
|
546
|
+
interface MLTimeGraphOptions {
|
|
547
|
+
/**
|
|
548
|
+
* Womit Textbreiten gerechnet werden (Legende, Achsentitel, Raender).
|
|
549
|
+
*
|
|
550
|
+
* Vorgabe ist `liberationMetrics` -- die mitgelieferte Vorschubtabelle des
|
|
551
|
+
* Stapels `Liberation Sans, Arial, Helvetica`. Sie liegt BEI, statt gemessen
|
|
552
|
+
* zu werden: eine Messung im Browser (Canvas `measureText`) und eine im
|
|
553
|
+
* Go-Port stimmen nicht aufs Pixel ueberein, und dann haengt das Bild davon
|
|
554
|
+
* ab, wer es zeichnet.
|
|
555
|
+
*
|
|
556
|
+
* Eigene Schrift? Dann entweder die Tabelle dafuer erzeugen
|
|
557
|
+
* (`node scripts/gen-text-metrics.mjs --font deine.ttf`) oder hier messen --
|
|
558
|
+
* etwa ueber Canvas im Browser. Mit dem zweiten Weg verlaesst du die
|
|
559
|
+
* Paritaet zwischen den beiden Bibliotheken, und zwar bewusst: eine Funktion
|
|
560
|
+
* steht in keinem JSON, der Go-Port kann sie nicht nachbilden.
|
|
561
|
+
*/
|
|
562
|
+
textMetrics?: TextMetrics;
|
|
563
|
+
/** Chart dimensions */
|
|
564
|
+
width?: number;
|
|
565
|
+
height?: number;
|
|
566
|
+
/** Margins */
|
|
567
|
+
margin?: Margin;
|
|
568
|
+
/** Renderer (injected) */
|
|
569
|
+
renderer?: Renderer;
|
|
570
|
+
/** Time series data (raw or aggregated min/max/avg) */
|
|
571
|
+
series?: AnySeries[];
|
|
572
|
+
/**
|
|
573
|
+
* Clip series drawing to the plot area (default `true`).
|
|
574
|
+
*
|
|
575
|
+
* It matters only when data lies outside the axis domain — which happens as soon as you
|
|
576
|
+
* fix `axes.x.domain` and hand over a reading from just outside the window, so the curve
|
|
577
|
+
* runs to the edge instead of starting in mid-air. Without clipping, line and markers
|
|
578
|
+
* paint over the axis labels.
|
|
579
|
+
*
|
|
580
|
+
* Turn it off if you deliberately want a series to reach beyond the plot, or if the
|
|
581
|
+
* clip costs you: every clipped group gets a `clip-path`, and a browser may promote each
|
|
582
|
+
* to its own layer. With a handful of series that is nothing; with dozens on a slow
|
|
583
|
+
* machine it can be worth measuring.
|
|
584
|
+
*/
|
|
585
|
+
clipSeries?: boolean;
|
|
586
|
+
/** Locale for i18n (e.g. 'de-DE') */
|
|
587
|
+
locale?: string;
|
|
588
|
+
/**
|
|
589
|
+
* IANA time zone for the time axis, e.g. `'Europe/Berlin'` or `'UTC'`.
|
|
590
|
+
*
|
|
591
|
+
* Unset means the machine's zone — the behaviour up to 1.8.1, kept so that
|
|
592
|
+
* nothing changes for callers who never thought about it. But a browser sits
|
|
593
|
+
* in the reader's zone and a server almost always in UTC, so the *same* JSON
|
|
594
|
+
* labelled the same reading with different times depending on where it was
|
|
595
|
+
* drawn. That is the opposite of what a DOM-free renderer is for; set this
|
|
596
|
+
* whenever a chart is produced in one place and read in another.
|
|
597
|
+
*
|
|
598
|
+
* The tick *positions* never depended on it — they are epoch arithmetic. Only
|
|
599
|
+
* the labels do.
|
|
600
|
+
*/
|
|
601
|
+
timeZone?: string;
|
|
602
|
+
/**
|
|
603
|
+
* Font for every text in the chart, written into the SVG as `font-family`.
|
|
604
|
+
*
|
|
605
|
+
* Unset means the default stack below. Why name one at all: the SVG says
|
|
606
|
+
* nothing about fonts today, so a viewer picks its own, and the same chart
|
|
607
|
+
* has different label widths in a browser, in an email client and in a
|
|
608
|
+
* rasteriser. Naming a stack removes that variance.
|
|
609
|
+
*
|
|
610
|
+
* The default is chosen for **metric compatibility**, not looks: Liberation
|
|
611
|
+
* Sans was designed with the same advance widths as Arial, so Linux lands on
|
|
612
|
+
* Liberation, Windows and macOS on Arial or Helvetica, and the labels occupy
|
|
613
|
+
* the same space. A stack with DejaVu Sans would not do that — it is
|
|
614
|
+
* noticeably wider, and labels would collide differently.
|
|
615
|
+
*
|
|
616
|
+
* A CSS stack *is* "use it if installed, otherwise ours" — no extra
|
|
617
|
+
* mechanism needed.
|
|
618
|
+
*
|
|
619
|
+
* Note that the library never **measures** text (it renders DOM-free), so
|
|
620
|
+
* this does not change the layout: anchors and `text-anchor` stay where they
|
|
621
|
+
* are. It changes what the viewer draws. A much wider house font will
|
|
622
|
+
* therefore collide differently; that is on you.
|
|
623
|
+
*/
|
|
624
|
+
fontFamily?: string;
|
|
625
|
+
/** Integrated legend configuration */
|
|
626
|
+
legend?: LegendOptions;
|
|
627
|
+
/** Markers */
|
|
628
|
+
markers?: Marker[];
|
|
629
|
+
/** Threshold bands / lines / fills drawn behind the series */
|
|
630
|
+
thresholds?: Threshold[];
|
|
631
|
+
/** Highlighted time regions drawn behind the series */
|
|
632
|
+
highlights?: Highlight[];
|
|
633
|
+
/**
|
|
634
|
+
* Data-gap configuration. Two equivalent forms:
|
|
635
|
+
* - `Gap[]` — legacy: array of region objects with flat
|
|
636
|
+
* fill/hatch/labelBaseline/rotate fields.
|
|
637
|
+
* - {@link GapsConfig} — new (preferred): `{ regions?, autoDetect?,
|
|
638
|
+
* minGapMs?, style? }`, where `style` provides
|
|
639
|
+
* per-region fallbacks and `autoDetect` (TODO)
|
|
640
|
+
* will derive gaps from time spacing in
|
|
641
|
+
* Phase 3+. For now: typed but not yet acted on.
|
|
642
|
+
*/
|
|
643
|
+
gaps?: Gap[] | GapsConfig;
|
|
644
|
+
/** Free-form overlays (arrow, line, rect, point, label) in data coordinates */
|
|
645
|
+
annotations?: Annotation[];
|
|
646
|
+
/** Horizontal annotation bands below the chart (colored time ranges + labels) */
|
|
647
|
+
annotationBands?: AnnotationBandConfig[];
|
|
648
|
+
/**
|
|
649
|
+
* First-class axes configuration: per-axis `label`, `format`, `ticks`, `grid`,
|
|
650
|
+
* `axis`, `labels` (see USAGE.md, "Axes").
|
|
651
|
+
*/
|
|
652
|
+
axes?: AxesConfig;
|
|
653
|
+
}
|
|
654
|
+
|
|
308
655
|
/*!
|
|
309
656
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
310
657
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
@@ -415,4 +762,4 @@ declare function renderMarkers(points: DataPoint[], ctx: RenderingContext, style
|
|
|
415
762
|
declare function drawMarker(// NOSONAR
|
|
416
763
|
commands: DrawCommand[], id: string | undefined, shape: Exclude<PointStyleType, "none">, x: number, y: number, size: number, stroke: string, fill: string, sw: number): void;
|
|
417
764
|
|
|
418
|
-
export { type
|
|
765
|
+
export { type AxesConfig as A, type GridLineStyle as G, type LegendItem as L, type MLTimeGraphOptions as M, Renderer as R, type SeriesStyle as S, type TextMetrics as T, type XAxisConfig as X, type YAxisConfig as Y, type LayoutResult as a, type Margin as b, type LegendOptions as c, type LegendPosition as d, type LegendOrientation as e, type Marker as f, type RenderOutput as g, type AxisLabelsStyle as h, type AxisStyle as i, type GridStyle as j, type Theme as k, type TickConfig as l, drawMarker as m, estimateMetrics as n, getDefaultTheme as o, liberationMetrics as p, slugify as q, resetDefaultTheme as r, setDefaultTheme as s, type RenderingContext as t, Layout as u, type LayoutConfig as v, type LegendConfig as w, measureLegend as x, renderLegend as y, renderMarkers as z };
|
|
@@ -331,6 +331,7 @@ type PathParams = Omit<DrawPath, "type">;
|
|
|
331
331
|
type RectParams = Omit<DrawRect, "type">;
|
|
332
332
|
type CircleParams = Omit<DrawCircle, "type">;
|
|
333
333
|
type TextParams = Omit<DrawText, "type">;
|
|
334
|
+
type GapParams = Omit<DrawGap, "type">;
|
|
334
335
|
|
|
335
336
|
/*!
|
|
336
337
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -448,12 +449,51 @@ interface GapLabel {
|
|
|
448
449
|
* but they need `margin.top` / `margin.bottom` to have somewhere to go.
|
|
449
450
|
*/
|
|
450
451
|
baseline?: RangeLabelPosition;
|
|
451
|
-
|
|
452
|
+
/**
|
|
453
|
+
* Drehung in Grad -- oder `'auto'`.
|
|
454
|
+
*
|
|
455
|
+
* `'auto'` dreht die Beschriftung auf -90 Grad, sobald sie waagerecht nicht
|
|
456
|
+
* zwischen die Raender der Luecke passt. Eine kurze Luecke mit einem langen
|
|
457
|
+
* Text ("Sensor Offline" ist breiter als zwei Stunden) lief sonst auf beiden
|
|
458
|
+
* Seiten heraus und legte sich ueber die Daten daneben.
|
|
459
|
+
*/
|
|
460
|
+
rotate?: number | "auto";
|
|
452
461
|
color?: string;
|
|
453
462
|
fontSize?: number;
|
|
454
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Ein Streifen am unteren Rand der Zeichenflaeche, der die Luecke markiert.
|
|
466
|
+
*
|
|
467
|
+
* Gedacht fuer den Fall, in dem im Bild selbst nichts zu sehen ist: eine
|
|
468
|
+
* Luecke mit `display: 'empty'` bricht nur die Linie, und bei einer kurzen
|
|
469
|
+
* Unterbrechung uebersieht man das. Der Streifen liegt immer an derselben
|
|
470
|
+
* Stelle und beantwortet die Frage "wann fehlten Daten?" auf einen Blick,
|
|
471
|
+
* ohne die Kurve zu beruehren.
|
|
472
|
+
*
|
|
473
|
+
* Er sitzt auf der Grundlinie und braucht deshalb KEINEN zusaetzlichen Rand --
|
|
474
|
+
* anders als ein Annotationsband, das unterhalb der Zeitachse liegt und vom
|
|
475
|
+
* Aufrufer Platz verlangt.
|
|
476
|
+
*/
|
|
477
|
+
interface GapBand {
|
|
478
|
+
/** Hoehe in px (Vorgabe 6). */
|
|
479
|
+
height?: number;
|
|
480
|
+
/** Farbe (Vorgabe: die Randfarbe der Luecke). */
|
|
481
|
+
fill?: string;
|
|
482
|
+
/** Deckkraft (Vorgabe 0,75). */
|
|
483
|
+
opacity?: number;
|
|
484
|
+
/**
|
|
485
|
+
* Verschiebung nach unten in px (Vorgabe 0).
|
|
486
|
+
*
|
|
487
|
+
* Mit 0 sitzt der Streifen INNERHALB der Zeichenflaeche auf der Grundlinie.
|
|
488
|
+
* Ein positiver Wert schiebt ihn in den unteren Rand -- dort ist er aus dem
|
|
489
|
+
* Bild heraus, braucht aber Platz, den `margin.bottom` hergeben muss.
|
|
490
|
+
*/
|
|
491
|
+
offset?: number;
|
|
492
|
+
}
|
|
455
493
|
/** Visual styling of a gap region. */
|
|
456
494
|
interface GapStyle {
|
|
495
|
+
/** Ein Streifen am unteren Rand, der die Luecke markiert. Ohne Angabe keiner. */
|
|
496
|
+
band?: GapBand;
|
|
457
497
|
/**
|
|
458
498
|
* - `'filled'` — the area in the fill colour, no edges.
|
|
459
499
|
* - `'dashed_border'` — the area **plus** two vertical dashed lines at its
|
|
@@ -751,7 +791,8 @@ interface Gap {
|
|
|
751
791
|
fillOpacity?: number;
|
|
752
792
|
/** Same five values as a highlight's `labelPosition` — see `core/range_label.ts`. */
|
|
753
793
|
labelBaseline?: RangeLabelPosition;
|
|
754
|
-
|
|
794
|
+
/** Drehung in Grad, oder "auto": drehen, wenn der Text nicht hineinpasst. */
|
|
795
|
+
rotate?: number | "auto";
|
|
755
796
|
style?: DrawGapType_t;
|
|
756
797
|
}
|
|
757
798
|
/** Configuration for gap rendering (manual or auto-detected) */
|
|
@@ -829,7 +870,15 @@ interface Highlight {
|
|
|
829
870
|
* (in the top margin / below the x-axis) so it never overlaps the data.
|
|
830
871
|
*/
|
|
831
872
|
labelPosition?: RangeLabelPosition;
|
|
832
|
-
|
|
873
|
+
/**
|
|
874
|
+
* Drehung in Grad -- oder `"auto"`.
|
|
875
|
+
*
|
|
876
|
+
* `"auto"` dreht die Beschriftung auf -90 Grad, sobald sie waagerecht nicht
|
|
877
|
+
* zwischen die Raender des Bereichs passt. Dieselbe Regel wie bei einer
|
|
878
|
+
* Luecke, und derselbe Anlass: eine Vier-Stunden-Abweichung mit dem Text
|
|
879
|
+
* "Delta 4,8 Grad -- Abtauung?" lief sonst auf beiden Seiten heraus.
|
|
880
|
+
*/
|
|
881
|
+
rotate?: number | "auto";
|
|
833
882
|
}
|
|
834
883
|
/** A point in data coordinates. `axis` selects the y-scale (0 = left, 1 = right). */
|
|
835
884
|
interface DataPointRef {
|
|
@@ -1053,4 +1102,4 @@ declare class BandScale implements Scale {
|
|
|
1053
1102
|
positions(): Map<string, number>;
|
|
1054
1103
|
}
|
|
1055
1104
|
|
|
1056
|
-
export { type SeriesOverlay as $, type AxisPosition as A, type DataPointRef as B, type FillBound as C, type DataPoint as D, type EnumMap as E, type FillSpec as F, type GridLayer as G, type
|
|
1105
|
+
export { type SeriesOverlay as $, type AxisPosition as A, type DataPointRef as B, type FillBound as C, type DataPoint as D, type EnumMap as E, type FillSpec as F, type GridLayer as G, type Highlight as H, type FillRegion as I, type FillSide as J, type FillStyle as K, LinearScale as L, type MarkerLineStyle as M, type GapConfig as N, type GapLabel as O, type PointStyleType as P, type GapRegion as Q, type RangeLabelPosition as R, type SmoothingType as S, TimeScale as T, type GapStyle as U, type LineShape as V, type LineStyle as W, type MarkerStyle as X, type MovingAverageType as Y, type SVGLineStyle as Z, type SensorType as _, type DrawCommand as a, type SeriesOverlayKind as a0, type SeriesType as a1, type ShadowStyle as a2, type SolidDashStyle as a3, type ThresholdLabelConfig as a4, getLineStyle as a5, resolveDash as a6, type GapBand as a7, type LineParams as a8, type PathParams as a9, type RectParams as aa, type CircleParams as ab, type TextParams as ac, type GapParams as ad, type Point as ae, BandScale as af, type BandScaleConfig as ag, type Dashstyle_t as ah, type DomainScaleConfig as ai, type DrawCircle as aj, type DrawGap as ak, type DrawGapType_t$1 as al, type DrawLine as am, type DrawPath as an, type DrawRect as ao, type DrawText as ap, type LinearScaleConfig as aq, type Scale as ar, type ScaleConfig as as, TIME_INTERVALS as at, type TimeScaleConfig as au, getHatch as av, type LineVariant as b, type DrawGroup as c, type AnySeries as d, type Threshold as e, type Gap as f, type GapsConfig as g, type Annotation as h, type AnnotationBandConfig as i, type HatchVariant as j, type SeriesStyle as k, type TimeSeries as l, type LineDashStyle as m, type ThresholdFill as n, type ThresholdLabelPosition as o, type AnnotationPointShape as p, type LabelAnchor as q, type AnnotationBandItem as r, type TextBaseline as s, type AggregatedPoint as t, type AggregatedSeries as u, type AggregatedShowAs as v, type AggregationConfig as w, type AggregationMode as x, type AnnotationKind as y, type AxisOrientation as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-time-graph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
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",
|