define("echarts/chart/radar","require ./base zrender/shape/Polygon ../component/polar ../config ../util/ecData zrender/tool/util zrender/tool/color ../util/accMath ../chart".split(" "),function(m){function l(f,k,d,a,c){w.call(this,f,k,d,a,c);this.refresh(a)}var w=m("./base"),q=m("zrender/shape/Polygon");m("../component/polar");var B=m("../config");B.radar={zlevel:0,z:2,clickable:!0,legendHoverLink:!0,polarIndex:0,itemStyle:{normal:{label:{show:!1},lineStyle:{width:2,type:"solid"}},emphasis:{label:{show:!1}}},symbolSize:2};var t=m("../util/ecData"),I=m("zrender/tool/util"),G=m("zrender/tool/color");return l.prototype={type:B.CHART_TYPE_RADAR,_buildShape:function(){this.selectedMap={};this._symbol=this.option.symbolList;this._queryTarget;this._dropBoxList=[];this._radarDataCounter=0;for(var f,k=this.series,d=this.component.legend,a=0,c=k.length;c>a;a++)k[a].type===B.CHART_TYPE_RADAR&&(this.serie=this.reformOption(k[a]),this.legendHoverLink=k[a].legendHoverLink||this.legendHoverLink,f=this.serie.name||"",this.selectedMap[f]=d?d.isSelected(f):!0,this.selectedMap[f]&&(this._queryTarget=[this.serie,this.option],this.deepQuery(this._queryTarget,"calculable")&&this._addDropBox(a),this._buildSingleRadar(a),this.buildMark(a)));this.addShapeList()},_buildSingleRadar:function(f){for(var k,d,a,c,b=this.component.legend,e=this.serie.data,h=this.deepQuery(this._queryTarget,"calculable"),g=0;gb;b++)d=this.getDataFromOption(k.value[b]),(d="-"!=d?c.getVector(f,b,d):!1)&&a.push(d);return a},_addSymbol:function(f,k,d,a,c){for(var b,e=this.series,h=this.component.polar,g=0,n=f.length;n>g;g++)b=this.getSymbolShape(this.deepMerge([e[a].data[d],e[a]]),a,e[a].data[d].value[g],g,h.getIndicatorText(c,g),f[g][0],f[g][1],this._symbol[this._radarDataCounter%this._symbol.length],k,"#fff","vertical"),b.zlevel=this.getZlevelBase(),b.z=this.getZBase()+1,t.set(b,"data",e[a].data[d]),t.set(b,"value",e[a].data[d].value),t.set(b,"dataIndex",d),t.set(b,"special",g),this.shapeList.push(b)},_addDataShape:function(f,k,d,a,c,b){var e=this.series,h=[d,this.serie],g=this.getItemStyleColor(this.deepQuery(h,"itemStyle.normal.color"),a,c,d),n=this.deepQuery(h,"itemStyle.normal.lineStyle.width"),r=this.deepQuery(h,"itemStyle.normal.lineStyle.type"),y=this.deepQuery(h,"itemStyle.normal.areaStyle.color"),F=this.deepQuery(h,"itemStyle.normal.areaStyle");f={zlevel:this.getZlevelBase(),z:this.getZBase(),style:{pointList:f,brushType:F?"both":"stroke",color:y||g||("string"==typeof k?G.alpha(k,.5):k),strokeColor:g||k,lineWidth:n,lineType:r},highlightStyle:{brushType:this.deepQuery(h,"itemStyle.emphasis.areaStyle")||F?"both":"stroke",color:this.deepQuery(h,"itemStyle.emphasis.areaStyle.color")||y||g||("string"==typeof k?G.alpha(k,.5):k),strokeColor:this.getItemStyleColor(this.deepQuery(h,"itemStyle.emphasis.color"),a,c,d)||g||k,lineWidth:this.deepQuery(h,"itemStyle.emphasis.lineStyle.width")||n,lineType:this.deepQuery(h,"itemStyle.emphasis.lineStyle.type")||r}};t.pack(f,e[a],a,d,c,d.name,this.component.polar.getIndicator(e[a].polarIndex));b&&(f.draggable=!0,this.setCalculable(f));f=new q(f);this.shapeList.push(f)},_addDropBox:function(f){var k=this.series,d=this.deepQuery(this._queryTarget,"polarIndex");if(!this._dropBoxList[d]){var a=this.component.polar.getDropBox(d);a.zlevel=this.getZlevelBase();a.z=this.getZBase();this.setCalculable(a);t.pack(a,k,f,void 0,-1);this.shapeList.push(a);this._dropBoxList[d]=!0}},ondragend:function(f,k){var d=this.series;if(this.isDragend&&f.target){var a=f.target,c=t.get(a,"seriesIndex"),a=t.get(a,"dataIndex");this.component.legend&&this.component.legend.del(d[c].data[a].name);d[c].data.splice(a,1);k.dragOut=!0;k.needRefresh=!0;this.isDragend=!1}},ondrop:function(f,k){var d=this.series;if(this.isDrop&&f.target){var a,c=f.target,b=f.dragged,e=t.get(c,"seriesIndex");a=t.get(c,"dataIndex");c=this.component.legend;if(-1===a)a={value:t.get(b,"value"),name:t.get(b,"name")},d[e].data.push(a);else{var h=m("../util/accMath");a=d[e].data[a];c&&c.del(a.name);a.name+=this.option.nameConnector+t.get(b,"name");d=t.get(b,"value");for(e=0;en;n++)c=d.polar2cartesian(h,b*Math.PI/180+e*n),g.push({vector:[c[1],-c[0]]})},_getRadius:function(){return this.parsePercent(this.polar[this._index].radius,Math.min(this.zr.getWidth(),this.zr.getHeight())/2)},_buildSpiderWeb:function(a){var c=this.polar[a],b=c.__ecIndicator,e=c.splitArea,h=c.splitLine;a=this.getCenter(a);var c=c.splitNumber,g=h.lineStyle.color,n=h.lineStyle.width,h=h.show,r=this.deepQuery(this._queryTarget,"axisLine");this._addArea(b,c,a,e,g,n,h);r.show&&this._addLine(b,a,r)},_addAxisLabel:function(a){var c,b,e,h,g,n,r,d,f,E=m("../util/accMath"),p=this.polar[a],A=this.deepQuery(this._queryTarget,"indicator"),D=p.__ecIndicator,J=this.deepQuery(this._queryTarget,"splitNumber");a=this.getCenter(a);for(var H=0;H=z;z+=f+1)h=k.merge({},e),n=E.accAdd(g.min,E.accMul(g.step,z)),h.text=this.numAddCommas(n),h.x=z*b[0]/J+Math.cos(r)*d+a[0],h.y=z*b[1]/J+Math.sin(r)*d+a[1],this.shapeList.push(new q({zlevel:this.getZlevelBase(),z:this.getZBase(),style:h,draggable:!1,hoverable:!1}))}},_buildText:function(a){for(var c,b,e,h,g,n,r=this.polar[a],d=r.__ecIndicator,f=this.deepQuery(this._queryTarget,"indicator"),k=this.getCenter(a),p=0,A=0,D=0;DMath.round(c[0])?"right":"center",null==a.margin?c=this._mapVector(c,k,1.1):(g=a.margin,p=0b;b++)c=e[b].vector,g.push(this._mapVector(c,a,1.2));c=this._getShape(g,"fill","rgba(0,0,0,0)","",1)}else"circle"==b&&(c=this._getCircle("",1,1.2,a,"fill","rgba(0,0,0,0)"));return c},_addArea:function(a,c,b,e,h,g,n){for(var r,d,f,k,p=this.deepQuery(this._queryTarget,"type"),A=0;c>A;A++)d=(c-A)/c,n&&("polygon"==p?(k=this._getPointList(a,d,b),r=this._getShape(k,"stroke","",h,g)):"circle"==p&&(r=this._getCircle(h,g,d,b,"stroke")),this.shapeList.push(r)),e.show&&(f=(c-A-1)/c,this._addSplitArea(a,e,d,f,b,A))},_getCircle:function(a,c,b,e,h,g){var n=this._getRadius();return new I({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:e[0],y:e[1],r:n*b,brushType:h,strokeColor:a,lineWidth:c,color:g},hoverable:!1,draggable:!1})},_getRing:function(a,c,b,e){var h=this._getRadius();return new G({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:e[0],y:e[1],r:c*h,r0:b*h,color:a,brushType:"fill"},hoverable:!1,draggable:!1})},_getPointList:function(a,c,b){for(var e,h=[],g=a.length,n=0;g>n;n++)e=a[n].vector,h.push(this._mapVector(e,b,c));return h},_getShape:function(a,c,b,e,h){return new t({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{pointList:a,brushType:c,color:b,strokeColor:e,lineWidth:h},hoverable:!1,draggable:!1})},_addSplitArea:function(a,c,b,e,h,g){var n,d,f;f=c.areaStyle.color;var k;c=a.length;k=this.deepQuery(this._queryTarget,"type");if("string"==typeof f&&(f=[f]),n=f.length,g=f[g%n],"polygon"==k)for(n=0;c>n;n++)k=[],d=a[n].vector,f=a[(n+1)%c].vector,k.push(this._mapVector(d,h,b)),k.push(this._mapVector(d,h,e)),k.push(this._mapVector(f,h,e)),k.push(this._mapVector(f,h,b)),d=this._getShape(k,"fill",g,"",1),this.shapeList.push(d);else"circle"==k&&(d=this._getRing(g,b,e,h),this.shapeList.push(d))},_mapVector:function(a,c,b){return[a[0]*b+c[0],a[1]*b+c[1]]},getCenter:function(a){return this.parseCenter(this.zr,this.polar[a||0].center)},_addLine:function(a,c,b){var e,h=a.length,g=b.lineStyle;b=g.color;for(var n=g.width,g=g.type,d=0;h>d;d++)e=a[d].vector,e=this._getLine(c[0],c[1],e[0]+c[0],e[1]+c[1],b,n,g),this.shapeList.push(e)},_getLine:function(a,c,b,e,h,g,d){return new B({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{xStart:a,yStart:c,xEnd:b,yEnd:e,strokeColor:h,lineWidth:g,lineType:d},hoverable:!1})},_adjustIndicatorValue:function(a){var c,b,e=this.polar[a],h=this.deepQuery(this._queryTarget,"indicator"),g=h.length,d=e.__ecIndicator;a=this._getSeriesData(a);for(var f=e.boundaryGap,k=e.splitNumber,e=e.scale,q=m("../util/smartSteps"),l=0;g>l;l++)"number"==typeof h[l].max?(c=h[l].max,b=h[l].min||0):(c=this._findValue(a,l,k,f),b=c.min,c=c.max),!e&&0<=b&&0<=c&&(b=0),!e&&0>=b&&0>=c&&(c=0),b=q(b,c,k),d[l].value={min:b.min,max:b.max,step:b.step}},_getSeriesData:function(a){for(var c,b,e,h=[],g=this.component.legend,d=0;dg||void 0===g)&&(g=a);(d>a||void 0===d)&&(d=a)}var g,d;if(a&&0!==a.length){if(1==a.length&&(d=0),1!=a.length)for(var f=0;f=this.polar[a].__ecIndicator.length)){var e;c=this.polar[a].__ecIndicator[c];a=this.getCenter(a);var d=c.vector,g=c.value.max;c=c.value.min;if("undefined"==typeof b)return a;switch(b){case "min":b=c;break;case "max":b=g;break;case "center":b=(g+c)/2}return e=g!=c?(b-c)/(g-c):.5,this._mapVector(d,a,e)}},isInside:function(a){return(a=this.getNearestIndex(a))?a.polarIndex:-1},getNearestIndex:function(a){for(var c,b,e,h,g,f,k,q,l,m=0;ma[0]-b[0]&&(h[1]+=Math.PI),0>h[1]&&(h[1]+=2*Math.PI),l=h[1]-g/180*Math.PI+2*Math.PI,Math.abs(Math.cos(l%(q/2)))*e>h[0])return{polarIndex:m,valueIndex:Math.floor((l+q/2)/q)%k}}},getIndicator:function(a){return this.polar[a||0].indicator},refresh:function(a){a&&(this.option=a,this.polar=this.option.polar,this.series=this.option.series);this.clear();this._buildShape()}},k.inherits(l,w),m("../component").define("polar",l),l});define("zrender/shape/Ring",["require","./Base","../tool/util"],function(m){var l=m("./Base"),w=function(q){l.call(this,q)};return w.prototype={type:"ring",buildPath:function(q,l){q.arc(l.x,l.y,l.r,0,2*Math.PI,!1);q.moveTo(l.x+l.r0,l.y);q.arc(l.x,l.y,l.r0,0,2*Math.PI,!0)},getRect:function(l){if(l.__rect)return l.__rect;var m;return m="stroke"==l.brushType||"fill"==l.brushType?l.lineWidth||1:0,l.__rect={x:Math.round(l.x-l.r-m/2),y:Math.round(l.y-l.r-m/2),width:2*l.r+m,height:2*l.r+m},l.__rect}},m("../tool/util").inherits(w,l),w});define("echarts/util/coordinates",["require","zrender/tool/math"],function(m){var l=m("zrender/tool/math");return{polar2cartesian:function(m,q){return[m*l.sin(q),m*l.cos(q)]},cartesian2polar:function(l,m){return[Math.sqrt(l*l+m*m),Math.atan(m/l)]}}});define("echarts/util/smartSteps",[],function(){function m(p,b,e,g){g=g||0;var h=l((b-p)/e,-1);p=l(p,-1,1);b=l(b,-1);var f=n.min(h.e,p.e,b.e);0===p.c?f=n.min(h.e,b.e):0===b.c&&(f=n.min(h.e,p.e));w(h,{c:0,e:f});w(p,h,1);w(b,h);g+=f;p=p.c;b=b.c;for(var h=(b-p)/e,f=n.pow(10,g),k=0,m=[],v=e+1;v--;)m[v]=(p+h*v)*f;if(0>g)for(v=f,k=(v=(+v).toFixed(15).split("."),v.pop().replace(/0+$/,"").length),h=+(h*f).toFixed(k),p=+(p*f).toFixed(k),b=+(b*f).toFixed(k),v=m.length;v--;)m[v]=m[v].toFixed(k),0===+m[v]&&(m[v]="0");else p*=f,b*=f,h*=f;return c=0,a=0,d=0,{min:p,max:b,secs:e,step:h,fix:k,exp:g,pnts:m}}function l(a,c,b){c=r(c%10)||2;0>c&&(a===y(a)?c=(""+E(a)).replace(/0+$/,"").length||1:(a=a.toFixed(15).replace(/0+$/,""),c=a.replace(".","").replace(/^[-0]+/,"").length,a=+a));var e=y(n.log(E(a))/n.LN10)-c+1;a=+(a*n.pow(10,-e)).toFixed(15)||0;return a=b?y(a):F(a),!a&&(e=0),(""+E(a)).length>c&&(e+=1,a/=10),{c:a,e:e}}function w(a,c,b){(c=c.e-a.e)&&(a.e+=c,a.c*=n.pow(10,-c),a.c=b?y(a.c):F(a.c))}function q(a,c,b){a.ec[e];)e++;if(!c[e])for(b/=10,a.e+=1,e=0;b>c[e];)e++;return a.c=c[e],a}function t(p,d,h){var g=h||+c.slice(-1),k=B((d-p)/g,a),z=l(d-p),x=l(p,-1,1),u=l(d,-1);w(z,k);w(x,k,1);w(u,k);if(h){var z=g,v,C;v=u.c;for(k=(u.c-x.c)/z-1;v>x.c;)k=B(k+1,a),k=k.c*n.pow(10,k.e),v=k*z,C=F(u.c/k)*k,v=C-v;z=x.c-v-(C-u.c);z>1.1*k&&(z=r(z/k/2)*k,v+=z,C+=z);x.c=v;u.c=C}else g=I(x,u);if(p===y(p)&&d===y(d)&&0<=p*d){if(g>d-p)return G(p,d,g);C=u.c-x.c;k=C/g*n.pow(10,u.e);k!==y(k)&&(k=y(k),C=k*g,d-p>C&&(k+=1,C=k*g,!h&&k*(g-1)>=d-p&&(--g,C=k*g)),C>=d-p)&&(h=C-(d-p),x.c=r(p-h/2),u.c=r(d+h/2),x.e=0,u.e=0)}h=f(p,d,x.c,u.c);x.c=h[0];u.c=h[1];if(b||e)b?(p=l(p,4,1),6d?2*d:d}function G(a,c,d){if(d=d||5,b)c=a+d;else if(e)a=c-d;else{var g=d-(c-a),h=r(a-g/2),g=r(c+g/2);c=f(a,c,h,g);a=c[0];c=c[1]}return m(a,c,d)}function f(a,c,b,d){return 0<=a&&0>b?(d-=b,b=0):0>=c&&0E(b/e)&&(b=0);1E-6>E(a/e)&&(a=0);var h,f,k=[[5,10],[10,2],[50,10],[100,2]],n=[],q=l(b-a,3);a=l(a,-1,1);var t=l(b,-1);w(a,q,1);w(t,q);e=t.c-a.c;q.c=e;for(var y=g.length;y--;){d=g[y];b=F(e/d);h=b*d-e;f=3*(h+3);f+=2*(d-g[0]+2);0===d%5&&(f-=10);for(var B=k.length;B--;)0===b%k[B][0]&&(f/=k[B][1]);[d,b,h,f].join();n[y]={secs:d,step:b,delta:h,score:f}}return n.sort(function(a,b){return a.score-b.score}),n=n[0],a.c=r(a.c-n.delta/2),t.c=r(t.c+n.delta/2),m(a.c,t.c,n.secs,q.e)}var d,a,c,b,e,h=[10,20,25,50],g=[4,5,6],n=Math,r=n.round,y=n.floor,F=n.ceil,E=n.abs;return function(f,l,m,q){d=q||{};a=d.steps||h;c=d.secs||g;m=r(+m||0)%99;f=+f||0;l=+l||0;b=e=0;"min"in d&&(f=+d.min||0,b=1);"max"in d&&(l=+d.max||0,e=1);f>l&&(l=[f,f=l][0]);q=l-f;if(b&&e)return k(f,l,m);if((m||5)>q){if(f===y(f)&&l===y(l))return G(f,l,m);if(0===q)return m=m||5,q=n.min(E(l/m),m)/2.1,b?l=f+q:e?f=l-q:(f-=q,l+=q),t(f,l,m)}return t(f,l,m)}});