-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathzingchart-vbar.min.js
8 lines (7 loc) · 11.7 KB
/
zingchart-vbar.min.js
1
2
3
4
5
6
7
8
/*
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 [email protected].
Build 2.9.16
*/
ZC.WJ.push("vbar"),ZC.A2M=ZC.NM.CD({$i:function(A){this.b(A);var i=this;i.AF="vbar",i.AY=new ZC.A0L(i),i.AJ["enable-guide"]=!0,i.AJ["enable-preview"]=!0,i.AJ["enable-scroll"]=!0},MT:function(A,i){switch(A){case"x":var e=this.b(A,i);return e.DF=!0,e;case"y":return this.b(A,i)}}}),ZC.A0L=ZC.LQ.CD({ACU:function(){return new ZC.R1(this)}}),ZC.A2A=ZC.W8.CD({$i:function(A){this.b(A);var i=this;i.AF="bar",i.sMetaType="bar",i.F5=.1,i.D5=0,i.bKeyWidth=!1,i.YW=-1,i.CH=.1,i.CU=.1,i.F0=0,i.TU=!1,i.LZ=[],i.P8="bg",i.A3N=!0,i.N7=!1},parse:function(){var A=this;if(A.BP=A.O6(),A.C2=A.BP[0],A.B9=A.BP[1],A.BX=A.BP[1],A.A0=A.BP[1],A.AE=A.BP[2],A.NS(),A.b(),"histogram"===A.CW&&(A.F5=A.CH=A.CU=0),A.assign_a([["group-bars","A3N","b"],["show-zero","TU","b"],["offset-values","LZ"],["bar-space","F5","fp"],["bar-width","D5","fp"],["key-width","bKeyWidth","b"],["bar-max-width","YW","fp"],["bars-space-left","CH","fp"],["bars-space-right","CU","fp"],["bars-overlap","F0","fp"],["smart-sampling","N7","b"]]),A.A3N||(A.F0=1),0===A.F5&&0===A.CH&&0===A.CU&&(A.FF=!1),A.AZ=A.C.BM(A.BW("k")[0]),A.CQ=A.C.BM(A.BW("v")[0]),null!==ZC._n_(A.o.column)){var i=A.o.column.split("/");if(2===i.length){var e=ZC._i_(i[0]),C=ZC._i_(i[1]),t=A.CH;A.CH>=1&&(t=A.CH/A.AZ.AA);var a=A.CU;A.CU>=1&&(a=A.CU/A.AZ.AA);var n=1-t-a,r=ZC._x_(n/(3*C+1));A.CH=t+r+3*(e-1)*r,A.CU=1-A.CH-2*r}}},SV:function(){var A,i=this;if(i.RU)return i.RU;if(i.o["fast-dimensions"]&&i.A.A3[0].RU)return i.A.A3[0].RU;i.bKeyWidth&&(i.assign_a([["bar-width","D5","fp"]]),i.D5=((i.AZ.CM?i.AZ.F:i.AZ.I)-i.AZ.A9-i.AZ.BU)*(i.D5/(i.AZ.BF-i.AZ.B0)));var e,C=i.AZ.AA*i.Y,t=0;for(i.A.K7[i.AF]=i.A.K7[i.AF]||[],A=0;A<i.A.K7[i.AF].length;A++){var a=i.A.K7[i.AF][A][0];i.A.A3[a].BO[0]===i.BO[0]&&t++}if(i.LT)for(t=0,A=0;A<i.A.A3.length;A++)"bar"===i.A.A3[A].sMetaType&&(t=ZC.BR(t,i.A.A3[A].R.length));if(null===ZC._n_(i.AZ.EV)&&(i.AZ.EV=0,i.AZ.WU={}),i.CG&&null!==ZC._n_(i.AZ.WU["stack-"+i.DZ]))e=i.AZ.WU["stack-"+i.DZ];else{for(e=i.AZ.EV,A=0;A<i.L;A++)if((i.A.A3[A].AP||"hide"===i.C.getToggleAction())&&i.BO[0]===i.A.A3[A].BO[0]&&i.A.A3[A].AF===i.AF&&(!i.CG||i.A.A3[A].DZ!==i.DZ)&&!i.A.A3[A].HT){e++;break}i.AZ.EV=e,i.AZ.WU["stack-"+i.DZ]=e}for(var n=!0,r=0,Z=[],o=0;o<i.A.A3.length;o++)i.A.A3[o].D5<=1?n=!1:null!==ZC._n_(i.A.A3[o].D5)&&(i.A.A3[o].CG&&-1!==ZC.AV(Z,i.A.A3[o].DZ)||(Z.push(i.A.A3[o].DZ),r+=i.A.A3[o].D5));var s=i.CH;s<=1&&(s*=C);var l,h=i.CU;h<=1&&(h*=C),s=ZC._i_(s),h=ZC._i_(h);var F,p,_,u,f=i.F0;return n?(l=r,0===i.F0||t<=1?((F=i.F5)<=1&&(F*=l/t),h=(_=C-l-(F=ZC.BR(0,F))*(t-1))-(s=_*(u=0===h?1:s/h)/(1+u)),s<1&&(s=h=0,F=C-l,t>1&&(F/=t-1),F<0&&(l=C-s-h-(F=0)*(t-1))),p=(l=ZC.BR(l,1*t))/t):t>1&&(F=0,p=l/t,f<=1&&(f*=p),h=(_=C-(l=t*(p-(f=ZC.CY(f,p)))+f)-F*(t-1))-(s=_*(u=0===h?1:s/h)/(1+u)),s<1&&(l-=1-s))):(l=C-s-h,0===i.F0||t<=1?((F=i.F5)<=1&&(F*=l/t),h=(_=C-l-(F=ZC.BR(0,F))*(t-1))-(s=_*(u=0===h?1:s/h)/(1+u)),s<1&&(s=h=0,F=C-l,t>1&&(F/=t-1),F<0&&(l=C-s-h-(F=0)*(t-1))),p=(l=ZC.BR(l,1*t))/t):t>1&&(F=0,p=l/t,f>1&&(f=p/f),f*=p=l/(t-t*f+f),h=(_=C-l-F*(t-1))-(s=_*(u=0===h?1:s/h)/(1+u)),s<1&&(l-=1-s))),-1!==i.YW&&p>i.YW&&!i.E.bw&&(i.D5=i.YW),i.RU={AA:C,EV:e,CH:s,CU:h,F5:F,D5:p,F0:f},{AA:C,EV:e,CH:s,CU:h,F5:F,D5:p,F0:f}},paint:function(){var A=this;A.b(),A.KH=A.CS("bl",0);var i=A.FF;A.A2L=!1,A.SH=null;var e=1;A.AZ.EI&&(e=A.R.length/(A.AZ.DQ-A.AZ.D4)),0!==A.E6.length||A.I0||A.C.KL||"svg"!==A.G.AC||!(A.AZ.A1-A.AZ.W>2048||A.AZ.EI&&e*(A.AZ.A1-A.AZ.W)>2048)||(A.A2L=!0,null===ZC._n_(A.o["rect-shortcut"])&&(A.FF=!0)),A.FF||(A.A2L=!1),A.PI(),A.FF=i,A.RefNode=null,A.W2=null}}),ZC.R1=ZC.A2A.CD({$i:function(A){this.b(A),this.AF="vbar"},U3:function(){return new ZC.ZL(this)}}),ZC.ZL=ZC.LM.CD({setup:function(){this.R4()},V7:function(){var A=this;A.paint(!0);var i=A.C.BM(A.A.BW("v")[0]);return[A.iX+A.I/2,A.iY+(i.AX?A.F:0),{reference:A,center:!0}]},AC6:function(A){var i=this,e="top-out",C=i.C.BM(i.A.BW("v")[0]),t=i.AD>=C.HC&&!C.AX||i.AD<C.HC&&C.AX?1:-1;A=i.setupValueBoxWH(A),null!==ZC._n_(A.o.placement)&&(e=A.o.placement);var a=A.I,n=A.F,r=i.iX+i.I/2-a/2,Z=i.iYVal-n/2,o=A.AB%180==90,s=o?a/2:n/2,l=o?a/2-n/2:0;switch(e){case"top-out":case"top":Z-=t*(s+5);break;case"top-in":Z+=t*(s+5);break;case"middle":Z+=t*(i.F/2);break;case"bottom-in":Z+=t*(i.F-s-5);break;case"bottom-out":case"bottom":Z+=t*(i.F+n/2+5)}if(null!==ZC._n_(A.o.x)||null!==ZC._n_(A.o.y))null!==ZC._n_(A.o.x)&&(r=A.iX),null!==ZC._n_(A.o.y)&&(Z=A.iY);else{var h=ZC._c_(i.A.o.tolerance,5);if(!ZC.AQ._boxoverlap2_(i,i.C.N,h))return[-1,-1]}var F=A.o.tolerance||[i.C.N.EB,i.C.N.EA,i.C.N.DW,i.C.N.E0];return i.C.AJ["3d"]||(r=ZC.BR(i.C.N.iX+0-F[3],r),r=ZC.CY(i.C.N.iX+i.C.N.I-a-0+F[1],r),Z-l<i.C.N.iY+5-F[0]&&(Z=i.C.N.iY+5-F[0]+l),Z+l>i.C.N.iY+i.C.N.F-n-5+F[2]&&(Z=i.C.N.iY+i.C.N.F-n-5+F[2]-l)),[ZC._i_(r),ZC._i_(Z)]},getPMap:function(){var A=this.b();return this.addPMap(A,"barWidth","I"),A},paint:function(A){var i,e=this;if(e.b(),!e.C.AJ["3d"]){void 0===A&&(A=!1);var C=e.A.AZ,t=e.A.CQ;e.setup();var a,n,r,Z,o,s=t.HC,l=t.AR(s),h=e.A.SV(),F=h.AA,p=h.EV,_=h.CH,u=h.CU,f=h.F5,c=h.D5,v=h.F0;if(A?p=e.A.E["node-"+e.L+"-bar-index"]:e.A.E["node-"+e.L+"-bar-index"]=h.EV,e.A.CG){a=0;for(var d=e.A.A.KG[p],D=0;D<d.length;D++){var Y=e.A.A.A3[d[D]].R[e.L];Y&&(a+=Y.AD)}}var I=1,b=1;if(e.A.CG&&(e.CR!==e.AD&&(I=(a-e.CR+e.AD)/a),b=(a-e.CR)/a),t.AX){var N=I;I=b,b=N}e.A.LT&&(p=e.L);var X=e.iX-F/2+_+p*(c+f)-p*v;if(X=ZC._l_(X,e.iX-F/2+_,e.iX+F/2-u),e.A.D5>0){var L=c;(c=e.A.D5)<=1&&(c*=L),X+=(L-c)/2}var E=c,R=e.iY,g=null!==ZC._n_(e.A.LZ[e.L])?e.A.LZ[e.L]:0;if(R=e.A.CG&&"100%"===e.A.KT?t.AR(100*(e.CR+g)/e.A.A.F9[e.L]["%total-"+e.A.DZ]):t.AR(e.CR+g),e.A.CG){n="100%"===e.A.KT?t.AR(100*(e.CR-e.AD+g)/e.A.A.F9[e.L]["%total-"+e.A.DZ]):t.AR(e.CR-e.AD+g),R=ZC._i_(R),n=ZC._i_(n);var B=!t.AX&&e.AD>=0||t.AX&&e.AD<=0?-1:1,H=0,U=0;""!==e.A.Q2?(H=e.WY(e.A.Q2)[0],U=0):H=e.A.AU,""!==e.A.NR?(U=e.WY(e.A.NR)[0],H=0):U=e.A.AU,H!==U&&(B=0),r=R-n+B*H,e.AD<0&&(R=n),t.AX?r>0&&(r=ZC._a_(r),R=n):r<0&&(r=ZC._a_(r),R=n-r),t.AX&&e.AD<0&&(r+=U)}else n=t.AR(g),(r=R-n)<0?(r=ZC._a_(r),R=n-r):R=n;if(e.A.TU&&e.A.CG&&e.A.L>0&&e.A.A.A3[e.A.L-1].R[e.L]&&0===e.A.A.A3[e.A.L-1].R[e.L].AD&&(r-=1,R+=t.AX?1:-1),r<2&&(e.AD>0||e.A.TU)&&(r=1,t.AX?e.A.CG&&(e.A.L>0&&(R-=1),(0===e.A.L||e.AD>0&&e.AD===e.CR)&&(R+=1)):e.A.CG?(0===e.A.L||e.AD>0&&e.AD===e.CR)&&(R-=2):R=g?n-1:l-2),e.I=E,e.F=r,e.iX=X,e.iY=R,t.AX?e.AD>=t.HC?e.iYVal=R+e.F:e.iYVal=R:e.AD>=t.HC?e.iYVal=R:e.iYVal=R+e.F,e.setNodeData({x:X,y:R,w:E,h:r,ax:X+E/2,ay:e.iYVal,fx:0,fy:e.iYVal>R?.75:-.75}),e.C.CX){var W="middle";e.C.CX.o.marker&&null!==ZC._n_(i=e.C.CX.o.marker.alignment)&&(W=i),null!==ZC._n_(e.A.o["guide-marker"])&&null!==ZC._n_(i=e.A.o["guide-marker"].alignment)&&(W=i),"node"===W&&(e.E.A5O=e.iX+e.I/2)}if(!A){var G,y=!0;if("none"!==e.A.J4||e.C.IY[e.A.L]||e.C.KL||e.A.T5&&e.A.T5[e.L]?(G=e.P=e.A.IJ(e,e.P),y=!1):G=e.P,(0!==e.A.E6.length||e.A.I0||e.P.o.override||e.C.KL)&&(y=!1),e.AP){var m;switch(e.A.CW){default:0!==e.A.E6.length||e.A.I0||"undefined"==typeof e.A.TS||e.P.o.override||e.C.KL?(m=new ZC.HU(e.A)).copy(G):m=e.A.TS,e.A.I0&&(e.H8(m),m.parse()),m.FF=e.A.FF,m.K=e.K,m.iX=X,m.iY=R,m.I=e.I,m.F=e.F,C.AA<5&&m.I<5?(m.I=ZC.BR(1,m.I)+1,m.N3=!1,m.D0=!1):m.N3=!0,m.I<5&&C.A1!==C.W&&e.C.N.I/(C.A1-C.W)<1&&(m.QX=!0);break;case"pyramid":case"cone":0!==e.A.E6.length||e.A.I0||"undefined"==typeof e.A.TS||e.P.o.override||e.C.KL?(m=new ZC.DT(e.A)).copy(G):m=e.A.TS,e.A.I0&&(e.H8(m),m.parse()),m.K=e.K,t.AX&&!e.A.CG?(o=e.AD>=0?0:e.F,Z=e.AD>=0?e.F:0):(o=e.AD>=0?e.F:0,Z=e.AD>=0?0:e.F),m.D=[],m.D.push([X+e.I/2-I*e.I/2,R+o],[X+e.I/2+I*e.I/2,R+o]),e.A.CG&&0!==b?m.D.push([X+e.I/2+b*e.I/2,R+Z],[X+e.I/2-b*e.I/2,R+Z]):m.D.push([X+e.I/2,R+Z]),m.D.push([m.D[0][0],m.D[0][1]]),e.setNodeData({points:m.D}),m.iX=X,m.iY=R,m.locate(2)}m.Z=e.A.CS("bl",1),m.C8=e.A.CS("bl",0),e.paintPreview(G,y);var K=e.C.K+"-node-area "+e.C.K+"-plotset-plot-"+e.A.L+"-node-area zc-node-area";m.DG=K;var w=ZC._c_(e.A.o.tolerance,5),P=function(){if("undefined"!=typeof e.paint_&&e.paint_(),e.NA(ZC.Q.EE(m.Z,e.G.AC)),ZC.AQ._boxoverlap2_(e,e.C.N,w)&&e.A.FW&&-1===ZC.AV(e.G.KQ,"skip_segment_tracking")){var A=E<5?.5:-.5,i=r<3?.5:-.5,C=Math.max(e.C.N.iX,Math.min(e.C.N.iX+e.C.N.I,ZC._i_(X+e.A.BK+ZC.MAPTX-A))),t=Math.max(e.C.N.iY,Math.min(e.C.N.iY+e.C.N.F,ZC._i_(R+e.A.BJ+ZC.MAPTX-i))),a=Math.max(e.C.N.iX,Math.min(e.C.N.iX+e.C.N.I,ZC._i_(X+e.A.BK+E+ZC.MAPTX+A))),n=Math.max(e.C.N.iY,Math.min(e.C.N.iY+e.C.N.F,ZC._i_(R+e.A.BJ+r+ZC.MAPTX+i))),Z=ZC.Q.FO("rect",e.A.E9,m.IE)+'class="'+K+'" '+e.a11y()+' id="'+e.K+'" coords="'+C+","+t+","+a+","+n+'" />';e.A.A.H3.push(Z)}e.A.U&&e.A.U.AP&&e.H1()};if(e.A.GG&&!e.C.HM){var M=m,S={};M.iX=X,M.iY=R,M.I=E,M.F=r,S.x=X,S.y=R,S.width=E,S.height=r;var T,x=e.A.LE,V=e.C.N;for(T in M.C6=0,S.alpha=G.C6,2===x?(M.iY=V.iY+V.F/2,M.F=1,S.height=e.F,S.y=R):3===x?(M.iY=V.iY,M.F=1,S.height=e.F,S.y=R):4===x?(M.iY=V.iY+V.F,M.F=1,S.height=e.F,S.y=R):5===x?(M.iX=V.iX,M.I=1,S.width=e.I,S.x=X):6===x?(M.iX=V.iX+V.I,M.I=1,S.width=e.I,S.x=X):7===x?(M.iX=V.iX+V.I/2,M.I=1,S.width=e.I,S.x=X):8===x?(M.iX=X-V.I,S.x=X):9===x?(M.iX=X+V.I,S.x=X):10===x?(M.iY=R-V.F,S.y=R):11===x?(M.iY=R+V.F,S.y=R):12===x?(M.I=1,S.width=e.I):13===x&&(M.F=1,S.height=e.F),e.A.FY)M[ZC.E8.GO[ZC.EH(T)]]=e.A.FY[T],S[ZC.EH(T)]=G[ZC.E8.GO[ZC.EH(T)]];if(null===ZC._n_(e.C.ER)&&(e.C.ER={}),null!==ZC._n_(e.C.ER[e.A.L+"-"+e.L]))for(T in e.C.ER[e.A.L+"-"+e.L])M[ZC.E8.GO[ZC.EH(T)]]=e.C.ER[e.A.L+"-"+e.L][T];if(e.C.ER[e.A.L+"-"+e.L]={},ZC._cp_(S,e.C.ER[e.A.L+"-"+e.L]),ZC.AQ._boxoverlap2_(e,e.C.N,w)){var k=new ZC.E8(M,S,e.A.JG,e.A.LC,ZC.E8.RQ[e.A.LF],function(){P()});k.AW=e,k.OH=function(){e.NA(ZC.Q.EE(m.Z,e.G.AC))},e.LU(k)}}else{if(m.AP||0===e.A.E6.length&&!e.A.I0)if(e.A.W2||(e.A.W2={iX:m.iX,iY:m.iY,F:m.F}),e.A.A2L)if(e.A.SH)if(e.A.SH.el&&"RECT"===e.A.SH.el.tagName.toUpperCase()){var Q=!1;if(e.A.N7&&e.A.W2&&ZC._a_(m.iX-e.A.W2.iX)<.75&&ZC._a_(m.iY-e.A.W2.iY)<1.5&&ZC._a_(m.F-e.A.W2.F)<1.5&&(Q=!0),!Q){e.A.W2={iX:m.iX,iY:m.iY,F:m.F};var J=e.A.SH.el.cloneNode(!1);J.setAttribute("id",e.K),J.setAttribute("x",e.iX),J.setAttribute("y",e.iY),J.setAttribute("height",e.F),e.A.SH.df?e.G.G4[m.Z.id].appendChild(J):e.A.SH.el.parentNode.appendChild(J)}}else m.paint();else m.paint(),e.A.SH={id:m.K+"-path"},zingchart.DEV.DOMFRAGMENTS&&document.querySelector&&e.G.G4&&e.G.G4[m.Z.id]?(e.A.SH.df=!0,e.A.SH.el=e.G.G4[m.Z.id].querySelector("#"+m.K+"-path")):(e.A.SH.df=!1,e.A.SH.el=ZC.AM(e.A.SH.id));else ZC.AQ._boxoverlap2_(e,e.C.N,w)&&m.paint();m.AP&&P()}"svg"===e.G.AC&&e.A.applyJsRuleSvg(e.A,e.K+"-path",e.M2()),0!==e.A.E6.length||e.A.I0||"undefined"!=typeof e.A.TS||e.P.o.override||e.C.KL||e.A.GG||(e.A.TS=m)}}}},paintPreview:function(A,i){var e,C,t=this;if(t.C.B7&&t.C.B7.I3&&t.A.QV){var a=t.C.N,n=t.C.B7,r=n.AT,Z=(t.iX-a.iX)/a.I,o=(t.iY-a.iY)/a.F;t.A.VZ?e=t.A.VZ:(e=new ZC.HU(t.A),t.A.VZ=e,e.copy(A),(C=t.A.o["preview-state"])&&(e.append(C),e.parse())),i||(e.copy(A),(C=t.A.o["preview-state"])&&(e.append(C),e.parse())),e.K=t.K+"-preview",e.DG=t.A.K+"-preview",e.iX=r.iX+r.AU+Z*(r.I-2*r.AU),e.iY=r.iY+r.AU+o*(r.F-2*r.AU),e.I=t.I/a.I*(r.I-2*r.AU),e.F=t.F/a.F*(r.F-2*r.AU),r.I/t.A.R.length<10?(e.I=e.I+.5,e.N3=!1,e.D0=!1):(e.N3=!0,e.D0=!0),e.Z=e.C8=n.Z,e.paint()}},A15:function(A){var i=this;if(A=A||"hover",!ZC.move){var e="";switch(i.A.CW){default:e="box";break;case"pyramid":e="shape"}i.MC({layer:A,type:e,initcb:function(){this.A0=i.A.BP[3],this.B9=i.A.BP[1],this.BX=i.A.BP[1],this.AE=i.A.BP[2]},setupcb:function(){switch(i.A.CW){default:this.iX=i.getNodeData("x"),this.iY=i.getNodeData("y"),this.I=i.getNodeData("w"),this.F=i.getNodeData("h");var A=i.C.N;this.iY<A.iY&&(this.F=this.F-(A.iY-this.iY),this.iY=A.iY),this.iY+this.F>A.iY+A.F&&(this.F=A.iY+A.F-this.iY);break;case"pyramid":case"cone":this.D=i.getNodeData("points")}}}),i.NA(ZC.Q.EE(i.C.K+"-hover-c",i.G.AC),!0),i.A.RU=null}}});