// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/geoenrichment/ReportPlayer/core/charts/chartUtils/plots/Ring","dojo/_base/lang dojo/_base/declare dojox/charting/plot2d/Base dojox/charting/plot2d/_PlotEvents dojox/charting/plot2d/common dojox/gfx dojox/gfx/matrix dojox/lang/functional dojox/lang/utils dojo/has ./animation/_RingAnimation".split(" "),function(q,x,y,z,A,v,J,m,w,E,B){var K={createPath:function(d,b,g,k,l,f,p,c,m){var n=function(c){var h={cx:g.cx,cy:g.cy,r:b},m=d.createCircle(h).setStroke({color:p.series.ringBackgroundColor||
"#DDDDDD",width:f}),e=k+2*c*Math.PI,n=g.cx+b*Math.cos(k),q=g.cy+b*Math.sin(k),v=g.cx+b*Math.cos(e),r=g.cy+b*Math.sin(e);return{shape:d.createPath().moveTo(n,q).arcTo(b,b,0,.5<c,!0,v,r).setStroke({color:l,width:f}),bgShape:m,end:e,ac:h}};m.push({sliceIndex:c,func:n});return n}},n=x([y,z,B],{_animationInfos:null,defaultParams:{labels:!0,ticks:!1,fixed:!0,precision:1,labelOffset:20,labelStyle:"default",htmlLabels:!0,radGrad:"native",fanSize:5,startAngle:0,animate:null},optionalParams:{radius:0,omitLabels:!1,
stroke:{},outline:{},shadow:{},fill:{},filter:{},styleFunc:null,font:"",fontColor:"",labelWiring:{}},_lastRenderResults:null,constructor:function(d,b){this.opt=q.clone(this.defaultParams);w.updateWithObject(this.opt,b);w.updateWithPattern(this.opt,b,this.optionalParams);this.axes=[];this.run=null;this.dyn=[];this.runFilter=[]},clear:function(){this.inherited(arguments);this.dyn=[];this.run=null;return this},setAxis:function(d){return this},addSeries:function(d){this.run=d;return this},getSeriesStats:function(){return q.delegate(A.defaultStats)},
getRequiredColors:function(){return this.run?this.run.data.length:0},getRenderResults:function(){return this._lastRenderResults},render:function(d,b){function g(a){return v._base._getTextBox(a,{font:l.series.font}).w}if(!this.dirty)return this;this.resetEvents();this.dirty=!1;this._eventSeries={};this.cleanGroup();var k=this.group,l=this.chart.theme;if(!this.run||!this.run.data.length)return this;var f=(d.width-b.l-b.r)/2,p=(d.height-b.t-b.b)/2,c=Math.min(f,p),q="font"in this.opt?this.opt.font:l.series.font,
w=J._degToRad(90),h,x=this.events(),u=this.run.data.map(function(a,b){"number"!==typeof a&&a.hidden&&(this.runFilter.push(b),a.hidden=!1);return this.runFilter.some(function(a){return a===b})?"number"===typeof a?0:{y:0,text:a.text}:a},this);this.dyn=[];"radius"in this.opt&&(c=this.opt.radius);var e={cx:b.l+f,cy:b.t+p,r:c},f=m.map(u,"x ? Math.max(x.y, 0) : 0");if(m.every(f,"\x3c\x3d 0"))return k.createCircle(e).setStroke(l.series.stroke),this.dyn=f.map(function(){return{}}),this;f=m.map(f,"/this",
m.foldl(f,"+",0));if(this.opt.labels)if(h=f.map(function(a,b){if(0>a)return"";var c=u[b];return"text"in c?c.text:this._getLabel(100*a)+"%"},this),h[0]&&-1!==h[0].indexOf(n.LABEL_SEPARATOR)){var C=0;h.forEach(function(a){a=a.split(n.LABEL_SEPARATOR)[0];a=g(a);C=Math.max(C,a)});var y=g("\x26nbsp;");h=h.map(function(a){a=a.split(n.LABEL_SEPARATOR);for(var b=Math.round((C-g(a[0]))/y),c="",e=0;e<b+4;e++)c+="\x26nbsp;";return"\x3cdiv\x3e\x3cspan\x3e"+a[0]+"\x3c/span\x3e"+c+"\x3cspan\x3e"+a[1]+"\x3c/span\x3e\x3c/div\x3e"})}else h=
h.map(function(a){return"\x3cdiv\x3e"+a+"\x3c/div\x3e"});var z=m.map(u,function(a,b){var c=[this.opt,this.run];null!=a&&"number"!==typeof a&&c.push(a);this.opt.styleFunc&&c.push(this.opt.styleFunc(a));return l.next("slice",c,!0)},this),r=0;if(this.opt.labels){h.forEach(function(a){r=Math.max(r,g(a))});var t=e.cx+c+r+b.r-d.width;0<t&&(p=e.cx-c,p>t?e.cx-=t:(t=(t-p)/2,e.cx-=p+t,c-=t))}e.cx-=e.cx-c-(d.width-(2*c+r))/2;var F=Array(f.length),D=Math.min(c/10,.5*c/f.length),G=c,c=c-D/2,H=[],I=[];this._animationInfos=
[];f.some(function(a,b){a=Math.max(a,.001);var d=u[b],f=z[b],g;g=f.series.fill;var h=K.createPath(k,c,e,w,g,D,f,b,this._animationInfos)(a);shape=h.shape;I.push(h.ac);this.dyn.push({fill:g,stroke:f.series.stroke});x&&(d={element:"slice",index:b,run:this.run,shape:shape,x:b,y:"number"===typeof d?d:d.y,cx:e.cx,cy:e.cy,cr:c},this._connectEvents(d),F[b]=d);H.push({x:e.cx,y:e.cy+c});c-=D+3;return!1},this);if(this.opt.labels){E("dojo-bidi")&&this.chart.isRightToLeft();var A=v._base._getTextBox("a",{font:q}).h;
H.forEach(function(a,b){k.createPath().moveTo(a.x-5,a.y).lineTo(a.x+G-5,a.y).setStroke(l.series.labelWiring);this.renderLabel(k,a.x+G,a.y+A/3,h[b],l,!1,"left")},this);l.series.show100PercentLabel&&this._show100PercentLabel(l,c,k,e)}var B=0;this._eventSeries[this.run.name]=m.map(u,function(a){return 0>=a?null:F[B++]});E("dojo-bidi")&&this._checkOrientation(this.group,d,b);this._lastRenderResults={labels:this.opt.labels,slicePies:I,maxLabelWidth:r};this.opt.animate&&this._renderAnimation(u,l,c,k,e,
f);return this},_show100PercentLabel:function(d,b,g,k){d={series:q.mixin({},d.series)};d.series.font=d.series.font.replace(/\s\w*px/," "+Math.min(50,.6*b)+"px");b=v._base._getTextBox("100%",{font:d.series.font});this.renderLabel(g,k.cx-b.w/2,k.cy+b.h/3,"100%",d,!1,"left").style.opacity="0.5"}});n.LABEL_SEPARATOR="\x26nbsp;";return n});