Newer
Older
Nanping_sponge_JXKH / spongePerformanceDist / assets / liquidFillView.8441c1fb.js
import{P as te,Q as se,R as ve,S as ue,T as de,U as he,V as fe,W as ce,X as ge,Y as ye,Z as _,$ as Z,a0 as me,a1 as we,a2 as j,a3 as Q,a4 as pe,a5 as Pe,a6 as J,a7 as Se,a8 as K,a9 as be}from"./index.82404a61.js";te([se,ve]);te(ue);de({type:"series.liquidFill",optionUpdated:function(){var t=this.option;t.gridSize=Math.max(Math.floor(t.gridSize),4)},getInitialData:function(t,a){var u=he(t.data,{coordDimensions:["value"]}),f=new fe(u,this);return f.initData(t.data),f},defaultOption:{color:["#294D99","#156ACF","#1598ED","#45BDFF"],center:["50%","50%"],radius:"50%",amplitude:"8%",waveLength:"80%",phase:"auto",period:"auto",direction:"right",shape:"circle",waveAnimation:!0,animationEasing:"linear",animationEasingUpdate:"linear",animationDuration:2e3,animationDurationUpdate:1e3,outline:{show:!0,borderDistance:8,itemStyle:{color:"none",borderColor:"#294D99",borderWidth:8,shadowBlur:20,shadowColor:"rgba(0, 0, 0, 0.25)"}},backgroundStyle:{color:"#E3F7FF"},itemStyle:{opacity:.95,shadowBlur:50,shadowColor:"rgba(0, 0, 0, 0.4)"},label:{show:!0,color:"#294D99",insideColor:"#fff",fontSize:50,fontWeight:"bold",align:"center",baseline:"middle",position:"inside"},emphasis:{itemStyle:{opacity:.8}}}});const Ie=ce({type:"ec-liquid-fill",shape:{waveLength:0,radius:0,radiusY:0,cx:0,cy:0,waterLevel:0,amplitude:0,phase:0,inverse:!1},buildPath:function(t,a){a.radiusY==null&&(a.radiusY=a.radius);for(var u=Math.max(Math.ceil(2*a.radius/a.waveLength*4)*2,8);a.phase<-Math.PI*2;)a.phase+=Math.PI*2;for(;a.phase>0;)a.phase-=Math.PI*2;var f=a.phase/Math.PI/2*a.waveLength,d=a.cx-a.radius+f-a.radius*2;t.moveTo(d,a.waterLevel);for(var g=0,p=0;p<u;++p){var O=p%4,o=Me(p*a.waveLength/4,O,a.waveLength,a.amplitude);t.bezierCurveTo(o[0][0]+d,-o[0][1]+a.waterLevel,o[1][0]+d,-o[1][1]+a.waterLevel,o[2][0]+d,-o[2][1]+a.waterLevel),p===u-1&&(g=o[2][0])}a.inverse?(t.lineTo(g+d,a.cy-a.radiusY),t.lineTo(d,a.cy-a.radiusY),t.lineTo(d,a.waterLevel)):(t.lineTo(g+d,a.cy+a.radiusY),t.lineTo(d,a.cy+a.radiusY),t.lineTo(d,a.waterLevel)),t.closePath()}});function Me(t,a,u,f){return a===0?[[t+1/2*u/Math.PI/2,f/2],[t+1/2*u/Math.PI,f],[t+u/4,f]]:a===1?[[t+1/2*u/Math.PI/2*(Math.PI-2),f],[t+1/2*u/Math.PI/2*(Math.PI-1),f/2],[t+u/4,0]]:a===2?[[t+1/2*u/Math.PI/2,-f/2],[t+1/2*u/Math.PI,-f],[t+u/4,-f]]:[[t+1/2*u/Math.PI/2*(Math.PI-2),-f],[t+1/2*u/Math.PI/2*(Math.PI-1),-f/2],[t+u/4,0]]}var I=Pe;function ee(t){return t&&t.indexOf("path://")===0}ge({type:"liquidFill",render:function(t,a,u){var f=this,d=this.group;d.removeAll();var g=t.getData(),p=g.getItemModel(0),O=p.get("center"),o=p.get("radius"),z=u.getWidth(),M=u.getHeight(),U=Math.min(z,M),B=0,D=0,F=t.get("outline.show");F&&(B=t.get("outline.borderDistance"),D=I(t.get("outline.itemStyle.borderWidth"),U));var L=I(O[0],z),T=I(O[1],M),C,E,R,P=!1,w=t.get("shape");if(w==="container"?(P=!0,C=[z/2,M/2],E=[C[0]-D/2,C[1]-D/2],R=[I(B,z),I(B,M)],o=[Math.max(E[0]-R[0],0),Math.max(E[1]-R[1],0)]):(C=I(o,U)/2,E=C-D/2,R=I(B,U),o=Math.max(E-R,0)),F){var ae=V();ae.style.lineWidth=D,d.add(V())}var re=P?0:L-o,ie=P?0:T-o,W=null;d.add(le());var q=this._data,G=[];g.diff(q).add(function(e){var r=N(e,!1),i=r.shape.waterLevel;r.shape.waterLevel=P?M/2:o,ye(r,{shape:{waterLevel:i}},t),r.z2=2,$(e,r,null),d.add(r),g.setItemGraphicEl(e,r),G.push(r)}).update(function(e,r){for(var i=q.getItemGraphicEl(r),s=N(e,!1,i),n={},l=["amplitude","cx","cy","phase","radius","radiusY","waterLevel","waveLength"],h=0;h<l.length;++h){var v=l[h];s.shape.hasOwnProperty(v)&&(n[v]=s.shape[v])}for(var y={},c=["fill","opacity","shadowBlur","shadowColor"],h=0;h<c.length;++h){var v=c[h];s.style.hasOwnProperty(v)&&(y[v]=s.style[v])}P&&(n.radiusY=M/2),_(i,{shape:n,x:s.x,y:s.y},t),t.isUniversalTransitionEnabled&&t.isUniversalTransitionEnabled()?_(i,{style:y},t):i.useStyle(y);var m=i.getClipPath(),S=s.getClipPath();i.setClipPath(s.getClipPath()),i.shape.inverse=s.inverse,m&&S&&f._shape===w&&!ee(w)&&_(S,{shape:m.shape},t,{isFrom:!0}),$(e,i,i),d.add(i),g.setItemGraphicEl(e,i),G.push(i)}).remove(function(e){var r=q.getItemGraphicEl(e);d.remove(r)}).execute(),p.get("label.show")&&d.add(ne(G)),this._shape=w,this._data=g;function Y(e,r){if(w)if(ee(w)){var i=J(w.slice(7),{}),s=i.getBoundingRect(),n=s.width,l=s.height;n>l?(l=e*2/n*l,n=e*2):(n=e*2/l*n,l=e*2);var h=r?0:L-n/2,v=r?0:T-l/2;return i=J(w.slice(7),{},new Se(h,v,n,l)),r&&(i.x=-n/2,i.y=-l/2),i}else if(P){var y=r?-e[0]:L-e[0],c=r?-e[1]:T-e[1];return K("rect",y,c,e[0]*2,e[1]*2)}else{var y=r?-e:L-e,c=r?-e:T-e;return w==="pin"?c+=e:w==="arrow"&&(c-=e),K(w,y,c,e*2,e*2)}return new be({shape:{cx:r?0:L,cy:r?0:T,r:e}})}function V(){var e=Y(C);return e.style.fill=null,e.setStyle(t.getModel("outline.itemStyle").getItemStyle()),e}function le(){var e=Y(o);e.setStyle(t.getModel("backgroundStyle").getItemStyle()),e.style.fill=null,e.z2=5;var r=Y(o);r.setStyle(t.getModel("backgroundStyle").getItemStyle()),r.style.stroke=null;var i=new Z;return i.add(e),i.add(r),i}function N(e,r,i){var s=P?o[0]:o,n=P?M/2:o,l=g.getItemModel(e),h=l.getModel("itemStyle"),v=l.get("phase"),y=I(l.get("amplitude"),n*2),c=I(l.get("waveLength"),s*2),m=g.get("value",e),S=n-m*n*2;v=i?i.shape.phase:v==="auto"?e*Math.PI/4:v;var b=h.getItemStyle();if(!b.fill){var A=t.get("color"),k=e%A.length;b.fill=A[k]}var oe=s*2,x=new Ie({shape:{waveLength:c,radius:s,radiusY:n,cx:oe,cy:0,waterLevel:S,amplitude:y,phase:v,inverse:r},style:b,x:L,y:T});x.shape._waterLevel=S;var H=l.getModel("emphasis.itemStyle").getItemStyle();H.lineWidth=0,x.ensureState("emphasis").style=H,me(x);var X=Y(o,!0);return X.setStyle({fill:"white"}),x.setClipPath(X),x}function $(e,r,i){var s=g.getItemModel(e),n=s.get("period"),l=s.get("direction"),h=g.get("value",e),v=s.get("phase");v=i?i.shape.phase:v==="auto"?e*Math.PI/4:v;var y=function(S){var b=g.count();return b===0?S:S*(.2+(b-e)/b*.8)},c=0;n==="auto"?c=y(5e3):c=typeof n=="function"?n(h,e):n;var m=0;l==="right"||l==null?m=Math.PI:l==="left"?m=-Math.PI:l==="none"?m=0:console.error("Illegal direction value for liquid fill."),l!=="none"&&s.get("waveAnimation")&&r.animate("shape",!0).when(0,{phase:v}).when(c/2,{phase:m+v}).when(c,{phase:m*2+v}).during(function(){W&&W.dirty(!0)}).start()}function ne(e){var r=p.getModel("label");function i(){var b=t.getFormattedLabel(0,"normal"),A=g.get("value",0)*100,k=g.getName(0)||t.name;return isNaN(A)||(k=A.toFixed(0)+"%"),b==null?k:b}var s={z2:10,shape:{x:re,y:ie,width:(P?o[0]:o)*2,height:(P?o[1]:o)*2},style:{fill:"transparent"},textConfig:{position:r.get("position")||"inside"},silent:!0},n={style:{text:i(),textAlign:r.get("align"),textVerticalAlign:r.get("baseline")}};Object.assign(n.style,we(r));var l=new j(s),h=new j(s);h.disableLabelAnimation=!0,l.disableLabelAnimation=!0;var v=new Q(n),y=new Q(n);l.setTextContent(v),h.setTextContent(y);var c=r.get("insideColor");y.style.fill=c;var m=new Z;m.add(l),m.add(h);var S=Y(o,!0);return W=new pe({shape:{paths:e},x:L,y:T}),W.setClipPath(S),h.setClipPath(W),m}},dispose:function(){}});