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=`"}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=`"}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=`"}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=`"}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=`"}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=`"}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=`"}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=`"}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=`"}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=`"}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=`"}function horizontal_chart(t,e=200,i=20,n=10,l=["L","M","H"]){let r,a=i/2;return 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}