diff --git a/dist/uPlot.cjs.js b/dist/uPlot.cjs.js index e0580206..cbb17468 100644 --- a/dist/uPlot.cjs.js +++ b/dist/uPlot.cjs.js @@ -4,7 +4,7 @@ * * uPlot.js (μPlot) * A small, fast chart for time series, lines, areas, ohlc & bars -* https://github.com/leeoniya/uPlot (v1.6.5) +* https://github.com/leeoniya/uPlot (v1.6.6) */ 'use strict'; diff --git a/dist/uPlot.esm.js b/dist/uPlot.esm.js index 28cba3ad..e4bae91b 100644 --- a/dist/uPlot.esm.js +++ b/dist/uPlot.esm.js @@ -4,7 +4,7 @@ * * uPlot.js (μPlot) * A small, fast chart for time series, lines, areas, ohlc & bars -* https://github.com/leeoniya/uPlot (v1.6.5) +* https://github.com/leeoniya/uPlot (v1.6.6) */ const FEAT_TIME = true; diff --git a/dist/uPlot.iife.js b/dist/uPlot.iife.js index 3b07a352..ae642fe1 100644 --- a/dist/uPlot.iife.js +++ b/dist/uPlot.iife.js @@ -4,7 +4,7 @@ * * uPlot.js (μPlot) * A small, fast chart for time series, lines, areas, ohlc & bars -* https://github.com/leeoniya/uPlot (v1.6.5) +* https://github.com/leeoniya/uPlot (v1.6.6) */ var uPlot = (function () { diff --git a/dist/uPlot.iife.min.js b/dist/uPlot.iife.min.js index 815c11fa..00328b45 100644 --- a/dist/uPlot.iife.min.js +++ b/dist/uPlot.iife.min.js @@ -1,2 +1,2 @@ -/*! https://github.com/leeoniya/uPlot (v1.6.5) */ +/*! https://github.com/leeoniya/uPlot (v1.6.6) */ var uPlot=function(){"use strict";function n(n,r,e,t){var i;e=e||0;for(var l=2147483647>=(t=t||r.length-1);t-e>1;)n>r[i=l?e+t>>1:m((e+t)/2)]?e=i:t=i;return n-r[e]>r[t]-n?t:e}function r(n,r,e,t){for(var i=1==t?r:e;i>=r&&e>=i;i+=t)if(null!=n[i])return i;return-1}var e=[0,0];function t(n,r,t,i){return e[0]=0>t?C(n,-t):n,e[1]=0>i?C(r,-i):r,e}function i(n,r,e,i){var l,a,o,s=10==e?k:y;return n==r&&(n/=e,r*=e),i?(l=m(s(n)),a=g(s(r)),n=(o=t(b(e,l),b(e,a),l,a))[0],r=o[1]):(l=m(s(d(n))),a=m(s(d(r))),n=Y(n,(o=t(b(e,l),b(e,a),l,a))[0]),r=W(r,o[1])),[n,r]}function l(n,r,e,t){var l=i(n,r,e,t);return 0==n&&(l[0]=0),0==r&&(l[1]=0),l}var a={pad:0,soft:null,mode:0},o={min:a,max:a};function s(n,r,e,t){return O(e)?f(n,r,e):(a.pad=e,a.soft=t?0:null,a.mode=t?3:0,f(n,r,o))}function u(n,r){return null==n?r:n}function f(n,r,e){var t=e.min,i=e.max,l=u(t.pad,0),a=u(i.pad,0),o=u(t.hard,-S),s=u(i.hard,S),f=u(t.soft,S),c=u(i.soft,-S),v=u(t.mode,0),h=u(i.mode,0),p=r-n,g=p||d(r)||1e3,_=k(g),y=b(10,m(_)),M=C(Y(n-g*(0==p?0==n?.1:1:l),y/10),6),T=f>n||1!=v&&(3!=v||M>f)&&(2!=v||f>M)?S:f,z=x(o,T>M&&n>=T?T:w(T,M)),D=C(W(r+g*(0==p?0==r?.1:1:a),y/10),6),E=r>c||1!=h&&(3!=h||c>D)&&(2!=h||D>c)?-S:c,P=w(s,D>E&&E>=r?E:x(E,D));return z==P&&0==z&&(P=100),[z,P]}var c=new Intl.NumberFormat(navigator.language).format,v=Math,h=v.PI,d=v.abs,m=v.floor,p=v.round,g=v.ceil,w=v.min,x=v.max,b=v.pow,_=v.sqrt,k=v.log10,y=v.log2,M=(n,r)=>(void 0===r&&(r=1),v.asinh(n/r)),S=1/0;function T(n,r){return p(n/r)*r}function z(n,r,e){return w(x(n,r),e)}function D(n){return"function"==typeof n?n:()=>n}var E=(n,r)=>r,P=()=>null,A=()=>!0;function W(n,r){return g(n/r)*r}function Y(n,r){return m(n/r)*r}function C(n,r){return p(n*(r=Math.pow(10,r)))/r}var H=new Map;function F(n){return((""+n).split(".")[1]||"").length}function N(n,r,e,t){for(var i=[],l=t.map(F),a=r;e>a;a++)for(var o=d(a),s=C(b(n,a),o),u=0;t.length>u;u++){var f=t[u]*s,c=(0>f||0>a?o:0)+(l[u]>a?l[u]:0),v=C(f,c);i.push(v),H.set(v,c)}return i}var I={},L=Array.isArray;function V(n){return"string"==typeof n}function O(n){var r=!1;if(null!=n){var e=n.constructor;r=null==e||e==Object}return r}function j(n){return null!=n&&"object"==typeof n}function G(n,r){var e;if(r=r||O,L(n))e=n.map((n=>G(n,r)));else if(r(n))for(var t in e={},n)e[t]=G(n[t],r);else e=n;return e}function U(n){for(var r=arguments,e=1;r.length>e;e++){var t=r[e];for(var i in t)O(n[i])?U(n[i],G(t[i])):n[i]=G(t[i])}return n}function B(n,r,e){for(var t=0,i=void 0,l=-1;r.length>t;t++){var a=r[t];if(a>l){for(i=a-1;i>=0&&null==n[i];)n[i--]=null;for(i=a+1;e>i&&null==n[i];)n[l=i++]=null}}}var R="undefined"==typeof queueMicrotask?n=>Promise.resolve().then(n):queueMicrotask,J="width",q="height",Z="top",X="bottom",K="left",Q="right",$="#000",nn="#0000",rn="mousemove",en="mousedown",tn="mouseup",ln="mouseenter",an="mouseleave",on="dblclick",sn="resize",un="scroll",fn="u-off",cn="u-label",vn=document,hn=window,dn=devicePixelRatio;function mn(n,r){if(null!=r){var e=n.classList;!e.contains(r)&&e.add(r)}}function pn(n,r){var e=n.classList;e.contains(r)&&e.remove(r)}function gn(n,r,e){n.style[r]=e+"px"}function wn(n,r,e,t){var i=vn.createElement(n);return null!=r&&mn(i,r),null!=e&&e.insertBefore(i,t),i}function xn(n,r){return wn("div",n,r)}function bn(n,r,e,t,i){n.style.transform="translate("+r+"px,"+e+"px)",0>r||0>e||r>t||e>i?mn(n,fn):pn(n,fn)}var _n={passive:!0};function kn(n,r,e){r.addEventListener(n,e,_n)}function yn(n,r,e){r.removeEventListener(n,e,_n)}var Mn=["January","February","March","April","May","June","July","August","September","October","November","December"],Sn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Tn(n){return n.slice(0,3)}var zn=Sn.map(Tn),Dn=Mn.map(Tn),En={MMMM:Mn,MMM:Dn,WWWW:Sn,WWW:zn};function Pn(n){return(10>n?"0":"")+n}var An={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,r)=>r.MMMM[n.getMonth()],MMM:(n,r)=>r.MMM[n.getMonth()],MM:n=>Pn(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>Pn(n.getDate()),D:n=>n.getDate(),WWWW:(n,r)=>r.WWWW[n.getDay()],WWW:(n,r)=>r.WWW[n.getDay()],HH:n=>Pn(n.getHours()),H:n=>n.getHours(),h:n=>{var r=n.getHours();return 0==r?12:r>12?r-12:r},AA:n=>12>n.getHours()?"AM":"PM",aa:n=>12>n.getHours()?"am":"pm",a:n=>12>n.getHours()?"a":"p",mm:n=>Pn(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>Pn(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>function(n){return(10>n?"00":100>n?"0":"")+n}(n.getMilliseconds())};function Wn(n,r){r=r||En;for(var e,t=[],i=/\{([a-z]+)\}|[^{]+/gi;e=i.exec(n);)t.push("{"==e[0][0]?An[e[1]]:e[0]);return n=>{for(var e="",i=0;t.length>i;i++)e+="string"==typeof t[i]?t[i]:t[i](n,r);return e}}var Yn=(new Intl.DateTimeFormat).resolvedOptions().timeZone,Cn=n=>n%1==0,Hn=[1,2,2.5,5],Fn=N(10,-16,0,Hn),Nn=N(10,0,16,Hn),In=Nn.filter(Cn),Ln=Fn.concat(Nn),Vn="{YYYY}",On="\n"+Vn,jn="{M}/{D}",Gn="\n"+jn,Un=Gn+"/{YY}",Bn="{aa}",Rn="{h}:{mm}"+Bn,Jn="\n"+Rn,qn=":{ss}",Zn=null;function Xn(n){var r=1e3*n,e=60*r,t=60*e,i=24*t,l=30*i,a=365*i;return[(1==n?N(10,0,3,Hn).filter(Cn):N(10,-3,0,Hn)).concat([r,5*r,10*r,15*r,30*r,e,5*e,10*e,15*e,30*e,t,2*t,3*t,4*t,6*t,8*t,12*t,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,l,2*l,3*l,4*l,6*l,a,2*a,5*a,10*a,25*a,50*a,100*a]),[[a,Vn,Zn,Zn,Zn,Zn,Zn,Zn,1],[28*i,"{MMM}",On,Zn,Zn,Zn,Zn,Zn,1],[i,jn,On,Zn,Zn,Zn,Zn,Zn,1],[t,"{h}"+Bn,Un,Zn,Gn,Zn,Zn,Zn,1],[e,Rn,Un,Zn,Gn,Zn,Zn,Zn,1],[r,qn,Un+" "+Rn,Zn,Gn+" "+Rn,Zn,Jn,Zn,1],[n,qn+".{fff}",Un+" "+Rn,Zn,Gn+" "+Rn,Zn,Jn,Zn,1]],function(r){return(o,s,u,f,c,v)=>{var h=[],d=c>=a,p=c>=l&&a>c,g=r(u),w=g*n,x=or(g.getFullYear(),d?0:g.getMonth(),p||d?1:g.getDate()),b=x*n;if(p||d)for(var _=p?c/l:0,k=d?c/a:0,y=w==b?w:or(x.getFullYear()+k,x.getMonth()+_,1)*n,M=new Date(y/n),S=M.getFullYear(),T=M.getMonth(),z=0;f>=y;z++){var D=or(S+k*z,T+_*z,1);(y=(+D+(D-r(D*n)))*n)>f||h.push(y)}else{var E=i>c?c:i,P=b+(m(u)-m(w))+W(w-b,E);h.push(P);for(var A=r(P),Y=A.getHours()+A.getMinutes()/e+A.getSeconds()/t,H=c/t,F=v/o.axes[s]._space;(P=C(P+c,1==n?0:3))<=f;)if(H>1){var N=m(C(Y+H,6))%24,I=r(P).getHours()-N;I>1&&(I=-1),Y=(Y+H)%24,.7>C(((P-=I*t)-h[h.length-1])/c,3)*F||h.push(P)}else h.push(P)}return h}}]}var Kn=Xn(1),Qn=Kn[0],$n=Kn[1],nr=Kn[2],rr=Xn(.001),er=rr[0],tr=rr[1],ir=rr[2];function lr(n,r){return n.map((n=>n.map(((e,t)=>0==t||8==t||null==e?e:r(1==t||0==n[8]?e:n[1]+e)))))}function ar(n,r){return(e,t,i,l,a)=>{var o,s,u,f,c,v,h=r.find((n=>a>=n[0]))||r[r.length-1];return t.map((r=>{var e=n(r),t=e.getFullYear(),i=e.getMonth(),l=e.getDate(),a=e.getHours(),d=e.getMinutes(),m=e.getSeconds(),p=t!=o&&h[2]||i!=s&&h[3]||l!=u&&h[4]||a!=f&&h[5]||d!=c&&h[6]||m!=v&&h[7]||h[1];return o=t,s=i,u=l,f=a,c=d,v=m,p(e)}))}}function or(n,r,e){return new Date(n,r,e)}function sr(n,r){return r(n)}function ur(n,r){return(e,t)=>r(n(t))}function fr(n,r){var e=n.series[r];return e.width?e.stroke(n,r):e.points.width?e.points.stroke(n,r):null}function cr(n,r){return n.series[r].fill(n,r)}N(2,-53,53,[1]);var vr=[0,0];function hr(n,r,e){return n=>{0==n.button&&e(n)}}function dr(n,r,e){return e}var mr={show:!0,x:!0,y:!0,lock:!1,move:function(n,r,e){return vr[0]=r,vr[1]=e,vr},points:{show:function(n,r){var e=n.cursor.points,t=xn(),i=e.stroke(n,r),l=e.fill(n,r);t.style.background=l||i;var a=e.size(n,r),o=e.width(n,r,a);o&&(t.style.border=o+"px solid "+i);var s=a/-2;return gn(t,J,a),gn(t,q,a),gn(t,"marginLeft",s),gn(t,"marginTop",s),t},size:function(n,r){return Yr(n.series[r].width,1)},width:0,stroke:function(n,r){return n.series[r].stroke(n,r)},fill:function(n,r){return n.series[r].stroke(n,r)}},bind:{mousedown:hr,mouseup:hr,click:hr,dblclick:hr,mousemove:dr,mouseleave:dr,mouseenter:dr},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,_x:!1,_y:!1},focus:{prox:-1},left:-10,top:-10,idx:null,dataIdx:function(n,r,e){return e}},pr={show:!0,stroke:"rgba(0,0,0,0.07)",width:2,filter:E},gr=U({},pr,{size:10}),wr='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',xr="bold "+wr,br={show:!0,scale:"x",stroke:$,space:50,gap:5,size:50,labelSize:30,labelFont:xr,side:2,grid:pr,ticks:gr,font:wr,rotate:0},_r={show:!0,scale:"x",auto:!1,sorted:1,min:S,max:-S,idxs:[]};function kr(n,r){return r.map((n=>null==n?"":c(n)))}function yr(n,r,e,t,i,l,a){for(var o=[],s=H.get(i)||0,u=e=a?e:C(W(e,i),s);t>=u;u=C(u+i,s))o.push(Object.is(u,-0)?0:u);return o}function Mr(n,r,e,t,i){var l=[],a=n.scales[n.axes[r].scale].log,o=m((10==a?k:y)(e));i=b(a,o),0>o&&(i=C(i,-o));var s=e;do{l.push(s),i*a>(s=C(s+i,H.get(i)))||(i=s)}while(t>=s);return l}function Sr(n,r,e,t,i){var l=n.scales[n.axes[r].scale].asinh,a=t>l?Mr(n,r,x(l,e),t,i):[l],o=0>t||e>0?[]:[0];return(-l>e?Mr(n,r,x(l,-t),-e,i):[l]).reverse().map((n=>-n)).concat(o,a)}var Tr=/./,zr=/[12357]/,Dr=/[125]/,Er=/1/;function Pr(n,r,e){var t=n.axes[e],i=t.scale,l=n.scales[i];if(3==l.distr&&2==l.log)return r;var a=n.valToPos,o=t._space,s=a(10,i),u=a(9,i)-s4==l.distr&&0==n||u.test(n)?n:null))}function Ar(n,r){return null==r?"":c(r)}var Wr={show:!0,scale:"y",stroke:$,space:30,gap:5,size:50,labelSize:30,labelFont:xr,side:3,grid:pr,ticks:gr,font:wr,rotate:0};function Yr(n,r){return C((3+2*(n||1))*r,3)}function Cr(n,r){var e=n.scales[n.series[r].scale],t=n.bands&&n.bands.some((n=>n.series[0]==r));return 3==e.distr||t?e.min:0}var Hr={scale:"y",auto:!0,sorted:0,show:!0,band:!1,spanGaps:!1,alpha:1,points:{show:function(n,r){var e=n.series[0].idxs;return(0==n.scales[n.series[0].scale].ori?n.bbox.width:n.bbox.height)/(n.series[r].points.space*dn)>=e[1]-e[0]}},values:null,min:S,max:-S,idxs:[],path:null,clip:null};function Fr(n,r,e){return e/10}var Nr={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Ir=U({},Nr,{time:!1,ori:1}),Lr={};function Vr(n){var r=Lr[n];if(!r){var e=[];r={key:n,sub:function(n){e.push(n)},unsub:function(n){e=e.filter((r=>r!=n))},pub:function(n,r,t,i,l,a){for(var o=0;e.length>o;o++)e[o]!=r&&e[o].pub(n,r,t,i,l,a,o)}},null!=n&&(Lr[n]=r)}return r}function Or(n,r,e){var t=n.series[r],i=n.scales,l=n.bbox,a=n._data[0],o=n._data[r],s=i[n.series[0].scale],u=i[t.scale],f=l.left,c=l.top,v=l.width,h=l.height,d=n.valToPosH,m=n.valToPosV;return 0==s.ori?e(t,a,o,s,u,d,m,f,c,v,h,Br,Jr,Zr,Kr,$r):e(t,a,o,s,u,m,d,c,f,h,v,Rr,qr,Xr,Qr,ne)}function jr(n,r,e,t,i){return Or(n,r,((n,r,l,a,o,s,u,f,c,v,h)=>{var d,m,p=0==a.ori?Jr:qr;1==a.dir*(0==a.ori?1:-1)?(d=e,m=t):(d=t,m=e);var g=T(s(r[d],a,v,f),.5),w=T(u(l[d],o,h,c),.5),x=T(s(r[m],a,v,f),.5),b=T(u(o.max,o,h,c),.5),_=new Path2D(i);return p(_,x,b),p(_,g,b),p(_,g,w),_}))}function Gr(n,r,e,t,i,l){var a=null;if(n.length>0){a=new Path2D;for(var o=0==r?Zr:Xr,s=e,u=0;n.length>u;u++){var f=n[u];o(a,s,t,f[0]-s,t+l),s=f[1]}o(a,s,t,e+i-s,t+l)}return a}function Ur(n,r,e){if(e>r){var t=n[n.length-1];t&&t[0]==r?t[1]=e:n.push([r,e])}}function Br(n,r,e){n.moveTo(r,e)}function Rr(n,r,e){n.moveTo(e,r)}function Jr(n,r,e){n.lineTo(r,e)}function qr(n,r,e){n.lineTo(e,r)}function Zr(n,r,e,t,i){n.rect(r,e,t,i)}function Xr(n,r,e,t,i){n.rect(e,r,i,t)}function Kr(n,r,e,t,i,l){n.arc(r,e,t,i,l)}function Qr(n,r,e,t,i,l){n.arc(e,r,t,i,l)}function $r(n,r,e,t,i,l,a){n.bezierCurveTo(r,e,t,i,l,a)}function ne(n,r,e,t,i,l,a){n.bezierCurveTo(e,r,i,t,a,l)}function re(n){return(r,e,t,i,l)=>{t!=i&&(n(r,e,t),n(r,e,i),n(r,e,l))}}var ee=re(Jr),te=re(qr);function ie(){return(n,e,t,i)=>Or(n,e,((l,a,o,s,u,f,c,v,h,d,m)=>{var g,b;0==s.ori?(g=Jr,b=ee):(g=qr,b=te);var _,k,y,M=s.dir*(0==s.ori?1:-1),z={stroke:new Path2D,fill:null,clip:null,band:null},D=z.stroke,E=S,P=-S,A=[],W=p(f(a[1==M?t:i],s,d,v)),Y=!1,C=r(o,t,i,1*M),H=r(o,t,i,-1*M),F=T(f(a[C],s,d,v),.5),N=T(f(a[H],s,d,v),.5);F>v&&Ur(A,v,F);for(var I=1==M?t:i;I>=t&&i>=I;I+=M){var L=p(f(a[I],s,d,v));if(L==W)null!=o[I]?(_=p(c(o[I],u,m,h)),E==S&&g(D,L,_),E=w(_,E),P=x(_,P)):Y||null!==o[I]||(Y=!0);else{var V=!1;E!=S?(b(D,W,E,P,_),k=y=W):Y&&(V=!0,Y=!1),null!=o[I]?(g(D,L,_=p(c(o[I],u,m,h))),E=P=_,L-W>1&&null===o[I-M]&&(V=!0)):(E=S,P=-S,Y||null!==o[I]||(Y=!0)),V&&Ur(A,k,L),W=L}}if(E!=S&&E!=P&&y!=W&&b(D,W,E,P,_),v+d>N&&Ur(A,N,v+d),null!=l.fill){var O=z.fill=new Path2D(D),j=p(c(l.fillTo(n,e,l.min,l.max),u,m,h));g(O,N,j),g(O,F,j)}return l.spanGaps||(z.clip=Gr(A,s.ori,v,h,d,m)),n.bands.length>0&&(z.band=jr(n,e,t,i,D)),z}))}function le(n,r,e,t,i){var l,a,o,s,u,f,c,v,h,d,m,g,w,x,k,y,M,S,T,z,D,E,P,A,W,Y=new Path2D,C=n.length;t(Y,p(n[0]),p(r[0]));for(var H=0;C-1>H;H++){var F=0==H?0:H-1;a=r[F],s=r[H],u=n[H+1],f=r[H+1],C>H+2?(c=n[H+2],v=r[H+2]):(c=u,v=f),w=_(b((l=n[F])-(o=n[H]),2)+b(a-s,2)),x=_(b(o-u,2)+b(s-f,2)),k=_(b(u-c,2)+b(f-v,2)),z=b(k,e),E=b(k,2*e),D=b(x,e),P=b(x,2*e),(S=3*(W=b(w,e))*(W+D))>0&&(S=1/S),(T=3*z*(z+D))>0&&(T=1/T),d=(-P*a+(y=2*(A=b(w,2*e))+3*W*D+P)*s+A*f)*S,g=(E*s+(M=2*E+3*z*D+P)*f-P*v)*T,0==(h=(-P*l+y*o+A*u)*S)&&0==d&&(h=o,d=s),0==(m=(E*o+M*u-P*c)*T)&&0==g&&(m=u,g=f),i(Y,h,d,m,g,u,f)}return Y}var ae=ie();function oe(n,r,e,t){return(t?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map(((n,t)=>se(n,t,r,e)))}function se(n,r,e,t){return U({},0==r?e:t,n)}var ue=[null,null];function fe(n,r,e){return null==r?ue:[r,e]}var ce=fe;function ve(n,r,e){return null==r?ue:s(r,e,.1,!0)}function he(n,r,e,t){return null==r?ue:i(r,e,n.scales[t].log,!1)}var de=he;function me(n,r,e,t){return null==r?ue:l(r,e,n.scales[t].log,!1)}var pe=me;function ge(n){var r;return[n=n.replace(/(\d+)px/,((n,e)=>(r=p(e*dn))+"px")),r]}function we(r,e,t){var a={};function o(n,r){return((3==r.distr?k(n>0?n:r.clamp(a,n,r.min,r.max,r.key)):4==r.distr?M(n,r.asinh):n)-r._min)/(r._max-r._min)}function f(n,r,e,t){var i=o(n,r);return t+e*(-1==r.dir?1-i:i)}function c(n,r,e,t){var i=o(n,r);return t+e*(-1==r.dir?i:1-i)}function _(n,r,e,t){return 0==r.ori?f(n,r,e,t):c(n,r,e,t)}a.valToPosH=f,a.valToPosV=c;var y=!1;a.status=0;var Y=a.root=xn("uplot");null!=r.id&&(Y.id=r.id),mn(Y,r.class),r.title&&(xn("u-title",Y).textContent=r.title);var F=wn("canvas"),N=a.ctx=F.getContext("2d"),B=xn("u-wrap",Y),$=xn("u-under",B);B.appendChild(F);var _n=xn("u-over",B),Mn=u((r=G(r)).pxAlign,!0);(r.plugins||[]).forEach((n=>{n.opts&&(r=n.opts(a,r)||r)}));var Sn=r.ms||.001,Tn=a.series=oe(r.series||[],_r,Hr,!1),zn=a.axes=oe(r.axes||[],br,Wr,!0),Dn=a.scales={},En=a.bands=r.bands||[];En.forEach((n=>{n.fill=D(n.fill||null)}));var Pn=Tn[0].scale,An={axes:function(){zn.forEach(((n,r)=>{if(n.show&&n._show){var e=Dn[n.scale],t=n.side,i=t%2,l=0==i?qr:Zr,o=0==i?Ur:Jr,s=p(n.gap*dn),u=n.ticks,f=u.show?p(u.size*dn):0,c=n._found,v=c[0],d=c[1],m=n._splits,g=2==e.distr?m.map((n=>Ae[n])):m,w=2==e.distr?Ae[m[1]]-Ae[m[0]]:v,x=n._rotate*-h/180,b=p(n._pos*dn),k=b+(f+s)*(0==i&&0==t||1==i&&3==t?-1:1),y=0==i?k:0,M=1==i?k:0;N.font=n.font[0],N.fillStyle=n.stroke(a,r),N.textAlign=1==n.align?K:2==n.align?Q:x>0?K:0>x?Q:0==i?"center":3==t?Q:K,N.textBaseline=x||1==i?"middle":2==t?Z:X;var S=1.5*n.font[1],T=m.map((n=>p(_(n,e,l,o))));if(n._values.forEach(((n,r)=>{null!=n&&(0==i?M=T[r]:y=T[r],(""+n).split(/\n/gm).forEach(((n,r)=>{x?(N.save(),N.translate(M,y+r*S),N.rotate(x),N.fillText(n,0,0),N.restore()):N.fillText(n,M,y+r*S)})))})),n.label){N.save();var z=p(n._lpos*dn);1==i?(M=y=0,N.translate(z,p(Jr+Zr/2)),N.rotate((3==t?-h:h)/2)):(M=p(Ur+qr/2),y=z),N.font=n.labelFont[0],N.textAlign="center",N.textBaseline=2==t?Z:X,N.fillText(n.label,M,y),N.restore()}u.show&&Ne(T,u.filter(a,g,r,d,w),i,t,b,f,C(u.width*dn,3),u.stroke(a,r),u.dash,u.cap);var D=n.grid;D.show&&Ne(T,D.filter(a,g,r,d,w),i,0==i?2:1,0==i?Jr:Ur,0==i?Zr:qr,C(D.width*dn,3),D.stroke(a,r),D.dash,D.cap)}})),Ct("drawAxes")},series:function(){Se>0&&(Tn.forEach(((n,r)=>{if(r>0&&n.show&&null==n._paths){var t=function(n){for(var r=z(De-1,0,Se-1),e=z(Ee+1,0,Se-1);null==n[r]&&r>0;)r--;for(;null==n[e]&&Se-1>e;)e++;return[r,e]}(e[r]);n._paths=n.paths(a,r,t[0],t[1])}})),Tn.forEach(((n,r)=>{r>0&&n.show&&(n._paths&&function(n){var r=Tn[n],e=r._paths,t=e.stroke,i=e.fill,l=e.clip,o=C(r.width*dn,3),s=o%2/2,u=r._stroke=r.stroke(a,n),f=r._fill=r.fill(a,n);N.globalAlpha=r.alpha;var c=Mn&&r.pxAlign;c&&N.translate(s,s),N.save();var v=Ur,h=Jr,d=qr,m=Zr,p=o*dn/2;0==r.min&&(m+=p),0==r.max&&(h-=p,m+=p),N.beginPath(),N.rect(v,h,d,m),N.clip(),l&&N.clip(l),function(n,r,e,t,i,l,o,s){var u=!1;En.forEach(((f,c)=>{if(f.series[0]==n){var v=Tn[f.series[1]],h=(v._paths||I).band;N.save();var d=null;v.show&&h&&(d=f.fill(a,c)||l,N.clip(h)),Fe(r,e,t,i,d,o,s),N.restore(),u=!0}})),u||Fe(r,e,t,i,l,o,s)}(n,u,o,r.dash,r.cap,f,t,i),N.restore(),c&&N.translate(-s,-s),N.globalAlpha=1}(r),n.points.show(a,r,De,Ee)&&function(n){var r=Tn[n],t=r.points,i=C(t.width*dn,3),l=i%2/2,o=t.width>0,s=(t.size-t.width)/2*dn,u=C(2*s,3),f=Mn&&r.pxAlign;f&&N.translate(l,l),N.save(),N.beginPath(),N.rect(Ur-u,Jr-u,qr+2*u,Zr+2*u),N.clip(),N.globalAlpha=r.alpha;var c,v,d,m,g=new Path2D,w=Dn[r.scale];0==jn.ori?(c=qr,v=Ur,d=Zr,m=Jr):(c=Zr,v=Jr,d=qr,m=Ur);for(var x=De;Ee>=x;x++)if(null!=e[n][x]){var b=p(Fn(e[0][x],jn,c,v)),_=p(Nn(e[n][x],w,d,m));Vn(g,b+s,_),On(g,b,_,s,0,2*h)}var k=t._stroke=t.stroke(a,n),y=t._fill=t.fill(a,n);He(k,i,t.dash,t.cap,y||(o?"#fff":r._stroke)),N.fill(g),o&&N.stroke(g),N.globalAlpha=1,N.restore(),f&&N.translate(-l,-l)}(r),Ct("drawSeries",r))})))}},Yn=(r.drawOrder||["axes","series"]).map((n=>An[n]));function Cn(n){var e=Dn[n];if(null==e){var t=(r.scales||I)[n]||I;if(null!=t.from)Cn(t.from),Dn[n]=U({},Dn[t.from],t);else{(e=Dn[n]=U({},n==Pn?Nr:Ir,t)).key=n;var i=e.time,l=e.range,a=L(l);if(n!=Pn&&!a&&O(l)){var o=l;l=(n,r,e)=>null==r?ue:s(r,e,o)}e.range=D(l||(i?ce:n==Pn?3==e.distr?de:4==e.distr?pe:fe:3==e.distr?he:4==e.distr?me:ve)),e.auto=D(!a&&e.auto),e.clamp=D(e.clamp||Fr),e._min=e._max=null}}}for(var Hn in Cn("x"),Cn("y"),Tn.forEach((n=>{Cn(n.scale)})),zn.forEach((n=>{Cn(n.scale)})),r.scales)Cn(Hn);var Fn,Nn,Vn,On,jn=Dn[Pn],Gn=jn.distr;0==jn.ori?(mn(Y,"u-hz"),Fn=f,Nn=c,Vn=Br,On=Kr):(mn(Y,"u-vt"),Fn=c,Nn=f,Vn=Rr,On=Qr);var Un={};for(var Bn in Dn){var Rn=Dn[Bn];null==Rn.min&&null==Rn.max||(Un[Bn]={min:Rn.min,max:Rn.max},Rn.min=Rn.max=null)}var Jn,qn=r.tzDate||(n=>new Date(n/Sn)),Zn=r.fmtDate||Wn,Xn=1==Sn?nr(qn):ir(qn),Kn=ar(qn,lr(1==Sn?$n:tr,Zn)),rr=ur(qn,sr("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Zn)),or=U({show:!0,live:!0},r.legend),vr=or.show;or.width=D(u(or.width,2)),or.dash=D(or.dash||"solid"),or.stroke=D(or.stroke||fr),or.fill=D(or.fill||cr);var hr,dr=[],pr=!1;if(vr){Jn=wn("table","u-legend",Y);var gr=Tn[1]?Tn[1].values:null;if(pr=null!=gr){var wr=wn("tr","u-thead",Jn);for(var xr in wn("th",null,wr),hr=gr(a,1,0))wn("th",cn,wr).textContent=xr}else hr={_:0},mn(Jn,"u-inline"),or.live&&mn(Jn,"u-live")}var Tr=new Map;function zr(n,r,e){var t=Tr.get(r)||{},i=le.bind[n](a,r,e);i&&(kn(n,r,t[n]=i),Tr.set(r,t))}var Dr=0,Er=0,Lr=0,Or=0,jr=0,Gr=0,Ur=0,Jr=0,qr=0,Zr=0;a.bbox={};var Xr=!1,$r=!1,ne=!1,re=!1,ee=!1;function te(n,r){n==a.width&&r==a.height||ie(n,r),Ve(!1),ne=!0,$r=!0,re=!0,ee=!0,nt()}function ie(n,r){a.width=Dr=Lr=n,a.height=Er=Or=r,jr=Gr=0,function(){var n=!1,r=!1,e=!1,t=!1;zn.forEach((i=>{if(i.show&&i._show){var l=i.side,a=l%2,o=i._size+(i.labelSize=null!=i.label?i.labelSize||30:0);o>0&&(a?(Lr-=o,3==l?(jr+=o,t=!0):e=!0):(Or-=o,0==l?(Gr+=o,n=!0):r=!0))}})),ye[0]=n,ye[1]=e,ye[2]=r,ye[3]=t,Lr-=ze[1]+ze[3],jr+=ze[3],Or-=ze[2]+ze[0],Gr+=ze[0]}(),function(){var n=jr+Lr,r=Gr+Or,e=jr,t=Gr;function i(i,l){switch(i){case 1:return(n+=l)-l;case 2:return(r+=l)-l;case 3:return(e-=l)+l;case 0:return(t-=l)+l}}zn.forEach((n=>{if(n.show&&n._show){var r=n.side;n._pos=i(r,n._size),null!=n.label&&(n._lpos=i(r,n.labelSize))}}))}();var e=a.bbox;Ur=e.left=T(jr*dn,.5),Jr=e.top=T(Gr*dn,.5),qr=e.width=T(Lr*dn,.5),Zr=e.height=T(Or*dn,.5)}a.setSize=function(n){te(n.width,n.height)};var le=a.cursor=U({},mr,r.cursor);le._lock=!1;var we=le.points;we.show=D(we.show),we.size=D(we.size),we.stroke=D(we.stroke),we.width=D(we.width),we.fill=D(we.fill);var xe=a.focus=U({},r.focus||{alpha:.3},le.focus),be=xe.prox>=0,_e=[null];function ke(n,r){var e=Dn[n.scale].time,t=n.value;if(n.value=e?V(t)?ur(qn,sr(t,Zn)):t||rr:t||Ar,n.label=n.label||(e?"Time":"Value"),r>0){n.width=null==n.width?1:n.width,n.paths=n.paths||ae||P,n.fillTo=D(n.fillTo||Cr),n.pxAlign=u(n.pxAlign,!0),n.stroke=D(n.stroke||null),n.fill=D(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;var i=Yr(n.width,1),l=n.points=U({},{size:i,width:x(1,.2*i),stroke:n.stroke,space:2*i,_stroke:null,_fill:null},n.points);l.show=D(l.show),l.fill=D(l.fill),l.stroke=D(l.stroke)}if(vr&&dr.splice(r,0,function(n,r){if(0==r&&(pr||!or.live))return null;var e=[],t=wn("tr","u-series",Jn,Jn.childNodes[r]);mn(t,n.class),n.show||mn(t,fn);var i=wn("th",null,t),l=xn("u-marker",i);if(r>0){var o=or.width(a,r);o&&(l.style.border=o+"px "+or.dash(a,r)+" "+or.stroke(a,r)),l.style.background=or.fill(a,r)}var s=xn(cn,i);for(var u in s.textContent=n.label,r>0&&(zr("click",i,(()=>{le._lock||dt(Tn.indexOf(n),{show:!n.show},Ht.setSeries)})),be&&zr(ln,i,(()=>{le._lock||dt(Tn.indexOf(n),mt,Ht.setSeries)}))),hr){var f=wn("td","u-value",t);f.textContent="--",e.push(f)}return e}(n,r)),le.show){var o=function(n,r){if(r>0){var e=le.points.show(a,r);if(e)return mn(e,"u-cursor-pt"),mn(e,n.class),bn(e,-10,-10,Lr,Or),_n.insertBefore(e,_e[r]),e}}(n,r);o&&_e.splice(r,0,o)}}a.addSeries=function(n,r){n=se(n,r=null==r?Tn.length:r,_r,Hr),Tn.splice(r,0,n),ke(Tn[r],r)},a.delSeries=function(n){Tn.splice(n,1),vr&&dr.splice(n,1)[0][0].parentNode.remove(),_e.length>1&&_e.splice(n,1)[0].remove()},Tn.forEach(ke);var ye=[!1,!1,!1,!1];function Me(n,r,e){var t=e[0],i=e[1],l=e[2],a=e[3],o=r%2,s=0;return 0==o&&(a||i)&&(s=0==r&&!t||2==r&&!l?p(br.size/3):0),1==o&&(t||l)&&(s=1==r&&!i||3==r&&!a?p(Wr.size/2):0),s}zn.forEach((function(n,r){if(n._show=n.show,n.show){var e=Dn[n.scale];null==e&&(n.scale=n.side%2?Tn[1].scale:Pn,e=Dn[n.scale]);var t=e.time;n.size=D(n.size),n.space=D(n.space),n.rotate=D(n.rotate),n.incrs=D(n.incrs||(2==e.distr?In:t?1==Sn?Qn:er:Ln)),n.splits=D(n.splits||(t&&1==e.distr?Xn:3==e.distr?Mr:4==e.distr?Sr:yr)),n.stroke=D(n.stroke),n.grid.stroke=D(n.grid.stroke),n.ticks.stroke=D(n.ticks.stroke);var i=n.values;n.values=t?L(i)?ar(qn,lr(i,Zn)):V(i)?function(n,r){var e=Wn(r);return(r,t)=>t.map((r=>e(n(r))))}(qn,i):i||Kn:i||kr,n.filter=D(n.filter||(3>e.distr?E:Pr)),n.font=ge(n.font),n.labelFont=ge(n.labelFont),n._size=n.size(a,null,r,0),n._space=n._rotate=n._incrs=n._found=n._splits=n._values=null,n._size>0&&(ye[r]=!0)}}));var Se,Te=a.padding=(r.padding||[Me,Me,Me,Me]).map((n=>D(u(n,Me)))),ze=a._padding=Te.map(((n,r)=>n(a,r,ye,0))),De=null,Ee=null,Pe=Tn[0].idxs,Ae=null,We=!1;function Ye(n,r){if((n=n||[])[0]=n[0]||[],a.data=n,e=n.slice(),Se=(Ae=e[0]).length,2==Gn&&(e[0]=Ae.map(((n,r)=>r))),a._data=e,Ve(!0),Ct("setData"),!1!==r){var t=jn;t.auto(a,We)?Ce():ht(Pn,t.min,t.max),re=le.left>=0,ee=!0,nt()}}function Ce(){var n,r,t,a,o;We=!0,Se>0?(De=Pe[0]=0,Ee=Pe[1]=Se-1,a=e[0][De],o=e[0][Ee],2==Gn?(a=De,o=Ee):1==Se&&(3==Gn?(a=(n=i(a,a,jn.log,!1))[0],o=n[1]):4==Gn?(a=(r=l(a,a,jn.log,!1))[0],o=r[1]):jn.time?o=a+86400/Sn:(a=(t=s(a,o,.1,!0))[0],o=t[1]))):(De=Pe[0]=a=null,Ee=Pe[1]=o=null),ht(Pn,a,o)}function He(n,r,e,t,i){N.strokeStyle=n||nn,N.lineWidth=r,N.lineJoin="round",N.lineCap=t||"butt",N.setLineDash(e||[]),N.fillStyle=i||nn}function Fe(n,r,e,t,i,l,a){He(n,r,e,t,i),i&&a&&N.fill(a),n&&l&&r&&N.stroke(l)}function Ne(n,r,e,t,i,l,a,o,s,u){var f=a%2/2;Mn&&N.translate(f,f),He(o,a,s,u),N.beginPath();var c,v,h,d,m=i+(0==t||3==t?-l:l);0==e?(v=i,d=m):(c=i,h=m),n.forEach(((n,t)=>{null!=r[t]&&(0==e?c=h=n:v=d=n,N.moveTo(c,v),N.lineTo(h,d))})),N.stroke(),Mn&&N.translate(-f,-f)}function Ie(n){var r=!0;return zn.forEach(((e,t)=>{if(e.show){var i=Dn[e.scale];if(null!=i.min){e._show||(r=!1,e._show=!0,Ve(!1));var l=e.side,o=i.min,s=i.max,u=function(n,r,e,t){var i,l=zn[n];if(t>0){var o=l._space=l.space(a,n,r,e,t),s=l._incrs=l.incrs(a,n,r,e,t,o);i=l._found=function(n,r,e,t,i){for(var l=t/(r-n),a=(""+m(n)).length,o=0;e.length>o;o++){var s=e[o]*l,u=10>e[o]?H.get(e[o]):0;if(s>=i&&17>a+u)return[e[o],s]}return[0,0]}(r,e,s,t,o)}else i=[0,0];return i}(t,o,s,0==l%2?Lr:Or),f=u[0],c=u[1];if(0!=c){var v=e._splits=e.splits(a,t,o,s,f,c,2==i.distr),h=2==i.distr?v.map((n=>Ae[n])):v,d=2==i.distr?Ae[v[1]]-Ae[v[0]]:f,p=e._values=e.values(a,e.filter(a,h,t,c,d),t,c,d);e._rotate=2==l?e.rotate(a,p,t,c):0;var w=e._size;e._size=g(e.size(a,p,t,n)),null!=w&&e._size!=w&&(r=!1)}}else e._show&&(r=!1,e._show=!1,Ve(!1))}})),r}function Le(n){var r=!0;return Te.forEach(((e,t)=>{var i=e(a,t,ye,n);i!=ze[t]&&(r=!1),ze[t]=i})),r}function Ve(n){Tn.forEach(((r,e)=>{e>0&&(r._paths=null,n&&(r.min=null,r.max=null))}))}a.setData=Ye;var Oe,je,Ge,Ue,Be,Re,Je,qe,Ze,Xe,Ke,Qe,$e=!1;function nt(){$e||(R(rt),$e=!0)}function rt(){Xr&&(function(){var r=G(Dn,j);for(var t in r){var i=r[t],l=Un[t];if(null!=l&&null!=l.min)U(i,l),t==Pn&&Ve(!0);else if(t!=Pn)if(0==Se&&null==i.from){var o=i.range(a,null,null,t);i.min=o[0],i.max=o[1]}else i.min=S,i.max=-S}if(Se>0)for(var s in Tn.forEach(((t,i)=>{var l=t.scale,o=r[l],s=Un[l];if(0==i){var u=o.range(a,o.min,o.max,l);o.min=u[0],o.max=u[1],De=n(o.min,e[0]),Ee=n(o.max,e[0]),o.min>e[0][De]&&De++,e[0][Ee]>o.max&&Ee--,t.min=Ae[De],t.max=Ae[Ee]}else if(t.show&&t.auto&&o.auto(a,We)&&(null==s||null==s.min)){var f=null==t.min?3==o.distr?function(n,r,e){for(var t=S,i=-S,l=r;e>=l;l++)n[l]>0&&(t=w(t,n[l]),i=x(i,n[l]));return[t==S?1:t,i==-S?10:i]}(e[i],De,Ee):function(n,r,e,t){var i=S,l=-S;if(1==t)i=n[r],l=n[e];else if(-1==t)i=n[e],l=n[r];else for(var a=r;e>=a;a++)null!=n[a]&&(i=w(i,n[a]),l=x(l,n[a]));return[i,l]}(e[i],De,Ee,t.sorted):[t.min,t.max];o.min=w(o.min,t.min=f[0]),o.max=x(o.max,t.max=f[1])}t.idxs[0]=De,t.idxs[1]=Ee})),r){var u=r[s],f=Un[s];if(null==u.from&&(null==f||null==f.min)){var c=u.range(a,u.min==S?null:u.min,u.max==-S?null:u.max,s);u.min=c[0],u.max=c[1]}}for(var v in r){var h=r[v];if(null!=h.from){var d=r[h.from],m=h.range(a,d.min,d.max,v);h.min=m[0],h.max=m[1]}}var p={},g=!1;for(var b in r){var _=r[b],y=Dn[b];if(y.min!=_.min||y.max!=_.max){y.min=_.min,y.max=_.max;var T=y.distr;y._min=3==T?k(y.min):4==T?M(y.min,y.asinh):y.min,y._max=3==T?k(y.max):4==T?M(y.max,y.asinh):y.max,p[b]=g=!0}}if(g){for(var z in Tn.forEach((n=>{p[n.scale]&&(n._paths=null)})),p)ne=!0,Ct("setScale",z);le.show&&(re=le.left>=0)}for(var D in Un)Un[D]=null}(),Xr=!1),ne&&(function(){for(var n=!1,r=0;!n;){var e=Ie(++r),t=Le(r);(n=e&&t)||(ie(a.width,a.height),$r=!0)}}(),ne=!1),$r&&(gn($,K,jr),gn($,Z,Gr),gn($,J,Lr),gn($,q,Or),gn(_n,K,jr),gn(_n,Z,Gr),gn(_n,J,Lr),gn(_n,q,Or),gn(B,J,Dr),gn(B,q,Er),F.width=p(Dr*dn),F.height=p(Er*dn),Mt(),Ct("setSize"),$r=!1),Dr>0&&Er>0&&(N.clearRect(0,0,F.width,F.height),Ct("drawClear"),Yn.forEach((n=>n())),Ct("draw")),le.show&&re&&(kt(),re=!1),y||(y=!0,a.status=1,Ct("ready")),We=!1,$e=!1}function et(r,t){var i=Dn[r];if(null==i.from){if(0==Se){var l=i.range(a,t.min,t.max,r);t.min=l[0],t.max=l[1]}if(t.min>t.max){var o=t.min;t.min=t.max,t.max=o}if(Se>1&&null!=t.min&&null!=t.max&&1e-16>t.max-t.min)return;r==Pn&&2==i.distr&&Se>0&&(t.min=n(t.min,e[0]),t.max=n(t.max,e[0])),Un[r]=t,Xr=!0,nt()}}a.redraw=(n,r)=>{ne=r||!1,!1!==n?ht(Pn,jn.min,jn.max):nt()},a.setScale=et;var tt=!1,it=le.drag,lt=it.x,at=it.y;le.show&&(le.x&&(Oe=xn("u-cursor-x",_n)),le.y&&(je=xn("u-cursor-y",_n)),0==jn.ori?(Ge=Oe,Ue=je):(Ge=je,Ue=Oe),Ke=le.left,Qe=le.top);var ot,st,ut,ft=a.select=U({show:!0,over:!0,left:0,width:0,top:0,height:0},r.select),ct=ft.show?xn("u-select",ft.over?_n:$):null;function vt(n,r){if(ft.show){for(var e in n)gn(ct,e,ft[e]=n[e]);!1!==r&&Ct("setSelect")}}function ht(n,r,e){et(n,{min:r,max:e})}function dt(n,r,e){var t=Tn[n];null!=r.focus&&function(n){if(n!=ut){var r=null==n;Tn.forEach(((e,t)=>{var i=r||0==t||t==n;e._focus=r?null:i,function(n,r){!function(n,r){Tn[n].alpha=r,le.show&&_e[n]&&(_e[n].style.opacity=r),vr&&dr[n]&&(dr[n][0].parentNode.style.opacity=r)}(n,r)}(t,i?1:xe.alpha)})),ut=n,nt()}}(n),null!=r.show&&(t.show=r.show,function(n){var r=vr?dr[n][0].parentNode:null;Tn[n].show?r&&pn(r,fn):(r&&mn(r,fn),_e.length>1&&bn(_e[n],-10,-10,Lr,Or))}(n),ht(t.scale,null,null),nt()),Ct("setSeries",n,r),e&&Nt("setSeries",a,n,r)}a.setSelect=vt,a.setSeries=dt;var mt={focus:!0},pt={focus:!1};function gt(n,r){var e=Dn[r],t=Lr;1==e.ori&&(n=(t=Or)-n),-1==e.dir&&(n=t-n);var i=e._min,l=i+n/t*(e._max-i),a=e.distr;return 3==a?b(10,l):4==a?((n,r)=>(void 0===r&&(r=1),v.sinh(n/r)))(l,e.asinh):l}function wt(n,r){gn(ct,K,ft.left=n),gn(ct,J,ft.width=r)}function xt(n,r){gn(ct,Z,ft.top=n),gn(ct,q,ft.height=r)}vr&&be&&kn(an,Jn,(()=>{le._lock||(dt(null,pt,Ht.setSeries),kt())})),a.valToIdx=r=>n(r,e[0]),a.posToIdx=function(r){return n(gt(r,Pn),e[0],De,Ee)},a.posToVal=gt,a.valToPos=(n,r,e)=>0==Dn[r].ori?f(n,Dn[r],e?qr:Lr,e?Ur:0):c(n,Dn[r],e?Zr:Or,e?Jr:0),a.batch=function(n){n(a),nt()},a.setCursor=n=>{Ke=n.left,Qe=n.top,kt()};var bt=0==jn.ori?wt:xt,_t=1==jn.ori?wt:xt;function kt(r,t){var i,l;Ze=Ke,Xe=Qe,i=le.move(a,Ke,Qe),Ke=i[0],Qe=i[1],le.show&&(Ge&&bn(Ge,p(Ke),0,Lr,Or),Ue&&bn(Ue,0,p(Qe),Lr,Or)),ot=S;var o=0==jn.ori?Lr:Or,s=1==jn.ori?Lr:Or;if(0>Ke||0==Se||De>Ee){l=null;for(var u=0;Tn.length>u;u++)if(u>0&&_e.length>1&&bn(_e[u],-10,-10,Lr,Or),vr&&or.live){if(0==u&&pr)continue;for(var f=0;dr[u].length>f;f++)dr[u][f].firstChild.nodeValue="--"}be&&dt(null,mt,Ht.setSeries)}else{var c=gt(0==jn.ori?Ke:Qe,Pn);l=n(c,e[0],De,Ee);for(var v=W(Fn(e[0][l],jn,o,0),.5),h=0;Tn.length>h;h++){var m=Tn[h],g=le.dataIdx(a,h,l,c),x=g==l?v:W(Fn(e[0][g],jn,o,0),.5);if(h>0&&m.show){var b=e[h][g],_=null==b?-10:W(Nn(b,Dn[m.scale],s,0),.5);if(_>0){var k=d(_-Qe);k>ot||(ot=k,st=h)}var M=void 0,T=void 0;0==jn.ori?(M=x,T=_):(M=_,T=x),_e.length>1&&bn(_e[h],M,T,Lr,Or)}if(vr&&or.live){if(g==le.idx&&!ee||0==h&&pr)continue;var z=0==h&&2==Gn?Ae:e[h],D=pr?m.values(a,h,g):{_:m.value(a,z[g],h,g)},E=0;for(var P in D)dr[h][E++].firstChild.nodeValue=D[P]}}ee=!1}if(ft.show&&tt)if(null!=t){var A=Ht.scales,Y=A[0],C=A[1],H=t.cursor.drag;lt=H._x,at=H._y;var F,N,I,L,V,O=t.select,j=O.left,G=O.top,U=O.width,B=O.height,R=t.scales[Y].ori,J=t.posToVal;Y&&(0==R?(F=j,N=U):(F=G,N=B),I=Dn[Y],L=Fn(J(F,Y),I,o,0),V=Fn(J(F+N,Y),I,o,0),bt(w(L,V),d(V-L)),C||_t(0,s)),C&&(1==R?(F=j,N=U):(F=G,N=B),I=Dn[C],L=Nn(J(F,C),I,s,0),V=Nn(J(F+N,C),I,s,0),_t(w(L,V),d(V-L)),Y||bt(0,o))}else{var q=d(Ze-Be),Z=d(Xe-Re);if(1==jn.ori){var X=q;q=Z,Z=X}lt=it.x&&q>=it.dist,at=it.y&&Z>=it.dist;var K,Q,$=it.uni;null!=$?lt&&at&&(at=Z>=$,(lt=q>=$)||at||(Z>q?at=!0:lt=!0)):it.x&&it.y&&(lt||at)&&(lt=at=!0),lt&&(0==jn.ori?(K=Je,Q=Ke):(K=qe,Q=Qe),bt(w(K,Q),d(Q-K)),at||_t(0,s)),at&&(1==jn.ori?(K=Je,Q=Ke):(K=qe,Q=Qe),_t(w(K,Q),d(Q-K)),lt||bt(0,o)),lt||at||(bt(0,0),_t(0,0))}if(le.idx=l,le.left=Ke,le.top=Qe,it._x=lt,it._y=at,null!=r&&(Nt(rn,a,Ke,Qe,o,s,l),be)){var nn=Ht.setSeries,en=xe.prox;null==ut?ot>en||dt(st,mt,nn):ot>en?dt(null,mt,nn):st!=ut&&dt(st,mt,nn)}y&&Ct("setCursor")}var yt=null;function Mt(){yt=_n.getBoundingClientRect()}function St(n,r,e,t,i,l){le._lock||(Tt(n,r,e,t,i,l,0,!1,null!=n),null!=n?kt(1):kt(null,r))}function Tt(n,r,e,t,i,l,o,s,u){var f;if(null!=n)e=n.clientX-yt.left,t=n.clientY-yt.top;else{if(0>e||0>t)return Ke=-10,void(Qe=-10);var c=Lr,v=Or,h=i,d=l,m=e,p=t;1==jn.ori&&(c=Or,v=Lr);var g=Ht.scales,w=g[0],x=g[1];if(1==r.scales[w].ori&&(h=l,d=i,m=t,p=e),e=null!=w?_(r.posToVal(m,w),Dn[w],c,0):c*(m/h),t=null!=x?_(r.posToVal(p,x),Dn[x],v,0):v*(p/d),1==jn.ori){var b=e;e=t,t=b}}u&&(e>1&&Lr-1>e||(e=T(e,Lr)),t>1&&Or-1>t||(t=T(t,Or))),s?(Be=e,Re=t,f=le.move(a,e,t),Je=f[0],qe=f[1]):(Ke=e,Qe=t)}function zt(){vt({width:0,height:0},!1)}function Dt(n,r,e,t,i,l){tt=!0,lt=at=it._x=it._y=!1,Tt(n,r,e,t,i,l,0,!0,!1),null!=n&&(zr(tn,vn,Et),Nt(en,a,Je,qe,Lr,Or,null))}function Et(n,r,e,t,i,l){tt=it._x=it._y=!1,Tt(n,r,e,t,i,l,0,!1,!0);var o=ft.left,s=ft.top,u=ft.width,f=ft.height,c=u>0||f>0;if(c&&vt(ft),it.setScale&&c){var v=o,h=u,d=s,m=f;if(1==jn.ori&&(v=s,h=f,d=o,m=u),lt&&ht(Pn,gt(v,Pn),gt(v+h,Pn)),at)for(var p in Dn){var g=Dn[p];p!=Pn&&null==g.from&&g.min!=S&&ht(p,gt(d+m,p),gt(d,p))}zt()}else le.lock&&(le._lock=!le._lock,le._lock||kt());null!=n&&(function(n,r){var e=Tr.get(r)||{};yn(n,r,e[n]),e[n]=null}(tn,vn),Nt(tn,a,Ke,Qe,Lr,Or,null))}function Pt(n){Ce(),zt(),null!=n&&Nt(on,a,Ke,Qe,Lr,Or,null)}var At,Wt={};Wt.mousedown=Dt,Wt.mousemove=St,Wt.mouseup=Et,Wt.dblclick=Pt,Wt.setSeries=(n,r,e,t)=>{dt(e,t)},le.show&&(zr(en,_n,Dt),zr(rn,_n,St),zr(ln,_n,Mt),zr(an,_n,(function(){if(!le._lock){var n=tt;if(tt){var r,e,t=!0,i=!0;0==jn.ori?(r=lt,e=at):(r=at,e=lt),r&&e&&(t=10>=Ke||Ke>=Lr-10,i=10>=Qe||Qe>=Or-10),r&&t&&(Ke=Je>Ke?0:Lr),e&&i&&(Qe=qe>Qe?0:Or),kt(1),tt=!1}Ke=-10,Qe=-10,kt(1),n&&(tt=n)}})),zr(on,_n,Pt),At=function(n){var r=null;function e(){r=null,n()}return function(){clearTimeout(r),r=setTimeout(e,100)}}(Mt),kn(sn,hn,At),kn(un,hn,At),a.syncRect=Mt);var Yt=a.hooks=r.hooks||{};function Ct(n,r,e){n in Yt&&Yt[n].forEach((n=>{n.call(null,a,r,e)}))}(r.plugins||[]).forEach((n=>{for(var r in n.hooks)Yt[r]=(Yt[r]||[]).concat(n.hooks[r])}));var Ht=U({key:null,setSeries:!1,filters:{pub:A,sub:A},scales:[Pn,null]},le.sync),Ft=Vr(Ht.key);function Nt(n,r,e,t,i,l,a){Ht.filters.pub(n,r,e,t,i,l,a)&&Ft.pub(n,r,e,t,i,l,a)}function It(){Ct("init",r,e),Ye(e||r.data,!1),Un[Pn]?et(Pn,Un[Pn]):Ce(),te(r.width,r.height),kt(),vt(ft,!1)}return Ft.sub(a),a.pub=function(n,r,e,t,i,l,a){Ht.filters.sub(n,r,e,t,i,l,a)&&Wt[n](null,r,e,t,i,l,a)},a.destroy=function(){Ft.unsub(a),yn(sn,hn,At),yn(un,hn,At),Y.remove(),Ct("destroy")},t?t instanceof HTMLElement?(t.appendChild(Y),It()):t(a,It):It(),a}we.assign=U,we.fmtNum=c,we.rangeNum=s,we.rangeLog=i,we.rangeAsinh=l,we.orient=Or,we.join=function(n,r){for(var e=new Set,t=0;n.length>t;t++)for(var i=n[t][0],l=i.length,a=0;l>a;a++)e.add(i[a]);for(var o=[Array.from(e).sort(((n,r)=>n-r))],s=o[0].length,u=new Map,f=0;s>f;f++)u.set(o[0][f],f);for(var c=0;n.length>c;c++)for(var v=n[c],h=v[0],d=1;v.length>d;d++){for(var m=v[d],p=Array(s).fill(void 0),g=r?r[c][d]:1,w=[],x=0;m.length>x;x++){var b=m[x],_=u.get(h[x]);null==b?0!=g&&(p[_]=b,2==g&&w.push(_)):p[_]=b}B(p,w,s),o.push(p)}return o},we.fmtDate=Wn,we.tzDate=function(n,r){var e;return"UTC"==r||"Etc/UTC"==r?e=new Date(+n+6e4*n.getTimezoneOffset()):r==Yn?e=n:(e=new Date(n.toLocaleString("en-US",{timeZone:r}))).setMilliseconds(n.getMilliseconds()),e},we.sync=Vr,we.addGap=Ur,we.clipGaps=Gr;var xe=we.paths={};return xe.linear=ie,xe.spline=function(){return(n,e,t,i)=>Or(n,e,((l,a,o,s,u,f,c,v,h,d,m)=>{var g,w,x;0==s.ori?(g=Br,x=Jr,w=$r):(g=Rr,x=qr,w=ne);var b=1*s.dir*(0==s.ori?1:-1);t=r(o,t,i,1),i=r(o,t,i,-1);for(var _=[],k=!1,y=p(f(a[1==b?t:i],s,d,v)),M=y,S=[],T=[],z=1==b?t:i;z>=t&&i>=z;z+=b){var D=o[z],E=f(a[z],s,d,v);null!=D?(k&&(Ur(_,M,E),k=!1),S.push(M=E),T.push(c(o[z],u,m,h))):null===D&&(Ur(_,M,E),k=!0)}var P={stroke:le(S,T,.5,g,w),fill:null,clip:null,band:null},A=P.stroke;if(null!=l.fill){var W=P.fill=new Path2D(A),Y=l.fillTo(n,e,l.min,l.max),C=p(c(Y,u,m,h));x(W,M,C),x(W,y,C)}return l.spanGaps||(P.clip=Gr(_,s.ori,v,h,d,m)),n.bands.length>0&&(P.band=jr(n,e,t,i,A)),P}))},xe.stepped=function(n){var e=u(n.align,1),t=u(n.ascDesc,!1);return(n,i,l,a)=>Or(n,i,((o,s,u,f,c,v,h,d,m,g,w)=>{var x=0==f.ori?Jr:qr,b={stroke:new Path2D,fill:null,clip:null,band:null},_=b.stroke,k=1*f.dir*(0==f.ori?1:-1);l=r(u,l,a,1),a=r(u,l,a,-1);var y=[],M=!1,S=p(h(u[1==k?l:a],c,w,m)),T=p(v(s[1==k?l:a],f,g,d)),z=T;x(_,T,S);for(var D=1==k?l:a;D>=l&&a>=D;D+=k){var E=u[D],P=p(v(s[D],f,g,d));if(null!=E){var A=p(h(E,c,w,m));if(M){if(Ur(y,z,P),S!=A){var W=o.width*dn/2,Y=y[y.length-1];Y[0]+=t||1==e?W:-W,Y[1]-=t||-1==e?W:-W}M=!1}1==e?x(_,P,S):x(_,z,A),x(_,P,A),S=A,z=P}else null===E&&(Ur(y,z,P),M=!0)}if(null!=o.fill){var C=b.fill=new Path2D(_),H=o.fillTo(n,i,o.min,o.max),F=p(h(H,c,w,m));x(C,z,F),x(C,T,F)}return o.spanGaps||(b.clip=Gr(y,f.ori,d,m,g,w)),n.bands.length>0&&(b.band=jr(n,i,l,a,_)),b}))},xe.bars=function(n){var e=u((n=n||I).size,[.6,S]),t=n.align||0,i=1-e[0],l=u(e[1],S)*dn;return(n,e,a,o)=>Or(n,e,((s,u,f,c,v,h,d,m,g,b,_)=>{var k,y=0==c.ori?Zr:Xr,M=h(u[1],c,b,m)-h(u[0],c,b,m),S=M*i,z=d(s.fillTo(n,e,s.min,s.max),v,_,g),D=p(s.width*dn),E=p(w(l,M-S)-D),P=1==t?0:-1==t?E:E/2,A={stroke:new Path2D,fill:null,clip:null,band:null},W=n.bands.length>0;W&&(A.band=new Path2D,k=T(d(v.max,v,_,g),.5));for(var Y=A.stroke,C=A.band,H=c.dir*(0==c.ori?1:-1),F=1==H?a:o;F>=a&&o>=F;F+=H){var N=f[F];if(null==N){if(!W)continue;var I=r(f,1==H?a:o,F,-H),L=r(f,F,1==H?o:a,H),V=f[I];N=V+(F-I)/(L-I)*(f[L]-V)}var O=h(2==c.distr?F:u[F],c,b,m),j=d(N,v,_,g),G=p(O-P),U=p(x(j,z)),B=p(w(j,z)),R=U-B;null!=f[F]&&y(Y,G,B,E,R),W&&(U=B,y(C,G,B=k,E,R=U-B))}return null!=s.fill&&(A.fill=new Path2D(Y)),A}))},we}(); diff --git a/package.json b/package.json index a20b7d66..422ac755 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uplot", - "version": "1.6.5", + "version": "1.6.6", "description": "A small, fast chart for time series, lines, areas, ohlc & bars", "main": "./dist/uPlot.cjs.js", "module": "./dist/uPlot.esm.js",