function draw_chart(e,i,n=350,l=100,r=10,a=350,o=!0,s=!1){const d=n-30,g=l-20;let h;i.length>a&&(i=zip_array(i,a,method="last"),e=zip_array(e,a,method="last"));let $=i.length,c=d/$;!0===s&&(i=i.map(t=>Math.log(t)));let x=Math.max.apply(Math,i),m=Math.min.apply(Math,i),y=.5*x+.5*m,f=i.map(t=>g-10-(t-m)/(x-m)*(g-10)),u={};u.max=.8*x+.2*y,u.upper=.4*x+.6*y,u.mid=y,u.lower=.6*y+.4*m,u.min=.2*y+.8*m;let b,p,_=Object.values(u).sort(),k=_.map(t=>g-10-(t-m)/(x-m)*(g-10));for(p=(e[e.length-1]-e[0])/2592e6>=1?"L":"S",h=``,h+="",h+="",h+='',h+='',h+='',h+="",h+="",h+=``,b=$-1;b>0;b-=Math.max(Math.round($/5),1))t=unixtime_converter(e[b],p),h+=`${t}`,b<$-1&&(h+=``);if(o){let t=get_trend(i).map(t=>g-10-(t-m)/(x-m)*(g-10));h+=``,h+=``,h+=``,h+=""}for(h+='',h+="",h+='`,h+="",!0===s&&(i=i.map(t=>Math.exp(t)),_=_.map(t=>Math.exp(t))),b=0;b<5;b++){let t=_[b];h+=`${add_commas(t,dec=null,mil=!0)}`}for(h+='',h+='',h+='',b=0;b<$;b++){let t=unixtime_converter(e[b],p);h+=`${add_commas(i[b])}`,h+=`${t}`,h+=``}return h+=``,h+=!0===s?'Log scale':'Natural scale ',h+="",h+=""}function guide(t,e,i,n,l,r){for(var a=0;ai/2?(document.getElementById("guide_box").setAttribute("x",t-63),document.getElementById("guide_val_"+l).setAttribute("x",t-3),document.getElementById("guide_time_"+l).setAttribute("x",t-3)):(document.getElementById("guide_box").setAttribute("x",t+3),document.getElementById("guide_val_"+l).setAttribute("x",t+63),document.getElementById("guide_time_"+l).setAttribute("x",t+63)),e>n/2?(document.getElementById("guide_box").setAttribute("y",e-28),document.getElementById("guide_val_"+l).setAttribute("y",e-26),document.getElementById("guide_time_"+l).setAttribute("y",e-14)):(document.getElementById("guide_box").setAttribute("y",e+3),document.getElementById("guide_val_"+l).setAttribute("y",e+5),document.getElementById("guide_time_"+l).setAttribute("y",e+17))}function draw_multi_chart(e,i=350,n=100,l=10,r=350,a=!0){const o=i-30,s=n-20,g=["LawnGreen","Orange","Aqua","HotPink","HoneyDew"],h=Object.values(e),$=h.length;let c=Object.keys(h[0]),x=[],m=[],y=[],f=[];for(E=0;E<$;E++)m[E]=Object.values(h[E]),x[E]=m[E].map(t=>.01*Math.round(t/m[E][0]*m[0][0]*100)),!0===a&&(x[E]=x[E].map(t=>Math.log(t))),y[E]=Math.max.apply(Math,x[E]),f[E]=Math.min.apply(Math,x[E]);const u=Math.max.apply(Math,y),b=Math.min.apply(Math,f),p=.5*u+.5*b;for(let t=0;ts-10-(t-b)/(u-b)*(s-10));let _={};_.max=.8*u+.2*p,_.mid=p,_.min=.2*p+.8*b;let k,w,v=Object.values(_).sort(),M=v.map(t=>s-10-(t-b)/(u-b)*(s-10)),B=x[0].length,I=o/B;w=(c[c.length-1]-c[0])/2592e6>=1?"L":"S";let A="";for(A=``,A+="",A+="",A+='',A+='',A+='',A+="",A+="",A+=``,k=B-1;k>0;k-=Math.max(Math.round(B/5),1))t=unixtime_converter(c[k],w),A+=`${t}`,k`);for(let t=0;t<$;t++){A+=``,A+=""}for(k=0;k${add_commas(d,dec=null,mil=!0)}`;for(E=0;E<$;E++)for(A+='',A+='',A+='',k=0;k${Object.keys(e)[E]}`,A+=`${add_commas(m[E][k])}`,A+=`${t}`,A+=``}for(var E=0;E<$;E++)A+=``,A+=`${Object.keys(e)[E]}`,A+=`${Object.keys(e)[E]}`;return A+=``,A+=!0===a?'Log scale':'Natural scale ',A+="",A+=""}function guide_multi(t,e,i,n,l,r,a,o){for(var s=0;si/2?(document.getElementById("guide_box").setAttribute("x",t-63),document.getElementById("guide_title_"+l+"_"+a).setAttribute("x",t-3),document.getElementById("guide_val_"+l+"_"+a).setAttribute("x",t-3),document.getElementById("guide_time_"+l).setAttribute("x",t-3)):(document.getElementById("guide_box").setAttribute("x",t+3),document.getElementById("guide_title_"+l+"_"+a).setAttribute("x",t+63),document.getElementById("guide_val_"+l+"_"+a).setAttribute("x",t+63),document.getElementById("guide_time_"+l).setAttribute("x",t+63)),e>n/2?(document.getElementById("guide_box").setAttribute("y",e-40),document.getElementById("guide_title_"+l+"_"+a).setAttribute("y",e-38),document.getElementById("guide_val_"+l+"_"+a).setAttribute("y",e-26),document.getElementById("guide_time_"+l).setAttribute("y",e-14)):(document.getElementById("guide_box").setAttribute("y",e+3),document.getElementById("guide_title_"+l+"_"+a).setAttribute("y",e+5),document.getElementById("guide_val_"+l+"_"+a).setAttribute("y",e+17),document.getElementById("guide_time_"+l).setAttribute("y",e+29))}function draw_simple_chart(e,i,n="",l=350,r=100,a=10,o=350,s=!1){const d=l-20,g=r-20;let h;if(0===(i=removeNaN(i)).length){console.log("Data error on ",n);let t=``;return t+=``,t+=`${n}`,t+=`N/A`,t+=""}e=e.slice(-i.length),i.length>o&&(i=zip_array(i,o,method="last"),e=zip_array(e,o,method="last"));let $,c,x=i.length,m=d/x;!0===s?($=100,c=0):($=Math.max.apply(Math,i),c=Math.min.apply(Math,i));let y=.5*$+.5*c,f=i.map(t=>g-10-(t-c)/($-c)*(g-10)),u={};u.max=.8*$+.2*y,u.mid=y,u.min=.2*y+.8*c;let b,p,_=Object.values(u).sort(),k=_.map(t=>g-10-(t-c)/($-c)*(g-10));for(p=(e[e.length-1]-e[0])/6048e5>=1?"L":"S",h=``,h+="",h+="",h+='',h+='',h+='',h+="",h+="",h+=``,b=x-1;b>0;b-=Math.max(Math.round(x/3),1))t=unixtime_converter(e[b],p),h+=`${t}`,b`);for(h+=``,h+='',h+="",h+='`,b=0;b<3;b++){let t=_[b];h+=`${add_commas(t,dec=null,mil=!0)}`}for(h+=`${n}`,h+=`${n}`,h+=``,h+=`${add_commas(i[b],dec=null,mil=!0)}`,h+=`${add_commas(i[b],dec=null,mil=!0)}`,b=0;b${t} ${add_commas(i[b])}`}return h+=""}function draw_long_short_chart(e,i,n="",l=350,r=100,a=10,o=350){const s=l-20,d=r-20;let g;if(0===(i=removeNaN(i)).length){console.log("Data error on ",n);let t=``;return t+=``,t+=`${n}`,t+=`N/A`,t+=""}e=e.slice(-i.length),i.length>o&&(i=zip_array(i,o,method="last"),e=zip_array(e,o,method="last"));let h=i.length,$=s/h,c=(Math.max(Math.abs(Math.max.apply(Math,i)-.5),Math.abs(Math.min.apply(Math,i)-.5)),i.map(t=>d-10-(t-.1)/.8*(d-10))),x=10**Math.floor(Math.log10(.8)),m={};m.max=Math.floor(.9/x)*x,m.min=Math.ceil(.1/x)*x,m.mid=Math.round((m.max+m.min)/2);let y;Object.values(m).sort().map(t=>d-10-(t-.1)/.8*(d-10));for(g=``,g+="",g+="",g+='',g+='',g+='',g+="",g+='',g+='',g+='',g+="",g+="",g+=``,y=h-1;y>0;y-=Math.max(Math.round(h/5),1))t=unixtime_converter(e[y],"simple"),g+=`${t}`,y`);for(g+='',g+="",g+='',g+='`,g+=``,g+=`${n}`,g+=`${n}`,g+=`Short`,g+=`Long`,g+=``,g+=`${(100*add_commas(i[y-1])).toFixed(1)}%`,g+=`${(100*add_commas(i[y-1])).toFixed(1)}%`,y=0;y${t} ${100*add_commas(i[y])}%`}return g+=""}function draw_summary_chart(t,e=350,i=100,n=10){let l;const r=Object.keys(t),a=Object.values(t),o=r.length,s=e/o;let d;for(l=``,l+="",l+=``,l+=``,l+=``,l+=`High`,l+=`Mid`,l+=`Low`,d=0;d`,l+=`${r[d]} ⓘ`}return l+=""}function score_to_color(t){t=Math.max(Math.min(t,100),0);const e=parseInt(Math.max(255-255*t/100,100)),i=parseInt(Math.max(200*t/100,150)),n=parseInt(Math.max(t,50));return color=e.toString()+","+i.toString()+","+n.toString(),color}function draw_signal_chart(e,i,n,l=350,r=100,a=10,o=350){const s=l-30,d=r-20;let g;if(0===(i=removeNaN(i)).length){console.log("Data error ");let t=``;return t+=``,t+=`N/A`,t+=""}e=e.slice(-i.length),n=n.slice(-i.length),i.length>o&&(i=zip_array(i,o,method="last"),e=zip_array(e,o,method="last"),n=zip_array(n,o,method="last"));let h=i.length,$=s/h,c=Math.max.apply(Math,i),x=Math.min.apply(Math,i),m=.5*c+.5*x,y=i.map(t=>d-10-(t-x)/(c-x)*(d-10)),f={};f.max=.8*c+.2*m,f.mid=m,f.min=.2*m+.8*x;let u,b,p=Object.values(f).sort(),_=p.map(t=>d-10-(t-x)/(c-x)*(d-10));for(b=(e[e.length-1]-e[0])/2592e6>=1?"L":"S",g=``,g+="",g+="",g+='',g+='',g+='',g+="",g+="",g+=``,u=h-1;u>0;u-=Math.max(Math.round(h/5),1))t=unixtime_converter(e[u],b),g+=`${t}`,g+=``;for(g+='',g+='`,g+='`,g+=``,g+=``,g+="",u=0;u<3;u++){let t=p[u];g+=`${add_commas(t,dec=null,mil=!0)}`}for(u=0;u${t} ${add_commas(i[u],mil=!0)}`}return g+=""}function draw_spike_chart(t,e="",i=100,n=30,l=500){let r;if(0===(t=removeNaN(t)).length){console.log("Data error on ",e);let t=``;return t+=``,t+=`${e}`,t+=`N/A`,t+=""}t.length>l&&(t=zip_array(t,l,method="last"));let a,o=t.length,s=i/o,d=Math.max.apply(Math,t),g=Math.min.apply(Math,t),h=t.map(t=>n-(t-g)/(d-g)*n);for(r=``,r+="",r+="",r+='',r+='',r+='',r+="",r+='',r+='',r+='',r+="",r+="",r+=``,t[0]`,r+="",r+='`,r+=""}function horizontal_chart(t,e=200,i=20,n=10,l=["L","M","H"]){let r,a=i/2;return r=``,r+="",r+="",r+='',r+='',r+='',r+="",r+='',r+='',r+='',r+="",r+='',r+='',r+='',r+="",r+="",r+=``,r+=``,r+=``,ball_color=t>=65?"#33cc33":t<=35?"#ff0000":"#ffcc00",t<10?(r+=``,r+=`${t}`):t>90?(r+=``,r+=`${t}`):(r+=``,r+=`${t}`),l.length>0&&(r+=`${l[0]}`,r+=`${l[1]}`,r+=`${l[2]}`),r+=""}function zip_array(t,e,i="last"){let n=Math.max(Math.round(t.length/e),1),l=[];for(let e=0;ee&&(l=l.slice(l.length-e)),l}