baizonghao
2023-08-04 8fee5b265eaa379b7a1cc51cd060a368c046de46
1
!function(t){"use strict";function T(){}var e=t.getOptions().plotOptions,h=t.seriesTypes,n=t.merge,Y=t.each;e.funnel=n(e.pie,{center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}}),h.funnel=t.extendClass(h.pie,{type:"funnel",animate:T,translate:function(){function t(t,e){return/%$/.test(t)?e*parseInt(t,10)/100:parseInt(t,10)}var e,n,a,o,i,r,s,h,l,c,p,d=0,u=this,f=u.chart,g=f.plotWidth,b=f.plotHeight,w=0,y=u.options,C=y.center,L=t(C[0],g),k=t(C[0],b),W=t(y.width,g),v=t(y.height,b),A=t(y.neckWidth,g),H=t(y.neckHeight,b),P=v-H,X=u.data,m="left"===y.dataLabels.position?1:0;u.getWidthAt=n=function(t){return v-H<t||v===H?A:A+(v-H-t)/(v-H)*(W-A)},u.getX=function(t,e){return L+(e?-1:1)*(n(t)/2+y.dataLabels.distance)},u.center=[L,k,v],u.centerX=L,Y(X,function(t){d+=t.y}),Y(X,function(t){p=null,o=d?t.y/d:0,e=n(r=k-v/2+w*v),s=(i=L-e/2)+e,e=n(l=r+o*v),c=(h=L-e/2)+e,P<r?(i=h=L-A/2,s=c=L+A/2):P<l&&(p=l,e=n(P),c=(h=L-e/2)+e,l=P),a=["M",i,r,"L",s,r,c,l],p&&a.push(c,p,h,p),a.push(h,l,"Z"),t.shapeType="path",t.shapeArgs={d:a},t.percentage=100*o,t.plotX=L,t.plotY=(r+(p||l))/2,t.tooltipPos=[L,t.plotY],t.slice=T,t.half=m,w+=o}),u.setTooltipPoints()},drawPoints:function(){var a=this,o=a.options,i=a.chart.renderer;Y(a.data,function(t){var e=t.graphic,n=t.shapeArgs;e?e.animate(n):t.graphic=i.path(n).attr({fill:t.color,stroke:o.borderColor,"stroke-width":o.borderWidth}).add(a.group)})},sortByAngle:T,drawDataLabels:function(){var t,e,n,a,o,i=this.data,r=this.options.dataLabels.distance,s=i.length;for(this.center[2]-=2*r;s--;)e=(t=(n=i[s]).half)?1:-1,o=n.plotY,a=this.getX(o,t),n.labelPos=[0,o,a+(r-5)*e,o,a+r*e,o,t?"right":"left",0];h.pie.prototype.drawDataLabels.call(this)}})}(Highcharts);