// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:jimu/dijit/templates/StatisticsChart.html":'\x3cdiv\x3e\r\n\t\x3cdiv class\x3d"results-header" data-dojo-attach-point\x3d"resultsHeader" style\x3d"margin-bottom:15px;"\x3e\r\n\t\t\x3cdiv tabindex\x3d"0" class\x3d"chart-title jimu-float-leading" data-dojo-attach-point\x3d"chartTitle"\x3e\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"paging-section jimu-float-leading"\x3e\r\n\t\t\t\x3cul tabindex\x3d"0" data-dojo-attach-point\x3d"pagingUl" data-dojo-attach-event\x3d"onclick:_onPagingUlClicked, onkeydown:_onPagingUlKeydown"\x3e\x3c/ul\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"jimu-float-trailing"\x3e\r\n\t\t\t\x3cdiv role\x3d"button" tabindex\x3d"0" class\x3d"settings jimu-float-leading" data-dojo-attach-point\x3d"settingsIcon"\x3e\x3c/div\x3e\r\n\t\t\t\x3cdiv role\x3d"button" tabindex\x3d"0" class\x3d"zoomin jimu-float-trailing" data-dojo-attach-point\x3d"zoominIcon"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"chartSection" class\x3d"chart-section"\x3e\r\n\t\t\x3ctable cellpadding\x3d"0" cellspacing\x3d"0" style\x3d"width:100%;height:100%;table-layout:fixed;"\x3e\r\n\t\t\t\x3ctbody\x3e\r\n\t\t\t\t\x3ctr\x3e\r\n\t\t\t\t\t\x3ctd class\x3d"arrow-td"\x3e\r\n\t\t\t\t\t\t\x3cdiv tabindex\x3d"0" role\x3d"button" aria-label\x3d"${nls.previous}" class\x3d"chart-section-item left-arrow arrow" data-dojo-attach-point\x3d"leftArrow" data-dojo-attach-event\x3d"onclick:_onLeftArrowClicked, onkeydown:_onLeftArrowKeydown"\x3e\x3c/div\x3e\r\n\t\t\t\t\t\x3c/td\x3e\r\n\t\t\t\t\t\x3ctd class\x3d"content-td"\x3e\r\n\t\t\t\t\t\t\x3cdiv class\x3d"chart-section-item chart-container" data-dojo-attach-point\x3d"chartContainer"\x3e\r\n\t\t\t\t\t\t\t\x3cdiv class\x3d"chart-real-container" data-dojo-attach-point\x3d"chartRealContainer"\x3e\x3c/div\x3e\r\n\t\t\t\t\t\t\t\x3cdiv tabindex\x3d"0" class\x3d"description-container" data-dojo-attach-point\x3d"descriptionContainer"\x3e/div\x3e\r\n\t\t\t\t\t\t\x3c/div\x3e\r\n\t\t\t\t\t\t\x3cdiv class\x3d"fiald-render-info" data-dojo-attach-point\x3d"faildRenderInfo"\x3e\r\n\t\t\t\t\t\t\t${nls.fieldDisplayChartTip}\r\n\t\t\t\t\t\t\x3c/div\x3e\r\n\t\t\t\t\t\x3c/td\x3e\r\n\t\t\t\t\t\x3ctd class\x3d"arrow-td"\x3e\r\n\t\t\t\t\t\t\x3cdiv tabindex\x3d"0" role\x3d"button" aria-label\x3d"${nls.next}" class\x3d"chart-section-item right-arrow arrow" data-dojo-attach-point\x3d"rightArrow" data-dojo-attach-event\x3d"onclick:_onRightArrowClicked, onkeydown:_onRightArrowKeydown"\x3e\x3c/div\x3e\r\n\t\t\t\t\t\x3c/td\x3e\r\n\t\t\t\t\x3c/tr\x3e\r\n\t\t\t\x3c/tbody\x3e\r\n\t\t\x3c/table\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"loading" data-dojo-type\x3d"jimu/dijit/LoadingIndicator" data-dojo-props\x3d\'hidden:true\'\x3e\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/on dojo/Evented dojo/Deferred dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/html dojo/_base/query dojo/_base/Color dijit/popup dijit/_WidgetBase dijit/TooltipDialog dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./templates/StatisticsChart.html esri/lang esri/graphic esri/symbols/jsonUtils esri/layers/FeatureLayer jimu/utils jimu/clientStatisticsUtils jimu/dijit/Chart jimu/dijit/_StatisticsChartSettings dojo/keys dijit/focus jimu/dijit/LoadingIndicator".split(" "),
function(u,C,D,E,k,m,p,w,v,A,F,G,H,I,J,K,L,y,B,r,z,M,N,t,x){return E([F,H,I,C],{baseClass:"jimu-dijit-statistics-chart",templateString:J,theme:"light",noMoreThanOneChartClassName:"no-more-than-one-chart",hasTitleClassName:"has-title",charts:null,paramsDijits:null,tooltipDialogs:null,currentChartIndex:-1,tempGraphics:null,maxPreviewFeaturesCount:20,tooltipColor:"green",floatNumberFieldDecimalPlace:null,popupFieldInfosObj:null,config:null,features:null,featureLayer:null,map:null,fontColor:"#333333",
isBigPreview:!1,showSettingIcon:!1,showZoomIcon:!1,zoomToFeaturesWhenClick:!1,initialChartIndex:0,postMixInProperties:function(){this.nls=window.jimuNls.statisticsChart;k.mixin(this.nls,window.jimuNls.common);this.charts=[];this.paramsDijits=[];this.tooltipDialogs=[];this.isBigPreview&&(this.showZoomIcon=!1)},postCreate:function(){this.inherited(arguments);this.showSettingIcon?(this.own(u(document.body,"click",k.hitch(this,this._onDocumentBodyClick))),this.own(u(this.settingsIcon,"keydown",k.hitch(this,
function(a){a.keyCode===t.ENTER?this._onSettingsIconClicked():a.keyCode===t.TAB&&a.shiftKey&&(a.preventDefault(),x.focus(this.pagingUl))})))):p.destroy(this.settingsIcon);this.showZoomIcon?(this.own(u(this.zoominIcon,"click",k.hitch(this,function(){this.emit("zoomin")}))),this.own(u(this.zoominIcon,"keydown",k.hitch(this,function(a){a.keyCode===t.ENTER&&this.emit("zoomin")})))):p.destroy(this.zoominIcon);this.isBigPreview&&(this.chartRealContainer.style.maxHeight="auto",p.addClass(this.domNode,"big-preview"));
this.zoominIcon.title=this.nls.enlarge;this.settingsIcon.title=this.nls.setting;p.addClass(this.domNode,this.noMoreThanOneChartClassName)},destroy:function(){this.clear();this.inherited(arguments)},resize:function(a,b){if(0<a||"string"===typeof a&&0<a.length)this.domNode.style.width=a;if(0<b||"string"===typeof b&&0<b.length)this.domNode.style.height=b;this._resize()},resizeByParent:function(){this.domNode.style.width="100%";this.domNode.style.height="100%";this._resize()},_resize:function(){this._calculateChartBox();
0<=this.currentChartIndex&&this._showChart(this.currentChartIndex)},createServerStatisticsCharts:function(a,b,c){var d=a.fields,e={type:"Table",fields:[]},f=k.clone(c),h=c.mode;"category"===h?(f.valueFields=[],e.fields=m.map(c.valueFields,k.hitch(this,function(l){var g=c.operation;"average"===g&&(g="avg");var n=l+"_"+r.upperCaseString(g);l=l+"_"+r.upperCaseString(g);f.valueFields.push(n);return{name:n,type:"esriFieldTypeDouble",alias:l}})),m.some(d,k.hitch(this,function(l){return l.name===c.categoryField?
(e.fields.push(l),!0):!1}))):"count"===h?(f.mode="feature",f.labelField=c.categoryField,a=a.fields[0].name+"_count",f.valueFields=[a],m.some(d,k.hitch(this,function(l){return l.name===c.categoryField?(e.fields.push(l),!0):!1})),e.fields.push({name:a,type:"esriFieldTypeInteger",alias:this.nls.count})):"field"===h&&(f.valueFields=[],e.fields=m.map(c.valueFields,k.hitch(this,function(l){var g=c.operation;"average"===g&&(g="avg");var n=l+"_"+r.upperCaseString(g);l=l+"_"+r.upperCaseString(g);f.valueFields.push(n);
return{name:n,type:"esriFieldTypeDouble",alias:l}})));return this._getLoadedLayer(e).then(k.hitch(this,function(l){this._createChartsAsync({featureLayer:l,features:b,config:f})}))},createClientCharts:function(a,b,c,d,e){e&&(this.featureLayerForChartSymbologyChart=e);return this._getLoadedLayer(a).then(k.hitch(this,function(f){this._createChartsAsync({featureLayer:f,features:b,config:c,popupFieldInfosObj:d})}))},_getLoadedLayer:function(a){var b=new D,c=null;c="string"===typeof a?new B(a):"esri.layers.FeatureLayer"===
a.declaredClass?a:new B({layerDefinition:k.clone(a),featureSet:null});c.loaded?b.resolve(c):this.own(u(c,"load",k.hitch(this,function(){b.resolve(c)})));return b},_createChartsAsync:function(a){setTimeout(k.hitch(this,function(){this._createCharts(a)}),0)},_createCharts:function(a){try{this.loading.hide();this.clear();var b=!1;a.features&&(b=!!a.features.isSelectedFeatures,a.features=m.filter(a.features,k.hitch(this,function(g){return!!g.attributes})));this.config=a.config;this.features=a.features;
this.featureLayer=a.featureLayer;this.popupFieldInfosObj=a.popupFieldInfosObj?a.popupFieldInfosObj:{};this.config.highLightColor||(this.config.highLightColor=b?"#ff0000":"#00ffff");this._calculateDecimalPlaceForFloatField();this.chartTitle.innerHTML=r.stripHTML(this.config.name||"");this.chartTitle.title=this.chartTitle.innerHTML;this.chartTitle.title?p.addClass(this.domNode,this.hasTitleClassName):p.removeClass(this.domNode,this.hasTitleClassName);if(this.config.description){p.setStyle(this.descriptionContainer,
"display","block");var c=r.stripHTML(this.config.description);this.descriptionContainer.innerHTML=c;this.descriptionContainer.title=c}else this.descriptionContainer.innerHTML="",this.descriptionContainer.title="",p.setStyle(this.descriptionContainer,"display","none");1>=a.config.types.length?p.addClass(this.domNode,this.noMoreThanOneChartClassName):p.removeClass(this.domNode,this.noMoreThanOneChartClassName);var d=this._calculateChartBox(),e=d.w+"px",f=d.h+"px",h={};(a.config&&a.config.types||[]).forEach(function(g){if(g=
g&&g.type)"column"===g?h.column=this.nls.columnChart:"bar"===g?h.bar=this.nls.barChart:"line"===g?h.line=this.nls.lineChart:"pie"===g&&(h.pie=this.nls.pieChart)}.bind(this));var l=m.map(a.config.types,k.hitch(this,function(g){var n=p.create("div",{"class":"chart-div",style:{width:e,height:f}},this.chartRealContainer),q=g.type,O=p.toDom("\x3cli class\x3d'paging-li'\x3e\x3ca tabindex\x3d'0' role\x3d'link' aria-label\x3d'"+h[q]+"'class\x3d'paging-a'\x3e\x3c/a\x3e\x3c/li\x3e");p.place(O,this.pagingUl);
g=g.display;g.backgroundColor||(g.backgroundColor="transparent");g.hasOwnProperty("showLegend")||(g.showLegend=!1);g.legendTextColor||(g.legendTextColor=this.fontColor);"pie"===q?(g.hasOwnProperty("showDataLabel")||(g.showDataLabel=!0),g.dataLabelColor||(g.dataLabelColor=this.fontColor)):(g.hasOwnProperty("showHorizontalAxis")||(g.showHorizontalAxis=!0),g.horizontalAxisTextColor||(g.horizontalAxisTextColor=this.fontColor),g.hasOwnProperty("showVerticalAxis")||(g.showVerticalAxis=!0),g.verticalAxisTextColor||
(g.verticalAxisTextColor=this.fontColor));return n}));b=null;"feature"===this.config.mode?b=this._createFeatureModeCharts(a,l):"category"===this.config.mode?b=this._createCategoryModeCharts(a,l):"count"===this.config.mode?b=this._createCountModeCharts(a,l):"field"===this.config.mode&&(b=this._createFieldModeCharts(a,l));this.charts=b.charts;this.paramsDijits=b.paramsDijits;this.tooltipDialogs=m.map(this.paramsDijits,k.hitch(this,function(g){var n=p.create("div");g.placeAt(n);return new G({content:n})}));
a=0;0<=this.initialChartIndex&&this.charts.length>=this.initialChartIndex+1&&(a=this.initialChartIndex);this._showChart(a)}catch(g){console.error(g)}},_calculateChartBox:function(){var a=!!this.config.description,b=p.getContentBox(this.domNode).h,c=b;0<this.resultsHeader.clientHeight&&(c=p.getMarginBox(this.resultsHeader),c=b-c.h);var d=0;a&&(d=parseInt(.15*b,10),c-=d);a=60;c<a&&(a=c);p.setStyle(this.leftArrow,"height",a+"px");p.setStyle(this.rightArrow,"height",a+"px");p.setStyle(this.chartRealContainer,
"height",c+"px");p.setStyle(this.descriptionContainer,"max-height",d+"px");p.setStyle(this.faildRenderInfo,"height",c+"px");return p.getContentBox(this.chartRealContainer)},_calculateDecimalPlaceForFloatField:function(){this.floatNumberFieldDecimalPlace={};var a=[];this.config.labelField&&a.push(this.config.labelField);this.config.categoryField&&a.push(this.config.categoryField);this.config.valueFields&&(a=a.concat(this.config.valueFields));var b=m.filter(a,k.hitch(this,function(d){return this._isFloatNumberField(d)})),
c={};m.forEach(b,k.hitch(this,function(d){c[d]=[]}));(a=this.features)&&0<a.length&&m.forEach(a,k.hitch(this,function(d){var e=d.attributes;e&&m.forEach(b,k.hitch(this,function(f){var h=e[f];"number"===typeof h&&c[f].push(h)}))}));m.forEach(b,k.hitch(this,function(d){this.floatNumberFieldDecimalPlace[d]=0;var e=c[d];if(0<e.length)try{var f=this._getBestDecimalPlace(e);this.floatNumberFieldDecimalPlace[d]=f}catch(h){this.floatNumberFieldDecimalPlace[d]=0,console.error(h)}this.popupFieldInfosObj&&(e=
this.popupFieldInfosObj[d])&&e.format&&0<=e.format.places&&(this.floatNumberFieldDecimalPlace[d]=e.format.places)}))},_onDocumentBodyClick:function(a){if(0<=this.currentChartIndex&&this.tooltipDialogs){var b=this.tooltipDialogs[this.currentChartIndex];if(b){var c=!!b.isOpendNow;this._hideAllTooltipDialogs();var d=a.target||a.srcElement;d===this.leftArrow||d===this.rightArrow||p.hasClass(d,"paging-a")||p.hasClass(d,"paging-li")||(d===this.settingsIcon?c?this._hideTooltipDialog(b):this._showTooltipDialog(b):
(a=d===b.domNode,d=p.isDescendant(d,b.domNode),a||d?c?this._showTooltipDialog(b):this._hideTooltipDialog(b):this._hideTooltipDialog(b)))}else this._hideAllTooltipDialogs()}else this._hideAllTooltipDialogs()},_onSettingsIconClicked:function(){var a=this.tooltipDialogs[this.currentChartIndex];a&&(a.isOpendNow?(this._hideTooltipDialog(a),x.focus(this.settingsIcon)):(this._showTooltipDialog(a),(a=this.paramsDijits[this.currentChartIndex])&&x.focus(a.domNode)))},clear:function(){this.featureLayer=this.features=
this.config=null;this.chartTitle.innerHTML="";this.chartTitle.title="";this.currentChartIndex=-1;this.popupFieldInfosObj=this.floatNumberFieldDecimalPlace=null;w("li",this.pagingUl).removeClass("selected");this.charts||(this.charts=[]);this.paramsDijits||(this.paramsDijits=[]);this.tooltipDialogs||(this.tooltipDialogs=[]);for(var a=0;a<this.charts.length;a++)this.charts[a]&&this.charts[a].destroy(),this.charts[a]=null,this.paramsDijits[a]&&this.paramsDijits[a].destroy(),this.paramsDijits[a]=null,
this.tooltipDialogs[a]&&this.tooltipDialogs[a].destroy(),this.tooltipDialogs[a]=null;this.charts=[];this.paramsDijits=[];this.tooltipDialogs=[];p.empty(this.pagingUl);p.empty(this.chartRealContainer);p.empty(this.descriptionContainer);p.addClass(this.domNode,this.noMoreThanOneChartClassName)},_showFialdRenderInfo:function(){p.addClass(this.chartSection,"render-faild")},_hideFialdRenderInfo:function(){p.removeClass(this.chartSection,"render-faild")},_showChart:function(a){this.currentChartIndex=-1;
var b=w(".chart-div",this.chartRealContainer);b.style({display:"none"});var c=w("li",this.pagingUl);c.removeClass("selected");if(!(0>a)){if(b=b[a])this.currentChartIndex=a,p.setStyle(b,"display","block");(c=c[a])&&p.addClass(c,"selected");this.charts&&0<this.charts.length&&(c=this.charts[a])&&this._handlePieChartDisplay(c);if(!this.isBigPreview&&(c=null,this.charts&&0<this.charts.length&&(c=this.charts[a]))){a=this._calculateChartBox();var d=p.getContentBox(b);if(a.w!==d.w||a.h!==d.h)this.loading.show(),
d=a.w+"px",a=a.h+"px",p.setStyle(b,"width",d),p.setStyle(b,"height",a),c.resize(d,a),this.loading.hide()}}},_handlePieChartDisplay:function(a){var b=!1;a&&a.config&&"pie"===a.config.type&&(a=a.config.labels)&&150<a.length&&(b=!0);b?this._showFialdRenderInfo():this._hideFialdRenderInfo()},_hideAllTooltipDialogs:function(){this.tooltipDialogs&&0<this.tooltipDialogs.length&&m.forEach(this.tooltipDialogs,k.hitch(this,function(a){this._hideTooltipDialog(a)}))},_hideTooltipDialog:function(a){a&&(A.close(a),
a.isOpendNow=!1)},_showTooltipDialog:function(a){a&&(A.open({popup:a,around:this.settingsIcon}),a.isOpendNow=!0)},_onPagingUlKeydown:function(a){a.keyCode!==t.TAB||a.shiftKey||(a.preventDefault(),x.focus(this.settingsIcon));if(a.keyCode===t.RIGHT_ARROW||a.keyCode===t.DOWN_ARROW)this._onRightArrowClicked(a),this._focusPagingLink();if(a.keyCode===t.LEFT_ARROW||a.keyCode===t.UP_ARROW)this._onLeftArrowClicked(a),this._focusPagingLink()},_focusPagingLink:function(){var a=w(".paging-li:nth-child("+(this.currentChartIndex+
1)+")",this.pagingUl)[0];(a=a&&a.firstChild)&&x.focus(a)},_onPagingUlClicked:function(a){a.stopPropagation();this._hideAllTooltipDialogs();a=a.target||a.srcElement;if("a"===a.tagName.toLowerCase()){var b=w("a",this.pagingUl);a=m.indexOf(b,a);0<=a&&this._showChart(a)}},_onLeftArrowClicked:function(a){a.stopPropagation();this._hideAllTooltipDialogs();a=(this.currentChartIndex-1+this.charts.length)%this.charts.length;0<=a&&this._showChart(a)},_onLeftArrowKeydown:function(a){a.keyCode===t.ENTER&&this._onLeftArrowClicked(a)},
_onRightArrowClicked:function(a){a.stopPropagation();this._hideAllTooltipDialogs();a=(this.currentChartIndex+1+this.charts.length)%this.charts.length;0<=a&&this._showChart(a)},_onRightArrowKeydown:function(a){a.keyCode===t.ENTER&&this._onRightArrowClicked(a)},_getHighLightMarkerSymbol:function(){var a=y.fromJson({color:[255,255,255,0],size:18,angle:0,xoffset:0,yoffset:0,type:"esriSMS",style:"esriSMSSquare",outline:{color:[0,0,128,255],width:.75,type:"esriSLS",style:"esriSLSSolid"}});a.setSize(30);
a.outline.setColor(new v(this.config.highLightColor));return a},_getHighLightLineSymbol:function(a){var b=y.fromJson({color:[0,255,255,255],width:1.5,type:"esriSLS",style:"esriSLSSolid"});b.setColor(new v(a||this.config.highLightColor));return b},_getDefaultHighLightFillSymbol:function(){var a=y.fromJson({color:[0,255,255,128],outline:{color:[0,255,255,255],width:1.5,type:"esriSLS",style:"esriSLSSolid"},type:"esriSFS",style:"esriSFSSolid"});a.outline.setColor(new v(this.config.highLightColor));return a},
_getVisualVariableByType:function(a,b){return b&&(b=m.filter(b,function(c){return c.type===a&&!c.target}),b.length)?b[0]:null},_getSymbolByRenderer:function(a,b){var c=this._getDefaultHighLightFillSymbol(),d=this._getVisualVariableByType("colorInfo",a.visualVariables);if(d){if(a=a.getColor(b,{colorInfo:d}))a=k.clone(a),c.setColor(a)}else c=a.getSymbol(b);return c},_getHighLightFillSymbol:function(a,b,c){var d=null,e=b.symbol;d=a.renderer;!e&&d&&(e=this._getSymbolByRenderer(d,b));e&&"function"===typeof e.setOutline?
(d=y.fromJson(e.toJson()),b=1.5,e.outline&&0<e.outline.width&&(b=e.outline.width+1),c=this._getHighLightLineSymbol(c?"#ff0000":this.config.highLightColor),c.setWidth(b),d.setOutline(c)):d=this._getDefaultHighLightFillSymbol();return d},_zoomToGraphics:function(a){if(this.map&&this.featureLayer&&this.featureLayer.visible){var b;a&&0<a.length&&(b=m.filter(a,function(c){c=c.geometry;return"point"!==c.type?!0:r.isVaildPointGeometry(c)}.bind(this)));if(b&&0<b.length){a=r.toFeatureSet(b);try{r.zoomToFeatureSet(this.map,
a)}catch(c){console.error(c)}}}},_removeTempGraphics:function(){if(this.featureLayer&&this.tempGraphics&&0<this.tempGraphics.length)for(;0<this.tempGraphics.length;)this.featureLayer.remove(this.tempGraphics[0]),this.tempGraphics.splice(0,1);this.tempGraphics=null},_mouseOverChartItem:function(a){this._removeTempGraphics();m.forEach(a,k.hitch(this,function(e){e._originalSymbol=e.symbol}));if(this.featureLayer&&this.featureLayer.getMap()&&this.featureLayer.visible){var b=r.getTypeByGeometryType(this.featureLayer.geometryType),
c=null;if("point"===b)c=this._getHighLightMarkerSymbol(),this.tempGraphics=[],m.forEach(a,k.hitch(this,function(e){e=new L(e.geometry,c);this.tempGraphics.push(e);this.featureLayer.add(e)}));else if("polyline"===b)c=this._getHighLightLineSymbol(),m.forEach(a,k.hitch(this,function(e){e.setSymbol(c)}));else if("polygon"===b){var d=this.featureLayer.getSelectedFeatures()||[];m.forEach(a,k.hitch(this,function(e){var f=0<=d.indexOf(e);f=this._getHighLightFillSymbol(this.featureLayer,e,f);e.setSymbol(f)}));
this.features.length!==a.length&&"polygon"===b&&(m.forEach(a,k.hitch(this,function(e){this.featureLayer.remove(e)})),m.forEach(a,k.hitch(this,function(e){this.featureLayer.add(e)})))}}},_mouseOutChartItem:function(a){this._removeTempGraphics();m.forEach(a,k.hitch(this,function(b){b.setSymbol(b._originalSymbol||null)}))},_isNumber:function(a){return"[object number]"===Object.prototype.toString.call(a).toLowerCase()},_tryLocaleNumber:function(a,b){var c=a;if(K.isDefined(a)&&isFinite(a))try{if(b&&this._isNumberField(b)){var d=
this.popupFieldInfosObj[b];var e=d&&k.exists("format.places",d)?r.localizeNumberByFieldInfo(a,d):r.localizeNumber(a)}else e=a;"string"===typeof e&&(c=e)}catch(f){console.error(f)}return c+""},_getBestDisplayValue:function(a,b){var c=this._tryLocaleNumber(b,a);if(this.featureLayer.typeIdField===a){var d=this.featureLayer.types;if(d&&0<d.length&&(d=m.filter(d,k.hitch(this,function(e){return e.id===b})),0<d.length))return c=d[0].name}(a=this._getFieldInfo(a))&&a.domain&&(a=a.domain.codedValues)&&0<a.length&&
m.some(a,function(e){return e.code===b?(c=e.name,!0):!1});return c},_getFieldAliasArray:function(a){return m.map(a,k.hitch(this,function(b){return this._getFieldAlias(b)}))},_getFieldAlias:function(a){var b=a;(a=this._getFieldInfo(a))&&(b=a.alias||b);return b},_getFieldInfo:function(a){if(this.featureLayer)for(var b=this.featureLayer.fields,c=0;c<b.length;c++)if(b[c].name===a)return b[c];return null},_isNumberField:function(a){var b=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle",
"esriFieldTypeDouble"];return m.some(this.featureLayer.fields,k.hitch(this,function(c){return c.name===a&&0<=b.indexOf(c.type)}))},_isFloatNumberField:function(a){var b=["esriFieldTypeSingle","esriFieldTypeDouble"];return m.some(this.featureLayer.fields,k.hitch(this,function(c){return c.name===a&&0<=b.indexOf(c.type)}))},_isDateField:function(a){return(a=this._getFieldInfo(a))?"esriFieldTypeDate"===a.type:!1},_getBestDecimalPlace:function(a){var b=0,c={};m.forEach(a,function(f){f=f.toString().split(".");
var h=null;1===f.length?h=0:2===f.length&&(h=f[1].length);null!==h&&(c[h]=void 0===c[h]?1:c[h]+1)});a=null;for(var d in c){d=parseInt(d,10);var e=c[d];a?e>a.value&&(a={key:d,value:e}):a={key:d,value:e}}a&&(b=parseInt(a.key,10));return b},_getFloatNumberFieldDecimalPlace:function(a){var b=0;this.floatNumberFieldDecimalPlace&&(a=this.floatNumberFieldDecimalPlace[a],"number"===typeof a&&(b=a));return b},_getBestValueForFloatNumberField:function(a,b){b=this._getFloatNumberFieldDecimalPlace(b);a=a.toFixed(b);
return parseFloat(a)},_getColors:function(a,b){var c=[];a=k.clone(a);if(2===a.colors.length)c=this._createGradientColors(a.colors[0],a.colors[a.colors.length-1],b);else{for(var d=Math.ceil(b/a.colors.length),e=0;e<d;e++)c=c.concat(a.colors);c=c.slice(0,b)}return c},_createGradientColors:function(a,b,c){var d=[];a=new v(a);var e=new v(b);b=(e.r-a.r)/c;var f=(e.g-a.g)/c;e=(e.b-a.b)/c;for(var h=new v,l=0,g=0,n=0,q=0;q<c;q++)l=parseInt(a.r+b*q,10),g=parseInt(a.g+f*q,10),n=parseInt(a.b+e*q,10),h.setColor([l,
g,n]),d.push(h.toHex());return d},_createParamsDijit:function(a,b,c){a=new N({isInWidget:this.map?!0:!1,type:a,config:b});this.own(u(a.domNode,"keydown",k.hitch(this,function(d){d.keyCode===t.ESCAPE&&this._onSettingsIconClicked()})));a._updateLegendDisplayByMode(c);return a},_createJimuChart:function(a,b,c,d,e){var f=e.type,h=this._createParamsDijit(f,e.display,b),l=h.getConfig();l&&k.mixin(e.display,l);var g=this._getBasicChartOptionsByStatisticsInfo(b,c,d,f);this._udpateJimuChartDisplayOptions(g,
e);var n=new M({chartDom:a,config:{type:f||"column",labels:[],series:[{data:[]}]}});n.placeAt(a);n.resize();n.updateConfig(g);this._bindChartEvent(n,b,d);this.showSettingIcon&&this.own(u(h,"change",k.hitch(this,function(){h.showShelter();if(n){var q=h.getConfig();k.mixin(e.display,q);this._udpateJimuChartDisplayOptions(g,e);n.updateConfig(g)}h.hideShelter()})));return[n,h]},_udpateJimuChartDisplayOptions:function(a,b){var c=b.type;b=b.display;this._settingAxisDisplay(a,b,c);a.type=c;a.dataZoom=["inside",
"slider"];a.confine=!0;a.backgroundColor=b.backgroundColor;a.color=b.colors;var d={show:b.showLegend,textStyle:{}};b.legendTextColor&&(d.textStyle.color=b.legendTextColor);b.legendTextSize&&(d.textStyle.fontSize=b.legendTextSize);a.legend=d;d={show:b.showDataLabel,textStyle:{}};b.dataLabelColor&&(d.textStyle.color=b.dataLabelColor);b.dataLabelSize&&(d.textStyle.fontSize=b.dataLabelSize);a.dataLabel=d;"pie"===c&&(a.innerRadius=b.innerRadius);return a},_settingAxisDisplay:function(a,b,c){if(!(0>["column",
"bar","line"].indexOf(c))){var d={show:b.showHorizontalAxis,textStyle:{}};b.horizontalAxisTextColor&&(d.textStyle.color=b.horizontalAxisTextColor);b.horizontalAxisTextSize&&(d.textStyle.fontSize=b.horizontalAxisTextSize);a.xAxis=d;d={show:b.showVerticalAxis,textStyle:{}};b.verticalAxisTextColor&&(d.textStyle.color=b.verticalAxisTextColor);b.verticalAxisTextSize&&(d.textStyle.fontSize=b.verticalAxisTextSize);a.yAxis=d;b.stack||(b.stack=!1);if("column"===c||"bar"===c||"line"===c&&b.area)a.stack=b.stack;
"line"!==c||b.area||(b.area=!1);"line"===c&&(a.area=b.area);a.axisPointer=!0;a.scale=!1}},_getBasicChartOptionsByStatisticsInfo:function(a,b,c,d){return"feature"===a||"category"===a?this._getCategoryModeChartOptionsByStatisticsInfo(b,c,d):"count"===a?this._getCountModeChartOptionsByStatisticsInfo(c,d):"field"===a?this._getFieldModeChartOptionByStatisticsInfo(c,d):null},_bindChartEvent:function(a,b,c){if(this.map&&0!==c.length){var d=k.hitch(this,function(f){if("series"===f.componentType){var h=null;
if("field"===b)h=this.features;else{var l=c[f.dataIndex];l&&(h=l.dataFeatures)}h&&("mouseover"===f.type?this._mouseOverChartItem(h):"mouseout"===f.type?this._mouseOutChartItem(h):"click"===f.type&&this.zoomToFeaturesWhenClick&&this._zoomToGraphics(h))}}),e=[{name:"mouseover",callback:d},{name:"mouseout",callback:d}];this.zoomToFeaturesWhenClick&&e.push({name:"click",callback:d});m.forEach(e,k.hitch(this,function(f){a.chart.on(f.name,f.callback)}))}},_createFeatureModeCharts:function(a,b){var c=[],
d=[],e=a.config,f={layerDefinition:this.featureLayer,popupFieldInfosObj:this.popupFieldInfosObj,features:a.features,labelField:e.labelField,valueFields:e.valueFields,sortOrder:e.sortOrder,maxLabels:e.maxLabels,useLayerSymbology:e.useLayerSymbology};this.featureLayerForChartSymbologyChart&&(f.featureLayerForChartSymbologyChart=this.featureLayerForChartSymbologyChart);var h=z.getFeatureModeStatisticsInfo(f);m.forEach(e.types,k.hitch(this,function(l,g){try{var n=this._createJimuChart(b[g],"feature",
f,h,l);c.push(n[0]);d.push(n[1])}catch(q){console.error(q)}}));return{charts:c,paramsDijits:d}},_createCategoryModeCharts:function(a,b){var c=[],d=[],e=a.config,f={layerDefinition:this.featureLayer,popupFieldInfosObj:this.popupFieldInfosObj,features:a.features,categoryField:e.categoryField,valueFields:e.valueFields,operation:a.config.operation,sortOrder:e.sortOrder,dateConfig:e.dateConfig,maxLabels:e.maxLabels,nullValue:e.nullValue,useLayerSymbology:e.useLayerSymbology,splitField:e.splitField};this.featureLayerForChartSymbologyChart&&
(f.featureLayerForChartSymbologyChart=this.featureLayerForChartSymbologyChart);var h=z.getCategoryModeStatisticsInfo(f);m.forEach(e.types,k.hitch(this,function(l,g){try{var n=this._createJimuChart(b[g],"category",f,h,l);c.push(n[0]);d.push(n[1])}catch(q){console.error(q)}}));return{charts:c,paramsDijits:d}},_getSplitedSeriesForCategoryOrCountMode:function(a,b){var c={type:b,labels:[],series:[]},d=[];a.forEach(function(f){if(f=f.splitedValueFields)f=f.map(function(h){return h.field}),d=d.concat(f)});
var e=r.uniqueArray(d);c.series=m.map(e,k.hitch(this,function(f){for(var h=[],l=0;l<a.length;l++)h[l]=null;return{name:f,type:b,data:h}}));m.forEach(a,k.hitch(this,function(f,h){var l="";f.category?l=f.category:f.fieldValue&&(l=f.fieldValue);c.labels.push(l);f.splitedValueFields.forEach(function(g){c.series.forEach(function(n){if(n.name===g.field)if("undefined"!==typeof f.color){var q=this._getSerieData(f,g.value);n.data[h]=q}else n.data[h]=g.value}.bind(this))}.bind(this))}));return c},_getCategoryModeChartOptionsByStatisticsInfo:function(a,
b,c){a=this._getFieldAliasArray(a.valueFields);var d=null;d={type:c,labels:[],series:[]};d.series=m.map(a,k.hitch(this,function(e){return{name:e,type:c,data:[]}}));m.forEach(b,k.hitch(this,function(e){d.labels.push(e.category);for(var f=0;f<e.valueFields.length;f++){var h=e.valueFields[f];"undefined"!==typeof e.color?(h=this._getSerieData(e,h),d.series[f].data.push(h)):d.series[f].data.push(h)}}));return d},_getSeriesOfRadar:function(a){a=a.map(function(b){return{name:b.category,value:b.valueFields}});
return[{type:"radar",data:a}]},_isAllFalseColor:function(a){return a.every(function(b){return!b.color})},_getSerieData:function(a,b){a.color||(a.color="transparent");return{value:b,itemStyle:{normal:{color:a.color},emphasis:{color:a.color}}}},_createCountModeCharts:function(a,b){var c=[],d=[],e=a.config,f={layerDefinition:this.featureLayer,popupFieldInfosObj:this.popupFieldInfosObj,features:a.features,categoryField:e.categoryField,sortOrder:e.sortOrder,dateConfig:e.dateConfig,maxLabels:e.maxLabels,
useLayerSymbology:e.useLayerSymbology,splitField:e.splitField};this.featureLayerForChartSymbologyChart&&(f.featureLayerForChartSymbologyChart=this.featureLayerForChartSymbologyChart);var h=z.getCountModeStatisticsInfo(f);m.forEach(e.types,k.hitch(this,function(l,g){try{var n=this._createJimuChart(b[g],"count",f,h,l);c.push(n[0]);d.push(n[1])}catch(q){console.error(q)}}));return{charts:c,paramsDijits:d}},_getCountModeChartOptionsByStatisticsInfo:function(a,b){var c={type:b,labels:[],series:[{name:"",
type:b,data:[]}]};m.forEach(a,k.hitch(this,function(d){var e=d.count;c.labels.push(d.fieldValue);"undefined"!==typeof d.color?(d=this._getSerieData(d,e),c.series[0].data.push(d)):c.series[0].data.push(e)}));return c},_createFieldModeCharts:function(a,b){var c=[],d=[],e=a.config,f={layerDefinition:this.featureLayer,popupFieldInfosObj:this.popupFieldInfosObj,features:a.features,valueFields:e.valueFields,operation:e.operation,sortOrder:e.sortOrder,maxLabels:e.maxLabels,nullValue:e.nullValue},h=z.getFieldModeStatisticsInfo(f);
m.forEach(e.types,k.hitch(this,function(l,g){try{var n=this._createJimuChart(b[g],"field",f,h,l);c.push(n[0]);d.push(n[1])}catch(q){console.error(q)}}));return{charts:c,paramsDijits:d}},_getFieldModeChartOptionByStatisticsInfo:function(a,b){var c={type:b,labels:[],series:[{name:"",type:b,data:[]}]};m.forEach(a,k.hitch(this,function(d){var e=this._getFieldAlias(d.label);c.labels.push(e);c.series[0].data.push(d.value)}));return c}})});