// 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/_StatisticsChartSettings.html":'\x3cdiv tabIndex\x3d"0"\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"divAxisX" class\x3d"setting-item"\x3e\x3c/div\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"divAxisY" class\x3d"setting-item"\x3e\x3c/div\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"divLegend" class\x3d"setting-item"\x3e\x3c/div\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"divPieLabel" class\x3d"setting-item"\x3e\x3c/div\x3e\r\n\t\x3cdiv\x3e\r\n\t\t\x3cdiv tabindex\x3d"0" aria-label\x3d"${nls.color}" class\x3d"color-tip"\x3e${nls.color}\x3c/div\x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"singleColorSection" class\x3d"single-color-section"\x3e\r\n\t\t\t\x3cdiv data-dojo-attach-point\x3d"colorDiv" class\x3d"single-color-div"\x3e\x3c/div\x3e\r\n\t\t\t\x3cdiv data-dojo-attach-point\x3d"paletteContainer" class\x3d"palette-container"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"multiColorSection" class\x3d"multi-color-section"\x3e\r\n\t\t\t\x3cdiv class\x3d"colorful-section"\x3e\r\n\t\t\t\t\x3cdiv data-dojo-attach-point\x3d"colorfulContainer"\x3e\x3c/div\x3e\r\n\t\t\t\x3c/div\x3e\r\n\t\t\t\x3cdiv class\x3d"monochromatic-section"\x3e\r\n\t\t\t\t\x3cdiv data-dojo-attach-point\x3d"monochromaticContainer"\x3e\x3c/div\x3e\r\n\t\t\t\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv class\x3d"shelter" data-dojo-attach-point\x3d"shelter"\x3e\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/html dojo/_base/query dojo/_base/Color dojo/on dojo/Evented dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./templates/_StatisticsChartSettings.html dijit/ColorPalette jimu/dijit/CheckBox".split(" "),function(t,c,q,b,r,h,k,u,v,w,x,y,z,p){return t([v,w,x,u],{baseClass:"jimu-dijit-statistics-chart-settings",templateString:y,colors:{c1:"#5d9cd3 #eb7b3a #a5a5a5 #febf29 #4673c2 #72ad4c".split(" "),c2:"#5d9cd3 #a5a5a5 #4673c2 #285f8f #636363 #274577".split(" "),
c3:"#eb7b3a #febf29 #72ad4c #9c4618 #987214 44682e".split(" "),c4:"#72ad4c #4673c2 #febf29 #44682e #274577 #987214".split(" "),g1:["#43729b","#c4d5ea"],g2:["#ac5928","#f5ccbf"],g3:["#787878","#d8d8d8"],g4:["#bb8b1b","#fee1be"],g5:["#30538d","#c0c9e3"],g6:["#517e36","#c9dbc2"],g7:["#c4d5ea","#43729b"],g8:["#f5ccbf","#ac5928"],g9:["#d8d8d8","#787878"],g10:["#fee1be","#bb8b1b"],g11:["#c0c9e3","#30538d"],g12:["#c9dbc2","#517e36"]},palette:null,defaultSingleColor:"#5d9cd3",multiColorValue:"c1",imagesUrl:window.require.toUrl("jimu/css/images/chart/"),
isInWidget:!1,type:"",singleColor:!1,config:null,postMixInProperties:function(){this.nls=window.jimuNls.statisticsChart},postCreate:function(){this.inherited(arguments);this._initSelf();this.isInWidget&&this._bindEvents();this.own(k(this.multiColorSection,"click",c.hitch(this,function(a){a=a.target||a.srcElement;if(b.hasClass(a,"multi-color")&&!b.hasClass(a,"selected")){var d=this.multiColorValue;this._selectMultiColorDiv(a);d!==a.colorValue&&this.isInWidget&&this._configChange()}})))},_initSelf:function(){this.config=
c.clone(this.config);this.cbxAxisX=new p({label:this.nls.horizontalAxis});this.cbxAxisX.placeAt(this.divAxisX);this.cbxAxisY=new p({label:this.nls.verticalAxis});this.cbxAxisY.placeAt(this.divAxisY);this.cbxLegend=new p({label:this.nls.legend});this.cbxLegend.placeAt(this.divLegend);this.cbxPieLabel=new p({label:this.nls.dataLabels});this.cbxPieLabel.placeAt(this.divPieLabel);this._setSingleColorForColorDiv(this.defaultSingleColor);this.palette=new z({palette:"7x10",cellClass:"cursor:pointer",style:{width:"220px"},
onChange:c.hitch(this,function(a){var d=this._getSingleColorFromColorDiv();this._setSingleColorForColorDiv(a);this.isInWidget&&d!==a&&this._configChange()})});this.palette.placeAt(this.paletteContainer);this.palette.startup();q.forEach(["c1","c2","c3","c4"],c.hitch(this,function(a){b.create("div",{"class":"multi-color colorful "+a,tabindex:"0"},this.colorfulContainer).colorValue=a}));q.forEach("g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11 g12".split(" "),c.hitch(this,function(a){b.create("div",{"class":"multi-color monochromatic "+
a,tabindex:"0"},this.monochromaticContainer).colorValue=a}));this._setMultiColorValue("c1");"pie"===this.type?(this.singleColor=!1,b.setStyle(this.divAxisX,"display","none"),b.setStyle(this.divAxisY,"display","none")):b.setStyle(this.divPieLabel,"display","none");this.reset();this.config&&this.setConfig(this.config)},_updateLegendDisplayByMode:function(a){if("pie"===this.type)this._showLegendCbx=!0,b.setStyle(this.divLegend,"display","");else if("column"===this.type||"bar"===this.type||"line"===this.type)if("count"===
a||"field"===a)b.setStyle(this.divLegend,"display","none"),this._showLegendCbx=!1;else if("feature"===a||"category"===a)this._showLegendCbx=!0,b.setStyle(this.divLegend,"display","")},_bindEvents:function(){this.own(k(this.cbxLegend,"change",c.hitch(this,this._configChange)));"pie"===this.type?this.own(k(this.cbxPieLabel,"change",c.hitch(this,this._configChange))):(this.own(k(this.cbxAxisX,"change",c.hitch(this,this._configChange))),this.own(k(this.cbxAxisY,"change",c.hitch(this,this._configChange))))},
setConfig:function(a){this.reset();this.cbxAxisX.setValue(!1===a.showHorizontalAxis?!1:!0);this.cbxAxisY.setValue(!1===a.showVerticalAxis?!1:!0);this.cbxPieLabel.setValue(!1===a.showDataLabel?!1:!0);this.cbxLegend.setValue(!1===a.showLegend?!1:!0);a=c.clone(a.colors||[]);(this.singleColor=1===a.length&&"pie"!==this.type)?this.showSingleColor(a[0]):this.showMultiColor(a)},getConfig:function(){var a={colors:[]};"pie"===this.type?(a.colors=this.colors[this._getMultiColorValue()],2===a.colors.length&&
(a.colors=this._createHexColors(a.colors[0],a.colors[1],6)),a.showDataLabel=this.cbxPieLabel.checked):(a.showHorizontalAxis=this.cbxAxisX.checked,a.showVerticalAxis=this.cbxAxisY.checked,a.colors=this.singleColor?[this._getSingleColorFromColorDiv()]:this.colors[this._getMultiColorValue()]);this._showLegendCbx&&(a.showLegend=this.cbxLegend.checked);return a},_setSingleColorForColorDiv:function(a){b.setStyle(this.colorDiv,"backgroundColor",a);this.colorDiv.bgHex=a},_getSingleColorFromColorDiv:function(){return this.colorDiv.bgHex},
_setMultiColorValue:function(a){(a=r("."+a,this.multiColorSection))&&0<a.length&&this._selectMultiColorDiv(a[0])},_selectMultiColorDiv:function(a){r(".multi-color",this.multiColorSection).removeClass("selected");b.addClass(a,"selected");this.multiColorValue=a.colorValue},_getMultiColorValue:function(){return this.multiColorValue},reset:function(){"pie"===this.type?this.cbxPieLabel.setValue(!0):(this.cbxAxisX.setValue(!0),this.cbxAxisY.setValue(!0));this.singleColor?this.showSingleColor():this.showMultiColor()},
showSingleColor:function(a){"pie"===this.type?this.singleColor=!1:(this.singleColor=!0,b.setStyle(this.singleColorSection,"display","block"),b.setStyle(this.multiColorSection,"display","none"),a&&this._setSingleColorForColorDiv(a))},showMultiColor:function(a){this.singleColor=!1;b.setStyle(this.singleColorSection,"display","none");b.setStyle(this.multiColorSection,"display","block");if(a&&0<a.length){var d=null,f=!1,g;for(g in this.colors)if(d=this.colors[g],f=!1,d.length===a.length&&(f=q.every(d,
c.hitch(this,function(e,l){e=new h(e);l=new h(a[l]);return e.toHex().toLowerCase()===l.toHex().toLowerCase()})))){this._setMultiColorValue(g);break}}},showShelter:function(){b.setStyle(this.shelter,"display","block")},hideShelter:function(){b.setStyle(this.shelter,"display","none")},_configChange:function(){var a=this.getConfig();this.emit("change",a)},_createHexColors:function(a,d,f){var g=[];a=h.fromHex(a);var e=h.fromHex(d);d=(e.r-a.r)/(f-1);var l=(e.g-a.g)/(f-1);e=(e.b-a.b)/(f-1);for(var m=null,
n=0;n<f;n++)m=new h,m.r=Math.floor(a.r+d*n),m.g=Math.floor(a.g+l*n),m.b=Math.floor(a.b+e*n),g.push(m.toHex());return g}})});