ml-time-graph 1.22.0 → 1.24.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 +30 -0
- package/GRAPH_JSON_STRUCTURE.md +6 -4
- package/README.de.md +3 -0
- package/README.md +3 -0
- package/USAGE.md +11 -3
- package/dist/index.d.ts +14 -6
- package/dist/index.js +21 -21
- package/dist/internals.d.ts +5 -4
- package/dist/internals.js +12 -12
- package/dist/{marker_renderer-tiiLQTL8.d.ts → marker_renderer-Dph9cKDY.d.ts} +9 -1
- package/dist/{types-Bo9798aK.d.ts → types-B9bbJxmn.d.ts} +39 -10
- package/package.json +1 -1
- package/skills/ml-time-graph/SKILL.md +3 -3
- package/skills/ml-time-graph/reference/annotations-and-markers.md +2 -0
- package/skills/ml-time-graph/reference/legend.md +4 -0
- package/skills/ml-time-graph/reference/thresholds-and-fills.md +3 -0
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-Dph9cKDY.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-Dph9cKDY.js';
|
|
4
|
+
import { a as DrawCommand, L as LinearScale, T as TimeScale, ae as LineParams, af as PathParams, ag as RectParams, ah as CircleParams, ai as TextParams, aj as GapParams, d as DrawGroup, B as AxisOrientation, A as AxisPosition, ak as Point, al as BandScale } from './types-B9bbJxmn.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 { am as BandScaleConfig, an as Dashstyle_t, ao as DomainScaleConfig, ap as DrawCircle, aq as DrawGap, ar as DrawGapType_t, as as DrawLine, at as DrawPath, au as DrawRect, av as DrawText, q as LabelAnchor, aw as LinearScaleConfig, ax as Scale, ay as ScaleConfig, az as TIME_INTERVALS, aA as TimeScaleConfig, aB as getHatch } from './types-B9bbJxmn.js';
|
|
7
7
|
import { DataPoint as DataPoint$1 } from './analyze/index.js';
|
|
8
8
|
|
|
9
9
|
/*!
|
|
@@ -805,6 +805,7 @@ declare class AnnotationBandSeries {
|
|
|
805
805
|
background?: string;
|
|
806
806
|
hatch?: HatchVariant;
|
|
807
807
|
labels?: AnnotationBandLabels;
|
|
808
|
+
minItemWidth?: number;
|
|
808
809
|
metrics?: TextMetrics;
|
|
809
810
|
}, xRange: [number, number], y: number, height: number);
|
|
810
811
|
/** Render the band as colored rects with labels, optionally with a time axis. */
|
package/dist/internals.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var Z=class{};var T=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=(r,o)=>r!==null&&o!==null?r+t*(o-r):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),r=[],o=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&o.length&&(r.push(o),o=[]),a||o.push(s),l=s;}return o.length&&r.push(o),r}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 r=[...e].sort((m,h)=>m-h),o=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let h=0;for(let d=0;d<r.length&&m>=r[d];d++)h=d+1;return h},a=[i[0]];for(let m=1;m<i.length;m++){let h=i[m-1],d=i[m],p=t(h),c=t(d),u;c>p?u=r.filter(g=>g>p&&g<=c):c<p?u=r.filter(g=>g>=c&&g<p).reverse():u=[];let y=p;for(let g of u){let b=(g-p)/(c-p),x=n(h,d,b);a.push(x);let S=s((y+g)/2);o.push({data:a,zoneIndex:S,zoneLow:l(S)}),a=[x],y=g;}(u.length===0||u[u.length-1]!==c)&&a.push(d);}if(a.length>1||i.length===1){let m=t(a[0]),h=t(a[a.length-1]),d=s((m+h)/2);o.push({data:a,zoneIndex:d,zoneLow:l(d)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let l of r)l.zoneIndex===0?o.below.push(l.data):o.above.push(l.data);return o}};var be=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,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.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 Fe(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 r=T.splitByThreshold(i,e,l=>l.value,T.interpolateDataPoint),o=[];return n.below&&o.push(...L(r.below.map(l=>({data:l})),t,n.below)),n.above&&o.push(...L(r.above.map(l=>({data:l})),t,n.above)),o}function L(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];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-${o}`:void 0,points:s,stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function We(i,e,t,n,r){let o=[],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(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(n(d))})),h=a.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(r(d))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...h],fill:a.color??l.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=T.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let l=0;l<r.length;l++){let s=r[l];if(s.data.length<2)continue;let a=t.getColor(s.zoneIndex);if(!a)continue;let m=s.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(t.yLow(d))})),h=s.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(t.yHigh(d))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${l}`:void 0,points:[...m,...h],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 o}function Q(i,e,t,n){let r=A(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let l=0;l<i.length;l++){let s=i[l],a=e.timeScale.map(s.time),m=e.valueScale.map(s.value),h=n(s),d=t.pointStroke??h,p=t.pointFill??h,c=t.pointStrokeWidth??1.5,u=t.id?`${t.id}-marker-${l}`:void 0;ee(o,u,r.markers.type,a,m,r.markers.size,d,p,c);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,l,s,a){let m=h=>e===void 0?void 0:`${e}-${h}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:l,strokeWidth:a,id:m(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "star":{let h=[];for(let d=0;d<10;d++){let p=d%2===0?o:o*.5,c=Math.PI/2*3+d*Math.PI/5;h.push({x:n+p*Math.cos(c),y:r+p*Math.sin(c)});}i.push({type:"path",points:h,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:l,strokeWidth:a,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "hexagon":{let h=[];for(let d=0;d<6;d++){let p=d*(Math.PI/3);h.push({x:n+o*Math.cos(p),y:r+o*Math.sin(p)});}i.push({type:"path",points:h,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});}}var Be=[[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 Be){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/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 Ie={...ke};function D(){return Ie}function ze(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 Ge(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,r=2){let o=n??ze(t),l=Ge(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
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=(r,o)=>r!==null&&o!==null?r+t*(o-r):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),r=[],o=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&o.length&&(r.push(o),o=[]),a||o.push(s),l=s;}return o.length&&r.push(o),r}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 r=[...e].sort((m,d)=>m-d),o=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let d=0;for(let c=0;c<r.length&&m>=r[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=r.filter(g=>g>p&&g<=h):h<p?u=r.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);o.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);o.push({data:a,zoneIndex:c,zoneLow:l(c)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let l of r)l.zoneIndex===0?o.below.push(l.data):o.above.push(l.data);return o}};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,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.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 r=w.splitByThreshold(i,e,l=>l.value,w.interpolateDataPoint),o=[];return n.below&&o.push(...L(r.below.map(l=>({data:l})),t,n.below)),n.above&&o.push(...L(r.above.map(l=>({data:l})),t,n.above)),o}function L(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=A(t);for(let o=0;o<i.length;o++){let l=i[o];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-${o}`:void 0,points:s,stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Be(i,e,t,n,r){let o=[],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(r(c))})).reverse();o.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 o}function J(i,e,t,n){if(i.length<2)return [];let r=w.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let l=0;l<r.length;l++){let s=r[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();o.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 o}function Q(i,e,t,n){let r=A(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];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(o,u,r.markers.type,a,m,r.markers.size,c,p,h);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,l,s,a){let m=d=>e===void 0?void 0:`${e}-${d}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:l,strokeWidth:a,id:m(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],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?o:o*.5,h=Math.PI/2*3+c*Math.PI/5;d.push({x:n+p*Math.cos(h),y:r+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-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:l,strokeWidth:a,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],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+o*Math.cos(p),y:r+o*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-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,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 r=0;r<n.length;r++)i.set(e+r,Number(n[r])/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,r=2){let o=n??Ge(t),l=He(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>
|
|
5
|
-
`.trim();let s=12,a=12,m="rotate(0)",
|
|
5
|
+
`.trim();let s=12,a=12,m="rotate(0)",d="";switch(e){case "classic-diagonal":m="rotate(45)",d=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":s=6,a=6,m="rotate(30)",d=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":s=14,a=14,m="rotate(45)",d=`
|
|
6
6
|
<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
|
|
7
7
|
<line x1="0" y1="0" x2="${s}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
|
|
8
|
-
`;break;case "dots":
|
|
8
|
+
`;break;case "dots":d=`<circle cx="${s/2}" cy="${a/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":s=16,a=16,d=`
|
|
9
9
|
<path d="M 0 ${a/2} Q ${s/4} 0, ${s/2} ${a/2} T ${s} ${a/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
|
|
10
|
-
`;break;case "dashed":m="rotate(45)",
|
|
10
|
+
`;break;case "dashed":m="rotate(45)",d=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":s=16,a=16,d=`
|
|
11
11
|
<path d="M 0 0 L ${s/2} ${a/2} L 0 ${a} M ${s} 0 L ${s/2} ${a/2} L ${s} ${a}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
|
|
12
|
-
`;break;case "brick":s=20,a=20,
|
|
12
|
+
`;break;case "brick":s=20,a=20,d=`
|
|
13
13
|
<path d="M 0 ${a/2} L ${s} ${a/2} M 0 ${a} L ${s} ${a} M ${s/2} 0 L ${s/2} ${a/2} M 0 ${a/2} L 0 ${a}" fill="none" stroke="${o}" stroke-width="${r}" />
|
|
14
|
-
`;break;case "double-stripe":s=16,a=16,m="rotate(45)",
|
|
14
|
+
`;break;case "double-stripe":s=16,a=16,m="rotate(45)",d=`
|
|
15
15
|
<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
|
|
16
16
|
<line x1="${s/2}" y1="0" x2="${s/2}" y2="${a}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
|
|
17
|
-
`;break;case "honeycomb":s=18,a=32,
|
|
17
|
+
`;break;case "honeycomb":s=18,a=32,d=`
|
|
18
18
|
<path d="M 0 0 L ${s/2} 5 L ${s} 0 M 0 16 L ${s/2} 11 L ${s} 16 M 0 16 L 0 32 M ${s/2} 5 L ${s/2} 11 M ${s} 16 L ${s} 32 M 0 32 L ${s/2} 27 L ${s} 32 M ${s/2} 27 L ${s/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
|
|
19
|
-
`;break}let
|
|
19
|
+
`;break}let c=`<rect width="${s}" height="${a}" fill="${t}"${l} />`;return `
|
|
20
20
|
<pattern id="${i}" width="${s}" height="${a}" patternTransform="${m}" patternUnits="userSpaceOnUse">
|
|
21
|
+
${c}
|
|
21
22
|
${d}
|
|
22
|
-
${h}
|
|
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 He="#ffffff",Ve="#cccccc",Ne=6,Xe=.85,C=12,N=8,O=20,Ye=11,V=18,te=(i,e)=>e(i,Ye);function we(i,e,t){let n=s=>C+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 r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=_,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*O}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:C+N+r,height:i.length*O}}function Ue(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=_,maxBreite:l,box:s,itemClass:a}=i,m=new B;if(s&&e.length>0){let c=ve(e,r,o,l),y=((r==="horizontal"?c.height/O:e.length)-1)*O+C,g=s.padding??Ne,b=s.stroke??Ve;m.rect({x:t-g,y:n-g,w:c.width+2*g,h:y+2*g,fill:s.fill??He,...b==="none"?{}:{stroke:b,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Xe});}let h=r==="horizontal"?we(e,o,l):e.map(c=>({items:[c],breite:0})),d=new Map;h.forEach((c,u)=>{let y=t;for(let g of c.items)d.set(g,{x:y,y:n+u*O}),y+=C+N+te(g.name,o)+V;});let p=e.some(c=>c.line!==void 0&&c.line!=="solid");return e.forEach(c=>{let u=d.get(c)??{x:t,y:n},y=u.x,g=u.y,b=["legend-item"];c.id&&b.push(`legend-item--${c.id}`),a&&b.push(a),m.group({cssClass:b.join(" "),...c.id?{id:`legend-${c.id}`}:{}},x=>{p?x.line({x1:y,y1:g+C/2,x2:y+C,y2:g+C/2,stroke:c.color,strokeWidth:Ze(c.width),...c.line&&c.line!=="solid"?{dash:c.line}:{}}):x.rect({x:y,y:g,w:C,h:C,fill:c.color,stroke:f.legendStroke,strokeWidth:1}),x.text({content:c.name,x:y+C+N,y:g+C-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ze(i){return Math.min(Math.max(i??2,1.5),3)}function Ke(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let h of t)m.push({type:"line",x1:n[0],y1:h,x2:n[1],y2:h,stroke:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let h of e)m.push({type:"line",x1:h,y1:r[0],x2:h,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function qe(i,e){return `${i}|${JSON.stringify(e??{})}`}function I(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,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},w=[{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[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:w[0].ms};let s=l/e,a=w[0].ms;for(let d of w)if(d.ms>=s){a=d.ms;break}let m=a,h=Math.round(l/m);for(;h>n&&m<w[w.length-1].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.min(d+1,w.length-1)].ms,h=Math.round(l/m);}for(;h<t&&m>w[0].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.max(d-1,0)].ms,h=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return I(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 r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(d=>String(d)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Je(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Qe(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),h=[],d=[];for(let p of e){let c=p.color??f.thresholdColor,u=t.map(p.value);p.fill==="above"?h.push({type:"rect",x:r,y:a,w:o-r,h:Math.max(0,u-a),fill:c,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&h.push({type:"rect",x:r,y:u,w:o-r,h:Math.max(0,m-u),fill:c,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let y=p.line??f.thresholdLine;if(y!=="none"){let S=Je(y),k={type:"line",x1:r,y1:u,x2:o,y2:u,stroke:c,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),h.push(k);}let[g,b]=t.domain();if(p.value>=Math.min(g,b)&&p.value<=Math.max(g,b)&&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,v=S?.position??"right",W=nt(k,v,r,o,u,c,S);d.push({...W,y:tt(W.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:h,labels:d}}function et(i){let e=Qe(i);return [...e.inside,...e.labels]}function tt(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function nt(i,e,t,n,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},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:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-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:r,metrics:o=_}=i,[l,s]=n,a=[],[m,h]=t.range(),d=Math.min(m,h),p=Math.max(m,h),c=u=>Math.max(d,Math.min(p,u));for(let u of e){let y=c(t.map(u.startTime)),g=c(t.map(u.endTime));if(u.fill!==void 0&&a.push({type:"rect",x:y,y:l,w:g-y,h:s-l,fill:u.fill,hatch:u.hatch,opacity:u.opacity}),u.edges)for(let b of [y,g])a.push({type:"line",x1:b,y1:l,x2:b,y2:s,stroke:u.edges.stroke,strokeWidth:u.edges.strokeWidth,dash:"dashed"});if(u.label){let b=u.labelPosition??"middle",x=u.rotate,S=true;if(x==="auto"){let k=b!=="above"&&b!=="below",v=o(u.label,u.fontSize??11);x=k&&v>Math.abs(g-y)-4?-90:void 0,S=x===void 0||v<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:u.label,x:(y+g)/2,y:Me(b,l,s,r),anchor:"middle",fontSize:u.fontSize,fill:u.labelColor,rotate:x});}}return a}function rt(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:h=true,fontSize:d=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:c="middle",labelRotate:u,metrics:y,band:g}=i,b=()=>{if(!g)return [];let x=g.height??6,[S,k]=n,v=Math.max(S,k);return e.map(W=>{let ge=t.map(W.startTime),ye=t.map(W.endTime);return {type:"rect",x:Math.min(ge,ye),y:v-x+(g.offset??0),w:Math.abs(ye-ge),h:x,fill:g.fill??a,opacity:g.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:y,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",v=S==="dashed_border"&&h!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??l,opacity:x.fillOpacity??s},...v&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??c,labelColor:p,fontSize:d,rotate:x.rotate??u}})}).concat(b())}function ot(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,l]=r,s=[];for(let a of e){let m=t.map(a.time),h=a.color??f.markerColor,d=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let c=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:c,stroke:h,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:c,stroke:h,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:h,strokeWidth:1}),d!=="none"&&ee(s,void 0,d,m,c,f.markerSize,h,h,1.5),a.label){let u=p==="to-value"?c-10:o-6;s.push({type:"text",content:a.label,x:m,y:u,anchor:"middle",fontSize:f.markerFontSize,fill:h});}}else p!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:h,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:h});}return s}function it(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function at(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function st(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||at(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=[],h=c=>m.push(c);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let d=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=d?{clipRect:r}:{};switch(a.type){case "line":{let c=s(a.from),u=s(a.to);h({type:"line",x1:c.x,y1:c.y,x2:u.x,y2:u.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let c=s(a.from),u=s(a.to),y=a.color??f.annotationColor,g=a.headSize??f.annotationHead;h({type:"line",x1:c.x,y1:c.y,x2:u.x,y2:u.y,stroke:y,strokeWidth:a.width??f.annotationWidth});let b=Math.hypot(u.x-c.x,u.y-c.y)||1,x=(u.x-c.x)/b,S=(u.y-c.y)/b,k=u.x-x*g,v=u.y-S*g;h({type:"path",points:[{x:u.x,y:u.y},{x:k-S*g*.5,y:v+x*g*.5},{x:k+S*g*.5,y:v-x*g*.5}],fill:y,stroke:"none"});break}case "rect":{let c=s(a.from),u=s(a.to);h({type:"rect",x:Math.min(c.x,u.x),y:Math.min(c.y,u.y),w:Math.abs(u.x-c.x),h:Math.abs(u.y-c.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let c=s(a.at),u=a.color??"#334155",y=a.radius??f.annotationRadius,g=a.shape??"circle";g==="circle"?h({type:"circle",cx:c.x,cy:c.y,r:y,fill:u}):g==="square"?h({type:"rect",x:c.x-y,y:c.y-y,w:y*2,h:y*2,fill:u}):(h({type:"line",x1:c.x-y,y1:c.y-y,x2:c.x+y,y2:c.y+y,stroke:u,strokeWidth:1.5}),h({type:"line",x1:c.x-y,y1:c.y+y,x2:c.x+y,y2:c.y-y,stroke:u,strokeWidth:1.5}));break}case "label":{let c=s(a.at);h({type:"text",content:a.text,x:c.x+(a.dx??0),y:c.y+(a.dy??0),anchor:a.anchor??lt(c.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 c=ne(a.id);o.push({type:"group",cssClass:`annotation annotation--${c}`,...p,commands:m});}else d&&m.length>0?o.push({type:"group",cssClass:"annotation",...p,commands:m}):o.push(...m);}return o}function lt(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"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 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 r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=_,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:T+N+r,height:i.length*I}}function Ze(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=_,maxBreite:l,box:s,itemClass:a}=i,m=new B;if(s&&e.length>0){let h=ve(e,r,o,l),b=((r==="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=r==="horizontal"?we(e,o,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,o)+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,r){let o=e.colors&&e.colors.length>=2?e.colors:[e.color],l=T/o.length;if(r){o.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(o.length===1){i.rect({x:t,y:n,w:T,h:T,fill:o[0],stroke:f.legendStroke,strokeWidth:1});return}o.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:r,stroke:o=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:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let d of e)m.push({type:"line",x1:d,y1:r[0],x2:d,y2:r[1],stroke:o,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,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},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[r,o]=this.#e.domain(),l=o-r;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:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)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 r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(c=>String(c)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function 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,[r,o]=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:r,y:a,w:o-r,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:r,y:u,w:o-r,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:r,y1:u,x2:o,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,r,o,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,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},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:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-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:r,metrics:o=_}=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=o(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,r),anchor:"middle",fontSize:u.fontSize,fill:u.labelColor,rotate:x});}}return a}function it(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=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:r,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??o,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:r=[0,300]}=i,[o,l]=r,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:o,x2:m,y2:h,stroke:d,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:o,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:o-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:o,x2:m,y2:l,stroke:d,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:d});}return s}function st(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function lt(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function mt(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||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=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=c?{clipRect:r}:{};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);o.push({type:"group",cssClass:`annotation annotation--${h}`,...p,commands:m});}else c&&m.length>0?o.push({type:"group",cssClass:"annotation",...p,commands:m}):o.push(...m);}return o}function ut(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"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(`
|
|
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 r=i[n],o=i[n+1];for(let l=1;l<=e;l++)t.push(r+(o-r)*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,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??G,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.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 r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,n)/2;return Math.max(l+2,Math.min(r-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 mt(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}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 y=this.#t.format??ie;return e.map(g=>({value:g,position:this.#e.map(g),label:y(g)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=a/n,h=Math.pow(10,Math.floor(Math.log10(m))),d=m/h,p;if(d<=1.5?p=h:d<=3?p=2*h:d<=7?p=5*h:p=10*h,p<=0||!Number.isFinite(p))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=y=>ie(y,p));let c=[],u=Math.ceil(l/p)*p;for(let y=u;y<=s;y+=p)c.push({value:y,position:this.#e.map(y),label:t(y)});return c}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,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=d=>l.some(p=>Math.abs(p-d)<=s),m=[];if(r==="vertical"){let[d,p]=this.#e.range();m.push({type:"line",x1:n,y1:d,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let c=mt(e);e.forEach((u,y)=>{let g=a(u.position),b=c[y]?{opacity:0}:{};o==="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,...b})):(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,...b}));});}else {let[d,p]=this.#e.range();m.push({type:"line",x1:d,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let c of e)m.push({type:"line",x1:c.position,y1:n,x2:c.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:c.label,x:c.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let h=(this.#t.orientation??"vertical")==="vertical";for(let d of this.generateMinorTicks())m.push(h?{type:"line",x1:o==="right"?n:n-2,y1:d,x2:o==="right"?n+2:n,y2:d,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:d,y1:n,x2:d,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-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(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,h)=>m+h.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}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 r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}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,r)=>n-r).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:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),h=this.#e.map(a),d=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:h,color:d,isGap:o.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 r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.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,r=e.gapThreshold??f.gapThreshold,o=e.id,l=T.getRuns(this.data,d=>d.value===null,r),s=l.reduce((d,p)=>d+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(d=>({data:d})),h=[];return h.push(...L(m,a,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&h.push(...Q(l.flat(),a,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),h}};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(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return 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,r=e.avgLine??false,o=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),h=e.valueScale.map(a.max),d=e.valueScale.map(a.min),p=l,c=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:h,w:p,h:d-h,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${c}`:void 0}),r&&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:o,strokeWidth:1,id:this.id?`${this.id}-avg-${c}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...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,r=e.avgColor??f.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=T.getRuns(this.data,u=>u.min===null||u.max===null||u.avg===null);if(m.length===0)return [];let h={timeScale:this.timeScale,valueScale:e.valueScale},d=[];m.forEach((u,y)=>{if(u.length<2)return;let g=b=>this.id?`${this.id}-${b}-${y}`:void 0;if(e.fillToMax){let b=Le(u,h,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:l,smoothingType:s});d.push(...b);}if(e.fillToMin){let b=Le(u,h,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:l,smoothingType:s});d.push(...b);}});let p=m.filter(u=>u.length>=2),c=(u,y,g,b=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:u(S)}))})),h,{stroke:y,strokeWidth:a,smoothing:l,smoothingType:s,dashed:b,id:this.id?`${this.id}-${g}`:void 0});return d.push(...c(u=>u.max,n,"max"),...c(u=>u.min,t,"min"),...c(u=>u.avg,r,"avg",o)),d}};var ut=1,De=4;function ct(i,e="last"){let t=[...i].sort((o,l)=>o.time-l.time||o.index-l.index),n=[],r=o=>n.every(l=>o.right+De<=l.left||l.right+De<=o.left);t.length>0&&n.push(e==="first"?t[0]:t[t.length-1]);for(let o of t)o!==n[0]&&r(o)&&n.push(o);return new Set(n.map(o=>o.index))}function dt(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,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,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 h=this.#n();if(e.forEach((d,p)=>{let c=this.#t(d);if(!c)return;let{startX:u,w:y}=c,g=u+y/2;if(m.push({type:"rect",x:u,y:s,w:y,h:a,hatch:d.hatch??r,fill:d.fill??"#6b728044",stroke:d.stroke,strokeWidth:d.strokeWidth??0,title:d.title}),d.label&&(!h||h.has(p))){let b=d.labelFontSize??10;m.push({type:"text",content:d.label,x:g,y:this.#r(d.labelBaseline,b),anchor:"middle",fontSize:b,fill:d.labelFill??"#333"});}}),o){let d=new H({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:d.render()});}return m}#t(e){let{timeScale:t,xRange:n}=this.#e,r=t.map(e.startTime),o=t.map(e.endTime);if(o<n[0]||r>n[1])return null;let l=Math.max(n[0],Math.min(n[1],r)),s=Math.max(n[0],Math.min(n[1],o)),a=Math.max(s-l,ut);return l+a>n[1]&&(l=Math.max(n[0],n[1]-a)),{startX:l,w:a}}#n(){let{fit:e,keep:t}=dt(this.#e.labels);if(!e)return null;let n=this.#e.metrics??_,r=[];return this.#e.items.forEach((o,l)=>{let s=o.label?this.#t(o):null;if(!s||!o.label)return;let a=s.startX+s.w/2,m=n(o.label,o.labelFontSize??10)/2;r.push({index:l,time:o.startTime,left:a-m,right:a+m});}),ct(r,t)}#r(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:h=f.statsLabelColor}=this.#e,d=be.compute(e),p=[{name:"min",value:d.min,enabled:r},{name:"max",value:d.max,enabled:o},{name:"avg",value:d.avg,enabled:l},{name:"median",value:d.median,enabled:s}],c=[],[u,y]=n;for(let g of p.filter(b=>b.enabled)){let b=t.map(g.value);c.push({type:"line",x1:u,y1:b,x2:y,y2:b,stroke:m,strokeWidth:1});let x=`${g.name}: ${g.value.toFixed(1)}`;(a==="start"||a==="both")&&c.push({type:"text",content:x,x:u+4,y:b-4,anchor:"start",fontSize:f.statFontSize,fill:h}),(a==="end"||a==="both")&&c.push({type:"text",content:x,x:y-4,y:b-4,anchor:"end",fontSize:f.statFontSize,fill:h}),a==="center"&&c.push({type:"text",content:x,x:(u+y)/2,y:b-4,anchor:"middle",fontSize:f.statFontSize,fill:h});}return c}};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 r=this.#n&&n?this.#r(e,n,t):t;return I(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return I(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(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 j=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((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var ht={time:new $,value:new F,enum:new j};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 _e(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 Ae(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),r=(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??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Re(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 Pe(i){return i.style?.gap}function $e(i){return i.style?.fill}function pt(i){return {lines:_e(i),fill:$e(i),markers:Ae(i),shadow:Re(i),gap:Pe(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 r=i[n],o=i[n+1];for(let l=1;l<=e;l++)t.push(r+(o-r)*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,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??G,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.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 r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,n)/2;return Math.max(l+2,Math.min(r-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){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}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,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];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:r,position:this.#e.map(r),label:t(r)}];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,r=this.#t.orientation??"vertical",o=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(r==="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}:{};o==="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:o==="right"?n:n-2,y1:c,x2:o==="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 r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-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(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,d)=>m+d.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}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 r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}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,r)=>n-r).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:r}=this.#n,o=new Set(r??[]);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:o.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 r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.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,r=e.gapThreshold??f.gapThreshold,o=e.id,l=w.getRuns(this.data,c=>c.value===null,r),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:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&d.push(...Q(l.flat(),a,{...t,id:o?`${o}-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(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=w.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return 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,r=e.avgLine??false,o=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}),r&&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:o,strokeWidth:1,id:this.id?`${this.id}-avg-${h}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:w.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...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,r=e.avgColor??f.avgColor,o=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,r,"avg",o)),c}};var De=1,dt="#6b728044";var _e=4;function ht(i,e="last"){let t=[...i].sort((o,l)=>o.time-l.time||o.index-l.index),n=[],r=o=>n.every(l=>o.right+_e<=l.left||l.right+_e<=o.left);t.length>0&&n.push(e==="first"?t[0]:t[t.length-1]);for(let o of t)o!==n[0]&&r(o)&&n.push(o);return new Set(n.map(o=>o.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,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,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??r,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"});}}),o){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:r=0}=this.#e,o=t.map(e.startTime),l=t.map(e.endTime);if(l<n[0]||o>n[1])return null;let s=Math.max(n[0],Math.min(n[1],o)),a=Math.max(n[0],Math.min(n[1],l)),m=Math.max(a-s,De);return r>De&&a-s<r&&(s=(s+a)/2-r/2,m=r),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??_,r=[];return this.#e.items.forEach((o,l)=>{let s=o.label?this.#t(o):null;if(!s||!o.label)return;let a=s.startX+s.w/2,m=n(o.label,o.labelFontSize??10)/2;r.push({index:l,time:o.startTime,left:a-m,right:a+m});}),ht(r,t)}#r(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=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:r},{name:"max",value:c.max,enabled:o},{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 r=this.#n&&n?this.#r(e,n,t):t;return O(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return O(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(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((r,o)=>{n[o]=r;}),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(),r=(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??r,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}}/*!
|
|
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 T=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{he as AnnotationBandSeries,z as BandScale,ce as BandSeries,oe as Clip,B as CommandBuilder,le as EnumAxis,
|
|
46
|
+
*/export{he as AnnotationBandSeries,z as BandScale,ce as BandSeries,oe as Clip,B as CommandBuilder,le as EnumAxis,W as EnumFormatter,ft as Formatters,re as Layout,me as LineSeries,R as LinearScale,de as MinMaxAvgSeries,se as MovingAvg,Z as Renderer,pe as StatsOverlay,ue as StepSeries,v as TIME_INTERVALS,H as TimeAxis,$ as TimeFormatter,E as TimeScale,ae as ValueAxis,F as ValueFormatter,Te as getHatch,ve as measureLegend,mt as renderAnnotations,Be as renderArea,it as renderGaps,Je as renderGrid,st as renderHighlights,Ze as renderLegend,L as renderLine,at as renderMarkers,Q as renderSeriesMarkers,je as renderSplitLine,q as renderStep,nt as renderThresholds,J as renderZonedArea,Fe as resolveFill,$e as resolveGap,Ae as resolveLines,Re as resolveMarkers,gt as resolveSeriesStyle,Pe as resolveShadow,ne as slugify,f as theme,We as toStepData,K 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 AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, S as SmoothingType, k as HatchVariant, T as TimeScale, L as LinearScale, D as DataPoint } from './types-
|
|
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 AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, S as SmoothingType, k as HatchVariant, T as TimeScale, L as LinearScale, D as DataPoint } from './types-B9bbJxmn.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = "svg" | "canvas" | "none";
|
|
@@ -356,6 +356,14 @@ interface LegendItem {
|
|
|
356
356
|
* Draw it with `drawMarker()`.
|
|
357
357
|
*/
|
|
358
358
|
marker?: Exclude<PointStyleType, "none">;
|
|
359
|
+
/**
|
|
360
|
+
* The section colours when the swatch is multi-coloured
|
|
361
|
+
* (`series.legend.colors`) -- for a series coloured by thresholds, whose base
|
|
362
|
+
* colour alone would name only its lowest zone. Draw them as stripes side by
|
|
363
|
+
* side. {@link color} stays the base colour, so a legend of your own that
|
|
364
|
+
* reads only `color` does not change.
|
|
365
|
+
*/
|
|
366
|
+
colors?: string[];
|
|
359
367
|
}
|
|
360
368
|
/** Layout direction for legend items. */
|
|
361
369
|
type LegendOrientation = "vertical" | "horizontal";
|
|
@@ -60,7 +60,7 @@ type MarkerLineStyle = "full" | "to-value" | "to-top" | "none";
|
|
|
60
60
|
* display === "bridge_line" ? undefined : display`). Was der Aufrufer bestellen
|
|
61
61
|
* kann, steht in GapStyle.display und hat einen Wert mehr.
|
|
62
62
|
*/
|
|
63
|
-
type DrawGapType_t$1 = "dashed_border" | "empty" | "filled"
|
|
63
|
+
type DrawGapType_t$1 = "dashed_border" | "empty" | "filled";
|
|
64
64
|
/**
|
|
65
65
|
* Verlauf einer Linie zwischen zwei Punkten: gerade oder als Treppe.
|
|
66
66
|
*
|
|
@@ -311,7 +311,7 @@ interface DrawText {
|
|
|
311
311
|
/** Optional SVG `id` attribute for this element. */
|
|
312
312
|
id?: string;
|
|
313
313
|
}
|
|
314
|
-
type DrawGapType_t = "dashed_border" | "empty" | "filled"
|
|
314
|
+
type DrawGapType_t = "dashed_border" | "empty" | "filled";
|
|
315
315
|
interface DrawGap {
|
|
316
316
|
type: "gap";
|
|
317
317
|
x1: number;
|
|
@@ -771,7 +771,7 @@ interface GapsConfig {
|
|
|
771
771
|
interface LineStyle {
|
|
772
772
|
/** Stroke colour. */
|
|
773
773
|
color?: string;
|
|
774
|
-
/** Stroke width in px. */
|
|
774
|
+
/** Stroke width in px. `0` draws no line; markers stay. */
|
|
775
775
|
width?: number;
|
|
776
776
|
/** Stroke variant (`solid` / `dashed` / `dotted` / …). */
|
|
777
777
|
style?: LineVariant;
|
|
@@ -929,6 +929,23 @@ type SensorType = "numeric" | "enum";
|
|
|
929
929
|
interface EnumMap {
|
|
930
930
|
[key: number]: string;
|
|
931
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* How the legend shows a series (I-TGRAF-20261106-02).
|
|
934
|
+
*
|
|
935
|
+
* Anlass (mlcsensormonitor): Eine Reihe mit `colorByThresholds` -- unten blau,
|
|
936
|
+
* im Bereich gruen, oben rot -- bekam in der Legende nur ihre Grundfarbe, und
|
|
937
|
+
* das ist die des UNTERSTEN Bereichs. Neben einer gruenen Kurve stand ein
|
|
938
|
+
* blaues Kaestchen. Gegenstueck: SeriesLegend in
|
|
939
|
+
* go-time-graph/pkg/models/series_legend.go.
|
|
940
|
+
*/
|
|
941
|
+
interface SeriesLegend {
|
|
942
|
+
/**
|
|
943
|
+
* Draw the legend swatch in several sections side by side, left to right in
|
|
944
|
+
* this order -- e.g. the zone colours of a series coloured by thresholds.
|
|
945
|
+
* Without it (or with a single colour) the swatch stays one colour.
|
|
946
|
+
*/
|
|
947
|
+
colors?: string[];
|
|
948
|
+
}
|
|
932
949
|
/** Raw series (numeric or enum) */
|
|
933
950
|
interface TimeSeries {
|
|
934
951
|
name: string;
|
|
@@ -962,6 +979,8 @@ interface TimeSeries {
|
|
|
962
979
|
colorByThresholds?: string[];
|
|
963
980
|
/** Optional SVG id prefix for series elements. */
|
|
964
981
|
id?: string;
|
|
982
|
+
/** How the legend shows this series -- see {@link SeriesLegend}. */
|
|
983
|
+
legend?: SeriesLegend;
|
|
965
984
|
/** Luecken je Reihe -- etwa `atEnd: false` fuer einen Melder, der absichtlich schweigt. */
|
|
966
985
|
gaps?: SeriesGaps;
|
|
967
986
|
/**
|
|
@@ -1012,6 +1031,8 @@ interface AggregatedSeries {
|
|
|
1012
1031
|
fillToMinHatch?: HatchVariant;
|
|
1013
1032
|
/** Optional SVG id prefix for series elements. */
|
|
1014
1033
|
id?: string;
|
|
1034
|
+
/** How the legend shows this series -- see {@link SeriesLegend}. */
|
|
1035
|
+
legend?: SeriesLegend;
|
|
1015
1036
|
}
|
|
1016
1037
|
/** Series type: raw, enum, or aggregated */
|
|
1017
1038
|
type AnySeries = TimeSeries | AggregatedSeries;
|
|
@@ -1029,10 +1050,9 @@ interface Gap {
|
|
|
1029
1050
|
/** Drehung in Grad, oder "auto": drehen, wenn der Text nicht hineinpasst. */
|
|
1030
1051
|
rotate?: number | "auto";
|
|
1031
1052
|
/**
|
|
1032
|
-
* How the gap is drawn. `"label"`
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
* (`gaps: { regions, style: { display } }`) never had it.
|
|
1053
|
+
* How the gap is drawn. `"label"` was removed (B-20261006-01): it was not a
|
|
1054
|
+
* look of its own but the absence of one -- use `"empty"` with `label`.
|
|
1055
|
+
* JSON that still carries it draws like `"empty"`, and `warnings()` reports it.
|
|
1036
1056
|
*/
|
|
1037
1057
|
style?: DrawGapType_t;
|
|
1038
1058
|
}
|
|
@@ -1251,8 +1271,17 @@ interface AnnotationBandConfig {
|
|
|
1251
1271
|
spacing?: number;
|
|
1252
1272
|
/** Whether to show a time axis for this band (default: false). */
|
|
1253
1273
|
showAxis?: boolean;
|
|
1254
|
-
/**
|
|
1274
|
+
/**
|
|
1275
|
+
* List this band in the legend: its `name` beside a swatch in the colour of its first
|
|
1276
|
+
* item (default: false). The legend itself still needs `legend.show`.
|
|
1277
|
+
*/
|
|
1255
1278
|
showInLegend?: boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* Smallest width in pixels an item is drawn with. A narrower item is widened around its
|
|
1281
|
+
* centre, so it claims no duration, only "here was something". Items may overlap then.
|
|
1282
|
+
* Values up to the default of 1 change nothing.
|
|
1283
|
+
*/
|
|
1284
|
+
minItemWidth?: number;
|
|
1256
1285
|
/** Background fill for the entire band (default: transparent). */
|
|
1257
1286
|
background?: string;
|
|
1258
1287
|
/** Colored time ranges to draw in this band. */
|
|
@@ -1264,5 +1293,5 @@ interface AnnotationBandConfig {
|
|
|
1264
1293
|
labels?: AnnotationBandLabels;
|
|
1265
1294
|
}
|
|
1266
1295
|
|
|
1267
|
-
export { LinearScale as L, TimeScale as T, getHatch as
|
|
1268
|
-
export type { MarkerStyle as $, AxisPosition as A, AxisOrientation as B, DataPointRef as C, DataPoint as D, EnumMap as E, FillSpec as F, GridLayer as G, Highlight as H, FillBound as I, FillRegion as J, FillSide as K, MarkerLineStyle as M, FillStyle as N, FillWhere as O, PointStyleType as P, GapBand as Q, RangeLabelPosition as R, SmoothingType as S, GapConfig as U, GapLabel as V, GapRegion as W, GapStyle as X, GapsAtEnd as Y, LineShape as Z, LineStyle as _, DrawCommand as a, MovingAverageType as a0, SVGLineStyle as a1, SensorType as a2, SeriesGapStyle as a3, SeriesGaps as a4,
|
|
1296
|
+
export { LinearScale as L, TimeScale as T, getHatch as aB, getLineStyle as ac, resolveDash as ad, BandScale as al, TIME_INTERVALS as az };
|
|
1297
|
+
export type { MarkerStyle as $, AxisPosition as A, AxisOrientation as B, DataPointRef as C, DataPoint as D, EnumMap as E, FillSpec as F, GridLayer as G, Highlight as H, FillBound as I, FillRegion as J, FillSide as K, MarkerLineStyle as M, FillStyle as N, FillWhere as O, PointStyleType as P, GapBand as Q, RangeLabelPosition as R, SmoothingType as S, GapConfig as U, GapLabel as V, GapRegion as W, GapStyle as X, GapsAtEnd as Y, LineShape as Z, LineStyle as _, DrawCommand as a, MovingAverageType as a0, SVGLineStyle as a1, SensorType as a2, SeriesGapStyle as a3, SeriesGaps as a4, SeriesLegend as a5, SeriesOverlay as a6, SeriesOverlayKind as a7, SeriesType as a8, ShadowStyle as a9, TimeScaleConfig as aA, SolidDashStyle as aa, ThresholdLabelConfig as ab, LineParams as ae, PathParams as af, RectParams as ag, CircleParams as ah, TextParams as ai, GapParams as aj, Point as ak, BandScaleConfig as am, Dashstyle_t as an, DomainScaleConfig as ao, DrawCircle as ap, DrawGap as aq, DrawGapType_t$1 as ar, DrawLine as as, DrawPath as at, DrawRect as au, DrawText as av, LinearScaleConfig as aw, Scale as ax, ScaleConfig as ay, LineDashStyle as b, LineVariant as c, DrawGroup as d, AnySeries as e, Threshold as f, Gap as g, GapsConfig as h, Annotation as i, AnnotationBandConfig as j, HatchVariant as k, SeriesStyle as l, TimeSeries as m, ThresholdFill as n, ThresholdLabelPosition as o, AnnotationPointShape as p, LabelAnchor as q, AnnotationBandItem as r, TextBaseline as s, AggregatedPoint as t, AggregatedSeries as u, AggregatedShowAs as v, AggregationConfig as w, AggregationMode as x, AnnotationBandLabels as y, AnnotationKind as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-time-graph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.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",
|
|
@@ -87,8 +87,8 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
87
87
|
| 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
88
|
| 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) |
|
|
89
89
|
| 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) |
|
|
90
|
-
| Arrows, labels and rectangles in data coordinates, time-range highlights, status bands, markers | [reference/annotations-and-markers.md](reference/annotations-and-markers.md) |
|
|
91
|
-
| Legend placement, a clickable legend, a panel behind it, line patterns in the swatches | [reference/legend.md](reference/legend.md) |
|
|
90
|
+
| 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) |
|
|
91
|
+
| Legend placement, a clickable legend, a panel behind it, line patterns in the swatches, annotation bands in the legend | [reference/legend.md](reference/legend.md) |
|
|
92
92
|
| Smoothing (which spline), aggregated min/max/avg series, moving average and other overlays | [reference/series-styles.md](reference/series-styles.md) |
|
|
93
93
|
| Draw commands, tooltips and `pointsAt`, server-side rendering, CSS classes, `idPrefix`, `classPrefix` | [reference/rendering.md](reference/rendering.md) |
|
|
94
94
|
| Svelte 5 components (`ml-time-graph-svelte`) | [reference/svelte.md](reference/svelte.md) |
|
|
@@ -108,6 +108,6 @@ shallow and an `axes` in `b` drops `a`'s grid and ticks. Server-side the same ru
|
|
|
108
108
|
still ships no click handler — you write one, and one on the chart is enough. `'separate'` remains
|
|
109
109
|
the way when the legend belongs in HTML, or needs to do more than toggle.
|
|
110
110
|
- **An annotation's `dash` takes a variant, not a pattern:** the type is `'dashed' | 'dotted'`. A raw SVG pattern like `'5,5'` is not rejected — it draws a solid line, in both libraries.
|
|
111
|
-
- **One option is still accepted and does nothing:** `series.sensorType` is in the types and the parser reads it, but no renderer acts on it — in either library. Setting it to `'enum'` does not label the axis; that is `series.enumMap`, which 1.10.0 wired up. Since 1.17.1 it is marked **deprecated** and will be removed before 2.0
|
|
111
|
+
- **One option is still accepted and does nothing:** `series.sensorType` is in the types and the parser reads it, but no renderer acts on it — in either library. Setting it to `'enum'` does not label the axis; that is `series.enumMap`, which 1.10.0 wired up. Since 1.17.1 it is marked **deprecated** and will be removed before 2.0. The flat gap style `'label'` is gone: use `'empty'` with a `label`; JSON that still has it draws like that and `warnings()` reports it. Until 1.10.0 this list also held `ticks.minor`, `grid.minor` and `enumMap` itself: three fields the types promised and both renderers swallowed. Since 1.18 `warnings()` reports `sensorType` too (any value but `"numeric"`, which `parseJSON` sets itself).
|
|
112
112
|
- **CSS classes are not namespaced:** the chart uses plain names like `.series` and `.time-axis`. Inline the SVG into a page whose stylesheet has a `.series` rule and that rule applies to the chart. Scope your own selectors, and suspect the host page when an embedded chart looks wrong but the standalone file does not.
|
|
113
113
|
- **Hatch lines adapt to fill colour:** Hatch patterns inherit the opaque colour of the area they belong to (`opaqueColor(fill)`), while the backdrop stays translucent. An earlier default drew fixed blue lines (`#4D88FF`), which falsely signaled an extra state on incident charts where colour is semantic.
|
|
@@ -34,6 +34,8 @@ mount('#chart', {
|
|
|
34
34
|
});
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
A band joins the legend only with `showInLegend: true` (and `legend.show`); see [legend.md](legend.md) for what that means to a click handler. `minItemWidth` keeps short events visible in long windows: a narrower item widens around its centre and claims no duration.
|
|
38
|
+
|
|
37
39
|
**Many events in one band?** Set `labels: 'fit'` on the band. Centred labels of close
|
|
38
40
|
events otherwise overlap into an unreadable bar; with `'fit'` the library keeps the last
|
|
39
41
|
label (or the first: `{ mode: 'fit', keep: 'first' }`) and adds the others only where they
|
|
@@ -22,6 +22,10 @@ container.addEventListener('click', (e) => {
|
|
|
22
22
|
.classList.toggle('hidden'); // .hidden { display: none }
|
|
23
23
|
});
|
|
24
24
|
```
|
|
25
|
+
An annotation band with `showInLegend: true` (default `false`) also gets an entry: its name beside
|
|
26
|
+
the colour of its first item, with the id `legend-band-<slug>`. **No `#series-…` group belongs to
|
|
27
|
+
it**, so the handler above throws on such a click. Skip them with
|
|
28
|
+
`if (!item || item.id.startsWith('legend-band-')) return;`.
|
|
25
29
|
`chart.legendItems()` returns the same key as `id`, for anyone still rendering their own legend.
|
|
26
30
|
|
|
27
31
|
## A panel behind the legend — `legend.box`
|
|
@@ -15,6 +15,9 @@ mount('#chart', {
|
|
|
15
15
|
});
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Trap: the legend swatch of such a series shows only the base colour — the lowest zone.
|
|
19
|
+
Add `legend: { colors: [base, warnColor, critColor] }` to show all zones in the swatch.
|
|
20
|
+
|
|
18
21
|
## Filled Areas Between Curve and Threshold
|
|
19
22
|
Use `style.fill.regions` with bounds (`from`, `to`, `side`, optional `hatch`):
|
|
20
23
|
```ts
|