ml-time-graph 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.de.md +5 -0
- package/README.md +4 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -15
- package/dist/interaction/index.js +2 -2
- package/dist/internals.d.ts +16 -4
- package/dist/internals.js +4 -4
- package/dist/{marker_renderer-Dph9cKDY.d.ts → marker_renderer-DYSAkVgI.d.ts} +29 -1
- package/dist/{types-B9bbJxmn.d.ts → types-RAg4hLZA.d.ts} +32 -3
- package/options.schema.json +15 -0
- package/package.json +1 -1
- package/skills/ml-time-graph/SKILL.md +2 -1
- package/skills/ml-time-graph/reference/axes.md +35 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var v=class{_config;_state;constructor(
|
|
1
|
+
var v=class{_config;_state;constructor(e,n){this._config={enabled:n?.enabled??true,zoomSpeed:n?.zoomSpeed??.1,minDomainMs:n?.minDomainMs??0,maxDomainMs:n?.maxDomainMs??365*24*60*60*1e3},this._state={domain:[...e],originalDomain:[...e],scale:1,offset:0};}get state(){return {...this._state,domain:[...this._state.domain]}}applyZoom(e,n,r){if(!this._config.enabled)return;let i=1+Math.sign(n)*this._config.zoomSpeed;if(i<=0)return;let[o,a]=this._state.domain,d=a-o,s=e/r,t=d/i,l=this._config.minDomainMs??0,m=this._config.maxDomainMs??1/0;t<l&&(t=l),t>m&&(t=m);let b=o+d*s,u=b-t*s,c=b+t*(1-s),[p,_]=this._state.originalDomain;c-u>_-p?(u=p,c=_,t=_-p):(u<p&&(c=_-(_-p)*((c-u)/(_-p)),u=p),c>_&&(u=p+(_-p)*((u-p)/(_-p)),c=_)),this._state.domain=[u,c],this._state.scale=(a-o)/t;}applyPan(e,n){if(!this._config.enabled)return;let[r,i]=this._state.domain,o=i-r,[a,d]=this._state.originalDomain,s=-(e/n)*o,t=r+s,l=i+s;t<a&&(s-=t-a),l>d&&(s-=l-d),this._state.domain=[r+s,i+s];}reset(){this._state.domain=[...this._state.originalDomain],this._state.scale=1,this._state.offset=0;}get enabled(){return this._config.enabled??true}};var D=new Map;function L(h,e){return `${h}|${JSON.stringify(e??{})}`}function k(h,e){let n=L(h,e),r=D.get(n);return r||(r=new Intl.DateTimeFormat(h,e),D.set(n,r)),r}function M(){return typeof navigator<"u"?navigator.language:void 0}var y=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}zeichenwert(e){return e}wert(e){return e}randZeichenwert(e){return this.zeichenwert(e)}map(e){let n=this.zeichenwert(Number(e)),r=this.randZeichenwert(this.#e[0]),i=this.randZeichenwert(this.#e[1]),[o,a]=this.#t;return i===r?o:o+(n-r)/(i-r)*(a-o)}invert(e){let n=this.randZeichenwert(this.#e[0]),r=this.randZeichenwert(this.#e[1]),[i,o]=this.#t;return o===i?this.#e[0]:this.wert(n+(e-i)/(o-i)*(r-n))}domain(){return [...this.#e]}range(){return [...this.#t]}};var g=[{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}],x=class{#e;#t;#n;constructor(e){this.#e=new y({domain:e.domain,range:e.range}),this.#t=e.locale||(M()??"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,n=3,r=12){let[i,o]=this.#e.domain(),a=o-i;if(a<=0)return {interval:g[0].ms};let d=a/e,s=g[0].ms;for(let m of g)if(m.ms>=d){s=m.ms;break}let t=s,l=Math.round(a/t);for(;l>r&&t<g[g.length-1].ms;){let m=g.findIndex(b=>b.ms===t);t=g[Math.min(m+1,g.length-1)].ms,l=Math.round(a/t);}for(;l<n&&t>g[0].ms;){let m=g.findIndex(b=>b.ms===t);t=g[Math.max(m-1,0)].ms,l=Math.round(a/t);}return {interval:t}}ticks(e){let n=e?.minTicks??5,r=e?.maxTicks??12,{interval:i}=this.tickInterval((n+r)/2,n,r),[o,a]=this.#e.domain(),d=[],s=Math.ceil(o/i)*i;for(let t=s;t<=a;t+=i)d.push(t);return d}format(e,n){let r=this.#n?{...n,timeZone:this.#n}:n;return k(this.#t,r).format(new Date(e))}};function T(h){let e=1/0,n=-1/0;for(let r=0;r<h.length;r++){let i=h[r];i<e&&(e=i),i>n&&(n=i);}return [e,n]}var z={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",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,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize: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 R={...z};function S(){return R}var f=new Proxy({},{get:(h,e)=>S()[e],has:(h,e)=>e in S(),ownKeys:()=>Reflect.ownKeys(S()),getOwnPropertyDescriptor:(h,e)=>Reflect.getOwnPropertyDescriptor(S(),e)});var w=class{_data;_width;_height;_x;_y;_zoom;_stroke;_bgColor;_brushColor;constructor(e){this._data=e.data,this._width=e.width,this._height=e.height,this._x=e.x,this._y=e.y,this._zoom=e.zoom,this._stroke=e.stroke??f.minimapStroke,this._bgColor=e.bgColor??f.minimapBg,this._brushColor=e.brushColor??f.minimapBrush;}render(){if(this._data.length===0)return [];let e=[],n=this._data.map(t=>t.time),r=this._data.map(t=>t.value).filter(t=>t!==null),i=T(n),o=T(r),a=new x({domain:i,range:[0,this._width]}),d=new y({domain:o,range:[this._height,0]});e.push({type:"rect",x:this._x,y:this._y,w:this._width,h:this._height,fill:this._bgColor});let s=this._data.map(t=>({x:this._x+a.map(t.time),y:this._y+d.map(t.value)}));if(e.push({type:"path",points:s,smoothing:false,stroke:this._stroke,strokeWidth:1}),this._zoom){let t=this._zoom.state,l=this._x+a.map(t.domain[0]),m=this._x+a.map(t.domain[1]),b=Math.max(2,m-l);e.push({type:"rect",x:l,y:this._y,w:b,h:this._height,fill:this._brushColor});}return e}navigateTo(e){let n=this._data.map(a=>a.time),r=T(n),i=new x({domain:r,range:[0,this._width]}),o=e-this._x;return i.invert(o)}};var C=class{_mouseX;_timeScale;_valueScale;_data;_xRange;_yRange;_snapRadius;_bgColor;_borderColor;_textColor;constructor(e){this._mouseX=e.mouseX,this._timeScale=e.timeScale,this._valueScale=e.valueScale,this._data=e.data,this._xRange=e.xRange,this._yRange=e.yRange,this._snapRadius=e.snapRadius??f.tooltipSnapRadius,this._bgColor=e.bgColor??f.tooltipBg,this._borderColor=e.borderColor??f.tooltipBorder,this._textColor=e.textColor??f.tooltipText;}compute(){let e=[...this._data].filter(u=>u.value!==null).sort((u,c)=>u.time-c.time),n,r=1/0;for(let u of e){let c=this._timeScale.map(u.time),p=Math.abs(this._mouseX-c);p<r&&(r=p,n=u);}if(!n||r>this._snapRadius)return {visible:false,commands:[]};let i=this._timeScale.map(n.time),o=this._valueScale.map(n.value),a=[];a.push({type:"line",x1:i,y1:this._yRange[0],x2:i,y2:this._yRange[1],stroke:"#94a3b8",strokeWidth:1},{type:"line",x1:this._xRange[0],y1:o,x2:this._xRange[1],y2:o,stroke:"#94a3b8",strokeWidth:1},{type:"circle",cx:i,cy:o,r:5,fill:"#3b82f6"});let d=new Date(n.time).toLocaleString(),s=n.value.toFixed(2),t=120,l=44,m=i+12,b=o-l-4;return m+t>this._xRange[1]&&(m=i-t-12),b<this._yRange[0]&&(b=o+12),a.push({type:"rect",x:m,y:b,w:t,h:l,fill:this._bgColor,stroke:this._borderColor,strokeWidth:1},{type:"text",content:d,x:m+8,y:b+16,fontSize:f.tooltipTimeFontSize,fill:this._textColor},{type:"text",content:`Value: ${s}`,x:m+8,y:b+32,fontSize:f.tooltipValueFontSize,fill:"#3b82f6"}),{visible:true,commands:a,dataPoint:n,snapX:i}}};/*!
|
|
2
2
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
3
3
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
4
4
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
5
|
-
*/export{
|
|
5
|
+
*/export{w as Minimap,C as Tooltip,v as Zoom};
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { u as RenderingContext, F as FlatSeriesStyle } from './marker_renderer-
|
|
1
|
+
import { u as RenderingContext, F as FlatSeriesStyle } from './marker_renderer-DYSAkVgI.js';
|
|
2
2
|
import { Theme, TextMetrics, Marker } from './index.js';
|
|
3
|
-
export { v as Layout, w as LayoutConfig, a as LayoutResult, x as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, y as measureLegend, z as renderLegend, B as renderSeriesMarkers, t as slugify } from './marker_renderer-
|
|
4
|
-
import { a as DrawCommand, L as LinearScale, T as TimeScale,
|
|
3
|
+
export { v as Layout, w as LayoutConfig, a as LayoutResult, x as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, y as measureLegend, z as renderLegend, B as renderSeriesMarkers, t as slugify } from './marker_renderer-DYSAkVgI.js';
|
|
4
|
+
import { a as DrawCommand, L as LinearScale, T as TimeScale, af as LineParams, ag as PathParams, ah as RectParams, ai as CircleParams, aj as TextParams, ak as GapParams, d as DrawGroup, C as AxisOrientation, A as AxisPosition, al as Point, am as BandScale } from './types-RAg4hLZA.js';
|
|
5
5
|
import { DataPoint, AggregatedPoint, HatchVariant, Threshold, Gap, RangeLabelPosition, GapBand, Highlight, Annotation, MovingAverageType, EnumMap, SmoothingType, PointStyleType, AnnotationBandItem, AnnotationBandLabels, LineVariant, LineShape, FillSpec, GapStyle, TimeSeries } from './index.js';
|
|
6
|
-
export {
|
|
6
|
+
export { an as BandScaleConfig, ao as Dashstyle_t, ap as DomainScaleConfig, aq as DrawCircle, ar as DrawGap, as as DrawGapType_t, at as DrawLine, au as DrawPath, av as DrawRect, aw as DrawText, r as LabelAnchor, ax as LinearScaleConfig, ay as Scale, az as ScaleConfig, aA as TIME_INTERVALS, aB as TimeScaleConfig, aC as getHatch } from './types-RAg4hLZA.js';
|
|
7
7
|
import { DataPoint as DataPoint$1 } from './analyze/index.js';
|
|
8
8
|
|
|
9
9
|
/*!
|
|
@@ -475,6 +475,18 @@ interface ValueAxisConfig {
|
|
|
475
475
|
* dort "0, 0.5, 1" und dazwischen Werte, die es nicht gibt.
|
|
476
476
|
*/
|
|
477
477
|
tickValues?: number[];
|
|
478
|
+
/**
|
|
479
|
+
* Logarithmische Teilung mit dieser Untergrenze (`scale: 'log'`). Die
|
|
480
|
+
* Striche kommen dann als `tickValues` und `minorTickValues` von aussen
|
|
481
|
+
* (log_achse.ts) -- die Schrittweite unten ist eine lineare Rechnung.
|
|
482
|
+
*/
|
|
483
|
+
untergrenze?: number;
|
|
484
|
+
/**
|
|
485
|
+
* Feste WERTE der Zwischenstriche. Gewinnt gegen `minorTicks`, das die
|
|
486
|
+
* Strecke zwischen zwei Hauptstrichen gleichmaessig teilt: an einer
|
|
487
|
+
* logarithmischen Achse liegen 2..9 nicht gleichmaessig.
|
|
488
|
+
*/
|
|
489
|
+
minorTickValues?: number[];
|
|
478
490
|
/**
|
|
479
491
|
* Zwischenstriche je Hauptabstand (0 = keine). Sie tragen keine
|
|
480
492
|
* Beschriftung und sind halb so lang -- ein Zwischenstrich, der aussieht wie
|
package/dist/internals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Z=class{};var w=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(o,r)=>o!==null&&r!==null?o+t*(r-o):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((s,a)=>s.time-a.time),o=[],r=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&r.length&&(o.push(r),r=[]),a||r.push(s),l=s;}return r.length&&o.push(r),o}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let o=[...e].sort((m,d)=>m-d),r=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:o[m-1],s=m=>{let d=0;for(let c=0;c<o.length&&m>=o[c];c++)d=c+1;return d},a=[i[0]];for(let m=1;m<i.length;m++){let d=i[m-1],c=i[m],p=t(d),h=t(c),u;h>p?u=o.filter(g=>g>p&&g<=h):h<p?u=o.filter(g=>g>=h&&g<p).reverse():u=[];let b=p;for(let g of u){let y=(g-p)/(h-p),x=n(d,c,y);a.push(x);let S=s((b+g)/2);r.push({data:a,zoneIndex:S,zoneLow:l(S)}),a=[x],b=g;}(u.length===0||u[u.length-1]!==h)&&a.push(c);}if(a.length>1||i.length===1){let m=t(a[0]),d=t(a[a.length-1]),c=s((m+d)/2);r.push({data:a,zoneIndex:c,zoneLow:l(c)});}return r}static splitByThreshold(i,e,t,n){let o=this.splitByBoundaries(i,[e],t,n),r={above:[],below:[]};for(let l of o)l.zoneIndex===0?r.below.push(l.data):r.above.push(l.data);return r}};var ye=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,a)=>s-a);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((s,a)=>s+a,0)/t,o=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,r=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(r);return {min:e[0],max:e[t-1],avg:n,mean:n,median:o,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(o=>o.time>=e&&o.time<=t);return this.compute(n)}};function K(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function We(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function A(i){return {id:i.id,line:{stroke:i.stroke??f.stroke,strokeWidth:i.strokeWidth??f.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??f.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??f.pointSize,stroke:i.stroke??f.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function je(i,e,t,n){let o=w.splitByThreshold(i,e,l=>l.value,w.interpolateDataPoint),r=[];return n.below&&r.push(...L(o.below.map(l=>({data:l})),t,n.below)),n.above&&r.push(...L(o.above.map(l=>({data:l})),t,n.above)),r}function L(i,e,t){let n=[],o=A(t);for(let r=0;r<i.length;r++){let l=i[r];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,smoothingType:o.line.smoothingType,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&&n.push({type:"circle",id:t.id?`${t.id}-dot-${r}`:void 0,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 q(i,e,t){let n=[],o=A(t);for(let r=0;r<i.length;r++){let l=i[r];if(l.data.length<2)continue;let s=K(l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:s,stroke:l.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Be(i,e,t,n,o){let r=[],l=A(t);for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),d=a.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-${s}`:void 0,points:[...m,...d],fill:a.color??l.fill,hatch:t.hatch,stroke:"none"});}return r}function J(i,e,t,n){if(i.length<2)return [];let o=w.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),r=[];for(let l=0;l<o.length;l++){let s=o[l];if(s.data.length<2)continue;let a=t.getColor(s.zoneIndex);if(!a)continue;let m=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),d=s.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-${l}`:void 0,points:[...m,...d],fill:a,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return r}function Q(i,e,t,n){let o=A(t);if(!o.markers.type||o.markers.type==="none")return [];let r=[];for(let l=0;l<i.length;l++){let s=i[l],a=e.timeScale.map(s.time),m=e.valueScale.map(s.value),d=n(s),c=t.pointStroke??d,p=t.pointFill??d,h=t.pointStrokeWidth??1.5,u=t.id?`${t.id}-marker-${l}`:void 0;ee(r,u,o.markers.type,a,m,o.markers.size,c,p,h);}return r.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:r}]}function ee(i,e,t,n,o,r,l,s,a){let m=d=>e===void 0?void 0:`${e}-${d}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:o,r,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-r,y:o-r,w:r*2,h:r*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-r,y1:o-r,x2:n+r,y2:o+r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-r,y1:o+r,x2:n+r,y2:o-r,stroke:l,strokeWidth:a,id:m(2)});break;case "diamond":i.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:s,stroke:l,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o+r},{x:n-r,y:o+r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "star":{let d=[];for(let c=0;c<10;c++){let p=c%2===0?r:r*.5,h=Math.PI/2*3+c*Math.PI/5;d.push({x:n+p*Math.cos(h),y:o+p*Math.sin(h)});}i.push({type:"path",points:d,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-r,y:o+r},{x:n,y:o-r},{x:n+r,y:o+r}],stroke:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:o-r,x2:n,y2:o+r,stroke:l,strokeWidth:a,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:o+r},{x:n+r,y:o-r},{x:n-r,y:o-r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "hexagon":{let d=[];for(let c=0;c<6;c++){let p=c*(Math.PI/3);d.push({x:n+r*Math.cos(p),y:o+r*Math.sin(p)});}i.push({type:"path",points:d,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "hourglass":i.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:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:o,r,fill:s,stroke:l,strokeWidth:a,id:e});}}var Ie=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],xe=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of Ie){let n=t.split(",");for(let o=0;o<n.length;o++)i.set(e+o,Number(n[o])/1e3);}return i})();function Se(i){return Oe.get(i)??xe}var _=(i,e)=>{let t=0;for(let n of i)t+=Se(n.codePointAt(0)??0);return t*e};var ke={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",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,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize: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 Ee={...ke};function D(){return Ee}function Ge(i){let e=i.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 He(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Te(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,o=2){let r=n??Ge(t),l=He(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
1
|
+
var K=class{};var C=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(o,r)=>o!==null&&r!==null?o+t*(r-o):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((s,a)=>s.time-a.time),o=[],r=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&r.length&&(o.push(r),r=[]),a||r.push(s),l=s;}return r.length&&o.push(r),o}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let o=[...e].sort((m,d)=>m-d),r=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:o[m-1],s=m=>{let d=0;for(let c=0;c<o.length&&m>=o[c];c++)d=c+1;return d},a=[i[0]];for(let m=1;m<i.length;m++){let d=i[m-1],c=i[m],p=t(d),h=t(c),u;h>p?u=o.filter(g=>g>p&&g<=h):h<p?u=o.filter(g=>g>=h&&g<p).reverse():u=[];let b=p;for(let g of u){let y=(g-p)/(h-p),x=n(d,c,y);a.push(x);let S=s((b+g)/2);r.push({data:a,zoneIndex:S,zoneLow:l(S)}),a=[x],b=g;}(u.length===0||u[u.length-1]!==h)&&a.push(c);}if(a.length>1||i.length===1){let m=t(a[0]),d=t(a[a.length-1]),c=s((m+d)/2);r.push({data:a,zoneIndex:c,zoneLow:l(c)});}return r}static splitByThreshold(i,e,t,n){let o=this.splitByBoundaries(i,[e],t,n),r={above:[],below:[]};for(let l of o)l.zoneIndex===0?r.below.push(l.data):r.above.push(l.data);return r}};var Se=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,a)=>s-a);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((s,a)=>s+a,0)/t,o=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,r=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(r);return {min:e[0],max:e[t-1],avg:n,mean:n,median:o,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(o=>o.time>=e&&o.time<=t);return this.compute(n)}};function q(i,e,t,n,o){let r=[...e].sort((s,a)=>s-a);return C.splitByBoundaries(i,r.map(s=>o.zeichenwert(s)),s=>o.zeichenwert(t(s)),n).map(s=>({data:s.data,zoneIndex:s.zoneIndex,zoneLow:s.zoneIndex<=0?Number.NEGATIVE_INFINITY:r[s.zoneIndex-1]}))}function we(i,e,t,n,o){let r={above:[],below:[]};for(let l of q(i,[e],t,n,o))l.zoneIndex===0?r.below.push(l.data):r.above.push(l.data);return r}function Te(i){return (e,t,n)=>{let o=i.zeichenwert(e.value??0),r=i.zeichenwert(t.value??0);return {...C.interpolateDataPoint(e,t,n),value:i.wert(o+n*(r-o))}}}function ke(i){return (e,t,n)=>{let o=(r,l)=>{if(r===null||l===null)return null;let s=i.zeichenwert(r);return i.wert(s+n*(i.zeichenwert(l)-s))};return {...C.interpolateAggregatedPoint(e,t,n),min:o(e.min,t.min),max:o(e.max,t.max),avg:o(e.avg,t.avg)}}}function J(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function Oe(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function P(i){return {id:i.id,line:{stroke:i.stroke??f.stroke,strokeWidth:i.strokeWidth??f.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??f.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??f.pointSize,stroke:i.stroke??f.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function Ee(i,e,t,n){let o=we(i,e,l=>l.value,Te(t.valueScale),t.valueScale),r=[];return n.below&&r.push(...L(o.below.map(l=>({data:l})),t,n.below)),n.above&&r.push(...L(o.above.map(l=>({data:l})),t,n.above)),r}function L(i,e,t){let n=[],o=P(t);for(let r=0;r<i.length;r++){let l=i[r];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:o.line.smoothing,smoothingType:o.line.smoothingType,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&&n.push({type:"circle",id:t.id?`${t.id}-dot-${r}`:void 0,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 Q(i,e,t){let n=[],o=P(t);for(let r=0;r<i.length;r++){let l=i[r];if(l.data.length<2)continue;let s=J(l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${r}`:void 0,points:s,stroke:l.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Ge(i,e,t,n,o){let r=[],l=P(t);for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),d=a.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-${s}`:void 0,points:[...m,...d],fill:a.color??l.fill,hatch:t.hatch,stroke:"none"});}return r}function ee(i,e,t,n){if(i.length<2)return [];let o=q(i,t.boundaries,t.getValue,t.interpolate,e.valueScale),r=[];for(let l=0;l<o.length;l++){let s=o[l];if(s.data.length<2)continue;let a=t.getColor(s.zoneIndex);if(!a)continue;let m=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),d=s.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-${l}`:void 0,points:[...m,...d],fill:a,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return r}function te(i,e,t,n){let o=P(t);if(!o.markers.type||o.markers.type==="none")return [];let r=[];for(let l=0;l<i.length;l++){let s=i[l],a=e.timeScale.map(s.time),m=e.valueScale.map(s.value),d=n(s),c=t.pointStroke??d,p=t.pointFill??d,h=t.pointStrokeWidth??1.5,u=t.id?`${t.id}-marker-${l}`:void 0;ne(r,u,o.markers.type,a,m,o.markers.size,c,p,h);}return r.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:r}]}function ne(i,e,t,n,o,r,l,s,a){let m=d=>e===void 0?void 0:`${e}-${d}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:o,r,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-r,y:o-r,w:r*2,h:r*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-r,y1:o-r,x2:n+r,y2:o+r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-r,y1:o+r,x2:n+r,y2:o-r,stroke:l,strokeWidth:a,id:m(2)});break;case "diamond":i.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:s,stroke:l,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o+r},{x:n-r,y:o+r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "star":{let d=[];for(let c=0;c<10;c++){let p=c%2===0?r:r*.5,h=Math.PI/2*3+c*Math.PI/5;d.push({x:n+p*Math.cos(h),y:o+p*Math.sin(h)});}i.push({type:"path",points:d,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-r,y:o+r},{x:n,y:o-r},{x:n+r,y:o+r}],stroke:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:o-r,x2:n,y2:o+r,stroke:l,strokeWidth:a,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:o+r},{x:n+r,y:o-r},{x:n-r,y:o-r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "hexagon":{let d=[];for(let c=0;c<6;c++){let p=c*(Math.PI/3);d.push({x:n+r*Math.cos(p),y:o+r*Math.sin(p)});}i.push({type:"path",points:d,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "hourglass":i.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:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:o,r,fill:s,stroke:l,strokeWidth:a,id:e});}}var He=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],ve=.6,Ve=(()=>{let i=new Map;for(let[e,,t]of He){let n=t.split(",");for(let o=0;o<n.length;o++)i.set(e+o,Number(n[o])/1e3);}return i})();function Ce(i){return Ve.get(i)??ve}var A=(i,e)=>{let t=0;for(let n of i)t+=Ce(n.codePointAt(0)??0);return t*e};var Me={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",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,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize: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 Ne={...Me};function D(){return Ne}function Ye(i){let e=i.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 Ze(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Le(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,o=2){let r=n??Ye(t),l=Ze(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
2
2
|
<pattern id="${i}" width="10" height="10" patternUnits="userSpaceOnUse">
|
|
3
3
|
<rect width="10" height="10" fill="${t}" />
|
|
4
4
|
</pattern>
|
|
@@ -21,10 +21,10 @@ var Z=class{};var w=class{static interpolateDataPoint(i,e,t){return {time:i.time
|
|
|
21
21
|
${c}
|
|
22
22
|
${d}
|
|
23
23
|
</pattern>
|
|
24
|
-
`.trim()}var f=new Proxy({},{get:(i,e)=>D()[e],has:(i,e)=>e in D(),ownKeys:()=>Reflect.ownKeys(D()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(D(),e)});var B=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var Ve="#ffffff",Ne="#cccccc",Xe=6,Ye=.85,T=12,N=8,I=20,Ue=11,V=18,te=(i,e)=>e(i,Ue);function we(i,e,t){let n=s=>T+N+te(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let o=[],r=[],l=0;for(let s of i){let a=n(s),m=r.length===0?a:l+V+a;r.length>0&&m>t?(o.push({items:r,breite:l}),r=[s],l=a):(r=[...r,s],l=m);}return r.length>0&&o.push({items:r,breite:l}),o}function ve(i,e="vertical",t=_,n){if(e==="horizontal"){let r=we(i,t,n);return {width:r.reduce((l,s)=>Math.max(l,s.breite),0),height:r.length*I}}let o=0;for(let r of i)o=Math.max(o,te(r.name,t));return {width:T+N+o,height:i.length*I}}function Ze(i){let{items:e,x:t,y:n,orientation:o="vertical",metrics:r=_,maxBreite:l,box:s,itemClass:a}=i,m=new B;if(s&&e.length>0){let h=ve(e,o,r,l),b=((o==="horizontal"?h.height/I:e.length)-1)*I+T,g=s.padding??Xe,y=s.stroke??Ne;m.rect({x:t-g,y:n-g,w:h.width+2*g,h:b+2*g,fill:s.fill??Ve,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ye});}let d=o==="horizontal"?we(e,r,l):e.map(h=>({items:[h],breite:0})),c=new Map;d.forEach((h,u)=>{let b=t;for(let g of h.items)c.set(g,{x:b,y:n+u*I}),b+=T+N+te(g.name,r)+V;});let p=e.some(h=>h.line!==void 0&&h.line!=="solid"&&h.line!=="none");return e.forEach(h=>{let u=c.get(h)??{x:t,y:n},b=u.x,g=u.y,y=["legend-item"];h.id&&y.push(`legend-item--${h.id}`),a&&y.push(a),m.group({cssClass:y.join(" "),...h.id?{id:`legend-${h.id}`}:{}},x=>{qe(x,h,b,g,p),x.text({content:h.name,x:b+T+N,y:g+T-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ke(i){return Math.min(Math.max(i??2,1.5),3)}function qe(i,e,t,n,o){let r=e.colors&&e.colors.length>=2?e.colors:[e.color],l=T/r.length;if(o){r.forEach((s,a)=>{let m=t+a*l;i.line({x1:m,y1:n+T/2,x2:m+l,y2:n+T/2,stroke:s,strokeWidth:Ke(e.width),...e.line&&e.line!=="solid"?{dash:e.line}:{}});});return}if(r.length===1){i.rect({x:t,y:n,w:T,h:T,fill:r[0],stroke:f.legendStroke,strokeWidth:1});return}r.forEach((s,a)=>{i.rect({x:t+a*l,y:n,w:l,h:T,fill:s});}),i.rect({x:t,y:n,w:T,h:T,fill:"none",stroke:f.legendStroke,strokeWidth:1});}function Je(i){let{xTicks:e,yTicks:t,xRange:n,yRange:o,stroke:r=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let d of t)m.push({type:"line",x1:n[0],y1:d,x2:n[1],y2:d,stroke:r,strokeWidth:l,dashed:s,opacity:a});if(e)for(let d of e)m.push({type:"line",x1:d,y1:o[0],x2:d,y2:o[1],stroke:r,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function Qe(i,e){return `${i}|${JSON.stringify(e??{})}`}function O(i,e){let t=Qe(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var R=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,o]=this.#e,[r,l]=this.#t;return o===n?r:r+(t-n)/(o-n)*(l-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}],E=class{#e;#t;#n;constructor(e){this.#e=new R({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"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(),l=r-o;if(l<=0)return {interval:v[0].ms};let s=l/e,a=v[0].ms;for(let c of v)if(c.ms>=s){a=c.ms;break}let m=a,d=Math.round(l/m);for(;d>n&&m<v[v.length-1].ms;){let c=v.findIndex(p=>p.ms===m);m=v[Math.min(c+1,v.length-1)].ms,d=Math.round(l/m);}for(;d<t&&m>v[0].ms;){let c=v.findIndex(p=>p.ms===m);m=v[Math.max(c-1,0)].ms,d=Math.round(l/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,l]=this.#e.domain(),s=[],a=Math.ceil(r/o)*o;for(let m=a;m<=l;m+=o)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return O(this.#t,n).format(new Date(e))}},z=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 l=this.#r*2*Math.abs(o-n),s=Math.abs(o-n)-l,a=o>=n?1:-1,m=s/r;return n+this.#r*Math.abs(o-n)*a+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]),l=Math.abs(e-r);l<n&&(n=l,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 ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function et(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function tt(i){let{thresholds:e,valueScale:t,xRange:n}=i,[o,r]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),d=[],c=[];for(let p of e){let h=p.color??f.thresholdColor,u=t.map(p.value);p.fill==="above"?d.push({type:"rect",x:o,y:a,w:r-o,h:Math.max(0,u-a),fill:h,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&d.push({type:"rect",x:o,y:u,w:r-o,h:Math.max(0,m-u),fill:h,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let b=p.line??f.thresholdLine;if(b!=="none"){let S=et(b),k={type:"line",x1:o,y1:u,x2:r,y2:u,stroke:h,strokeWidth:1,...S,id:p.id?`${p.id}-line`:void 0};p.shadowColor&&(k.shadowColor=p.shadowColor,k.shadowBlur=p.shadowBlur??4,k.shadowOffsetX=p.shadowOffsetX??0,k.shadowOffsetY=p.shadowOffsetY??2),d.push(k);}let[g,y]=t.domain();if(p.value>=Math.min(g,y)&&p.value<=Math.max(g,y)&&p.label!==void 0&&p.label!==null&&p.label!==false){let S=typeof p.label=="object"?p.label:void 0,k=typeof p.label=="string"?p.label:S?.text??p.name,C=S?.position??"right",j=ot(k,C,o,r,u,h,S);c.push({...j,y:rt(j.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:d,labels:c}}function nt(i){let e=tt(i);return [...e.inside,...e.labels]}function rt(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function ot(i,e,t,n,o,r,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:r},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:o-4,anchor:"start"};case "above":return {...a,...m,x:s,y:o-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:o+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:o-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:o+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:o+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:o-4,anchor:"end"}}}function Me(i,e,t,n){switch(i){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 Y(i){let{ranges:e,timeScale:t,yRange:n,height:o,metrics:r=_}=i,[l,s]=n,a=[],[m,d]=t.range(),c=Math.min(m,d),p=Math.max(m,d),h=u=>Math.max(c,Math.min(p,u));for(let u of e){let b=h(t.map(u.startTime)),g=h(t.map(u.endTime));if(u.fill!==void 0&&a.push({type:"rect",x:b,y:l,w:g-b,h:s-l,fill:u.fill,hatch:u.hatch,opacity:u.opacity}),u.edges)for(let y of [b,g])a.push({type:"line",x1:y,y1:l,x2:y,y2:s,stroke:u.edges.stroke,strokeWidth:u.edges.strokeWidth,dash:"dashed"});if(u.label){let y=u.labelPosition??"middle",x=u.rotate,S=true;if(x==="auto"){let k=y!=="above"&&y!=="below",C=r(u.label,u.fontSize??11);x=k&&C>Math.abs(g-b)-4?-90:void 0,S=x===void 0||C<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:u.label,x:(b+g)/2,y:Me(y,l,s,o),anchor:"middle",fontSize:u.fontSize,fill:u.labelColor,rotate:x});}}return a}function it(i){let{gaps:e,timeScale:t,yRange:n,height:o,fill:r=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:d=true,fontSize:c=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:h="middle",labelRotate:u,metrics:b,band:g}=i,y=()=>{if(!g)return [];let x=g.height??6,[S,k]=n,C=Math.max(S,k);return e.map(j=>{let ge=t.map(j.startTime),be=t.map(j.endTime);return {type:"rect",x:Math.min(ge,be),y:C-x+(g.offset??0),w:Math.abs(be-ge),h:x,fill:g.fill??a,opacity:g.opacity??.75}})};return Y({timeScale:t,yRange:n,height:o,metrics:b,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",C=S==="dashed_border"&&d!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??r,hatch:x.hatch??l,opacity:x.fillOpacity??s},...C&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??h,labelColor:p,fontSize:c,rotate:x.rotate??u}})}).concat(y())}function at(i){let{markers:e,timeScale:t,valueScale:n,yRange:o=[0,300]}=i,[r,l]=o,s=[];for(let a of e){let m=t.map(a.time),d=a.color??f.markerColor,c=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let h=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:r,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:r,x2:m,y2:l,stroke:d,strokeWidth:1}),c!=="none"&&ee(s,void 0,c,m,h,f.markerSize,d,d,1.5),a.label){let u=p==="to-value"?h-10:r-6;s.push({type:"text",content:a.label,x:m,y:u,anchor:"middle",fontSize:f.markerFontSize,fill:d});}}else p!=="none"&&s.push({type:"line",x1:m,y1:r,x2:m,y2:l,stroke:d,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:r-6,anchor:"middle",fontSize:f.markerFontSize,fill:d});}return s}function st(i){let{highlights:e,timeScale:t,yRange:n,height:o}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:o,ranges:e.map(r=>({startTime:r.startTime,endTime:r.endTime,fill:r.color??f.highlightColor,opacity:r.opacity??f.highlightOpacity,label:r.label,labelPosition:r.labelPosition??"top",labelColor:r.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:r.rotate}))})}function lt(i,e,t){let n=(r,[l,s])=>r>=Math.min(l,s)&&r<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let o=t.get(i.axis??0)??t.values().next().value;return !o||n(i.value,o.domain())}function mt(i){let{annotations:e,timeScale:t,valueScales:n,plot:o}=i,r=[],l=a=>!o||lt(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],d=h=>m.push(h);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let c=o!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=c?{clipRect:o}:{};switch(a.type){case "line":{let h=s(a.from),u=s(a.to);d({type:"line",x1:h.x,y1:h.y,x2:u.x,y2:u.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let h=s(a.from),u=s(a.to),b=a.color??f.annotationColor,g=a.headSize??f.annotationHead;d({type:"line",x1:h.x,y1:h.y,x2:u.x,y2:u.y,stroke:b,strokeWidth:a.width??f.annotationWidth});let y=Math.hypot(u.x-h.x,u.y-h.y)||1,x=(u.x-h.x)/y,S=(u.y-h.y)/y,k=u.x-x*g,C=u.y-S*g;d({type:"path",points:[{x:u.x,y:u.y},{x:k-S*g*.5,y:C+x*g*.5},{x:k+S*g*.5,y:C-x*g*.5}],fill:b,stroke:"none"});break}case "rect":{let h=s(a.from),u=s(a.to);d({type:"rect",x:Math.min(h.x,u.x),y:Math.min(h.y,u.y),w:Math.abs(u.x-h.x),h:Math.abs(u.y-h.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let h=s(a.at),u=a.color??"#334155",b=a.radius??f.annotationRadius,g=a.shape??"circle";g==="circle"?d({type:"circle",cx:h.x,cy:h.y,r:b,fill:u}):g==="square"?d({type:"rect",x:h.x-b,y:h.y-b,w:b*2,h:b*2,fill:u}):(d({type:"line",x1:h.x-b,y1:h.y-b,x2:h.x+b,y2:h.y+b,stroke:u,strokeWidth:1.5}),d({type:"line",x1:h.x-b,y1:h.y+b,x2:h.x+b,y2:h.y-b,stroke:u,strokeWidth:1.5}));break}case "label":{let h=s(a.at);d({type:"text",content:a.text,x:h.x+(a.dx??0),y:h.y+(a.dy??0),anchor:a.anchor??ut(h.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let h=ne(a.id);r.push({type:"group",cssClass:`annotation annotation--${h}`,...p,commands:m});}else c&&m.length>0?r.push({type:"group",cssClass:"annotation",...p,commands:m}):r.push(...m);}return r}function ut(i,e,t){let{metrics:n,timeScale:o}=t;if(!n)return "middle";let[r,l]=o.range(),s=n(e,f.annotationFontSize)/2;return i-s<r?"start":i+s>l?"end":"middle"}var re=class i{_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 i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=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 f=new Proxy({},{get:(i,e)=>D()[e],has:(i,e)=>e in D(),ownKeys:()=>Reflect.ownKeys(D()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(D(),e)});var I=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var Ue="#ffffff",Ke="#cccccc",qe=6,Je=.85,T=12,N=8,z=20,Qe=11,V=18,re=(i,e)=>e(i,Qe);function De(i,e,t){let n=s=>T+N+re(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let o=[],r=[],l=0;for(let s of i){let a=n(s),m=r.length===0?a:l+V+a;r.length>0&&m>t?(o.push({items:r,breite:l}),r=[s],l=a):(r=[...r,s],l=m);}return r.length>0&&o.push({items:r,breite:l}),o}function Ae(i,e="vertical",t=A,n){if(e==="horizontal"){let r=De(i,t,n);return {width:r.reduce((l,s)=>Math.max(l,s.breite),0),height:r.length*z}}let o=0;for(let r of i)o=Math.max(o,re(r.name,t));return {width:T+N+o,height:i.length*z}}function et(i){let{items:e,x:t,y:n,orientation:o="vertical",metrics:r=A,maxBreite:l,box:s,itemClass:a}=i,m=new I;if(s&&e.length>0){let h=Ae(e,o,r,l),b=((o==="horizontal"?h.height/z:e.length)-1)*z+T,g=s.padding??qe,y=s.stroke??Ke;m.rect({x:t-g,y:n-g,w:h.width+2*g,h:b+2*g,fill:s.fill??Ue,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Je});}let d=o==="horizontal"?De(e,r,l):e.map(h=>({items:[h],breite:0})),c=new Map;d.forEach((h,u)=>{let b=t;for(let g of h.items)c.set(g,{x:b,y:n+u*z}),b+=T+N+re(g.name,r)+V;});let p=e.some(h=>h.line!==void 0&&h.line!=="solid"&&h.line!=="none");return e.forEach(h=>{let u=c.get(h)??{x:t,y:n},b=u.x,g=u.y,y=["legend-item"];h.id&&y.push(`legend-item--${h.id}`),a&&y.push(a),m.group({cssClass:y.join(" "),...h.id?{id:`legend-${h.id}`}:{}},x=>{nt(x,h,b,g,p),x.text({content:h.name,x:b+T+N,y:g+T-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function tt(i){return Math.min(Math.max(i??2,1.5),3)}function nt(i,e,t,n,o){let r=e.colors&&e.colors.length>=2?e.colors:[e.color],l=T/r.length;if(o){r.forEach((s,a)=>{let m=t+a*l;i.line({x1:m,y1:n+T/2,x2:m+l,y2:n+T/2,stroke:s,strokeWidth:tt(e.width),...e.line&&e.line!=="solid"?{dash:e.line}:{}});});return}if(r.length===1){i.rect({x:t,y:n,w:T,h:T,fill:r[0],stroke:f.legendStroke,strokeWidth:1});return}r.forEach((s,a)=>{i.rect({x:t+a*l,y:n,w:l,h:T,fill:s});}),i.rect({x:t,y:n,w:T,h:T,fill:"none",stroke:f.legendStroke,strokeWidth:1});}function rt(i){let{xTicks:e,yTicks:t,xRange:n,yRange:o,stroke:r=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let d of t)m.push({type:"line",x1:n[0],y1:d,x2:n[1],y2:d,stroke:r,strokeWidth:l,dashed:s,opacity:a});if(e)for(let d of e)m.push({type:"line",x1:d,y1:o[0],x2:d,y2:o[1],stroke:r,strokeWidth:l,dashed:s,opacity:a});return m}var _e=new Map;function ot(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=ot(i,e),n=_e.get(t);return n||(n=new Intl.DateTimeFormat(i,e),_e.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var _=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}zeichenwert(e){return e}wert(e){return e}randZeichenwert(e){return this.zeichenwert(e)}map(e){let t=this.zeichenwert(Number(e)),n=this.randZeichenwert(this.#e[0]),o=this.randZeichenwert(this.#e[1]),[r,l]=this.#t;return o===n?r:r+(t-n)/(o-n)*(l-r)}invert(e){let t=this.randZeichenwert(this.#e[0]),n=this.randZeichenwert(this.#e[1]),[o,r]=this.#t;return r===o?this.#e[0]:this.wert(t+(e-o)/(r-o)*(n-t))}domain(){return [...this.#e]}range(){return [...this.#t]}},Y=class extends _{#e;constructor(e){super(e),this.#e=e.untergrenze??Math.min(e.domain[0],e.domain[1]);}get untergrenze(){return this.#e}zeichenwert(e){return Math.log(Math.max(e,this.#e))/Math.LN10}wert(e){return 10**e}randZeichenwert(e){return Math.log(e)/Math.LN10}},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}],O=class{#e;#t;#n;constructor(e){this.#e=new _({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"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(),l=r-o;if(l<=0)return {interval:k[0].ms};let s=l/e,a=k[0].ms;for(let c of k)if(c.ms>=s){a=c.ms;break}let m=a,d=Math.round(l/m);for(;d>n&&m<k[k.length-1].ms;){let c=k.findIndex(p=>p.ms===m);m=k[Math.min(c+1,k.length-1)].ms,d=Math.round(l/m);}for(;d<t&&m>k[0].ms;){let c=k.findIndex(p=>p.ms===m);m=k[Math.max(c-1,0)].ms,d=Math.round(l/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,l]=this.#e.domain(),s=[],a=Math.ceil(r/o)*o;for(let m=a;m<=l;m+=o)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},E=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 l=this.#r*2*Math.abs(o-n),s=Math.abs(o-n)-l,a=o>=n?1:-1,m=s/r;return n+this.#r*Math.abs(o-n)*a+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]),l=Math.abs(e-r);l<n&&(n=l,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 oe(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function it(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function at(i){let{thresholds:e,valueScale:t,xRange:n}=i,[o,r]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),d=[],c=[];for(let p of e){let h=p.color??f.thresholdColor,u=t.map(p.value);p.fill==="above"?d.push({type:"rect",x:o,y:a,w:r-o,h:Math.max(0,u-a),fill:h,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&d.push({type:"rect",x:o,y:u,w:r-o,h:Math.max(0,m-u),fill:h,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let b=p.line??f.thresholdLine;if(b!=="none"){let S=it(b),w={type:"line",x1:o,y1:u,x2:r,y2:u,stroke:h,strokeWidth:1,...S,id:p.id?`${p.id}-line`:void 0};p.shadowColor&&(w.shadowColor=p.shadowColor,w.shadowBlur=p.shadowBlur??4,w.shadowOffsetX=p.shadowOffsetX??0,w.shadowOffsetY=p.shadowOffsetY??2),d.push(w);}let[g,y]=t.domain();if(p.value>=Math.min(g,y)&&p.value<=Math.max(g,y)&&p.label!==void 0&&p.label!==null&&p.label!==false){let S=typeof p.label=="object"?p.label:void 0,w=typeof p.label=="string"?p.label:S?.text??p.name,v=S?.position??"right",j=mt(w,v,o,r,u,h,S);c.push({...j,y:lt(j.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:d,labels:c}}function st(i){let e=at(i);return [...e.inside,...e.labels]}function lt(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function mt(i,e,t,n,o,r,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:r},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:o-4,anchor:"start"};case "above":return {...a,...m,x:s,y:o-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:o+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:o-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:o+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:o+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:o-4,anchor:"end"}}}function Pe(i,e,t,n){switch(i){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 Z(i){let{ranges:e,timeScale:t,yRange:n,height:o,metrics:r=A}=i,[l,s]=n,a=[],[m,d]=t.range(),c=Math.min(m,d),p=Math.max(m,d),h=u=>Math.max(c,Math.min(p,u));for(let u of e){let b=h(t.map(u.startTime)),g=h(t.map(u.endTime));if(u.fill!==void 0&&a.push({type:"rect",x:b,y:l,w:g-b,h:s-l,fill:u.fill,hatch:u.hatch,opacity:u.opacity}),u.edges)for(let y of [b,g])a.push({type:"line",x1:y,y1:l,x2:y,y2:s,stroke:u.edges.stroke,strokeWidth:u.edges.strokeWidth,dash:"dashed"});if(u.label){let y=u.labelPosition??"middle",x=u.rotate,S=true;if(x==="auto"){let w=y!=="above"&&y!=="below",v=r(u.label,u.fontSize??11);x=w&&v>Math.abs(g-b)-4?-90:void 0,S=x===void 0||v<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:u.label,x:(b+g)/2,y:Pe(y,l,s,o),anchor:"middle",fontSize:u.fontSize,fill:u.labelColor,rotate:x});}}return a}function ut(i){let{gaps:e,timeScale:t,yRange:n,height:o,fill:r=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:d=true,fontSize:c=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:h="middle",labelRotate:u,metrics:b,band:g}=i,y=()=>{if(!g)return [];let x=g.height??6,[S,w]=n,v=Math.max(S,w);return e.map(j=>{let ye=t.map(j.startTime),xe=t.map(j.endTime);return {type:"rect",x:Math.min(ye,xe),y:v-x+(g.offset??0),w:Math.abs(xe-ye),h:x,fill:g.fill??a,opacity:g.opacity??.75}})};return Z({timeScale:t,yRange:n,height:o,metrics:b,ranges:e.map(x=>{let S=x.style??"dashed_border",w=S==="filled"||S==="dashed_border",v=S==="dashed_border"&&d!==false;return {startTime:x.startTime,endTime:x.endTime,...w&&{fill:x.fill??r,hatch:x.hatch??l,opacity:x.fillOpacity??s},...v&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??h,labelColor:p,fontSize:c,rotate:x.rotate??u}})}).concat(y())}function ct(i){let{markers:e,timeScale:t,valueScale:n,yRange:o=[0,300]}=i,[r,l]=o,s=[];for(let a of e){let m=t.map(a.time),d=a.color??f.markerColor,c=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let h=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:r,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:r,x2:m,y2:l,stroke:d,strokeWidth:1}),c!=="none"&&ne(s,void 0,c,m,h,f.markerSize,d,d,1.5),a.label){let u=p==="to-value"?h-10:r-6;s.push({type:"text",content:a.label,x:m,y:u,anchor:"middle",fontSize:f.markerFontSize,fill:d});}}else p!=="none"&&s.push({type:"line",x1:m,y1:r,x2:m,y2:l,stroke:d,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:r-6,anchor:"middle",fontSize:f.markerFontSize,fill:d});}return s}function dt(i){let{highlights:e,timeScale:t,yRange:n,height:o}=i;return Z({metrics:i.metrics,timeScale:t,yRange:n,height:o,ranges:e.map(r=>({startTime:r.startTime,endTime:r.endTime,fill:r.color??f.highlightColor,opacity:r.opacity??f.highlightOpacity,label:r.label,labelPosition:r.labelPosition??"top",labelColor:r.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:r.rotate}))})}function ht(i,e,t){let n=(r,[l,s])=>r>=Math.min(l,s)&&r<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let o=t.get(i.axis??0)??t.values().next().value;return !o||n(i.value,o.domain())}function pt(i){let{annotations:e,timeScale:t,valueScales:n,plot:o}=i,r=[],l=a=>!o||ht(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],d=h=>m.push(h);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let c=o!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=c?{clipRect:o}:{};switch(a.type){case "line":{let h=s(a.from),u=s(a.to);d({type:"line",x1:h.x,y1:h.y,x2:u.x,y2:u.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let h=s(a.from),u=s(a.to),b=a.color??f.annotationColor,g=a.headSize??f.annotationHead;d({type:"line",x1:h.x,y1:h.y,x2:u.x,y2:u.y,stroke:b,strokeWidth:a.width??f.annotationWidth});let y=Math.hypot(u.x-h.x,u.y-h.y)||1,x=(u.x-h.x)/y,S=(u.y-h.y)/y,w=u.x-x*g,v=u.y-S*g;d({type:"path",points:[{x:u.x,y:u.y},{x:w-S*g*.5,y:v+x*g*.5},{x:w+S*g*.5,y:v-x*g*.5}],fill:b,stroke:"none"});break}case "rect":{let h=s(a.from),u=s(a.to);d({type:"rect",x:Math.min(h.x,u.x),y:Math.min(h.y,u.y),w:Math.abs(u.x-h.x),h:Math.abs(u.y-h.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let h=s(a.at),u=a.color??"#334155",b=a.radius??f.annotationRadius,g=a.shape??"circle";g==="circle"?d({type:"circle",cx:h.x,cy:h.y,r:b,fill:u}):g==="square"?d({type:"rect",x:h.x-b,y:h.y-b,w:b*2,h:b*2,fill:u}):(d({type:"line",x1:h.x-b,y1:h.y-b,x2:h.x+b,y2:h.y+b,stroke:u,strokeWidth:1.5}),d({type:"line",x1:h.x-b,y1:h.y+b,x2:h.x+b,y2:h.y-b,stroke:u,strokeWidth:1.5}));break}case "label":{let h=s(a.at);d({type:"text",content:a.text,x:h.x+(a.dx??0),y:h.y+(a.dy??0),anchor:a.anchor??ft(h.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let h=oe(a.id);r.push({type:"group",cssClass:`annotation annotation--${h}`,...p,commands:m});}else c&&m.length>0?r.push({type:"group",cssClass:"annotation",...p,commands:m}):r.push(...m);}return r}function ft(i,e,t){let{metrics:n,timeScale:o}=t;if(!n)return "middle";let[r,l]=o.range(),s=n(e,f.annotationFontSize)/2;return i-s<r?"start":i+s>l?"end":"middle"}var ie=class i{_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 i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var ae=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]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let o=i[n],r=i[n+1];for(let l=1;l<=e;l++)t.push(o+(r-o)*l/(e+1));}return t}var G={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},H=class{#e;#t;constructor(e){this.#e=new E({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??G).axisColor}get tickColor(){return (this.#t.colors??G).tickColor}get textColor(){return (this.#t.colors??G).textColor}get textSize(){return (this.#t.colors??G).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??G,n=this.#t.y??0,o=[],[r,l]=this.#e.range();o.push({type:"line",x1:r,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())o.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)o.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),o.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return o}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let o=this.#t.gesamtbreite,r=this.#t.metrics;if(o===void 0||r===void 0)return e;let l=r(t,n)/2;return Math.max(l+2,Math.min(o-l-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function ct(i){return i.map((e,t)=>t+1<i.length&&i[t+1].label===e.label)}var ae=class{#e;#t;constructor(e){this.#e=new R({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let b=this.#t.format??ie;return e.map(g=>({value:g,position:this.#e.map(g),label:b(g)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[o,r]=this.#e.domain(),l=Math.min(o,r),s=Math.max(o,r),a=s-l;if(a===0)return [{value:o,position:this.#e.map(o),label:t(o)}];let m=a/n,d=Math.pow(10,Math.floor(Math.log10(m))),c=m/d,p;if(c<=1.5?p=d:c<=3?p=2*d:c<=7?p=5*d:p=10*d,p<=0||!Number.isFinite(p))return [{value:o,position:this.#e.map(o),label:t(o)}];this.#t.format||(t=b=>ie(b,p));let h=[],u=Math.ceil(l/p)*p;for(let b=u;b<=s;b+=p)h.push({value:b,position:this.#e.map(b),label:t(b)});return h}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,o=this.#t.orientation??"vertical",r=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=c=>l.some(p=>Math.abs(p-c)<=s),m=[];if(o==="vertical"){let[c,p]=this.#e.range();m.push({type:"line",x1:n,y1:c,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let h=ct(e);e.forEach((u,b)=>{let g=a(u.position),y=h[b]?{opacity:0}:{};r==="left"?(m.push({type:"line",x1:n-4,y1:u.position,x2:n,y2:u.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:u.label,x:this.#n(n-8,u.label,"end"),y:u.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:u.position,x2:n+4,y2:u.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:u.label,x:this.#n(n+8,u.label,"start"),y:u.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[c,p]=this.#e.range();m.push({type:"line",x1:c,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let h of e)m.push({type:"line",x1:h.position,y1:n,x2:h.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:h.label,x:h.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let d=(this.#t.orientation??"vertical")==="vertical";for(let c of this.generateMinorTicks())m.push(d?{type:"line",x1:r==="right"?n:n-2,y1:c,x2:r==="right"?n+2:n,y2:c,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:c,y1:n,x2:c,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let o=this.#t.gesamtbreite,r=this.#t.metrics;if(o===void 0||r===void 0)return e;let l=r(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(o-2,e)):Math.min(o-l-2,Math.max(2,e))}};var se=class i{#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,l)=>r.time-l.time),o=[];for(let r=0;r<n.length;r++){let l=Math.max(0,r-t+1),s=n.slice(l,r+1),a=s.reduce((m,d)=>m+d.value,0)/s.length;o.push({time:n[r].time,value:a});}return o}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let o=2/(t+1),r=[],l=n[0].value;r.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*o+l*(1-o),r.push({time:n[s].time,value:l});return r}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.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 le=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 z({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((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),d=this.#e.map(a),c=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:d,color:c,isGap:r.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.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:f.textSize,fill:o.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var M=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var me=class extends M{#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,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,o=e.gapThreshold??f.gapThreshold,r=e.id,l=w.getRuns(this.data,c=>c.value===null,o),s=l.reduce((c,p)=>c+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(c=>({data:c})),d=[];return d.push(...L(m,a,{...t,id:r?`${r}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&d.push(...Q(l.flat(),a,{...t,id:r?`${r}-marker`:void 0},()=>t.stroke)),d}};var ue=class extends M{#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),l=e.map(t[o].value);o===0?n.push({x:r,y:l}):n.push({x:r,y:n[n.length-1].y},{x:r,y:l});}return n}render(){let e=w.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 q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends M{#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??f.bandFill,n=e.hatch,o=e.avgLine??false,r=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),d=e.valueScale.map(a.max),c=e.valueScale.map(a.min),p=l,h=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:d,w:p,h:c-d,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${h}`:void 0}),o&&a.avg!==null){let u=e.valueScale.map(a.avg);s.push({type:"line",x1:m-p/2,y1:u,x2:m+p/2,y2:u,stroke:r,strokeWidth:1,id:this.id?`${this.id}-avg-${h}`:void 0});}}return s}};function Le(i,e,t,n,o,r,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:w.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>o},{id:r,...l})}var de=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,o=e.avgColor??f.avgColor,r=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=w.getRuns(this.data,u=>u.min===null||u.max===null||u.avg===null);if(m.length===0)return [];let d={timeScale:this.timeScale,valueScale:e.valueScale},c=[];m.forEach((u,b)=>{if(u.length<2)return;let g=y=>this.id?`${this.id}-${y}-${b}`:void 0;if(e.fillToMax){let y=Le(u,d,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:l,smoothingType:s});c.push(...y);}if(e.fillToMin){let y=Le(u,d,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:l,smoothingType:s});c.push(...y);}});let p=m.filter(u=>u.length>=2),h=(u,b,g,y=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:u(S)}))})),d,{stroke:b,strokeWidth:a,smoothing:l,smoothingType:s,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return c.push(...h(u=>u.max,n,"max"),...h(u=>u.min,t,"min"),...h(u=>u.avg,o,"avg",r)),c}};var De=1,dt="#6b728044";var _e=4;function ht(i,e="last"){let t=[...i].sort((r,l)=>r.time-l.time||r.index-l.index),n=[],o=r=>n.every(l=>r.right+_e<=l.left||l.right+_e<=r.left);t.length>0&&n.push(e==="first"?t[0]:t[t.length-1]);for(let r of t)r!==n[0]&&o(r)&&n.push(r);return new Set(n.map(r=>r.index))}function pt(i){let e=typeof i=="object"&&i!==null?i.mode:i,t=typeof i=="object"&&i!==null&&i.keep==="first"?"first":"last";return {fit:e==="fit",keep:t}}var he=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:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});let d=this.#n();if(e.forEach((c,p)=>{let h=this.#t(c);if(!h)return;let{startX:u,w:b}=h,g=u+b/2;if(m.push({type:"rect",x:u,y:s,w:b,h:a,hatch:c.hatch??o,fill:c.fill??dt,stroke:c.stroke,strokeWidth:c.strokeWidth??0,title:c.title}),c.label&&(!d||d.has(p))){let y=c.labelFontSize??10;m.push({type:"text",content:c.label,x:g,y:this.#r(c.labelBaseline,y),anchor:"middle",fontSize:y,fill:c.labelFill??"#333"});}}),r){let c=new H({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:c.render()});}return m}#t(e){let{timeScale:t,xRange:n,minItemWidth:o=0}=this.#e,r=t.map(e.startTime),l=t.map(e.endTime);if(l<n[0]||r>n[1])return null;let s=Math.max(n[0],Math.min(n[1],r)),a=Math.max(n[0],Math.min(n[1],l)),m=Math.max(a-s,De);return o>De&&a-s<o&&(s=(s+a)/2-o/2,m=o),s=Math.max(n[0],s),s+m>n[1]&&(s=Math.max(n[0],n[1]-m)),{startX:s,w:m}}#n(){let{fit:e,keep:t}=pt(this.#e.labels);if(!e)return null;let n=this.#e.metrics??_,o=[];return this.#e.items.forEach((r,l)=>{let s=r.label?this.#t(r):null;if(!s||!r.label)return;let a=s.startX+s.w/2,m=n(r.label,r.labelFontSize??10)/2;o.push({index:l,time:r.startTime,left:a-m,right:a+m});}),ht(o,t)}#r(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 pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:o=false,showMax:r=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:d=f.statsLabelColor}=this.#e,c=ye.compute(e),p=[{name:"min",value:c.min,enabled:o},{name:"max",value:c.max,enabled:r},{name:"avg",value:c.avg,enabled:l},{name:"median",value:c.median,enabled:s}],h=[],[u,b]=n;for(let g of p.filter(y=>y.enabled)){let y=t.map(g.value);h.push({type:"line",x1:u,y1:y,x2:b,y2:y,stroke:m,strokeWidth:1});let x=`${g.name}: ${g.value.toFixed(1)}`;(a==="start"||a==="both")&&h.push({type:"text",content:x,x:u+4,y:y-4,anchor:"start",fontSize:f.statFontSize,fill:d}),(a==="end"||a==="both")&&h.push({type:"text",content:x,x:b-4,y:y-4,anchor:"end",fontSize:f.statFontSize,fill:d}),a==="center"&&h.push({type:"text",content:x,x:(u+b)/2,y:y-4,anchor:"middle",fontSize:f.statFontSize,fill:d});}return h}};var $=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"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 O(this.#e,o).format(new Date(e))}catch{for(let o of this.#t)try{return O(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,l=36e5,s=6e4,a={};return o<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):o<l?(a.minute="2-digit",a.hour="2-digit"):o<r?(a.hour="2-digit",a.minute="2-digit"):o<7*r?(a.weekday="short",a.day="numeric"):o<365*r?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var F=class i{#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 i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var W=class i{#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 i({map:n,showValue:t})}};var ft={time:new $,value:new F,enum:new W};function fe(i,e){let t=D();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function Ae(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function Re(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),o=(i.style?.line&&!Array.isArray(i.style.line)?i.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 Pe(i){let e=i.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 $e(i){return i.style?.gap}function Fe(i){return i.style?.fill}function gt(i){return {lines:Ae(i),fill:Fe(i),markers:Re(i),shadow:Pe(i),gap:$e(i),id:i.style?.id??i.id}}/*!
|
|
27
|
+
</clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let o=i[n],r=i[n+1];for(let l=1;l<=e;l++)t.push(o+(r-o)*l/(e+1));}return t}var G={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},H=class{#e;#t;constructor(e){this.#e=new O({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??G).axisColor}get tickColor(){return (this.#t.colors??G).tickColor}get textColor(){return (this.#t.colors??G).textColor}get textSize(){return (this.#t.colors??G).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??G,n=this.#t.y??0,o=[],[r,l]=this.#e.range();o.push({type:"line",x1:r,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())o.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)o.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),o.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return o}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let o=this.#t.gesamtbreite,r=this.#t.metrics;if(o===void 0||r===void 0)return e;let l=r(t,n)/2;return Math.max(l+2,Math.min(o-l-2,e))}};var R={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function se(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function gt(i){return i.map((e,t)=>t+1<i.length&&i[t+1].label===e.label)}var le=class{#e;#t;constructor(e){this.#e=e.untergrenze===void 0?new _({domain:e.domain,range:e.range}):new Y({domain:e.domain,range:e.range,untergrenze:e.untergrenze}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??R).axisColor}get tickColor(){return (this.#t.colors??R).tickColor}get textColor(){return (this.#t.colors??R).textColor}get textSize(){return (this.#t.colors??R).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let b=this.#t.format??se;return e.map(g=>({value:g,position:this.#e.map(g),label:b(g)}))}let t=this.#t.format??se,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[o,r]=this.#e.domain(),l=Math.min(o,r),s=Math.max(o,r),a=s-l;if(a===0)return [{value:o,position:this.#e.map(o),label:t(o)}];let m=a/n,d=Math.pow(10,Math.floor(Math.log10(m))),c=m/d,p;if(c<=1.5?p=d:c<=3?p=2*d:c<=7?p=5*d:p=10*d,p<=0||!Number.isFinite(p))return [{value:o,position:this.#e.map(o),label:t(o)}];this.#t.format||(t=b=>se(b,p));let h=[],u=Math.ceil(l/p)*p;for(let b=u;b<=s;b+=p)h.push({value:b,position:this.#e.map(b),label:t(b)});return h}generateMinorTicks(){let e=this.#t.minorTickValues;return e?e.map(t=>this.#e.map(t)):U(this.generateTicks().map(t=>t.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??R,n=this.#t.x??0,o=this.#t.orientation??"vertical",r=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=c=>l.some(p=>Math.abs(p-c)<=s),m=[];if(o==="vertical"){let[c,p]=this.#e.range();m.push({type:"line",x1:n,y1:c,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let h=gt(e);e.forEach((u,b)=>{let g=a(u.position),y=h[b]?{opacity:0}:{};r==="left"?(m.push({type:"line",x1:n-4,y1:u.position,x2:n,y2:u.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:u.label,x:this.#n(n-8,u.label,"end"),y:u.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:u.position,x2:n+4,y2:u.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:u.label,x:this.#n(n+8,u.label,"start"),y:u.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[c,p]=this.#e.range();m.push({type:"line",x1:c,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let h of e)m.push({type:"line",x1:h.position,y1:n,x2:h.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:h.label,x:h.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let d=(this.#t.orientation??"vertical")==="vertical";for(let c of this.generateMinorTicks())m.push(d?{type:"line",x1:r==="right"?n:n-2,y1:c,x2:r==="right"?n+2:n,y2:c,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:c,y1:n,x2:c,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let o=this.#t.gesamtbreite,r=this.#t.metrics;if(o===void 0||r===void 0)return e;let l=r(t,(this.#t.colors??R).textSize);return n==="end"?Math.max(l+2,Math.min(o-2,e)):Math.min(o-l-2,Math.max(2,e))}};var me=class i{#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,l)=>r.time-l.time),o=[];for(let r=0;r<n.length;r++){let l=Math.max(0,r-t+1),s=n.slice(l,r+1),a=s.reduce((m,d)=>m+d.value,0)/s.length;o.push({time:n[r].time,value:a});}return o}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let o=2/(t+1),r=[],l=n[0].value;r.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*o+l*(1-o),r.push({time:n[s].time,value:l});return r}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.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 ue=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 E({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((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),d=this.#e.map(a),c=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:d,color:c,isGap:r.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.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:f.textSize,fill:o.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var M=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var ce=class extends M{#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,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,o=e.gapThreshold??f.gapThreshold,r=e.id,l=C.getRuns(this.data,c=>c.value===null,o),s=l.reduce((c,p)=>c+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(c=>({data:c})),d=[];return d.push(...L(m,a,{...t,id:r?`${r}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&d.push(...te(l.flat(),a,{...t,id:r?`${r}-marker`:void 0},()=>t.stroke)),d}};var de=class extends M{#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),l=e.map(t[o].value);o===0?n.push({x:r,y:l}):n.push({x:r,y:n[n.length-1].y},{x:r,y:l});}return n}render(){let e=C.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 Q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var he=class extends M{#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??f.bandFill,n=e.hatch,o=e.avgLine??false,r=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),d=e.valueScale.map(a.max),c=e.valueScale.map(a.min),p=l,h=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:d,w:p,h:c-d,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${h}`:void 0}),o&&a.avg!==null){let u=e.valueScale.map(a.avg);s.push({type:"line",x1:m-p/2,y1:u,x2:m+p/2,y2:u,stroke:r,strokeWidth:1,id:this.id?`${this.id}-avg-${h}`:void 0});}}return s}};function Re(i,e,t,n,o,r,l){return ee(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:ke(e.valueScale),getColor:()=>n,getHatch:()=>o},{id:r,...l})}var pe=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,o=e.avgColor??f.avgColor,r=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=C.getRuns(this.data,u=>u.min===null||u.max===null||u.avg===null);if(m.length===0)return [];let d={timeScale:this.timeScale,valueScale:e.valueScale},c=[];m.forEach((u,b)=>{if(u.length<2)return;let g=y=>this.id?`${this.id}-${y}-${b}`:void 0;if(e.fillToMax){let y=Re(u,d,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:l,smoothingType:s});c.push(...y);}if(e.fillToMin){let y=Re(u,d,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:l,smoothingType:s});c.push(...y);}});let p=m.filter(u=>u.length>=2),h=(u,b,g,y=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:u(S)}))})),d,{stroke:b,strokeWidth:a,smoothing:l,smoothingType:s,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return c.push(...h(u=>u.max,n,"max"),...h(u=>u.min,t,"min"),...h(u=>u.avg,o,"avg",r)),c}};var $e=1,bt="#6b728044";var Fe=4;function yt(i,e="last"){let t=[...i].sort((r,l)=>r.time-l.time||r.index-l.index),n=[],o=r=>n.every(l=>r.right+Fe<=l.left||l.right+Fe<=r.left);t.length>0&&n.push(e==="first"?t[0]:t[t.length-1]);for(let r of t)r!==n[0]&&o(r)&&n.push(r);return new Set(n.map(r=>r.index))}function xt(i){let e=typeof i=="object"&&i!==null?i.mode:i,t=typeof i=="object"&&i!==null&&i.keep==="first"?"first":"last";return {fit:e==="fit",keep:t}}var fe=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:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});let d=this.#n();if(e.forEach((c,p)=>{let h=this.#t(c);if(!h)return;let{startX:u,w:b}=h,g=u+b/2;if(m.push({type:"rect",x:u,y:s,w:b,h:a,hatch:c.hatch??o,fill:c.fill??bt,stroke:c.stroke,strokeWidth:c.strokeWidth??0,title:c.title}),c.label&&(!d||d.has(p))){let y=c.labelFontSize??10;m.push({type:"text",content:c.label,x:g,y:this.#r(c.labelBaseline,y),anchor:"middle",fontSize:y,fill:c.labelFill??"#333"});}}),r){let c=new H({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:c.render()});}return m}#t(e){let{timeScale:t,xRange:n,minItemWidth:o=0}=this.#e,r=t.map(e.startTime),l=t.map(e.endTime);if(l<n[0]||r>n[1])return null;let s=Math.max(n[0],Math.min(n[1],r)),a=Math.max(n[0],Math.min(n[1],l)),m=Math.max(a-s,$e);return o>$e&&a-s<o&&(s=(s+a)/2-o/2,m=o),s=Math.max(n[0],s),s+m>n[1]&&(s=Math.max(n[0],n[1]-m)),{startX:s,w:m}}#n(){let{fit:e,keep:t}=xt(this.#e.labels);if(!e)return null;let n=this.#e.metrics??A,o=[];return this.#e.items.forEach((r,l)=>{let s=r.label?this.#t(r):null;if(!s||!r.label)return;let a=s.startX+s.w/2,m=n(r.label,r.labelFontSize??10)/2;o.push({index:l,time:r.startTime,left:a-m,right:a+m});}),yt(o,t)}#r(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 ge=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:o=false,showMax:r=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:d=f.statsLabelColor}=this.#e,c=Se.compute(e),p=[{name:"min",value:c.min,enabled:o},{name:"max",value:c.max,enabled:r},{name:"avg",value:c.avg,enabled:l},{name:"median",value:c.median,enabled:s}],h=[],[u,b]=n;for(let g of p.filter(y=>y.enabled)){let y=t.map(g.value);h.push({type:"line",x1:u,y1:y,x2:b,y2:y,stroke:m,strokeWidth:1});let x=`${g.name}: ${g.value.toFixed(1)}`;(a==="start"||a==="both")&&h.push({type:"text",content:x,x:u+4,y:y-4,anchor:"start",fontSize:f.statFontSize,fill:d}),(a==="end"||a==="both")&&h.push({type:"text",content:x,x:b-4,y:y-4,anchor:"end",fontSize:f.statFontSize,fill:d}),a==="center"&&h.push({type:"text",content:x,x:(u+b)/2,y:y-4,anchor:"middle",fontSize:f.statFontSize,fill:d});}return h}};var $=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"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 B(this.#e,o).format(new Date(e))}catch{for(let o of this.#t)try{return B(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,l=36e5,s=6e4,a={};return o<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):o<l?(a.minute="2-digit",a.hour="2-digit"):o<r?(a.hour="2-digit",a.minute="2-digit"):o<7*r?(a.weekday="short",a.day="numeric"):o<365*r?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var F=class i{#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 i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var W=class i{#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 i({map:n,showValue:t})}};var St={time:new $,value:new F,enum:new W};function be(i,e){let t=D();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function We(i){let e=i.style?.line;return e===false?[]:e===void 0?[be({},i)]:Array.isArray(e)?e.map(t=>be(t,i)):[be(e,i)]}function je(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),o=(i.style?.line&&!Array.isArray(i.style.line)?i.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 Ie(i){let e=i.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 ze(i){return i.style?.gap}function Be(i){return i.style?.fill}function wt(i){return {lines:We(i),fill:Be(i),markers:je(i),shadow:Ie(i),gap:ze(i),id:i.style?.id??i.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 w=class{static interpolateDataPoint(i,e,t){return {time:i.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{
|
|
46
|
+
*/export{fe as AnnotationBandSeries,E as BandScale,he as BandSeries,ae as Clip,I as CommandBuilder,ue as EnumAxis,W as EnumFormatter,St as Formatters,ie as Layout,ce as LineSeries,_ as LinearScale,pe as MinMaxAvgSeries,me as MovingAvg,K as Renderer,ge as StatsOverlay,de as StepSeries,k as TIME_INTERVALS,H as TimeAxis,$ as TimeFormatter,O as TimeScale,le as ValueAxis,F as ValueFormatter,Le as getHatch,Ae as measureLegend,pt as renderAnnotations,Ge as renderArea,ut as renderGaps,rt as renderGrid,dt as renderHighlights,et as renderLegend,L as renderLine,ct as renderMarkers,te as renderSeriesMarkers,Ee as renderSplitLine,Q as renderStep,st as renderThresholds,ee as renderZonedArea,Be as resolveFill,ze as resolveGap,We as resolveLines,je as resolveMarkers,wt as resolveSeriesStyle,Ie as resolveShadow,oe as slugify,f as theme,Oe as toStepData,J as toStepPoints};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as
|
|
1
|
+
import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AxisScale, f as AnySeries, g as Threshold, H as Highlight, h as Gap, i as GapsConfig, j as Annotation, k as AnnotationBandConfig, S as SmoothingType, l as HatchVariant, T as TimeScale, L as LinearScale, D as DataPoint } from './types-RAg4hLZA.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = "svg" | "canvas" | "none";
|
|
@@ -498,6 +498,34 @@ interface YAxisConfig {
|
|
|
498
498
|
labelOffset?: number;
|
|
499
499
|
/** Override the value domain. `'auto'` lets the chart compute it from data. */
|
|
500
500
|
domain?: [number, number] | "auto";
|
|
501
|
+
/**
|
|
502
|
+
* How the axis divides its range. `'linear'` (default): equal distance for
|
|
503
|
+
* equal differences. `'log'`: equal distance for equal *ratios* — every power
|
|
504
|
+
* of ten gets the same height. Use it for readings that span several orders
|
|
505
|
+
* of magnitude: illuminance (0.1 lx at night, 100,000 lx in the sun),
|
|
506
|
+
* particle counts, vacuum pressure.
|
|
507
|
+
*
|
|
508
|
+
* A logarithmic axis has no zero, so it needs a lower edge: set `min`, or a
|
|
509
|
+
* fixed `domain` whose lower bound is above 0. Without one the axis stays
|
|
510
|
+
* linear and `warnings()` says so.
|
|
511
|
+
*
|
|
512
|
+
* ```ts
|
|
513
|
+
* axes: { left: { scale: 'log', min: 0.1 } }
|
|
514
|
+
* ```
|
|
515
|
+
*
|
|
516
|
+
* Only the picture changes. Averages, bands and every other computed overlay
|
|
517
|
+
* still work on the readings themselves. An axis whose series carry an
|
|
518
|
+
* `enumMap` ignores it.
|
|
519
|
+
*/
|
|
520
|
+
scale?: AxisScale;
|
|
521
|
+
/**
|
|
522
|
+
* Lower edge of a logarithmic axis (`scale: 'log'`), above 0. Readings below
|
|
523
|
+
* it — including 0 and negative ones — are drawn **on** this edge, and
|
|
524
|
+
* `warnings()` reports how many. The edge stays put whatever the data does,
|
|
525
|
+
* so several charts with the same `min` line up. Ignored on a linear axis,
|
|
526
|
+
* and when `domain` is set to fixed bounds (their lower one is the edge).
|
|
527
|
+
*/
|
|
528
|
+
min?: number;
|
|
501
529
|
/**
|
|
502
530
|
* Extra room above and below the data, **in pixels**. Ignored when `domain`
|
|
503
531
|
* is set explicitly — then you decide the range.
|
|
@@ -28,6 +28,8 @@ type FillSide = "above" | "below";
|
|
|
28
28
|
type AxisOrientation = "vertical" | "horizontal";
|
|
29
29
|
/** Vertical axis placement. */
|
|
30
30
|
type AxisPosition = "left" | "right";
|
|
31
|
+
/** How a value axis divides its range (see `YAxisConfig.scale`). */
|
|
32
|
+
type AxisScale = "linear" | "log";
|
|
31
33
|
/**
|
|
32
34
|
* Waagerechte Textausrichtung -- `text-anchor` im SVG.
|
|
33
35
|
*
|
|
@@ -409,10 +411,37 @@ interface LinearScaleConfig {
|
|
|
409
411
|
domain: [number, number];
|
|
410
412
|
range: [number, number];
|
|
411
413
|
}
|
|
412
|
-
/**
|
|
414
|
+
/**
|
|
415
|
+
* Maps numeric data values to pixel coordinates using linear interpolation.
|
|
416
|
+
*
|
|
417
|
+
* Die Skala einer Werteachse. Sie teilt gleichmaessig im ZEICHENWERT, und der
|
|
418
|
+
* ist hier der Wert selbst. Eine Skala, die anders teilt (LogScale unten),
|
|
419
|
+
* ueberschreibt nur `zeichenwert` und `wert`; alles andere bleibt.
|
|
420
|
+
*
|
|
421
|
+
* Wer zwischen zwei Messwerten etwas GEOMETRISCHES ausrechnet -- wo eine
|
|
422
|
+
* Linie eine Grenze kreuzt, wie hoch eine Kurve zu einer fremden Zeit steht --,
|
|
423
|
+
* rechnet im Zeichenwert und geht mit `wert` zurueck. Nur dann liegt der
|
|
424
|
+
* errechnete Punkt auf der gezeichneten Strecke; im Wert gerechnet laege er
|
|
425
|
+
* bei jeder nicht-linearen Teilung daneben (I-TGRAF-20261128-01). Was eine
|
|
426
|
+
* Aussage ueber die Messwerte ist -- ein Mittelwert, ein Abstand in Einheiten
|
|
427
|
+
* --, rechnet weiter im Wert.
|
|
428
|
+
*
|
|
429
|
+
* Gegenstueck: LinearScale in go-time-graph/pkg/core/scale.go.
|
|
430
|
+
*/
|
|
413
431
|
declare class LinearScale implements Scale {
|
|
414
432
|
#private;
|
|
415
433
|
constructor(config: LinearScaleConfig);
|
|
434
|
+
/** Wert -> Zeichenwert: der Raum, in dem die Achse gleichmaessig teilt. */
|
|
435
|
+
zeichenwert(value: number): number;
|
|
436
|
+
/** Zeichenwert -> Wert, der Rueckweg von `zeichenwert`. */
|
|
437
|
+
wert(zeichenwert: number): number;
|
|
438
|
+
/**
|
|
439
|
+
* Der Zeichenwert eines RANDES der Domain. Dasselbe wie `zeichenwert`,
|
|
440
|
+
* solange die Skala nichts klemmt -- die logarithmische klemmt Werte auf ihre
|
|
441
|
+
* Untergrenze, ihre Raender aber nicht: die Domain darf um ein Polster
|
|
442
|
+
* darunter reichen.
|
|
443
|
+
*/
|
|
444
|
+
protected randZeichenwert(rand: number): number;
|
|
416
445
|
map(value: unknown): number;
|
|
417
446
|
invert(pixel: number): number;
|
|
418
447
|
domain(): [number, number];
|
|
@@ -1293,5 +1322,5 @@ interface AnnotationBandConfig {
|
|
|
1293
1322
|
labels?: AnnotationBandLabels;
|
|
1294
1323
|
}
|
|
1295
1324
|
|
|
1296
|
-
export { LinearScale as L, TimeScale as T,
|
|
1297
|
-
export type {
|
|
1325
|
+
export { LinearScale as L, TimeScale as T, TIME_INTERVALS as aA, getHatch as aC, getLineStyle as ad, resolveDash as ae, BandScale as am };
|
|
1326
|
+
export type { LineStyle as $, AxisPosition as A, AnnotationKind as B, AxisOrientation as C, DataPoint as D, DataPointRef as E, FillSpec as F, GridLayer as G, Highlight as H, EnumMap as I, FillBound as J, FillRegion as K, MarkerLineStyle as M, FillSide as N, FillStyle as O, PointStyleType as P, FillWhere as Q, RangeLabelPosition as R, SmoothingType as S, GapBand as U, GapConfig as V, GapLabel as W, GapRegion as X, GapStyle as Y, GapsAtEnd as Z, LineShape as _, DrawCommand as a, MarkerStyle as a0, MovingAverageType as a1, SVGLineStyle as a2, SensorType as a3, SeriesGapStyle as a4, SeriesGaps as a5, SeriesLegend as a6, SeriesOverlay as a7, SeriesOverlayKind as a8, SeriesType as a9, TimeScaleConfig as aB, ShadowStyle as aa, SolidDashStyle as ab, ThresholdLabelConfig as ac, LineParams as af, PathParams as ag, RectParams as ah, CircleParams as ai, TextParams as aj, GapParams as ak, Point as al, BandScaleConfig as an, Dashstyle_t as ao, DomainScaleConfig as ap, DrawCircle as aq, DrawGap as ar, DrawGapType_t$1 as as, DrawLine as at, DrawPath as au, DrawRect as av, DrawText as aw, LinearScaleConfig as ax, Scale as ay, ScaleConfig as az, LineDashStyle as b, LineVariant as c, DrawGroup as d, AxisScale as e, AnySeries as f, Threshold as g, Gap as h, GapsConfig as i, Annotation as j, AnnotationBandConfig as k, HatchVariant as l, SeriesStyle as m, TimeSeries as n, ThresholdFill as o, ThresholdLabelPosition as p, AnnotationPointShape as q, LabelAnchor as r, AnnotationBandItem as s, TextBaseline as t, AggregatedPoint as u, AggregatedSeries as v, AggregatedShowAs as w, AggregationConfig as x, AggregationMode as y, AnnotationBandLabels as z };
|
package/options.schema.json
CHANGED
|
@@ -2857,6 +2857,13 @@
|
|
|
2857
2857
|
],
|
|
2858
2858
|
"description": "Configures tick label text colour and font size."
|
|
2859
2859
|
},
|
|
2860
|
+
"min": {
|
|
2861
|
+
"description": "Lower edge of a logarithmic axis (scale \"log\"), above 0. Readings below it -- including 0 and negative ones -- are drawn ON this edge, and warnings() reports how many. Ignored on a linear axis, and when domain is set to fixed bounds (their lower one is the edge).",
|
|
2862
|
+
"type": [
|
|
2863
|
+
"number",
|
|
2864
|
+
"null"
|
|
2865
|
+
]
|
|
2866
|
+
},
|
|
2860
2867
|
"offset": {
|
|
2861
2868
|
"description": "An optional explicit horizontal pixel offset from chart edge (defaults to index * 50px).",
|
|
2862
2869
|
"type": [
|
|
@@ -2883,6 +2890,14 @@
|
|
|
2883
2890
|
],
|
|
2884
2891
|
"type": "string"
|
|
2885
2892
|
},
|
|
2893
|
+
"scale": {
|
|
2894
|
+
"description": "How the axis divides its range. \"linear\" (default): equal distance for equal differences. \"log\": equal distance for equal ratios -- every power of ten gets the same height. For readings that span several orders of magnitude: illuminance, particle counts, vacuum pressure. A logarithmic axis has no zero and needs a lower edge: set min, or a fixed domain whose lower bound is above 0. Without one the axis stays linear and warnings() says so. Only the picture changes; computed overlays still work on the readings. An axis whose series carry an enumMap ignores it.",
|
|
2895
|
+
"enum": [
|
|
2896
|
+
"linear",
|
|
2897
|
+
"log"
|
|
2898
|
+
],
|
|
2899
|
+
"type": "string"
|
|
2900
|
+
},
|
|
2886
2901
|
"tickFormat": {
|
|
2887
2902
|
"anyOf": [
|
|
2888
2903
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-time-graph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "TypeScript library for time-series charts with rich contextual annotation — telemetry, sensors, metrics, logs, finance. DOM-free SVG output, identical in the browser and on the server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -85,7 +85,7 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
85
85
|
|
|
86
86
|
| Task | File |
|
|
87
87
|
| --- | --- |
|
|
88
|
-
| Several series, a second or third value axis, `axisGroups`, axis titles and `labelOffset`, margins, grid, minor ticks, time zone | [reference/axes.md](reference/axes.md) |
|
|
88
|
+
| Several series, a second or third value axis, `axisGroups`, axis titles and `labelOffset`, margins, grid, minor ticks, a logarithmic axis (`scale: 'log'`, light sensors), time zone | [reference/axes.md](reference/axes.md) |
|
|
89
89
|
| Threshold lines and zone colouring, filled areas between curve and threshold or between two series, `where`, `divergenceExcursions` | [reference/thresholds-and-fills.md](reference/thresholds-and-fills.md) |
|
|
90
90
|
| Missing data (`value: null`), gap regions and labels, `gaps.atEnd` for a device that went quiet, `holdToEnd` for a sensor that reports only on change | [reference/gaps.md](reference/gaps.md) |
|
|
91
91
|
| Arrows, labels and rectangles in data coordinates, time-range highlights, status bands (short events in long windows: `minItemWidth`), markers | [reference/annotations-and-markers.md](reference/annotations-and-markers.md) |
|
|
@@ -96,6 +96,7 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
96
96
|
|
|
97
97
|
## Traps (Read Before Coding)
|
|
98
98
|
|
|
99
|
+
- **There are no bar or column charts:** `seriesType` is `'line'`, `'area'` or `'step'` — nothing draws separate bars, groups them side by side or stacks them. For counts per interval (messages per 15 minutes, events per hour) use `seriesType: 'step'` with `style.fill`; it reads like a histogram, and several series overlay cleanly. Do not fake bars out of rectangle annotations.
|
|
99
100
|
- **Timestamps are numbers, not Date objects:** `time` is always milliseconds since Unix epoch (`number`). Passing a `Date` object fails typechecking or evaluates to `NaN`.
|
|
100
101
|
- **Margins are fixed unless you measure them:** The chart draws into `margin` (default `{ top: 20, right: 20, bottom: 40, left: 60 }`). A right Y-axis or a formatted unit (`120.5 °C`) does not fit into `right: 20`, and a clipped number is a wrong number (`120` clipped to `20`). Use `margin: 'auto'` — it measures the labels the chart actually draws (no DOM, a few ms), also in JSON for the Go port, the CLI and the PDF; `autoMargin(options)` returns the same numbers if you need them — or set the margins yourself.
|
|
101
102
|
- **Something you configured does not show up — ask `chart.warnings()`.** Drawing never throws for a threshold name with a typo, a fill bound naming an unknown series, `side` where it is ignored, two series sharing an id, or a deprecated field; it just leaves the thing out. `warnings()` (Go: `Warnings()`, same texts) lists exactly these. Thresholds are found by `id`, and by `name` only when they have no `id`.
|
|
@@ -68,6 +68,41 @@ travel in JSON, so the server cannot run yours. Same chart, two renderers, two l
|
|
|
68
68
|
the browser is the only renderer; use a generated table when both have to agree. `estimateMetrics`
|
|
69
69
|
(exported) reproduces the layout of versions before 1.10.0.
|
|
70
70
|
|
|
71
|
+
## Logarithmic value axis — `scale: 'log'`
|
|
72
|
+
For readings that span several orders of magnitude: illuminance (0.1 lx at night, 100,000 lx in
|
|
73
|
+
the sun), particle counts, vacuum pressure, concentrations. Every power of ten gets the same
|
|
74
|
+
height.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
axes: { left: { scale: 'log', min: 0.1 } }
|
|
78
|
+
axes: { left: { scale: 'log', domain: [1, 100000] } } // both edges fixed
|
|
79
|
+
axes: { left: { scale: 'log', min: 0.1, ticks: { minor: 1 }, grid: { major: {}, minor: {} } } }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **`min` is required** (or a fixed `domain` whose lower bound is above 0). A logarithmic axis
|
|
83
|
+
has no zero. Without a lower edge the axis **stays linear** and `chart.warnings()` says so —
|
|
84
|
+
the chart does not throw.
|
|
85
|
+
- **Readings below `min` — also 0 and negative ones — are drawn on the edge.** `warnings()`
|
|
86
|
+
reports how many. The edge does not move with the data, so tiles with the same `min` line up;
|
|
87
|
+
the upper edge follows the largest reading unless `domain` fixes it.
|
|
88
|
+
- **Only the picture changes.** Overlays (`movingAverage`, `stdDevBand`, `movingMkt`), aggregated
|
|
89
|
+
min/max/avg and everything in `ml-time-graph/analyze` still compute on the readings. Do not
|
|
90
|
+
take logarithms of your data first — the average of logarithms is not the logarithm of the
|
|
91
|
+
average.
|
|
92
|
+
- **Ticks:** one labelled tick per decade (0.1, 1, 10, 100, 1k, 10k); with far more decades than
|
|
93
|
+
`ticks.major` (default 6) every second or third. Under three decades: 1, 2 and 5 per decade.
|
|
94
|
+
Any `ticks.minor` above 0 (or a `grid.minor`) adds the unlabelled ticks at 2…9 of each decade —
|
|
95
|
+
the count is not used, they are never evenly spaced.
|
|
96
|
+
- **Labels are yours as on any axis:** `format: (v) => …` or `tickFormat: { unit, decimals }`.
|
|
97
|
+
The default writes `0.1`, `1`, `10`, `1k`, `1M`, and `1e-7` below a thousandth. `tickFormat`
|
|
98
|
+
applies the same `decimals` to every tick, so prefer `decimals: 0` or `format` on an axis
|
|
99
|
+
that runs from 0.1 to 100,000.
|
|
100
|
+
- Thresholds, zone colours, fills and markers work unchanged and sit on the drawn line. One
|
|
101
|
+
exception to know: `fill.where.exceeds` compares in units of the reading ("more than 50 lx
|
|
102
|
+
apart"), not in ratios.
|
|
103
|
+
- Per axis, not per chart: `axes.y[i].scale`. An axis whose series carry an `enumMap` ignores it
|
|
104
|
+
(`warnings()` reports that too). Same option in JSON for the Go port, the CLI and the PDF.
|
|
105
|
+
|
|
71
106
|
## Grid
|
|
72
107
|
`axes: { x: { grid: true } }` — a grid in both directions; one axis is enough. `grid: false` on
|
|
73
108
|
the other axis leaves that direction out; a `false` alone switches nothing on. `true` is short for
|