zingchart
Version:
Our JavaScript charting library is a commercial product. But the full branded version is free to try, forever.
8 lines (7 loc) • 7.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("vfunnel"),ZC.A80=ZC.NK.CC({$i:function(A){this.b(A);var n=this;n.AF="vfunnel",n.AZ=new ZC.A6T(n),n.AJ["enable-animation"]=!1,n.AJ["enable-zooming"]=!1,n.AJ["enable-scroll"]=!1},MS:function(A,n){switch(A){case"x":var e=this.b(A,n);return e.DE=!0,e;case"y":var i=this.b(A,n);return i.DE=!0,i}},ABG:function(A){if("v"===A){for(var n=[],e=0;e<this.o.series.length;e++)n.push("Step "+(e+1));return n}},paint:function(){for(var A=this,n=0,e=A.BO.length;n<e;n++)"v"===A.BO[n].AF&&(A.BO[n].AW=!A.BO[n].AW);A.b()}}),ZC.A2C=ZC.LN.CC({parse:function(){var A,n,e,i,l,a=this;for(a.AY=ZC.MAX,a.BD=-ZC.MAX,a.A7R=[],a.S8=[],a.b(),A=0,n=a.A3.length;A<n;A++)for(e=0,i=a.A3[A].R.length;e<i;e++)a.A3[A].R[e]&&(l=a.A3[A].R[e],null===ZC._n_(a.S8[e])&&(a.S8[e]=ZC.MAX),null===ZC._n_(a.A7R[e])&&(a.A7R[e]=-ZC.MAX),a.S8[e]=ZC.CY(a.S8[e],l.AD),a.A7R[e]=ZC.BQ(a.A7R[e],l.AD));for(A=0,n=a.A3.length;A<n;A++)for(e=0,i=a.A3[A].R.length;e<i;e++)a.A3[A].R[e]&&(l=a.A3[A].R[e],a.AY=ZC.CY(a.AY,l.AD),a.BD=ZC.BQ(a.BD,l.AD))}}),ZC.A6T=ZC.A2C.CC({ACU:function(){return new ZC.V8(this)}}),ZC.W8=ZC.W5.CC({$i:function(A){this.b(A);var n=this;n.L2=.1,n.OB=.1,n.LW=0,n.A2I="dynamic",n.OS=[],n.VI=[],n.P3="bg"},parse:function(){var A,n,e,i,l=this;if(l.BP=l.O1(),l.C2=l.BP[0],l.B7=l.BP[1],l.BX=l.BP[1],l.A0=l.BP[2],l.AE=l.BP[1],l.NQ(),l.b(),l.assign_a([["start-width","A2I"],["min-exit","LW","fp"],["space-entry","L2","fp"],["offset","L2","fp"],["offset","OB","fp"]]),null!==ZC._n_(e=l.o.entry))for(e instanceof Array||(e=[e]),A=0,n=e.length;A<n;A++){var a=new ZC.DQ(l);a.o=e[A],a.parse(),l.OS.push(a)}if(null!==ZC._n_(i=l.o.exit))for(i instanceof Array||(i=[i]),A=0,n=i.length;A<n;A++){var t=new ZC.DQ(l);t.o=i[A],t.parse(),l.VI.push(t)}l.B0=l.C.BM(l.BW("k")[0]),l.CN=l.C.BM(l.BW("v")[0])},paint:function(){var A=this;A.b(),A.KF=A.CQ("bl",0),A.PD()}}),ZC.V8=ZC.W8.CC({$i:function(A){this.b(A),this.AF="vfunnel"},TY:function(){return new ZC.A5V(this)}}),ZC.A5V=ZC.LI.CC({setup:function(){var A=this,n=A.A.B0,e=A.A.CN,i=[n.W,n.A1,e.W,e.A1];A.JQ!==i&&(n.AW?A.iX=n.iX+n.I-n.A9-(A.L+1)*n.AB:A.iX=n.iX+n.A9+A.L*n.AB,e.AW?A.iY=e.iY+e.A9+A.A.L*e.AB:A.iY=e.iY+e.F-e.A9-(A.A.L+1)*e.AB,A.JQ=i),A.HZ||(A.copy(A.A),A.E7=A.A.E7,A.DF()&&A.parse(!1),A.HZ=!0)},JX:function(A,n,e,i){var l,a,t=this,C=ZC._f_(t.A.A.F8["%pstack-"+t.L+"-0-sum"]||"0"),r=t.A.MT();if(ZC._cp_(n,r),t.CV=[],t.A.L>0&&t.A.A.A3[t.A.L-1]&&t.A.A.A3[t.A.L-1].R[t.L]?a=""+(l=100*t.AD/t.A.A.A3[t.A.L-1].R[t.L].AD):(l=100,a="100"),null!==ZC._n_(r.decimals)&&(a=l.toFixed(ZC.BQ(0,ZC._i_(r.decimals)))),t.CV.push(["%output-percent-value",a]),C>0){var o=100*t.AD/C,s=""+o;null!==ZC._n_(r.decimals)&&(s=o.toFixed(ZC.BQ(0,ZC._i_(r.decimals)))),t.CV.push(["%node-percent-value",s]),t.CV.push(["%npv",s])}return A=t.b(A,n,e,i)},paint:function(){var A,n,e,i,l,a,t,C,r,o,s,Z,p,u=this;u.b();var B=u.A.B0,h=u.A.CN;u.setup(),"static"===u.A.A2I?(u.C.AZ.S8[u.L],A=u.C.AZ.A7R[u.L]):(u.C.AZ.AY,A=u.C.AZ.BD);var _=u.A.L2;_<=1&&(_*=B.AB);var c=u.A.OB;c<=1&&(c*=B.AB);var f=u.A.LW;f<=1&&(f*=B.AB);var b=B.AB-_-c-f,v=f+b*(u.AD/A),L=0;u.A.L+1<u.A.A.A3.length&&u.A.A.A3[u.A.L+1].R[u.L]&&(L=u.A.A.A3[u.A.L+1].R[u.L].AD);var Y=f+b*(L/A);u.E["entry-exit"]=[v,Y];var D=u.iX+(B.AW?c:_)+b/2+f/2;if(i=[],h.AW?i.push([D-v/2,u.iY],[D+v/2,u.iY],[D+Y/2,u.iY+h.AB],[D-Y/2,u.iY+h.AB],[D-v/2,u.iY]):i.push([D-v/2,u.iY+h.AB],[D+v/2,u.iY+h.AB],[D+Y/2,u.iY],[D-Y/2,u.iY],[D-v/2,u.iY+h.AB]),u.E.points=i,u.AN){var Q=new ZC.DQ(u.A);Q.K=u.K+"-trapeze",Q.copy(u),Q.D=i,Q.parse(),Q.Z=u.A.CQ("bl",1),Q.C7=u.A.CQ("bl",0),Q.paint();var d=Q.FG(),X=u.C.K+"-node-area "+u.C.K+"-plotset-plot-"+u.A.L+"-node-area zc-node-area";u.A.A.HD.push(ZC.Q.FS("poly",u.A.EA,u.A.IK)+'class="'+X+'" id="'+u.K+'" coords="'+d+'" />')}for(n=0,e=u.A.OS.length;n<e;n++){var g=u.A.OS[n];g&&null!==ZC._n_(g.o.values)&&null!==ZC._n_(g.o.values[u.L])&&(null===ZC._n_(g.o.width)&&null===ZC._n_(g.o.height)||((l=new ZC.HQ(u.A)).append(g.o),l.parse()),a=0,t=0,null!==ZC._n_(g.o.width)&&(a=l.I),null!==ZC._n_(g.o.height)&&(t=l.F),0===a&&(a=ZC.BQ(20,B.AB/10)),0===t&&(t=ZC.BQ(16,h.AB/10)),(C=new ZC.DQ(u.A)).K=u.K+"-arrow-entry",C.copy(u),C.append(g.o),C.parse(),i=[],1===u.A.OS.length?o=u.iY+h.AB/2:(s=h.AB/(u.A.OS.length+1),o=u.iY+s+n*s),B.AW?(r=u.iX+B.AB+a-_-b/2+(v+Y)/4-f/2+2,i.push([r,o-2*t/6],[r-2*a/3,o-t/6],[r-2*a/3,o-3*t/6],[r-a,o],[r-2*a/3,o+3*t/6],[r-2*a/3,o+t/6],[r,o+2*t/6],[r,o-2*t/6])):(r=u.iX+_-a+b/2-(v+Y)/4+f/2-2,i.push([r,o-2*t/6],[r+2*a/3,o-t/6],[r+2*a/3,o-3*t/6],[r+a,o],[r+2*a/3,o+3*t/6],[r+2*a/3,o+t/6],[r,o+2*t/6],[r,o-2*t/6])),C.D=i,C.parse(),C.Z=u.A.CQ("bl",1),C.C7=u.A.CQ("bl",0),C.paint(),null!==ZC._n_(g.o.labels)&&null!==ZC._n_(g.o.labels[u.L])&&""!==g.o.labels[u.L]&&(Z=g.o.labels[u.L],(p=new ZC.DN(u.A)).K=u.K+"-entry-label-"+n,p.GL=u.K+"-entry-label "+u.A.K+"-entry-label zc-entry-label",p.copy(u),p.o.text=Z,p.append(g.o),null!==ZC._n_(g.o.label)&&p.append(g.o.label),p.Z=u.A.CQ("fl",0),p.parse(),B.AW?p.iX=r+2:p.iX=r-p.I-2,p.iY=o-p.F/2,p.paint(),p.EM()))}for(n=0,e=u.A.VI.length;n<e;n++){var K=u.A.VI[n];K&&null!==ZC._n_(K.o.values)&&null!==ZC._n_(K.o.values[u.L])&&(null===ZC._n_(K.o.width)&&null===ZC._n_(K.o.height)||((l=new ZC.HQ(u.A)).append(K.o),l.parse()),a=0,t=0,null!==ZC._n_(K.o.width)&&(a=l.I),null!==ZC._n_(K.o.height)&&(t=l.F),0===a&&(a=ZC.BQ(20,B.AB/10)),0===t&&(t=ZC.BQ(16,h.AB/10)),(C=new ZC.DQ(u.A)).K=u.K+"-arrow-exit",C.copy(u),C.append(K.o),C.parse(),i=[],1===u.A.VI.length?o=u.iY+h.AB/2:(s=h.AB/(u.A.VI.length+1),o=u.iY+s+n*s),B.AW?(r=u.iX+c+b/2-(v+Y)/4+f/2-2,i.push([r,o-2*t/6],[r-2*a/3,o-t/6],[r-2*a/3,o-3*t/6],[r-a,o],[r-2*a/3,o+3*t/6],[r-2*a/3,o+t/6],[r,o+2*t/6],[r,o-2*t/6])):(r=u.iX+B.AB-c-b/2+(v+Y)/4-f/2+2,i.push([r,o-2*t/6],[r+2*a/3,o-t/6],[r+2*a/3,o-3*t/6],[r+a,o],[r+2*a/3,o+3*t/6],[r+2*a/3,o+t/6],[r,o+2*t/6],[r,o-2*t/6])),C.D=i,C.parse(),C.Z=u.A.CQ("bl",1),C.C7=u.A.CQ("bl",0),C.paint(),null!==ZC._n_(K.o.labels)&&null!==ZC._n_(K.o.labels[u.L])&&""!==K.o.labels[u.L]&&(Z=K.o.labels[u.L],(p=new ZC.DN(u.A)).K=u.K+"-exit-label-"+n,p.GL=u.K+"-exit-label "+u.A.K+"-exit-label zc-exit-label",p.copy(u),p.o.text=Z,p.append(K.o),null!==ZC._n_(K.o.label)&&p.append(K.o.label),p.parse(),p.Z=u.A.CQ("fl",0),B.AW?p.iX=r-a-p.I-2:p.iX=r+a+2,p.iY=o-p.F/2,p.paint(),p.EM()))}u.A.U&&u.GY()},AC7:function(A){var n,e=this,i=e.A.B0,l=e.A.CN;null!==ZC._n_(A.o.placement)&&(n=A.o.placement);var a=e.iX+i.AB/2-A.I/2,t=e.iY+l.AB/2-A.F/2,C=e.E["entry-exit"],r=(C[0]+C[1])/2;switch(n){case"in":case"auto":break;case"top":t=e.iY+5;break;case"bottom":t=e.iY+l.AB-A.F-5;break;case"left":a=e.iX+i.AB/2-r/2+5;break;case"left-out":a=e.iX+i.AB/2-r/2-A.I-5;break;case"right":a=e.iX+i.AB/2+r/2-A.I-5;break;case"right-out":a=e.iX+i.AB/2+r/2+5}return null!==ZC._n_(A.o.x)&&(a=A.iX),null!==ZC._n_(A.o.y)&&(t=A.iY),[ZC._i_(a),ZC._i_(t)]},A12:function(){var A=this;if(!ZC.move&&A.A.IH&&A.A.AN){A.b();var n=new ZC.DQ(A.A);n.K=A.K+"-trapeze-hover",n.Z=ZC.AL(A.C.K+"-hover-c"),n.D=A.E.points,n.parse(),n.B7=A.A.BP[1],n.BX=A.A.BP[1],n.A0=A.A.BP[2],n.AE=A.A.BP[3],n.append(A.A.IH.o),n.parse(),n.J5=function(n){return A.J5(n)},n.DF()&&n.parse(),n.AN&&n.paint()}}});