// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/Histogram/templates/Histogram.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"${css.container}" data-dojo-attach-point\x3d"_containerNode"\x3e\r\n    \x3cdiv class\x3d"${css.topLabel}" data-dojo-attach-point\x3d"_topLabelNode"\x3e\x3c/div\x3e\r\n    \x3cdiv class\x3d"${css.svgContainer}" data-dojo-attach-point\x3d"_svgContainer"\x3e\x3c/div\x3e\r\n    \x3cdiv class\x3d"${css.bottomLabel}" data-dojo-attach-point\x3d"_bottomLabelNode"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/Histogram","require ../kernel dijit/_TemplatedMixin dijit/_WidgetBase dijit/Tooltip dojo/has dojo/on dojo/string dojo/number dojo/_base/array dojo/_base/declare dojo/_base/lang dojo/dom dojo/dom-construct dojo/dom-style dojo/dom-class dojo/dom-geometry dojo/date/locale dojox/gfx dojo/i18n!../nls/jsapi dojo/text!./Histogram/templates/Histogram.html".split(" "),function(r,t,g,u,l,v,B,k,m,e,w,x,C,D,n,E,h,y,p,z,A){g=w([u,g],{declaredClass:"esri.dijit.Histogram",baseClass:"esri-histogram",
templateString:A,data:null,statistics:null,isDate:!1,css:{container:"esri-histogram-container",topLabel:"esri-histogram-top-label",svgContainer:"esri-histogram-svg-container",bottomLabel:"esri-histogram-bottom-label",surface:"esri-histogram-surface",group:"esri-histogram-group",bar:"esri-histogram-bar"},_surface:null,_countTooltips:null,_barsGroup:null,_defaultImagePadding:30,_defaultBarPadding:40,_i18n:z.widgets.histogram,constructor:function(a,d){this._countTooltips=[]},startup:function(){this.inherited(arguments);
this._syncContainerSizes();this._surface=this._generateSurface();this._barsGroup=this._generateBarsGroup();this.statistics&&(this._generateLines(),this._generateCountTooltips());this._updateLabels()},_syncContainerSizes:function(){this._nodeDimensions=h.getMarginBox(this.domNode);this._topLabelHeight=h.getMarginBox(this._topLabelNode).h;this._bottomLabelHeight=h.getMarginBox(this._bottomLabelNode).h;this._svgContainer.setAttribute("style","height: "+(this._nodeDimensions.h-(this._topLabelHeight+this._bottomLabelHeight)-
1)+"px;");this._svgContainerDimensions=h.getMarginBox(this._svgContainer)},_updateLabels:function(){var a=this.data.maxValue,d=this.data.minValue;this._topLabelNode.innerHTML=this.isDate?this._getFormattedDate(a):this._getLocaleFormattedNumber(a);this._bottomLabelNode.innerHTML=this.isDate?this._getFormattedDate(d):this._getLocaleFormattedNumber(d)},_generateSurface:function(){var a=p.createSurface(this._svgContainer,"100%","100%");a.rawNode.setAttribute("class",this.css.surface);return a},_generateBarsGroup:function(){var a=
this.data,d=this._defaultBarPadding,c,b,f,q;c=this._surface.createGroup();c.rawNode.setAttribute("class",this.css.group);b=e.map(a.bins,function(a){return"object"===typeof a?a.count:a});b.reverse();f=(this._svgContainerDimensions.h-1)/b.length;e.forEach(b,function(a,g){q=Math.round(0<a?(this._svgContainerDimensions.w-d)*(a/Math.max.apply(Math,b)):0);var e=c.createRect({width:q,height:f}).setFill("#aaa").setTransform(p.matrix.translate(1,f*g-1)).setStroke({color:"#FFF",width:2});e.rawNode.setAttribute("class",
this.css.bar);e.rawNode.setAttribute("shape-rendering","crispEdges")},this);return c},_generateLines:function(){var a=this.statistics,d=this._svgContainerDimensions.h,c,b,f;b=this.isDate?this._getFormattedDate(a.avg):this._getLocaleFormattedNumber(this._roundValueForLabel(a.avg));b=k.substitute(this._i18n.statsAvg,{avg:b});c=this._getLocaleFormattedNumber(this._roundValueForLabel(a.stddev));c=k.substitute(this._i18n.statsSD,{sd:c});f={color:"#667",style:"Dot"};this._generateLine({label:b,lineStroke:{color:"#667"},
imageURL:"esri/dijit/Histogram/images/xAvg.png",yAxisAlignment:d*(a.max-a.avg)/(a.max-a.min),imagePadding:this._defaultImagePadding});this._generateLine({label:c,lineStroke:f,imageURL:"esri/dijit/Histogram/images/sd.png",yAxisAlignment:d*(a.max-a.avg-a.stddev)/(a.max-a.min),imagePadding:this._defaultImagePadding+10});this._generateLine({label:c,lineStroke:f,imageURL:"esri/dijit/Histogram/images/sd.png",yAxisAlignment:d*(a.max-a.avg+a.stddev)/(a.max-a.min),imagePadding:this._defaultImagePadding+10})},
_generateLine:function(a){var d=this._surface,c=this._svgContainerDimensions.h,b=a.yAxisAlignment,f=a.imageURL,e=a.lineStroke,g=a.label;a=a.imagePadding;e=d.createLine({x1:0,x2:this._svgContainerDimensions.w-a,y1:b,y2:b}).setStroke(e);e.rawNode.setAttribute("shape-rendering","crispEdges");d=d.createImage({x:this._svgContainerDimensions.w-a,y:b-6,width:12,height:14,src:r.toUrl(f)});new l({connectId:[d.rawNode],label:g});c=b>c||0>b?"none":"block";n.set(e.rawNode,"display",c);n.set(d.rawNode,"display",
c)},_generateCountTooltips:function(){var a=e.map(this.data.bins,function(a){return"object"===typeof a?a.count:a});a.reverse();e.forEach(a,function(a,c){var b=k.substitute(this._i18n.count,{count:a});this._countTooltips.push(new l({connectId:[this._barsGroup.children[c].rawNode],label:b}))},this)},_getLocaleFormattedNumber:function(a){return isNaN(a)?null:m.format(a)},_getFormattedDate:function(a){return y.format(new Date(a))},_roundValueForLabel:function(a){return m.round(a,this._getRoundingPrecision(a))},
_getRoundingPrecision:function(a){return 1E3<=a?0:10<=a?2:0<=a?4:6}});v("extend-esri")&&x.setObject("dijit.Histogram",g,t);return g});