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/CHANGELOG.md +809 -0
- package/QUICKSTART_GRAPH_BUILDER.de.md +1 -1
- package/README.de.md +125 -16
- package/README.md +122 -17
- package/SKILLS.md +157 -4
- package/USAGE.md +326 -3
- package/dist/analyze/index.d.ts +54 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +107 -7
- package/dist/index.js +27 -26
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +1 -1
- package/dist/internals.d.ts +104 -26
- package/dist/internals.js +15 -15
- package/dist/{scale-D6NtEaUB.d.ts → scale-CoTgJ27U.d.ts} +71 -12
- package/dist/{series_renderer-COVNvq2x.d.ts → slug-0lFk9pY7.d.ts} +18 -2
- package/package.json +19 -12
package/dist/internals.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as Theme, M as Marker } from './
|
|
2
|
-
export {
|
|
3
|
-
import { D as DrawCommand, T as Threshold, e as LinearScale, G as Gap, d as TimeScale, g as HatchVariant, H as Highlight, b as Annotation,
|
|
4
|
-
export { W as AxisOrientation, X as AxisPosition, Y as BandScaleConfig, Z as CircleParams, _ as Dashstyle_t, $ as DomainScaleConfig, a0 as DrawCircle, a1 as DrawGap, a2 as DrawGapType_t, a3 as DrawGradient, a4 as DrawGroup, a5 as DrawLine, a6 as DrawPath, a7 as DrawRect, a8 as DrawText, a9 as LabelAnchor, aa as LineParams, ab as LinearScaleConfig, ac as PathParams, ad as RectParams, ae as Scale, af as ScaleConfig, ag as TIME_INTERVALS, ah as TextParams, ai as TimeScaleConfig, aj as getHatch } from './scale-
|
|
1
|
+
import { T as Theme, M as Marker } from './slug-0lFk9pY7.js';
|
|
2
|
+
export { f as Layout, h as LayoutConfig, b as LayoutResult, i as LegendConfig, a as LegendItem, L as LegendOrientation, R as Renderer, m as measureLegend, j as renderArea, k as renderLegend, l as renderLine, n as renderSeriesMarkers, o as renderSplitLine, p as renderStep, q as renderZonedArea, e as slugify, t as toStepData, u as toStepPoints } from './slug-0lFk9pY7.js';
|
|
3
|
+
import { D as DrawCommand, T as Threshold, e as LinearScale, G as Gap, d as TimeScale, g as HatchVariant, H as Highlight, b as Annotation, l as DataPoint, U as Point, E as EnumMap, V as BandScale, P as PointStyleType, j as AggregatedPoint, i as AnnotationBandItem, L as LineVariant, F as FillSpec, x as GapStyle, f as TimeSeries } from './scale-CoTgJ27U.js';
|
|
4
|
+
export { W as AxisOrientation, X as AxisPosition, Y as BandScaleConfig, Z as CircleParams, _ as Dashstyle_t, $ as DomainScaleConfig, a0 as DrawCircle, a1 as DrawGap, a2 as DrawGapType_t, a3 as DrawGradient, a4 as DrawGroup, a5 as DrawLine, a6 as DrawPath, a7 as DrawRect, a8 as DrawText, a9 as LabelAnchor, aa as LineParams, ab as LinearScaleConfig, ac as PathParams, ad as RectParams, ae as Scale, af as ScaleConfig, ag as TIME_INTERVALS, ah as TextParams, ai as TimeScaleConfig, aj as getHatch } from './scale-CoTgJ27U.js';
|
|
5
5
|
|
|
6
6
|
/*!
|
|
7
7
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -53,6 +53,37 @@ interface ThresholdRenderConfig {
|
|
|
53
53
|
/** Flat-list variant: lines / fills / labels in one array (legacy callers). */
|
|
54
54
|
declare function renderThresholds(config: ThresholdRenderConfig): DrawCommand[];
|
|
55
55
|
|
|
56
|
+
/*!
|
|
57
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
58
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
59
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Wo die Beschriftung eines Zeitbereichs sitzt — Highlight wie Datenluecke.
|
|
63
|
+
*
|
|
64
|
+
* Fuenf Werte, und die Unterscheidung ist der ganze Punkt:
|
|
65
|
+
*
|
|
66
|
+
* - `top` / `center` / `bottom` liegen INNERHALB der Zeichenflaeche. Sie
|
|
67
|
+
* brauchen keinen Rand und koennen die Kurve ueberdecken.
|
|
68
|
+
* - `above` / `below` liegen im Rand DES BILDES — oben ueber der Flaeche,
|
|
69
|
+
* unten unter der Zeitachse. Sie ueberdecken nie Daten, brauchen dafuer
|
|
70
|
+
* aber Platz: `margin.top` bzw. `margin.bottom`.
|
|
71
|
+
*
|
|
72
|
+
* `below` rechnet deshalb von der Gesamthoehe her, nicht von der Unterkante
|
|
73
|
+
* der Zeichenflaeche. Ohne diese Zahl gibt es keinen unteren Rand, in den die
|
|
74
|
+
* Schrift gehoeren koennte, und der Aufrufer bekaeme Text ausserhalb des SVG —
|
|
75
|
+
* sichtbar in keinem Betrachter, aber vorhanden in jeder Datei.
|
|
76
|
+
*
|
|
77
|
+
* `middle` ist der alte Name der Datenluecken fuer `center` und bleibt
|
|
78
|
+
* gueltig: Ein Name, der einmal in einer Datei stand, verschwindet nicht,
|
|
79
|
+
* weil zwei Bauteile sich auf eine gemeinsame Schreibweise einigen.
|
|
80
|
+
*
|
|
81
|
+
* Dieselben Zahlen stehen im Go-Port (pkg/renderer/range_label.go). Laufen sie
|
|
82
|
+
* auseinander, sitzt dieselbe Beschriftung im Browser und auf dem Server
|
|
83
|
+
* verschieden hoch.
|
|
84
|
+
*/
|
|
85
|
+
type RangeLabelPosition = "top" | "center" | "middle" | "bottom" | "above" | "below";
|
|
86
|
+
|
|
56
87
|
/*!
|
|
57
88
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
58
89
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
@@ -67,6 +98,8 @@ interface GapRenderConfig {
|
|
|
67
98
|
timeScale: TimeScale;
|
|
68
99
|
/** Pixel Y range of the chart area */
|
|
69
100
|
yRange: [number, number];
|
|
101
|
+
/** Total SVG height — needed to place a 'below' label in the bottom margin */
|
|
102
|
+
height?: number;
|
|
70
103
|
/** Background fill color (default: theme.gapFill). */
|
|
71
104
|
fill?: string;
|
|
72
105
|
/** Hatch pattern for gap fill */
|
|
@@ -83,14 +116,23 @@ interface GapRenderConfig {
|
|
|
83
116
|
fontSize?: number;
|
|
84
117
|
/** Text color for gap labels (default: theme.gapFontColor). */
|
|
85
118
|
fontFill?: string;
|
|
86
|
-
/**
|
|
87
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Where the label sits (default 'middle'). Same five values as a highlight's
|
|
121
|
+
* `labelPosition`, and the same pixel offsets: 'top' | 'center'/'middle' |
|
|
122
|
+
* 'bottom' inside the plot area, 'above' / 'below' in the margin around it.
|
|
123
|
+
*/
|
|
124
|
+
labelBaseline?: RangeLabelPosition;
|
|
88
125
|
/** Rotation angle for labels in degrees (default: none). */
|
|
89
126
|
labelRotate?: number;
|
|
90
127
|
}
|
|
91
128
|
/**
|
|
92
|
-
* Render data gaps as dashed
|
|
93
|
-
*
|
|
129
|
+
* Render data gaps as fills, dashed edges, or labels.
|
|
130
|
+
*
|
|
131
|
+
* Das Zeichnen liegt in `renderRanges` — dieselbe Funktion, die auch
|
|
132
|
+
* Highlights zeichnet. Hier bleibt, was eine Luecke ausmacht: ihre
|
|
133
|
+
* Theme-Vorgaben, die Schraffur, die beiden senkrechten Kanten und die zwei
|
|
134
|
+
* Ebenen. Denn anders als ein Highlight traegt eine Luecke chart-weite
|
|
135
|
+
* Vorgaben, die jede einzelne ueberschreiben darf.
|
|
94
136
|
*/
|
|
95
137
|
declare function renderGaps(config: GapRenderConfig): DrawCommand[];
|
|
96
138
|
|
|
@@ -131,7 +173,14 @@ interface HighlightRenderConfig {
|
|
|
131
173
|
/** Total SVG height — needed to place a 'below' label in the bottom margin */
|
|
132
174
|
height?: number;
|
|
133
175
|
}
|
|
134
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Render time-range highlights as colored bands with optional labels.
|
|
178
|
+
*
|
|
179
|
+
* Das Zeichnen selbst liegt in `renderRanges` — dieselbe Funktion, die auch
|
|
180
|
+
* die Datenluecken zeichnet. Hier bleibt nur, was ein Highlight ausmacht:
|
|
181
|
+
* seine Theme-Vorgaben und die Eigenheit, dass die Beschriftung die Farbe des
|
|
182
|
+
* Bereichs traegt.
|
|
183
|
+
*/
|
|
135
184
|
declare function renderHighlights(config: HighlightRenderConfig): DrawCommand[];
|
|
136
185
|
|
|
137
186
|
/*!
|
|
@@ -208,6 +257,8 @@ interface AxisColorspec {
|
|
|
208
257
|
interface TimeAxisConfig {
|
|
209
258
|
/** Locale for i18n formatting (default: 'en-US') */
|
|
210
259
|
locale?: string;
|
|
260
|
+
/** IANA-Zone fuer die Beschriftung; wird an die Zeitskala gereicht. */
|
|
261
|
+
timeZone?: string;
|
|
211
262
|
/** Custom format callback override */
|
|
212
263
|
format?: (date: Date) => string;
|
|
213
264
|
/** Minimum number of ticks */
|
|
@@ -309,6 +360,49 @@ declare class ValueAxis {
|
|
|
309
360
|
render(): DrawCommand[];
|
|
310
361
|
}
|
|
311
362
|
|
|
363
|
+
/*!
|
|
364
|
+
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
365
|
+
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
366
|
+
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
/** Moving average type */
|
|
370
|
+
type MovingAvgType = "simple" | "exponential";
|
|
371
|
+
interface MovingAvgConfig {
|
|
372
|
+
/** Data points */
|
|
373
|
+
data: DataPoint[];
|
|
374
|
+
/** Window size (number of data points) */
|
|
375
|
+
windowSize: number;
|
|
376
|
+
/** MA type */
|
|
377
|
+
type?: MovingAvgType;
|
|
378
|
+
/** Time scale for X-axis */
|
|
379
|
+
timeScale: TimeScale;
|
|
380
|
+
/** Value scale for Y-axis */
|
|
381
|
+
valueScale: LinearScale;
|
|
382
|
+
/** Stroke color */
|
|
383
|
+
stroke?: string;
|
|
384
|
+
/** Stroke width */
|
|
385
|
+
strokeWidth?: number;
|
|
386
|
+
}
|
|
387
|
+
declare class MovingAvg {
|
|
388
|
+
#private;
|
|
389
|
+
constructor(config: MovingAvgConfig);
|
|
390
|
+
/** Compute simple moving average points */
|
|
391
|
+
static simple(data: DataPoint[], windowSize: number): {
|
|
392
|
+
time: number;
|
|
393
|
+
value: number;
|
|
394
|
+
}[];
|
|
395
|
+
/** Compute exponential moving average (EMA) */
|
|
396
|
+
static exponential(data: DataPoint[], windowSize: number): {
|
|
397
|
+
time: number;
|
|
398
|
+
value: number;
|
|
399
|
+
}[];
|
|
400
|
+
/** Get computed moving average as pixel points */
|
|
401
|
+
points(): Point[];
|
|
402
|
+
/** Render MA as a path command */
|
|
403
|
+
render(): DrawCommand[];
|
|
404
|
+
}
|
|
405
|
+
|
|
312
406
|
/*!
|
|
313
407
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
314
408
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
@@ -812,20 +906,4 @@ declare function resolveFill(series: TimeSeries): FillSpec | undefined;
|
|
|
812
906
|
*/
|
|
813
907
|
declare function resolveSeriesStyle(series: TimeSeries): ResolvedSeriesStyle;
|
|
814
908
|
|
|
815
|
-
|
|
816
|
-
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
817
|
-
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
818
|
-
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
819
|
-
*/
|
|
820
|
-
/**
|
|
821
|
-
* Turn a free-form name into an ASCII slug usable as an `id`/CSS-class
|
|
822
|
-
* suffix. Lowercased, non-alphanumeric runs collapsed to `-`, accents
|
|
823
|
-
* stripped, trimmed, capped at 50 chars. Empty input → `'unnamed'`.
|
|
824
|
-
*
|
|
825
|
-
* slugify('Temperatur (°C)') → 'temperatur-c'
|
|
826
|
-
* slugify('Signal A') → 'signal-a'
|
|
827
|
-
* slugify(' ') → 'unnamed'
|
|
828
|
-
*/
|
|
829
|
-
declare function slugify(s: string | undefined | null): string;
|
|
830
|
-
|
|
831
|
-
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, renderGaps, renderGrid, renderHighlights, renderMarkers, renderThresholds, resolveFill, resolveGap, resolveLines, resolveMarkers, resolveSeriesStyle, resolveShadow, slugify, theme };
|
|
909
|
+
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, MovingAvg, type MovingAvgConfig, type MovingAvgType, 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, renderGaps, renderGrid, renderHighlights, renderMarkers, renderThresholds, resolveFill, resolveGap, resolveLines, resolveMarkers, resolveSeriesStyle, resolveShadow, theme };
|
package/dist/internals.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N=class{};var x=class{static interpolateDataPoint(a,e,t){return {time:a.time+Math.round(t*(e.time-a.time)),value:(a.value??0)+t*((e.value??0)-(a.value??0))}}static interpolateAggregatedPoint(a,e,t){let n=(o,r)=>o!==null&&r!==null?o+t*(r-o):null;return {time:a.time+t*(e.time-a.time),min:n(a.min,e.min),max:n(a.max,e.max),avg:n(a.avg,e.avg),count:Math.round(a.count+t*(e.count-a.count))}}static getRuns(a,e,t=0){let n=[...a].sort((l,i)=>l.time-i.time),o=[],r=[],s=null;for(let l of n){let i=e(l),m=t>0&&s&&l.time-s.time>t;(i||m)&&r.length&&(o.push(r),r=[]),i||r.push(l),s=l;}return r.length&&o.push(r),o}static splitByBoundaries(a,e,t,n){if(a.length===0)return [];if(e.length===0)return [{data:a,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let o=[...e].sort((m,u)=>m-u),r=[],s=m=>m<=0?Number.NEGATIVE_INFINITY:o[m-1],l=m=>{let u=0;for(let c=0;c<o.length&&m>=o[c];c++)u=c+1;return u},i=[a[0]];for(let m=1;m<a.length;m++){let u=a[m-1],c=a[m],d=t(u),p=t(c),f;p>d?f=o.filter(y=>y>d&&y<=p):p<d?f=o.filter(y=>y>=p&&y<d).reverse():f=[];let g=d;for(let y of f){let b=(y-d)/(p-d),S=n(u,c,b);i.push(S);let O=l((g+y)/2);r.push({data:i,zoneIndex:O,zoneLow:s(O)}),i=[S],g=y;}(f.length===0||f[f.length-1]!==p)&&i.push(c);}if(i.length>1){let m=t(i[0]),u=t(i[i.length-1]),c=l((m+u)/2);r.push({data:i,zoneIndex:c,zoneLow:s(c)});}return r}static splitByThreshold(a,e,t,n){let o=this.splitByBoundaries(a,[e],t,n),r={above:[],below:[]};for(let s of o)s.zoneIndex===0?r.below.push(s.data):r.above.push(s.data);return r}};var ue=class{static compute(a){let e=a.map(l=>l.value).filter(l=>l!==null).sort((l,i)=>l-i);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((l,i)=>l+i,0)/t,o=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,r=e.reduce((l,i)=>l+Math.pow(i-n,2),0)/t,s=Math.sqrt(r);return {min:e[0],max:e[t-1],avg:n,mean:n,median:o,stdDev:s,count:t}}static computeInRange(a,e,t){let n=a.filter(o=>o.time>=e&&o.time<=t);return this.compute(n)}};var ce={stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var ve={...ce};function C(){return ve}function ke(a){let e=a.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function we(a){let e=a.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function de(a,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,o=2){let r=n??ke(t),s=we(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
2
2
|
<pattern id="${a}" width="10" height="10" patternUnits="userSpaceOnUse">
|
|
3
3
|
<rect width="10" height="10" fill="${t}" />
|
|
4
4
|
</pattern>
|
|
5
|
-
`.trim();let l=12,i=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${
|
|
6
|
-
<line x1="0" y1="0" x2="0" y2="${i}" stroke="${
|
|
7
|
-
<line x1="0" y1="0" x2="${l}" y2="0" stroke="${
|
|
8
|
-
`;break;case "dots":l=12,i=12,u=`<circle cx="${l/2}" cy="${i/2}" r="${
|
|
9
|
-
<path d="M 0 ${i/2} Q ${l/4} 0, ${l/2} ${i/2} T ${l} ${i/2}" fill="none" stroke="${
|
|
10
|
-
`;break;case "dashed":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${
|
|
11
|
-
<path d="M 0 0 L ${l/2} ${i/2} L 0 ${i} M ${l} 0 L ${l/2} ${i/2} L ${l} ${i}" fill="none" stroke="${
|
|
5
|
+
`.trim();let l=12,i=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "dense-steep":l=6,i=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "crosshatch":l=14,i=14,m="rotate(45)",u=`
|
|
6
|
+
<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
|
|
7
|
+
<line x1="0" y1="0" x2="${l}" y2="0" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
|
|
8
|
+
`;break;case "dots":l=12,i=12,u=`<circle cx="${l/2}" cy="${i/2}" r="${o*1.2}" fill="${r}" />`;break;case "waves":l=16,i=16,u=`
|
|
9
|
+
<path d="M 0 ${i/2} Q ${l/4} 0, ${l/2} ${i/2} T ${l} ${i/2}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linecap="round" />
|
|
10
|
+
`;break;case "dashed":l=12,i=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,i=16,u=`
|
|
11
|
+
<path d="M 0 0 L ${l/2} ${i/2} L 0 ${i} M ${l} 0 L ${l/2} ${i/2} L ${l} ${i}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
|
|
12
12
|
`;break;case "brick":l=20,i=20,u=`
|
|
13
|
-
<path d="M 0 ${i/2} L ${l} ${i/2} M 0 ${i} L ${l} ${i} M ${l/2} 0 L ${l/2} ${i/2} M 0 ${i/2} L 0 ${i}" fill="none" stroke="${
|
|
13
|
+
<path d="M 0 ${i/2} L ${l} ${i/2} M 0 ${i} L ${l} ${i} M ${l/2} 0 L ${l/2} ${i/2} M 0 ${i/2} L 0 ${i}" fill="none" stroke="${r}" stroke-width="${o}" />
|
|
14
14
|
`;break;case "double-stripe":l=16,i=16,m="rotate(45)",u=`
|
|
15
|
-
<line x1="0" y1="0" x2="0" y2="${i}" stroke="${
|
|
16
|
-
<line x1="${l/2}" y1="0" x2="${l/2}" y2="${i}" stroke="${
|
|
15
|
+
<line x1="0" y1="0" x2="0" y2="${i}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
|
|
16
|
+
<line x1="${l/2}" y1="0" x2="${l/2}" y2="${i}" stroke="${r}" stroke-width="${o/2}" stroke-linecap="square" />
|
|
17
17
|
`;break;case "honeycomb":l=18,i=32,u=`
|
|
18
|
-
<path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${
|
|
18
|
+
<path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
|
|
19
19
|
`;break}let c=`<rect width="${l}" height="${i}" fill="${t}"${s} />`;return `
|
|
20
20
|
<pattern id="${a}" width="${l}" height="${i}" patternTransform="${m}" patternUnits="userSpaceOnUse">
|
|
21
21
|
${c}
|
|
22
22
|
${u}
|
|
23
23
|
</pattern>
|
|
24
|
-
`.trim()}var h=new Proxy({},{get:(a,e)=>T()[e],has:(a,e)=>e in T(),ownKeys:()=>Reflect.ownKeys(T()),getOwnPropertyDescriptor:(a,e)=>Reflect.getOwnPropertyDescriptor(T(),e)});function H(a){return {id:a.id,line:{stroke:a.stroke??h.stroke,strokeWidth:a.strokeWidth??h.strokeWidth,smoothing:a.smoothing??false,dashed:a.dashed??false},fill:a.fill??h.areaFillAlpha,markers:{type:a.pointStyle??"none",size:a.pointSize??h.pointSize,stroke:a.stroke??h.stroke,fill:"#ffffff"},shadow:{color:a.shadowColor??"transparent",blur:a.shadowBlur??0,offsetX:a.shadowOffsetX??0,offsetY:a.shadowOffsetY??0}}}function w(a,e,t){let n=[],r=a.reduce((s,l)=>s+l.data.length,0),o=H(t);for(let s=0;s<a.length;s++){let l=a[s];l.data.length>=2?n.push({type:"path",id:t.id?`${t.id}-line-${s}`:void 0,points:l.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})),stroke:l.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,dashed:o.line.dashed,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur,shadowOffsetX:o.shadow.offsetX,shadowOffsetY:o.shadow.offsetY,fill:"none"}):l.data.length===1&&r===1&&n.push({type:"circle",cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(o.markers.size,o.line.strokeWidth),fill:l.color??o.line.stroke,shadowColor:o.shadow.color,shadowBlur:o.shadow.blur});}return n}function pe(a){let e=[];for(let t of a)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function De(a){let e=[];for(let t of a)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function G(a,e,t){let n=[],r=H(t);for(let o=0;o<a.length;o++){let s=a[o];if(s.data.length<2)continue;let l=pe(s.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})));n.push({type:"path",id:t.id?`${t.id}-line-${o}`:void 0,points:l,stroke:s.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Me(a,e,t,n,r){let o=[],s=H(t);for(let l=0;l<a.length;l++){let i=a[l];if(i.data.length<2)continue;let m=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(r(c))})).reverse();o.push({type:"path",id:t.id?`${t.id}-fill-${l}`:void 0,points:[...m,...u],fill:i.color??s.fill,hatch:t.hatch,stroke:"none"});}return o}function N(a,e,t,n){if(a.length<2)return [];let r=S.splitByBoundaries(a,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<r.length;s++){let l=r[s];if(l.data.length<2)continue;let i=t.getColor(l.zoneIndex);if(!i)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();o.push({type:"path",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...m,...u],fill:i,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return o}function _e(a,e,t,n){let r=S.splitByThreshold(a,e,s=>s.value,S.interpolateDataPoint),o=[];return n.below&&o.push(...w(r.below.map(s=>({data:s})),t,n.below)),n.above&&o.push(...w(r.above.map(s=>({data:s})),t,n.above)),o}function W(a,e,t,n){let r=H(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let s=0;s<a.length;s++){let l=a[s],i=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,d=t.pointFill??u,p=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${s}`:void 0;Y(o,f,r.markers.type,i,m,r.markers.size,c,d,p);}return o}function Y(a,e,t,n,r,o,s,l,i){switch(t){case "circle":a.push({type:"circle",cx:n,cy:r,r:o,fill:l,stroke:s,strokeWidth:i,id:e});break;case "square":a.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:l,stroke:s,strokeWidth:i,id:e});break;case "cross":a.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:s,strokeWidth:i,id:e});break;case "diamond":a.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "triangle":a.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:r+c*Math.sin(d)});}a.push({type:"path",points:m,fill:l,stroke:s,strokeWidth:i,id:e});break}case "arrow":a.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:s,strokeWidth:i,fill:"none",id:e});break;case "plus":a.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:s,strokeWidth:i,id:e});break;case "triangle-down":a.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+o*Math.cos(c),y:r+o*Math.sin(c)});}a.push({type:"path",points:m,fill:l,stroke:s,strokeWidth:i,id:e});break}case "hourglass":a.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],fill:l,stroke:s,strokeWidth:i,id:e});break;case "line-horizontal":a.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:s,strokeWidth:i,id:e});break;default:a.push({type:"circle",cx:n,cy:r,r:o,fill:l,stroke:s,strokeWidth:i,id:e});}}var D=12,V=8,X=20,$e=11,Z=18,U=a=>a.length*$e*.6;function Fe(a,e="vertical"){if(e==="horizontal"){let n=0;for(let r of a)n+=D+V+U(r.name)+Z;return {width:Math.max(0,n-Z),height:X}}let t=0;for(let n of a)t=Math.max(t,U(n.name));return {width:D+V+t,height:a.length*X}}function Pe(a){let{items:e,x:t,y:n,orientation:r="vertical"}=a,o=[],s=t;return e.forEach((l,i)=>{let m=r==="horizontal"?s:t,u=r==="horizontal"?n:n+i*X;o.push({type:"rect",x:m,y:u,w:D,h:D,fill:l.color,stroke:h.legendStroke,strokeWidth:1},{type:"text",content:l.name,x:m+D+V,y:u+D-2,fontSize:h.legendFont,fill:h.legendText}),r==="horizontal"&&(s+=D+V+U(l.name)+Z);}),{type:"group",cssClass:"chart-legend",commands:o}}function We(a){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=h.gridStroke,strokeWidth:s=h.gridStrokeWidth,dashed:l=false,opacity:i=h.gridOpacity}=a,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:s,dashed:l,opacity:i});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:s,dashed:l,opacity:i});return m}var fe=new Map;function Ae(a,e){return `${a}|${JSON.stringify(e??{})}`}function A(a,e){let t=Ae(a,e),n=fe.get(t);return n||(n=new Intl.DateTimeFormat(a,e),fe.set(t,n)),n}var M=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,s]=this.#t;return r===n?o:o+(t-n)/(r-n)*(s-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},k=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],R=class{#e;#t;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US");}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),s=o-r;if(s<=0)return {interval:k[0].ms};let l=s/e,i=k[0].ms;for(let c of k)if(c.ms>=l){i=c.ms;break}let m=i,u=Math.round(s/m);for(;u>n&&m<k[k.length-1].ms;){let c=k.findIndex(d=>d.ms===m);m=k[Math.min(c+1,k.length-1)].ms,u=Math.round(s/m);}for(;u<t&&m>k[0].ms;){let c=k.findIndex(d=>d.ms===m);m=k[Math.max(c-1,0)].ms,u=Math.round(s/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,s]=this.#e.domain(),l=[],i=Math.ceil(o/r)*r;for(let m=i;m<=s;m+=r)l.push(m);return l}format(e,t){return A(this.#t,t).format(new Date(e))}},O=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let s=this.#r*2*Math.abs(r-n),l=Math.abs(r-n)-s,i=r>=n?1:-1,m=l/o;return n+this.#r*Math.abs(r-n)*i+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),s=Math.abs(e-o);s<n&&(n=s,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function Re(a){return a==="dotted"?{dash:"dotted"}:a==="dashed"?{dash:"dashed"}:{}}function Oe(a){let{thresholds:e,valueScale:t,xRange:n}=a,[r,o]=n,[s,l]=t.range(),i=Math.min(s,l),m=Math.max(s,l),u=[],c=[];for(let d of e){let p=d.color??h.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:r,y:i,w:o-r,h:Math.max(0,f-i),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:r,y:f,w:o-r,h:Math.max(0,m-f),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??h.thresholdLine;if(g!=="none"){let b=Re(g),y={type:"line",x1:r,y1:f,x2:o,y2:f,stroke:p,strokeWidth:1,...b,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(y.shadowColor=d.shadowColor,y.shadowBlur=d.shadowBlur??4,y.shadowOffsetX=d.shadowOffsetX??0,y.shadowOffsetY=d.shadowOffsetY??2),u.push(y);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let b=typeof d.label=="object"?d.label:void 0,y=typeof d.label=="string"?d.label:b?.text??d.name,x=b?.position??"right";c.push({...je(y,x,r,o,f,p,b),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Ie(a){let e=Oe(a);return [...e.inside,...e.labels]}function je(a,e,t,n,r,o,s){let l=(t+n)/2,i={type:"text",content:a,fontSize:h.thresholdFontSize,fill:o},m=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...i,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...i,...m,x:l,y:r-6,anchor:"middle"};case "below":return {...i,...m,x:l,y:r+14,anchor:"middle"};case "center":return {...i,...m,x:l,y:r-4,anchor:"middle"};case "outside-left":return {...i,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...i,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...i,...m,x:n-4,y:r-4,anchor:"end"}}}function Be(a){let{gaps:e,timeScale:t,yRange:n,fill:r=h.gapFill,hatch:o,fillOpacity:s=h.gapFillOpacity??.15,stroke:l=h.gapStroke,strokeWidth:i=h.gapStrokeWidth,dashed:m=true,fontSize:u=h.gapFontSize,fontFill:c=h.gapFontColor,labelBaseline:d="middle",labelRotate:p}=a,[f,g]=n,b=[];for(let y of e){let x=t.map(y.startTime),C=t.map(y.endTime),L=y.fill??r,P=y.hatch??o,me=y.fillOpacity??s,ue=y.label??"",ke=y.rotate??p,E=y.labelBaseline??d;if(y.style==="dashed_border"||!y.style?b.push({type:"rect",x,y:f,w:C-x,h:g-f,fill:L,hatch:P,opacity:me,stroke:l,strokeWidth:i,dashed:m}):y.style==="empty"&&b.push({type:"rect",x,y:f,w:C-x,h:g-f,fill:L,hatch:P,opacity:me}),ue){let ve=He(f,g,E),we=E==="above"?"top":E==="below"?"bottom":"middle";b.push({type:"text",content:ue,x:(x+C)/2,y:ve,anchor:"middle",fontSize:u,fill:c,textBaseline:we,rotate:ke});}}return b}function He(a,e,t){switch(t){case "above":return a-12;case "below":return e+4;default:return (a+e)/2}}function Ne(a){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=a,[o,s]=r,l=[];for(let i of e){let m=t.map(i.time),u=i.color??h.markerColor,c=i.pointStyle??(i.value!==void 0?"circle":"none"),d=i.lineStyle??"full";if(i.value!==void 0){let p=n.map(i.value);if(d==="to-value"?l.push({type:"line",x1:m,y1:s,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?l.push({type:"line",x1:m,y1:o,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&l.push({type:"line",x1:m,y1:o,x2:m,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&Y(l,void 0,c,m,p,h.markerSize,u,u,1.5),i.label){let f=d==="to-value"?p-10:o-6;l.push({type:"text",content:i.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else d!=="none"&&l.push({type:"line",x1:m,y1:o,x2:m,y2:s,stroke:u,strokeWidth:1}),i.label&&l.push({type:"text",content:i.label,x:m,y:o-6,anchor:"middle",fontSize:11,fill:u});}return l}function Ve(a){let{highlights:e,timeScale:t,yRange:n,height:r}=a,[o,s]=n,l=[];for(let i of e){let m=t.map(i.startTime),u=t.map(i.endTime);l.push({type:"rect",x:m,y:o,w:u-m,h:s-o,fill:i.color??h.highlightColor,opacity:i.opacity??h.highlightOpacity}),i.label&&l.push({type:"text",content:i.label,x:(m+u)/2,y:Ee(i.labelPosition??"top",o,s,r),anchor:"middle",fontSize:h.annotationFontSize,fill:i.color??h.highlightLabelColor,rotate:i.rotate});}return l}function Ee(a,e,t,n){switch(a){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function q(a){return a&&a.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function ze(a){let{annotations:e,timeScale:t,valueScales:n}=a,r=[],o=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],i=m=>l.push(m);switch(s.type){case "line":{let m=o(s.from),u=o(s.to);i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:s.color??h.annotationColor,strokeWidth:s.width??h.annotationWidth,dash:s.dash});break}case "arrow":{let m=o(s.from),u=o(s.to),c=s.color??h.annotationColor,d=s.headSize??h.annotationHead;i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:s.width??h.annotationWidth});let p=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/p,g=(u.y-m.y)/p,b=u.x-f*d,y=u.y-g*d;i({type:"path",points:[{x:u.x,y:u.y},{x:b-g*d*.5,y:y+f*d*.5},{x:b+g*d*.5,y:y-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=o(s.from),u=o(s.to);i({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:s.fill??"none",stroke:s.stroke,opacity:s.opacity});break}case "point":{let m=o(s.at),u=s.color??"#334155",c=s.radius??h.annotationRadius,d=s.shape??"circle";d==="circle"?i({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?i({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(i({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),i({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(s.at);i({type:"text",content:s.text,x:m.x+(s.dx??0),y:m.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:h.annotationFontSize,fill:s.color??h.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let m=q(s.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else r.push(...l);}return r}var K=class a{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new a({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var J=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
|
|
24
|
+
`.trim()}var h=new Proxy({},{get:(a,e)=>C()[e],has:(a,e)=>e in C(),ownKeys:()=>Reflect.ownKeys(C()),getOwnPropertyDescriptor:(a,e)=>Reflect.getOwnPropertyDescriptor(C(),e)});function B(a){return {id:a.id,line:{stroke:a.stroke??h.stroke,strokeWidth:a.strokeWidth??h.strokeWidth,smoothing:a.smoothing??false,dashed:a.dashed??false},fill:a.fill??h.areaFillAlpha,markers:{type:a.pointStyle??"none",size:a.pointSize??h.pointSize,stroke:a.stroke??h.stroke,fill:"#ffffff"},shadow:{color:a.shadowColor??"transparent",blur:a.shadowBlur??0,offsetX:a.shadowOffsetX??0,offsetY:a.shadowOffsetY??0}}}function w(a,e,t){let n=[],o=a.reduce((s,l)=>s+l.data.length,0),r=B(t);for(let s=0;s<a.length;s++){let l=a[s];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${s}`:void 0,points:l.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&o===1&&n.push({type:"circle",cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function he(a){let e=[];for(let t of a)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function Ce(a){let e=[];for(let t of a)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function z(a,e,t){let n=[],o=B(t);for(let r=0;r<a.length;r++){let s=a[r];if(s.data.length<2)continue;let l=he(s.data.map(i=>({x:e.timeScale.map(i.time),y:e.valueScale.map(i.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:l,stroke:s.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Te(a,e,t,n,o){let r=[],s=B(t);for(let l=0;l<a.length;l++){let i=a[l];if(i.data.length<2)continue;let m=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=i.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(o(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${l}`:void 0,points:[...m,...u],fill:i.color??s.fill,hatch:t.hatch,stroke:"none"});}return r}function H(a,e,t,n){if(a.length<2)return [];let o=x.splitByBoundaries(a,t.boundaries,t.getValue,t.interpolate),r=[];for(let s=0;s<o.length;s++){let l=o[s];if(l.data.length<2)continue;let i=t.getColor(l.zoneIndex);if(!i)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...m,...u],fill:i,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return r}function Le(a,e,t,n){let o=x.splitByThreshold(a,e,s=>s.value,x.interpolateDataPoint),r=[];return n.below&&r.push(...w(o.below.map(s=>({data:s})),t,n.below)),n.above&&r.push(...w(o.above.map(s=>({data:s})),t,n.above)),r}function $(a,e,t,n){let o=B(t);if(!o.markers.type||o.markers.type==="none")return [];let r=[];for(let s=0;s<a.length;s++){let l=a[s],i=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,d=t.pointFill??u,p=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${s}`:void 0;G(r,f,o.markers.type,i,m,o.markers.size,c,d,p);}return r}function G(a,e,t,n,o,r,s,l,i){switch(t){case "circle":a.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:i,id:e});break;case "square":a.push({type:"rect",x:n-r,y:o-r,w:r*2,h:r*2,fill:l,stroke:s,strokeWidth:i,id:e});break;case "cross":a.push({type:"line",x1:n-r,y1:o-r,x2:n+r,y2:o+r,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n-r,y1:o+r,x2:n+r,y2:o-r,stroke:s,strokeWidth:i,id:e});break;case "diamond":a.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o},{x:n,y:o+r},{x:n-r,y:o}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "triangle":a.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o+r},{x:n-r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?r:r*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:o+c*Math.sin(d)});}a.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break}case "arrow":a.push({type:"path",points:[{x:n-r,y:o+r},{x:n,y:o-r},{x:n+r,y:o+r}],stroke:s,strokeWidth:i,fill:"none",id:e});break;case "plus":a.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:i,id:e},{type:"line",x1:n,y1:o-r,x2:n,y2:o+r,stroke:s,strokeWidth:i,id:e});break;case "triangle-down":a.push({type:"path",points:[{x:n,y:o+r},{x:n+r,y:o-r},{x:n-r,y:o-r}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+r*Math.cos(c),y:o+r*Math.sin(c)});}a.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break}case "hourglass":a.push({type:"path",points:[{x:n-r,y:o-r},{x:n+r,y:o-r},{x:n-r,y:o+r},{x:n+r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:i,id:e});break;case "line-horizontal":a.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:i,id:e});break;default:a.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:i,id:e});}}var T=12,V=8,Z=20,De=11,Y=18,X=a=>a.length*De*.6;function Me(a,e="vertical"){if(e==="horizontal"){let n=0;for(let o of a)n+=T+V+X(o.name)+Y;return {width:Math.max(0,n-Y),height:Z}}let t=0;for(let n of a)t=Math.max(t,X(n.name));return {width:T+V+t,height:a.length*Z}}function _e(a){let{items:e,x:t,y:n,orientation:o="vertical"}=a,r=[],s=t;return e.forEach((l,i)=>{let m=o==="horizontal"?s:t,u=o==="horizontal"?n:n+i*Z;r.push({type:"rect",x:m,y:u,w:T,h:T,fill:l.color,stroke:h.legendStroke,strokeWidth:1},{type:"text",content:l.name,x:m+T+V,y:u+T-2,fontSize:h.legendFont,fill:h.legendText}),o==="horizontal"&&(s+=T+V+X(l.name)+Y);}),{type:"group",cssClass:"chart-legend",commands:r}}function $e(a){let{xTicks:e,yTicks:t,xRange:n,yRange:o,stroke:r=h.gridStroke,strokeWidth:s=h.gridStrokeWidth,dashed:l=false,opacity:i=h.gridOpacity}=a,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:r,strokeWidth:s,dashed:l,opacity:i});if(e)for(let u of e)m.push({type:"line",x1:u,y1:o[0],x2:u,y2:o[1],stroke:r,strokeWidth:s,dashed:l,opacity:i});return m}var pe=new Map;function Pe(a,e){return `${a}|${JSON.stringify(e??{})}`}function P(a,e){let t=Pe(a,e),n=pe.get(t);return n||(n=new Intl.DateTimeFormat(a,e),pe.set(t,n)),n}var L=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,o]=this.#e,[r,s]=this.#t;return o===n?r:r+(t-n)/(o-n)*(s-r)}invert(e){let[t,n]=this.#e,[o,r]=this.#t;return r===o?t:t+(e-o)/(r-o)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},v=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],R=class{#e;#t;#n;constructor(e){this.#e=new L({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[o,r]=this.#e.domain(),s=r-o;if(s<=0)return {interval:v[0].ms};let l=s/e,i=v[0].ms;for(let c of v)if(c.ms>=l){i=c.ms;break}let m=i,u=Math.round(s/m);for(;u>n&&m<v[v.length-1].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.min(c+1,v.length-1)].ms,u=Math.round(s/m);}for(;u<t&&m>v[0].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.max(c-1,0)].ms,u=Math.round(s/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:o}=this.tickInterval((t+n)/2,t,n),[r,s]=this.#e.domain(),l=[],i=Math.ceil(r/o)*o;for(let m=i;m<=s;m+=o)l.push(m);return l}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return P(this.#t,n).format(new Date(e))}},F=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let o=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-o)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,o]=this.#t,r=this.#e.length;if(r<=1)return (n+o)/2;let s=this.#r*2*Math.abs(o-n),l=Math.abs(o-n)-s,i=o>=n?1:-1,m=l/r;return n+this.#r*Math.abs(o-n)*i+t*m}invert(e){let t=0,n=1/0;for(let o=0;o<this.#e.length;o++){let r=this.map(this.#e[o]),s=Math.abs(e-r);s<n&&(n=s,t=o);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function Re(a){return a==="dotted"?{dash:"dotted"}:a==="dashed"?{dash:"dashed"}:{}}function Fe(a){let{thresholds:e,valueScale:t,xRange:n}=a,[o,r]=n,[s,l]=t.range(),i=Math.min(s,l),m=Math.max(s,l),u=[],c=[];for(let d of e){let p=d.color??h.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:o,y:i,w:r-o,h:Math.max(0,f-i),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:o,y:f,w:r-o,h:Math.max(0,m-f),fill:p,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??h.thresholdLine;if(g!=="none"){let y=Re(g),b={type:"line",x1:o,y1:f,x2:r,y2:f,stroke:p,strokeWidth:1,...y,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(b.shadowColor=d.shadowColor,b.shadowBlur=d.shadowBlur??4,b.shadowOffsetX=d.shadowOffsetX??0,b.shadowOffsetY=d.shadowOffsetY??2),u.push(b);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let y=typeof d.label=="object"?d.label:void 0,b=typeof d.label=="string"?d.label:y?.text??d.name,S=y?.position??"right";c.push({...We(b,S,o,r,f,p,y),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Ae(a){let e=Fe(a);return [...e.inside,...e.labels]}function We(a,e,t,n,o,r,s){let l=(t+n)/2,i={type:"text",content:a,fontSize:h.thresholdFontSize,fill:r},m=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...i,...m,x:t+4,y:o-4,anchor:"start"};case "above":return {...i,...m,x:l,y:o-6,anchor:"middle"};case "below":return {...i,...m,x:l,y:o+14,anchor:"middle"};case "center":return {...i,...m,x:l,y:o-4,anchor:"middle"};case "outside-left":return {...i,...m,x:t-6,y:o+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...i,...m,x:n+6,y:o+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...i,...m,x:n-4,y:o-4,anchor:"end"}}}function fe(a,e,t,n){switch(a){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function E(a){let{ranges:e,timeScale:t,yRange:n,height:o}=a,[r,s]=n,l=[];for(let i of e){let m=t.map(i.startTime),u=t.map(i.endTime);if(i.fill!==void 0&&l.push({type:"rect",x:m,y:r,w:u-m,h:s-r,fill:i.fill,hatch:i.hatch,opacity:i.opacity}),i.edges)for(let c of [m,u])l.push({type:"line",x1:c,y1:r,x2:c,y2:s,stroke:i.edges.stroke,strokeWidth:i.edges.strokeWidth,dash:"dashed"});i.label&&l.push({type:"text",content:i.label,x:(m+u)/2,y:fe(i.labelPosition??"middle",r,s,o),anchor:"middle",fontSize:i.fontSize,fill:i.labelColor,rotate:i.rotate});}return l}function je(a){let{gaps:e,timeScale:t,yRange:n,height:o,fill:r=h.gapFill,hatch:s,fillOpacity:l=h.gapFillOpacity??.15,stroke:i=h.gapStroke,strokeWidth:m=h.gapStrokeWidth,dashed:u=true,fontSize:c=h.gapFontSize,fontFill:d=h.gapFontColor,labelBaseline:p="middle",labelRotate:f}=a;return E({timeScale:t,yRange:n,height:o,ranges:e.map(g=>{let y=g.style??"dashed_border",b=y==="filled"||y==="dashed_border",S=y==="dashed_border"&&u!==false;return {startTime:g.startTime,endTime:g.endTime,...b&&{fill:g.fill??r,hatch:g.hatch??s,opacity:g.fillOpacity??l},...S&&{edges:{stroke:i,strokeWidth:m}},label:g.label,labelPosition:g.labelBaseline??p,labelColor:d,fontSize:c,rotate:g.rotate??f}})})}function Oe(a){let{markers:e,timeScale:t,valueScale:n,yRange:o=[0,300]}=a,[r,s]=o,l=[];for(let i of e){let m=t.map(i.time),u=i.color??h.markerColor,c=i.pointStyle??(i.value!==void 0?"circle":"none"),d=i.lineStyle??"full";if(i.value!==void 0){let p=n.map(i.value);if(d==="to-value"?l.push({type:"line",x1:m,y1:s,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?l.push({type:"line",x1:m,y1:r,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&G(l,void 0,c,m,p,h.markerSize,u,u,1.5),i.label){let f=d==="to-value"?p-10:r-6;l.push({type:"text",content:i.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else d!=="none"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),i.label&&l.push({type:"text",content:i.label,x:m,y:r-6,anchor:"middle",fontSize:11,fill:u});}return l}function Ie(a){let{highlights:e,timeScale:t,yRange:n,height:o}=a;return E({timeScale:t,yRange:n,height:o,ranges:e.map(r=>({startTime:r.startTime,endTime:r.endTime,fill:r.color??h.highlightColor,opacity:r.opacity??h.highlightOpacity,label:r.label,labelPosition:r.labelPosition??"top",labelColor:r.color??h.highlightLabelColor,fontSize:h.annotationFontSize,rotate:r.rotate}))})}function U(a){return a&&a.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Be(a){let{annotations:e,timeScale:t,valueScales:n}=a,o=[],r=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],i=m=>l.push(m);switch(s.type){case "line":{let m=r(s.from),u=r(s.to);i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:s.color??h.annotationColor,strokeWidth:s.width??h.annotationWidth,dash:s.dash});break}case "arrow":{let m=r(s.from),u=r(s.to),c=s.color??h.annotationColor,d=s.headSize??h.annotationHead;i({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:s.width??h.annotationWidth});let p=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/p,g=(u.y-m.y)/p,y=u.x-f*d,b=u.y-g*d;i({type:"path",points:[{x:u.x,y:u.y},{x:y-g*d*.5,y:b+f*d*.5},{x:y+g*d*.5,y:b-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=r(s.from),u=r(s.to);i({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let m=r(s.at),u=s.color??"#334155",c=s.radius??h.annotationRadius,d=s.shape??"circle";d==="circle"?i({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?i({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(i({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),i({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=r(s.at);i({type:"text",content:s.text,x:m.x+(s.dx??0),y:m.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:h.annotationFontSize,fill:s.color??h.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let m=U(s.id);o.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else o.push(...l);}return o}var q=class a{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new a({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var K=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
|
|
25
25
|
`);return `<clipPath id="${e}">
|
|
26
26
|
${t}
|
|
27
|
-
</clipPath>`}get regions(){return [...this.#e]}};var I={axisColor:h.axisColor,tickColor:h.tickColor,textColor:h.textColor,textSize:h.textSize},j=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.xRange,locale:e.locale}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??I).axisColor}get tickColor(){return (this.#t.colors??I).tickColor}get textColor(){return (this.#t.colors??I).textColor}get textSize(){return (this.#t.colors??I).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??I,n=this.#t.y??0,r=[],[o,s]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of e)r.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:l.label,x:l.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}};var B={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Ge(a){return Math.abs(a)>=1e6?`${(a/1e6).toFixed(1)}M`:Math.abs(a)>=1e3?`${(a/1e3).toFixed(1)}k`:Number.isInteger(a)?String(a):a.toFixed(1)}function Ye(a){let e=new Array(a.length).fill(false),t=0;for(;t<a.length;){let n=t;for(;n+1<a.length&&a[n+1].label===a[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var Q=class{#e;#t;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??B).axisColor}get tickColor(){return (this.#t.colors??B).tickColor}get textColor(){return (this.#t.colors??B).textColor}get textSize(){return (this.#t.colors??B).textSize}generateTicks(){let e=this.#t.format??Ge,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,r]=this.#e.domain(),o=Math.min(n,r),s=Math.max(n,r),l=s-o;if(l===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let i=l/t,m=Math.pow(10,Math.floor(Math.log10(i))),u=i/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],p=Math.ceil(o/c)*c;for(let f=p;f<=s;f+=c)d.push({value:f,position:this.#e.map(f),label:e(f)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??B,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,i=u=>s.some(c=>Math.abs(c-u)<=l),m=[];if(r==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Ye(e);e.forEach((p,f)=>{let g=i(p.position),b=d[f]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:p.position,x2:n,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n-8,y:p.position+4,anchor:"end",fontSize:11,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:p.position,x2:n+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n+8,y:p.position+4,anchor:"start",fontSize:11,fill:t.textColor,...b}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new O({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((s,l)=>{let i=Number(s),m=t?e[i]??String(i):String(i),u=this.#e.map(i),c=n?h.palette[l%h.palette.length]:void 0;return {value:i,label:m,y:u,color:c,isGap:o.has(i)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return h.palette[t%h.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:11,fill:r.color??h.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var v=class a{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++a.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var te=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??h.stroke,strokeWidth:e.strokeWidth??h.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??h.pointThreshold,r=e.gapThreshold??h.gapThreshold,o=e.id,s=S.getRuns(this.data,c=>c.value===null,r),l=s.reduce((c,d)=>c+d.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=s.map(c=>({data:c})),u=[];if(u.push(...w(m,i,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of s)u.push(...W(c,i,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),s=e.map(t[r].value);r===0?n.push({x:o,y:s}):n.push({x:o,y:n[n.length-1].y},{x:o,y:s});}return n}render(){let e=S.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return G(n,t,{stroke:this.#e.stroke??h.stroke,strokeWidth:this.#e.strokeWidth??h.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??h.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??h.bandAvgLine,s=e.bandWidth??10,l=[];for(let i of this.data){if(i.min===null||i.max===null)continue;let m=this.timeScale.map(i.time),u=e.valueScale.map(i.max),c=e.valueScale.map(i.min),d=s,p=this.data.indexOf(i);if(l.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(i.count),id:this.id?`${this.id}-slot-${p}`:void 0}),r&&i.avg!==null){let f=e.valueScale.map(i.avg);l.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return l}};var oe=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??h.minColor,n=e.maxColor??h.maxColor,r=e.avgColor??h.avgColor,o=e.avgDashed??true,s=e.smoothing??false,l=e.strokeWidth??h.strokeWidth,i=S.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(i.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];i.forEach((p,f)=>{p.length<2||(e.fillToMax&&u.push(...N(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:S.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...N(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:S.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=i.filter(p=>p.length>=2),d=p=>c.map(f=>({data:f.map(g=>({time:g.time,value:p(g)}))}));return u.push(...w(d(p=>p.max),m,{stroke:n,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...w(d(p=>p.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...w(d(p=>p.avg),m,{stroke:r,strokeWidth:l,smoothing:s,dashed:o,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends v{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??h.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??h.stroke,n={stroke:t,strokeWidth:e.strokeWidth??h.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize},r=e.gapThreshold??h.gapThreshold,o=e.pointThreshold??h.pointThreshold,s=S.getRuns(this.data,u=>u.value===null,r),l=s.reduce((u,c)=>u+c.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of s){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=S.splitByBoundaries(u,[f],y=>y.value,S.interpolateDataPoint),b=e.valueScale.map(f);for(let y=0;y<g.length;y++){let x=g[y];if(x.data.length<2)continue;let C=x.zoneIndex>0;if(e.fill.side==="above"===C){let L=x.data.map(P=>({x:this.timeScale.map(P.time),y:e.valueScale.map(P.value)}));m.push({type:"path",id:this.id?`${this.id}-fill-${y}`:void 0,points:[...L,{x:L[L.length-1].x,y:b},{x:L[0].x,y:b}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),p=S.splitByBoundaries(u,c,f=>f.value,S.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(p,i,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=o&&m.push(...W(u,i,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let b of this.#t)f.value>=b.value&&(g=b.color);return g}));}return m}};var Xe=1,ae=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:s,y:l,height:i}=this.#e,m=[];n&&m.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h:i,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(d<s[0]||c>s[1])continue;let p=Math.max(s[0],Math.min(s[1],c)),f=Math.max(s[0],Math.min(s[1],d)),g=Math.max(f-p,Xe);p+g>s[1]&&(p=Math.max(s[0],s[1]-g));let b=p+g/2;if(m.push({type:"rect",x:p,y:l,w:g,h:i,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let y=u.labelFontSize??10;m.push({type:"text",content:u.label,x:b,y:this.#t(u.labelBaseline,y),anchor:"middle",fontSize:y,fill:u.labelFill??"#333"});}}if(o){let u=new j({domain:t.domain(),xRange:s,y:l+i+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:s=true,showMedian:l=false,labelPosition:i="end",lineColor:m=h.statsLineColor,labelColor:u=h.statsLabelColor}=this.#e,c=ce.compute(e),d=[{name:"min",value:c.min,enabled:r},{name:"max",value:c.max,enabled:o},{name:"avg",value:c.avg,enabled:s},{name:"median",value:c.median,enabled:l}],p=[],[f,g]=n;for(let b of d.filter(y=>y.enabled)){let y=t.map(b.value);p.push({type:"line",x1:f,y1:y,x2:g,y2:y,stroke:m,strokeWidth:1});let x=`${b.name}: ${b.value.toFixed(1)}`;(i==="start"||i==="both")&&p.push({type:"text",content:x,x:f+4,y:y-4,anchor:"start",fontSize:10,fill:u}),(i==="end"||i==="both")&&p.push({type:"text",content:x,x:g-4,y:y-4,anchor:"end",fontSize:10,fill:u}),i==="center"&&p.push({type:"text",content:x,x:(f+g)/2,y:y-4,anchor:"middle",fontSize:10,fill:u});}return p}};var _=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return A(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return A(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,s=36e5,l=6e4,i={};return r<l?(i.second="2-digit",i.minute="2-digit",i.hour="2-digit"):r<s?(i.minute="2-digit",i.hour="2-digit"):r<o?(i.hour="2-digit",i.minute="2-digit"):r<7*o?(i.weekday="short",i.day="numeric"):r<365*o?(i.month="short",i.day="numeric"):(i.month="short",i.year="numeric"),{...n,...i}}};var $=class a{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new a({unit:e,decimals:t})}static temperature(e="\xB0C"){return new a({unit:e,decimals:1})}static percentage(){return new a({unit:"%",decimals:0})}};var F=class a{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new a({map:n,showValue:t})}};var Ze={time:new _,value:new $,enum:new F};function le(a,e){let t=T();return {color:a.color??t.stroke,width:a.width??t.strokeWidth,style:a.style??"solid",smoothing:a.smoothing??false,shape:a.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:a.gapThreshold??t.gapThreshold,opacity:a.opacity??1}}function ge(a){let e=a.style?.line;return e===false?[]:e===void 0?[le({},a)]:Array.isArray(e)?e.map(t=>le(t,a)):[le(e,a)]}function ye(a){let e=a.style?.markers;if(!e?.type||e.type==="none")return;let t=T(),r=(a.style?.line&&!Array.isArray(a.style.line)?a.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function be(a){let e=a.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function xe(a){return a.style?.gap}function Se(a){return a.style?.fill}function Ue(a){return {lines:ge(a),fill:Se(a),markers:ye(a),shadow:be(a),gap:xe(a),id:a.style?.id??a.id}}/*!
|
|
27
|
+
</clipPath>`}get regions(){return [...this.#e]}};var A={axisColor:h.axisColor,tickColor:h.tickColor,textColor:h.textColor,textSize:h.textSize},W=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??A).axisColor}get tickColor(){return (this.#t.colors??A).tickColor}get textColor(){return (this.#t.colors??A).textColor}get textSize(){return (this.#t.colors??A).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,o=this.#e.ticks({minTicks:e,maxTicks:t}).map(r=>({time:r,x:this.#e.map(r),label:this.tickLabel(r)}));return this.antiOverlap(o)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:o}=this.#e.tickInterval((t+n)/2,t,n),r={};return o<6e4?(r.hour="2-digit",r.minute="2-digit",r.second="2-digit"):o<36e5||o<864e5?(r.hour="2-digit",r.minute="2-digit"):o<31536e6?(r.day="numeric",r.month="short",o>=2592e6&&(r.day=void 0,r.month="long")):(r.year="numeric",o<2*31536e6&&(r.month="short")),this.#e.format(e,r)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let o=1;o<e.length;o++){let r=n[n.length-1].x;Math.abs(e[o].x-r)>=t&&n.push(e[o]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??A,n=this.#t.y??0,o=[],[r,s]=this.#e.range();o.push({type:"line",x1:r,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of e)o.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),o.push({type:"text",content:l.label,x:l.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return o}};var j={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function He(a){return Math.abs(a)>=1e6?`${(a/1e6).toFixed(1)}M`:Math.abs(a)>=1e3?`${(a/1e3).toFixed(1)}k`:Number.isInteger(a)?String(a):a.toFixed(1)}function Ve(a){let e=new Array(a.length).fill(false),t=0;for(;t<a.length;){let n=t;for(;n+1<a.length&&a[n+1].label===a[t].label;)n++;for(let o=t+1;o<n;o++)e[o]=true;t=n+1;}return e}var J=class{#e;#t;constructor(e){this.#e=new L({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??j).axisColor}get tickColor(){return (this.#t.colors??j).tickColor}get textColor(){return (this.#t.colors??j).textColor}get textSize(){return (this.#t.colors??j).textSize}generateTicks(){let e=this.#t.format??He,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,o]=this.#e.domain(),r=Math.min(n,o),s=Math.max(n,o),l=s-r;if(l===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let i=l/t,m=Math.pow(10,Math.floor(Math.log10(i))),u=i/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],p=Math.ceil(r/c)*c;for(let f=p;f<=s;f+=c)d.push({value:f,position:this.#e.map(f),label:e(f)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??j,n=this.#t.x??0,o=this.#t.orientation??"vertical",r=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,i=u=>s.some(c=>Math.abs(c-u)<=l),m=[];if(o==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Ve(e);e.forEach((p,f)=>{let g=i(p.position),y=d[f]?{opacity:0}:{};r==="left"?(m.push({type:"line",x1:n-4,y1:p.position,x2:n,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n-8,y:p.position+4,anchor:"end",fontSize:11,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:p.position,x2:n+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:p.label,x:n+8,y:p.position+4,anchor:"start",fontSize:11,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var Q=class a{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(r=>r.value!==null).sort((r,s)=>r.time-s.time),o=[];for(let r=0;r<n.length;r++){let s=Math.max(0,r-t+1),l=n.slice(s,r+1),i=l.reduce((m,u)=>m+u.value,0)/l.length;o.push({time:n[r].time,value:i});}return o}static exponential(e,t){let n=[...e].filter(l=>l.value!==null).sort((l,i)=>l.time-i.time);if(n.length===0)return [];let o=2/(t+1),r=[],s=n[0].value;r.push({time:n[0].time,value:s});for(let l=1;l<n.length;l++)s=n[l].value*o+s*(1-o),r.push({time:n[l].time,value:s});return r}points(){return (this.#n==="exponential"?a.exponential(this.#e,this.#t):a.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,o)=>n-o).map(String);this.#t=t,this.#e=new F({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:o}=this.#n,r=new Set(o??[]);return this.#t.map((s,l)=>{let i=Number(s),m=t?e[i]??String(i):String(i),u=this.#e.map(i),c=n?h.palette[l%h.palette.length]:void 0;return {value:i,label:m,y:u,color:c,isGap:r.has(i)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return h.palette[t%h.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let o of e)o.isGap||n.push({type:"text",content:o.label,x:t,y:o.y+4,anchor:"end",fontSize:11,fill:o.color??h.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var k=class a{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++a.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var te=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??h.stroke,strokeWidth:e.strokeWidth??h.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??h.pointThreshold,o=e.gapThreshold??h.gapThreshold,r=e.id,s=x.getRuns(this.data,c=>c.value===null,o),l=s.reduce((c,d)=>c+d.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=s.map(c=>({data:c})),u=[];if(u.push(...w(m,i,{...t,id:r?`${r}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of s)u.push(...$(c,i,{...t,id:r?`${r}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(o=>o.value!==null).sort((o,r)=>o.time-r.time),n=[];for(let o=0;o<t.length;o++){let r=this.timeScale.map(t[o].time),s=e.map(t[o].value);o===0?n.push({x:r,y:s}):n.push({x:r,y:n[n.length-1].y},{x:r,y:s});}return n}render(){let e=x.getRuns(this.data,o=>o.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(o=>({data:o}));return z(n,t,{stroke:this.#e.stroke??h.stroke,strokeWidth:this.#e.strokeWidth??h.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??h.bandFill,n=e.hatch,o=e.avgLine??false,r=e.avgLineColor??h.bandAvgLine,s=e.bandWidth??10,l=[];for(let i of this.data){if(i.min===null||i.max===null)continue;let m=this.timeScale.map(i.time),u=e.valueScale.map(i.max),c=e.valueScale.map(i.min),d=s,p=this.data.indexOf(i);if(l.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(i.count),id:this.id?`${this.id}-slot-${p}`:void 0}),o&&i.avg!==null){let f=e.valueScale.map(i.avg);l.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:r,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return l}};var oe=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??h.minColor,n=e.maxColor??h.maxColor,o=e.avgColor??h.avgColor,r=e.avgDashed??true,s=e.smoothing??false,l=e.strokeWidth??h.strokeWidth,i=x.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(i.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];i.forEach((p,f)=>{p.length<2||(e.fillToMax&&u.push(...H(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...H(p,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=i.filter(p=>p.length>=2),d=p=>c.map(f=>({data:f.map(g=>({time:g.time,value:p(g)}))}));return u.push(...w(d(p=>p.max),m,{stroke:n,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...w(d(p=>p.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...w(d(p=>p.avg),m,{stroke:o,strokeWidth:l,smoothing:s,dashed:r,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends k{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??h.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??h.stroke,n={stroke:t,strokeWidth:e.strokeWidth??h.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??h.pointSize},o=e.gapThreshold??h.gapThreshold,r=e.pointThreshold??h.pointThreshold,s=x.getRuns(this.data,u=>u.value===null,o),l=s.reduce((u,c)=>u+c.length,0);if(l===0)return [];let i={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of s){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=x.splitByBoundaries(u,[f],b=>b.value,x.interpolateDataPoint),y=e.valueScale.map(f);for(let b=0;b<g.length;b++){let S=g[b];if(S.data.length<2)continue;let O=S.zoneIndex>0;if(e.fill.side==="above"===O){let I=S.data.map(me=>({x:this.timeScale.map(me.time),y:e.valueScale.map(me.value)}));m.push({type:"path",cssClass:"series-fill",id:this.id?`${this.id}-fill-${b}`:void 0,points:[...I,{x:I[I.length-1].x,y},{x:I[0].x,y}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),p=x.splitByBoundaries(u,c,f=>f.value,x.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(p,i,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=r&&m.push(...$(u,i,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let y of this.#t)f.value>=y.value&&(g=y.color);return g}));}return m}};var Ee=1,ae=class{#e;constructor(e,t,n,o){this.#e={...e,xRange:t,y:n,height:o};}render(){let{items:e,timeScale:t,background:n,hatch:o,showAxis:r,xRange:s,y:l,height:i}=this.#e,m=[];n&&m.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h:i,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(d<s[0]||c>s[1])continue;let p=Math.max(s[0],Math.min(s[1],c)),f=Math.max(s[0],Math.min(s[1],d)),g=Math.max(f-p,Ee);p+g>s[1]&&(p=Math.max(s[0],s[1]-g));let y=p+g/2;if(m.push({type:"rect",x:p,y:l,w:g,h:i,hatch:u.hatch??o,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(r){let u=new W({domain:t.domain(),xRange:s,y:l+i+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:o}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+o-t*.25;default:return n+o/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:o=false,showMax:r=false,showAvg:s=true,showMedian:l=false,labelPosition:i="end",lineColor:m=h.statsLineColor,labelColor:u=h.statsLabelColor}=this.#e,c=ue.compute(e),d=[{name:"min",value:c.min,enabled:o},{name:"max",value:c.max,enabled:r},{name:"avg",value:c.avg,enabled:s},{name:"median",value:c.median,enabled:l}],p=[],[f,g]=n;for(let y of d.filter(b=>b.enabled)){let b=t.map(y.value);p.push({type:"line",x1:f,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let S=`${y.name}: ${y.value.toFixed(1)}`;(i==="start"||i==="both")&&p.push({type:"text",content:S,x:f+4,y:b-4,anchor:"start",fontSize:10,fill:u}),(i==="end"||i==="both")&&p.push({type:"text",content:S,x:g-4,y:b-4,anchor:"end",fontSize:10,fill:u}),i==="center"&&p.push({type:"text",content:S,x:(f+g)/2,y:b-4,anchor:"middle",fontSize:10,fill:u});}return p}};var D=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let o=this.#n&&n?this.#r(e,n,t):t;return P(this.#e,o).format(new Date(e))}catch{for(let o of this.#t)try{return P(o,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),o=this.format(t);return `${n} \u2014 ${o}`}#r(e,t,n){let o=Math.abs(e-t),r=864e5,s=36e5,l=6e4,i={};return o<l?(i.second="2-digit",i.minute="2-digit",i.hour="2-digit"):o<s?(i.minute="2-digit",i.hour="2-digit"):o<r?(i.hour="2-digit",i.minute="2-digit"):o<7*r?(i.weekday="short",i.day="numeric"):o<365*r?(i.month="short",i.day="numeric"):(i.month="short",i.year="numeric"),{...n,...i}}};var M=class a{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new a({unit:e,decimals:t})}static temperature(e="\xB0C"){return new a({unit:e,decimals:1})}static percentage(){return new a({unit:"%",decimals:0})}};var _=class a{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((o,r)=>{n[r]=o;}),new a({map:n,showValue:t})}};var Ne={time:new D,value:new M,enum:new _};function le(a,e){let t=C();return {color:a.color??t.stroke,width:a.width??t.strokeWidth,style:a.style??"solid",smoothing:a.smoothing??false,shape:a.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:a.gapThreshold??t.gapThreshold,opacity:a.opacity??1}}function ge(a){let e=a.style?.line;return e===false?[]:e===void 0?[le({},a)]:Array.isArray(e)?e.map(t=>le(t,a)):[le(e,a)]}function ye(a){let e=a.style?.markers;if(!e?.type||e.type==="none")return;let t=C(),o=(a.style?.line&&!Array.isArray(a.style.line)?a.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??o,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function be(a){let e=a.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function xe(a){return a.style?.gap}function Se(a){return a.style?.fill}function ze(a){return {lines:ge(a),fill:Se(a),markers:ye(a),shadow:be(a),gap:xe(a),id:a.style?.id??a.id}}/*!
|
|
28
28
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
29
29
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
30
30
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
@@ -43,4 +43,4 @@ var z=class{};var S=class{static interpolateDataPoint(a,e,t){return {time:a.time
|
|
|
43
43
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
44
44
|
* MIT with Attribution: free use incl. commercial must have visible credit to
|
|
45
45
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
46
|
-
*/export{ae as AnnotationBandSeries,
|
|
46
|
+
*/export{ae as AnnotationBandSeries,F as BandScale,re as BandSeries,K as Clip,ee as EnumAxis,_ as EnumFormatter,Ne as Formatters,q as Layout,te as LineSeries,L as LinearScale,oe as MinMaxAvgSeries,Q as MovingAvg,N as Renderer,se as StatsOverlay,ne as StepSeries,v as TIME_INTERVALS,W as TimeAxis,D as TimeFormatter,R as TimeScale,J as ValueAxis,M as ValueFormatter,ie as ZonedLineSeries,de as getHatch,Me as measureLegend,Be as renderAnnotations,Te as renderArea,je as renderGaps,$e as renderGrid,Ie as renderHighlights,_e as renderLegend,w as renderLine,Oe as renderMarkers,$ as renderSeriesMarkers,Le as renderSplitLine,z as renderStep,Ae as renderThresholds,H as renderZonedArea,Se as resolveFill,xe as resolveGap,ge as resolveLines,ye as resolveMarkers,ze as resolveSeriesStyle,be as resolveShadow,U as slugify,h as theme,Ce as toStepData,he as toStepPoints};
|
|
@@ -81,6 +81,17 @@ type Dashstyle_t = LineVariant;
|
|
|
81
81
|
interface DrawPath extends DrawEffects {
|
|
82
82
|
type: "path";
|
|
83
83
|
points: Point[];
|
|
84
|
+
/**
|
|
85
|
+
* CSS-Klasse am Pfad — `series-line` oder `series-fill`.
|
|
86
|
+
*
|
|
87
|
+
* Bisher trugen nur Gruppen eine Klasse; ein Pfad hatte allein seine id. Die
|
|
88
|
+
* gilt aber pro DOKUMENT: Zwei Diagramme auf einer Seite ergeben denselben
|
|
89
|
+
* Serienschluessel und damit dieselbe id, und `getElementById` trifft das
|
|
90
|
+
* erste. Mit der Klasse laesst sich im Container suchen statt im Dokument
|
|
91
|
+
* (`#chart-2 .series--temperatur .series-line`) — und im Gegensatz zum
|
|
92
|
+
* crc32 in der id kann ein Aufrufer sie hinschreiben.
|
|
93
|
+
*/
|
|
94
|
+
cssClass?: string;
|
|
84
95
|
smoothing?: boolean;
|
|
85
96
|
/**
|
|
86
97
|
* When `smoothing` is enabled, only apply the Catmull-Rom spline to the
|
|
@@ -91,6 +102,15 @@ interface DrawPath extends DrawEffects {
|
|
|
91
102
|
* Unset (or ≥ points.length) keeps the current behaviour: smooth all.
|
|
92
103
|
*/
|
|
93
104
|
smoothCount?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Schliesst den Streckenzug zum Anfangspunkt (`Z` im SVG).
|
|
107
|
+
*
|
|
108
|
+
* Fuer eine FLAECHE aendert das nichts -- SVG schliesst sie von selbst.
|
|
109
|
+
* Fuer den STRICH aendert es alles: Ohne `Z` fehlt die letzte Kante, und
|
|
110
|
+
* eine Raute, ein Dreieck oder ein Stern steht mit einer offenen Seite da.
|
|
111
|
+
* Genau so sahen die Marker seit ihrer Einfuehrung aus.
|
|
112
|
+
*/
|
|
113
|
+
closed?: boolean;
|
|
94
114
|
stroke?: string;
|
|
95
115
|
strokeWidth?: number;
|
|
96
116
|
fill?: string;
|
|
@@ -180,7 +200,7 @@ interface DrawGradient {
|
|
|
180
200
|
stops: GradientStop[];
|
|
181
201
|
direction: DrawDirection_t;
|
|
182
202
|
}
|
|
183
|
-
type DrawGapType_t$1 = "dashed_border" | "empty" | "label";
|
|
203
|
+
type DrawGapType_t$1 = "dashed_border" | "empty" | "filled" | "label";
|
|
184
204
|
interface DrawGap {
|
|
185
205
|
type: "gap";
|
|
186
206
|
x1: number;
|
|
@@ -237,7 +257,7 @@ type AxisPosition = "left" | "right";
|
|
|
237
257
|
/** Text anchor alignment. */
|
|
238
258
|
type LabelAnchor = "start" | "middle" | "end";
|
|
239
259
|
/** Gap rendering style. */
|
|
240
|
-
type DrawGapType_t = "dashed_border" | "empty" | "label";
|
|
260
|
+
type DrawGapType_t = "dashed_border" | "empty" | "filled" | "label";
|
|
241
261
|
|
|
242
262
|
/*!
|
|
243
263
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -281,6 +301,18 @@ type FillBound = "series" | "chartTop" | "chartBottom" | {
|
|
|
281
301
|
threshold: string;
|
|
282
302
|
} | {
|
|
283
303
|
value: number;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Eine ANDERE Messreihe, benannt ueber ihre `id` oder, ohne die, ihren
|
|
307
|
+
* `name`. Damit laesst sich zwischen zwei Kurven fuellen -- ein
|
|
308
|
+
* Toleranzkorridor, Soll gegen Ist, zwei Sensoren im Vergleich.
|
|
309
|
+
*
|
|
310
|
+
* Die fremde Kurve wird auf die Zeitpunkte DIESER Reihe interpoliert; wo sie
|
|
311
|
+
* keinen Wert hat -- eine Luecke, oder ausserhalb ihres Zeitraums --, bricht
|
|
312
|
+
* die Flaeche ab, genau wie eine Linie an einer Luecke abbricht.
|
|
313
|
+
*/
|
|
314
|
+
| {
|
|
315
|
+
series: string;
|
|
284
316
|
};
|
|
285
317
|
/**
|
|
286
318
|
* A fill region. `from` and `to` define the Y interval; the X range is always
|
|
@@ -323,7 +355,14 @@ type FillSpec = FillStyle | {
|
|
|
323
355
|
|
|
324
356
|
/** Label placement / styling inside a gap region. */
|
|
325
357
|
interface GapLabel {
|
|
326
|
-
|
|
358
|
+
/**
|
|
359
|
+
* Where the label sits (default `'middle'`). The same five values a
|
|
360
|
+
* highlight's `labelPosition` takes, placed by the same rule:
|
|
361
|
+
* `'top'` | `'center'` (= `'middle'`) | `'bottom'` sit inside the plot area,
|
|
362
|
+
* `'above'` | `'below'` sit in the margin around it and never cover data —
|
|
363
|
+
* but they need `margin.top` / `margin.bottom` to have somewhere to go.
|
|
364
|
+
*/
|
|
365
|
+
baseline?: "top" | "center" | "middle" | "bottom" | "above" | "below";
|
|
327
366
|
rotate?: number;
|
|
328
367
|
color?: string;
|
|
329
368
|
fontSize?: number;
|
|
@@ -331,17 +370,33 @@ interface GapLabel {
|
|
|
331
370
|
/** Visual styling of a gap region. */
|
|
332
371
|
interface GapStyle {
|
|
333
372
|
/**
|
|
334
|
-
* - `'
|
|
335
|
-
* - `'dashed_border'` —
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
373
|
+
* - `'filled'` — the area in the fill colour, no edges.
|
|
374
|
+
* - `'dashed_border'` — the area **plus** two vertical dashed lines at its
|
|
375
|
+
* borders (the default). Not a frame: the top and
|
|
376
|
+
* bottom of a gap lie on the edge of the plot area,
|
|
377
|
+
* where they say nothing and sit on the axis. Only the
|
|
378
|
+
* vertical edges carry information — there the
|
|
379
|
+
* readings stop, and there they start again.
|
|
380
|
+
* - `'empty'` — nothing. The line breaks, that is all.
|
|
381
|
+
* - `'bridge_line'` — a dotted line between the last point before the gap
|
|
382
|
+
* and the first one after. Per-series only: a
|
|
383
|
+
* chart-wide region has no readings to span.
|
|
384
|
+
*
|
|
385
|
+
* These mean the same here and in `gaps.regions[].style`. Until 1.8.0 they
|
|
386
|
+
* did not: chart-wide, `'empty'` drew a filled area, and per-series,
|
|
387
|
+
* `'filled'` drew an *empty* rectangle with a frame.
|
|
341
388
|
*/
|
|
342
389
|
display?: "empty" | "dashed_border" | "filled" | "bridge_line";
|
|
343
390
|
fill?: FillStyle;
|
|
344
391
|
opacity?: number;
|
|
392
|
+
/**
|
|
393
|
+
* How the gap's label is set — alignment, rotation, colour, size.
|
|
394
|
+
*
|
|
395
|
+
* **Not the text.** A label needs something to say, and that comes from
|
|
396
|
+
* `gaps.regions[].label`: a region knows which gap it describes, a series
|
|
397
|
+
* style does not. So on a per-series gap this block currently has nothing
|
|
398
|
+
* to align — it takes effect only for gaps that carry a text.
|
|
399
|
+
*/
|
|
345
400
|
label?: GapLabel;
|
|
346
401
|
/** Optional bridge-line style; only used when `display: 'bridge_line'`. */
|
|
347
402
|
bridge?: {
|
|
@@ -602,7 +657,8 @@ interface Gap {
|
|
|
602
657
|
/** Hatch pattern for gap fill */
|
|
603
658
|
hatch?: HatchVariant;
|
|
604
659
|
fillOpacity?: number;
|
|
605
|
-
|
|
660
|
+
/** Same five values as a highlight's `labelPosition` — see `core/range_label.ts`. */
|
|
661
|
+
labelBaseline?: "top" | "center" | "middle" | "bottom" | "above" | "below";
|
|
606
662
|
rotate?: number;
|
|
607
663
|
style?: DrawGapType_t$1;
|
|
608
664
|
}
|
|
@@ -844,6 +900,8 @@ interface TimeScaleConfig {
|
|
|
844
900
|
range: [number, number];
|
|
845
901
|
/** Locale for i18n formatting (default: 'en-US') */
|
|
846
902
|
locale?: string;
|
|
903
|
+
/** IANA-Zone fuer die Beschriftung; ohne sie die Zone der Maschine. */
|
|
904
|
+
timeZone?: string;
|
|
847
905
|
}
|
|
848
906
|
/** Maps timestamps (ms) to pixel coordinates with automatic tick interval selection. */
|
|
849
907
|
declare class TimeScale implements Scale {
|
|
@@ -853,6 +911,7 @@ declare class TimeScale implements Scale {
|
|
|
853
911
|
invert(pixel: number): number;
|
|
854
912
|
domain(): [number, number];
|
|
855
913
|
range(): [number, number];
|
|
914
|
+
get timeZone(): string | undefined;
|
|
856
915
|
get locale(): string;
|
|
857
916
|
/**
|
|
858
917
|
* Pick the "nicest" time interval that yields roughly `targetTicks` ticks
|
|
@@ -897,4 +956,4 @@ declare class BandScale implements Scale {
|
|
|
897
956
|
positions(): Map<string, number>;
|
|
898
957
|
}
|
|
899
958
|
|
|
900
|
-
export { type DomainScaleConfig as $, type AnySeries as A, type SVGLineStyle as B, type SensorType as C, type DrawCommand as D, type EnumMap as E, type FillSpec as F, type Gap as G, type Highlight as H, type SeriesOverlay as I, type SeriesOverlayKind as J, type SeriesType as K, type LineVariant as L, type MarkerStyle as M, type ShadowStyle as N, type ThresholdLabelConfig as O, type PointStyleType as P, getLineStyle as Q, resolveDash as R, type SeriesStyle as S, type Threshold as T,
|
|
959
|
+
export { type DomainScaleConfig as $, type AnySeries as A, type SVGLineStyle as B, type SensorType as C, type DrawCommand as D, type EnumMap as E, type FillSpec as F, type Gap as G, type Highlight as H, type SeriesOverlay as I, type SeriesOverlayKind as J, type SeriesType as K, type LineVariant as L, type MarkerStyle as M, type ShadowStyle as N, type ThresholdLabelConfig as O, type PointStyleType as P, getLineStyle as Q, resolveDash as R, type SeriesStyle as S, type Threshold as T, type Point as U, BandScale as V, type AxisOrientation as W, type AxisPosition as X, type BandScaleConfig as Y, type CircleParams as Z, type Dashstyle_t as _, type GapsConfig as a, type DrawCircle as a0, type DrawGap as a1, type DrawGapType_t as a2, type DrawGradient as a3, type DrawGroup as a4, type DrawLine as a5, type DrawPath as a6, type DrawRect as a7, type DrawText as a8, type LabelAnchor as a9, type LineParams as aa, type LinearScaleConfig as ab, type PathParams as ac, type RectParams as ad, type Scale as ae, type ScaleConfig as af, TIME_INTERVALS as ag, type TextParams as ah, type TimeScaleConfig as ai, getHatch as aj, type Annotation as b, type AnnotationBandConfig as c, TimeScale as d, LinearScale as e, type TimeSeries as f, type HatchVariant as g, type ThresholdLabelPosition as h, type AnnotationBandItem as i, type AggregatedPoint as j, type AggregatedSeries as k, type DataPoint as l, type AggregationConfig as m, type AggregationMode as n, type DataPointRef as o, type FillBound as p, type FillDirectionType as q, type FillRegion as r, type FillSide as s, type FillStyle as t, type GapConfig as u, type GapLabel as v, type GapRegion as w, type GapStyle as x, type LineDashStyle as y, type LineStyle as z };
|