UNPKG

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
/* 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.16-hf1 */ ZC.WJ.push("animation");var VP={$i:function(t){var i=this;i.LX=null,i.A4M=0,i.P2=[],i.BD=t,i.A3G=!0},add:function(t){var i=this;i.P2.push(t),t.K6=i,t.LX=i.LX,t.BZ.TM=!0,t.X2=i.P2.length-1,i.A3G=!1}};ZC.VP=ZC.C5.CD(VP);var E8={$i:function(t,i,n,e,a,r){var C=this;for(var Z in C.LX=null,C.BZ=t,C.AW=null,C.A4N=0,C.HY=null,C.O=i||{},C.A4O=n||500,C.XC=e||-1,C.A0E=null,C.TA=null,C.OH=null,null!==ZC._n_(r)&&(C.TA=r),C.A4P=ZC.E8.linear,null!==ZC._n_(a)&&""!==a&&(C.A4P=a),C.ADJ={},C.C7={},C.ACK=[],C.RI=ZC._i_(C.A4O/ZC.PO.U6),C.RI>100&&(C.RI=100),(ZC.vml||ZC.mobile)&&(C.RI=ZC._i_(C.RI/4)),C.RI<5&&(C.RI=5),C.O)null!==ZC._n_(ZC.E8.GO[Z])?C.C7[Z]=C.BZ[ZC.E8.GO[Z]]:C.C7[Z]=C.BZ[Z];C.Y=0,C.K6=null,C.X2=-1},status:function(){return this.Y+1>this.RI?0:1},step:function(){var t,i,n,e,a,r,C=this,Z=1,l=C.LX.C.G.AC;if(C.Y++,C.Y>C.RI&&(C.Y===C.RI+1&&-1!==C.X2&&(C.K6.A4M++,C.K6.A4M===C.K6.P2.length&&(C.K6.A3G=!0)),Z=0),Z){var o={};if(C.Y===C.RI)o=C.O,C.A4N=1;else for(var A in C.A4N=C.A4P(C.Y,0,1,C.RI),C.O)switch(A){case"points":var s=[];for(a=0,r=C.O[A].length;a<r;a++)if(null!==ZC._n_(C.C7[A][a])){s[a]=[];for(var c=0,u=C.O[A][a].length;c<u;c++)s[a][c]=C.A4P(C.Y,C.C7[A][a][c],C.O[A][a][c]-C.C7[A][a][c],C.RI)}o[A]=s;break;case"lineColor":case"borderColor":case"backgroundColor1":case"backgroundColor2":var B=C.C7[A].replace("#",""),h=ZC.AO.GD(C.O[A]).replace("#",""),E=ZC.R3(B.slice(0,2)),p=ZC.R3(B.slice(2,4)),f=ZC.R3(B.slice(4,6)),d=ZC.R3(h.slice(0,2)),_=ZC.R3(h.slice(2,4)),O=ZC.R3(h.slice(4,6)),P=ZC.OZ(ZC._i_(C.A4P(C.Y,E,d-E,C.RI)));1===P.length&&(P="0"+P);var R=ZC.OZ(ZC._i_(C.A4P(C.Y,p,_-p,C.RI)));1===R.length&&(R="0"+R);var v=ZC.OZ(ZC._i_(C.A4P(C.Y,f,O-f,C.RI)));1===v.length&&(v="0"+v),o[A]="#"+P+R+v;break;default:o[A]=C.A4P(C.Y,C.C7[A],C.O[A]-C.C7[A],C.RI)}if(C.BZ.append(o),C.BZ.TM=!0,C.BZ.parse(),C.AW&&(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.AW.A.HS?C.BZ.E.opacity2=C.AW.A.HS:C.BZ.E.opacity2=C.AW.A.C6),C.AW.G&&(C.AW.G.E[C.AW.K+"-bounds"]=[C.AW.iX,C.AW.iY,C.AW.iX+C.AW.I,C.AW.iY+C.AW.F])),C.A0E)try{C.A0E(C.BZ,o)}catch(Y){}if(C.AW){var m={id:C.AW.G.K,graphid:C.AW.C.K,plotindex:C.AW.A.L,nodeindex:C.AW.L,stage:C.A4N,value:C.AW.AD*C.A4N};ZC.AO.C0("animation_step",C.AW.G,m)}}if(C.AW){if(1===C.Y||"canvas"===l)-1!==ZC.AV(["svg","vml"],l)?0===ZC.A4("#"+C.BZ.K+"-path").length&&C.paint():C.paint();else if(C.Y<=C.RI){switch(l){case"svg":C.BZ.WZ(!0);break;case"vml":C.BZ.X0(null,!0)}C.BZ.WH&&C.BZ.WH(),"vml"===l&&/\-plotset\-plot-\d+\-node\-\d+\-area/.test(C.BZ.K)&&(C.BZ.B1=0),i=null,"undefined"!=typeof C.BZ.DJ&&"box"===C.BZ.DJ&&(i=C.BZ.B1,C.BZ.B1=C.BZ.AU);var g=!1;if("svg"===l&&ZC.AM(C.BZ.K+"-path")&&"rect"===ZC.AM(C.BZ.K+"-path").tagName&&(g=!0),g)n=[],e=[];else if(n=ZC.Q.A33(C.BZ.D,l,C.BZ,!1,!0),C.BZ.ME){var T=ZC.Q._sh_(C.BZ.D,C.BZ);e=ZC.Q.A33(T,l,C.BZ,!1,!0)}null!==ZC._n_(i)&&(C.BZ.B1=i);var w=C.BZ.C6,M=C.BZ.O3,I=C.BZ.T8,K=C.BZ.JZ,L=C.BZ.AI;switch(l){case"svg":ZC.A4("#"+C.BZ.K+"-path").attr("d",n.join(" ")).attr("stroke-opacity",M).attr("fill-opacity",w),C.BZ.ME&&ZC.A4("#"+C.BZ.K+"-sh-path").attr("d",e.join(" ")).attr("stroke-opacity",M*I).attr("fill-opacity",w*I),g&&(ZC.A4("#"+C.BZ.K+"-path").attr("x",C.BZ.iX).attr("y",C.BZ.iY).attr("width",ZC.BR(0,C.BZ.I)).attr("height",ZC.BR(0,C.BZ.F)),C.BZ.ME&&ZC.A4("#"+C.BZ.K+"-sh-path").attr("x",C.BZ.iX+K*ZC.EF(C.BZ.OM)).attr("y",C.BZ.iY+K*ZC.EL(C.BZ.OM)).attr("width",ZC.BR(0,C.BZ.I)).attr("height",ZC.BR(0,C.BZ.F))),ZC.A4("#"+C.BZ.K+"-circle").attr("stroke-opacity",M).attr("cx",C.BZ.iX).attr("cy",C.BZ.iY).attr("r",L).attr("fill-opacity",w),C.BZ.ME&&ZC.A4("#"+C.BZ.K+"-sh-circle").attr("stroke-opacity",M*I).attr("cx",C.BZ.iX+K).attr("r",L).attr("cy",C.BZ.iY+K).attr("fill-opacity",w*I),""!==C.BZ.DC&&ZC.A4("#"+C.BZ.K+"-path-imgfill").attr("d",n.join(" ")).attr("stroke-opacity",M).attr("fill-opacity",w),ZC.A4("#"+C.BZ.K+"-goal-path").remove();break;case"vml":ZC.A4("#"+C.BZ.K+"-path").children().each(function(){this.v=n.join(" "),this.opacity=w}),C.BZ.ME&&ZC.A4("#"+C.BZ.K+"-sh-path").children().each(function(){this.v=e.join(" "),this.opacity=w*I}),ZC.A4("#"+C.BZ.K+"-circle").children().each(function(){this.opacity=w}),ZC.A4("#"+C.BZ.K+"-circle").each(function(){this.style.left=C.BZ.iX-L+"px",this.style.top=C.BZ.iY-L+"px",this.style.width=2*L+"px",this.style.height=2*L+"px"}),C.BZ.ME&&(ZC.A4("#"+C.BZ.K+"-sh-circle").children().each(function(){this.opacity=w*I}),ZC.A4("#"+C.BZ.K+"-sh-circle").each(function(){this.style.left=C.BZ.iX-L+K+"px",this.style.top=C.BZ.iY-L+K+"px",this.style.width=2*L+"px",this.style.height=2*L+"px"})),ZC.A4("#"+C.BZ.K+"-goal-path").remove()}}}else C.LX.C.Q9=!0,C.LX.C.A0P(),C.LX.C.KM();return C.Y===C.RI+1&&null!==ZC._n_(C.TA)&&C.TA(),Z},paint:function(){var t=this;if(null!==ZC._n_(t.HY)?ZC.CO.paint(t.HY,t.BZ,t.BZ.D):t.BZ.paint(),t.OH)try{1===t.A4N&&t.OH()}catch(i){}}};ZC.E8=ZC.C5.CD(E8),ZC.E8.GO={angleStart:"B4",angleEnd:"BL",slice:"CP",size:"AI",x:"iX",y:"iY",width:"I",height:"F",alpha:"C6",angle:"AB",fillAngle:"NC",points:"D",lineWidth:"B1",lineColor:"B9",borderWidth:"AU",borderColor:"BX",backgroundColor1:"A0",backgroundColor2:"AE"},ZC.E8.linear=function(t,i,n,e){return n*t/e+i},ZC.E8.backEaseOut=function(t,i,n,e){var a=(t/=e)*t;return i+n*(4*(a*t)+-9*a+6*t)},ZC.E8.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.E8.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.E8.regularEaseOut=function(t,i,n,e){var a=(t/=e)*t;return i+n*(a*t+-3*a+3*t)},ZC.E8.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.E8.RQ=[ZC.E8.linear,ZC.E8.backEaseOut,ZC.E8.elasticEaseOut,ZC.E8.bounceEaseOut,ZC.E8.strongEaseOut,ZC.E8.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.PO=ZC.C5.CD({$i:function(t){var i=this;i.C=t,i.RJ=!1,i.C4=null,i.P2=[],i.PM={},i.onStop=null},AA7:function(t,i){var n=this;null===ZC._n_(n.PM[t.BD])&&(n.PM[t.BD]=t,t.LX=n,n.RJ||(null!==ZC._n_(i)&&i>0?window.setTimeout(function(){n.start()},i+1):n.start()))},add:function(t){var i=this;t.LX=i,t.XC>0?(i.P2.push(t),window.setTimeout(function(){t.BZ.TM=!0,i.RJ||i.start()},t.XC+1)):(t.BZ.TM=!0,i.P2.push(t),i.RJ||i.start())},start:function(){var t=this;t.RJ=!0,ZC.AO.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.RJ&&(t.C4=window.requestAnimFrame(n))}()},step:function(){var t,i=this,n=0;if(i.RJ){for(var e=0,a=i.P2.length;e<a;e++)n+=i.P2[e].status();if("canvas"===i.C.G.AC)if(i.C.G.KK)null!==ZC._n_(t=ZC.AM(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.AY.A3.length;e<a;e++)for(var r=0;r<i.C.AY.A3[e].SX;r++)null!==ZC._n_(t=ZC.AM(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.P2.length;e<a;e++)0===i.P2[e].step()&&(i.P2[e].BZ.TM=!1);for(var C in i.PM)for(i.PM[C].A3G||(n+=1),e=0,a=i.PM[C].P2.length;e<a;e++)i.PM[C].P2[e].X2===i.PM[C].A4M?0===i.PM[C].P2[e].step()&&(i.PM[C].P2[e].BZ.TM=!1):"canvas"===i.C.G.AC&&i.PM[C].P2[e].paint();0===n&&(i.PM={},i.P2=[],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.A0P(),n.C.Q9=!1,ZC.AM(n.C.G.K)){n.C.KM(),window.setTimeout(function(){if((i=ZC.AM(n.C.A.K+"-map"))&&n.C.AY.H3){-1===ZC.AV(["bubble","mixed","vbullet","hbullet","radar"],n.C.AF)&&1!==zingchart.SORTTRACKERS||n.C.AY.H3.sort(function(t,i){return ZC.AO.NB(t)>ZC.AO.NB(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.AY.H3.join("")+i.innerHTML.substring(e+t.length):i.innerHTML+=n.C.a11y()+n.C.AY.H3.join("")}},33),n.C.A71(),n.RJ=!1;for(var e=0,a=n.P2.length;e<a;e++)n.P2[e].TA=null;if(n.P2=[],n.PM={},t||ZC.AO.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.PO.U6=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.PO.U6)}),window.clearAnimFrame||(window.clearAnimFrame=function(t){window.clearTimeout(t)})}();