-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.min.js
1 lines (1 loc) · 19 KB
/
main.min.js
1
function Init(){var t=document.getElementById("myRange"),e=document.getElementById("myPoints");document.getElementById("tableSwitch_GAS");document.getElementById("pointsValue").innerHTML=sliderPoints,t.oninput=function(){sliderPercentage=Number(this.value/100);let t=set_s_e(sliderPoints,sliderPercentage);_s=t.s,_e=t.e,document.getElementById("rangeValue").innerHTML=_e,document.getElementById("rangeValue_from").innerHTML=_s,document.getElementById("pointsValue").innerHTML=sliderPoints,button_stop&&(Ctx.clearRect(0,0,w,h),CtxG.clearRect(0,0,wg,hg),drawLine())},e.oninput=function(){sliderPoints=Math.floor(Math.exp(Number(this.value)));let t=set_s_e(sliderPoints,sliderPercentage);_s=t.s,_e=t.e,document.getElementById("rangeValue").innerHTML=_e,document.getElementById("rangeValue_from").innerHTML=_s,document.getElementById("pointsValue").innerHTML=sliderPoints,button_stop&&(Ctx.clearRect(0,0,w,h),CtxG.clearRect(0,0,wg,hg),drawLine())},_s=0,_e=0,zoomStatus=!1,gVar.zoom={s:_s,e:_e,zoomStatus:zoomStatus},e_start&&e_start.style&&(e_start.style.opacity=1),e_stop&&e_stop.style&&(e_stop.style.opacity=0),e_scan&&e_scan.style&&(e_scan.style.opacity=1),iteration=0,dataX=[1,2,3,4,5,6,7,8,9,10],dataL_Total=[0,100],un=Math.round((Math.max(...dataL_Total)-Math.min(...dataL_Total))/10),xs=(w-80)/dataX.length,dataT=[],chart.setCtx(Ctx),chart.chartLine(),chart.digram(),chart.setCtx(CtxG),chart.chartLine(),chart.digram()}function set_s_e(t,e){let a=Math.floor(e*dataX.length);a<10&&(a=10);let n=a-t;return(n<0||null==n)&&(n=0),gVar.zoom={s:n,e:a,zoomStatus:zoomStatus},debug&&console.log(n,a,t,e),{s:n,e:a}}function tableSwitch_GAS(){let t=document.getElementById("tableSwitch_GAS").checked;debug&&console.log(t);let e=document.getElementById("table_GAS");e.style.display=t&&e?"block":"none"}async function wrapper(){console.log("start"),await waitInterval(meter,999),console.log(iteration),button_stop=!0,console.log("finish")}async function wrapperW(){console.log("start W"),await waitInterval(meterW,999),console.log(iteration),button_stop=!0,console.log("finish W")}function toggleZoom(){zoomStatus=gVar.zoom.zoomStatus,zoomStatus=!zoomStatus,zoomStatus=gVar.zoom.zoomStatus;let t=document.getElementById("Zoom");t.style.backgroundColor=zoomStatus?"lightblue":"white",null!=gVar.zoom&&null!=gVar.zoom.s&&0!=gVar.zoom.e||(null!=sliderPercentage&&0!=sliderPercentage||(sliderPercentage=1),_e=Math.floor(dataX.length*sliderPercentage),_e<10&&(_e=10),_s=_e-sliderPoints,_s<0&&(_s=0),gVar.zoom={s:_s,e:_e,zoomStatus:zoomStatus}),button_stop&&(Ctx.clearRect(0,0,w,h),CtxG.clearRect(0,0,wg,hg),drawLine())}function getMinMaxUn(t){min=0,max=0;let e=[];if(zoomStatus?(_s=gVar.zoom.s,_e=gVar.zoom.e):(_s=0,_e=dataX.length),zoomStatus&&null!=t[0]?(_e>t[0].length&&(_e=t[0].length,_s=t[0].length-10),_s<0&&(_s=0,_e=_s+sliderPoints),_e>t[0].length&&(_e=t[0].length),e[0]=[],e[1]=[],e[2]=[],e[3]=[],null!=t[0]&&null!=t[0]&&t[0].length>1?(e[0]=t[0].slice(_s,_e),e[1]=t[1].slice(_s,_e),e[2]=t[2].slice(_s,_e),e[3]=t[3].slice(_s,_e)):e=t):(_s=0,t[0]&&(_e=t[0].length),e=t),e.length>=1)if(Array.isArray(e[0])){let t=e.map(t=>Math.max.apply(null,t));max=Math.max(...t);let a=e.map(t=>Math.min.apply(null,t));min=Math.min(...a)}else max=Math.max(...e),min=Math.min(...e);return min==max&&(max-min>10?(min=.999*e[0],max=1.001*e[0]):(min=0,max=1.01*e[0])),un=(max-min)/10,un>=1e3?(max=5e3*Math.ceil(max/5e3),min=5e3*Math.floor(min/5e3),un=(max-min)/10):un>=100?(max=500*Math.ceil(max/500),min=500*Math.floor(min/500),un=(max-min)/10):un>=10?(max=50*Math.ceil(max/50),min=50*Math.floor(min/50),un=(max-min)/10):un>=1?(max=10*Math.ceil(max/10),min=10*Math.floor(min/10),un=(max-min)/10):un>=0&&(max=Math.ceil(1*max)/1,min=Math.floor(1*min)/1,un=(max-min)/10),0==un&&(un=.1,max=10,min=0),debug&&console.log(min,max,un),[min,max,un]}function drawLine(){if(0!=dataL_Total.length){zoomStatus?(_s=gVar.zoom.s,_e=gVar.zoom.e,1==sliderPercentage&&(_e=dataX.length,_s=_e-sliderPoints,_s<0&&(_s=0)),zoomStatus=gVar.zoom.zoomStatus):(_s=0,_e=dataX.length),gVar.zoom={s:_s,e:_e,zoomStatus:zoomStatus},_length=_e-_s;let t=[dataL_Total.slice(_s,_e),datal1.slice(_s,_e),datal2.slice(_s,_e),datal3.slice(_s,_e)];MMU[0]=getMinMaxUn(t),min=MMU[0][0],max=MMU[0][1],un=MMU[0][2],xs=(w-80)/_length,dataT=[],chart.setCtx(Ctx),chart.chartLine(),chart.digram(),chart.data(),chart.draw(),chart.pointes()}if(0!=dataGasPoint.length){let t=[];for(datagas of dataGasPoint)t.push(datagas[5]);_s=0,_e=dataX.length,MMU[1]=getMinMaxUn(t),MMU[1][0]=min=0,max=MMU[1][1],un=MMU[1][2],xs=(w-80)/dataXG.length,chart.setCtx(CtxG),chart.chartLine(),chart.digram(),chart.dataGas(),chart.drawG(),chart.pointesGas()}return!0}async function tryIP(t){let e="http://"+t+"/api";const a=new Promise((a,n)=>{debug&&console.log(e),fetch(e).then(async function(a){if(a.ok){let n=await a.json();"HWE-P1"==n.product_type&&(ip.P1=t,debug&&console.log(ip.P1),debug&&console.log("Found HWE-P1",e,ip.P1),document.getElementById("IP_P1").value=ip.P1),"HWE-WTR"==n.product_type&&(ip.WTR=t,debug&&console.log(ip.WTR),debug&&console.log("Found HWE-WTR",e,ip.WTR),document.getElementById("IP_WTR").value=ip.WTR)}return a.json()}).catch(t=>{})}),n=new Promise((t,e)=>setTimeout(e,100));try{await Promise.race([a,n])}catch(t){debug&&console.log(e,"failed")}}function scanIP(){if(ip.P1=document.getElementById("IP_P1").value,ip.WTR=document.getElementById("IP_WTR").value,""!=ip.P1&&ip.P1.split(".")[3].includes("*")){let e=ip.P1;for(var t=1;t<256;t++){let a=e.split(".");a[3]=t,e=a[0]+"."+a[1]+"."+a[2]+"."+a[3],debug&&console.log(e),tryIP(e)}}}function setHoverText(){let t=document.getElementsByClassName("tooltip")[0];t&&(t.style.display=button_stop?"inline-block":"none")}function fill_data_random(){let t=600;set_s_e(sliderPoints,sliderPercentage),document.getElementById("rangeValue").innerHTML=t,gVar.zoom={s:1,e:t,zoomStatus:zoomStatus},dataX=[];for(let e=1;e<t;e++){dataX.push(e);let t=Math.random(),a=Math.random(),n=Math.random(),o=Math.floor(400*t),l=Math.floor(400*a),s=Math.floor(400*n),i=o+l+s;datal1.push(o),datal2.push(l),datal3.push(s),dataL_Total.push(i)}dataXG=[1,2,3,4,5,6,7,8,9,10],dataGas=[["21:10:06/22-11-22",3037.961,76206],["21:10:06/22-11-22",3037.961,76206],["21:10:06/22-11-22",3037.961,76206],["21:15:05/22-11-22",3038.991,76505],["21:15:05/22-11-22",3038.991,76505],["21:15:05/22-11-22",3038.991,76505],["21:20:05/22-11-22",3039.991,76505],["21:20:05/22-11-22",3039.991,76505]],dataGasPoint=[["18:10:00/22-11-22",2000.101,75005,2,5,.4],["18:10:00/22-11-22",2000.108,75305,125,5,25],["18:10:00/22-11-22",2000.15,75605,100,5,20],["18:10:00/22-11-22",2000.2,75905,0,5,0],["18:10:00/22-11-22",2000.202,76205,28,5,15],["18:10:00/22-11-22",2000.205,76505,255,5,50],["18:10:00/22-11-22",2001.206,76805,25,5,5],["18:10:00/22-11-22",2001.209,77105,133,5,25]]}function run(){button_stop=!1,setHoverText(),ip.P1=document.getElementById("IP_P1").value,ip.WTR=document.getElementById("IP_WTR").value,""==ip.WTR||ip.WTR.includes("*")||wrapperW(),""==ip.P1||ip.P1.includes("*")?(document.getElementById("test").innerHTML="TESTDATA",fill_data_random(),iteration=1,Ctx.clearRect(0,0,w,h),CtxG.clearRect(0,0,wg,hg),drawLine(),button_stop=!0,writeNumbers_E({active_power_w:dataL_Total[dataL_Total.length-1],active_power_l1_w:datal1[dataL_Total.length-1],active_power_l2_w:datal2[dataL_Total.length-1],active_power_l3_w:datal3[dataL_Total.length-1],total_gas_m3:dataGasPoint[dataGasPoint.length-1],total_power_export_t1_kwh:1234,total_power_export_t2_kwh:83,total_power_import_t1_kwh:987,total_power_import_t2_kwh:321})):(document.getElementById("test").innerHTML="",Init(),e_start&&(e_start.style.opacity=0),e_stop&&(e_stop.style.opacity=1),e_scan&&e_scan.style&&(e_scan.style.opacity=0),dataX=[],dataXG=[],dataL_Total=[],datal1=[],datal2=[],datal3=[],dataT=[],dataGas=[],dataGasPoint=[],iteration=1,wrapper())}function stop(){button_stop=!0,setHoverText(),e_start&&(e_start.style.opacity=1),e_stop&&(e_stop.style.opacity=0),e_scan&&e_scan.style&&(e_scan.style.opacity=1)}async function meter(t){iteration=t;let e="http://"+ip.P1+"/api/v1/data",a=await fetch(e);if(a.ok){let e=await a.json();if(isNaN(e.active_power_w)&&(e.active_power_w=0),isNaN(e.active_power_l1_w)&&(e.active_power_l1_w=0),isNaN(e.active_power_l2_w)&&(e.active_power_l2_w=0),isNaN(e.active_power_l3_w)&&(e.active_power_l3_w=0),dataL_Total.push(e.active_power_w),datal1.push(e.active_power_l1_w),datal2.push(e.active_power_l2_w),datal3.push(e.active_power_l3_w),dataX.push(t),document.getElementById("IP_P1_001").innerHTML=ip.P1,document.getElementById("WifiSSID").innerHTML=e.wifi_ssid,document.getElementById("WifiStrength").innerHTML=e.wifi_strength,document.getElementById("MM").innerHTML=e.meter_model,document.getElementById("SV").innerHTML=e.smr_version,writeNumbers_E(e),zoomStatus&&debug&&console.log("pause"),Ctx.clearRect(0,0,w,h),CtxG.clearRect(0,0,wg,hg),drawLine(),1==sliderPercentage&&(document.getElementById("rangeValue").innerHTML=dataX.length),e.gas_timestamp){let a=e.gas_timestamp.toString(),n=a.substring(6,8),o=a.substring(8,10),l=a.substring(10,12),s=a.substring(4,6),i=a.substring(2,4),r=a.substring(0,2),c=n+":"+o+":"+l,d=s+"-"+i+"-"+r;c=c+"/"+d;let _=new Date("20"+r+"-"+i+"-"+s+"T"+n+":"+o+":"+l).getTime();debug&&console.log(new Date(_),_);let m=0,u=0,g=0;if(0!=dataGasPoint.length){if(dataGasPoint[dataGasPoint.length-1][2]!=_||1==debug){debug&&console.log(n,o,l,c,_);let a=dataGasPoint[0][1],s=1e3*(Math.floor(1e3*e.total_gas_m3)-Math.floor(1e3*a))/1e3;_string=_string+"<tr><th>"+c+"</th>",dataGasPoint.length>0&&(m=Math.floor(1e3*(1e3*e.total_gas_m3-1e3*dataGasPoint[dataGasPoint.length-1][1]))/1e3,u=(_-dataGasPoint[dataGasPoint.length-1][2])/6e4,_string=_string+"<th>"+e.total_gas_m3+"</th><th>"+s+"</th><th>"+m+"</th><th>"+Math.floor(10*u)/10+"</th>",0!=u&&(g=Math.round(100*m/u)/100,_string=_string+"<th>"+g+"</th>")),_string+="</tr>",dataGasPoint.push([c,e.total_gas_m3,_,m,u,g]),dataXG.push(t)}dataGas.push([c,e.total_gas_m3,_])}else dataGas.push([c,e.total_gas_m3,_]),dataGasPoint.push([c,e.total_gas_m3,_,null,null,null]),dataXG.push(t),_string=_string+"<tr><th>"+c+"<th>"+e.total_gas_m3+"</th></tr>";_k=object("#TimeGasM3"),_k.innerHTML=_string}let n=t==max_seconds||button_stop;return n&&stop(),n}alert("HTTP-Error: "+a.status)}async function meterW(t){iterationW=t;let e="http://"+ip.WTR+"/api/v1/data",a=await fetch(e);if(a.ok){let e=await a.json();dataL_Total.push(e.active_power_w),document.getElementById("IP_W1_001").innerHTML=ip.WTR,e.active_liter_lpm?(document.getElementById("AL").innerHTML=e.active_liter_lpm,document.getElementById("TL").innerHTML=e.total_liter_m3):document.getElementById("AL").innerHTML=document.getElementById("TL").innerHTML="";let n=t==max_seconds||button_stop;return n&&stop(),n}alert("HTTP-Error: "+a.status)}function writeNumbers_E(t){document.getElementById("P1").innerHTML=t.active_power_l1_w,t.active_power_l2_w?document.getElementById("P2").innerHTML=t.active_power_l2_w:document.getElementById("P2").innerHTML="",t.active_power_l3_w?document.getElementById("P3").innerHTML=t.active_power_l3_w:document.getElementById("P3").innerHTML="",document.getElementById("PT").innerHTML=t.active_power_w;let e=delta_calc(dataL_Total);document.getElementById("PTd3").innerHTML=e[0],document.getElementById("PTd2").innerHTML=e[1],document.getElementById("PTd1").innerHTML=e[2];let a=delta_calc(datal1);document.getElementById("P1d3").innerHTML=a[0],document.getElementById("P1d2").innerHTML=a[1],document.getElementById("P1d1").innerHTML=a[2];let n=delta_calc(datal2);document.getElementById("P2d3").innerHTML=n[0],document.getElementById("P2d2").innerHTML=n[1],document.getElementById("P2d1").innerHTML=n[2];let o=delta_calc(datal3);document.getElementById("P3d3").innerHTML=o[0],document.getElementById("P3d2").innerHTML=o[1],document.getElementById("P3d1").innerHTML=o[2],document.getElementById("ET1").innerHTML=t.total_power_export_t1_kwh,document.getElementById("ET2").innerHTML=t.total_power_export_t2_kwh,document.getElementById("IT1").innerHTML=t.total_power_import_t1_kwh,document.getElementById("IT2").innerHTML=t.total_power_import_t2_kwh}async function waitInterval(t,e){return new Promise(a=>{const n=setInterval(async()=>{if(await t(iteration,n))return a(),clearInterval(n),!0;iteration++},e)})}function delta_calc(t){let e=[];return t.length>3?e.push(t[t.length-1]-t[t.length-4]):e.push(0),t.length>2?e.push(t[t.length-1]-t[t.length-3]):e.push(0),t.length>1?e.push(t[t.length-1]-t[t.length-2]):e.push(0),e}function $(t){return document.querySelector(t)}function object(t){return document.querySelector(t)}function leftPad(t,e){for(var a=t+"";a.length<e;)a="0"+a;return a}var ip={};let c={},h=0,w=0,Ctx={},CtxG={},dataX=[],dataXG=[],dataL_Total=[],datal1=[],datal2=[],datal3=[],dataGas=[],dataGasPoint=[];var un=0;let xs=0,dataT=[],button_stop=!0,tabE={},tabG={};var zoomStatus=!1,sliderPercentage=1,sliderPoints=10;let debug=!1;var MMU=[],tabIndexCanvas=0,tabIndeX_dataT=0;const max_seconds=86400;let e_start={},e_stop={},e_scan={},_string="<tr><th>Time (hh:mm:ss/dd-mm-yy)</th><th>Gas (m3)</th><th>DeltaSum(liter)</th><th>Delta (liter)</th><th>min.</th><th>Flow (liter/min )</th></tr> ",min=0,max=0,_s=0,_e=0,_index=0,_length=0;var _k,gVar={s:0,e:0,zoomStatus:!1,get zoom(){return null==s&&(s=0),null==e&&(e=dataX.length||0),null==zoomStatus&&(zoomStatus=!1),{s:s,e:e,zoomStatus:zoomStatus}},set zoom(t){s=t.s,e=t.e,zoomStatus=t.zoomStatus}};let iteration=0;window.onload=function(){function t(t){let e=t.currentTarget.attributes[1].nodeValue;tabIndexCanvas=t.currentTarget.attributes[4].nodeValue,_index=0,_s=gVar.zoom.s,_e=gVar.zoom.e,zoomStatus=gVar.zoom.zoomStatus,(-1==_e||isNaN(_e))&&(_s=0,_e=dataX.length,debug&&console.log("correction")),gVar.zoom={s:_s,e:_e,zoomStatus:zoomStatus};for(let a of dataT){for(const[n,o]of Object.entries(a)){let a=o.split(","),n=Number(t.offsetX),l=Number(t.offsetY),s=Number(a[1]),i=Number(a[0]),r=Math.floor(Number(a[4])/3);r<10&&(r=10),n>s-r&&n<s+r&&l>i-r&&l<i+r&&("E"==e&&"Gas"!=a[3]?(tabE.innerHTML=a[3]+":"+a[2],tabE.style.opacity="1",tabE.style.left=t.layerX+"px",tabE.style.top=t.layerY+"px",debug&&console.log(_index,Number(a[7])),tabIndeX_dataT=Number(a[7])):"G"==e&&"Gas"==a[3]&&(tabG.innerHTML=a[3]+":"+a[2],tabG.style.opacity="1",tabG.style.left=t.layerX+"px",tabG.style.top=t.layerY+"px")),n-=1,s-=1}_index++}}e_start=document.getElementById("Start"),e_stop=document.getElementById("Stop"),e_scan=document.getElementById("Scan"),e_start&&(e_start.style.opacity=1),e_stop&&(e_stop.style.opacity=0),e_scan&&e_scan.style&&(e_scan.style.opacity=1),c=document.querySelector("canvas[le]"),cg=document.querySelector("canvas[lg]"),tabE=document.querySelector("draw-canvas-data-set"),tabG=document.querySelector("draw-canvas-data-setG"),h=c.height,w=c.width,hg=cg.height,wg=cg.width,Ctx=c.getContext("2d"),CtxG=cg.getContext("2d"),cg.onmousemove=function(e){document.getElementById("G").focus(),tabE.style.opacity="0",tabG.style.opacity="0",t(e)},c.onmousemove=function(e){tabE.style.opacity="0",tabG.style.opacity="0",document.getElementById("E").focus(),t(e)},Init(),document.getElementById("IP_P1").value="192.168.2.*"};var chart={ctx:{},setCtx:function(t){ctx=t},setStrokeStyle:function(t){ctx.strokeStyle=t},digram:function(){for(x=60,y=1,ctx.strokeStyle="#a7a7a7";x<w;)ctx.beginPath(),ctx.moveTo(x,0),ctx.lineTo(x,h-30),ctx.stroke(),x+=30;for(;y<h-30;)ctx.beginPath(),ctx.moveTo(60,y),ctx.lineTo(w,y),ctx.stroke(),y+=30},chartLine:function(){ctx.strokeStyle="#000",ctx.beginPath(),ctx.moveTo(60,0),ctx.lineTo(60,h-30),ctx.stroke(),ctx.beginPath(),ctx.moveTo(w,h-30),ctx.lineTo(60,h-30),ctx.stroke()},draw:function(){ctx.save(),ctx.strokeStyle="#0b95d3",ctx.lineWidth=4,ctx.beginPath(),x=60,line=30,start=0;for(let t=_s;t<_e;t++){const e=dataL_Total[t];y=30,y+=(MMU[0][1]-e)/MMU[0][2]*line,ctx.lineTo(x,y),x+=xs}ctx.stroke(),chart.setStrokeStyle("#00FF00"),ctx.lineWidth=3,ctx.beginPath(),x=60,line=30,start=0;for(let t=_s;t<_e;t++){const e=datal1[t];y=30,y+=(MMU[0][1]-e)/MMU[0][2]*line,ctx.lineTo(x,y),x+=xs}ctx.stroke(),chart.setStrokeStyle("#d6d610"),ctx.lineWidth=3,ctx.beginPath(),x=60,line=30,start=0;for(let t=_s;t<_e;t++){const e=datal2[t];y=30,y+=(MMU[0][1]-e)/MMU[0][2]*line,ctx.lineTo(x,y),x+=xs}ctx.stroke(),chart.setStrokeStyle("#A020F0"),ctx.lineWidth=3,ctx.beginPath(),x=60,line=30,start=0;for(let t=_s;t<_e;t++){const e=datal3[t];y=30,y+=(MMU[0][1]-e)/MMU[0][2]*line,ctx.lineTo(x,y),x+=xs}ctx.stroke(),ctx.restore()},drawG:function(){ctx.save(),ctx.strokeStyle="#0b95d3",ctx.lineWidth=3,ctx.beginPath(),x=60,line=30;let t=[];for(datagas of dataGasPoint)t.push(datagas[5]);for(data of dataGasPoint)y=30,y+=(MMU[1][1]-data[5])/MMU[1][2]*line,ctx.lineTo(x,y),x+=xs;ctx.stroke(),ctx.restore()},pointes:function(){let t=0;ctx.fillStyle="#0b95d3",x=60,line=30;for(let e=_s;e<_e;e++){const a=dataL_Total[e];this.points(a,dataL_Total,"Tot.",t),t++}t=0,ctx.fillStyle="#00FF00",x=60,line=30,start=30;for(let e=_s;e<_e;e++){const a=datal1[e];this.points(a,datal1,"l1",t),t++}t=0,ctx.fillStyle="#d6d610",x=60,line=30,start=30;for(let e=_s;e<_e;e++){const a=datal2[e];this.points(a,datal2,"l2",t),t++}t=0,ctx.fillStyle="#A020F0",x=60,line=30,start=30;for(let e=_s;e<_e;e++){const a=datal3[e];this.points(a,datal3,"l3",t),t++}ctx.fillStyle="#00000F",ctx.stroke()},points:function(t,e,a,n){y=30,y+=(MMU[0][1]-t)/MMU[0][2]*line,chart.circle(x,y),dataT.push({d:Math.round(y)+","+Math.round(x)+","+Math.round(t)+","+a+","+MMU[0]+","+Number(n)}),x+=xs},pointesGas:function(){ctx.fillStyle="#0b95d3",x=60,line=30,start=30;let t=0;for(data of dataGasPoint)this.pointsGas(data[5],dataGasPoint,"Gas",t),t++;ctx.fillStyle="#00000F",ctx.stroke()},pointsGas:function(t,e,a,n){y=30,y+=(MMU[1][1]-t)/MMU[1][2]*line,chart.circle(x,y),dataT.push({d:Math.round(y)+","+Math.round(x)+","+Math.round(10*t)/10+","+a+","+MMU[1]+","+Number(n)}),x+=xs},data:function(){x=60,y=30,n=max;let t=1;zoomStatus?(_s=gVar.zoom.s,_e=gVar.zoom.e,zoomStatus=gVar.zoom.zoomStatus):(_s=0,_e=dataX.length),_length=_e-_s,debug&&console.log(_s,_e,_length);let e=0;_length>24e3?(t=Math.floor(_length/3600),t<3600&&(t=3600)):_length>6e3?(t=Math.floor(_length/1200),t<1200&&(t=1200)):_length>1200?(t=Math.floor(_length/240),t<240&&(t=240)):_length>300?(t=Math.floor(_length/60),t<60&&(t=60)):_length>20&&(t=Math.floor(_length/10),t<1&&(t=1));for(let a=_s;a<_e;a++){const n=dataX[a];ctx.font="12px Arial",n>3600?e%t==0&&ctx.fillText(Math.floor(n/3600)+":"+leftPad(Math.floor(n-3600*Math.floor(n/3600)/60),2)+":"+leftPad((n-60*Math.floor(n/60))%60,2),x,h-10):n>60?e%t==0&&ctx.fillText(Math.floor(n/60)+":"+leftPad((n-60*Math.floor(n/60))%60,2),x,h-10):e%t==0&&ctx.fillText(n+"s",x,h-10),debug&&(console.log(n,x,xs,e,t),console.log(t)),x+=xs,e++}for(;y<h-30;)ctx.font="11px Arial",ctx.fillText(n,0,y+5),n-=un,y+=30},dataGas:function(){for(xdata of(x=60,y=30,n=max,dataXG))ctx.font="12px Arial",dataXG.length>300?(ctx.fillText(60*xdata,x+60*xs-xs,h-10),x+=60*xs):dataXG.length>140?(ctx.fillText(20*xdata,x+20*xs-xs,h-10),x+=20*xs):dataXG.length>50?(ctx.fillText(10*xdata,x+10*xs-xs,h-10),x+=10*xs):dataXG.length>20?(ctx.fillText(5*xdata,x+5*xs-xs,h-10),x+=5*xs):dataXG.length>10?(ctx.fillText(2*xdata,x+2*xs-xs,h-10),x+=2*xs):(ctx.fillText(xdata,x,h-10),x+=xs);for(;y<h-30;)ctx.font="11px Arial",ctx.fillText(n,0,y+5),n-=un,n=Math.floor(100*n)/100,y+=30},circle:function(t,e){ctx.beginPath(),ctx.arc(t,e,4,0,2*Math.PI),ctx.fill()}};