ml-time-graph 1.7.1 → 1.8.3

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { L as LegendOrientation, R as Renderer, M as Marker, a as LegendItem, b as LayoutResult, c as RenderOutput } from './series_renderer-COVNvq2x.js';
2
- export { T as Theme, d as drawMarker, g as getDefaultTheme, r as resetDefaultTheme, s as setDefaultTheme } from './series_renderer-COVNvq2x.js';
3
- import { L as LineVariant, A as AnySeries, T as Threshold, H as Highlight, G as Gap, a as GapsConfig, b as Annotation, c as AnnotationBandConfig, D as DrawCommand, d as TimeScale, e as LinearScale, S as SeriesStyle, F as FillSpec, f as TimeSeries, g as HatchVariant, h as ThresholdLabelPosition, P as PointStyleType, i as AnnotationBandItem, j as AggregatedPoint, k as AggregatedSeries, l as DataPoint } from './scale-D6NtEaUB.js';
4
- export { m as AggregationConfig, n as AggregationMode, o as DataPointRef, E as EnumMap, p as FillBound, q as FillDirectionType, r as FillRegion, s as FillSide, t as FillStyle, u as GapConfig, v as GapLabel, w as GapRegion, x as GapStyle, y as LineDashStyle, z as LineStyle, M as MarkerStyle, B as SVGLineStyle, C as SensorType, I as SeriesOverlay, J as SeriesOverlayKind, K as SeriesType, N as ShadowStyle, O as ThresholdLabelConfig, Q as getLineStyle, R as resolveDash } from './scale-D6NtEaUB.js';
1
+ import { L as LegendOrientation, R as Renderer, M as Marker, a as LegendItem, b as LayoutResult, c as RenderOutput } from './slug-0lFk9pY7.js';
2
+ export { T as Theme, d as drawMarker, g as getDefaultTheme, r as resetDefaultTheme, s as setDefaultTheme, e as slugify } from './slug-0lFk9pY7.js';
3
+ import { L as LineVariant, A as AnySeries, T as Threshold, H as Highlight, G as Gap, a as GapsConfig, b as Annotation, c as AnnotationBandConfig, D as DrawCommand, d as TimeScale, e as LinearScale, S as SeriesStyle, F as FillSpec, f as TimeSeries, g as HatchVariant, h as ThresholdLabelPosition, P as PointStyleType, i as AnnotationBandItem, j as AggregatedPoint, k as AggregatedSeries, l as DataPoint } from './scale-CoTgJ27U.js';
4
+ export { m as AggregationConfig, n as AggregationMode, o as DataPointRef, E as EnumMap, p as FillBound, q as FillDirectionType, r as FillRegion, s as FillSide, t as FillStyle, u as GapConfig, v as GapLabel, w as GapRegion, x as GapStyle, y as LineDashStyle, z as LineStyle, M as MarkerStyle, B as SVGLineStyle, C as SensorType, I as SeriesOverlay, J as SeriesOverlayKind, K as SeriesType, N as ShadowStyle, O as ThresholdLabelConfig, Q as getLineStyle, R as resolveDash } from './scale-CoTgJ27U.js';
5
5
 
6
6
  /*!
7
7
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -54,6 +54,29 @@ interface YAxisConfig {
54
54
  label?: string;
55
55
  /** Override the value domain. `'auto'` lets the chart compute it from data. */
56
56
  domain?: [number, number] | "auto";
