text: /**
   * dojox - A version of dojox.js framework that ported to running on skylarkjs.
   * @author Hudaokeji, Inc.
   * @version v0.9.0
   * @link https://github.com/skylark-integration/dojox/
   * @license MIT
   */
  define(["dojo/_base/lang","dojo/_base/declare","dojo/_base/connect","dojo/_base/array","dojo/dom-geometry","dojo/_base/fx","dojo/fx","dojo/sniff","./Base","./_PlotEvents","./common","../axis2d/common","dojox/gfx","dojox/gfx/matrix","dojox/gfx/fx","dojox/lang/functional","dojox/lang/utils","dojo/fx/easing"],function(t,e,i,a,s,r,o,n,h,l,c,d,p,m,x,u,f,y){return e("dojox.charting.plot2d.Spider",[h,l],{defaultParams:{labels:!0,ticks:!1,fixed:!0,precision:1,labelOffset:-10,labelStyle:"default",htmlLabels:!0,startAngle:-90,divisions:3,axisColor:"",axisWidth:0,spiderColor:"",spiderWidth:0,seriesWidth:0,seriesFillAlpha:.2,spiderOrigin:.16,markerSize:3,spiderType:"polygon",animationType:y.backOut,animate:null,axisTickFont:"",axisTickFontColor:"",axisFont:"",axisFontColor:""},optionalParams:{radius:0,font:"",fontColor:""},constructor:function(e,i){this.opt=t.clone(this.defaultParams),f.updateWithObject(this.opt,i),f.updateWithPattern(this.opt,i,this.optionalParams),this.dyn=[],this.datas={},this.labelKey=[],this.oldSeriePoints={},this.animate=null===this.opt.animate?{}:this.opt.animate,this.animations={}},clear:function(){return this.inherited(arguments),this.dyn=[],this.axes=[],this.datas={},this.labelKey=[],this.oldSeriePoints={},this.animations={},this},setAxis:function(t){return t&&(void 0!=t.opt.min&&(this.datas[t.name].min=t.opt.min),void 0!=t.opt.max&&(this.datas[t.name].max=t.opt.max)),this},addSeries:function(t){var e;for(e in this.series.push(t),t.data){var i=t.data[e],a=this.datas[e];if(a)a.vlist.push(i),a.min=Math.min(a.min,i),a.max=Math.max(a.max,i);else{var s="__"+e;this.axes.push(s),this[s]=e,this.datas[e]={min:i,max:i,vlist:[i]}}}if(this.labelKey.length<=0)for(e in t.data)this.labelKey.push(e);return this},getSeriesStats:function(){return c.collectSimpleStats(this.series)},render:function(t,e){if(!this.dirty)return this;this.dirty=!1,this.cleanGroup();var i=this.group,r=this.chart.theme;if(this.resetEvents(),!this.series||!this.series.length)return this;var o,n,h,l,c,x,f,y,g,v,_,b,k,S,j,C,P,w,T,M=this.opt,F=r.axis,L=(t.width-e.l-e.r)/2,A=(t.height-e.t-e.b)/2,E=Math.min(L,A),O=M.font||F.majorTick&&F.majorTick.font||F.tick&&F.tick.font||"normal normal normal 7pt Tahoma",B=M.axisFont||F.tick&&F.tick.titleFont||"normal normal normal 11pt Tahoma",W=M.axisTickFontColor||F.majorTick&&F.majorTick.fontColor||F.tick&&F.tick.fontColor||"silver",G=M.axisFontColor||F.tick&&F.tick.titleFontColor||"black",K=M.axisColor||F.tick&&F.tick.axisColor||"silver",z=M.spiderColor||F.tick&&F.tick.spiderColor||"silver",I=M.axisWidth||F.stroke&&F.stroke.width||2,R=M.spiderWidth||F.stroke&&F.stroke.width||2,q=M.seriesWidth||F.stroke&&F.stroke.width||2,D=p.normalizedLength(p.splitFontString(B).size),H=m._degToRad(M.startAngle),J=M.spiderOrigin,N=M.divisions>=3?M.divisions:3,Q=M.markerSize,U=M.spiderType,V=M.animationType,X=M.labelOffset<-10?M.labelOffset:-10;M.labels&&(o=a.map(this.series,function(t){return t.name},this),n=u.foldl1(u.map(o,function(t){var e=r.series.font;return p._base._getTextBox(t,{font:e}).w},this),"Math.max(a, b)")/2,h=(E=Math.min(L-2*n,A-D)+X)-X),"radius"in M&&(h=(E=M.radius)-X),E/=1.2;var Y={cx:e.l+L,cy:e.t+A,r:E};for(g=this.series.length-1;g>=0;g--)if(j=this.series[g],this.dirty||j.dirty){if(j.cleanGroup(),null!==(C=j.data)&&(b=this._getObjectLength(C),(!l||l.length<=0)&&(l=[],c=[],y=[],this._buildPoints(l,b,Y,E,H,!0,t),this._buildPoints(c,b,Y,E*J,H,!0,t),this._buildPoints(y,b,Y,h,H,!1,t),N>2)))for(x=[],f=[],v=0;v<N-2;v++)x[v]=[],this._buildPoints(x[v],b,Y,E*(J+(1-J)*(v+1)/(N-1)),H,!0,t),f[v]=E*(J+(1-J)*(v+1)/(N-1))}else r.skip();var Z=i.createGroup(),$={color:K,width:I},tt={color:z,width:R};for(v=l.length-1;v>=0;--v){var et={x:(_=l[v]).x+.2*(_.x-Y.cx),y:_.y+.2*(_.y-Y.cy)},it={x:_.x+.2*(_.x-Y.cx)/2,y:_.y+.2*(_.y-Y.cy)/2};Z.createLine({x1:Y.cx,y1:Y.cy,x2:et.x,y2:et.y}).setStroke($),this._drawArrow(Z,et,it,$)}var at=i.createGroup();for(v=y.length-1;v>=0;--v){_=y[v],k=p._base._getTextBox(this.labelKey[v],{font:B}).w||0,S=this.opt.htmlLabels&&"vml"!=p.renderer?"html":"gfx";var st=d.createText[S](this.chart,at,s.isBodyLtr()||"html"!=S?_.x:_.x+k-t.width,_.y,"middle",this.labelKey[v],B,G);this.opt.htmlLabels&&this.htmlElements.push(st)}var rt=i.createGroup();if("polygon"==U){if(rt.createPolyline(l).setStroke(tt),rt.createPolyline(c).setStroke(tt),x.length>0)for(v=x.length-1;v>=0;--v)rt.createPolyline(x[v]).setStroke(tt)}else if(rt.createCircle({cx:Y.cx,cy:Y.cy,r:E}).setStroke(tt),rt.createCircle({cx:Y.cx,cy:Y.cy,r:E*J}).setStroke(tt),f.length>0)for(v=f.length-1;v>=0;--v)rt.createCircle({cx:Y.cx,cy:Y.cy,r:f[v]}).setStroke(tt);b=this._getObjectLength(this.datas);var ot=i.createGroup(),nt=0;for(var ht in this.datas){for(w=(P=this.datas[ht]).min,T=P.max-w,ft=H+2*Math.PI*nt/b,g=0;g<N;g++){var lt=w+T*g/(N-1);_=this._getCoordinate(Y,E*(J+(1-J)*g/(N-1)),ft,t),lt=this._getLabel(lt),k=p._base._getTextBox(lt,{font:O}).w||0,S=this.opt.htmlLabels&&"vml"!=p.renderer?"html":"gfx",this.opt.htmlLabels&&this.htmlElements.push(d.createText[S](this.chart,ot,s.isBodyLtr()||"html"!=S?_.x:_.x+k-t.width,_.y,"start",lt,O,W))}nt++}for(this.chart.seriesShapes={},g=this.series.length-1;g>=0;g--)if(null!==(C=(j=this.series[g]).data)){var ct=r.next("spider",[M,j]),dt=p.normalizeColor(ct.series.fill),pt={color:ct.series.fill,width:q};if(dt.a=M.seriesFillAlpha,j.dyn={fill:dt,stroke:pt},j.hidden)continue;var mt=[],xt=[];for(ht in nt=0,C){w=(P=this.datas[ht]).min,T=P.max-w;var ut=C[ht],ft=H+2*Math.PI*nt/b;_=this._getCoordinate(Y,E*(J+(1-J)*(ut-w)/T),ft,t),mt.push(_),xt.push({sname:j.name,key:ht,data:ut}),nt++}mt[mt.length]=mt[0],xt[xt.length]=xt[0];var yt=this._getBoundary(mt),gt=j.group,vt=this.oldSeriePoints[j.name],_t=this._createSeriesEntry(gt,vt||c,mt,dt,pt,E,J,Q,V);this.chart.seriesShapes[j.name]=_t,this.oldSeriePoints[j.name]=mt;var bt={element:"spider_poly",index:g,id:"spider_poly_"+j.name,run:j,plot:this,shape:_t.poly,parent:gt,brect:yt,cx:Y.cx,cy:Y.cy,cr:E,f:dt,s:i};this._connectEvents(bt);var kt={element:"spider_plot",index:g,id:"spider_plot_"+j.name,run:j,plot:this,shape:j.group};this._connectEvents(kt),a.forEach(_t.circles,function(t,e){var a={element:"spider_circle",index:e,id:"spider_circle_"+j.name+e,run:j,plot:this,shape:t,parent:gt,tdata:xt[e],cx:mt[e].x,cy:mt[e].y,f:dt,s:i};this._connectEvents(a)},this)}return this},_createSeriesEntry:function(e,s,n,h,l,c,d,p,m){for(var x=this.animate?s:n,u=e.createPolyline(x).setFill(h).setStroke(l),f=[],y=0;y<x.length;y++){var g=x[y],v=p,_=e.createCircle({cx:g.x,cy:g.y,r:v}).setFill(h).setStroke(l);f.push(_)}if(this.animate){var b=a.map(n,function(e,a){var o=s[a],n=new r.Animation(t.delegate({duration:1e3,easing:m,curve:[o.y,e.y]},this.animate)),h=u,l=f[a];return i.connect(n,"onAnimate",function(t){var e=h.getShape();e.points[a].y=t,h.setShape(e);var i=l.getShape();i.cy=t,l.setShape(i)}),n},this),k=a.map(n,function(e,a){var o=s[a],n=new r.Animation(t.delegate({duration:1e3,easing:m,curve:[o.x,e.x]},this.animate)),h=u,l=f[a];return i.connect(n,"onAnimate",function(t){var e=h.getShape();e.points[a].x=t,h.setShape(e);var i=l.getShape();i.cx=t,l.setShape(i)}),n},this);o.combine(b.concat(k)).play()}return{group:e,poly:u,circles:f}},plotEvent:function(t){"spider_plot"==t.element&&("onmouseover"!=t.type||n("ie")||t.shape.moveToFront())},tooltipFunc:function(t){return"spider_circle"==t.element?t.tdata.sname+"<br/>"+t.tdata.key+"<br/>"+t.tdata.data:null},_getBoundary:function(t){for(var e=t[0].x,i=t[0].x,a=t[0].y,s=t[0].y,r=0;r<t.length;r++){var o=t[r];e=Math.max(o.x,e),a=Math.max(o.y,a),i=Math.min(o.x,i),s=Math.min(o.y,s)}return{x:i,y:s,width:e-i,height:a-s}},_drawArrow:function(t,e,i,a){var s=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2)),r=(i.y-e.y)/s,o=(i.x-e.x)/s,n={x:i.x+s/3*-r,y:i.y+s/3*o},h={x:i.x+s/3*r,y:i.y+s/3*-o};t.createPolyline([e,n,h]).setFill(a.color).setStroke(a)},_buildPoints:function(t,e,i,a,s,r,o){for(var n=0;n<e;n++){var h=s+2*Math.PI*n/e;t.push(this._getCoordinate(i,a,h,o))}r&&t.push(this._getCoordinate(i,a,s+2*Math.PI,o))},_getCoordinate:function(t,e,i,a){var s=t.cx+e*Math.cos(i);return n("dojo-bidi")&&this.chart.isRightToLeft()&&a&&(s=a.width-s),{x:s,y:t.cy+e*Math.sin(i)}},_getObjectLength:function(e){var i=0;if(t.isObject(e))for(var a in e)i++;return i},_getLabel:function(t){return c.getLabel(t,this.opt.fixed,this.opt.precision)}})});
  //# sourceMappingURL=../../sourcemaps/charting/plot2d/Spider.js.map
  