import{r as t,h as e}from"./p-0d5a2e05.js";const a=class{constructor(e){t(this,e);this.width=130;this.height=66;this.strokeColor="#067647";this.fillColor="#079455";this.strokeWidth=2;this.data=[];this.showMarker=true;this.pathD="";this.areaD="";this.currentMarkerPos={x:76,y:5}}dataChangeHandler(){this.generatePaths();this.updateMarkerPosition()}componentWillLoad(){this.generatePaths();this.updateMarkerPosition()}normalizeData(){if(this.data.length===0)return[];const t=this.data.map((t=>t.x));const e=this.data.map((t=>t.y));const a=Math.min(...t);const s=Math.max(...t);const i=Math.min(...e);const h=Math.max(...e);const d=10;return this.data.map((t=>({x:(t.x-a)/(s-a)*(128-2*d)+d,y:64-((t.y-i)/(h-i)*(64-2*d)+d)})))}updateMarkerPosition(){if(this.markerPosition){this.currentMarkerPos=this.markerPosition}else if(this.data.length>0){const t=this.normalizeData();const e=t[t.length-1];this.currentMarkerPos={x:e.x-10,y:e.y-15}}}generatePaths(){const t=this.normalizeData();if(t.length===0)return;this.pathD=t.reduce(((t,e,a)=>t+`${a===0?"M":"L"} ${e.x} ${e.y} `),"");this.areaD=`${this.pathD} L ${t[t.length-1].x} 65 L 1 65 Z`}render(){const{x:t,y:a}=this.currentMarkerPos;return e("svg",{key:"561214e9b0e9ede3a8292cb509600eded68201d2",width:this.width,height:this.height,viewBox:"0 0 130 66",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("defs",{key:"d421cb49aca9ad1f78e3fac0f7093d2dceb09aea"},e("linearGradient",{key:"c6ebd0531820c13db12ed62ec74a865a4cb60db4",id:"gradientMask",x1:"64",y1:"0",x2:"64",y2:"64",gradientUnits:"userSpaceOnUse"},e("stop",{key:"12a26b01ff78fcf99038f1f91c0252ac15380d24"}),e("stop",{key:"e9dcb0a9c64fa9cf318a64f51eb3dde55aa03b1e",offset:"1","stop-opacity":"0"})),e("mask",{key:"70b3672f6ac99f494e3f12eaa5bdfcb3750fe089",id:"chartMask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"1",y:"1",width:"128",height:"64"},e("rect",{key:"3769defd85dc7b29d420f321a169541ca394a785",width:"128",height:"64",transform:"translate(1 1)",fill:"url(#gradientMask)"}))),e("g",{key:"4abdc3367f61f2fd3018e5af6cc5edb42da6b248",mask:"url(#chartMask)"},e("path",{key:"dc14b1914fc17cc139d833863f6103f1ca08b5b0",opacity:"0.2",d:this.areaD,fill:this.fillColor})),e("path",{key:"7cda141c4ff7627be41c17907d0ae9da9690cea2",d:this.pathD,stroke:this.strokeColor,"stroke-width":this.strokeWidth,"stroke-linecap":"round","stroke-linejoin":"round",fill:"none"}),this.showMarker&&e("g",{key:"88623bb601a89cb0b5597b23d7d7fc959e450949",transform:`translate(${t}, ${a})`},e("g",{key:"5a55ca9038e444b9c0bfa4477b45ef2b1e61a168",opacity:"0.2"},e("rect",{key:"d3d3602f98630dfd2abe6bb2ff77f9f895a494fe",width:"20",height:"20",rx:"10",stroke:this.strokeColor,"stroke-width":this.strokeWidth})),e("rect",{key:"b9400d4f3dde157f52983b71b361621b5a4f202b",x:"5",y:"5",width:"10",height:"10",rx:"5",fill:"white"}),e("rect",{key:"3ae04377914612dfbe93beed89734dcae5530db3",x:"5",y:"5",width:"10",height:"10",rx:"5",stroke:this.strokeColor,"stroke-width":this.strokeWidth})))}static get watchers(){return{data:["dataChangeHandler"]}}};export{a as dga_metric_chart_v2};
//# sourceMappingURL=p-3ec59ae4.entry.js.map