// 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/geoenrichment/ReportPlayer/core/templates/ChartContainer.html":'\x3cdiv class\x3d"esriGEReportPlayer_chartContainer"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"chartLabel" class\x3d"chartContainer_chartLabel"\x3e\x3c/div\x3e\r\n\r\n    \x3cdiv data-dojo-attach-point\x3d"chartNormalViewDiv"\x3e\r\n        \x3cdiv class\x3d"chartContainer_chartContainerWithAxis" data-dojo-attach-point\x3d"chartContainerWithAxis"\x3e\r\n            \x3cdiv data-dojo-attach-point\x3d"chartContainerDiv"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"tableContainerDiv"\x3e\x3c/div\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"legendContainerDiv" class\x3d"chartContainer_legendContainer"\x3e\x3c/div\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"comparisonSelectBlock" class\x3d"chartContainer_comparisonSelectBlock"\x3e\r\n            \x3cdiv data-dojo-attach-point\x3d"comparisonLabel" class\x3d"dijitInline esriGESpaceAfterBig"\x3e\x3c/div\x3e\r\n            \x3cdiv data-dojo-attach-point\x3d"comparisonSelectDiv" class\x3d"dijitInline"\x3e\x3c/div\x3e\r\n        \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv data-dojo-attach-point\x3d"errorDiv" class\x3d"esriGEReportPlayerErrorMessage"\x3e${nls.chartLoadError}\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/geoenrichment/ReportPlayer/core/charts/ChartContainer","dojo/_base/declare dojo/_base/lang dojo/Deferred dojo/dom-class dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/on dojo/when dijit/_WidgetBase dijit/_TemplatedMixin dojox/charting/Chart dojox/charting/action2d/Magnify ./chartUtils/action2d/Highlight ./_ChartLegendSupport ./_ChartEventSupport ./_ChartComparisonSupport ./_ChartUnderlineSupport ./chartUtils/builder/ChartBuilder ./chartUtils/ChartTypes ./chartUtils/ChartSorting ./chartUtils/ChartCalculator ./chartUtils/ChartStyleUtil ./chartUtils/ChartJsonUtil ./chartUtils/builder/ChartPlots ../themes/ReportThemes ./tooltips/ChartTooltip esri/dijit/geoenrichment/utils/DomUtil esri/dijit/geoenrichment/utils/InvokeUtil ./iconRendering/IconRenderer ./textRendering/TextRenderer ./tableViewRendering/TableViewRenderer dojo/text!../templates/ChartContainer.html dojo/i18n!../../../../../nls/jsapi ../../_devConfig".split(" "),
function(l,r,t,m,n,P,c,Q,u,v,w,x,y,z,A,B,C,D,e,g,E,p,F,R,h,G,H,d,I,q,J,K,L,k,M){k=k.geoenrichment.dijit.ReportPlayer.ReportPlayer;var O=l(x,{_renderPlotBackground:function(a,b,f,c){this.theme.plotarea.backgroundImageData?this.surface.createImage({src:this.theme.plotarea.backgroundImageData,x:b.l-1,y:b.t-1,width:f+2,height:c+2}):this.inherited(arguments)}});return l([v,w,A,B,C,D],{templateString:L,nls:k,viewModel:null,themeContext:null,theme:null,parentWidget:null,previewFeatureIndex:null,immediateRender:!1,
chartTheme:null,onPlotChangeColor:null,onPlotChangeIcon:null,chart:null,_currentSeries:null,_placements:["Left","Right","Top","Bottom"],_iconRenderer:null,_textRenderer:null,_tableViewRenderer:null,postCreate:function(){this.inherited(arguments);this._showError(!1);this.viewModel.reportStyle===G.GRAPHIC&&m.add(this.domNode,"graphicReportChart");m.add(this.domNode,this.viewModel.isLightDocumentTheme(this.theme||this.themeContext)?"light":"dark")},_currentSeriesItems:null,_currentVisualProperties:null,
_currentChartType:null,_currentComparisonInfo:null,_isMultiFeatureChart:null,updateChart:function(a){a&&(this._currentSeriesItems=a.seriesItems,this._currentVisualProperties=a.visualProperties,this._currentChartType=a.type,this._currentComparisonInfo=a.comparisonInfo,this._isMultiFeatureChart=a.isMultiFeatureChart,this._initChartComparisonSelect(),this._updateLabels(),this._createChart(),this._addPlotEventListeners(),this._createLegend(),this._updateSeries())},getLegendNode:function(){return this.legendContainerDiv},
_updateLabels:function(){this.chartLabel.innerHTML=this._currentVisualProperties.title.text;d[this.chartLabel.innerHTML?"show":"hide"](this.chartLabel);c.set(this.chartLabel,"textAlign",this._currentVisualProperties.title.align);var a=r.mixin({},this.viewModel.getChartDefaultStyles(this.theme||this.themeContext).titleStyle,this._currentVisualProperties.title.style);c.set(this.chartLabel,F.getStyleObjWithUnits(a))},_createChart:function(){this._destroyChart();var a=n.create("div",{"class":"chartContainerDiv_innerChartNode"},
this.chartContainerDiv),b=new O(a);this.chart=b;b.setTheme(this.chartTheme);e.getChartBuilder(this._currentChartType).configureChart({chart:b,seriesItems:this._currentSeriesItems,visualProperties:this._currentVisualProperties,chartType:this._currentChartType,comparisonInfo:this._currentComparisonInfo,themeSettings:this.viewModel.getChartDefaultStyles(this.theme||this.themeContext),viewModel:this.viewModel,previewFeatureIndex:this.previewFeatureIndex});this.viewModel.dynamicReportInfo&&(g.isPieLike(this._currentChartType)&&
new y(b,h.PRIMARY,{scale:1.03}),h.getWorkingPlots(b).forEach(function(a,c){var f=0===c?this._currentChartType:this._getComparisonChartType();new z(b,a,{stroke:f===g.RING})},this));(this.viewModel.dynamicReportInfo||this._currentVisualProperties.conditionalStyling&&e.supportConditionalStyling(this._currentChartType))&&h.getWorkingPlots(b).forEach(function(a,c){var f=0===c?this._currentChartType:this._getComparisonChartType(),d=new H(b,a,{duration:50});d.showStatistics=!!this.viewModel.dynamicReportInfo;
d.setChartType(f)},this)},_destroyChart:function(){this._hideLevelLine();this.chartContainerDiv&&n.empty(this.chartContainerDiv);this.chart&&this.chart.destroy();this.chart=null;this._destroyLegend()},_updateSeries:function(){var a=this;this._removeSeries();if(this._currentSeriesItems&&this._currentSeriesItems.length){this._currentSeries=e.getChartBuilder(this._currentChartType).calcSeries({chart:this.chart,seriesItems:this._currentSeriesItems,visualProperties:this._currentVisualProperties,chartType:this._currentChartType,
comparisonInfo:this._currentComparisonInfo,selectedComparisonAreaName:this._getSelectedComparisonAreaName(),selectedComparisonIndex:this._getSelectedComparisonIndex(),ge:this._getGeoenrichment(),themeSettings:this.viewModel.getChartDefaultStyles(this.theme||this.themeContext),viewModel:this.viewModel,previewFeatureIndex:this.previewFeatureIndex,isMultiFeatureChart:this._isMultiFeatureChart,excludedSeriesHash:this._excludedSeriesHash,sorting:this._sorting||this._currentVisualProperties.sorting});var b=
e.checkSeriesAreValid(this._currentSeries);this._showError(!b);if(b)return this._currentSeries.forEach(function(b){a._excludedSeriesHash[b.name]||a.chart.addSeries(b.name,b.data,b.params)}),this.resize()}else this.resize()},_removeSeries:function(){var a=this;this._currentSeries=this._currentSeries||[];this._currentSeries.forEach(function(b){a.chart.removeSeries(b.name)});this._currentSeries.length=0},_chartWidth:0,_chartHeight:0,_resizedFlag:!1,_resizeDfd:null,resize:function(a,b,d){if(this._currentVisualProperties)return void 0!==
a&&p.resizeVisualProperties(this._currentVisualProperties,a,b),this._resizedFlag||c.set(this.domNode,"opacity","0"),this._resizeDfd=this._resizeDfd||new t,d||this.immediateRender?this._doResizeChart():I.invoke(this,"_doResizeChart",50)},_doResizeChart:function(){var a=this;if(this.chart){this._resizedFlag||c.set(this.domNode,"opacity","1");this._resizedFlag=!0;this._updateLegend();var b=p.calcChartDimentions(this,{visualProps:this._currentVisualProperties,comparisonInfo:this._currentComparisonInfo,
chartType:this._currentChartType,maxIconSize:q.AXIS_ICON_MAX_SIZE}),d=b.h;this._chartWidth=b.w;this._chartHeight=d;c.set(this.domNode,{width:this._currentVisualProperties.width+"px",height:this._currentVisualProperties.height+"px"});this._adjustErrorMessage();if(this._isTableView)this._refreshTableView(),this._renderChartPendingFlag=!0;else{g.isColumnBarLike(this._currentChartType)&&e.getChartBuilder(this._currentChartType).updateBarSize({chart:this.chart,chartSize:g.isColumnLike(this._currentChartType)?
this._chartWidth:this._chartHeight,seriesItems:this._currentSeriesItems,visualProperties:this._currentVisualProperties,comparisonInfo:this._currentComparisonInfo,chartType:this._currentChartType,viewModel:this.viewModel,previewFeatureIndex:this.previewFeatureIndex});try{this.chart&&(this.chart.resize(this._chartWidth,this._chartHeight),this.chart.dirty&&this.chart.render())}catch(N){console.log(N)}(function(){setTimeout(function(){a._updateLegend();a._updateIcons();a._updateTexts()});a.onRendered();
a._resizeDfd&&a._resizeDfd.resolve();a._resizeDfd=null})()}}},notifyShown:function(){this.viewModel.chartAnimationAllowed&&h.getWorkingPlots(this.chart).forEach(function(a,b){this.chart.getPlot(a).renderAnimation&&this.chart.getPlot(a).renderAnimation()},this)},onRendered:function(){},_getIconRendererClass:function(){return q},_updateIcons:function(){this._iconRenderer||(this._iconRenderer=(new this._getIconRendererClass)(),this.own(this._iconRenderer),this._iconRenderer.setViewMode(this._viewMode));
this._iconRenderer.renderIcons({viewModel:this.viewModel,themeContext:this.themeContext,theme:this.theme,parentWidget:this,chartType:this._currentChartType,iconNode:this.chartContainerWithAxis,chartW:this._chartWidth,chartH:this._chartHeight,visualProperties:this._currentVisualProperties,comparisonInfo:this._currentComparisonInfo,chart:this.chart})},_getTextRendererClass:function(){return J},_updateTexts:function(){this._textRenderer||(this._textRenderer=(new this._getTextRendererClass)(),this.own(this._textRenderer),
this._textRenderer.setViewMode(this._viewMode));this._textRenderer.renderTexts({viewModel:this.viewModel,themeContext:this.themeContext,theme:this.theme,parentWidget:this,textNode:this.chartContainerWithAxis,chartW:this._chartWidth,chartH:this._chartHeight,visualProperties:this._currentVisualProperties,chart:this.chart})},_viewMode:null,setViewMode:function(a){this._viewMode!==a&&(this._viewMode=a,this._iconRenderer&&this._iconRenderer.setViewMode(a),this._textRenderer&&this._textRenderer.setViewMode(a),
this._tableViewRenderer&&this._tableViewRenderer.setViewMode(a))},_showError:function(a){M.emulateErrors.contentErrors&&(a=!0);d[a?"show":"hide"](this.errorDiv);d[a?"hide":"show"](this.chartNormalViewDiv)},_adjustErrorMessage:function(){c.set(this.errorDiv,"paddingTop",c.get(this.domNode,"height")/2-20+"px")},_sorting:null,getSorting:function(){return this._sorting},sortChart:function(a){this._sorting=a&&a!==E.NONE?a:null;this._updateSeries()},_isTableView:!1,_renderChartPendingFlag:!1,chartToTable:function(){if(!this._isTableView){this._isTableView=
!0;d.hide([this.chartContainerDiv,this.legendContainerDiv]);for(var a=0;a<this.chartContainerWithAxis.children.length;a++){var b=this.chartContainerWithAxis.children[a];b!==this.tableContainerDiv&&d.hide(b)}this._tableViewRenderer||(this._tableViewRenderer=new K,this.own(this._tableViewRenderer),this._tableViewRenderer.setViewMode(this._viewMode));this._refreshTableView()}},_refreshTableView:function(){var a=c.get(this.domNode,"height")-c.get(this.chartLabel,"height");this._currentComparisonInfo&&
(a-=40);this._tableViewRenderer.renderTableForChart({viewModel:this.viewModel,themeContext:this.themeContext,theme:this.theme,parentWidget:this,tableNode:this.tableContainerDiv,width:c.get(this.domNode,"width"),height:a,chartSeries:this._currentSeries,chartType:this._currentChartType,visualProperties:this._currentVisualProperties,hasComparison:!!this._currentComparisonInfo,chart:this.chart})},tableToChart:function(){if(this._isTableView){this._isTableView=!1;d.show([this.chartContainerDiv,this.legendContainerDiv]);
for(var a=0;a<this.chartContainerWithAxis.children.length;a++)d.show(this.chartContainerWithAxis.children[a]);this._tableViewRenderer&&this._tableViewRenderer.destroyTable();this._renderChartPendingFlag&&(this._renderChartPendingFlag=!1,this.resize())}},getVisualState:function(){return{sorting:this.getSorting(),isTableView:this._isTableView}},setVisualState:function(a){a&&u(this._resizeDfd&&this._resizeDfd.promise,function(){a.sorting&&this.sortChart(a.sorting);a.isTableView&&this.chartToTable()}.bind(this))},
getWidth:function(){return this._currentVisualProperties.width},getHeight:function(){return this._currentVisualProperties.height},destroy:function(){this._destroyChart();this.inherited(arguments)}})});