// 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/Gauge","dojo/_base/declare dojo/_base/lang dojo/dom-style dojox/gfx dojox/gfx/matrix ./Donut ./animation/_GaugeAnimation ./supportClasses/GaugeLabelPlacement".split(" "),function(v,w,q,r,t,x,y,n){var u={getLabelInfo:function(c,a,f,e,d,b,k){var p=(void 0!==k?k:c[0].tooltip.valueLabel)+"%",g=(a.series.donutHolePercent||0)/100*f*1.5;a.series.donutMainLabelPosition===n.INSIDE&&a.series.donutShowIcons&&(g/=2);var h={series:w.mixin({},
a.series)};h.series.font=a.series.donutMainLabelFont||h.series.font;h.series.fontColor=a.series.donutMainLabelFontColor||h.series.fontColor;c=function(){if(a.series.donutMainLabelFontSize)return a.series.donutMainLabelFontSize;if(a.series.donutMainLabelPosition===n.OUTSIDE)return 30;h.series.font=h.series.font.replace(/\s\w*px/," 30px");var c=r._base._getTextBox(p,{font:h.series.font});return Math.min(100,Math.max(30,30*g/Math.max(c.w,c.h)))}();h.series.font=h.series.font.replace(/\s\w*px/," "+c+
"px");k=r._base._getTextBox(p,{font:h.series.font});var m;a.series.donutMainLabelPosition===n.OUTSIDE&&(b=t._degToRad(b),d=b+2*d*Math.PI,d=a.series.donutShowArrowIndicator?d:(b+d)/2,b=k.w*Math.cos(d),m=k.h*Math.sin(d),m={labelX:e.cx+f*Math.cos(d)-k.w/2+.8*b,labelY:e.cy+f*Math.sin(d)+k.h/3+.8*m,pushX:b,pushY:m});return{text:p,fontSize:c,labelBox:k,labelT:h,maxLabelSize:g,outsideInfo:m}}},z={renderLabel:function(c,a,f,e,d,b,k,p){var g=function(g,p){var h,m,l=u.getLabelInfo(c,a,f,d,g,k,p);a.series.donutMainLabelPosition===
n.OUTSIDE?h=b.renderLabel(e,l.outsideInfo.labelX,l.outsideInfo.labelY,l.text,l.labelT,!1,"left"):(h=d.cx-l.labelBox.w/2,m=d.cy,50!==a.series.donutArcPercent&&(m+=l.labelBox.h/3),a.series.donutShowIcons&&(m-=l.maxLabelSize/1.5),h=b.renderLabel(e,h,m,l.text,l.labelT,!1,"left"));h&&"underline"===a.series.donutMainLabelTextDecoration&&(q.set(h,"textDecoration","underline"),q.set(h,"textDecorationColor",l.labelT.series.fontColor));return{labelInfo:l,element:h}};p.push({isLabel:!0,func:g});return g}},A=
{renderArrow:function(c,a,f,e,d,b){var k=function(b){b=t._degToRad(d)+2*b*Math.PI;var g=[];g.push({x:e.cx+5*Math.cos(b+Math.PI/2),y:e.cy+5*Math.sin(b+Math.PI/2)});g.push({x:e.cx+5*Math.cos(b+Math.PI),y:e.cy+5*Math.sin(b+Math.PI)});g.push({x:e.cx+5*Math.cos(b-Math.PI/2),y:e.cy+5*Math.sin(b-Math.PI/2)});g.push({x:e.cx+f*Math.cos(b),y:e.cy+f*Math.sin(b)});return{shape:c.createPath().moveTo(g[0].x,g[0].y).lineTo(g[1].x,g[1].y).lineTo(g[2].x,g[2].y).lineTo(g[3].x,g[3].y).lineTo(g[0].x,g[0].y).setStroke(a.series.donutArrowIndicatorLineColor).setFill(a.series.donutArrowIndicatorFillColor)}};
b.push({isArrow:!0,func:k});return k}};return v([x,y],{startAngleOffset:-90,_getLabelInfo:function(c,a,f,e,d){return u.getLabelInfo(c,a,f,e,this._getSliceValueAt(d,0,a),this._getStartAngle(a))},_preprocessParams:function(c,a,f,e,d,b,k){c=this._getLabelInfo(c,a,f,b,k);a.series.donutMainLabelPosition===n.OUTSIDE&&(a=c.outsideInfo.pushX/2,c=c.outsideInfo.pushY/2,k=f,f=Math.min(e-Math.abs(a),d-Math.abs(c))-5,f=Math.max(f,k/2),b.cx-=a,b.cy-=c,this._lastRenderResults.chartShiftX=-a,this._lastRenderResults.chartShiftY=
-c);return{circle:b,r:f}},_renderAdditionalElements:function(c,a,f,e,d,b){this._lastRenderResults.ryMultiplier=this._getRYMultiplier(a);this._renderGaugeDataLabel(c,a,f,e,d,b);this._renderGaugeArrowIndicator(c,a,f,e,d,b)},_gaugeLabelElement:null,_renderGaugeDataLabel:function(c,a,f,e,d,b){a.series.donutMainLabelPosition!==n.NONE&&(c=z.renderLabel(c,a,f,e,d,this,this._getStartAngle(a),this._animationInfos)(this._getSliceValueAt(b,0,a)),this._gaugeLabelElement=c.element,a.series.donutMainLabelPosition===
n.INSIDE&&(this._lastRenderResults.maxIconSize=c.labelInfo.maxLabelSize,this._lastRenderResults.chartIconOffset=c.labelInfo.maxLabelSize/1.25))},_renderGaugeArrowIndicator:function(c,a,f,e,d,b){a.series.donutShowArrowIndicator&&A.renderArrow(e,a,f,d,this._getStartAngle(a),this._animationInfos)(this._getSliceValueAt(b,0,a))}})});