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) 6.37 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.11 */ ZC.WG.push("nestedpie"),ZC.A6N=ZC.JL.CC({$i:function(n){this.b(n);var i=this;i.AF="nestedpie",i.AZ=new ZC.A58(i)},A2P:function(n){return n},MS:function(n){switch(n){case"m":return new ZC.T5(this)}},ACO:function(){var n=this,i=n.MS("m","scale");i.BF="scale",i.K=n.K+"-scale",n.BO.push(i),n.b()}}),ZC.A58=ZC.LN.CC({$i:function(n){this.b(n);this.KO=[],this.P6=[]},ACU:function(){return new ZC.TX(this)},parse:function(){var n=this;n.KO=[],n.P6=[],n.b();for(var i,t=n.A.BM("scale"),C=t.iX+t.I/2,e=1,a=0,A=n.A3.length;a<A;a++)if(n.C.E["plot"+a+".visible"]||"hide"===n.C.getToggleAction())for(var l=0,s=n.A3[a].R.length;l<s;l++)if(n.A3[a].R[l]){var o=n.A3[a].R[l];null===ZC._n_(n.P6[l])&&(n.P6[l]=n.A3[a].DJ);var r=n.P6[l],B=r+360*o.AD/n.KO[l];n.P6[l]=B,o.B4=r,o.BL=B;var c=o.GY(!0);if(c&&"in"!==c.o.placement){var Z=ZC._i_((r+B)/2);i=((Z>=0&&Z<=90||Z>=270&&Z<=360?t.iX+t.I-(c.I+25):t.iX+(c.I+25))-C)/ZC.EI(Z),e=ZC.CY(e,2*i/t.I),i=t.F/2-(c.F/2+10),e=ZC.CY(e,2*i/t.F)}}e=ZC.BQ(.15,ZC.CY(.85,e)),"auto"===t.o["size-factor"]&&(t.o["size-factor"]=t.JF=e)}}),ZC.TX=ZC.HY.CC({$i:function(n){this.b(n);var i=this;i.AF="nestedpie",i.BO=["scale"],i.U2=0,i.SK=0,i.DJ=0,i.C3=null,i.P3="bg",i.aBandWidths=null},TY:function(){return new ZC.A49(this)},parse:function(){var n,i,t=this;t.BP=t.O1(),t.C2=t.BP[0],t.A0=t.BP[1],t.AE=t.BP[2],t.BX=t.BP[0],t.B7=t.BP[0],t.NQ(),t.b(),t.U&&(t.C3=new ZC.CZ(t),t.C.A.B8.load(t.C3.o,["graph.plot.value-box.connector",t.AF+".plot.value-box.connector"]),null!==ZC._n_(n=t.C.o.plot)&&null!==ZC._n_(n["value-box"])&&null!==ZC._n_(i=n["value-box"].connector)&&t.C3.append(i),t.C3.append(t.o["value-box"].connector)),t.assign_a([["slice-start","U2","fp"],["offset","U2","fp"],["slice","U2","fp"],["band-space","SK","fp"],["ref-angle","DJ","i"],["band-widths","aBandWidths"]]),t.DJ%=360;for(var C=0,e=t.R.length;C<e;C++)t.R[C]&&(t.C.E["plot"+t.L+".visible"]||"hide"===t.C.getToggleAction())&&(null===ZC._n_(t.A.KO[C])&&(t.A.KO[C]=0),t.A.KO[C]+=ZC._f_(t.R[C].AD))},paint:function(){var n=this;n.b(),n.KF=n.CQ("bl",0),n.PD(!0)}}),ZC.A49=ZC.LI.CC({bCXY:!0,$i:function(n){this.b(n)},setup:function(){var n=this,i=n.C.BM(n.A.BW("k")[0]);n.iX=i.iX+i.I/2+i.BK,n.iY=i.iY+i.F/2+i.BI,n.HZ||(n.copy(n.A),n.o.slice=null,n.E7=n.A.E7,n.DF()&&n.parse(!1),n.HZ=!0)},ACA:function(){var n=this,i=(n.B4+n.BL)/2%360,t=ZC.AO.BN(n.iX,n.iY,n.CO+n.E.bandwidth/2+n.DW,i);return[t[0],t[1]]},JX:function(n,i,t,C){var e=this,a=e.A.MT();ZC._cp_(i,a);var A=100*e.AD/e.A.A.KO[e.L],l=""+A;return null!==ZC._n_(a.decimals)&&(l=A.toFixed(ZC.BQ(0,ZC._i_(a.decimals)))),e.CV=[["%node-percent-value",l],["%npv",l]],n=e.b(n,i,t,C)},ABF:function(n){var i={},t="in";return null!==ZC._n_(n.o.placement)&&(t=n.o.placement),i.color="out"===t?this.A0:this.C2,i},AC7:function(n){var i=this,t="in";null!==ZC._n_(n.o.placement)&&(t=n.o.placement);var C,e,a,A=n.I,l=n.F,s=(i.B4+i.BL)/2%360;return"out"===t?i.L===i.A.R.length-1?(a=ZC.AO.BN(i.iX,i.iY,i.A.U2+i.A.R.length*(i.E.bandwidth+i.E.bandspace)+15+n.DW,s),C=s>=0&&s<90||s>=270&&s<360?a[0]+10+i.BK:a[0]-A-10+i.BK,e=a[1]-l/2+i.BI):(C=-1,e=-1):(C=(a=ZC.AO.BN(i.iX,i.iY,i.CO+i.E.bandwidth/2+n.DW,s))[0]-A/2+i.BK,e=a[1]-l/2+i.BI),null!==ZC._n_(n.o.x)&&(C=n.iX),null!==ZC._n_(n.o.y)&&(e=n.iY),[ZC._i_(C),ZC._i_(e),s]},GY:function(n){var i=this,t=i.b(n);if(n)return t;if(t.AN&&null!==ZC._n_(t.AM)&&""!==t.AM){var C="in";if(null!==ZC._n_(t.o.placement)&&(C=t.o.placement),"out"===C&&i.L===i.A.R.length-1){var e=new ZC.DQ(i.A);e.Z=e.C7=i.H.usc()?i.H.mc("top"):i.C.AJ["3d"]||i.H.K9?ZC.AL(i.C.K+"-plots-vb-c"):ZC.AL(i.C.K+"-plot-"+i.A.L+"-vb-c"),e.append(i.A.C3.o),e.B7=i.A0,e.DV="line",e.D=[];var a=(i.B4+i.BL)/2%360,A=ZC.AO.BN(i.iX,i.iY,i.CO+i.E.bandwidth+t.DW,a),l=ZC.AO.BN(i.iX,i.iY,i.A.U2+i.A.R.length*(i.E.bandwidth+i.E.bandspace)+15+t.DW,a);A[0]+=i.BK,l[0]+=i.BK,A[1]+=i.BI,l[1]+=i.BI,e.D.push(A),a>=0&&a<90||a>=270&&a<360?e.D.push([l[0],l[1],l[0]+10,l[1]]):e.D.push([l[0],l[1],l[0]-10,l[1]]),e.parse(),e.J5=function(n){return i.J5(n)},e.DF()&&e.parse(),e.AN&&e.paint()}}},paint:function(){var n,i=this;i.b();var t=i.C.BM(i.A.BW("k")[0]);i.setup(),i.AI=ZC.CY(t.I,t.F)/2,i.AI=t.JF*i.AI,i.CO=i.A.U2,i.CO<1&&(i.CO=i.A.U2*i.AI);var C=i.A.SK;C<1&&(C=i.A.SK*i.AI);var e=2,a=i.AI-i.CO;if(null!==ZC._n_(i.A.aBandWidths)&&null!==ZC._n_(i.A.aBandWidths[i.L])){(e=ZC._f_(i.A.aBandWidths[i.L]))>1&&(e/=100),e=ZC._i_(a*e),e=ZC.BQ(e,2);for(var A=0,l=0;l<i.L;l++)A+=ZC._f_(i.A.aBandWidths[l]);A>1&&(A/=100),A=ZC._i_(a*A),i.CO+=A,i.AI=i.CO+e}else e=(a-(i.A.R.length-1)*C)/i.A.R.length,e=ZC.BQ(e,2),i.CO+=i.L*(e+C),i.AI=i.CO+e;var s=i.O=i.A.IG(i,i);i.H4(s);var o=new ZC.DQ(i.A);o.K=i.K,o.Z=i.A.CQ("bl",1),o.C7=i.A.CQ("bl",0),o.copy(s),o.iX=i.iX,o.iY=i.iY,o.DV="pie",o.B4=i.B4,o.BL=i.BL,o.CO=i.CO,o.AI=i.AI,o.parse();var r=o.CO;function B(){var n=o.FG(),t=i.C.K+"-node-area "+i.C.K+"-plotset-plot-"+i.A.L+"-node-area zc-node-area",C=ZC.Q.FS("poly",i.A.EA,i.A.IK)+'class="'+t+'" '+i.a11y()+' id="'+i.K+'" coords="'+n+'" />';i.A.A.HD.push(C),i.A.U&&i.A.U.AN&&i.GY()}if(i.E.bandwidth=e,i.E.bandspace=C,i.A.GE&&!i.C.HI){var c=o,Z={};c.B4=i.B4,c.BL=i.BL,Z.angleStart=i.B4,Z.angleEnd=i.BL;var u=i.A.LA;if(c.C5=0,Z.alpha=s.C5,2===u)c.BL=i.B4,Z.angleEnd=i.BL;else if(3===u)c.CO=r+i.E.bandwidth,Z.slice=r;else if(4===u){var h=ZC.AO.BN(i.iX,i.iY,i.AI,(i.B4+i.BL)/2);c.iX=h[0],c.iY=h[1],Z.x=i.iX,Z.y=i.iY}else 5===u&&(c.B4=c.BL=(i.B4+i.BL)/2,Z.angleStart=i.B4,Z.angleEnd=i.BL);for(n in i.A.FY)c[ZC.E6.GM[ZC.EF(n)]]=i.A.FY[n],Z[ZC.EF(n)]=s[ZC.E6.GM[ZC.EF(n)]];if(i.C.EO||(i.C.EO={}),null!==ZC._n_(i.C.EO[i.A.L+"-"+i.L]))for(n in i.C.EO[i.A.L+"-"+i.L])c[ZC.E6.GM[ZC.EF(n)]]=i.C.EO[i.A.L+"-"+i.L][n];i.C.EO[i.A.L+"-"+i.L]={},ZC._cp_(Z,i.C.EO[i.A.L+"-"+i.L]);var p=new ZC.E6(c,Z,i.A.JG,i.A.L8,ZC.E6.RL[i.A.LB],function(){B()});p.AX=i,i.LS(p)}else o.paint(),B()},A12:function(n){var i=this;ZC.move||i.M8({layer:n,type:"shape",initcb:function(){this.copy(i),this.iX=i.iX,this.iY=i.iY,this.DV="pie",this.A0=i.A.BP[3],this.AE=i.A.BP[2],this.B4=i.B4,this.BL=i.BL,this.CO=i.CO,this.AI=i.AI},parsecb:function(){this.o.slice=null}})}});