-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathzingchart-gauge.min.js
8 lines (7 loc) · 11.7 KB
/
zingchart-gauge.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-hf1
*/
ZC.WJ.push("gauge"),ZC.A9V=ZC.JM.CD({$i:function(e){this.b(e);var a=this;a.AF="gauge",a.AJ.layout="gauge",a.AY=new ZC.A85(a)},A2P:function(e){return e},MT:function(e){var a=this;switch(e){case"m":return new ZC.TC(a);case"r":return new ZC.A86(a);case"v":return new ZC.WA(a)}},ACN:function(){var e,a=this,i=a.MT("m","scale");for(i.BD="scale",i.K=a.K+"-scale",a.BO.push(i),e=2;e<10;e++)if(null!==ZC._n_(a.o["scale-"+e])){var n=a.MT("m","scale-"+e);n.L=e,n.BD="scale-"+e,n.K=a.K+"-scale-"+e,a.BO.push(n)}var t=a.MT("r","scale-r");for(t.BD="scale-r",t.K=a.K+"-scale-r",a.BO.push(t),e=2;e<10;e++)if(null!==ZC._n_(a.o["scale-r-"+e])){var r=a.MT("r","scale-r-"+e);r.L=e,r.BD="scale-r-"+e,r.K=a.K+"-scale-r-"+e,a.BO.push(r)}a.b()},hideLayer_:function(){var e=this;ZC.A4("#"+e.K+"-plots-bl-2").children().each(function(){ZC.Q.IW(this,e.G.AC,e.iX,e.iY,e.I,e.F,e.K)})}}),ZC.A85=ZC.LQ.CD({ACU:function(){return new ZC.XJ(this)}}),ZC.XJ=ZC.I2.CD({$i:function(e){this.b(e);var a=this;a.AF="gauge",a.SX=3,a.BO=["scale-r","scale-v","scale"],a.HS=.5,a.I4=[10,0,0,0,0],a.P8="bg"},U3:function(){return new ZC.A7G(this)},parse:function(){var e,a=this;a.BP=a.O6(),a.C2=a.BP[0],a.B9=a.BP[1],a.A0=a.BP[3],a.AE=a.BP[3],a.NS(),a.b(),a.assign_a([["alpha-area","HS","f",0,1],["indicator","I4"]]),null!==ZC._n_(e=a.o.csize)&&(a.I4[0]=ZC._i_(e)),a.I4=[ZC._f_(a.I4[0]||"10"),ZC._f_(a.I4[1]||"0"),ZC._f_(a.I4[2]||"0"),ZC._f_(a.I4[3]||"0"),ZC._f_(a.I4[4]||"0")]},paint:function(){var e=this;e.b(),e.KH=e.CS("bl",0),e.PI(!0)}}),ZC.A7G=ZC.LM.CD({setup:function(){var e=this,a=e.C.BM(e.A.BW("k")[0]),i=e.C.BM(e.A.BW("v")[0]),n=e.L%a.H7,t=Math.floor(e.L/a.H7),r=i.EM/(i.BF-i.B0);e.iX=a.iX+n*a.GM+a.GM/2,e.iY=a.iY+t*a.GH+a.GH/2,e.E.angle=i.DL-i.EM/2+r*(e.AD-i.B0),i.AX&&(e.E.angle=i.DL+i.EM/2-r*(e.AD-i.B0)),e.I3||(e.copy(e.A),e.E6=e.A.E6,e.DH()&&e.parse(!1),e.I3=!0)},AC6:function(e){var a,i,n,t=e.I,r=e.F,C=this,s=C.C.BM(C.A.BW("k")[0]),l=ZC.CY(s.GM/2,s.GH/2)*s.JU,A=C.L%s.H7,Z=Math.floor(C.L/s.H7),c=s.iX+A*s.GM+s.GM/2+s.BK,o=s.iY+Z*s.GH+s.GH/2+s.BJ;switch(e.o.placement){case"center":i=c-t/2+C.BK,n=o-r/2+C.BJ;break;case"edge":i=(a=ZC.AQ.BN(c,o,l+e.DX,C.E.angle))[0]-t/2+C.BK,n=a[1]-r/2+C.BJ;break;case"tip":i=(a=ZC.AQ.BN(c,o,C.E.size+e.DX,C.E.angle))[0]-t/2+C.BK,n=a[1]-r/2+C.BJ;break;default:i=(a=ZC.AQ.BN(c,o,l/2+e.DX,C.E.angle))[0]-t/2+C.BK,n=a[1]-r/2+C.BJ}return null!==ZC._n_(e.o.x)&&(i=e.iX),null!==ZC._n_(e.o.y)&&(n=e.iY),[ZC._i_(i),ZC._i_(n)]},ABE:function(){return{color:this.A0}},Y3:function(){return{"background-color":this.A0,"border-color":this.B9,color:this.C2}},paint:function(){var e,a=this;a.b(),a.setup(),a.D0=!1;var i=a.C.BM(a.A.BW("k")[0]),n=ZC.CY(i.GM/2,i.GH/2)*i.JU,t=a.L%i.H7,r=Math.floor(a.L/i.H7),C=i.iX+t*i.GM+i.GM/2+i.BK,s=i.iY+r*i.GH+i.GH/2+i.BJ,l=ZC.IO(a.A.o.size||"0.9",!1);l>0&&l<=1&&(l*=n),a.E.size=l;var A=a.P=a.A.IJ(a,a),Z=new ZC.DT(a.A);function c(i){var t=[],r=a.A.I4;r[4]>-1&&r[4]<1&&(r[4]=ZC._i_(r[4]*n));var A=ZC.AQ.BN(C,s,r[4],i);if(r[0]>=0)for(e=-r[2];e<=180+r[2];e+=5)t.push(ZC.AQ.BN(A[0],A[1],r[0],i+270-e));else t.push(ZC.AQ.BN(A[0],A[1],ZC._a_(r[0]),i-90)),t.push(ZC.AQ.BN(A[0],A[1],ZC._a_(r[0]),i+90));if(0===r[1])t.push(ZC.AQ.BN(C,s,l>0?l:.9*n,i));else if(r[1]>0)for(A=ZC.AQ.BN(C,s,l>0?l:.9*n,i),e=-r[3];e<=180+r[3];e+=5)t.push(ZC.AQ.BN(A[0],A[1],r[1],i-270-e));else A=ZC.AQ.BN(C,s,(l>0?l:.9*n)+r[1],i),t.push(ZC.AQ.BN(A[0],A[1],ZC._a_(r[1]/(90/r[3])),i+90),ZC.AQ.BN(A[0],A[1],ZC._a_(r[1]),i+90),ZC.AQ.BN(C,s,l>0?l:.9*n,i),ZC.AQ.BN(A[0],A[1],ZC._a_(r[1]),i+270),ZC.AQ.BN(A[0],A[1],ZC._a_(r[1]/(90/r[3])),i+270));return t.push([t[0][0],t[0][1]]),t}function o(){var e=Z.F1(),i=a.C.K+"-node-area "+a.C.K+"-plotset-plot-"+a.A.L+"-node-area zc-node-area",n=ZC.Q.FO("poly",a.A.E9,a.A.IE)+'class="'+i+'" '+a.a11y()+' id="'+a.K+'" coords="'+e+'" />';a.A.A.H3.push(n)}Z.copy(A),Z.Z=a.A.CS("bl",1),Z.C8=a.A.CS("bl",0),Z.K=a.K+"-arrow";var B=a.C.BM(a.A.BW("v")[0]),p=B.DL-B.EM/2,u=c(a.E.angle);if(a.E.points=u,Z.DJ="poly",Z.D=u,Z.parse(),Z.IQ=function(e){return a.IQ(e)},Z.DH()&&Z.parse(),a.A.GG&&!a.C.HM){var M,f=Z,h={},_=a.A.LE;for(M in f.C6=0,h.alpha=A.C6,2===_&&(f.A2H=p,h.A2H=a.E.angle),a.A.FY)f[ZC.E8.GO[ZC.EH(M)]]=a.A.FY[M],h[ZC.EH(M)]=A[ZC.E8.GO[ZC.EH(M)]];if(a.C.ER||(a.C.ER={}),null!==ZC._n_(a.C.ER[a.A.L+"-"+a.L]))for(M in a.C.ER[a.A.L+"-"+a.L]){var E=ZC.E8.GO[ZC.EH(M)];null===ZC._n_(E)&&(E=M),f[E]=a.C.ER[a.A.L+"-"+a.L][M]}a.C.ER[a.A.L+"-"+a.L]={},ZC._cp_(h,a.C.ER[a.A.L+"-"+a.L]);var D=new ZC.E8(f,h,a.A.JG,a.A.LC,ZC.E8.RQ[a.A.LF],function(){o()});D.AW=a,D.A0E=function(e,a){null!==ZC._n_(a.A2H)&&(e.D=c(a.A2H))},a.LU(D),a.A.U&&a.H1()}else Z.paint(),a.A.U&&a.H1(),o()},A15:function(e){var a=this;ZC.move||a.MC({layer:e,type:"shape",initcb:function(){this.copy(a),this.B9=a.A.BP[1],this.BX=a.A.BP[1],this.A0=a.A.BP[3],this.AE=a.A.BP[2],this.D=a.E.points,this.Z=this.C8=a.A.CS("bl",2)}})}}),ZC.A86=ZC.A5A.CD({$i:function(e){this.b(e);var a=this;a.DL=-90,a.EM=180,a.QH=null,a.IZ=null,a.CW="circle"},parse:function(){var e,a=this;a.b(),null!==ZC._n_(e=a.o["ref-angle"])&&(a.DL=ZC._i_(e)%360),null!==ZC._n_(e=a.o.aperture)&&(a.EM=ZC._i_(e)),null!==ZC._n_(e=a.o.center)&&(a.QH=new ZC.DT(a),a.QH.append(e),a.QH.parse()),null!==ZC._n_(e=a.o.ring)&&(a.IZ=new ZC.DT(a),a.G.B6.load(a.IZ.o,[a.A.AF+"."+a.BD+".ring"]),a.IZ.append(e),a.IZ.parse())},AA0:function(e){this.b(e)},clear:function(){},build:function(){this.b()},AR:function(e){var a=this,i=a.A.BM("scale"),n=i.iX+i.I/2,t=i.iY+i.F/2,r=a.A.BM("scale-"+a.L);r||(r=a.A.BM("scale"));var C=ZC.CY(r.GM/2,r.GH/2)*r.JU,s=a.BF-a.B0,l=a.EM/s;return ZC.AQ.BN(n,t,C,a.DL-a.EM/2+l*(e-a.B0))},II:function(e){return this.AR(this.V[e])},paintMarker:function(e){var a,i=this;if(e.FA){var n,t=i.A.BM("scale-"+i.L);if(t||(t=i.A.BM("scale")),e.AP){var r=i.A.K+"-scales-"+("top"===e.BA?"f":"b")+"l-0-c";e.Z=e.C8=ZC.AM(i.G.usc()?t.G.K+"-main-c":r),n=ZC.Q.EE(e.Z,i.G.AC);var C=ZC.CY(t.GM/2,t.GH/2)*t.JU,s=ZC.IO(e.o["offset-start"]||"0");s>0&&s<1&&(s*=C);var l=ZC.IO(e.o["offset-end"]||"0");l>0&&l<1&&(l*=C),e.M&&(e.M.Z=i.G.usc()?i.G.mc():ZC.AM(i.A.K+"-scales-ml-0-c"),e.M.K=e.A.A.K+"-"+e.A.BD.replace(/\-/g,"_")+"-marker_"+e.L,e.M.GN=e.A.K+"-marker-label "+e.A.A.K+"-scale-marker-label zc-scale-marker-label");for(var A=0;A<t.V.length;A++){var Z,c=A%t.H7,o=Math.floor(A/t.H7),B=t.iX+c*t.GM+t.GM/2+t.BK,p=t.iY+o*t.GH+t.GH/2+t.BJ;switch(e.AF){case"line":if(e.FA.length>0){var u=i.DL-i.EM/2+i.EM*(e.FA[0]-i.B0)/(i.BF-i.B0);Z=u;var M=[];M.push(ZC.AQ.BN(B,p,s,u)),M.push(ZC.AQ.BN(B,p,C-l,u)),2===M.length&&(ZC.CO.setup(n,e),ZC.CO.paint(n,e,M))}break;case"area":if(e.FA.length>1){var f=i.DL-i.EM/2+i.EM*(e.FA[0]-i.B0)/(i.BF-i.B0),h=i.DL-i.EM/2+i.EM*(e.FA[1]-i.B0)/(i.BF-i.B0);Z=(f+h)/2;var _=new ZC.DT(e);_.Z=e.Z,_.append(e.o),_.append({size:C-l,slice:s,type:"pie","angle-start":f,"angle-end":h}),_.K=t.K+"-marker-"+e.L,_.iX=B,_.iY=p,_.parse(),_.paint()}}if(e.M){var E;null!==ZC._n_(a=e.M.o["offset-r"])?E=ZC._f_(ZC._p_(a)):E<1?E*=C-l-s:E=0;var D=ZC.AQ.BN(B,p,(C-l-s)/2+E,Z);e.M.iX=D[0]-e.M.I/2,e.M.iY=D[1]-e.M.F/2,e.M.paint()}}}}},paint:function(){var e,a,i,n,t,r,C,s,l,A=this;if(A.AP&&0!==A.V.length){A.AX&&A.V.reverse(),e=ZC.Q.EE(A.G.usc()?A.G.K+"-main-c":A.A.K+"-scales-bl-0-c",A.G.AC);var Z=ZC._i_(A.IV.o.size||8),c=ZC._i_(A.IG.o.size||4),o=0,B=ZC.BR(1,Math.ceil((A.A1-A.W)/(A.M4-1))),p=ZC.BR(1,Math.ceil((A.A1-A.W)/(A.EJ-1))),u=A.A.BM("scale-"+A.L);u||(u=A.A.BM("scale"));for(var M,f,h,_=ZC.CY(u.GM/2,u.GH/2)*u.JU,E=A.EM/(A.V.length-1),D=0;D<u.V.length;D++){var G=D%u.H7,K=Math.floor(D/u.H7),L=u.iX+G*u.GM+u.GM/2+u.BK,v=u.iY+K*u.GH+u.GH/2+u.BJ,I=new ZC.DT(A);if(I.Z=A.G.usc()?A.G.mc():ZC.AM(A.A.K+"-scales-bl-0-c"),I.copy(A),I.K=A.K+"-"+D,I.iX=L,I.iY=v,I.AI=_-.5,I.DJ=360===A.EM?"circle":"pie",I.B4=A.DL-A.EM/2+360,I.BL=A.DL+A.EM/2+360,I.CP=0,I.parse(),I.paint(),A.D8.AP){if(A.D8.o.items&&A.D8.o.items.length>0)for(a=0;a<A.V.length-1;a++)I=new ZC.DT(A),C=a%A.D8.o.items.length,I.append(A.D8.o.items[C]),I.Z=A.G.usc()?A.G.mc():ZC.AM(A.A.K+"-scales-bl-0-c"),I.iX=L,I.iY=v,I.K=A.K+"-pie-"+a,I.o.type="pie",I.o.size=_-A.BU,I.CP=A.A9,I.B4=A.DL-A.EM/2+a*E+360,I.BL=A.DL-A.EM/2+(a+1)*E+360,I.parse(),I.paint();if(A.D8.B1>0)for(a=0,i=A.V.length;a<i;a++)(M=new ZC.CZ(A)).copy(A.D8),M.IQ=F,M.E6=A.D8.E6,M.DH()&&M.parse(),(r=[]).push(ZC.AQ.BN(L,v,_-A.BU,A.DL-A.EM/2+a*E)),r.push(ZC.AQ.BN(L,v,A.A9,A.DL-A.EM/2+a*E)),ZC.CO.paint(e,M,r)}if(A.G8.AP&&A.G8.B1>0&&A.FZ>0)for(a=0,i=A.V.length;a<i-1;a++)for(s=A.DL-A.EM/2+a*E,f=E/(A.FZ+1),h=1;h<=A.FZ;h++)(M=new ZC.CZ(A)).copy(A.G8),M.IQ=F,M.E6=A.G8.E6,M.DH()&&M.parse(),(r=[]).push(ZC.AQ.BN(L,v,_-A.BU,A.DL-A.EM/2+a*E+h*f)),r.push(ZC.AQ.BN(L,v,A.A9,A.DL-A.EM/2+a*E+h*f)),ZC.CO.paint(e,M,r);if(A.XV(),A.G.ZY(),A.IZ&&((t=new ZC.DT(A)).append(A.IZ.o),t.Z=A.G.usc()?A.G.mc():ZC.AM(A.A.K+"-scales-bl-0-c"),t.K=A.K+"-ring",t.iX=L,t.iY=v,360!==A.EM?(t.o.type="pie",n=ZC._i_(t.o.size),n=ZC.BR(1,ZC.CY(n,_)),t.CP=_-n,t.o.size=_,t.B4=A.DL-A.EM/2+360,t.BL=A.DL+A.EM/2+360):(t.o.type="circle",n=ZC._i_(t.o.size),n=ZC.BR(1,ZC.CY(n,_)),t.o.size=_),t.parse(),t.AP&&n+t.AU>0&&(t.paint(),360===A.EM&&(t.K=A.K+"-ring-inner",t.o.size=_-n,t.parse(),t.paint())),A.IZ.o.items&&A.IZ.o.items.length>0||A.IZ.o.rules))for(a=0;a<A.V.length-1;a++)(t=new ZC.DT(A)).append(A.IZ.o),A.IZ.o.items&&(C=a%A.IZ.o.items.length,t.append(A.IZ.o.items[C])),t.Z=A.G.usc()?A.G.mc():ZC.AM(A.A.K+"-scales-bl-0-c"),t.K=A.K+"-ring-"+a,t.iX=L,t.iY=v,t.o.type="pie",n=ZC._i_(t.o.size),n=ZC.BR(0,ZC.CY(n,_)),t.CP=_-n,t.o.size=_,t.B4=A.DL-A.EM/2+a*E+360,t.BL=A.DL-A.EM/2+(a+1)*E+360+.25,t.parse(),t.IQ=F,t.E6=A.IZ.E6,t.DH()&&t.parse(),t.AP&&n+t.AU>0&&t.paint();if(A.IV.AP){switch(A.IV.o.placement){case"outer":o+=Z;break;default:o+=Z/2}for(r=[],a=0,i=A.V.length;a<i;a++)if(a===A.W||a===A.A1||a%B==0){switch(s=A.DL-A.EM/2+a*E,l=[0,0],A.IV.o.placement){case"inner":l=[-Z,0];break;case"outer":l=[0,Z];break;default:l=[-Z/2,Z/2]}r.push(ZC.AQ.BN(L,v,_+l[0],s),ZC.AQ.BN(L,v,_+l[1],s),null)}ZC.CO.paint(e,A.IV,r)}if(A.IG.AP&&A.FZ>0){for(r=[],a=0,i=A.V.length;a<i-1;a++)for(s=A.DL-A.EM/2+a*E,f=E/(A.FZ+1),h=1;h<=A.FZ;h++){switch(l=[0,0],A.IG.o.placement){case"inner":l=[-c,0];break;case"outer":l=[0,c];break;default:l=[-c/2,c/2]}r.push(ZC.AQ.BN(L,v,_+l[0],s+h*f),ZC.AQ.BN(L,v,_+l[1],s+h*f),null)}ZC.CO.paint(e,A.IG,r)}if(A.BQ.AP){var H=[];for(a=0,i=A.V.length;a<i;a++)if(a===A.W||a===A.A1||a%p==0){var g=new ZC.DN(A);g.append(A.BQ.o),g.GN=A.K+"-item "+A.A.K+"-scale-item zc-scale-item",g.K=A.A.K+"-"+A.BD.replace(/\-/g,"_")+"-item_"+D+"_"+a;var Q=A.FU(a);if(g.AK=Q,g.Z=g.C8=A.G.usc()?A.G.mc():ZC.AM(A.A.K+"-scales-ml-0-c"),g.parse(),"auto"===g.o.angle&&(g.AB=A.DL-A.EM/2+a*E+90),g.IQ=F,g.E6=A.BQ.E6,g.DH()&&g.parse(),g.AP){g.F=g.KF;var m,b=1.15*g.DI;switch(A.BQ.o.placement){case"inner":m=ZC.AQ.BN(L,v,_+A.BQ.DX-b-5+o,A.DL-A.EM/2+a*E);break;default:m=ZC.AQ.BN(L,v,_+A.BQ.DX+b+o,A.DL-A.EM/2+a*E)}g.VF="center",g.iX=m[0]-g.I/2,g.iY=m[1]-g.F/2,g.paint(),g.EP(),null===ZC._n_(A.o.tooltip)&&g.KK||(null!==ZC._n_(A.o.tooltip)&&(A.o.tooltip.text=A.o.tooltip.text||"%scale-value"),H.push(ZC.AO.OB(A.A.G.K,A.A.K,g)))}}H.length>0&&ZC.AM(A.A.A.K+"-map")&&(ZC.AM(A.A.A.K+"-map").innerHTML+=H.join(""))}}}function F(e){return e=(e=(e=(e=e.replace(/%i/g,a)).replace(/%k/g,a)).replace(/%v/g,null!==ZC._n_(A.V[a])?A.V[a]:"")).replace(/%l/g,null!==ZC._n_(A.BY[a])?A.BY[a]:"")}},paint_:function(){var e=this,a=e.A.BM("scale-"+e.L);a||(a=e.A.BM("scale"));for(var i=0;i<a.V.length;i++){var n=i%a.H7,t=Math.floor(i/a.H7),r=a.iX+n*a.GM+a.GM/2+a.BK,C=a.iY+t*a.GH+a.GH/2+a.BJ;if(e.QH){var s=new ZC.DT(e);s.append(e.QH.o),s.Z=s.C8=e.G.usc()?e.G.mc("top"):ZC.AM(e.A.K+"-scales-ml-0-c"),s.K=e.K+"-"+i+"-center",s.iX=r,s.iY=C,s.o.type=s.o.type||"circle",s.parse(),s.AP&&s.paint()}}}});