From e4a27f270c838e7c23c470138e6597bf5107d534 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Sat, 12 Dec 2020 00:17:21 -0600 Subject: [PATCH] 1.5.1 --- dist/uPlot.cjs.js | 2 +- dist/uPlot.esm.js | 2 +- dist/uPlot.iife.js | 2 +- dist/uPlot.iife.min.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/uPlot.cjs.js b/dist/uPlot.cjs.js index 6ad47bf8..ebf41225 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.5.0) +* https://github.com/leeoniya/uPlot (v1.5.1) */ 'use strict'; diff --git a/dist/uPlot.esm.js b/dist/uPlot.esm.js index 08c27d27..d4713b84 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.5.0) +* https://github.com/leeoniya/uPlot (v1.5.1) */ const FEAT_TIME = true; diff --git a/dist/uPlot.iife.js b/dist/uPlot.iife.js index 10fd5f0b..4a9d2076 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.5.0) +* https://github.com/leeoniya/uPlot (v1.5.1) */ var uPlot = (function () { diff --git a/dist/uPlot.iife.min.js b/dist/uPlot.iife.min.js index 5fb11c90..f7dbaf3a 100644 --- a/dist/uPlot.iife.min.js +++ b/dist/uPlot.iife.min.js @@ -1,2 +1,2 @@ -/*! https://github.com/leeoniya/uPlot (v1.5.0) */ +/*! https://github.com/leeoniya/uPlot (v1.5.1) */ var uPlot=function(){"use strict";function n(n,t,e,r){var i;e=e||0;for(var o=2147483647>=(r=r||t.length-1);r-e>1;)n>t[i=o?e+r>>1:h((e+r)/2)]?e=i:r=i;return n-t[e]>t[r]-n?r:e}function t(n,t,e,r){for(var i=1==r?t:e;i>=t&&e>=i;i+=r)if(null!=n[i])return i;return-1}var e=[0,0];function r(n,t,r,i){return e[0]=0>r?P(n,-r):n,e[1]=0>i?P(t,-i):t,e}function i(n,t,e,i){var o,a,l,u=10==e?b:_;return n==t&&(n/=e,t*=e),i?(o=h(u(n)),a=p(u(t)),n=(l=r(w(e,o),w(e,a),o,a))[0],t=l[1]):(o=h(u(n)),a=h(u(t)),n=Y(n,(l=r(w(e,o),w(e,a),o,a))[0]),t=E(t,l[1])),[n,t]}var o={pad:0,soft:null,mode:0},a={min:o,max:o};function l(n,t,e,r){return N(e)?s(n,t,e):(o.pad=e,o.soft=r?0:null,o.mode=r?2:0,s(n,t,a))}function u(n,t){return null==n?t:n}function s(n,t,e){var r=e.min,i=e.max,o=u(r.pad,0),a=u(i.pad,0),l=u(r.hard,-M),s=u(i.hard,M),f=u(r.soft,M),c=u(i.soft,-M),d=u(r.mode,0),p=u(i.mode,0),x=t-n,_=x||v(t)||1e3,y=b(_),T=w(10,h(y)),k=P(Y(n-_*(0==x?0==n?.1:1:o),T/100),6),S=n>=f&&(1==d||2==d&&f>k)?f:M,D=g(l,S>k&&n>=S?S:m(S,k)),z=P(E(t+_*(0==x?0==t?.1:1:a),T/100),6),W=c>=t&&(1==p||2==p&&z>c)?c:-M,A=m(s,z>W&&W>=t?W:g(W,z));return D==A&&0==D&&(A=100),[D,A]}var f=new Intl.NumberFormat(navigator.language).format,c=Math,v=c.abs,h=c.floor,d=c.round,p=c.ceil,m=c.min,g=c.max,w=c.pow,x=c.sqrt,b=c.log10,_=c.log2,y=c.PI,M=1/0;function T(n,t){return d(n/t)*t}function k(n,t,e){return m(g(n,t),e)}function S(n){return"function"==typeof n?n:function(){return n}}var D=function(n,t){return t},z=function(){return null};function E(n,t){return p(n/t)*t}function Y(n,t){return h(n/t)*t}function P(n,t){return d(n*(t=Math.pow(10,t)))/t}var W=new Map;function A(n){return((""+n).split(".")[1]||"").length}function C(n,t,e,r){for(var i=[],o=r.map(A),a=t;e>a;a++)for(var l=v(a),u=P(w(n,a),l),s=0;r.length>s;s++){var f=r[s]*u,c=(0>f||0>a?l:0)+(o[s]>a?o[s]:0),h=P(f,c);i.push(h),W.set(h,c)}return i}var F={},G=Array.isArray;function H(n){return"string"==typeof n}function N(n){var t=!1;if(null!=n){var e=n.constructor;t=null==e||e==Object}return t}function I(n){var t;if(G(n))t=n.map(I);else if(N(n))for(var e in t={},n)t[e]=I(n[e]);else t=n;return t}function V(n){for(var t=arguments,e=1;t.length>e;e++){var r=t[e];for(var i in r)N(n[i])?V(n[i],I(r[i])):n[i]=I(r[i])}return n}var L="undefined"==typeof queueMicrotask?function(n){return Promise.resolve().then(n)}:queueMicrotask,O="width",j="height",B="top",R="bottom",U="left",q="right",J="#000",X="#0000",Z="mousemove",K="mousedown",Q="mouseup",$="mouseenter",nn="mouseleave",tn="dblclick",en="resize",rn="scroll",on="u-off",an="u-label",ln=requestAnimationFrame,un=document,sn=window,fn=devicePixelRatio;function cn(n,t){null!=t&&n.classList.add(t)}function vn(n,t){n.classList.remove(t)}function hn(n,t,e){n.style[t]=e+"px"}function dn(n,t,e,r){var i=un.createElement(n);return null!=t&&cn(i,t),null!=e&&e.insertBefore(i,r),i}function pn(n,t){return dn("div",n,t)}function mn(n,t,e,r,i){n.style.transform="translate("+t+"px,"+e+"px)",0>t||0>e||t>r||e>i?cn(n,on):vn(n,on)}var gn={passive:!0};function wn(n,t,e){t.addEventListener(n,e,gn)}function xn(n,t,e){t.removeEventListener(n,e,gn)}var bn=["January","February","March","April","May","June","July","August","September","October","November","December"],_n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function yn(n){return n.slice(0,3)}var Mn=_n.map(yn),Tn=bn.map(yn),kn={MMMM:bn,MMM:Tn,WWWW:_n,WWW:Mn};function Sn(n){return(10>n?"0":"")+n}var Dn={YYYY:function(n){return n.getFullYear()},YY:function(n){return(n.getFullYear()+"").slice(2)},MMMM:function(n,t){return t.MMMM[n.getMonth()]},MMM:function(n,t){return t.MMM[n.getMonth()]},MM:function(n){return Sn(n.getMonth()+1)},M:function(n){return n.getMonth()+1},DD:function(n){return Sn(n.getDate())},D:function(n){return n.getDate()},WWWW:function(n,t){return t.WWWW[n.getDay()]},WWW:function(n,t){return t.WWW[n.getDay()]},HH:function(n){return Sn(n.getHours())},H:function(n){return n.getHours()},h:function(n){var t=n.getHours();return 0==t?12:t>12?t-12:t},AA:function(n){return 12>n.getHours()?"AM":"PM"},aa:function(n){return 12>n.getHours()?"am":"pm"},a:function(n){return 12>n.getHours()?"a":"p"},mm:function(n){return Sn(n.getMinutes())},m:function(n){return n.getMinutes()},ss:function(n){return Sn(n.getSeconds())},s:function(n){return n.getSeconds()},fff:function(n){return function(n){return(10>n?"00":100>n?"0":"")+n}(n.getMilliseconds())}};function zn(n,t){t=t||kn;for(var e,r=[],i=/\{([a-z]+)\}|[^{]+/gi;e=i.exec(n);)r.push("{"==e[0][0]?Dn[e[1]]:e[0]);return function(n){for(var e="",i=0;r.length>i;i++)e+="string"==typeof r[i]?r[i]:r[i](n,t);return e}}var En=(new Intl.DateTimeFormat).resolvedOptions().timeZone,Yn=function(n){return n%1==0},Pn=[1,2,2.5,5],Wn=C(10,-16,0,Pn),An=C(10,0,16,Pn),Cn=An.filter(Yn),Fn=Wn.concat(An),Gn="{YYYY}",Hn="\n"+Gn,Nn="{M}/{D}",In="\n"+Nn,Vn=In+"/{YY}",Ln="{aa}",On="{h}:{mm}"+Ln,jn="\n"+On,Bn=":{ss}",Rn=null;function Un(n){var t=1e3*n,e=60*t,r=60*e,i=24*r,o=30*i,a=365*i;return[(1==n?C(10,0,3,Pn).filter(Yn):C(10,-3,0,Pn)).concat([t,5*t,10*t,15*t,30*t,e,5*e,10*e,15*e,30*e,r,2*r,3*r,4*r,6*r,8*r,12*r,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,o,2*o,3*o,4*o,6*o,a,2*a,5*a,10*a,25*a,50*a,100*a]),[[a,Gn,Rn,Rn,Rn,Rn,Rn,Rn,1],[28*i,"{MMM}",Hn,Rn,Rn,Rn,Rn,Rn,1],[i,Nn,Hn,Rn,Rn,Rn,Rn,Rn,1],[r,"{h}"+Ln,Vn,Rn,In,Rn,Rn,Rn,1],[e,On,Vn,Rn,In,Rn,Rn,Rn,1],[t,Bn,Vn+" "+On,Rn,In+" "+On,Rn,jn,Rn,1],[n,Bn+".{fff}",Vn+" "+On,Rn,In+" "+On,Rn,jn,Rn,1]],function(t){return function(l,u,s,f,c,v){var d=[],p=c>=a,m=c>=o&&a>c,g=t(s),w=g*n,x=rt(g.getFullYear(),p?0:g.getMonth(),m||p?1:g.getDate()),b=x*n;if(m||p)for(var _=m?c/o:0,y=p?c/a:0,M=w==b?w:rt(x.getFullYear()+y,x.getMonth()+_,1)*n,T=new Date(M/n),k=T.getFullYear(),S=T.getMonth(),D=0;f>=M;D++){var z=rt(k+y*D,S+_*D,1);(M=(+z+(z-t(z*n)))*n)>f||d.push(M)}else{var Y=i>c?c:i,W=b+(h(s)-h(w))+E(w-b,Y);d.push(W);for(var A=t(W),C=A.getHours()+A.getMinutes()/e+A.getSeconds()/r,F=c/r,G=v/l.axes[u]._space;(W=P(W+c,1==n?0:3))<=f;)if(F>1){var H=h(P(C+F,6))%24,N=t(W).getHours()-H;N>1&&(N=-1),C=(C+F)%24,.7>P(((W-=N*r)-d[d.length-1])/c,3)*G||d.push(W)}else d.push(W)}return d}}]}var qn=Un(1),Jn=qn[0],Xn=qn[1],Zn=qn[2],Kn=Un(.001),Qn=Kn[0],$n=Kn[1],nt=Kn[2];function tt(n,t){return n.map((function(n){return n.map((function(e,r){return 0==r||8==r||null==e?e:t(1==r||0==n[8]?e:n[1]+e)}))}))}function et(n,t){return function(e,r,i,o,a){var l,u,s,f,c,v,h=t.find((function(n){return a>=n[0]}))||t[t.length-1];return r.map((function(t){var e=n(t),r=e.getFullYear(),i=e.getMonth(),o=e.getDate(),a=e.getHours(),d=e.getMinutes(),p=e.getSeconds(),m=r!=l&&h[2]||i!=u&&h[3]||o!=s&&h[4]||a!=f&&h[5]||d!=c&&h[6]||p!=v&&h[7]||h[1];return l=r,u=i,s=o,f=a,c=d,v=p,m(e)}))}}function rt(n,t,e){return new Date(n,t,e)}function it(n,t){return t(n)}function ot(n,t){return function(e,r){return t(n(r))}}C(2,-53,53,[1]);var at=[0,0];function lt(n,t,e){return function(n){0==n.button&&e(n)}}function ut(n,t,e){return e}var st={show:!0,x:!0,y:!0,lock:!1,move:function(n,t,e){return at[0]=t,at[1]=e,at},points:{show:function(n,t){var e=n.series[t],r=pn();r.style.background=e.stroke||J;var i=St(e.width,1),o=(i-1)/-2;return hn(r,O,i),hn(r,j,i),hn(r,"marginLeft",o),hn(r,"marginTop",o),r}},bind:{mousedown:lt,mouseup:lt,click:lt,dblclick:lt,mousemove:ut,mouseleave:ut,mouseenter:ut},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,t,e){return e}},ft={show:!0,stroke:"rgba(0,0,0,0.07)",width:2,filter:D},ct=V({},ft,{size:10}),vt='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"',ht="bold "+vt,dt={show:!0,scale:"x",space:50,gap:5,size:50,labelSize:30,labelFont:ht,side:2,grid:ft,ticks:ct,font:vt,rotate:0},pt={show:!0,scale:"x",auto:!1,sorted:1,min:M,max:-M,idxs:[]};function mt(n,t){return t.map((function(n){return null==n?"":f(n)}))}function gt(n,t,e,r,i,o,a){for(var l=[],u=W.get(i)||0,s=e=a?e:P(E(e,i),u);r>=s;s=P(s+i,u))l.push(Object.is(s,-0)?0:s);return l}function wt(n,t,e,r,i){var o=[],a=n.scales[n.axes[t].scale].log,l=h((10==a?b:_)(e));i=w(a,l),0>l&&(i=P(i,-l));var u=e;do{o.push(u),i*a>(u=P(u+i,W.get(i)))||(i=u)}while(r>=u);return o}var xt=/./,bt=/[12357]/,_t=/[125]/,yt=/1/;function Mt(n,t,e){var r=n.axes[e],i=r.scale;if(2==n.scales[i].log)return t;var o=n.valToPos,a=r._space,l=o(10,i),u=o(9,i)-l=r[1]-r[0]}},values:null,min:M,max:-M,idxs:[],path:null,clip:null};function Et(n,t,e){return e/10}var Yt={time:!0,auto:!0,distr:1,log:10,min:null,max:null},Pt=V({},Yt,{time:!1}),Wt={};function At(){var n=[];return{sub:function(t){n.push(t)},unsub:function(t){n=n.filter((function(n){return n!=t}))},pub:function(t,e,r,i,o,a,l){n.length>1&&n.forEach((function(n){n!=e&&n.pub(t,e,r,i,o,a,l)}))}}}var Ct=[,,,,,,,,,,,];function Ft(n,t){var e=n.series[t],r=n.scales,i=n.bbox;return Ct[0]=e,Ct[1]=n._data[0],Ct[2]=n._data[t],Ct[3]=r[n.series[0].scale],Ct[4]=r[e.scale],Ct[5]=n.valToPosX,Ct[6]=n.valToPosY,Ct[7]=i.left,Ct[8]=i.top,Ct[9]=i.width,Ct[10]=i.height,Ct}function Gt(n,t,e,r,i,o){var a=null;if(n.length>0&&(a=new Path2D,1==t)){for(var l=e,u=0;n.length>u;u++){var s=n[u];a.rect(l,r,s[0]-l,r+o),l=s[1]}a.rect(l,r,e+i-l,r+o)}return a}function Ht(n,t,e){if(e>t){var r=n[n.length-1];r&&r[0]==t?r[1]=e:n.push([t,e])}}var Nt=1;function It(n,t,e,r,i){n.lineTo(t,e),n.lineTo(t,r),n.lineTo(t,i)}function Vt(){return function(n,e,r,i){var o,a,l,u=Ft(n,e),s=u[0],f=u[1],c=u[2],v=u[3],h=u[4],p=u[5],w=u[6],x=u[7],b=u[8],_=u[9],y=u[10],k=s.isGap,S=1==Nt?{stroke:new Path2D,fill:null,clip:null}:n.series[e-1]._paths,D=S.stroke,z=P(s.width*fn,3),E=M,Y=-M,W=[],A=d(p(f[1==Nt?r:i],v,_,x)),C=!1,F=t(c,r,i,1),G=t(c,r,i,-1),H=T(p(f[F],v,_,x),.5),N=T(p(f[G],v,_,x),.5);H>x&&Ht(W,x,H),s.band&&1==Nt&&D.lineTo(H-2*z,d(w(c[r],h,y,b)));for(var I=1==Nt?r:i;I>=r&&i>=I;I+=Nt){var V=d(p(f[I],v,_,x));if(V==A)null!=c[I]?(o=d(w(c[I],h,y,b)),E==M&&D.lineTo(V,o),E=m(o,E),Y=g(o,Y)):!C&&k(n,e,I)&&(C=!0);else{var L=!1;E!=M?(It(D,A,E,Y,o),a=l=A):C&&(L=!0,C=!1),null!=c[I]?(o=d(w(c[I],h,y,b)),D.lineTo(V,o),E=Y=o,V-A>1&&null==c[I-1]&&k(n,e,I-1)&&(L=!0)):(E=M,Y=-M,!C&&k(n,e,I)&&(C=!0)),L&&Ht(W,a,V),A=V}}if(E!=M&&E!=Y&&l!=A&&It(D,A,E,Y,o),x+_>N&&Ht(W,N,x+_),s.band){var O,j,B,R=n._data;1==Nt?(O=N+2*z,j=G,B=R[e+1]):(O=H-2*z,j=F,B=R[e-1]),D.lineTo(O,d(w(c[j],h,y,b))),D.lineTo(O,d(w(B[j],h,y,b)))}if(1==Nt&&(s.spanGaps||(S.clip=Gt(W,1,x,b,_,y)),null!=s.fill)){var U=S.fill=new Path2D(D),q=d(w(s.fillTo(n,e,s.min,s.max),h,y,b));U.lineTo(N,q),U.lineTo(H,q)}return s.band&&(Nt*=-1),S}}var Lt=Vt();function Ot(n,t,e,r){return(r?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((function(n,r){return jt(n,r,t,e)}))}function jt(n,t,e,r){return V({},0==t||n&&n.side%2==0?e:r,n)}var Bt=[null,null];function Rt(n,t,e){return null==t?Bt:[t,e]}var Ut=Rt;function qt(n,t,e){return null==t?Bt:l(t,e,.1,!0)}function Jt(n,t,e,r){return null==t?Bt:i(t,e,n.scales[r].log,!1)}var Xt=Jt;function Zt(n){var t;return[n=n.replace(/(\d+)px/,(function(n,e){return(t=d(e*fn))+"px"})),t]}function Kt(t,e,r){var o={};function a(n,t){return 3==t.distr?b((n>0?n:t.clamp(o,n,t.min,t.max,t.key))/t.min)/b(t.max/t.min):(n-t.min)/(t.max-t.min)}function s(n,t,e,r){return r+a(n,t)*e}function f(n,t,e,r){return r+(1-a(n,t))*e}o.valToPosX=s,o.valToPosY=f;var c=!1;o.status=0;var x=o.root=pn("uplot");null!=t.id&&(x.id=t.id),cn(x,t.class),t.title&&(pn("u-title",x).textContent=t.title);var _=dn("canvas"),E=o.ctx=_.getContext("2d"),Y=pn("u-wrap",x),A=pn("u-under",Y);Y.appendChild(_);var C=pn("u-over",Y);((t=I(t)).plugins||[]).forEach((function(n){n.opts&&(t=n.opts(o,t)||t)}));var gn=t.ms||.001,bn=o.series=Ot(t.series||[],pt,zt,!1),_n=o.axes=Ot(t.axes||[],dt,kt,!0),yn=o.scales={},Mn=bn[0].scale,Tn={axes:function(){_n.forEach((function(n,t){if(n.show&&n._show){var e=yn[n.scale],r=n.side,i=r%2,a=0==i?s:f,l=0==i?_t:yt,u=0==i?xt:bt,c=d(n.gap*fn),v=n.ticks,h=v.show?d(v.size*fn):0,p=n._found,m=p[0],g=p[1],w=n._splits,x=2==e.distr?w.map((function(n){return fe[n]})):w,b=2==e.distr?fe[w[1]]-fe[w[0]]:m,_=n._rotate*-y/180,M=d(n._pos*fn),T=M+(h+c)*(0==i&&0==r||1==i&&3==r?-1:1),k=0==i?T:0,S=1==i?T:0;E.font=n.font[0],E.fillStyle=n.stroke||J,E.textAlign=1==n.align?U:2==n.align?q:_>0?U:0>_?q:0==i?"center":3==r?q:U,E.textBaseline=_||1==i?"middle":2==r?B:R;var D=1.5*n.font[1],z=w.map((function(n){return d(a(n,e,l,u))}));if(n._values.forEach((function(n,t){null!=n&&(0==i?S=z[t]:k=z[t],(""+n).split(/\n/gm).forEach((function(n,t){_?(E.save(),E.translate(S,k+t*D),E.rotate(_),E.fillText(n,0,0),E.restore()):E.fillText(n,S,k+t*D)})))})),n.label){E.save();var Y=d(n._lpos*fn);1==i?(S=k=0,E.translate(Y,d(bt+yt/2)),E.rotate((3==r?-y:y)/2)):(S=d(xt+_t/2),k=Y),E.font=n.labelFont[0],E.textAlign="center",E.textBaseline=2==r?B:R,E.fillText(n.label,S,k),E.restore()}v.show&&me(z,v.filter(o,x,t,g,b),i,r,M,h,P(v.width*fn,3),v.stroke);var W=n.grid;W.show&&me(z,W.filter(o,x,t,g,b),i,0==i?2:1,0==i?bt:xt,0==i?yt:_t,P(W.width*fn,3),W.stroke,W.dash)}})),sr("drawAxes")},series:function(){ie>0&&(bn.forEach((function(n,t){if(t>0&&n.show&&null==n._paths){var r=function(n){for(var t=k(le-1,0,ie-1),e=k(ue+1,0,ie-1);null==n[t]&&t>0;)t--;for(;null==n[e]&&ie-1>e;)e++;return[t,e]}(e[t]);n._paths=n.paths(o,t,r[0],r[1])}})),bn.forEach((function(n,t){t>0&&n.show&&(n._paths&&function(n){var t=bn[n];if(1==pe){var e=t._paths,r=e.stroke,i=e.fill,o=e.clip,a=P(t.width*fn,3),l=a%2/2;de(t.stroke,a,t.dash,t.fill),E.globalAlpha=t.alpha,E.translate(l,l),E.save();var u=xt,s=bt,f=_t,c=yt,v=a*fn/2;0==t.min&&(c+=v),0==t.max&&(s-=v,c+=v),E.beginPath(),E.rect(u,s,f,c),E.clip(),null!=o&&E.clip(o),t.band?(E.fill(r),a&&E.stroke(r)):(null!=t.fill&&E.fill(i),a&&E.stroke(r)),E.restore(),E.translate(-l,-l),E.globalAlpha=1}t.band&&(pe*=-1)}(t),n.points.show(o,t,le,ue)&&function(n){var t=bn[n],r=t.points,i=P(r.width*fn,3),o=i%2/2,a=r.width>0,l=(r.size-r.width)/2*fn,u=P(2*l,3);E.translate(o,o),E.save(),E.beginPath(),E.rect(xt-u,bt-u,_t+2*u,yt+2*u),E.clip(),E.globalAlpha=t.alpha;for(var c=new Path2D,v=le;ue>=v;v++)if(null!=e[n][v]){var h=d(s(e[0][v],yn[Mn],_t,xt)),p=d(f(e[n][v],yn[t.scale],yt,bt));c.moveTo(h+l,p),c.arc(h,p,l,0,2*y)}de(r.stroke,i,null,r.fill||(a?"#fff":t.stroke)),E.fill(c),a&&E.stroke(c),E.globalAlpha=1,E.restore(),E.translate(-o,-o)}(t),sr("drawSeries",t))})))}},kn=(t.drawOrder||["axes","series"]).map((function(n){return Tn[n]}));function Sn(n){var e=yn[n];if(null==e){var r=(t.scales||F)[n]||F;if(null!=r.from)Sn(r.from),yn[n]=V({},yn[r.from],r);else{(e=yn[n]=V({},n==Mn?Yt:Pt,r)).key=n;var i=e.time,o=3==e.distr,a=e.range;if(n!=Mn&&!G(a)&&N(a)){var u=a;a=function(n,t,e){return null==t?Bt:l(t,e,u)}}e.range=S(a||(i?Ut:n==Mn?o?Xt:Rt:o?Jt:qt)),e.auto=S(e.auto),e.clamp=S(e.clamp||Et)}}}for(var Dn in Sn("x"),Sn("y"),bn.forEach((function(n){Sn(n.scale)})),t.scales)Sn(Dn);var En=yn[Mn].distr,Yn={};for(var Pn in yn){var Wn=yn[Pn];null==Wn.min&&null==Wn.max||(Yn[Pn]={min:Wn.min,max:Wn.max})}var An,Gn,Hn=t.tzDate||function(n){return new Date(n/gn)},Nn=t.fmtDate||zn,In=1==gn?Zn(Hn):nt(Hn),Vn=et(Hn,tt(1==gn?Xn:$n,Nn)),Ln=ot(Hn,it("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Nn)),On=V({show:!0,live:!0},t.legend),jn=On.show,Bn=[],Rn=!1;if(jn){An=dn("table","u-legend",x);var Un=bn[1]?bn[1].values:null;if(Rn=null!=Un){var qn=dn("tr","u-thead",An);for(var Kn in dn("th",null,qn),Gn=Un(o,1,0))dn("th",an,qn).textContent=Kn}else Gn={_:0},cn(An,"u-inline"),On.live&&cn(An,"u-live")}var rt=new Map;function at(n,t,e){var r=rt.get(t)||{},i=Kt.bind[n](o,t,e);i&&(wn(n,t,r[n]=i),rt.set(t,r))}var lt=0,ut=0,ft=0,ct=0,vt=0,ht=0,xt=0,bt=0,_t=0,yt=0;o.bbox={};var Ct=!1,Ft=!1,Gt=!1,Ht=!1,Nt=!1;function It(n,t){n==o.width&&t==o.height||Vt(n,t),xe(!1),Gt=!0,Ft=!0,Ht=!0,Nt=!0,Pe()}function Vt(n,t){o.width=lt=ft=n,o.height=ut=ct=t,vt=ht=0,function(){var n=!1,t=!1,e=!1,r=!1;_n.forEach((function(i){if(i.show&&i._show){var o=i.side,a=o%2,l=i._size+(i.labelSize=null!=i.label?i.labelSize||30:0);l>0&&(a?(ft-=l,3==o?(vt+=l,r=!0):e=!0):(ct-=l,0==o?(ht+=l,n=!0):t=!0))}})),ee[0]=n,ee[1]=e,ee[2]=t,ee[3]=r,ft-=ae[1]+ae[3],vt+=ae[3],ct-=ae[2]+ae[0],ht+=ae[0]}(),function(){var n=vt+ft,t=ht+ct,e=vt,r=ht;function i(i,o){switch(i){case 1:return(n+=o)-o;case 2:return(t+=o)-o;case 3:return(e-=o)+o;case 0:return(r-=o)+o}}_n.forEach((function(n){if(n.show&&n._show){var t=n.side;n._pos=i(t,n._size),null!=n.label&&(n._lpos=i(t,n.labelSize))}}))}();var e=o.bbox;xt=e.left=T(vt*fn,.5),bt=e.top=T(ht*fn,.5),_t=e.width=T(ft*fn,.5),yt=e.height=T(ct*fn,.5)}o.setSize=function(n){It(n.width,n.height)};var Kt=o.cursor=V({},st,t.cursor);Kt._lock=!1,Kt.points.show=S(Kt.points.show);var Qt=o.focus=V({},t.focus||{alpha:.3},Kt.focus),$t=Qt.prox>=0,ne=[null];function te(n,t){var e=yn[n.scale].time,r=n.value;if(n.value=e?H(r)?ot(Hn,it(r,Nn)):r||Ln:r||Tt,n.label=n.label||(e?"Time":"Value"),t>0){n.width=null==n.width?1:n.width,n.paths=n.paths||Lt||z,n.fillTo=n.fillTo||Dt;var i=St(n.width,1);n.points=V({},{size:i,width:g(1,.2*i),stroke:n.stroke,space:2*i},n.points),n.points.show=S(n.points.show),n._paths=null}if(jn&&Bn.splice(t,0,function(n,t){if(0==t&&(Rn||!On.live))return null;var e=[],r=dn("tr","u-series",An,An.childNodes[t]);cn(r,n.class),n.show||cn(r,on);var i=dn("th",null,r),o=pn("u-marker",i);o.style.borderColor=n.width?n.stroke:t>0&&n.points.width?n.points.stroke:null,o.style.backgroundColor=n.fill||null;var a=pn(an,i);for(var l in a.textContent=n.label,t>0&&(at("click",i,(function(){Kt._lock||Ue(bn.indexOf(n),{show:!n.show},fr.setSeries)})),$t&&at($,i,(function(){Kt._lock||Ue(bn.indexOf(n),{focus:!0},fr.setSeries)}))),Gn){var u=dn("td","u-value",r);u.textContent="--",e.push(u)}return e}(n,t)),Kt.show){var a=function(n,t){if(t>0){var e=Kt.points.show(o,t);if(e)return cn(e,"u-cursor-pt"),cn(e,n.class),mn(e,-10,-10,ft,ct),C.insertBefore(e,ne[t]),e}}(n,t);a&&ne.splice(t,0,a)}}o.addSeries=function(n,t){n=jt(n,t=null==t?bn.length:t,pt,zt),bn.splice(t,0,n),te(bn[t],t)},o.delSeries=function(n){bn.splice(n,1),jn&&Bn.splice(n,1)[0][0].parentNode.remove(),ne.length>1&&ne.splice(n,1)[0].remove()},bn.forEach(te);var ee=[!1,!1,!1,!1];function re(n,t,e){var r=e[0],i=e[1],o=e[2],a=e[3],l=t%2,u=0;return 0==l&&(a||i)&&(u=0==t&&!r||2==t&&!o?d(dt.size/3):0),1==l&&(r||o)&&(u=1==t&&!i||3==t&&!a?d(kt.size/2):0),u}_n.forEach((function(n,t){if(n._show=n.show,n.show){var e=yn[n.scale];null==e&&(n.scale=n.side%2?bn[1].scale:Mn,e=yn[n.scale]);var r=e.time;n.size=S(n.size),n.space=S(n.space),n.rotate=S(n.rotate),n.incrs=S(n.incrs||(2==e.distr?Cn:r?1==gn?Jn:Qn:Fn)),n.splits=S(n.splits||(r&&1==e.distr?In:3==e.distr?wt:gt));var i=n.values;n.values=r?G(i)?et(Hn,tt(i,Nn)):H(i)?function(n,t){var e=zn(t);return function(t,r){return r.map((function(t){return e(n(t))}))}}(Hn,i):i||Vn:i||mt,n.filter=S(n.filter||(3==e.distr?Mt:D)),n.font=Zt(n.font),n.labelFont=Zt(n.labelFont),n._size=n.size(o,null,t,0),n._space=n._rotate=n._incrs=n._found=n._splits=n._values=null,n._size>0&&(ee[t]=!0)}}));var ie,oe=o.padding=(t.padding||[re,re,re,re]).map((function(n){return S(u(n,re))})),ae=o._padding=oe.map((function(n,t){return n(o,t,ee,0)})),le=null,ue=null,se=bn[0].idxs,fe=null,ce=!1;function ve(n,t){if(!G(n)&&N(n)&&(n.isGap&&bn.forEach((function(t){t.isGap=n.isGap})),n=n.data),(n=n||[])[0]=n[0]||[],o.data=n,e=n.slice(),ie=(fe=e[0]).length,2==En&&(e[0]=fe.map((function(n,t){return t}))),o._data=e,xe(!0),sr("setData"),!1!==t){var r=yn[Mn];r.auto(o,ce)?he():Re(Mn,r.min,r.max),Ht=!0,Nt=!0,Pe()}}function he(){var n,t,r,o;ce=!0,ie>0?(le=se[0]=0,ue=se[1]=ie-1,r=e[0][le],o=e[0][ue],2==En?(r=le,o=ue):1==ie&&(3==En?(r=(n=i(r,r,yn[Mn].log,!1))[0],o=n[1]):yn[Mn].time?o=r+86400/gn:(r=(t=l(r,o,.1,!0))[0],o=t[1]))):(le=se[0]=r=null,ue=se[1]=o=null),Re(Mn,r,o)}function de(n,t,e,r){E.strokeStyle=n||X,E.lineWidth=t,E.lineJoin="round",E.setLineDash(e||[]),E.fillStyle=r||X}o.setData=ve;var pe=1;function me(n,t,e,r,i,o,a,l,u){var s=a%2/2;E.translate(s,s),de(l,a,u),E.beginPath();var f,c,v,h,d=i+(0==r||3==r?-o:o);0==e?(c=i,h=d):(f=i,v=d),n.forEach((function(n,r){null!=t[r]&&(0==e?f=v=n:c=h=n,E.moveTo(f,c),E.lineTo(v,h))})),E.stroke(),E.translate(-s,-s)}function ge(n){var t=!0;return _n.forEach((function(e,r){if(e.show){var i=yn[e.scale];if(null!=i.min){e._show||(t=!1,e._show=!0,xe(!1));var a=e.side,l=i.min,u=i.max,s=function(n,t,e,r){var i,a=_n[n];if(r>0){var l=a._space=a.space(o,n,t,e,r),u=a._incrs=a.incrs(o,n,t,e,r,l);i=a._found=function(n,t,e,r,i){for(var o=r/(t-n),a=(""+h(n)).length,l=0;e.length>l;l++){var u=e[l]*o,s=10>e[l]?W.get(e[l]):0;if(u>=i&&17>a+s)return[e[l],u]}return[0,0]}(t,e,u,r,l)}else i=[0,0];return i}(r,l,u,0==a%2?ft:ct),f=s[0],c=s[1];if(0!=c){var v=e._splits=e.splits(o,r,l,u,f,c,2==i.distr),d=2==i.distr?v.map((function(n){return fe[n]})):v,m=2==i.distr?fe[v[1]]-fe[v[0]]:f,g=e._values=e.values(o,e.filter(o,d,r,c,m),r,c,m);e._rotate=2==a?e.rotate(o,g,r,c):0;var w=e._size;e._size=p(e.size(o,g,r,n)),null!=w&&e._size!=w&&(t=!1)}}else e._show&&(t=!1,e._show=!1,xe(!1))}})),t}function we(n){var t=!0;return oe.forEach((function(e,r){var i=e(o,r,ee,n);i!=ae[r]&&(t=!1),ae[r]=i})),t}function xe(n){bn.forEach((function(t,e){e>0&&(t._paths=null,n&&(t.min=null,t.max=null))}))}var be,_e,ye,Me,Te,ke,Se,De,ze,Ee,Ye=!1;function Pe(){Ye||(L(We),Ye=!0)}function We(){Ct&&(function(){var t=I(yn);for(var r in t){var i=t[r],a=Yn[r];if(null!=a&&null!=a.min)V(i,a),r==Mn&&xe(!0);else if(r!=Mn)if(0==ie&&null==i.from){var l=i.range(o,null,null,r);i.min=l[0],i.max=l[1]}else i.min=M,i.max=-M}if(ie>0)for(var u in bn.forEach((function(r,i){var a=r.scale,l=t[a],u=Yn[a];if(0==i){var s=l.range(o,l.min,l.max,a);l.min=s[0],l.max=s[1],le=n(l.min,e[0]),ue=n(l.max,e[0]),l.min>e[0][le]&&le++,e[0][ue]>l.max&&ue--,r.min=fe[le],r.max=fe[ue]}else if(r.show&&r.auto&&l.auto(o,ce)&&(null==u||null==u.min)){var f=null==r.min?3==l.distr?function(n,t,e){for(var r=M,i=-M,o=t;e>=o;o++)n[o]>0&&(r=m(r,n[o]),i=g(i,n[o]));return[r==M?1:r,i==-M?10:i]}(e[i],le,ue):function(n,t,e,r){var i=M,o=-M;if(1==r)i=n[t],o=n[e];else if(-1==r)i=n[e],o=n[t];else for(var a=t;e>=a;a++)null!=n[a]&&(i=m(i,n[a]),o=g(o,n[a]));return[i,o]}(e[i],le,ue,r.sorted):[r.min,r.max];l.min=m(l.min,r.min=f[0]),l.max=g(l.max,r.max=f[1])}r.idxs[0]=le,r.idxs[1]=ue})),t){var s=t[u],f=Yn[u];if(null==s.from&&(null==f||null==f.min)){var c=s.range(o,s.min==M?null:s.min,s.max==-M?null:s.max,u);s.min=c[0],s.max=c[1]}}for(var v in t){var h=t[v];if(null!=h.from){var d=t[h.from],p=h.range(o,d.min,d.max,v);h.min=p[0],h.max=p[1]}}var w={},x=!1;for(var b in t){var _=t[b],y=yn[b];y.min==_.min&&y.max==_.max||(y.min=_.min,y.max=_.max,w[b]=x=!0)}if(x){for(var T in bn.forEach((function(n){w[n.scale]&&(n._paths=null)})),w)Gt=!0,sr("setScale",T);Kt.show&&(Ht=!0)}for(var k in Yn)Yn[k]=null}(),Ct=!1),Gt&&(function(){for(var n=!1,t=0;!n;){var e=ge(++t),r=we(t);(n=e&&r)||(Vt(o.width,o.height),Ft=!0)}}(),Gt=!1),Ft&&(hn(A,U,vt),hn(A,B,ht),hn(A,O,ft),hn(A,j,ct),hn(C,U,vt),hn(C,B,ht),hn(C,O,ft),hn(C,j,ct),hn(Y,O,lt),hn(Y,j,ut),_.width=d(lt*fn),_.height=d(ut*fn),Qe(),sr("setSize"),Ft=!1),Kt.show&&Ht&&(Ze(),Ht=!1),lt>0&&ut>0&&(E.clearRect(0,0,_.width,_.height),sr("drawClear"),kn.forEach((function(n){return n()})),sr("draw")),c||(c=!0,o.status=1,sr("ready")),ce=!1,Ye=!1}function Ae(t,r){var i=yn[t];if(null==i.from){if(0==ie){var a=i.range(o,r.min,r.max,t);r.min=a[0],r.max=a[1]}if(ie>1&&null!=r.min&&null!=r.max&&1e-16>r.max-r.min)return;t==Mn&&2==i.distr&&ie>0&&(r.min=n(r.min,e[0]),r.max=n(r.max,e[0])),Yn[t]=r,Ct=!0,Pe()}}o.redraw=function(n){!1!==n?Re(Mn,yn[Mn].min,yn[Mn].max):Pe()},o.setScale=Ae;var Ce=!1,Fe=Kt.drag,Ge=Fe.x,He=Fe.y;Kt.show&&(Kt.x&&(ze=Kt.left,be=pn("u-cursor-x",C)),Kt.y&&(Ee=Kt.top,_e=pn("u-cursor-y",C)));var Ne,Ie,Ve,Le=o.select=V({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Oe=Le.show?pn("u-select",Le.over?C:A):null;function je(n,t){if(Le.show){for(var e in n)hn(Oe,e,Le[e]=n[e]);!1!==t&&sr("setSelect")}}function Be(n){var t=jn?Bn[n][0].parentNode:null;bn[n].show?t&&vn(t,on):(t&&cn(t,on),ne.length>1&&mn(ne[n],-10,-10,ft,ct))}function Re(n,t,e){Ae(n,{min:t,max:e})}function Ue(n,t,e){var r=bn[n];if(null!=t.focus&&function(n){n!=Ve&&(bn.forEach((function(t,e){!function(n,t){var e=bn[n];qe(n,t),e.band&&qe(bn[n+1].band?n+1:n-1,t)}(e,null==n||0==e||e==n?1:Qt.alpha)})),Ve=n,Pe())}(n),null!=t.show){if(r.show=t.show,Be(n),r.band){var i=bn[n+1]&&bn[n+1].band?n+1:n-1;bn[i].show=r.show,Be(i)}Re(r.scale,null,null),Pe()}sr("setSeries",n,t),e&&vr.pub("setSeries",o,n,t)}function qe(n,t){bn[n].alpha=t,Kt.show&&ne[n]&&(ne[n].style.opacity=t),jn&&Bn[n]&&(Bn[n][0].parentNode.style.opacity=t)}function Je(n,t){var e=ft;t!=Mn&&(n=(e=ct)-n);var r=n/e,i=yn[t],o=i.min,a=i.max;return 3==i.distr?(o=b(o),a=b(a),w(10,o+(a-o)*r)):o+(a-o)*r}o.setSelect=je,o.setSeries=Ue,jn&&$t&&wn(nn,An,(function(){Kt._lock||(Ue(null,{focus:!1},fr.setSeries),Ze())})),o.valToIdx=function(t){return n(t,e[0])},o.posToIdx=function(t){return n(Je(t,Mn),e[0],le,ue)},o.posToVal=Je,o.valToPos=function(n,t,e){return t==Mn?s(n,yn[t],e?_t:ft,e?xt:0):f(n,yn[t],e?yt:ct,e?bt:0)},o.batch=function(n){n(o),Pe()},o.setCursor=function(n){ze=n.left,Ee=n.top,Ze()};var Xe=0;function Ze(t,r){var i,a;if(Xe=0,Se=ze,De=Ee,i=Kt.move(o,ze,Ee),ze=i[0],Ee=i[1],Kt.show&&(Kt.x&&mn(be,d(ze),0,ft,ct),Kt.y&&mn(_e,0,d(Ee),ft,ct)),Ne=M,0>ze||0==ie||le>ue){a=null;for(var l=0;bn.length>l;l++)if(l>0&&ne.length>1&&mn(ne[l],-10,-10,ft,ct),jn&&On.live){if(0==l&&Rn)continue;for(var u=0;Bn[l].length>u;u++)Bn[l][u].firstChild.nodeValue="--"}$t&&Ue(null,{focus:!0},fr.setSeries)}else{var h=Je(ze,Mn);a=n(h,e[0],le,ue);for(var p=yn[Mn],g=P(s(e[0][a],p,ft,0),3),w=0;bn.length>w;w++){var x=bn[w],b=Kt.dataIdx(o,w,a,h),_=b==a?g:P(s(e[0][b],p,ft,0),3);if(w>0&&x.show){var y=e[w][b],T=null==y?-10:P(f(y,yn[x.scale],ct,0),3);if(T>0){var k=v(T-Ee);k>Ne||(Ne=k,Ie=w)}ne.length>1&&mn(ne[w],_,T,ft,ct)}if(jn&&On.live){if(b==Kt.idx&&!Nt||0==w&&Rn)continue;var S=0==w&&2==En?fe:e[w],D=Rn?x.values(o,w,b):{_:x.value(o,S[b],w,b)},z=0;for(var E in D)Bn[w][z++].firstChild.nodeValue=D[E]}}Nt=!1}if(Le.show&&Ce)if(null!=r){var Y=fr.scales,W=Y[0],A=Y[1],C=r.cursor.drag;if(Ge=C._x,He=C._y,W){var F=yn[W],G=r.posToVal(r.select.left,W),H=r.posToVal(r.select.left+r.select.width,W);Le.left=s(G,F,ft,0),Le.width=v(Le.left-s(H,F,ft,0)),hn(Oe,U,Le.left),hn(Oe,O,Le.width),A||(hn(Oe,B,Le.top=0),hn(Oe,j,Le.height=ct))}if(A){var N=yn[A],I=r.posToVal(r.select.top,A),V=r.posToVal(r.select.top+r.select.height,A);Le.top=f(I,N,ct,0),Le.height=v(Le.top-f(V,N,ct,0)),hn(Oe,B,Le.top),hn(Oe,j,Le.height),W||(hn(Oe,U,Le.left=0),hn(Oe,O,Le.width=ft))}}else{var L=v(Se-ye),R=v(De-Me);Ge=Fe.x&&L>=Fe.dist,He=Fe.y&&R>=Fe.dist;var q=Fe.uni;if(null!=q?Ge&&He&&(He=R>=q,(Ge=L>=q)||He||(R>L?He=!0:Ge=!0)):Fe.x&&Fe.y&&(Ge||He)&&(Ge=He=!0),Ge){var J=m(Te,ze),X=v(ze-Te);hn(Oe,U,Le.left=J),hn(Oe,O,Le.width=X),He||(hn(Oe,B,Le.top=0),hn(Oe,j,Le.height=ct))}if(He){var K=m(ke,Ee),Q=v(Ee-ke);hn(Oe,B,Le.top=K),hn(Oe,j,Le.height=Q),Ge||(hn(Oe,U,Le.left=0),hn(Oe,O,Le.width=ft))}Ge||He||(hn(Oe,j,Le.height=0),hn(Oe,O,Le.width=0))}Kt.idx=a,Kt.left=ze,Kt.top=Ee,Fe._x=Ge,Fe._y=He,null!=t&&(vr.pub(Z,o,ze,Ee,ft,ct,a),$t&&Ue(Ne>Qt.prox?null:Ie,{focus:!0},fr.setSeries)),c&&sr("setCursor")}var Ke=null;function Qe(){Ke=C.getBoundingClientRect()}function $e(n,t,e,r,i,o){Kt._lock||(nr(n,t,e,r,i,o,0,!1,null!=n),null!=n?0==Xe&&(Xe=ln(Ze)):Ze(null,t))}function nr(n,t,e,r,i,a,l,u,c){var v;if(null!=n)e=n.clientX-Ke.left,r=n.clientY-Ke.top;else{if(0>e||0>r)return ze=-10,void(Ee=-10);var h=fr.scales,d=h[0],p=h[1];e=null!=d?s(t.posToVal(e,d),yn[d],ft,0):ft*(e/i),r=null!=p?f(t.posToVal(r,p),yn[p],ct,0):ct*(r/a)}c&&(e>1&&ft-1>e||(e=T(e,ft)),r>1&&ct-1>r||(r=T(r,ct))),u?(ye=e,Me=r,v=Kt.move(o,e,r),Te=v[0],ke=v[1]):(ze=e,Ee=r)}function tr(){je({width:0,height:0},!1)}function er(n,t,e,r,i,a){Ce=!0,Ge=He=Fe._x=Fe._y=!1,nr(n,t,e,r,i,a,0,!0,!1),null!=n&&(at(Q,un,rr),vr.pub(K,o,Te,ke,ft,ct,null))}function rr(n,t,e,r,i,a){Ce=Fe._x=Fe._y=!1,nr(n,t,e,r,i,a,0,!1,!0);var l=Le.width>0||Le.height>0;if(l&&je(Le),Fe.setScale&&l){if(Ge&&Re(Mn,Je(Le.left,Mn),Je(Le.left+Le.width,Mn)),He)for(var u in yn){var s=yn[u];u!=Mn&&null==s.from&&s.min!=M&&Re(u,Je(Le.top+Le.height,u),Je(Le.top,u))}tr()}else Kt.lock&&(Kt._lock=!Kt._lock,Kt._lock||Ze());null!=n&&(function(n,t){var e=rt.get(t)||{};xn(n,t,e[n]),e[n]=null}(Q,un),vr.pub(Q,o,ze,Ee,ft,ct,null))}function ir(){if(!Kt._lock){var n=Ce;if(Ce){var t=!0,e=!0;if(Ge&&He&&(t=10>=ze||ze>=ft-10,e=10>=Ee||Ee>=ct-10),Ge&&t){var r=ze,i=ft-ze,o=m(r,i);o==r&&(ze=0),o==i&&(ze=ft)}if(He&&e){var a=Ee,l=ct-Ee,u=m(a,l);u==a&&(Ee=0),u==l&&(Ee=ct)}Ze(1),Ce=!1}ze=-10,Ee=-10,Ze(1),n&&(Ce=n)}}function or(n){he(),tr(),null!=n&&vr.pub(tn,o,ze,Ee,ft,ct,null)}var ar,lr={};lr.mousedown=er,lr.mousemove=$e,lr.mouseup=rr,lr.dblclick=or,lr.setSeries=function(n,t,e,r){Ue(e,r)},Kt.show&&(at(K,C,er),at(Z,C,$e),at($,C,Qe),at(nn,C,(function(){ln(ir)})),at(tn,C,or),ar=function(n){var t=null;function e(){t=null,n()}return function(){clearTimeout(t),t=setTimeout(e,100)}}(Qe),wn(en,sn,ar),wn(rn,sn,ar),o.syncRect=Qe);var ur=o.hooks=t.hooks||{};function sr(n,t,e){n in ur&&ur[n].forEach((function(n){n.call(null,o,t,e)}))}(t.plugins||[]).forEach((function(n){for(var t in n.hooks)ur[t]=(ur[t]||[]).concat(n.hooks[t])}));var fr=V({key:null,setSeries:!1,scales:[Mn,null]},Kt.sync),cr=fr.key,vr=null!=cr?Wt[cr]=Wt[cr]||At():At();function hr(){sr("init",t,e),ve(e||t.data,!1),Yn[Mn]?Ae(Mn,Yn[Mn]):he(),It(t.width,t.height),je(Le,!1)}return vr.sub(o),o.pub=function(n,t,e,r,i,o,a){lr[n](null,t,e,r,i,o,a)},o.destroy=function(){vr.unsub(o),xn(en,sn,ar),xn(rn,sn,ar),x.remove(),sr("destroy")},r?r instanceof HTMLElement?(r.appendChild(x),hr()):r(o,hr):hr(),o}Kt.assign=V,Kt.fmtNum=f,Kt.rangeNum=l,Kt.rangeLog=i,Kt.join=function(n,t){if(1==n.length)return{data:n[0],isGap:t?function(n,e){return 0!=t[0][e]}:function(){return!0}};for(var e=new Set,r=[new Set],i=0;n.length>i;i++){for(var o=n[i],a=o[0],l=a.length,u=0;l>u;u++)e.add(a[u]);for(var s=1;o.length>s;s++){var f=new Set;if(null==t||1==t[i][s]||2==t[i][s])for(var c=o[s],v=0;l>v;v++)null==c[v]&&f.add(a[v]);r.push(f)}}for(var h=[Array.from(e).sort((function(n,t){return n-t}))],d=h[0].length,p=new Map,m=0;d>m;m++)p.set(h[0][m],m);for(var g=1,w=0;n.length>w;w++)for(var x=n[w],b=x[0],_=1;x.length>_;_++){for(var y=x[_],T=Array(d).fill(null),k=0;y.length>k;k++)T[p.get(b[k])]=y[k];if(t&&2==t[w][_]){var S=r[g],D=S.size,z=0,E=void 0,Y=-M;for(var P of S.values()){if(z++==D)break;if(P>Y){var W=p.get(P);for(E=W-1;null===T[E];)S.add(h[0][E]),E--;for(E=W+1;null===T[E];)S.add(Y=h[0][E]),E++}}}h.push(T),g++}return{data:h,isGap:function(n,t,e){return r[t].has(n._data[0][e])}}},Kt.fmtDate=zn,Kt.tzDate=function(n,t){var e;return"Etc/UTC"==t?e=new Date(+n+6e4*n.getTimezoneOffset()):t==En?e=n:(e=new Date(n.toLocaleString("en-US",{timeZone:t}))).setMilliseconds(n.getMilliseconds()),e},Kt.addGap=Ht,Kt.clipGaps=Gt;var Qt=Kt.paths={};return Qt.linear=Vt,Qt.spline=function(){return function(n,e,r,i){var o=Ft(n,e),a=o[0],l=o[1],u=o[2],s=o[3],f=o[4],c=o[5],v=o[6],h=o[7],p=o[8],m=o[9],g=o[10];r=t(u,r,i,1),i=t(u,r,i,-1);for(var b=[],_=!1,y=d(c(l[r],s,m,h)),M=y,T=[],k=[],S=r;i>=S;S++){var D=u[S],z=c(l[S],s,m,h);null!=D?(_&&(Ht(b,M,z),_=!1),T.push(M=z),k.push(v(u[S],f,g,p))):a.isGap(n,e,S)&&(Ht(b,M,z),_=!0)}var E=function(n,t,e){var r,i,o,a,l,u,s,f,c,v,h,p,m,g,b,_,y,M,T,k,S,D,z,E,Y,P=new Path2D,W=n.length;P.moveTo(d(n[0]),d(t[0]));for(var A=0;W-1>A;A++){var C=0==A?0:A-1;i=t[C],a=t[A],l=n[A+1],u=t[A+1],W>A+2?(s=n[A+2],f=t[A+2]):(s=l,f=u),m=x(w((r=n[C])-(o=n[A]),2)+w(i-a,2)),g=x(w(o-l,2)+w(a-u,2)),b=x(w(l-s,2)+w(u-f,2)),k=w(b,e),D=w(b,1),S=w(g,e),z=w(g,1),(M=3*(Y=w(m,e))*(Y+S))>0&&(M=1/M),(T=3*k*(k+S))>0&&(T=1/T),v=(-z*i+(_=2*(E=w(m,1))+3*Y*S+z)*a+E*u)*M,p=(D*a+(y=2*D+3*k*S+z)*u-z*f)*T,0==(c=(-z*r+_*o+E*l)*M)&&0==v&&(c=o,v=a),0==(h=(D*o+y*l-z*s)*T)&&0==p&&(h=l,p=u),P.bezierCurveTo(c,v,h,p,l,u)}return P}(T,k,.5),Y=new Path2D(E),P=a.fillTo(n,e,a.min,a.max),W=d(v(P,f,g,p));return Y.lineTo(M,W),Y.lineTo(y,W),{stroke:E,fill:Y,clip:a.spanGaps?null:Gt(b,1,h,p,m,g)}}},Qt.stepped=function(n){var e=u(n.align,1);return function(n,r,i,o){var a=Ft(n,r),l=a[0],u=a[1],s=a[2],f=a[3],c=a[4],v=a[5],h=a[6],p=a[7],m=a[8],g=a[9],w=a[10],x=new Path2D;i=t(s,i,o,1),o=t(s,i,o,-1);var b=[],_=!1,y=d(h(s[i],c,w,m)),M=d(v(u[i],f,g,p)),T=M;x.moveTo(M,y);for(var k=i+1;o>=k;k++){var S=s[k],D=d(v(u[k],f,g,p));if(null!=S){var z=d(h(S,c,w,m));if(_){if(Ht(b,T,D),y!=z){var E=l.width*fn/2,Y=b[b.length-1];Y[0]+=E,Y[1]-=E}_=!1}1==e?x.lineTo(D,y):x.lineTo(T,z),x.lineTo(D,z),y=z,T=D}else l.isGap(n,r,k)&&(Ht(b,T,D),_=!0)}var P=new Path2D(x),W=l.fillTo(n,r,l.min,l.max),A=d(h(W,c,w,m));return P.lineTo(T,A),P.lineTo(M,A),{stroke:x,fill:P,clip:l.spanGaps?null:Gt(b,1,p,m,g,w)}}},Qt.bars=function(n){var t=u((n=n||F).size,[.6,M]),e=1-t[0],r=u(t[1],M)*fn;return function(n,t,i,o){for(var a=Ft(n,t),l=a[0],u=a[1],s=a[2],f=a[3],c=a[4],v=a[5],h=a[6],p=a[7],w=a[8],x=a[9],b=a[10],_=v(u[1],f,x,p)-v(u[0],f,x,p),y=_*e,M=h(l.fillTo(n,t,l.min,l.max),c,b,w),T=d(l.width*fn),k=d(m(r,_-y)-T),S=new Path2D,D=i;o>=D;D++){var z=s[D];if(null!=z){var E=v(2==f.distr?D:u[D],f,x,p),Y=h(z,c,b,w),P=d(E-k/2),W=d(g(Y,M)),A=d(m(Y,M));S.rect(P,A,k,W-A)}}return{stroke:S,fill:null!=l.fill?new Path2D(S):void 0}}},Kt}(); diff --git a/package.json b/package.json index f20b9d18..684693c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uplot", - "version": "1.5.0", + "version": "1.5.1", "description": "A small, fast chart for time series, lines, areas, ohlc & bars", "main": "./dist/uPlot.cjs.js", "module": "./dist/uPlot.esm.js",