// 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/ThemeCalculator",["dojo/_base/lang","dojox/charting/Theme","../../themes/ThemeLibrary","./ChartTypes","./plots/supportClasses/GaugeLabelPlacement"],function(h,q,r,f,t){function p(c,b){var a;switch(c){case f.COLUMN:a=b.column&&b.column.colors;break;case f.LINE:a=b.line&&b.line.colors;break;case f.BAR:a=b.bar&&b.bar.colors;break;case f.PIE:a=b.pie&&b.pie.colors;break;case f.DONUT:a=b.donut&&b.donut.colors;break;case f.GAUGE:a=b.gauge&&
b.gauge.colors;break;case f.RING:a=b.ring&&b.ring.colors}a&&a.length||(a=null);return a||b.colors||k}var e={},k=["#AAAAAA","#888888","#555555","#333333"];e.DEFAULT_LINE_THICKNESS=1;e.DEFAULT_COLUMN_THICKNESS="Medium";e.DEFAULT_DONUT_HOLE_PERCENT=50;e.DEFAULT_DONUT_GAP=3;e.DEFAULT_DONUT_ARC_PERCENT=100;e.DEFAULT_GAUGE_HOLE_PERCENT=80;e.DEFAULT_GAUGE_GAP=2;e.DEFAULT_GAUGE_ANGLE=0;e.DEFAULT_GAUGE_ARC_PERCENT=100;e.getThemeForSettings=function(c,b){var a=new q({colors:b.colors||k});if(!c)return a;var d=
c.visualProperties;a.plotarea.fill=d.backgroundColor||b.backgroundColor;a.plotarea.stroke={width:0};a.chart.fill="transparent";a.axis.title.font="normal normal normal 11px Verdana";!f.isPieLike(c.type)&&c.type!==f.RING&&d.backgroundImageData&&(a.plotarea.backgroundImageData=d.backgroundImageData);var g=h.mixin({},b.dataLabelsStyle,d.dataLabelsStyle);g.color&&(a.series.fontColor=g.color);a.series.font=e.combineFontString(g);a.series.showColumnBarBackground=d.showColumnBarBackground;a.series.columnBarBackgroundColor=
d.columnBarBackgroundColor||b.columnBarBackground&&b.columnBarBackground.backgroundColor;c.type===f.DONUT&&(a.series.donutHolePercent=void 0!==d.donutHolePercent?d.donutHolePercent:e.DEFAULT_DONUT_HOLE_PERCENT,a.series.donutGap=void 0!==d.donutGap?d.donutGap:e.DEFAULT_DONUT_GAP,a.series.donutArcPercent=void 0!==d.donutArcPercent?d.donutArcPercent:e.DEFAULT_DONUT_ARC_PERCENT,a.series.donutArcPercent=Math.min(100,Math.max(50,a.series.donutArcPercent)));c.type===f.GAUGE&&(a.series.donutHolePercent=void 0!==
d.gaugeHolePercent?d.gaugeHolePercent:e.DEFAULT_GAUGE_HOLE_PERCENT,a.series.donutGap=void 0!==d.gaugeGap?d.gaugeGap:e.DEFAULT_GAUGE_GAP,a.series.startAngle=void 0!==d.gaugeStartAngle?d.gaugeStartAngle:e.DEFAULT_GAUGE_ANGLE,a.series.donutArcPercent=void 0!==d.gaugeArcPercent?d.gaugeArcPercent:e.DEFAULT_GAUGE_ARC_PERCENT,a.series.donutArcPercent=Math.min(100,Math.max(50,a.series.donutArcPercent)),a.series.donutShowIcons=d.showChartIcons,d.gaugeShowArrow&&(a.series.donutShowArrowIndicator=!0,a.series.donutGap=
0,100!==a.series.donutArcPercent&&(a.series.startAngle=0),a.series.donutArrowIndicatorLineColor=d.gaugeArrowLineColor||b.gauge&&b.gauge.arrowIndicator.lineColor,a.series.donutArrowIndicatorFillColor=d.gaugeArrowFillColor||b.gauge&&b.gauge.arrowIndicator.backgroundColor),g=h.mixin({},b.gauge&&b.gauge.dataLabelStyle,d.gaugeLabelStyle),a.series.donutMainLabelPosition=d.gaugeLabelPlacement,a.series.donutMainLabelFont=e.combineFontString(g),a.series.donutMainLabelFontColor=g.color,a.series.donutMainLabelFontSize=
d.gaugeLabelStyle&&d.gaugeLabelStyle.fontSize,a.series.donutMainLabelTextDecoration=g.textDecoration);c.type===f.RING&&(a.series.show100PercentLabel=!0,a.series.ringBackgroundColor=d.ringBackgroundColor||b.ring&&b.ring.ringBackground&&b.ring.ringBackground.backgroundColor);f.isPictureLike(c.type)&&(a.series.showWholePictures=d.showWholePictures);a.marker.fill="#FFFFFF";return a};e.getComparisonSymbol=function(){return"m-3,0 c0,-4 6,-4 6,0, m-6,0 c0,4 6,4 6,0"};e.calcColorForPoint=function(c,b,a,d,
e,l,h,k,m){e=f.isPieLike(l)||!h.renderSingleDataSeriesWithSameColor&&1===e;var g=p(l,h),n;if(l===f.LINE)k&&m?c=m.color||h.comparisonInfo.lineColor:(n=g[d%g.length],c=b.color||n||"#FFFFFF");else if(k&&m&&m.color)c=m.color;else{if(l===f.GAUGE&&1===a&&h.gauge.othersColor)return c&&c.color||h.gauge.othersColor;n=n||(e?g[a%g.length]:g[d%g.length]);c=c&&c.color||!f.isPieLike(l)&&b.color||n||"#FFFFFF"}return c};e.calcColorForSeries=function(c,b,a,d,e){a=f.isPieLike(d)||!e.renderSingleDataSeriesWithSameColor&&
1===a;e=p(d,e);b=d===f.LINE?e[b%e.length]:a?null:e[b%e.length];return c&&c.color||b||"#FFFFFF"};e.provideMissingIconsForPoints=function(c,b){if(!f.isPictureLike(b))return null;var a,d=[];c.forEach(function(b){b.iconFieldInfo?(a=b.iconFieldInfo,d.forEach(function(b){b.iconFieldInfo=h.clone(a)}),d.length=0):a?b.iconFieldInfo=h.clone(a):d.push(b)})};e.calcIconForPoint=function(c,b,a){if(!f.isPictureLike(a))return null;(c=c.iconFieldInfo)&&c.shapeJson&&b&&(c.shapeJson.themeStyle={fillColor:b,borderColor:b});
return c};e.calcBackgroundIconForPoint=function(c,b,a,d){if(!f.isPictureLike(b))return null;b=d.columnBarBackgroundColor||a.columnBarBackground&&a.columnBarBackground.backgroundColor;return(c=c.iconFieldInfo)&&c.shapeJson&&b?(c=h.clone(c),c.shapeJson.themeStyle={fillColor:b,borderColor:b},c):null};e.combineFontString=function(c){c=c||{};return(c.fontStyle||"normal")+" normal "+(c.fontWeight||"normal")+" "+((c.fontSize||"11")+"px")+" "+(c.fontFamily||r.DEFAULT_FONT_FAMILY_CLASSIC)};return e});