57
+ /**
58
+ * Extra room above and below the data, **in pixels**. Ignored when `domain`
59
+ * is set explicitly — then you decide the range.
60
+ *
61
+ * The computed domain ends exactly at the smallest and largest reading, and
62
+ * the plot is clipped to its rectangle. A line of width 10 at the maximum
63
+ * therefore loses half its stroke, and a marker half its disc. That is right
64
+ * for the *value* and wrong for the *picture*.
65
+ *
66
+ * Pixels rather than a share of the range: the cause is in pixels
67
+ * (`style.line.width`, `markers.size`), and the same number then works for a
68
+ * series in °C and one in kW. A rule of thumb is half the widest stroke plus
69
+ * a little — `padding: 8` covers a 10 px line and a size-6 marker.
70
+ *
71
+ * ```ts
72
+ * axes: { left: { padding: 8 } }
73
+ * axes: { left: { padding: { top: 24, bottom: 4 } } } // room for a label
74
+ * ```
75
+ */
76
+ padding?: number | {
77
+ top?: number;
78
+ bottom?: number;
79
+ };
57
80
  /** Format a tick value into its label text. */
58
81
  format?: (value: number) => string;
59
82
  /** Tick density / sizing. */
@@ -144,6 +167,20 @@ interface MLTimeGraphOptions {
144
167
  clipSeries?: boolean;
145
168
  /** Locale for i18n (e.g. 'de-DE') */
146
169
  locale?: string;
170
+ /**
171
+ * IANA time zone for the time axis, e.g. `'Europe/Berlin'` or `'UTC'`.
172
+ *
173
+ * Unset means the machine's zone — the behaviour up to 1.8.1, kept so that
174
+ * nothing changes for callers who never thought about it. But a browser sits
175
+ * in the reader's zone and a server almost always in UTC, so the *same* JSON
176
+ * labelled the same reading with different times depending on where it was
177
+ * drawn. That is the opposite of what a DOM-free renderer is for; set this
178
+ * whenever a chart is produced in one place and read in another.
179
+ *
180
+ * The tick *positions* never depended on it — they are epoch arithmetic. Only
181
+ * the labels do.
182
+ */
183
+ timeZone?: string;
147
184
  /** Integrated legend configuration */
148
185
  legend?: LegendOptions;
149
186
  /** Markers */
@@ -190,6 +227,7 @@ declare class MLTimeGraph {
190
227
  private readonly _layout;
191
228
  private readonly _renderer?;
192
229
  private readonly _locale?;
230
+ private readonly _timeZone?;
193
231
  private readonly _legend?;
194
232
  /** Serien auf die Zeichenflaeche beschneiden (Vorgabe: ja) — siehe options.ts. */
195
233
  private readonly _clipSeries;
@@ -741,8 +779,6 @@ declare class SVGRenderer extends Renderer {
741
779
  _toSVG(cmd: DrawCommand): string;
742
780
  /** Register or retrieve a hatch pattern by variant. Returns the pattern id for use as fill="url(#id)". */
743
781
  _hatchPattern(variant: string, fillColor: string | undefined): string;
744
- /** Monotonic counter for unique hatch pattern ids. */
745
- _hatchIndex: number;
746
782
  _path(c: Extract<DrawCommand, {
747
783
  type: "path";
748
784
  }>): string;
@@ -934,4 +970,68 @@ declare function toSeries<T>(name: string, rows: readonly T[], spec?: ToDataPoin
934
970
  data: DataPoint[];
935
971
  };
936
972
 
937
- export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnySeries, type AxesConfig, type AxisLabelsStyle, type AxisStyle, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, type GridLineStyle, type GridStyle, HatchVariant, Highlight, HighlightBuilder, LegendItem, type LegendOptions, LegendOrientation, type LegendPosition, type LimitStatsPoint, LineVariant, MLTimeGraph, type MLTimeGraphOptions, type Margin, Marker, MarkerBuilder, type MktPoint, PointStyleType, SVGRenderer, SeriesStyle, type StatsAggregatedPoint, type StdDevPoint, Threshold, ThresholdBuilder, ThresholdLabelPosition, type TickConfig, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, type XAxisConfig, type YAxisConfig, attachTooltip, fillBetweenThresholds, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
973
+ /*!
974
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
975
+ * MIT with Attribution: free use incl. commercial requires visible credit to
976
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
977
+ */
978
+
979
+ /**
980
+ * Ein Fragment: dieselbe Form wie die Optionen, nur unvollstaendig.
981
+ *
982
+ * Die zweite Haelfte der Union ist der Ausweg fuer rohes JSON -- ein aus einer
983
+ * Datei gelesenes Fragment ist nicht typisiert, und `mergeOptions` soll es
984
+ * trotzdem annehmen. Ohne die erste Haelfte waere dagegen der haeufigste
985
+ * Aufruf unmoeglich: `mergeOptions(theme, optionen)` mit zwei typisierten
986
+ * Objekten -- `MLTimeGraphOptions` ist nicht auf `Record<string, unknown>`
987
+ * zuweisbar, weil ihm die Index-Signatur fehlt.
988
+ */
989
+ type OptionsLayer = Partial<MLTimeGraphOptions> | Record<string, unknown>;
990
+ /**
991
+ * Layer chart options on top of each other — the later layer wins.
992
+ *
993
+ * Use it when part of the options repeats across many charts: colours, axes,
994
+ * legend, dimensions. Keep that part in one place and put it over the data
995
+ * instead of copying it into every call.
996
+ *
997
+ * ```ts
998
+ * const chart = new MLTimeGraph(mergeOptions(hausTheme, messwerte));
999
+ * ```
1000
+ *
1001
+ * **The rule, in one sentence:** objects are merged key by key, to any depth;
1002
+ * everything else — numbers, strings, booleans, `null` and **arrays** — is
1003
+ * replaced.
1004
+ *
1005
+ * Replacing arrays rather than appending is deliberate. If a layer appended, a
1006
+ * theme carrying a single line style would *add* it to your series instead of
1007
+ * styling them, and nobody would guess why there is one curve too many. To add
1008
+ * entries, write the array out in full — longer, but it says so.
1009
+ *
1010
+ * This is the same rule the Go port applies (`models.MergeJSON`), and the
1011
+ * CLI's `-with` flag uses it. A different rule on either side would mean the
1012
+ * same job draws two different pictures.
1013
+ *
1014
+ * Note that `{ ...a, ...b }` is *not* the same thing: the spread is shallow, so
1015
+ * an `axes` in the later object replaces the whole `axes` of the earlier one —
1016
+ * grid, ticks and all.
1017
+ */
1018
+ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGraphOptions;
1019
+
1020
+ /*!
1021
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
1022
+ * MIT with Attribution: free use incl. commercial requires visible credit to
1023
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
1024
+ */
1025
+ /**
1026
+ * Die Version dieser Bibliothek — das Gegenstueck zu `version.Version` im
1027
+ * Go-Port, und dieselbe Zahl: beide werden von `scripts/release.mjs` im
1028
+ * selben Lauf gesetzt.
1029
+ *
1030
+ * Es gab sie auf der TS-Seite bisher nicht. Gebraucht wird sie, seit jedes
1031
+ * erzeugte SVG sagt, woraus es stammt (`<!-- MLTimeGraph x.y.z -->`): Wer
1032
+ * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
1033
+ * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
1034
+ */
1035
+ declare const VERSION = "1.8.3";
1036
+
1037
+ export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnySeries, type AxesConfig, type AxisLabelsStyle, type AxisStyle, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, type GridLineStyle, type GridStyle, HatchVariant, Highlight, HighlightBuilder, LegendItem, type LegendOptions, LegendOrientation, type LegendPosition, type LimitStatsPoint, LineVariant, MLTimeGraph, type MLTimeGraphOptions, type Margin, Marker, MarkerBuilder, type MktPoint, type OptionsLayer, PointStyleType, SVGRenderer, SeriesStyle, type StatsAggregatedPoint, type StdDevPoint, Threshold, ThresholdBuilder, ThresholdLabelPosition, type TickConfig, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, type XAxisConfig, type YAxisConfig, attachTooltip, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };