define(function(e){var d=e("./base");var g=e("zrender/shape/Text");var b=e("zrender/shape/Line");var i=e("zrender/shape/Polygon");var k=e("../config");k.funnel={zlevel:0,z:2,clickable:true,legendHoverLink:true,x:80,y:60,x2:80,y2:60,min:0,max:100,minSize:"0%",maxSize:"100%",sort:"descending",gap:0,funnelAlign:"center",itemStyle:{normal:{borderColor:"#fff",borderWidth:1,label:{show:true,position:"outer"},labelLine:{show:true,length:10,lineStyle:{width:1,type:"solid"}}},emphasis:{borderColor:"rgba(0,0,0,0)",borderWidth:1,label:{show:true},labelLine:{show:true}}}};var c=e("../util/ecData");var h=e("../util/number");var f=e("zrender/tool/util");var a=e("zrender/tool/color");var l=e("zrender/tool/area");function j(p,m,q,o,n){d.call(this,p,m,q,o,n);this.refresh(o)}j.prototype={type:k.CHART_TYPE_FUNNEL,_buildShape:function(){var p=this.series;var q=this.component.legend;this._paramsMap={};this._selected={};this.selectedMap={};var o;for(var n=0,m=p.length;n1?(m.height-(J-1)*y)/J:m.height;var B;var r=m.y;var p=A.sort==="descending"?this._getItemWidth(G,o[0].value):h.parsePercent(A.minSize,m.width);var z=A.sort==="descending"?1:0;var s=m.centerX;var C=[];var t;var v;var q;for(var F=0,D=o.length;Fl.getTextWidth(v,w)?"#fff":a.reverse(E)}else{if(H.position==="left"){p="right"}else{p="left"}}var z={zlevel:B.zlevel,z:B.z+1,style:{x:this._getLabelPoint(H.position,u,m,t,n,F,D),y:s+A/2,color:q.color||o,text:v,textAlign:q.align||p,textBaseline:q.baseline||"middle",textFont:w}};C="emphasis";H=r[C].label||H;q=H.textStyle||q;F=r[C].labelLine.length||F;H.position=H.position||r.normal.label.position;v=this.getLabelText(G,I,C);w=this.getFont(q);o=E;if(H.position==="inner"||H.position==="inside"||H.position==="center"){p=D;o=Math.max(t,n)/2>l.getTextWidth(v,w)?"#fff":a.reverse(E)}else{if(H.position==="left"){p="right"}else{p="left"}}z.highlightStyle={x:this._getLabelPoint(H.position,u,m,t,n,F,D),color:q.color||o,text:v,textAlign:q.align||p,textFont:w,brushType:"fill"};return new g(z)},getLabelText:function(n,q,m){var p=this.series;var r=p[n];var s=r.data[q];var o=this.deepQuery([s,r],"itemStyle."+m+".label.formatter");if(o){if(typeof o==="function"){return o.call(this.myChart,{seriesIndex:n,seriesName:r.name||"",series:r,dataIndex:q,data:s,name:s.name,value:s.value})}else{if(typeof o==="string"){o=o.replace("{a}","{a0}").replace("{b}","{b0}").replace("{c}","{c0}").replace("{a0}",r.name).replace("{b0}",s.name).replace("{c0}",s.value);return o}}}else{return s.name}},getLabelLine:function(D,F,B,t,q,r,o,v,A){var w=this.series[D];var G=w.data[F];var m=this._paramsMap[D].location;var p=f.merge(f.clone(G.itemStyle)||{},w.itemStyle);var z="normal";var u=p[z].labelLine;var C=p[z].labelLine.length;var n=u.lineStyle||{};var E=p[z].label;E.position=E.position||p.normal.label.position;var s={zlevel:w.zlevel,z:w.z+1,hoverable:false,style:{xStart:this._getLabelLineStartPoint(t,m,r,o,A),yStart:q+v/2,xEnd:this._getLabelPoint(E.position,t,m,r,o,C,A),yEnd:q+v/2,strokeColor:n.color||B,lineType:n.type,lineWidth:n.width}};z="emphasis";u=p[z].labelLine||u;C=p[z].labelLine.length||C;n=u.lineStyle||n;E=p[z].label||E;E.position=E.position;s.highlightStyle={xEnd:this._getLabelPoint(E.position,t,m,r,o,C,A),strokeColor:n.color||B,lineType:n.type,lineWidth:n.width};return new b(s)},_getLabelPoint:function(o,n,p,r,q,m,s){o=(o==="inner"||o==="inside")?"center":o;switch(o){case"center":return s=="center"?(n+r/2):s=="left"?(n+10):(n+r-10);case"left":if(m==="auto"){return p.x-10}else{return s=="center"?(p.centerX-Math.max(r,q)/2-m):s=="right"?(n-(r