zingchart
Version:
Our JavaScript charting library is a commercial product. But the full branded version is free to try, forever.
8 lines (7 loc) • 9.39 kB
JavaScript
/*
All of the code within the ZingChart software is developed and copyrighted by ZingChart, Inc., and may not be copied,
replicated, or used in any other software or application without prior permission from ZingChart. All usage must coincide with the
ZingChart End User License Agreement which can be requested by email at support@zingchart.com.
Build 2.9.11
*/
ZC.WG.push("animation");var VL={$i:function(t){var i=this;i.LV=null,i.A4L=0,i.OX=[],i.BF=t,i.A3G=!0},add:function(t){var i=this;i.OX.push(t),t.K3=i,t.LV=i.LV,t.BZ.TH=!0,t.X0=i.OX.length-1,i.A3G=!1}};ZC.VL=ZC.C9.CC(VL);var E6={$i:function(t,i,n,e,a,r){var C=this;for(var Z in C.LV=null,C.BZ=t,C.AX=null,C.A4M=0,C.HU=null,C.N=i||{},C.A4N=n||500,C.XA=e||-1,C.A0B=null,C.T4=null,C.OC=null,null!==ZC._n_(r)&&(C.T4=r),C.A4O=ZC.E6.linear,null!==ZC._n_(a)&&""!==a&&(C.A4O=a),C.ADJ={},C.C6={},C.ACL=[],C.RD=ZC._i_(C.A4N/ZC.PJ.U1),C.RD>100&&(C.RD=100),(ZC.vml||ZC.mobile)&&(C.RD=ZC._i_(C.RD/4)),C.RD<5&&(C.RD=5),C.N)null!==ZC._n_(ZC.E6.GM[Z])?C.C6[Z]=C.BZ[ZC.E6.GM[Z]]:C.C6[Z]=C.BZ[Z];C.Y=0,C.K3=null,C.X0=-1},status:function(){return this.Y+1>this.RD?0:1},step:function(){var t,i,n,e,a,r,C=this,Z=1,l=C.LV.C.H.AC;if(C.Y++,C.Y>C.RD&&(C.Y===C.RD+1&&-1!==C.X0&&(C.K3.A4L++,C.K3.A4L===C.K3.OX.length&&(C.K3.A3G=!0)),Z=0),Z){var o={};if(C.Y===C.RD)o=C.N,C.A4M=1;else for(var A in C.A4M=C.A4O(C.Y,0,1,C.RD),C.N)switch(A){case"points":var s=[];for(a=0,r=C.N[A].length;a<r;a++)if(null!==ZC._n_(C.C6[A][a])){s[a]=[];for(var c=0,u=C.N[A][a].length;c<u;c++)s[a][c]=C.A4O(C.Y,C.C6[A][a][c],C.N[A][a][c]-C.C6[A][a][c],C.RD)}o[A]=s;break;case"lineColor":case"borderColor":case"backgroundColor1":case"backgroundColor2":var B=C.C6[A].replace("#",""),h=ZC.AQ.GC(C.N[A]).replace("#",""),E=ZC.QY(B.slice(0,2)),O=ZC.QY(B.slice(2,4)),p=ZC.QY(B.slice(4,6)),f=ZC.QY(h.slice(0,2)),d=ZC.QY(h.slice(2,4)),_=ZC.QY(h.slice(4,6)),X=ZC.OU(ZC._i_(C.A4O(C.Y,E,f-E,C.RD)));1===X.length&&(X="0"+X);var L=ZC.OU(ZC._i_(C.A4O(C.Y,O,d-O,C.RD)));1===L.length&&(L="0"+L);var v=ZC.OU(ZC._i_(C.A4O(C.Y,p,_-p,C.RD)));1===v.length&&(v="0"+v),o[A]="#"+X+L+v;break;default:o[A]=C.A4O(C.Y,C.C6[A],C.N[A]-C.C6[A],C.RD)}if(C.BZ.append(o),C.BZ.TH=!0,C.BZ.parse(),C.AX&&(null!==ZC._n_(t=C.BZ.E["bound-1"])&&(C.BZ.D2[1]=t),null!==ZC._n_(t=C.BZ.E["bound-3"])&&(C.BZ.D2[3]=t),"vml"===l&&1===C.Y&&("undefined"!=typeof C.AX.A.HO?C.BZ.E.opacity2=C.AX.A.HO:C.BZ.E.opacity2=C.AX.A.C5),C.AX.H&&(C.AX.H.E[C.AX.K+"-bounds"]=[C.AX.iX,C.AX.iY,C.AX.iX+C.AX.I,C.AX.iY+C.AX.F])),C.A0B)try{C.A0B(C.BZ,o)}catch(N){}if(C.AX){var m={id:C.AX.H.K,graphid:C.AX.C.K,plotindex:C.AX.A.L,nodeindex:C.AX.L,stage:C.A4M,value:C.AX.AD*C.A4M};ZC.AQ.C0("animation_step",C.AX.H,m)}}if(C.AX){if(1===C.Y||"canvas"===l)-1!==ZC.AV(["svg","vml"],l)?0===ZC.A5("#"+C.BZ.K+"-path").length&&C.paint():C.paint();else if(C.Y<=C.RD){switch(l){case"svg":C.BZ.WX(!0);break;case"vml":C.BZ.WY(null,!0)}C.BZ.WE&&C.BZ.WE(),"vml"===l&&/\-plotset\-plot-\d+\-node\-\d+\-area/.test(C.BZ.K)&&(C.BZ.B1=0),i=null,"undefined"!=typeof C.BZ.DV&&"box"===C.BZ.DV&&(i=C.BZ.B1,C.BZ.B1=C.BZ.AU);var D=!1;if("svg"===l&&ZC.AL(C.BZ.K+"-path")&&"rect"===ZC.AL(C.BZ.K+"-path").tagName&&(D=!0),D)n=[],e=[];else if(n=ZC.Q.A33(C.BZ.D,l,C.BZ,!1,!0),C.BZ.MA){var g=ZC.Q._sh_(C.BZ.D,C.BZ);e=ZC.Q.A33(g,l,C.BZ,!1,!0)}null!==ZC._n_(i)&&(C.BZ.B1=i);var T=C.BZ.C5,R=C.BZ.NZ,w=C.BZ.T2,H=C.BZ.JU,K=C.BZ.AI;switch(l){case"svg":ZC.A5("#"+C.BZ.K+"-path").attr("d",n.join(" ")).attr("stroke-opacity",R).attr("fill-opacity",T),C.BZ.MA&&ZC.A5("#"+C.BZ.K+"-sh-path").attr("d",e.join(" ")).attr("stroke-opacity",R*w).attr("fill-opacity",T*w),D&&(ZC.A5("#"+C.BZ.K+"-path").attr("x",C.BZ.iX).attr("y",C.BZ.iY).attr("width",ZC.BQ(0,C.BZ.I)).attr("height",ZC.BQ(0,C.BZ.F)),C.BZ.MA&&ZC.A5("#"+C.BZ.K+"-sh-path").attr("x",C.BZ.iX+H*ZC.EI(C.BZ.OI)).attr("y",C.BZ.iY+H*ZC.EP(C.BZ.OI)).attr("width",ZC.BQ(0,C.BZ.I)).attr("height",ZC.BQ(0,C.BZ.F))),ZC.A5("#"+C.BZ.K+"-circle").attr("stroke-opacity",R).attr("cx",C.BZ.iX).attr("cy",C.BZ.iY).attr("r",K).attr("fill-opacity",T),C.BZ.MA&&ZC.A5("#"+C.BZ.K+"-sh-circle").attr("stroke-opacity",R*w).attr("cx",C.BZ.iX+H).attr("r",K).attr("cy",C.BZ.iY+H).attr("fill-opacity",T*w),""!==C.BZ.DB&&ZC.A5("#"+C.BZ.K+"-path-imgfill").attr("d",n.join(" ")).attr("stroke-opacity",R).attr("fill-opacity",T),ZC.A5("#"+C.BZ.K+"-goal-path").remove();break;case"vml":ZC.A5("#"+C.BZ.K+"-path").children().each(function(){this.v=n.join(" "),this.opacity=T}),C.BZ.MA&&ZC.A5("#"+C.BZ.K+"-sh-path").children().each(function(){this.v=e.join(" "),this.opacity=T*w}),ZC.A5("#"+C.BZ.K+"-circle").children().each(function(){this.opacity=T}),ZC.A5("#"+C.BZ.K+"-circle").each(function(){this.style.left=C.BZ.iX-K+"px",this.style.top=C.BZ.iY-K+"px",this.style.width=2*K+"px",this.style.height=2*K+"px"}),C.BZ.MA&&(ZC.A5("#"+C.BZ.K+"-sh-circle").children().each(function(){this.opacity=T*w}),ZC.A5("#"+C.BZ.K+"-sh-circle").each(function(){this.style.left=C.BZ.iX-K+H+"px",this.style.top=C.BZ.iY-K+H+"px",this.style.width=2*K+"px",this.style.height=2*K+"px"})),ZC.A5("#"+C.BZ.K+"-goal-path").remove()}}}else C.LV.C.Q3=!0,C.LV.C.A0M(),C.LV.C.KL();return C.Y===C.RD+1&&null!==ZC._n_(C.T4)&&C.T4(),Z},paint:function(){var t=this;if(null!==ZC._n_(t.HU)?ZC.CR.paint(t.HU,t.BZ,t.BZ.D):t.BZ.paint(),t.OC)try{1===t.A4M&&t.OC()}catch(i){}}};ZC.E6=ZC.C9.CC(E6),ZC.E6.GM={angleStart:"B4",angleEnd:"BL",slice:"CO",size:"AI",x:"iX",y:"iY",width:"I",height:"F",alpha:"C5",angle:"AA",fillAngle:"N9",points:"D",lineWidth:"B1",lineColor:"B7",borderWidth:"AU",borderColor:"BX",backgroundColor1:"A0",backgroundColor2:"AE"},ZC.E6.linear=function(t,i,n,e){return n*t/e+i},ZC.E6.backEaseOut=function(t,i,n,e){var a=(t/=e)*t;return i+n*(4*(a*t)+-9*a+6*t)},ZC.E6.elasticEaseOut=function(t,i,n,e){var a=(t/=e)*t,r=a*t;return i+n*(37.045*r*a+-116.2825*a*a+134.08*r+-68.59*a+14.7475*t)},ZC.E6.bounceEaseOut=function(t,i,n,e){return(t/=e)<1/2.75?n*(7.5625*t*t)+i:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+i:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+i:n*(7.5625*(t-=2.625/2.75)*t+.984375)+i},ZC.E6.regularEaseOut=function(t,i,n,e){var a=(t/=e)*t;return i+n*(a*t+-3*a+3*t)},ZC.E6.strongEaseOut=function(t,i,n,e){var a=(t/=e)*t,r=a*t;return i+n*(r*a+-5*a*a+10*r+-10*a+5*t)},ZC.E6.RL=[ZC.E6.linear,ZC.E6.backEaseOut,ZC.E6.elasticEaseOut,ZC.E6.bounceEaseOut,ZC.E6.strongEaseOut,ZC.E6.regularEaseOut],ZC.ANIMATION={SLOW:4e3,FAST:1e3,LINEAR:0,BACK_EASE_OUT:1,ELASTIC_EASE_OUT:2,BOUNCE_EASE_OUT:3,STRONG_EASE_OUT:4,REGULAR_EASE_OUT:5,NO_SEQUENCE:0,BY_PLOT:1,BY_NODE:2,BY_PLOT_AND_NODE:3,FADE_IN:1,EXPAND_VERTICAL:2,EXPAND_TOP:3,EXPAND_BOTTOM:4,EXPAND_LEFT:5,EXPAND_RIGHT:6,EXPAND_HORIZONTAL:7,SLIDE_LEFT:8,SLIDE_RIGHT:9,SLIDE_TOP:10,SLIDE_BOTTOM:11,UNFOLD_HORIZONTAL:12,UNFOLD_VERTICAL:13,EXPAND:2,GROW:3,FLY_IN:4,UNFOLD:5},ZC.PJ=ZC.C9.CC({$i:function(t){var i=this;i.C=t,i.RE=!1,i.C4=null,i.OX=[],i.PH={},i.onStop=null},AA8:function(t,i){var n=this;null===ZC._n_(n.PH[t.BF])&&(n.PH[t.BF]=t,t.LV=n,n.RE||(null!==ZC._n_(i)&&i>0?window.setTimeout(function(){n.start()},i+1):n.start()))},add:function(t){var i=this;t.LV=i,t.XA>0?(i.OX.push(t),window.setTimeout(function(){t.BZ.TH=!0,i.RE||i.start()},t.XA+1)):(t.BZ.TH=!0,i.OX.push(t),i.RE||i.start())},start:function(){var t=this;t.RE=!0,ZC.AQ.C0("animation_start",t.C.A,{id:t.C.A.K,graphid:t.C.K});var i=!0;!function n(){i||t.step(),i=!1,t.RE&&(t.C4=window.requestAnimFrame(n))}()},step:function(){var t,i=this,n=0;if(i.RE){for(var e=0,a=i.OX.length;e<a;e++)n+=i.OX[e].status();if("canvas"===i.C.H.AC)if(i.C.H.K9)null!==ZC._n_(t=ZC.AL(i.C.K+"-plots-bl-c"))&&t.getContext("2d").clearRect(i.C.iX,i.C.iY,i.C.I,i.C.F);else for(e=0,a=i.C.AZ.A3.length;e<a;e++)for(var r=0;r<i.C.AZ.A3[e].SR;r++)null!==ZC._n_(t=ZC.AL(i.C.K+"-plot-"+e+"-bl-"+r+"-c"))&&t.getContext("2d").clearRect(i.C.iX,i.C.iY,i.C.I,i.C.F);for(e=0,a=i.OX.length;e<a;e++)0===i.OX[e].step()&&(i.OX[e].BZ.TH=!1);for(var C in i.PH)for(i.PH[C].A3G||(n+=1),e=0,a=i.PH[C].OX.length;e<a;e++)i.PH[C].OX[e].X0===i.PH[C].A4L?0===i.PH[C].OX[e].step()&&(i.PH[C].OX[e].BZ.TH=!1):"canvas"===i.C.H.AC&&i.PH[C].OX[e].paint();0===n&&(i.PH={},i.OX=[],i.stop())}},stop:function(t){null===ZC._n_(t)&&(t=!1);var i,n=this;if(t&&(n.bDead=!0),window.clearAnimFrame(n.C4),n.C.A0M(),n.C.Q3=!1,ZC.AL(n.C.H.K)){n.C.KL(),window.setTimeout(function(){if((i=ZC.AL(n.C.A.K+"-map"))&&n.C.AZ.HD){-1===ZC.AV(["bubble","mixed","vbullet","hbullet","radar"],n.C.AF)&&1!==zingchart.SORTTRACKERS||n.C.AZ.HD.sort(function(t,i){return ZC.AQ.N8(t)>ZC.AQ.N8(i)?1:-1});var t='<area shape="rect" coords="0,0,1,1" id="mark'+n.C.L+'">',e=i.innerHTML.indexOf(t);-1!==e?i.innerHTML=i.innerHTML.substring(0,e+t.length)+n.C.a11y()+n.C.AZ.HD.join("")+i.innerHTML.substring(e+t.length):i.innerHTML+=n.C.a11y()+n.C.AZ.HD.join("")}},33),n.C.A6Z(),n.RE=!1;for(var e=0,a=n.OX.length;e<a;e++)n.OX[e].T4=null;if(n.OX=[],n.PH={},t||ZC.AQ.C0("animation_end",n.C.A,{id:n.C.A.K,graphid:n.C.K}),null!==ZC._n_(n.onStop))try{n.onStop()}catch(r){}}}}),ZC.PJ.U1=33,function(){for(var t=["ms","moz","webkit","o"],i=0,n=t.length;i<n&&!window.requestAnimFrame;++i)window.requestAnimFrame=window.requestAnimationFrame||window[t[i]+"RequestAnimationFrame"],window.cancelAnimFrame=window.cancelAnimationFrame||window[t[i]+"CancelAnimationFrame"]||window[t[i]+"CancelRequestAnimationFrame"];window.requestAnimFrame||(window.requestAnimFrame=function(t){return window.setTimeout(t,ZC.PJ.U1)}),window.clearAnimFrame||(window.clearAnimFrame=function(t){window.clearTimeout(t)})}();