function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}var ABF=ABF||{},ABFCharts_Area,ABFCharts_Bar,ABFCharts_BenchmarkPie,ABFCharts_Column,ABFCharts_Empty,ABFCharts_Gauge,ABFCharts_Line,ABFCharts_Map,ABFCharts_Pie,ABFCharts_Radar,ABFCharts_Sankey,ABFCharts_Scatter,_createClass,ABFCharts_Treemap,chartutils;ABF.AC=ABF.AC||{};ABF.AC.PresList=[];ABF.AC.ResizeTimeout=null;ABF.AC.ResizingCharts=!1;ABF.AC.DetailviewSubtitle=function(n){var t="",i;if(n.inMultiIndicatorView)if(n.period.length>0)t=n.period,n.unit&&n.unit.length>0&&(t+=", "+n.unit);else if(n.startPeriod&&n.endPeriod)return i=n.startPeriod!==n.endPeriod?n.startPeriod+"-"+n.endPeriod:n.endPeriod,n.geoItem!==n.startPeriod&&n.geoItem!==n.endPeriod?n.geoItem+", "+i:i;return t};ABF.AC.CreateComplementaryColor=function(n){var t=[];if(n.indexOf("rgb")>=0&&(t=n.replace(/[^\d,]/g,"").split(",")),t.length>=3){var i=t[0],r=t[1],u=t[2],f=255-i,e=255-r,o=255-u;return"rgb("+f+","+e+","+o+")"}};ABF.AC.DrilldownHeight=function(n,t){var u=n.categories.length,r=70,i=r+70*u,r=$("#"+t).parent().height();i=i<r?r-5:i;$("#"+t).css("height",i+"px")};ABF.AC.LegendTooltip=function(n,t){var r=$(t).attr("data-legendobject"),i;r&&(i=JSON.parse(decodeURIComponent(r)),i.nodata&&n.show(i.nodata))};ABF.AC.Tooltip=function(n,t,i,r,u){var c=d3.select(r),f="",a=ABF.AC.GetTooltipTheme(i.options.tileBgColor),e=c.attr("data-value"),l=i.options.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",o,s,h;t.empty?(c.classed("hover",!1),f+=t.nodata):(o="",t.x&&t.x.length>0&&t.name&&t.name!=="undefined"&&t.name.trim().length>0?f+="<p class='tt-title'>"+t.x+"<\/p>":t.x&&t.x.length>0&&(o="<p class='tt-indicator'>"+t.x,f+=o),t.title&&t.title!=="undefined"&&t.title.trim().length>0?(o="<p class='tt-indicator'>"+t.title,f+=o):t.name&&t.name!=="undefined"&&t.name.trim().length>0&&(o="<p class='tt-indicator'>"+t.name,f+=o),(e===null||e===undefined||e.length===0)&&(e=t.ystring!==undefined&&t.ystring!==null&&t.ystring.length>0?t.ystring:chartutils.numberFormat(Number(t.y),parseInt(i.options.noDec,10),null,{thousandsSep:l,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})),e.length>0&&(s=i.dataPostfix?i.dataPostfix:i.options.dataPostfix,(s==null||s==undefined)&&(s=""),h=i.dataPrefix?i.dataPrefix:i.options.dataPrefix,(h==null||h==undefined)&&(h=""),e=s.length>0&&e.indexOf(s)>=0?h+e:h+e+s,f+=o.length>0?": ":"",f+="<span class='tt-value'>"+e+"<\/span>"),i.type==="line"&&d3.select(i.container+" svg").selectAll("g.points circle").each(function(n){var r;if(t.name&&t.name!=="undefined"&&n.name&&n.name!=="undefined"&&t.name!==n.name&&t.x===n.x){var u=d3.select(this),e=c.attr("cy"),s=u.attr("cy");Math.abs(+e-+s)<5&&(f+="<br />"+n.name,r=u.attr("data-value"),(r===null||r===undefined||r.length===0)&&(r=t.ystring!==undefined&&t.ystring!==null&&t.ystring.length>0?t.ystring:chartutils.numberFormat(Number(t.y),parseInt(i.options.noDec,10),null,{thousandsSep:l,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.options.perc),r.length>0&&(f+=o.length>0?": ":"",f+="<span class='tt-value'>"+r+"<\/span>"))}}),o.length>0&&(f+="<\/p>"),t.descr&&(f+="<p class='tt-descr'>"+t.descr+"<\/p>"));n.show(f,u);n.div.classed("theme-dark",!1);n.div.classed("theme-light",!1);n.div.classed("theme-"+a,!0)};ABF.AC.ColumnTooltip=function(n,t,i,r,u){var h=d3.select(r),e="",c=ABF.AC.GetTooltipTheme(i.options.tileBgColor),f=h.attr("data-value"),l=i.options.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",o,s;t.ignoreTT||(t.empty?(h.classed("hover",!1),e+=t.nodata):(o="",s=t.title?t.title:t.x,s&&s.length>0&&t.name&&t.name!=="undefined"&&t.name.trim().length>0?e+="<p class='tt-title'>"+s+"<\/p>":s&&s.length>0&&(o="<p class='tt-indicator'>"+s,e+=o),t.name&&t.name!=="undefined"&&t.name.trim().length>0&&(o="<p class='tt-indicator'>"+t.name,e+=o),(f===null||f===undefined||f.length===0)&&(f=t.ystring!==undefined&&t.ystring!==null&&t.ystring.length>0?t.ystring:chartutils.numberFormat(Number(t.y),parseInt(i.options.noDec,10),null,{thousandsSep:l,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})),f.length>0&&(f=i.dataPostfix.length>0&&f.indexOf(i.dataPostfix)>=0?i.dataPrefix+f:i.dataPrefix+f+i.dataPostfix,e+=o.length>0?": ":"",e+="<span class='tt-value'>"+f+"<\/span>"),o.length>0&&(e+="<\/p>"),t.descr&&(e+="<p class='tt-descr'>"+t.descr+"<\/p>")),n.show(e,u),n.div.classed("theme-dark",!1),n.div.classed("theme-light",!1),n.div.classed("theme-"+c,!0))};ABF.AC.RadarTooltip=function(n,t,i){var u="",e,h=i.options.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",f,o,r,s;for(d3.select(i.container).select("g.chart").selectAll("circle").attr("r",i.pointRadius),d3.select(i.container).select("g.chart").selectAll("circle[data-code='"+t[0].index+"']").attr("r",i.pointRadius*2),f=0,o=t.length;f<o;f++)r=t[f],f===0&&r.name&&(u+="<p class='tt-title'>"+r.x+"<\/p>"),r.x&&r.x.length>0&&(u+=r.title&&r.title!=="undefined"&&r.title.trim().length>0?"<p class='tt-indicator'>"+r.title:"<p class='tt-indicator'>"+r.name),e=r.ystring!==undefined?r.ystring:chartutils.numberFormat(Number(r.y),parseInt(i.options.noDec,10),null,{thousandsSep:h,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.options.perc,e.length>0&&(u+=u.length>0?": ":"",u+="<span class='tt-value'>"+e+"<\/span>"),u+="<\/p>",f===t.length-1&&r.descr&&(u+="<p class='tt-descr'>"+r.descr+"<\/p>");n.show(u);s=ABF.AC.GetTooltipTheme(i.options.tileBgColor);n.div.classed("theme-dark",!1);n.div.classed("theme-light",!1);n.div.classed("theme-"+s,!0)};ABF.AC.GaugeTooltip=function(n,t,i){var r="",u=i.dataset[0],e=i.options.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",f;u=chartutils.numberFormat(Number(u),parseInt(i.options.noDec,10),null,{thousandsSep:e,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.options.perc;i.subtitleTitle?r+="<p class='tt-title'>"+i.subtitleTitle+"<\/p>":i.subtitle&&(r+="<p class='tt-title'>"+i.subtitle+"<\/p>");i.options.indicator&&(r+="<p class='tt-indicator'>"+i.options.indicator);u.length>0&&(r+=r.length>0?": ":"",r+="<span class='tt-value'>"+u+"<\/span>");i.options.indicator&&(r+="<\/p>");i.options.descr&&(r+="<p class='tt-descr'>"+i.options.descr+"<\/p>");r.length>0&&(n.show(r),f=ABF.AC.GetTooltipTheme(i.options.tileBgColor),n.div.classed("theme-dark",!1),n.div.classed("theme-light",!1),n.div.classed("theme-"+f,!0))};ABF.AC.PieTooltip=function(n,t,i,r){var f=t.index,o=d3.select(r),u="",e=o.attr("data-value"),s=i.options.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",h=ABF.AC.GetTooltipTheme(i.options.tileBgColor);i.indicators[f]&&(u+="<p class='tt-title'>"+i.indicators[f]+"<\/p>");i.subtitleTitle&&i.subtitleTitle.trim().length>0?u+="<p class='tt-indicator'>"+i.subtitleTitle:i.subtitle&&i.subtitle.trim().length>0&&(u+="<p class='tt-indicator'>"+i.subtitle);e===null&&(e=t.ystring!==undefined?t.ystring:chartutils.numberFormat(Number(t.value),parseInt(i.options.noDec,10),null,{thousandsSep:s,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.options.perc);e.length>0&&(u+=u.length>0&&i.subtitle&&i.subtitle.trim().length>0?": ":"",u+="<span class='tt-value'>"+e+"<\/span>");i.subtitle&&(u+="<\/p>");i.options.descriptions&&i.options.descriptions[f]&&(u+="<p class='tt-descr'>"+i.options.descriptions[f]+"<\/p>");n.show(u);n.div.classed("theme-dark",!1);n.div.classed("theme-light",!1);n.div.classed("theme-"+h,!0)};ABF.AC.TreeMapTooltip=function(n,t,i,r){var e=d3.select(r),u="",f=e.attr("data-value"),o=i.options.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",s=ABF.AC.GetTooltipTheme(i.options.tileBgColor);t.data.name&&(u+="<p class='tt-indicator'>"+t.data.name);f===null&&(f=t.ystring!==undefined?t.ystring:chartutils.numberFormat(Number(t.value),parseInt(i.options.noDec,10),null,{thousandsSep:o,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.options.perc);f.length>0&&(u+=u.length>0&&t.data.name?": ":"",u+="<span class='tt-value'>"+f+"<\/span>");t.data.name&&(u+="<\/p>");t.data.description&&(u+="<p class='tt-descr'>"+t.data.description+"<\/p>");n.show(u);n.div.classed("theme-dark",!1);n.div.classed("theme-light",!1);n.div.classed("theme-"+s,!0)};$(document).on("mouseover, mousemove",".nodataGroup",function(n){var r=n.clientX,u=n.clientY+$(window).scrollTop(),t=$(this).attr("data-nodata"),i;t&&(i=chartutils.toolTip(!0),i.show(t,{x:r,y:u}))});$(document).on("mouseout",".nodataGroup",function(){var n=chartutils.toolTip(!0);n.hide()});$(document).on("click",function(){var n=chartutils.toolTip(!0);n.hide()});$(window).resize(function(){$(window).outerWidth()!==ABF_Dashboard_MosaicView._windowWidth&&(clearTimeout(ABF.AC.ResizeTimeout),ABF.AC.ResizeTimeout=setTimeout(ABF.AC.ResizeCharts,250))});ABF.AC.ResizeCharts=function(){var r=ABF_Dashboard_Model.Settings.ChartAnimateSpeed,n,i,t;for(ABF.AC.ResizingCharts=!0,ABF_Dashboard_Model.Settings.ChartAnimateSpeed=0,n=0,i=ABF.AC.PresList.length;n<i;n++)t=ABF.AC.PresList[n],ABF.AC.RedrawChart(t.id,t);ABF.AC.ResizingCharts=!1;ABF_Dashboard_Model.Settings.ChartAnimateSpeed=r};ABF.AC.RedrawChart=function(n,t){if((t===null||t===undefined)&&(t=ABF.AC.FindPresInList(ABF.AC.PresList,n,"id")),t!==null&&t!==undefined)switch(t.type){case"gauge":ABF.AC.Gauge(t.options,t.id);break;case"radar":ABF.AC.Radar(t.options,t.id);break;case"pie":ABF.AC.Pie(t.options,t.id);break;case"line":ABF.AC.Line(t.options,t.id);break;case"sparkline":ABF.AC.SparkLine(t.options,t.id);break;case"bar":ABF.AC.Bar(t.options,t.id);break;case"mirroredbar":ABF.AC.BarMirrored(t.options,t.id);case"rankingbar":ABF.AC.RankingBar(t.options,t.id);break;case"column":ABF.AC.Column(t.options,t.id);break;case"column_svg":ABF.AC.SvgColumn(t.options,t.id);break;case"map":ABF.AC.Map.Init(t.options,t.id);break;case"viewer":ABF.AC.ViewerTile.Init(t.options,t.id);break;case"treemap":ABF.AC.TreeMap(t.options,t.id)}};ABF.AC.GetDefaultOptions=function(n){return{forecastType:"Hatch",forecastDrawStyle:"ForwardDiagonal",forecastColor:"rgb(128,128,128)",showForecast:n.showForecast,showEstimation:n.showEstimation,estimationType:"Hatch",estimationDrawStyle:"ForwardDiagonal",estimationColor:"rgb(128,128,128)",baseLoc:window.location.href,extraType:"Hatch",extraDataType:"p",extraDrawStyle:"DashedDownwardDiagonal",extraColor:"rgb(128,128,128)",labelFontColorContrast:"rgb(0,0,0)"}};ABF.AC.MissingChart=function(n,t,i,r,u,f,e){var c=chartutils.toolTip(!0),y=n.containerElement,p=d3.select(y).select("svg"),w=p.append("g").attr("class","nodataGroup"),b=t.fontColor,k=w.append("g").attr("class","nodata").attr("data-nodata",e),o=k.append("text").attr("font-size","21px").attr("font-weight","bold").attr("text-anchor","middle").attr("fill",b).text(f).attr("dy",0).attr("data-nodata",e),h=o.text(),s=h,l=o.node().getBBox().width,a,v;for(o.attr("text-anchor","middle");h.length>0&&l>i*.95;)s=s.substr(0,s.length-1),o.text(s),l=o.node().getBBox().width;h!==s&&(s+="...",o.text(s));o.on("mouseover, mousemove",function(){var n=$(d3.select(this).node()).attr("data-nodata");c.show(n)}).on("mouseout",function(){c.hide()});a=r/2;v=i/2;o.attr("transform","translate("+(v+u)+",0)");o.attr("y",a)};ABF.AC.CustomizeAxes=function(n,t){var i=n.containerElement,r=d3.select(i).select("svg");r.selectAll("g.y.axis g.tick line").attr("stroke",t)};ABF.AC.CustomizePaths=function(n,t){var i=n.containerElement,r=d3.select(i).select("svg");r.selectAll("g.slices path").attr("stroke",t).attr("stroke-width",1)};ABF.AC.CustomizeRects=function(n,t){var i=n.containerElement,r=d3.select(i).select("svg");r.selectAll("g.bar rect").attr("stroke",t).attr("stroke-width",1)};ABF.AC.AddSubtitles=function(n,t,i){if(t.geoItemTitle||t.geoCompareTitle){var u=i?"g.chart g.y.axis g.tick text":"g.chart g.subtitleGroup g.subtitle text",r=d3.select("#"+n+" svg").selectAll(u),f=r.size();r.each(function(n,r){var u=t.geoItemTitle;f>1&&(u=r===0&&!i||r===1&&i?t.geoItemTitle:t.geoCompareTitle);d3.select(this).select("title").text(u)})}};ABF.AC.Gauge=function(n,t){ABF.AC.AddPresToList(n,t,"gauge");var i={fill:null,fillBG:null,fillcolors:[],fontColor:"fff",tileBgColor:"ccc",indicator:"",noDec:"0",perc:"",valuta:"",unit:"",geoItem:null,geoCompare:null,geoData:null,geoCompareData:null,min:0,max:100,isAngular:!1,startAngle:-90,endAngle:90,gaugeMin:30,gaugeMax:70,gaugeMinColor:null,gaugeInterColor:null,gaugeMaxColor:null,gaugeMinString:"",gaugeInterString:"",gaugeMaxString:"",showThousandsSeparator:!0,showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);this.CreateGauge=function(n){for(var d=n.geoCompare?[n.geoItem,n.geoCompare]:[n.geoItem],it=n.geoCompare?[n.geoItemTitle,n.geoCompareTitle]:[n.geoItemTitle],l=n.geoCompare?[n.geoData,n.geoCompareData]:[n.geoData],y=!0,u,c,tt,e,k,r=0;r<l.length;r++)isNaN(l[r])||(y=!1);var g=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",nt=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:y?n.noDataLabel:"",gaugeColor:n.fillBG,dataColor:n.fill,minimum:n.min,maximum:n.max,margin:{top:0,bottom:0,left:0,right:0},isAngular:n.isAngular,isCircular:n.isCircular,tresholdDataset:n.isAngular?[n.gaugeMin,n.gaugeMax]:[],tresholdColorlist:n.isAngular?[n.gaugeMinColor,n.gaugeInterColor,n.gaugeMaxColor]:[],tresholdDataLabels:n.isAngular?[n.gaugeMinString,n.gaugeInterString,n.gaugeMaxString]:[],minAngle:n.isCircular?0:-150,maxAngle:n.isCircular?360:150,gaugeRatio:n.isAngular?25:37.5,dataUnit:n.perc==="%"?"%":"",animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,customLang:{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},title:"",source:"",showLegend:!0,legendData:[],titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:20,subtitleFontColor:i.fontColor,subtitlePosition:"bottomcenter",sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:11,labelFontColor:i.fontColor,valueFontColor:i.fontColor,chartBackgroundColor:i.tileBgColor,shortNotation:n.shortNotation,options:n,onTooltipFunction:ABF.AC.GaugeTooltip,truncateSubtitle:!0}),o=new ABFCharts_Gauge("#"+t,nt);o.draw();var u=o.settings.margin,p=l.length,rt=$("#"+t).width(),w=$("#"+t).height(),f=rt/p,ut=u.top,b=u.left,a=w-u.top;if(a>f&&f>400?(u.left=50,u.right=50):a>f&&f>300?(u.left=35,u.right=35):a>f&&f>200?(u.left=25,u.right=25):a>f&&f>50&&(u.left=15,u.right=15),y)$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr);else{for(u=o.settings.margin,u.top=25,r=0;r<p;r++){d[r].trim().length<=0&&r===0&&(u.bottom+=40);var v=[l[r]],s="",h=!1;for(c=0,tt=v.length;c<tt;c++)e=v[c],h||e===null||e===undefined||isNaN(e)||(h=!0),s=e!==null&&e!==undefined&&!isNaN(e)?i.valuta+chartutils.numberFormat(e,parseInt(i.noDec,10),null,{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc:v[c],i.showPositiveSign&&h&&e>0&&(s=n.positiveSign+s);(r===0&&i.baseSpecialType||r===1&&i.compareSpecialType)&&(s=s+"*");k={dataset:h?v:[],dataText:s,subtitle:d[r],subtitleTitle:it[r],valueFontSize:h?26:32,margin:u};n.isAngular||(k.dataColor=n.fillcolors[r]);b+=r*f;o.changeSettings(k);o.addChart(f,w,b,ut);h||nt.nodata||ABF.AC.MissingChart(o,i,f,w,b,n.noDataLabel,n.noDataDescr);n.isAngular&&p>1&&f<200&&d3.select("#"+t+" svg").selectAll("g.label text.treshold:nth-child(2),g.label text.treshold:nth-child(3)").style("visibility","hidden");r===0&&n.geoitemTitle&&d3.select();ABF.AC.CustomizePaths(o,i.tileBgColor)}ABF.AC.AddSubtitles(t,n)}};this.CreateGauge(n)};ABF.AC.Radar=function(n,t){ABF.AC.AddPresToList(n,t,"radar");var i={fill:null,fillBG:null,fontColor:"fff",tileBgColor:"ccc",indicator:"",perc:"",valuta:"",unit:"",period:"",series:[],categories:null,inMultiIndicatorView:!1,showThousandsSeparator:!0,showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);this.GetGridColor=function(n,t){var i=this.GetRGBComponents(n),r=this.GetRGBComponents(t);if(i.length>=3&&r.length>=3){var u=Math.round((parseInt(i[0],10)+parseInt(r[0],10))/2.2),f=Math.round((parseInt(i[1],10)+parseInt(r[1],10))/2.2),e=Math.round((parseInt(i[2],10)+parseInt(r[2],10))/2.2);return"rgb("+u+","+f+","+e+")"}return n};this.GetRGBComponents=function(n){return n.substring(n.indexOf("(")+1,n.lastIndexOf(")")).split(/,\s*/)};this.CreateRadar=function(n){for(var f,c,s,y,e,tt,it,l,p,d,r,ft,b,k=[n.fill,n.fillBG],ot=[],o=[],g=[],a=[],nt=25,v=!1,h=[],st=$("#"+t).parent().parent().hasClass("height4"),ht=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",u=0;u<n.series.length;u++){for(f=n.series[u],ot.push(f.name),c=!1,r=0;r<f.data.length;r++)s=f.data[r].value,y="",n.descriptions&&n.descriptions.length>r?y=n.descriptions[r]:n.descr&&(y=n.descr),e=s!==null&&s!==undefined?i.valuta+chartutils.numberFormat(s,parseInt(i.noDec,10),null,{thousandsSep:ht,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc:"",e=e.trim(),c||(c=e!==""),tt=i.showPositiveSign&&e!==""&&s>0?n.positiveSign:"",e=tt+e,g[r]=e,o.push({name:f.name,title:f.title,namecode:u,x:n.categories[r],y:s,ystring:e,descr:y,index:r,t:f.data[r].dataType}),u===0&&(it={type:"empty",text:String.fromCharCode(65+r)+" | "+n.categories[r]},h.push(it),n.categories[r].length>nt&&(v=!0));if(!c)for(l=0;l<o.length;l++)o[l].name===f.name&&(o[l].name+=" ("+n.noDataLabel+")");p={type:"point",color:k[u],text:f.name};c||(p.nodata=n.noDataDescr,p.text+="*");a.push(p)}if(v&&!st){for(u=0;u<n.categories.length;u++){for(d=!1,r=0;r<n.series.length;r++)if(n.series[r].data[u].value===null||isNaN(n.series[r].data[u].value)){d=!0;break}d&&(h[u].text+="*",h[u].nodata=n.noDataDescr)}a=a.concat(h);v=!1}var rt=0,ut=0,ct=rt>0||ut>0?!1:!0,w=ABF.AC.IsEmpty(o),lt=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:w?n.noDataLabel:"",colorList:k,indicators:n.categories,dataUnit:"",dataPostfix:n.perc==="%"?"%":"",animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,showValues:!1,onTooltipFunction:ABF.AC.RadarTooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,title:"",titleSubtitle:"",axisLineColor:this.GetGridColor(n.fontColor,n.tileBgColor),gridLineColor:this.GetGridColor(n.fontColor,n.tileBgColor),titleFontColor:n.fontColor,lineWidth:1,usePoints:!1,pointRadius:3,titleFontSize:18,titleBackgroundColor:"transparent",subtitleFontColor:n.fontColor,sourceFontColor:n.fontColor,sourceBackgroundColor:"transparent",legendFontColor:n.fontColor,legendBackgroundColor:"transparent",legendHeight:26,legendMargin:-10,centerLegendRows:!0,legendIconDefault:"point",axisXFontColor:n.fontColor,axisYFontColor:n.fontColor,labelFontColor:n.fontColor,axisXFontSize:11,axisYFontSize:12,axisTickSpace:60,margin:i.inMultiIndicatorView?{top:10,right:20,bottom:0,left:25}:{top:0,right:0,bottom:0,left:0},categoryColorList:k,rotation:rt,rotationy:ut,autoRotation:ct,customYMax:n.max!==undefined?n.max:null,customYMin:n.min!==undefined?n.min:null,lineStyles:"",drawStyle:"area",gridLineSize:"1",axisLineSize:"1",maxLabelLength:nt,maxLegendWidth:200,legendPosition:"bottom",legendData:w?[]:a,labelLegendPosition:"left",labelLegendData:v?h:[],dataset:w?[]:o,datasetStr:g,rotateRadar:!1,ignoreTextBBox:!1,wrapRadarLabels:!0,skewedAxis:!0,minYDefZero:n.min!==null&&n.min!==undefined&&n.max!==null&&n.max!==undefined?!1:!0,options:n,nrOfDec:parseInt(i.noDec,10)}),at=new ABFCharts_Radar("#"+t,lt);if(at.draw(),w)$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr);else if(ft=$("#"+t).outerHeight(),b=$("#"+t+" svg").find("g.legend"),b.length>1){var et=b[b.length-1],vt=d3.select(et),yt=ft/2-vt.node().getBBox().height/1.5;d3.select(et).attr("transform","translate(0,"+yt+")")}};this.CreateRadar(i)};ABF.AC.Pie=function(n,t){ABF.AC.AddPresToList(n,t,"pie");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,labelOutside:!1,showThousandsSeparator:!0,showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);this.CreatePie=function(n){var at=[n.geoItem,n.geoCompare],vt=[n.geoItemTitle,n.geoCompareTitle],c=n.colorScheme,v,it,l,y,g,r,u,d,tt,h,lt;c!==null&&c!==undefined&&(c=c.slice(0));var a=[],o=!1,s=!1,k=n.data.length;if(i.showForecast||i.showEstimation)for(r=0;r<k;r++){for(v=n.data[r],u=0,d=v.length;u<d;u++)if(o=o||v[u].dataType==="f",s=s||v[u].dataType==="e",o&&s)break;if(o&&s)break}for(r=0;r<i.categories.length;r++){for(it=!1,l=!1,u=0;u<k;u++){if(n.data[u][r].value===null||isNaN(n.data[u][r].value)){it=!0;break}if(n.data[u][r].value!==0&&n.data[u][r].dataType==="p"){l=!0;break}}if(y={type:"point",color:c[r],text:i.categories[r]},i.categories[r]!=="___"+ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown+"___"||l)i.categories[r]==="___"+ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown+"___"&&(c[r]="transparent",y.text=ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown,y.color="url("+window.location.href+"#"+t+"DashedDownwardDiagonal_p)");else continue;it&&(y.nodata=n.noDataDescr,y.text+="*");a.push(y)}i.showForecast&&o&&a.push(ABF.AC.getForecastLegend(i,a.length>0));i.showEstimation&&s&&a.push(ABF.AC.getEstimateLegend(i,a.length>0));var rt=ABF.AC.IsEmpty(n.data),ot=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:rt?n.noDataLabel:"",colors:c,indicators:rt?[]:n.categories,dataUnit:n.perc,margin:i.inMultiIndicatorView?{top:8.5,right:20,bottom:0,left:25}:{top:8.5,right:0,bottom:0,left:0},animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,title:"",titleSubtitle:"",source:"",pieLabelInside:!n.labelOutside,showLegend:!0,useDonut:n.useDonut===!0,donutRatio:i.isDonutAggregate?25:50,labelShift:!0,legendData:a,usePieLabel:n.showGraphLabel,showValues:n.showGraphLabel,titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:20,subtitleFontColor:i.fontColor,subtitlePosition:"bottomcenter",sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,legendMargin:n.geoItem.trim().length<=0?40:0,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:15,calcLabelFontSize:7,labelFontColor:i.fontColor,showLabelContrast:!0,chartBackgroundColor:i.tileBgColor,onTooltipFunction:ABF.AC.PieTooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,options:n,iconSrc:n.iconSrc?"images/svg/"+n.iconSrc:"",iconColor:n.iconFill,centerLabelUnit:n.centerLabelUnit?n.centerLabelUnit:"",centerLabelFontSize:26,truncateSubtitle:!0,customLang:{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},showExtra:l}),p=new ABFCharts_Pie("#"+t,ot);if(p.draw(),rt)$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr);else{var f=p.settings.margin,yt=$("#"+t).width(),st=$("#"+t).height(),e=yt/k,pt=f.top,ut=f.left,b=st-f.top;for(b>e&&e>400?(f.left=50,f.right=50):b>e&&e>300?(f.left=35,f.right=35):b>e&&e>200?(f.left=25,f.right=25):b>e&&e>50&&(f.left=15,f.right=15),i.inMultiIndicatorView||(f.top=16),g=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",r=0;r<k;r++){o=!1;s=!1;l=!1;var v=n.data[r],ft=[],ht=[],et=!1;for(u=0,d=v.length;u<d;u++){var nt=v[u],w=nt.value,ct=w!==null&&w!==undefined?i.valuta+chartutils.numberFormat(w,parseInt(i.noDec,10),null,{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc:"",wt=i.showPositiveSign&&w&&w>0?n.positiveSign:"";et||(et=ct.trim()!=="");ft[u]=wt+ct.trim();ht[u]=w;o=o||nt.dataType==="f";s=s||nt.dataType==="e";nt.dataType==="p"&&(l=!0,ft[u]="")}tt="";h=0;n.isDonutAggregate&&(r===0&&n.labelText&&n.labelText.length>0?h=Number(n.labelText):r===1&&n.compareLabelText&&n.compareLabelText.length>0&&(h=Number(n.compareLabelText)),n.centerLabelUnit==="%"&&(tt+=n.centerLabelUnit),h!==0&&(tt=chartutils.numberFormat(h,chartutils.nbrOfDecimals(h),null,{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})));lt={dataset:ht,datasetStr:ft,subtitle:at[r],subtitleTitle:vt[r],labelValue:h!==0?h:"",labelText:tt,useCenterLabel:n.isDonutAggregate,margin:n.inMultiIndicatorView?{top:0,bottom:f.bottom,left:0,right:0}:f,centerLabelUnit:!n.centerLabelUnit||n.centerLabelUnit==="%"?"":n.centerLabelUnit,showForecast:o,showEstimation:s,showExtra:l};ut+=r*e;p.changeSettings(lt);$("#"+t).is(":visible")&&(p.addChart(e,b,ut,pt),et||ot.nodata||ABF.AC.MissingChart(p,i,e,st,ut,n.noDataLabel,n.noDataDescr))}ABF.AC.AddSubtitles(t,n);ABF.AC.CustomizePaths(p,i.tileBgColor)}};this.CreatePie(n)};ABF.AC.SparkLine=function(n,t){ABF.AC.AddPresToList(n,t,"sparkline");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,showThousandsSeparator:!0};typeof n=="object"&&$.extend(i,n);this.CreateSparkLine=function(n){var u,r,k,c,f,v,o,e,ct,lt,g,st,nt,y,pt,wt,l,tt,bt,p,it;colorList=n.colorScheme;colorList=colorList?colorList.slice(0):[n.fill,n.fillBG];var ft=n.categories,v=[],h=n.series;h||(h=[],n.geoItem&&h.push({name:n.geoItem,data:n.geoData}),n.geoCompare&&h.push({name:n.geoCompare,data:n.geoCompareData}));var w=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",s=$.extend({},ABF.AC.GetDefaultOptions(i),{margin:{top:-14,right:0,bottom:0,left:0},rotation:0,autoRotation:!1,lineWidth:2,useTooltip:!0,dataUnitY1:"",colorList:colorList,categoryColorList:colorList,subtitle:"",skipLabel:0,lineStyle:"linear",showAxes:!0,inlineAxis:!0,showGridLines:!1,axisColor:i.fontColor,brokenAxis:!1,showValues:!1,fontsize:10,useMarker:!1,width:0,height:0,minYDefZero:!1,animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,source:"",showLegend:!1,titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:12,subtitleFontColor:i.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,labelFontSize:12,labelFontColor:i.fontColor,chartBackgroundColor:i.tileBgColor,axisXFontSize:0,axisXFontColor:i.fontColor,axisYFontSize:12,axisYFontColor:i.fontColor,onTooltipFunction:ABF.AC.Tooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,options:n,customLang:{thousandsSep:w,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},datasetY1:[{y:null}],dataPostfix:n.perc,dataPostfixY1:n.perc,dataPrefix:n.valuta,dataPrefixY1:n.valuta,nrOfDec:parseInt(i.noDec,10)}),b=0;for(u=0,seriesLength=h.length;u<seriesLength;u++)for(k=h[u],c=k.data,r=0,dataLength=c.length;r<dataLength;r++)f=c[r].value,b=b>f?b:f;for(s.customizedYMax=b,u=0,seriesLength=h.length;u<seriesLength;u++){for(v=[],r=0;r<ft.length;r++)v.push({xcode:""+r,x:ft[r]});var k=h[u],dt=k.name,c=k.data,d="";n.descriptions&&n.descriptions.length>u?d=n.descriptions[u]:n.descr&&(d=n.descr);var at=!1,vt=!1,yt=!1;for(r=0,dataLength=c.length;r<dataLength;r++){var f=c[r].value,et=i.valuta+chartutils.numberFormat(f,parseInt(i.noDec,10),null,{thousandsSep:w,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc,ot=f===null||f.length<=0||isNaN(f);(at||ot||(at=!0),ot)||(g=i.showEstimation&&c[r].dataType==="e"||i.showForecast&&c[r].dataType==="f",st={name:dt,namecode:u,x:ft[r],xcode:""+r,y:ot?null:f,ystring:et!==null&&et!==undefined?et.trim():"",special:g},(o===undefined||o===null||r===0)&&(o=f,ct=f,vt=g),(e===undefined||e===null||r===0)&&(e=f),f!==undefined&&f!==null&&(lt=f,yt=g),o=Math.min(o,f),e=Math.max(e,f),d.length>0&&(st.descr=d),v.push(st))}if(nt=ABF.AC.IsEmpty(v),s.dataset=nt?[]:v,s.nodata=nt?n.noDataLabel:"",s.colorList=[colorList[u]],s.customYMin=o!==undefined?o:null,s.customYMax=e!==undefined?e:null,e!==undefined&&o!==undefined&&e===o&&(e=e*2),y=parseFloat((e-o).toFixed(3)),s.customYStep=y!==0?y:1,s.customY2Min=o!==undefined?o:null,s.customY2Max=e!==undefined?e:null,s.customY2Step=y!==0?y:1,pt=$("#"+t+"_spark"+(u+1)).width(),wt=new ABFCharts_Line("#"+t+"_spark"+(u+1),s),wt.draw(),l=$("#"+t+"_spark"+(u+1)+" svg"),l.attr("width",pt+"px"),l.find(".axis path.domain").remove(),l.find(".y.axis.left g.tick:not(:first)").remove(),l.find(".y.axis.right g.tick:not(:first)").remove(),l.find("clipPath").remove(),tt=d3.select("#"+t+"_spark"+(u+1)+" svg"),bt=tt.select("g.chart").node(),bt&&(p=tt.select(".y.axis.left g.tick"),it=tt.select(".y.axis.right g.tick"),p.node()!==null&&it.node()!==null)){var gt=n.valuta+chartutils.numberFormat(ct,parseInt(n.noDec,10),null,{thousandsSep:w,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+n.perc,ni=n.valuta+chartutils.numberFormat(lt,parseInt(n.noDec,10),null,{thousandsSep:w,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+n.perc,ti=vt?"*":"",ii=yt?"*":"";p.select("text").text(gt+ti);it.select("text").text(ni+ii);var ht=p.attr("transform"),kt=ht.indexOf("("),ri=ht.indexOf(")"),rt=ht.substr(kt+1,ri-kt-1),a,ut;rt.indexOf(",")>0?(a=rt.split(","),ut="translate("+a[0]+","+(a[1]/2+7)+")"):rt.indexOf(" ")>0&&(a=rt.split(" "),ut="translate("+a[0]+" "+(a[1]/2+7)+")");p.attr("transform",ut);it.attr("transform",ut);nt&&$("#"+t+"_spark"+(u+1)+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr)}}};this.CreateSparkLine(n)};ABF.AC.Line=function(n,t){ABF.AC.AddPresToList(n,t,"line");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,showThousandsSeparator:!0,useCompare:!0,showGeoItems:!0,showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);this.CreateLine=function(n){var r,ut=n.useCompare&&n.geoCompareData!=null,s=n.colorScheme,w,f,ot,it,d,l,e,ht,ct,rt,lt;s=s?s.slice(0):ut?[n.fill,n.fillBG]:[n.fill];var a=n.categories,v=[],u=[],o=n.series;for(o||(o=[],n.geoItem&&o.push({name:n.geoItem,title:n.geoItemTitle,data:n.geoData}),ut&&o.push({name:n.geoCompare,title:n.geoCompareTitle,data:n.geoCompareData})),r=0;r<a.length;r++)v.push({xcode:""+r,x:a[r]});var g=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",y=[],ft=!1,et=!1;for(r=o.length-1;r>=0;r--){var nt=o[r],p=nt.name,h=nt.data,at=nt.title,b="";for(n.descriptions&&n.descriptions.length>r?b=n.descriptions[r]:n.descr&&(b=n.descr),w=!1,f=0,ot=h.length;f<ot;f++){var c=h[f].value,k=i.valuta+chartutils.numberFormat(c,parseInt(i.noDec,10),null,{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc,tt=c===null||c.length<=0||isNaN(c),st="";(w||tt||(w=!0),tt)||(i.showPositiveSign&&w&&c>0&&(st="+"),i.showForecast&&h[f].dataType==="f"&&(ft=!0),i.showEstimation&&h[f].dataType==="e"&&(et=!0),it={name:p,title:at,namecode:o.length-1-r,x:a[f],xcode:""+f,y:tt?null:c,ystring:k!==null&&k!==undefined&&k.length>0?st+k.trim():"",special:i.showEstimation&&h[f].dataType==="e"||i.showForecast&&h[f].dataType==="f"},b.length>0&&(it.descr=b),v.push(it))}d={type:"point",color:s[r],text:p};p&&p.trim().length>0&&(w||(d.nodata=n.noDataDescr,d.text+="*",v.push({name:p,namecode:o.length-1-r,x:a[0],xcode:"0",y:null})),i.showGeoItems&&u.push(d),y.push(s[r]))}if(y.length<=0&&(y=s),l=ABF.AC.IsEmpty(v),l)for(r=0;r<u.length;r++)u[r].text=o[r].name,u[r].nodata=null;ft&&u.unshift({type:"line",linetype:"dot",color:"",text:i.forecastLabel,addseperator:u.length>0,typeset:"Forecast"});et&&u.unshift({type:"line",linetype:"dot",color:"",text:i.estimationLabel,addseperator:u.length>0,typeset:"Estimation"});e=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:l?n.noDataLabel:"",dataset:l?[]:v,margin:{top:10,right:0,bottom:0,left:0},rotation:0,autoRotation:!1,autoXSplitText:!0,lineWidth:2,useTooltip:!0,dataPrefix:"",dataPrefixY1:"",dataPostfix:n.perc,dataPostfixY1:"",dataUnit:n.unit&&n.unit.length<4?n.unit:"",dataUnitY1:"",colorList:y,categoryColorList:y,subtitle:"",skipLabel:0,lineStyle:"linear",showAxes:!0,showGridLines:!0,inlineAxis:!0,axisColor:i.fontColor,brokenAxis:!0,customYMax:n.max,customYMin:n.min,showValues:!1,fontsize:10,useMarker:!0,markerColor:"default",markerBorderColor:"default",markerStyle:"circle",markerSize:8,width:0,height:0,minYDefZero:!1,lineStyles:"",animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,title:"",titleSubtitle:"",source:"",showLegend:u.length>0,legendData:l?[]:u.reverse(),titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:12,subtitleFontColor:i.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:16,labelFontColor:i.fontColor,chartBackgroundColor:i.tileBgColor,axisXFontSize:12,axisXFontColor:i.fontColor,axisYFontSize:12,axisTickSpace:24,axisYFontColor:i.fontColor,onTooltipFunction:ABF.AC.Tooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,options:n,customLang:{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},axisXLength:a.length,nrOfDec:parseInt(i.noDec,10)});u.length<=0&&(e.margin.bottom=41);n.showNormLine&&(e.medianDataset=n.normlineValue,e.medianColor=n.normlineColor,e.lineWidth=2,ht=isNaN(n.normlineValue)?n.normlineValue:i.valuta+chartutils.numberFormat(n.normlineValue,parseInt(i.noDec,10),null,{thousandsSep:g,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator}),ct=i.showPositiveSign&&!isNaN(n.normlineValue)&&n.normlineValue>0?n.positiveSign:"",u.length>0&&n.normlineLabel&&n.normlineLabel.length>0&&e.legendData.push({type:"line",color:n.normlineColor,text:n.normlineLabel}),e.averageLabel=ct+ht+i.perc,e.averageLabelAlignment="right",e.showLabelContrast=!0);rt=new ABFCharts_Line("#"+t,e);rt.draw();l&&$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr);n.showNormLine&&(lt=chartutils.getContrastLabelColor({labelFontColorContrast:"rgb(0,0,0)"},n.normlineColor,i.tileBgColor),d3.select("#"+t).select("svg").selectAll(".avglabel").selectAll("text").attr("fill",lt));ABF.AC.CustomizeAxes(rt,i.fontColor)};this.CreateLine(n)};ABF.AC.Bar=function(n,t){ABF.AC.AddPresToList(n,t,"bar");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inIndicatorView:!1,inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,combineBars:!1,autoCalcBarWidth:!1,rotation:0,showThousandsSeparator:!0,showGeoItems:!0,showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);this.CreateBar=function(n){var l,f,p,et,a=n.colorScheme,wt,ot,o,st,g,b,nt,r,kt,ct,lt,k,ni,at,u,ut,h,ti,ii,vt,ft;a=a?a.slice(0):[n.fill,n.fillBG];var v=n.categories,c=[],d=[],w=a,s=[],yt=!1,pt=!1;for(u=0,wt=n.series.length;u<wt;u++){var y=n.series[u],bt=y.name,ri=y.title,e=y.data;if(n.combineBars&&u===1||!n.combineBars){if(f=bt,et=ABF.AC.IsEmpty(e),et)f+="*";else if(!n.combineBars){for(ot=!0,r=0;r<e.length;r++)if(o=e[r].value,o!==null&&!isNaN(o)){ot=!1;break}ot&&(f+="*")}n.combineBars||i.showGeoItems||(f="");d.push(f);st=d.length;g=w[u];y.color&&(g=y.color,w.length<st?w.push(y.color):w[st-1]=y.color);p=n.combineBars?{type:"box",color:g,text:f,addseperator:!0}:{type:"point",color:g,text:f};et&&(p.nodata=n.noDataDescr);f&&f.trim().length>0&&s.push(p)}for(b="",n.combineBars||(n.descriptions&&n.descriptions.length>u?b=n.descriptions[u]:n.descr&&(b=n.descr)),nt=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",r=0,kt=e.length;r<kt;r++){var o=e[r].value,tt=n.combineBars&&u===1||!n.inIndicatorView&&(o.length<=0||isNaN(o))?"":o.length<=0||isNaN(o)?o:i.valuta+chartutils.numberFormat(o,parseInt(i.noDec,10),null,{thousandsSep:nt,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator}),dt=o===null||o.length<=0||isNaN(o),ui=i.showPositiveSign&&!dt&&e[r].value>0?n.positiveSign:"",it={name:bt,title:ri,namecode:u,x:v&&v.length>0||n.inIndicatorView&&v&&v.length>0?v[r]:"",xcode:""+r,y:dt?null:e[r].value,ystring:tt!==null&&tt!==undefined&&tt.length>0?ui+tt.trim():"",t:e[r].dataType};if(i.showForecast&&e[r].dataType==="f"&&(yt=!0),i.showEstimation&&e[r].dataType==="e"&&(pt=!0),n.combineBars&&(n.descriptions&&n.descriptions.length>r&&(b=n.descriptions[r]),it.catCode=e.length),n.combineBars&&u===0){d.push(v[r]);it.catCode=r;f=v[r];var gt=e[r].value,rt=!1,ht=[];isNaN(gt)?(ht.push(null),rt=!0):ht.push(gt);n.series[1]&&(ct=n.series[1].data[r].value,lt=isNaN(ct)?null:ct,lt===null&&(rt=!0),ht.push(lt));rt&&(f+="*");p={type:"point",color:w[r],text:f};rt&&(p.nodata=n.noDataDescr);s.push(p)}b.length>0&&(it.descr=b);c.push(it)}}for(yt&&s.push(ABF.AC.getForecastLegend(i,s.length>0)),pt&&s.push(ABF.AC.getEstimateLegend(i,s.length>0)),k=c.length,n.combineBars&&(ni=c.splice(k/n.series.length),c=ni.concat(c)),l=ABF.AC.IsEmpty(c),l&&c.forEach(function(n){n.ystring=""}),at=!0,u=0;u<a.length;u++)if(ut=a[u],ut&&(ft=chartutils.getContrastLabelColor({labelFontColorContrast:"rgb(0,0,0)"},ut,i.tileBgColor),ut!==ft)){at=!1;break}h=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:l?n.noDataLabel:"",dataset:l?[]:c,categorySet:l?[]:d,legendData:l?[]:s,margin:{top:10,right:0,bottom:0,left:0},colorList:a,categoryColorList:w,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,groupPadding:0,barPadding:n.combineBars||n.inIndicatorView&&k>2||n.noPadding?0:n.inIndicatorView?20:20/k,showAxisXLabels:!0,autoCalcBarWidth:n.combineBars&&k/2>8?!1:!0,autoXSplitText:!0,title:"",titleSubtitle:"",titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:12,subtitleFontColor:i.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:16,labelFontColor:i.fontColor,showLabelBarColor:at,autoRotateLabels:!0,chartBackgroundColor:i.tileBgColor,axisXFontSize:n.hideAxisLabels||n.combineBars?0:12,legendMargin:n.hideAxisLabels||n.combineBars?36:0,axisXFontColor:i.fontColor,axisYFontSize:12,axisTickSpace:24,axisYFontColor:i.fontColor,mirrorDataset:[],dataUnit:"",animateHover:!0,useTooltip:!0,showLegend:s.length>0,showValues:i.showGraphLabel,axisColor:i.fontColor,brokenAxis:!0,customYMax:n.max,customYMin:n.min,showGridLines:!0,inlineAxis:!0,minYDefZero:n.min!==null&&n.max!==null?!1:!0,options:n,showLabelContrast:!0,customLang:{thousandsSep:nt,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},combineBars:i.combineBars,stacked:!1,mirrored:!1,dataPostfix:n.perc,onTooltipFunction:ABF.AC.Tooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,rotation:i.rotation,nrOfDec:parseInt(i.noDec,10)});n.showNormLine&&(h.medianDataset=n.normlineValue,h.medianColor=n.normlineColor,h.lineWidth=2,ti=isNaN(n.normlineValue)?n.normlineValue:i.valuta+chartutils.numberFormat(n.normlineValue,parseInt(i.noDec,10),null,{thousandsSep:nt,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator}),ii=i.showPositiveSign&&!isNaN(n.normlineValue)&&n.normlineValue>0?n.positiveSign:"",h.averageLabel=ii+ti+i.perc,h.averageLabelAlignment="right",s.length>0&&n.normlineLabel&&n.normlineLabel.length>0&&h.legendData.push({type:"line",color:n.normlineColor,text:n.normlineLabel}));s.length<=0&&(h.margin.bottom=41);vt=new ABFCharts_Bar("#"+t,h);vt.draw();l&&$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr);d3.select("#"+t+" svg").selectAll("g.label.bar rect").style("opacity",.5);n.showNormLine&&(ft=chartutils.getContrastLabelColor({labelFontColorContrast:"rgb(0,0,0)"},n.normlineColor,i.tileBgColor),d3.select("#"+t).select("svg").selectAll(".avglabel").selectAll("text").attr("fill",ft));ABF.AC.CustomizeAxes(vt,i.fontColor)};this.CreateBar(n)};ABF.AC.BarMirrored=function(n,t){ABF.AC.AddPresToList(n,t,"barmirrored");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inIndicatorView:!1,inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,combineBars:!1,autoCalcBarWidth:!1,rotation:0,showThousandsSeparator:!0};typeof n=="object"&&$.extend(i,n);this.CreateBarMirrored=function(n){var f,e=n.colorScheme,b,u,c,l,w,s,g,ot;e=e?e.slice(0):[n.fill,n.fillBG];b=e.splice(e.length/2);b=b.reverse();e=e.concat(b);var k=[],nt=[],ht=e,o=[],tt=n.seriesLeft,it=n.seriesRight;n.categories=!n.categories||n.categories.length<1?[" "]:n.categories;var a=n.categories,d=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",y=!1,p=!1;for(u=0;u<a.length;u++){for(w=a[u],f=0,seriesLength=tt.length;f<seriesLength;f++){var v=tt[f],rt=v.name,r=v.data[u].value,h=i.valuta+chartutils.numberFormat(r,parseInt(i.noDec,10),null,{thousandsSep:d,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc,ut=r===null||isNaN(r||r.length<=0);ut&&r!==null&&(r=null,h=r);c={name:w,x:rt,y:r,ystring:h!==null&&h!==undefined?h.trim():"",t:v.data[u].dataType};y=y||c.t==="f";p=p||c.t==="e";k.push(c)}for(f=0,seriesLength=it.length;f<seriesLength;f++){var v=it[f],rt=v.name,r=v.data[u].value,h=i.valuta+chartutils.numberFormat(r,parseInt(i.noDec,10),null,{thousandsSep:d,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+i.perc,ut=r===null||isNaN(r||r.length<=0);ut&&r!==null&&(h=r);c={name:w,x:rt,y:r,ystring:h!==null&&h!==undefined?h.trim():"",t:v.data[u].dataType};y=y||c.t==="f";p=p||c.t==="e";nt.push(c)}}var o=[],ft=[n.leftLabel,n.rightLabel],et=0;for(u=0;u<ft.length;u++)if(l={type:"none",text:ft[u]},a.length<=1?(l.type="point",l.color=e[u]):l.rowstart=!0,o.push(l),a.length>1)for(f=0;f<a.length;f++)w=a[f],l={type:"point",text:w,color:e[et]},o.push(l),et++;if(y&&o.push(ABF.AC.getForecastLegend(i,o.length>0)),p&&o.push(ABF.AC.getEstimateLegend(i,o.length>0)),s=ABF.AC.IsEmpty(k),s&&k.forEach(function(n){n.ystring=""}),g=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:s?n.noDataLabel:"",dataset:s?[]:nt,mirrorDataset:s?[]:k,categorySet:s?[]:[],legendData:s?[]:o,margin:{top:10,right:0,bottom:0,left:0},colorList:e,categoryColorList:ht,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,groupPadding:0,barPadding:0,showAxisXLabels:!0,autoCalcBarWidth:!0,autoXSplitText:!0,title:"",titleSubtitle:"",titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:12,subtitleFontColor:i.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:16,labelFontColor:i.fontColor,autoRotateLabels:!0,chartBackgroundColor:i.tileBgColor,axisXFontSize:12,legendMargin:0,axisXFontColor:i.fontColor,axisYFontSize:12,axisTickSpace:24,axisYFontColor:i.fontColor,dataUnit:"",animateHover:!0,useTooltip:!0,showLegend:o.length>0,showValues:i.showGraphLabel,axisColor:i.fontColor,brokenAxis:!0,customYMax:n.max,customYMin:n.min,showGridLines:!1,inlineAxis:!1,minYDefZero:n.min!==null&&n.max!==null?!1:!0,options:n,showLabelContrast:!0,customLang:{thousandsSep:d,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},stacked:!0,mirrored:!0,onTooltipFunction:ABF.AC.Tooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,rotation:i.rotation,nrOfDec:parseInt(i.noDec,10)}),o.length<=0&&(g.margin.bottom=41),ot=new ABFCharts_Column("#"+t,g),ot.draw(),s)$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr);else{var ct=d3.select("#"+t).select("svg"),st=ct.select("g.chart"),lt=st.node().getBBox().width,at=st.select("g.axes").node().transform.baseVal.consolidate().matrix.e;d3.select("#"+t+" svg").selectAll("g.label.bar circle").remove();d3.select("#"+t+" svg").selectAll("g.label.bar rect").style("opacity",.5);d3.select("#"+t).select("svg g.axes g.axis.y").selectAll("path.domain").attr("display","none");d3.select("#"+t+" svg").select("g.x.axis").selectAll("g.tick").each(function(){var t=this.transform.baseVal.consolidate().matrix,n=d3.select(this).select("text"),i=n.node().getBBox().width;t.e+i/2+at>lt&&n.attr("text-anchor","end")})}};this.CreateBarMirrored(n)};ABF.AC.RankingBar=function(n,t){var i,r,u;ABF.AC.AddPresToList(n,t,"rankingbar");i={fontColor:"fff",tileBgColor:"ccc",indicator:"",noDec:"0",perc:"",valuta:"",unit:"",geoItem:"",series:null,average:null,averageLabel:"",averageLabelAlignment:"left",xAxisTitle:"",useSimpleTooltip:!0,isRanking:!0,min:null,max:null,rankingMinColor:"rgb(0,0,0)",rankingInterColor:"rgb(0,0,0)",rankingMaxColor:"rgb(0,0,0)",rankingMinString:"",rankingInterString:"",rankingMaxString:"",rankingAreaString:"",rankingAreaColor:"rgb(0,0,0)",rankingCompAreaString:"",rankingCompAreaColor:"rgb(0,0,0)",descr:"",sortDirection:"ascending",showThousandsSeparator:!0,showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);r=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"";u=isNaN(i.average)?i.average:i.valuta+chartutils.numberFormat(i.average,parseInt(i.noDec,10),null,{thousandsSep:r,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator});this.CreateRankingBar=function(n){for(var l,s,d,h,f,g,p=[],o=0;o<n.series.length;o++)l=n.series[o],p.push(l.c);var c=[],w=!1,b=!1;for(o=0;o<n.series.length;o++){var l=n.series[o],tt=l.name,a=l.data,v="";for(n.descriptions&&n.descriptions.length>o?v=n.descriptions[o]:n.descr&&(v=n.descr),s=0;s<a.length;s++){var e=a[s],y=n.combineBars&&o===1||e===null&&n.combineBars?"":e===null||e.length<=0?ABF_Dashboard_Model.Settings.MissingValue:i.valuta+chartutils.numberFormat(e.y,parseInt(i.noDec,10),null,{thousandsSep:r,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator}),it=i.showPositiveSign&&e&&e.y&&e.y>0?n.positiveSign:"",k={name:tt,title:e.t,x:e.n,y:e.y,showValue:e.dl?e.dl.enabled:!1,color:e.c,ystring:y!==null&&y!==undefined&&y.length>0?it+y.trim():"",t:e.dt};v.length>0&&(k.descr=v);i.showForecast&&a[s].dt==="f"&&(w=!0);i.showEstimation&&a[s].dt==="e"&&(b=!0);c.push(k)}}d=c.length;h=ABF.AC.IsEmpty(c);h&&c.forEach(function(n){n.ystring=""});f=[];n.rankingMinString.length>0&&f.push({type:"point",color:n.rankingMinColor,text:n.rankingMinString});n.rankingInterString.length>0&&f.push({type:"point",color:n.rankingInterColor,text:n.rankingInterString});n.rankingMaxString.length>0&&f.push({type:"point",color:n.rankingMaxColor,text:n.rankingMaxString});n.sortDirection.toLowerCase()==="descending"&&(f=f.reverse());n.rankingAreaString.length>0&&(f.push({type:"point",color:n.rankingAreaColor,text:n.rankingAreaString}),n.rankingAreaNoDataDescr.length>0&&(f[f.length-1].nodata=n.rankingAreaNoDataDescr));n.rankingCompAreaString.length>0&&(f.push({type:"point",color:n.rankingCompAreaColor,text:n.rankingCompAreaString}),n.rankingCompAreaNoDataDescr.length>0&&(f[f.length-1].nodata=n.rankingCompAreaNoDataDescr));!isNaN(i.average)&&n.geoCompare&&(g=n.regionPlural?n.regionPlural:n.geoCompare,f.push({type:"point",color:n.rankingCompAreaColor,text:n.averageLabel+" "+g}));w&&f.push(ABF.AC.getForecastLegend(i,f.length>0));b&&f.push(ABF.AC.getEstimateLegend(i,f.length>0));var rt=i.showPositiveSign&&!isNaN(u)&&u>0?n.positiveSign:"",ut=$.extend({},ABF.AC.GetDefaultOptions(i),{averageLineColor:n.rankingCompAreaColor,averageLabel:rt+u+i.perc,averageLabelAlignment:"right",nodata:h?n.rankingAreaNoDataLabel:"",dataset:c,categorySet:[],margin:{top:10,right:0,bottom:0,left:0},colorList:p,categoryColorList:[],duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,drawBarDelay:0,barPadding:60/d,showAxisXLabels:!1,autoCalcBarWidth:!0,title:"",titleSubtitle:"",titleFontSize:18,titleFontColor:n.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:12,subtitleFontColor:n.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendData:h?[]:f,legendFontSize:12,legendFontColor:n.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:20,labelFontColor:n.rankingCompAreaColor,showLabelBarColor:!0,showLabelContrast:!0,chartBackgroundColor:i.tileBgColor,axisXFontSize:12,axisXFontColor:n.fontColor,axisYFontSize:12,axisTickSpace:24,axisYFontColor:n.fontColor,dataUnit:"",dataPostfix:n.perc,animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,useTooltip:!0,showLegend:f.length>0&&!h,showValues:n.showGraphLabel,axisColor:n.fontColor,brokenAxis:!0,customYMax:n.max,customYMin:n.min,showGridLines:!0,inlineAxis:!0,minYDefZero:n.min!==null&&n.max!==null?!1:!0,autoRotateLabels:!1,showAverage:!0,averageDataSet:[n.average],legendMargin:18,xAxisTitle:n.xAxisTitle,lineWidth:1,options:n,customLang:{thousandsSep:r,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},onTooltipFunction:ABF.AC.ColumnTooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,rotation:0,nrOfDec:parseInt(i.noDec,10)}),nt=new ABFCharts_Bar("#"+t,ut);nt.draw();d3.select("#"+t).select("svg").selectAll(".avglabel").attr("font-weight","bold");h&&$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.rankingAreaNoDataDescr);d3.select("#"+t+" svg").selectAll("g.label.bar circle").remove();d3.select("#"+t+" svg").selectAll("g.label.bar rect").style("opacity",.5);ABF.AC.CustomizeAxes(nt,i.fontColor)};this.CreateRankingBar(i)};ABF.AC.SvgColumn=function(n,t){ABF.AC.AddPresToList(n,t,"column_svg");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,showThousandsSeparator:!0,isDrilldown:!1};typeof n=="object"&&$.extend(i,n);this.Tooltip=function(){return};this.CreateSvgColumn=function(n){var f=$.extend({},ABF.AC.GetDefaultOptions(i),{margin:{top:0,right:-10,bottom:0,left:0},duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,groupPadding:0,colorList:[n.barFill,n.barBackground],barPadding:0,autoCalcBarWidth:!0,animateHover:!1,useTooltip:!0,showLegend:!1,showValues:!1,customYMax:n.max,customYMin:n.min,inlineAxis:!1,showAxes:!1,showAxisXLabels:!1,minYDefZero:n.min!==null&&n.max!==null?!1:!0,options:n,stacked:!0,onTooltipFunction:this.Tooltip}),r,u,e,o;n.value===undefined||isNaN(n.value)||(r=n.value,u=0,r<n.max&&r>=n.min&&(u=n.max-r+n.min),e=[{x:"",name:"value",y:r},{x:"",name:"restValue",y:u}],f.dataset=e,o=new ABFCharts_Column("#bar_"+t,f),o.draw());n.valueCompare===undefined||n.valueCompare===null||isNaN(n.valueCompare)||(r=n.valueCompare,u=0,r<n.max&&r>=n.min&&(u=n.max-r+n.min),e=[{x:"",name:"value",y:r},{x:"",name:"restValue",y:u}],f.dataset=e,o=new ABFCharts_Column("#bar_compare_"+t,f),o.draw())};this.CreateSvgColumn(n)};ABF.AC.Column=function(n,t){ABF.AC.AddPresToList(n,t,"column");var i={data:null,callback:null,categories:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",inMultiIndicatorView:!1,ShowNegativeWarning:!1,descr:"",descriptions:null,showGraphLabel:!1,showThousandsSeparator:!0,isDrilldown:!1};typeof n=="object"&&$.extend(i,n);this.CreateColumn=function(n){var r,l=n.colorScheme,d,u,ri,yt,it,rt,pt,ft,st,y,o,h,wt,bt,p,dt,ht,gt;l=l?l.slice(0):[n.fill,n.fillBG];n.isDrilldown&&ABF.AC.DrilldownHeight(n,t);var ct=n.geoCompare?[n.geoItem,n.geoCompare]:[n.geoItem],si=n.geoCompare?[n.geoItemTitle,n.geoCompareTitle]:[n.geoItemTitle],ni=n.categories,ot=n.titles,b=[],ti={},f=!1,c=n.series,k=0,e;if(c)for(u=0;u<c.length;u++)for(e=c[u].data,r=0;r<e.length;r++)d=e[r]?e[r].value:null,!isNaN(d)&&d>k&&!i.stacked?k=d:!isNaN(d)&&i.stacked&&(k+=d);else f=!0,c=n.geoCompare&&n.geoCompareData?[{name:n.indicator,data:[n.geoData,n.geoCompareData]}]:[{name:n.indicator,data:[n.geoData]}],k=isNaN(n.geoData)?isNaN(n.geoCompareData)?0:n.geoCompareData:n.geoData;var g=[],ii=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",lt=!1,at=!1,vt=!1,a,v;for(u=0,ri=c.length;u<ri;u++){for(yt=c[u],it=yt.name,e=yt.data,rt="",n.descriptions&&n.descriptions.length>u?rt=n.descriptions[u]:n.descr&&(rt=n.descr),pt=!1,r=e.length-1;r>=0;r--){var s=e[r]?e[r].value:null,ut=i.valuta+chartutils.numberFormat(s,parseInt(i.noDec,10),null,{thousandsSep:ii,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator}),nt=s===null||isNaN(s||s.length<=0),ui="";nt&&(pt=!0);nt&&s!==null&&(ut=s,f&&(l[r]="transparent"));ti[ct[r]]|=!nt;(ot==null||ot==undefined)&&(ot=ni);ft=nt?f?k/4:null:s;i.showPositiveSign&&ft&&ft>0&&(ui=n.positiveSign);st="";i.showForecast&&e[r].dataType==="f"&&(lt=!0,n.inListView&&(st="*"));i.showEstimation&&e[r].dataType==="e"&&(at=!0,n.inListView&&(st="*"));y={name:it,x:i.isDrilldown?ni[r]:ct[r],title:i.isDrilldown?ot[r]:si[r],xcode:r+1,y:ft,t:e[r].dataType,ystring:ut!==null&&ut!==undefined&&ut.length>0?ui+ut.trim()+st:"",empty:nt};e[r].dataType==="p"&&ft>=.5&&(vt=!0,y.ystring="",y.hideLabel=!0,y.ignoreTT=!0);rt.length>0&&(y.descr=rt);c.length===1&&f&&(y.catCode=r);nt&&(y.nodata=n.noDataDescr);(a===undefined||a===null||r===e.length-1)&&(a=s);(v===undefined||v===null||r===e.length-1)&&(v=s);a=Math.min(a,s);v=Math.max(v,s);b.push(y)}if(!f){if(o={type:"point",color:l[u],text:it},pt&&(o.nodata=n.noDataDescr,o.text+="*"),it!=="___"+ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown+"___"||vt)it==="___"+ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown+"___"&&(l[u]="transparent",o.text=ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown,o.color="url("+window.location.href+"#"+t+"DashedDownwardDiagonal_p)");else continue;g.push(o)}}lt&&(o=ABF.AC.getForecastLegend(i,g.length>0),o.addseperator=!f,g.push(o));at&&(o=ABF.AC.getEstimateLegend(i,g.length>0),o.addseperator=!f,g.push(o));var fi=!f||!n.inListView&&(lt||at),hi=f&&!n.inListView?fi?35:77:0,ei=!1,et=ABF.AC.IsEmpty(b);if(et||n.isDrilldown||b.forEach(function(t,i){if(ti[t.x]){t.y===null&&t.ystring.length>0&&(t.ystring="");return}t.ystring=i<b.length/c.length?t.ystring:"";t.y=n.isDrilldown?t.y:i<b.length/c.length?k/2:null;ei=!0}),h=$.extend({},ABF.AC.GetDefaultOptions(i),{showExtra:vt,nodata:et?n.noDataLabel:"",dataset:et?[]:b,categorySet:f?ct:"",margin:{top:10,right:0,bottom:hi,left:0},colorList:l,categoryColorList:l,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,autoCalcBarWidth:!0,barPadding:n.inListView?-2:0,title:"",titleSubtitle:"",titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:12,subtitleFontColor:i.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendData:et?[]:g,legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,centerLegendRows:!0,legendIconDefault:"point",labelFontSize:16,labelFontColor:i.stacked?"rgb(0,0,0)":i.fontColor,chartBackgroundColor:i.tileBgColor,axisXFontSize:20,axisXFontColor:i.fontColor,axisYFontSize:12,axisYFontColor:i.fontColor,mirrorDataset:[],dataUnit:"",labelSplitSmall:n.perc.trim(),animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,useTooltip:!0,showLegend:fi,showAxisXLabels:!f,showValues:n.showGraphLabel,showEmptyLabel:ei,axisColor:i.fontColor,brokenAxis:!0,customYMax:n.max,customYMin:n.min,showGridLines:!1,inlineAxis:!0,showAxes:!n.inListView,minYDefZero:n.min!==null&&n.max!==null?!1:!0,rotation:0,forceDataLabel:i.isDrilldown||i.forceShowLabel,drawBarDelay:i.isDrilldown?0:50,dataPostfix:n.perc,stacked:i.stacked,mirrored:!1,showLabelContrast:!0,showLabelInside:f||i.isDrilldown,customLang:{thousandsSep:ii,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},onTooltipFunction:ABF.AC.ColumnTooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,options:n,nrOfDec:parseInt(i.noDec,10)}),i.stacked&&n.geoItem.trim().length<=0&&(h.legendMargin=16),$("#"+t).parent().parent().hasClass("height2")&&(h.margin.top=-7,h.margin.bottom=0,h.axisXFontSize=12,h.labelFontSize=12),n.inListView&&(h.margin.top=-5,h.customYMin=a!==undefined&&!isNaN(a)?a:null,h.customYMax=v!==undefined&&!isNaN(v)?v:null),wt=new ABFCharts_Column("#"+t,h),wt.draw(),f){if(p=d3.select("#"+t).select("svg"),bt=p.select("g.chart"),!bt.empty()){var oi=bt.node().getBBox(),kt=oi.width,w=oi.height,tt=w>100?20:15,ci=w>100?w/3:w/4,li=w>100?w*5/6:w*2/3;n.refSymbol&&n.refSymbol.length>1&&p.select("g.chart").append("image").attr("xlink:href","images/"+n.refSymbol).attr("x",kt-tt-2).attr("y",ci).attr("width",tt).attr("height",tt);n.refSymbolCompare&&n.refSymbolCompare.length>1&&p.select("g.chart").append("image").attr("xlink:href","images/"+n.refSymbolCompare).attr("x",kt-tt-2).attr("y",li).attr("width",tt).attr("height",tt)}(n.geoData<0||n.geoCompareData<0)&&p.select(".y.axis").select(".domain").remove()}for((i.stacked||f)&&(p=d3.select("#"+t).select("svg"),p.selectAll(".y.axis g.tick text").each(function(){var n=this.getBBox(),t=d3.select(this.parentNode).append("rect"),r;t.attr("width",n.width).attr("height",n.height).attr("x",n.x).attr("y",n.y).attr("fill",i.tileBgColor).style("opacity",.8);r=t.node();this.parentNode.insertBefore(r,this)})),dt=$("#"+t+" svg").find("g.bar"),ABF.AC.CustomizeRects(wt,n.tileBgColor),u=0;u<dt.length;u++)ht=dt[u],gt=d3.select(ht).datum(),gt&&gt.empty&&(d3.select(ht).select("rect:not(.bgbar)").attr("fill","transparent").attr("stroke-width","0"),d3.select(ht).select("g.labels text").attr("fill",i.fontColor));et?$("#"+t+" svg").find("g.nodataGroup").attr("data-nodata",n.noDataDescr):($("#"+t+" svg").find("g.x.axis g.tick text").first().attr("text-anchor","start"),f||d3.select("#"+t+" svg").select("g.x.axis").selectAll("g.tick").each(function(){var t=this.transform.baseVal.consolidate().matrix,n=d3.select(this).select("text"),i=n.node().getBBox().width;t.e+i/2>kt&&n.attr("text-anchor","end")}));n.inListView&&d3.select("#"+t).select("svg").selectAll("path.domain").attr("display","none");ABF.AC.AddSubtitles(t,n,!0)};this.CreateColumn(n)};ABF.AC.ViewerTile={Init:function(n,t){ABF.AC.AddPresToList(n,t,"viewer");var i=function(i){ABF.AC.ViewerTile.Create(n,t,i)};ABF.AC.ViewerTile._getData(n,i)},Create:function(n,t,i){var r=$("#"+t),l=r.find("h2"),o="",s=!1,p,a,u,g,v,h,f,e;i.title?(r.attr("title",i.title),l.text(i.title),l.removeClass("u-hidden"),ABF_Dashboard_Utilities._ResizeTextToHeader(l),p=r.find("a.iframe_link"),p.attr("title",i.title),p.find("span").html(i.title),r.find("iframe").attr("title",i.title)):l.remove();n.subtitle?(o=n.subtitle,s=!0):(i.region&&i.region.length>0&&n.showAreas&&(o=i.region,s=!0),!i.unit||i.unit==="%"||i.unit==="€"||!n.showUnit||(o=s?o+", "+i.unit:i.unit,s=!0));s?r.find(".subtitle.unit").text(o):r.find(".subtitle.unit").removeClass("js-retain");i.source&&r.find("footer .source").text(i.source);i.period&&(a=i.period,i.source&&i.source.length>0&&(a=" | "+a),r.find("footer .period").text(a));r=r.find(".content");var tt=r.width(),it=r.height(),k=[],d=[],w=[];for(u=0,g=i.legend.length;u<g;u++)if(v=i.legend[u].legendGroup,h=v==="ReferenceValues",v==="Data"||h)for(f=0;f<i.legend[u].items.length;f++){var e=i.legend[u].items[f],b=e.type==="Favorite",nt={color:e.color,text:e.text,type:h||b?"box":"point",typeset:e.type,addseperator:h||b,outlinecolor:e.outlinecolor};h||b?d.push(nt):k.push(nt)}else if(v==="SpecialValues")for(f=0;f<i.legend[u].items.length;f++)e=i.legend[u].items[f],e.type==="Forecast"?(w.push(ABF.AC.getForecastLegend(n,!0,!1)),n.showForecast=!0):e.type==="Estimate"&&(w.push(ABF.AC.getEstimateLegend(n,!0)),n.showEstimation=!0);var rt=k.concat(d).concat(w),ut=$.extend({},ABF.AC.GetDefaultOptions(n),{legendData:rt,legendPosition:"bottom",legendFontColor:n.fontColor,legendHeight:26,legendIconDefault:"point",useTooltip:!1,onLegendTooltipFunction:null,margin:{top:0,right:0,bottom:0,left:0},verticalLegendMarginTop:0,centerLegendRows:!0}),c=new ABFCharts_Empty("#"+t+"_legend",ut);c.draw();var y={top:c.settings.margin.top,bottom:c.settings.margin.bottom,left:c.settings.margin.left,right:c.settings.margin.right},ft=tt-y.left-y.right,et=it-y.bottom-y.top;r.find(".presel-image").width(ft);r.find(".presel-image").height(et)},_getData:function(n,t){$.ajax({url:n.RequestUrl,type:"POST",contentType:"application/json; charset=utf-8",error:function(n,t,i){console.log(i)},success:function(n){if(n)try{t(JSON.parse(n))}catch(i){console.log(i)}}})}};ABF.AC.Map={AbfMaps:[],_geolevelRequest:{},GetMapGeoJson:function(n,t){if(ABF.AC.Map._geolevelRequest[t])return ABF.AC.Map._geolevelRequest[t];var o=typeof ABF_Dashboard_Controller!="undefined",r,u,i,f,e;return o?(u=setTimeout(function(){ABF_Dashboard_Controller.ShowLoading()},1e3),i=ABF_Dashboard_Controller.HideLoading,r=ABF_Dashboard_Model.Settings.Url_SwingDashboardSvc,e=ABF_Dashboard_Model._getThemeCode(),f=ABF_Dashboard_Model.Mosaic.Name):ABF.Globals?(u=setTimeout(function(){ABF.GUI.ShowLoading()},1e3),i=ABF.GUI.HideLoading,r=ABF.GlobalSettings.AbfServerPath,e=ABF.Globals.SelectedTheme,f=ABF.Globals.DashboardName):(i=function(){},r=ABF_Dashboard_Model.Settings.ServerPath,e=ABF_Dashboard_Model.Settings.ThemeCode,f=ABF_Dashboard_Model.Settings.DashboardName),ABF.AC.Map._geolevelRequest[t]=new Promise(function(t,e){var o={request:"getgeojson",NameDashboard:f,GUID:n,AvailableGeoJson:[]},s=new Date;o.rand=s.getTime();$.ajax({url:r,type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify(o),error:function(){clearTimeout(u);i();e()},success:function(n){clearTimeout(u);i();var r=JSON.parse(n);r.GeoJson&&ABF_GeoJSON.IndexedDb.SetGeoJsonForLevel(r.GeoJson,r.GeoJsonCode);t(r.GeoJson)}})}),ABF.AC.Map._geolevelRequest[t]},Create:function(n,t){var i=function(i){n.data.geoJson=i;ABF.AC.Map.Init(n,t,n.Colorscheme)};n.mapgeolevel&&ABF_GeoJSON.IndexedDb.HasGeoJsonForLevel(n.mapgeolevel)?i(ABF_GeoJSON.IndexedDb.GetGeoJsonForLevel(n.mapgeolevel)):ABF.AC.Map.GetMapGeoJson(n.tileID,n.mapgeolevel).then(function(n){i(n)}).catch(function(n){console.log(n)})},Init:function(n,t,i){i&&(n.colorList=i);ABF.AC.AddPresToList(n,t,"map");var r={addLegend:!0,data:null,geoItem:null,geoCompare:null,urlInfo:null,fontColor:"fff",tileBgColor:"ccc",borderColor:"rgb(127,127,127)",baseItemColor:"rgb(255,69,0)",unit:"",indicator:"",noDec:"0",perc:"",valuta:"",period:"",title:"",descr:"",showGraphLabel:!1,useTooltip:!0,nodata:"",baseItemInLegend:!0,showPositiveSign:!1,positiveSign:"+",hasForecastData:!1,hasEstimateData:!1,dataPostfix:"",dataPrefix:""};n.data&&n.data.GeoItems&&n.data.GeoItems.length!=0?n.data.geoJson?(r.geojsonObject=JSON.parse(n.data.geoJson),r.geojsonObject.features&&r.geojsonObject.features.length!=0||(r.nodata="Geen kaart beschikbaar")):r.nodata="Geen kaart beschikbaar":r.nodata="Geen data";typeof n=="object"&&$.extend(r,n);this._createMap(r,t)},_createMap:function(n,t){var dt=$("#"+t),ci=t+"_legend",k=t+"_map",lt=$("#"+k),c=[],s=n.showMapAsPoints?n.showMapAsPoints:!1,gt,at,vt,yt,ni,ti,d,g,a,v,y,nt,tt,it,pt,u,h,r,l,rt,ft,kt,ei,oi,et,b,ot,o,e,f,ht,ct,i,hi;if(n.addLegend===!0&&!(!n.data.geoJson||n.nodata)){if(s)for(gt=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",i=0;i<n.data.DataClasses.length-1;i++)yt=n.data.DataClasses[i],i==0&&(at=yt.Maximum),at>0&&i>0?(ni=yt.Minimum/at,vt=12*Math.sqrt(ni)):vt=i===0?12:12*Math.sqrt(i+1),ti=chartutils.numberFormat(n.data.DataClasses[i].Maximum,"",null,{thousandsSep:gt,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator}),d={color:n.colorList[0],text:ti,type:"elipse",iconsize:vt,maxiconsize:25,typeset:"DataSet"},c.push(d);else for(i=0;i<n.data.DataClasses.length;i++)d={color:n.colorList[i],text:n.data.DataClasses[i].Label,type:"point"},c.push(d);n.baseItemInLegend&&(g={color:s?n.colorList[1]:"transparent",text:n.geoItem,type:s?"elipse":"box",outlinecolor:s?n.colorList[1]:n.baseItemColor,addseperator:!0},s&&(g.maxiconsize=26,g.iconsize=10),c.push(g));n.hasForecastData&&c.push(ABF.AC.getForecastLegend(n,c.length>0,s));n.hasEstimateData&&c.push(ABF.AC.getEstimateLegend(n,c.length>0))}var ii=dt.width(),ri=dt.height(),ui=!0,fi="right";if(ii<1.5*ri&&(fi="bottom",ui=!1),a=$.extend({},ABF.AC.GetDefaultOptions(n),{legendData:c,legendPosition:fi,legendFontColor:n.fontColor,legendHeight:26,legendIconDefault:"point",nodata:n.nodata,useTooltip:!1,onLegendTooltipFunction:null,sourceFontColor:n.fontColor,titleBackgroundColor:n.tileBgColor,titleFontColor:n.fontColor,sourceBackgroundColor:n.tileBgColor,sourceFontSize:12,sourcePosition:"bottomcenter",margin:{top:0,right:0,bottom:5,left:0},verticalLegendMarginTop:5,centerLegendRows:!0}),v=new ABFCharts_Empty("#"+ci,a),v.draw(),n.data.geoJson&&!n.nodata){if(y={top:v.settings.margin.top,bottom:v.settings.margin.bottom,left:v.settings.margin.left,right:v.settings.margin.right},ui&&(y.right+=10),nt=ii-y.left-y.right,tt=ri-y.bottom-y.top,lt.width(nt),lt.height(tt),it=ABF.AC.Map._getMap(k),it!==null&&ABF.AC.ResizingCharts){if(h=n.geojsonObject,r=h.bbox,r&&r.length==4){var wt=r[3]-r[1],bt=r[2]-r[0],pt=Math.max(wt/nt,bt/tt)*1.1;it.map.getView().setResolution(pt)}it.map.updateSize();return}if(lt.empty(),u=JSON.parse(n.data.MapConfig),u.map.controls.zoom.enabled=!1,u.map.mouseMoveCallback=ABF.AC.Map._mouseMoveCallback,u.map.clickCallback=function(){},u.map.postrenderCallback=ABF.AC.Map._postRenderMap,u.map.disableZoom=!1,h=n.geojsonObject,r=h.bbox,r&&r.length==4){var wt=r[3]-r[1],bt=r[2]-r[0],pt=Math.max(wt/nt,bt/tt)*1.1;u.map.maxResolution&&(u.map.maxResolution=pt);u.map.resolution=pt;u.map.extent.minX=r[1];u.map.extent.maxX=r[3];u.map.extent.minY=r[0];u.map.extent.maxY=r[2];u.map.center.x=r[1]+wt/2;u.map.center.y=r[0]+bt/2}else u.map.resolution=u.map.maxResolution;for(l=new AbfMaps(k,u),l.ChartSettings=n,l.map.MapId=k,ABF.AC.Map._addMap(l),rt={},i=0;i<n.data.GeoItems.length;i++)rt[n.data.GeoItems[i].C]=n.data.GeoItems[i];var p=[],w=[],ut=[];for(i=0;i<h.features.length;i++)o=h.features[i],e=rt[o.id],typeof e!="undefined"&&(f=o.properties,f.strokeColor=n.borderColor,f.strokeWidth=1,f.name=e.N,ft=e.DC,s?(f.fillColor="transparent",f.value=e.V,ut.push({c:o.id,ps:ABF.AC.GetPointSize(e.V,ft,n.data.DataClasses)})):ft>=0?(f.fillColor=n.colorList[ft],f.value=e.V):(f.fillColor="transparent",f.value=e.TV),e.IIG?(s?p.push(o):(f.strokeColor=n.baseItemColor,f.strokeWidth=2),w.push(o)):p.push(o));if(s||p.push.apply(p,w),h.features=p,kt=[],(n.hasEstimateData||n.hasForecastData)&&(kt=[{usePattern:!0,patternStyle:n.hasForecastData?a.forecastDrawStyle:a.estimationDrawStyle,patternColor:n.hasForecastData?a.forecastColor:a.estimationColor}]),ei="polygonlayer",oi={renderMode:"image",code:ei,format:"GeoJSON",zIndex:20,inClickCallback:!0,inContextMenuCallback:!0,inMouseMoveCallback:!s,styles:kt},l.addVectorLayer(oi,h),s){for(et=[],ut.sort(ABF.AC.SortPoints).reverse(),b=[],i=0;i<ut.length;i++){var si=ut[i],li=si.c,ai=si.ps;for(ot=0;ot<h.features.length;ot++)if(o=h.features[ot],o.id===li&&(e=rt[o.id],typeof e!="undefined")){f=o.properties;f.name=e.N;var vi=e.X,yi=e.Y,st=new ol.Feature({geometry:new ol.geom.Point([vi,yi])});if(st.setProperties(f),ht=!1,w.length>0)for(ct=0;ct<w.length;ct++)o.id===w[ct].id&&(ht=!0);st.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:ai/2,fill:new ol.style.Fill({color:ht?n.colorList[1]:n.colorList[0]}),stroke:new ol.style.Stroke({color:"rgb(255,255,255)",width:1})})}));ht?b.push(st):et.push(st)}}if(b.length>0)for(i=0;i<b.length;i++)et.push(b[i].clone())}hi={renderMode:"image",code:"mappointlayer",zIndex:21,inClickCallback:!0,inContextMenuCallback:!0,inMouseMoveCallback:!0};l.addCircleVectorLayer(hi,et);l.map.on("movestart",function(){ABF_Dashboard_DashboardView._TileDragged=!0});l.map.on("moveend",function(){ABF_Dashboard_DashboardView._TileDragged=!1})}},_postRenderMap:function(n){var r=ABF.AC.Map._getMap(n.map.MapId),t=r.getLayerExtent("polygonlayer"),i=r.getLayerExtent("basegeoitemlayer");isFinite(t[0])?(i!=null&&isFinite(i[0])&&(t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[1]),t[2]=Math.max(t[2],i[2]),t[3]=Math.max(t[3],i[3])),r.setViewByExtent(t[0],t[1],t[2],t[3])):i&&isFinite(i[0])&&r.setViewByExtent(i[0],i[1],i[2],i[3]);r.map.getView().maxResolution_=r.map.getView().getResolution()},_mouseMoveCallback:function(n,t,i){var u,r,f;t.length>0&&(t[0]==="polygonlayer"||t[0]==="hoverlayer"||t[0]==="basegeoitemlayer")?(u=new ol.style.Style({stroke:new ol.style.Stroke({color:"rgb(128, 128, 128)",width:1}),fill:new ol.style.Fill({color:"rgba(0, 90, 150, 0.3)"})}),r=i[0].clone(),r.setStyle(u),f=ABF.AC.Map._getMap(n.map.MapId),ABF.AC.Map._addLayer(f,r,"hoverlayer"),ABF.AC.Map._addTooltip(n,t,i)):t.length>0&&t[0]==="mappointlayer"?ABF.AC.Map._addTooltip(n,t,i):ABF.AC.Map._removeLayer("hoverlayer")},_addLayer:function(n,t,i){var r,f,u;(ABF.AC.Map._removeLayer(i),t.length<=0)||(r=t,t.length||(r=[t]),f=new ol.source.Vector({features:r}),u=new ol.layer.Vector({format:"GeoJSON",source:f,zIndex:80,code:i,type:"vector"}),u.layerSettings={inMouseMoveCallback:!0,inClickCallback:!0,renderMode:"image"},n.map.addLayer(u))},_removeLayer:function(n){var i,t,r;for(ABF.AC.Map._removeTooltip(),i=ABF.AC.Map.AbfMaps,t=0;t<i.length;t++)r=i[t],r.removeLayer(n)},_removeTooltip:function(){var n=chartutils.toolTip();n.hide()},_addTooltip:function(n,t,i){var w=ABF.AC.Map._getMap(n.map.MapId),r=w.ChartSettings,a=document.querySelector("div.maptile-tooltip"),u,e,v,i,h,l,s;if((a===null||a.length===0)&&(u=document.createElement("div"),u.style.display="none",u.classList?u.classList.add("maptile-tooltip"):u.className="maptile-tooltip",document.body.appendChild(u)),e=$(".maptile-tooltip")[0],v=r.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",t.length>0)if(i=i[0],h=t[0]==="mappointlayer"?i.name:i.get("name"),h){var f=t[0]==="mappointlayer"?i.value:i.get("value"),c="",y="";f&&(typeof f=="string"?c=f:(c=r.valuta+chartutils.numberFormat(f,parseInt(r.noDec,10),null,{thousandsSep:v,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+r.perc,r.showPositiveSign&&f>0&&(y=r.positiveSign)));var b={descr:r.descr,x:h,y:f,ystring:y+c},k={options:r},d=n.originalEvent.clientX?parseInt(n.originalEvent.clientX,10):null,g=n.originalEvent.clientY?parseInt(n.originalEvent.clientY,10):null,p=n.map.getSize(),o=n.pixel;$(e).css("display","inline-block");l=d+10;o[0]+20>p[0]&&(l+=p[0]-(o[0]+20));s=50;o[1]<s&&(s=o[1]);var nt=window.pageYOffset,tt={x:l,y:g-s+nt},it=chartutils.toolTip(r.useTooltip);ABF.AC.Tooltip(it,b,k,e,tt)}else $(e).css("display","none");else $(e).css("display","none")},_getMap:function(n){for(var i,r=ABF.AC.Map.AbfMaps,t=0;t<r.length;t++)if(i=r[t],i.map.MapId==n)return i;return null},_addMap:function(n){for(var t,u=ABF.AC.Map.AbfMaps,i=[],r=0;r<u.length;r++)t=u[r],t.map.MapId!=n.map.MapId&&$("#"+t.map.MapId).length===1&&i.push(t);i.push(n);ABF.AC.Map.AbfMaps=i}};ABF.AC.Table=function(n,t){typeof n=="object"&&$.extend({fontColor:"#000",useHeadHeadingColor:!1,useBorderBottom:!1,tileColor:"#fff",labelFontColorContrast:"#fff"},n);this.CreateTable=function(n){var e=n.useHeadHeadingColor?n.tileColor:n.fontColor,o=n.useHeadHeadingColor?n.fontColor:n.tileColor,s=chartutils.getContrastLabelColor(n,e,o),h=chartutils.getContrastLabelColor(n,n.fontColor,n.tileColor),r=n.fontColor,u=chartutils._getRgbArray(r),f,i;r="rgba("+u[0]+","+u[1]+","+u[2]+",0.2)";f="1px solid "+r;i=$("#"+t+" table.tile-presentation-table");i.find("th, td").css("border",n.useBorderBottom?"0 none":f);n.useBorderBottom&&i.find("tr").css("border-bottom",f);n.useHeadHeadingColor&&i.find("thead th").css("background-color",n.fontColor).css("color",s)};this.CreateTable(n)};ABF.AC.TreeMap=function(n,t){ABF.AC.AddPresToList(n,t,"treemap");var i={showPositiveSign:!1};typeof n=="object"&&$.extend(i,n);this.CreateTreeMap=function(n){for(var y,f,p,s,h,c,u,l,e,a=n.showThousandsSeparator?ABF_Dashboard_Model.Settings.GroupingSeparator:"",o=["white"].concat(n.colorScheme),v=[-99995],r=0;r<n.dataclasses.length-1;r++)v.push(parseFloat(n.dataclasses[r].Maximum));for(o.push(n.colorScheme[n.colorScheme.length-1]),y=d3.scaleThreshold().range(o).domain(v),f=[],r=0;r<n.dataclasses.length;r++)p={color:n.colorScheme[r],text:n.dataclasses[r].Label,type:"point"},f.push(p);for(s=!1,h=!1,r=0;r<n.dataset.children.length;r++)u=n.dataset.children[r],n.descriptions&&n.descriptions.length>r?l=n.descriptions[r]:n.descr&&(l=n.descr),n.dataset.children[r].description=l,e=u.value,e&&e>0&&(n.dataset.children[r].valstr=n.valuta+chartutils.numberFormat(e,"",null,{thousandsSep:a,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator})+n.perc),i.showPositiveSign&&e&&e>0&&(n.dataset.children[r].valstr=n.positiveSign+n.dataset.children[r].valstr),i.showForecast&&u.t==="f"&&(s=!0),i.showEstimation&&u.t==="e"&&(h=!0),u.t==="p"&&e!==0&&(u.valstr=" ",u.name="",u.ci=o.length,u.ignoreTT=!0,c=!0,o.push("transparent"));s&&f.push(ABF.AC.getForecastLegend(i,f.length>0));h&&f.push(ABF.AC.getEstimateLegend(i,f.length>0));c&&f.push(ABF.AC.GetSumUpLegend());var w=ABF.AC.IsEmpty(n.dataset.children),b=$.extend({},ABF.AC.GetDefaultOptions(i),{nodata:w?n.noDataLabel:"",dataset:w?[]:n.dataset,colorList:o,colorScale:y,dataUnit:n.perc,margin:i.inMultiIndicatorView?{top:8.5,right:20,bottom:0,left:25}:{top:8.5,right:0,bottom:0,left:0},animate:ABF_Dashboard_Model.Settings.ChartAnimateSpeed>0,animateHover:!0,duration:ABF_Dashboard_Model.Settings.ChartAnimateSpeed,onTooltipFunction:ABF.AC.TreeMapTooltip,onLegendTooltipFunction:ABF.AC.LegendTooltip,showLegend:!0,showExtra:c,legendData:f,titleFontSize:18,titleFontColor:i.fontColor,titleBackgroundColor:"transparent",subtitleFontSize:20,subtitleFontColor:i.fontColor,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendIconDefault:"point",legendFontSize:12,legendFontColor:i.fontColor,legendBackgroundColor:"transparent",legendHeight:26,legendMargin:0,centerLegendRows:!0,labelFontSize:15,labelFontColor:i.fontColor,showLabelContrast:!0,chartBackgroundColor:i.tileBgColor,borderColor:i.tileBgColor,options:n,customLang:{thousandsSep:a,decimalPoint:ABF_Dashboard_Model.Settings.DecimalSeparator},showValues:n.showGraphLabel,showNames:n.showGraphNameLabel}),k=new ABFCharts_Treemap("#"+t,b);k.draw()};this.CreateTreeMap(n)};ABF.AC.GetTooltipTheme=function(n){var t=[],i=[],r="rgb(255,255,255)",u,f;return(t=r.indexOf("#")===0?chartutils.hexToRgb(r):chartutils._getRgbArray(r),i=n.indexOf("#")===0?chartutils.hexToRgb(n):chartutils._getRgbArray(n),t.length<3||i.length<3)?r:(u=(t[0]*299+t[1]*587+t[2]*114)/1e3,f=(i[0]*299+i[1]*587+i[2]*114)/1e3,Math.abs(u-f)>=128?"light":"dark")};ABF.AC.IsEmpty=function(n){return Array.isArray(n)?!n.some(function(n){return!ABF.AC.IsEmpty(n)}):n===null||n===undefined?!0:!n.name||n.y!==null&&n.y!==undefined||n.value!==null&&n.value!==undefined?typeof n=="string"?!0:!1:!0};ABF.AC.AddPresToList=function(n,t,i){if(ABF.AC.PresList.length<=0||!ABF.AC.ListContainsPres(ABF.AC.PresList,t,"id")){var r={id:t,options:n,type:i};ABF.AC.PresList.push(r)}};ABF.AC.ListContainsPres=function(n,t,i){for(var r=0;r<n.length;r++)if(n[r][i]===t)return!0;return!1};ABF.AC.FindPresInList=function(n,t,i){for(var r=0;r<n.length;r++)if(n[r][i]===t)return n[r];return null};ABF.AC.SortPoints=function(n,t){return n.ps-t.ps};ABF.AC.GetPointSize=function(n,t,i){var r,o,h,s=19,u,e,f;return(h=i.length>2?s/(i.length-2):s/i.length,o=12,r=o,t<0)?0:(u=i[0].Maximum,e=i[1].Maximum-i[1].Minimum,n>0&&u>=0)?(f=u>0?n/u:n/e+1,r=12*Math.sqrt(f),r>6?r:6):u<0?(f=(n-u)/e+1,r=12*Math.sqrt(f),r>6?r:6):void 0};ABF.AC.getForecastLegend=function(n,t,i){var r={type:"box",color:"black",text:n.forecastLabel,addseperator:t,typeset:"Forecast"};return i&&(r.maxiconsize=25,r.iconsize=12),r};ABF.AC.getEstimateLegend=function(n,t){return{type:"box",color:"",text:n.estimationLabel,addseperator:t,typeset:"Estimation"}};ABF.AC.GetSumUpLegend=function(){return{type:"point",color:"url("+window.location.href+"#DashedDownwardDiagonal_p)",text:ABF_Dashboard_Model.Settings.TextResource.Mosaic_Unknown}};_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Area=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],margin:{top:20,right:20,bottom:10,left:20},rotation:45,rotationy:0,useTooltip:!0,showLegend:!0,legendData:[],dataPrefix:"",dataPostfix:"",dataUnit:"",duration:1250,colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",skipLabel:0,width:0,height:0,animate:!1,animateHover:!0,customYMax:null,customYMin:null,customYStep:null,autoRotation:!1,autoXSplitText:!1,minYDefZero:!0,showAxes:!0,showAxisXLabels:!0,axisColor:"rgb(0,0,0)",brokenAxis:!1,showGridLines:!0,gridLineColor:"rgb(0,0,0)",showEstimation:!1,showForecast:!1,forecastType:"Solid",forecastDrawStyle:"",forecastColor:"rgb(128,128,128)",estimationType:"Solid",estimationDrawStyle:"",estimationColor:"rgb(128,128,128)",titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"line",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,axisXFontSize:10,axisXFontColor:"rgb(0,0,0)",axisYFontSize:10,axisYFontColor:"rgb(0,0,0)",labelFontSize:10,labelFontColor:"rgb(0,0,0)",chartBackgroundColor:"transparent",onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.getAreaTooltip,onLegendTooltipFunction:null,validContainer:!0,clipPathCount:0,inlineAxis:!1,axisTickSpace:10,nrOfDec:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);(n.width=i.width,n.height=i.height,n.width<50||n.height<50)||(d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g"),(n.showEstimation&&n.estimationType!=="Solid"||n.showForecast&&n.forecastType!=="Solid")&&chartutils.addHatchDefs(this),chartutils.drawChartExtras(this,n),r.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var u,at,ut,ft,o,e,tt,vt,yt,ni,c,pt,st,ii,ht,d,ri,g,si,rt,bt,hi,ci;if(!(n<50)&&!(t<50)&&(u=this.settings,u.validContainer)){var l,y,p,kt,ct,w,h=u.dataset,lt=d3.select(u.container+" svg"),b=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(h),dt=b.length,f=u.customYMin===null?d3.min(h,function(n){return+n.y}):u.customYMin;u.minYDefZero&&f>0&&(f=0);var li=d3.range(dt).map(function(n){return b[n].values.map(function(n){return+n.y})}),ai=d3.stack().keys(d3.range(dt))(d3.transpose(li)),s=d3.max(ai,function(n){return d3.max(n,function(n){return n[1]})});s=u.customYMax===null?s:u.customYMax;f===s&&(s=f+1);var k=lt.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),a=k.append("g").attr("class","axes"),nt=k.append("g").attr("class","elements"),vi=a.append("rect").attr("width",0).attr("height",0),gt=u.margin.top;if(chartutils.drawSubtitle(this,n,t,k),at=u.margin.top,l=lt.append("text").attr("font-size",u.axisYFontSize+"px").text(Math.round(s)),y=l.node().getBBox().width,p=l.node().getBBox().height,l.remove(),l=lt.append("text").style("font-size",u.axisXFontSize+"px").text("1234567,890"),kt=l.node().getBBox().height,l.remove(),ut=u.margin.left,ut+=u.inlineAxis?0:p+y,ft=r===0?u.margin.top:at-gt,ft+=u.inlineAxis?p:0,a.attr("transform","translate("+ut+","+ft+")"),nt.attr("transform","translate("+ut+","+ft+")"),o=n-u.margin.left-u.margin.right,e=t-u.margin.bottom,e-=r===0?u.margin.top:at-gt,u.inlineAxis?e-=p:o=o-y-p,!(o<1)&&!(e<1)){tt=y*1.5;tt<50&&(tt=50);var yi=u.inlineAxis?[tt,o-20]:[0,o],pi=u.inlineAxis?o-20-tt:o,it=d3.scalePoint().range(yi);it.domain(h.map(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x}));vt=!1;yt=null;h.length>0&&h[0].xcode&&(vt=!0,yt=d3.nest().key(function(n){return n.xcode}).entries(h));ni=chartutils.getXAxis(b,it,this,pi);e=chartutils.drawXAxis(ni,this,a,o,e,kt,!1,vt,yt);u.inlineAxis&&a.select(".x.axis").selectAll("g.tick").each(function(){var r=chartutils._getTranslateMatrix(d3.select(this)),t=this.getBBox(),i=r.e,n=t.width,u,f;i&&n&&i+n+t.x>o&&(u=i+n-o,u<n&&(f=o-n-t.x,d3.select(this).attr("transform","translate("+f+","+r.f+")")))});var et=chartutils.getNiceRange(f,s,u.nrOfDec),ti=u.customYMin===null||u.customYMax===null,ot=u.brokenAxis&&f>0&&(!ti||ti&&et.minValue>0)?e/4:0;if(ot>30&&(ot=30),c=d3.scaleLinear().range([e-ot,0]),u.customYMin!==null&&u.customYMax!==null?c.domain([f,s]):(f=et.minValue,s=et.maxValue,c.domain([f,s]),u.customYStep=et.step),pt=[],u.customYStep!==null&&u.customYStep!==0)for(ct=(s-f)/u.customYStep,w=chartutils.nbrOfDecimals(u.customYStep),w=w>3?3:w,st=0;st<=ct;st++)ii=Math.round((f+st*u.customYStep)*1e3)/1e3,pt.push(ii.toFixed(w));ht=chartutils.getYAxis(o,e,c,pt,this);u.customYStep!==null&&u.customYStep!==0&&ht.ticks(ct);chartutils.drawYAxis(ht,this,a,e,y);u.brokenAxis&&f>0&&(d=d3.scaleLinear().range([e,e-ot]),d.domain([0,f]),ri=chartutils.getYAxis(o,e,d,[0..toFixed(w)],this),chartutils.drawYAxis(ri,this,a,e,y,!0));f<0&&chartutils.drawZeroLine(c,ht,a);var ui=k.selectAll(".y.axis"),wt=ui.size(),wi=k.select(".x.axis"),fi=0;ui.each(function(n,t){if(t===0&&wt>1&&(fi=d3.select(this).node().getBBox().y),t===wt-1){var h=d3.select(this),i=h.node().getBBox(),r=wi.node().getBBox(),f=u.container.replace("#","")+"_"+u.clipPathCount,s=wt===1?i.height-(i.y<0?Math.abs(i.y)*2:0)+1:i.height*2-(i.height-Math.abs(i.y))-Math.abs(fi)+1;u.clipPathCount++;u.inlineAxis&&(s+=p);k.append("clipPath").attr("id","chart-clip_"+f).append("rect").attr("x",0).attr("y",0).attr("height",s).attr("width",r.width-r.x);nt.attr("clip-path","url(#chart-clip_"+f+")");vi.attr("fill",u.chartBackgroundColor).attr("x",1).attr("width",o-1).attr("y",0).attr("height",e)}});var ei=chartutils.toolTip(u.useTooltip),bi=d3.line().defined(function(n){return!isNaN(+n[1])}).x(function(n){return it(n.data.key)}).y(function(n){return u.brokenAxis&&+n[1]<f?d(+n[1]):c(+n[1])}),ki=d3.area().defined(bi.defined()).x(function(n){return it(n.data.key)+1}).y0(function(n){return u.brokenAxis&&+n[0]<f?d(+n[0]):c(+n[0])}).y1(function(n){return u.brokenAxis&&+n[1]<f?d(+n[1]):c(+n[1])}),oi=[];b.forEach(function(n){oi.push(n.key)});g=d3.stack();g.keys(oi);g.value(function(n,t){for(var r=n.values,i=0;i<r.length;i++)if((r[i].name===undefined||r[i].name===t||r[i].namecode!==undefined&&r[i].namecode.toString()===t)&&!isNaN(+r[i].y))return+r[i].y});g.order(d3.stackOrderNone);g.offset(d3.stackOffsetNone);b=d3.nest().key(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x}).entries(h);si=g(b);rt=u.animate?u.duration:0;nt.selectAll(".area").data(si).enter().append("g").attr("class","area").append("path").attr("data-title",function(n){if(n.key)return n.key.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("fill",function(n,t){return u.colorList[t]}).attr("d",ki).attr("transform","translate(0, "+e+")").transition().duration(rt).ease(d3.easeCubic).delay(function(n,t){return rt>0?t*50:0}).attr("transform","translate(0,0)");var v=h[1].t!==undefined?v=h[1].t:"",di=v==="e"?u.estimationDrawStyle:u.forecastDrawStyle,gi=v==="e"&&u.showEstimation||v==="f"&&u.showForecast;gi&&(bt=nt.selectAll("g.area path"),hi=v==="e"?u.estimationType:u.forecastType,hi!=="Solid"?bt.each(function(n,t){var i=d3.select(this),f=i.node().cloneNode(!0),r=d3.select(f);r.datum(i.datum());r.attr("fill","url("+u.baseLoc+u.container+di+"_"+v+")");r.transition().duration(rt).ease(d3.easeCubic).delay(function(){return rt>0?t*50:0}).attr("transform","translate(0,0)");i.node().parentNode.appendChild(f)}):(ci=v==="e"?u.estimationColor:u.forecastColor,bt.each(function(){var n=d3.select(this);n.attr("fill",ci)})));nt.selectAll(".area").on("mouseover, mousemove",function(n){if(u.animateHover){var t=d3.select(this);t.classed("hover",!0)}return u.onTooltipFunction(ei,n,u,this,it)}).on("mouseout",function(){if(u.animateHover){var n=d3.select(this);n.classed("hover",!1)}ei.hide()}).on("click touchstart",u.onClickFunction).on("contextmenu",u.onCMFunction)}}}},{key:"getAreaTooltip",value:function(n,t,i,r,u){for(var c=u.domain(),l=0,a=0,s=d3.mouse(r)[0],h=0,o,e=0;e<c.length;e++)if(o=u(c[e]),s>o&&(l=o),s<=o){a=o;h=e;break}Math.abs(s-l)<=Math.abs(s-a)&&(h=h--);var p=t.index,f=t[h].data.values[p],v="",y="";return f.name&&(v=", "+f.name),y=f.ystring!==undefined?f.ystring:Number(f.y).toLocaleString(),n.show("<span>"+f.x+v+": "+i.dataPrefix+y+i.dataPostfix+"<\/span>")}},{key:"getLegendData",value:function(n){var i=this.settings,r=[],t,u,f,e;if(n.length>1)for(t=0;t<n.length;t++)u=i.legendIconDefault,f=n[t].key,e=i.colorList[t],r.push({type:u,color:e,text:f});return r}},{key:"triggerMouseOverByCode",value:function(n){this.settings.animateHover&&d3.selectAll(".chart").selectAll("g.area").each(function(t){if(t.code===n){var i=d3.select(this);i.classed("hover",!0)}})}},{key:"triggerMouseOutByCode",value:function(){var t,n,i;if(this.settings.animateHover)for(t=document.querySelectorAll("g.area.hover"),n=0;n<t.length;n++)i=d3.select(t[n]),i.classed("hover",!1)}},{key:"reSize",value:function(){this.draw()}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Bar=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],medianDataset:[],averageDataSet:[],categorySet:[],mirrorDataset:[],medianColor:"#333",medianType:"",medianName:"",medianShape:"circle",medianStripeWidth:0,medianSize:50,medianStrokeColor:"#fff",medianStrokeWidth:1,medianLineColor:"#0f0",medianLineDashStyle:"solid",medianLineStyle:"cardinal",medianLineWidth:3,useMarker:!1,markerColor:"default",markerBorderColor:"black",markerStyle:"circle",markerSize:8,margin:{top:10,right:20,bottom:10,left:20},rotation:45,rotationy:0,yTicks:5,opacity:.8,lineWidth:2,barPadding:0,groupPadding:1,animate:!1,animateHover:!0,duration:1250,drawBarDelay:50,useTooltip:!0,showLegend:!0,legendData:[],dataPrefix:"",dataPostfix:"",dataPrefixY1:"",dataPostfixY1:"",dataUnit:"",colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],categoryColorList:[],title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",stacked:!1,mirrored:!1,skipLabel:0,width:0,height:0,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:chartutils.defaultTooltip,onLegendTooltipFunction:null,showAxes:!0,showAxisXLabels:!0,axisColor:"rgb(0,0,0)",brokenAxis:!1,showGridLines:!0,gridLineColor:"rgb(0,0,0)",showValues:!1,showAverage:!1,showInterval:!1,showEstimation:!1,showForecast:!1,averageLineWidth:2,averageLineColor:"black",customYMax:null,customYMin:null,customYStep:null,customY2Max:null,customY2Min:null,customY2Step:null,autoRotation:!1,autoXSplitText:!1,autoCalcBarWidth:!1,minYDefZero:!0,intervalStrokeColor:"black",intervalStrokeWidth:1,drawStyle:"default",forecastType:"Solid",forecastDrawStyle:"",forecastColor:"rgb(128,128,128)",estimationType:"Solid",estimationDrawStyle:"",estimationColor:"rgb(128,128,128)",titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"rect",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,axisXFontSize:10,axisXFontColor:"rgb(0,0,0)",axisYFontSize:10,axisYFontColor:"rgb(0,0,0)",labelFontSize:10,labelFontColor:"rgb(0,0,0)",labelFontColorContrast:"rgb(255,255,255)",showLabelContrast:!1,bevelWidth:3,bevelColors:[],chartBackgroundColor:"transparent",combineBars:!1,autoRotateLabels:!0,validContainer:!0,clipPathCount:0,inlineAxis:!1,axisTickSpace:10,nrOfDec:null,averageLabel:"",averageLabelAlignment:"left"};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);if(n.width=i.width,n.height=i.height,!(n.width<1)&&!(n.height<1)){d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g");switch(n.drawStyle){case"cylinder":chartutils.addCylinderDefs(this,!1);break;case"gradient":chartutils.addGradientDefs(this,!1);break;case"lighttodark":chartutils.addLightToDarkDefs(this,!1);break;case"emboss":case"wedge":n.bevelColors=chartutils.getBevelColors(this)}((n.showEstimation&&n.estimationType!=="Solid"||n.showForecast&&n.forecastType!=="Solid")&&chartutils.addHatchDefs(this),chartutils.drawChartExtras(this,n),r.length<=0)||this.addChart(n.width,n.height,0,0)}}}},{key:"addChart",value:function(n,t,i,r){var u,di,at,vt,o,f,yt,fi,it,a,dt,pt,gt,tt,ei,ni,oi,wt,ti,v,si,hi,rt,ut,kt,ci,ir,li,rr,ur,fr,d,et,er,or,sr,bt;if(!(n<1)&&!(t<1)&&(u=this.settings,u.validContainer)){var l,h,y,vi,ri,ht=this,g,c,yi=0,ot=u.dataset,st=d3.select(u.container+" svg"),nt=d3.nest().key(function(n){return n.namecode!==undefined&&n.namecode!==null?n.namecode:n.name}).entries(ot),p=nt.length,pi=ot.map(function(n){return+n.y}),s,e;if(u.stacked){var hr=d3.range(p).map(function(n){return nt[n].values.map(function(n){if(n.y>=0)return+n.y})}),cr=d3.range(p).map(function(n){return nt[n].values.map(function(n){if(n.y<0)return+n.y})}),lr=d3.stack().keys(d3.range(p))(d3.transpose(hr)),ar=d3.stack().keys(d3.range(p))(d3.transpose(cr));s=d3.max(lr,function(n){return d3.max(n,function(n){return n[1]})});e=d3.min(ar,function(n){return d3.min(n,function(n){return n[0]})})}else s=d3.max(pi),e=d3.min(pi);s=u.customYMax===null?s:u.customYMax;e=u.customYMin===null?e:u.customYMin;u.minYDefZero&&e>0?e=0:u.minYDefZero&&e<0&&s<0&&(s=0);e===s&&(s=e+1);u.inlineAxis&&u.averageLabel.length>0&&u.medianDataset!==null&&typeof u.medianDataset=="number"&&(e>u.medianDataset?e=u.medianDataset:s<u.medianDataset&&(s=u.medianDataset));var ct=st.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),b=ct.append("g").attr("class","axes"),k=ct.append("g").attr("class","elements"),vr=ct.append("g").attr("class","labels"),yr=b.append("rect").attr("width",0).attr("height",0),wi=u.margin.top;chartutils.drawSubtitle(this,n,t,ct);var bi=u.margin.top,lt=chartutils.getNiceRange(e,s,u.nrOfDec),ui=u.customYMin===null||u.customYMax===null,ki=u.customYStep;if(ui||u.customYStep===null||u.customYStep===0?(ki=lt.step,c=chartutils.nbrOfDecimals(ki),c=c>3?3:c):c=chartutils.nbrOfDecimals(u.customYStep),di=u.dataPrefix+chartutils.numberFormat(s,c,u.lang,u.customLang)+u.dataPostfix,l=st.append("text").style("font-size",u.axisYFontSize+"px").text(di),h=l.node().getBBox().width,y=l.node().getBBox().height,l.remove(),l=st.append("text").style("font-size",u.axisXFontSize+"px").text("1234567,890"),vi=l.node().getBBox().height,l.remove(),l=st.append("text").attr("class","label").style("font-size",u.labelFontSize+"px").text("1234567,890"),ri=l.node().getBBox().height,l.remove(),u.showAxes||(h=0,y=0),at=u.margin.left,at+=u.inlineAxis?0:y+h,vt=r===0?u.margin.top:bi-wi,vt+=u.inlineAxis?y:0,b.attr("transform","translate("+at+","+vt+")"),k.attr("transform","translate("+at+","+vt+")"),vr.attr("transform","translate("+at+","+vt+")"),o=n-u.margin.left-u.margin.right,f=t-u.margin.bottom,f-=r===0?u.margin.top:bi-wi,u.inlineAxis?f-=y:(o=o-h-y,u.medianDataset!==null&&typeof u.medianDataset=="object"&&u.medianType==="line"&&(o-=h+y)),!(o<1)&&!(f<1)){yt=20;u.inlineAxis&&u.showAverage&&u.averageLabel.length>0?(l=st.append("text").attr("class","label").style("font-size",u.labelFontSize+"px").text(u.averageLabel),yt=l.node().getBBox().width,l.remove()):u.inlineAxis&&u.averageLabel.length>0&&u.medianDataset!==null&&typeof u.medianDataset=="number"&&(l=st.append("text").attr("class","label").style("font-size",u.labelFontSize+"px").text(u.averageLabel),yt=l.node().getBBox().width,l.remove());tt=u.inlineAxis?[h+20,o-(yt+10)]:[0,o];fi=u.inlineAxis?o-40-h-(yt+10):o;u.inlineAxis&&u.medianDataset!==null&&typeof u.medianDataset=="object"&&u.medianType==="line"&&(fi-=h,tt[1]=tt[1]-=h);it=d3.scaleBand().range(tt);it.domain(ot.map(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x}));var pr=chartutils.getXAxis(nt,it,this,fi),gi=!1,nr=null;if(ot.length>0&&ot[0].xcode&&(gi=!0,nr=d3.nest().key(function(n){return n.xcode}).entries(ot)),f=chartutils.drawXAxis(pr,this,b,o,f,vi,!1,gi,nr),!(f<1)){a=u.brokenAxis&&e>0&&(!ui||ui&&lt.minValue>0)?f/4:0;a>30&&(a=30);var wr=u.mirrored?[f/2-a,0]:[f-a,0],w=d3.scaleLinear().range(wr),tr=!1;if(u.customYMin!==null&&u.customYMax!==null?w.domain([e,s]):(e=lt.minValue,s=lt.maxValue,w.domain([e,s]),u.customYStep=lt.step,tr=!0),rt=[],u.customYStep!==null&&u.customYStep!==0)for(g=(s-e)/u.customYStep,c=chartutils.nbrOfDecimals(u.customYStep),c=c>3?3:c,ut=0;ut<=g;ut++)kt=Math.round((e+ut*u.customYStep)*1e3)/1e3,rt.push(kt.toFixed(c));if(dt=chartutils.getYAxis(o,u.mirrored?f/2:f,w,rt,this,tr),u.customYStep!==null&&u.customYStep!==0&&dt.ticks(g),chartutils.drawYAxis(dt,this,b,f,h),u.brokenAxis&&e>0&&(tt=u.mirrored?[f/2,f/2-a]:[f,f-a],pt=d3.scaleLinear().range(tt),pt.domain([0,e]),ei=chartutils.getYAxis(o,f,pt,[yi.toFixed(c)],this),chartutils.drawYAxis(ei,this,b,f,h,!0),u.mirrored&&(tt=[f/2,f/2+a],gt=d3.scaleLinear().range(tt),gt.domain([0,e]),ei=chartutils.getYAxis(o,f,gt,[yi.toFixed(c)],this))),e<0&&chartutils.drawZeroLine(w,dt,b),u.mirrored&&(ni=d3.scaleLinear().range([f/2+a,f]),ni.domain([e,s]).nice(),oi=chartutils.getYAxis(o,f/2,ni,rt,this),u.customYStep!==null&&u.customYStep!==0&&(g=(u.customYMax-u.customYMin)/u.customYStep,oi.ticks(g)),chartutils.drawYAxis(oi,this,b,f,h)),v=e,u.medianDataset!==null&&typeof u.medianDataset=="object"&&u.medianType==="line"){if(v=u.customY2Min===null?d3.min(u.medianDataset,function(n){return+n.y}):u.customY2Min,u.minYDefZero&&v>0&&(v=0),a=u.brokenAxis&&v>0?f/4:0,a>30&&(a=30),s=u.customY2Max===null?d3.max(u.medianDataset):u.customY2Max,wt=d3.scaleLinear().range([f-a,0]),v===s&&(s=v+1),si=w.ticks().length,hi=chartutils.getNiceTickRangeY1(v,s,si),u.customY2Min!==null&&u.customY2Max!==null?wt.domain([v,s]):wt.domain([v,hi[si-1]]),rt=[],u.customY2Step!==null&&u.customY2Step!==0)for(g=Math.round((s-v)/u.customY2Step),c=chartutils.nbrOfDecimals(u.customY2Step),c=c>3?3:c,ut=0;ut<=g;ut++)kt=Math.round((v+ut*u.customY2Step)*1e3)/1e3,rt.push(kt.toFixed(c));else rt=hi;ci=chartutils.getY1Axis(o,f,wt,rt,this);u.customY2Step!==null&&u.customY2Step!==0&&ci.ticks(g);chartutils.drawY1Axis(ci,this,b,o,f,h);u.brokenAxis&&v>0&&(ti=d3.scaleLinear().range([f,f-a]),ti.domain([0,v]),ir=chartutils.getY1Axis(o,f,ti,[0],this),chartutils.drawY1Axis(ir,this,b,o,f,h,!0))}li=u.container.replace("#","")+"_"+u.clipPathCount;u.clipPathCount++;u.inlineAxis&&(t+=y);rr=u.inlineAxis?-y:0;ur=u.inlineAxis?f+y:f;ct.append("clipPath").attr("id","chart-clip_"+li).append("rect").attr("x",0).attr("y",rr).attr("height",ur).attr("width",o);k.attr("clip-path","url(#chart-clip_"+li+")");yr.attr("fill",u.chartBackgroundColor).attr("x",1).attr("width",o-1).attr("y",0).attr("height",f);var ii=chartutils.toolTip(u.useTooltip),ft=0,ai=it.bandwidth();(u.autoCalcBarWidth?(fr=u.stacked?.25:1/(p+1)/2,ft=ai*fr):ft=Math.ceil(o/1e3*u.groupPadding),d=(ai-ft*2-(p-1)*u.barPadding)/p,u.stacked&&(d=ai-ft*2-u.barPadding),d<=2&&(d=2),et=u.animate?u.duration:0,er=u.mirrored?p:0,this.drawBars(f,nt,k,it,w,pt,e,d,ft,et,ii,!1,ri,er),u.mirrored&&(or=d3.nest().key(function(n){return n.namecode!==undefined&&n.namecode!==null?n.namecode:n.name}).entries(u.mirrorDataset),this.drawBars(f,or,k,it,ni,gt,e,d,ft,et,ii,!0,ri,0)),u.medianType==="line"&&typeof u.medianDataset!="number"?ht.drawMedianData(k,it,wt,ti,d*p,o,ft,ii,et):(sr=u.stacked?d:d*p,ht.drawMedianData(k,it,w,pt,sr,o,ft,ii,et,h)),u.showAverage)&&(u.stacked?(bt=0,nt.forEach(function(n){var t=0;n.values.forEach(function(n){t+=+n.y});t=t/n.values.length;bt+=t}),bt=bt,ht.drawAverageLine(k,w,u.averageLineColor,o,bt,u.averageLineWidth,et,null,null,null,h)):nt.forEach(function(n,t){var i=0,r=0,f;u.averageDataSet.length>t?i=u.averageDataSet[t]:(n.values.forEach(function(n){n.y===null||isNaN(n.y)||(r++,i+=+n.y)}),i=r>0?i/r:i/n.values.length);nt.length>1?ht.drawAverageLine(k,w,u.categoryColorList[t],o,i,u.lineWidth,et,null,null,null,h):(f=d3.select(u.container+" svg g.labels"),ht.drawAverageLine(k,w,u.averageLineColor,o,i,u.lineWidth,et,f,u.averageLabel,u.averageLabelAlignment,h))}))}}}}},{key:"drawBars",value:function(n,t,i,r,u,f,e,o,s,h,c,l,a,v){var y=this.settings,ut=t.length,nt=!1,tt=!0,p=[],d=[],b=[],g=y.categoryColorList.length,ft=this,it=y.labelFontSize,k=y.labelFontColor,et=d3.select(i.node().parentNode).select("g.labels"),w,rt;e<0&&(e=0);w=y.brokenAxis&&e>0?f(0):u(e);l&&w++;rt=[];t.forEach(function(t,ot){var st=i.selectAll("bar").data(t.values).enter().append("g").attr("class","bar");st.each(function(t,i){var bi,vi,wt,st,ht,ui,si,hi,di,nr,rr,fi,ei,ur,fr,vt,ai,pt;if(y.combineBars&&ot===0&&(bi=isNaN(t.y)?"":t.y,rt.push(bi)),!isNaN(t.y)){var lt=d3.select(this),or=t.xcode?r(t.xcode):t.xshort?r(t.xshort):r(t.x),ki=y.stacked?0:o*ot+y.barPadding*ot*2,ct=or+s+ki,oi;if(y.combineBars&&(vi=ki,ot>0&&(vi-=o/(ot*2)),ct=ct-vi),wt=+t.y<0?!0:!1,st=+t.y<e&&e>0&&y.brokenAxis?Math.abs(f(+t.y)-w):Math.abs(u(+t.y)-w),d[i]===undefined&&(d[i]=0),b[i]===undefined&&(b[i]=0),p[i]===undefined&&(p[i]=0),y.stacked&&y.brokenAxis&&e>0&&(wt?st=0:+t.y+p[i]<=e?(st=Math.abs(f(+t.y)-w),p[i]+=+t.y):+t.y+p[i]>e&&p[i]<e?(ui=e-p[i],si=Math.abs(+t.y-ui),st=Math.abs(f(ui)-w)+Math.abs(u(si)-u(0)),p[i]+=+t.y):(st=Math.abs(u(+t.y)-u(0)),p[i]+=+t.y)),ht=wt?u(Math.max(e,+t.y))-b[i]:+t.y<e&&e>0&&y.brokenAxis?f(Math.max(0,+t.y))-d[i]:u(Math.max(e,+t.y))-d[i],y.stacked&&y.brokenAxis&&e>0&&(wt?ht=0:p[i]<=e?ht=f(p[i]):p[i]>e&&p[i]-+t.y<e?(ui=e-(p[i]-+t.y),si=Math.abs(+t.y-ui),ht=u(e)-(u(0)-u(si))):ht=u(p[i])),l&&(ht=w-b[i]),y.stacked&&l?b[i]-=st:y.stacked&&!wt?d[i]+=st:y.stacked&&wt&&(b[i]-=st),y.drawStyle==="emboss"||y.drawStyle==="wedge"){var at=y.bevelColors[ot],tr=t.t!==undefined&&(t.t==="e"&&y.showEstimation||t.t==="f"&&y.showForecast),ir=t.t==="e"?y.estimationType:y.forecastType;tr&&ir==="Solid"&&(rr=t.t==="e"?y.estimationColor:y.forecastColor,at=chartutils.createGradientColors(rr));ei=fi=y.drawStyle==="wedge"?y.bevelWidth=o/2:y.bevelWidth;fi>o&&(fi=o/2);ei>st&&(ei=st/2);var bt=ct,kt=ct+fi,dt=ct+o-fi,gt=ct+o,ni=ht,ti=ht+ei,ii=ht+st-ei,ri=ht+st,sr=y.drawStyle==="wedge"?at[0]:at[1],hr=y.drawStyle==="wedge"?at[2]:at[1],cr=at[3],lr=y.drawStyle==="wedge"?at[2]:at[3],ar=lt.append("polygon"),vr=lt.append("polygon"),yr=lt.append("polygon"),pr=lt.append("polygon");ar.attr("points",bt+","+ni+" "+kt+","+ti+" "+kt+","+ii+" "+bt+","+ri).attr("fill",sr);vr.attr("points",bt+","+ni+" "+gt+","+ni+" "+dt+","+ti+" "+kt+","+ti).attr("fill",hr);yr.attr("points",gt+","+ni+" "+gt+","+ri+" "+dt+","+ii+" "+dt+","+ti).attr("fill",cr);pr.attr("points",bt+","+ri+" "+kt+","+ii+" "+dt+","+ii+" "+gt+","+ri).attr("fill",lr);y.drawStyle==="emboss"&&(ur=lt.append("polygon"),ur.attr("points",kt+","+ti+" "+dt+","+ti+" "+dt+","+ii+" "+kt+","+ii).attr("fill",at[0]));tr&&ir!=="Solid"&&(oi=t.t==="e"?y.estimationDrawStyle:y.forecastDrawStyle,fr=lt.append("polygon"),fr.attr("points",bt+","+ni+" "+gt+","+ni+" "+gt+","+ri+" "+bt+","+ri).attr("fill","url("+y.baseLoc+y.container+oi+"_"+t.t+")"))}else if(hi=lt.append("rect"),hi.attr("fill",function(n){if(n.color)return n.color;if(n.catCode!==undefined&&n.catCode!==null&&n.catCode<g)return y.categoryColorList[n.catCode];switch(y.drawStyle){case"cylinder":return"url("+y.container+"cylinder_"+(ot+v)+")";case"gradient":return"url("+y.container+"gradient_"+(ot+v)+")";case"lighttodark":return"url("+y.container+"ltod_"+(ot+v)+")";default:return y.colorList[ot+v]}}).attr("x",function(){return ct}).attr("width",function(){return o}).attr("y",w).attr("height",0).transition().duration(h).delay(function(){return h>0?i*y.drawBarDelay:0}).attr("height",st).attr("y",ht),t.t!==undefined&&(t.t==="e"&&y.showEstimation||t.t==="f"&&y.showForecast))if(di=t.t==="e"?y.estimationType:y.forecastType,di!=="Solid"){var yi=hi,gi=yi.node().cloneNode(!0),pi=d3.select(gi);pi.datum(yi.datum());pi.transition().duration(h).delay(function(){return h>0?i*y.drawBarDelay:0}).attr("height",st).attr("y",ht);oi=t.t==="e"?y.estimationDrawStyle:y.forecastDrawStyle;pi.attr("fill","url("+y.baseLoc+y.container+oi+"_"+t.t+")");yi.node().parentNode.appendChild(gi)}else nr=t.t==="e"?y.estimationColor:y.forecastColor,hi.attr("fill",nr);if(lt.attr("data-title",function(n){if(n.name)return n.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.namecode!==undefined&&n.namecode!==null?n.namecode:n.name}).attr("data-value",function(n){return n.ystring!==undefined?n.ystring:Number(n.y).toLocaleString()}),ft.addMouseInteraction(lt,y,c),y.showInterval&&t.ri){var ci=u(Math.max(0,+t.y-+t.ri)),wi=u(Math.max(0,+t.y+ +t.ri)),er=ct+o/2;lt.append("line").attr("x1",er).attr("x2",er).attr("y1",ci).attr("y2",wi).attr("stroke-width",y.intervalStrokeWidth).attr("stroke",y.intervalStrokeColor);lt.append("line").attr("x1",ct+o/6).attr("x2",ct+5*(o/6)).attr("y1",ci).attr("y2",ci).attr("stroke-width",y.intervalStrokeWidth).attr("stroke",y.intervalStrokeColor);ci>=0&&lt.append("line").attr("x1",ct+o/6).attr("x2",ct+5*(o/6)).attr("y1",wi).attr("y2",wi).attr("stroke-width",y.intervalStrokeWidth).attr("stroke",y.intervalStrokeColor)}if(vt=d3.select(this).datum(),y.showValues||vt.showValue){var yt=et.append("g").attr("class","label bar"),wr=yt.append("rect").style("opacity","0").attr("width",0).attr("height",0),li=o+y.barPadding*2;ut===1?li+=(s-2)*2:y.combineBars&&(li*=2.25);ai=yt.append("text").attr("class","label middle").style("visibility","hidden").attr("font-size",it+"px").attr("fill",function(){if(y.showLabelBarColor){var n;return n=t.color?t.color:t.catCode!==undefined&&t.catCode!==null&&t.catCode<g?y.categoryColorList[t.catCode]:y.colorList[ot+v],chartutils.getContrastLabelColor(y,n,y.chartBackgroundColor)}return y.showLabelContrast&&y.stacked?chartutils.getContrastLabelColor(y,k,y.colorList[ot+v]):k}).attr("text-anchor","middle").attr("dy",.35*it+"px").text(function(){var n="",t;return(vt.ystring!==undefined?n=vt.ystring:(t=chartutils.nbrOfDecimals(Number(vt.y)),t=t>3?3:t,n=chartutils.numberFormat(Number(vt.y),t,y.lang,y.customLang)),n.length>0)?y.dataPostfix.length>0&&n.indexOf(y.dataPostfix)>=0?y.dataPrefix+n:y.dataPrefix+n+y.dataPostfix:n}).transition().delay(0).on("end",function(){try{var n=d3.select(this),t=n.node().getBBox(),i=t.width;li<i&&(y.stacked?tt=!1:y.autoRotateLabels&&(nt=!0))}catch(r){}}).transition().delay(h).on("end",function(){var o,c,e,r,f,h;try{o=!0;c=d3.select(this);chartutils.wrapCenterText(c,y);var t=c.node().getBBox(),i=t.width,s=t.height;vt.showValue||(y.showValues?(nt&&li<s&&(o=!1),y.stacked&&(o=s<st-2&&tt)):o=!1);o?(wr.attr("class","labelBG").attr("height",s).attr("width",i+8).attr("x",t.x-4).attr("y",t.y),nt&&(e=t.x+i/2,r=t.y+s/2,!l&&t.y-(i/2+s/2)<0?(h=u(vt.y),h=h>=0?h:0,f=(h+i/2)*-1,f=f+r-5,yt.attr("transform","rotate(270 "+e+" "+r+") translate("+f+" 0)")):!l&&vt.y<0?t.y+i>n?(f=n-(i+t.y),yt.attr("transform","rotate(270 "+e+" "+r+") translate(+"+Math.abs(f)+" 0)")):yt.attr("transform","rotate(270 "+e+" "+r+") translate(-"+i/2+" 0)"):l?l&&t.y+i>n?(f=n-(i+t.y),yt.attr("transform","rotate(270 "+e+" "+r+") translate(+"+Math.abs(f)+" 0)")):l&&yt.attr("transform","rotate(270 "+e+" "+r+") translate(-"+i/2+" 0)"):yt.attr("transform","rotate(270 "+e+" "+r+") translate(+"+i/2+" 0)")),c.style("visibility",o?"visible":"hidden")):yt.remove()}catch(a){}}).attr("x",ct+o/2);pt=y.stacked?ht+st/2:ht-a/2;l&&!y.stacked||!y.stacked&&wt?(pt+=st+a,pt+a>n*1.1&&(pt-=a,ai.attr("fill",function(n){if(!y.showLabelContrast)return k;var t=n&&n.catCode!==undefined&&n.catCode!==null&&n.catCode<g?y.categoryColorList[n.catCode]:y.colorList[ot+v];return chartutils.getContrastLabelColor(y,k,t)}))):!y.stacked&&(y.inlineAxis&&pt<-a/2||!y.inlineAxis&&pt<a/2)&&(ai.attr("fill",function(){if(!y.showLabelContrast)return k;var n=t&&t.catCode!==undefined&&t.catCode!==null&&t.catCode<g?y.categoryColorList[t.catCode]:y.colorList[ot+v];return y.showLabelBarColor?chartutils.getContrastLabelColor(y,n,y.chartBackgroundColor):chartutils.getContrastLabelColor(y,k,n)}),pt+=a);ai.attr("y",pt)}}})})}},{key:"addMouseInteraction",value:function(n,t,i){n.on("mouseover, mousemove",function(n){var r=d3.select(this);t.animateHover&&r.classed("hover",!0);t.onTooltipFunction(i,n,t,this)}).on("mouseout",function(){if(t.animateHover){var n=d3.select(this);n.classed("hover",!1)}i.hide()}).on("click touchstart",t.onClickFunction).on("contextmenu",t.onCMFunction)}},{key:"drawAverageLine",value:function(n,t,i,r,u,f,e,o,s,h,c){var l=this.settings,a=t(u),v;if(!isNaN(a)&&!(a<0)&&(v=0,l.inlineAxis&&(v=c+20),n.append("g").attr("class","avgline").attr("transform","translate("+v+","+a+")").append("line").transition().attr("x2",0).attr("y2",0).attr("stroke",i).attr("stroke-width",f+"px").transition().duration(e).attr("x2",r),o&&s)){h||(h="left");var y=o.append("g").attr("class","avglabel label bar"),w=y.append("rect").style("opacity","0"),p=h==="left"?"start":"end";y.append("text").attr("class","label"+p).attr("font-size",l.labelFontSize+"px").attr("fill",l.showLabelContrast?chartutils.getContrastLabelColor(l,l.labelFontColor,l.chartBackgroundColor):l.labelFontColor).attr("text-anchor",p).attr("dy",.85*l.labelFontSize+"px").attr("x",function(){return h==="left"?4:r-4}).attr("y",a-l.labelFontSize).transition().delay(e).on("end",function(){var t=d3.select(this);t.text(s);chartutils.wrapCenterText(t,l);var n=t.node().getBBox(),i=n.width,r=n.height;w.attr("class","labelBG").attr("height",r).attr("width",i+8).attr("x",n.x-4).attr("y",n.y)})}}},{key:"drawMedianData",value:function(n,t,i,r,u,f,e,o,s,h){var c=this.settings,w=this,a=null,g,l,y,b,ut;if(r&&(g=r.ticks(),a=g[g.length-1]),c.medianDataset!==null&&typeof c.medianDataset=="object"){if(c.medianType==="point"){var nt=c.medianShape==="circle"?"circle":"rect",ft=n.append("g").attr("class","points").selectAll(nt).data(c.medianDataset).enter().append(nt).attr("fill",c.medianColor).attr("class","point").attr("stroke",c.medianStrokeColor).attr("stroke-width",c.medianStrokeWidth+"px").attr("data-title",function(n){if(n.name)return n.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.namecode!==undefined&&n.namecode!==null?n.namecode:n.name}),et=Math.sqrt(Math.pow(c.medianSize/100,2)*Math.pow(c.medianSize/100,2)),ot=c.medianSize/200;ft.each(function(n,f){var h,l,y,p,d;if(n.y!==null&&!isNaN(n.y)){h=d3.select(this);switch(c.medianShape){case"diamond":l=u*et;y=(u-l)/2;h.attr("width",l).attr("height",l).attr("transform",function(n){var f=n.xcode?t(n.xcode):n.xshort?t(n.xshort):t(n.x),o=i(n.y);return f+=u/2,f+=e,a&&c.brokenAxis&&+n.y<a&&(o=r(+n.y)),"rotate(45,"+f+","+o+")"}).attr("x",function(n){var i=n.xcode?t(n.xcode):n.xshort?t(n.xshort):t(n.x);return i+e+y}).attr("y",function(n){var t=a&&c.brokenAxis&&+n.y<a?r(+n.y):i(+n.y);return t-l/2});break;case"stripe":h.attr("width",u).attr("height",c.medianStripeWidth).attr("x",function(n){var i=n.xcode?t(n.xcode):n.xshort?t(n.xshort):t(n.x);return i+e}).attr("y",function(n){return a&&c.brokenAxis&&+n.y<a?r(+n.y):i(+n.y)});break;default:h.attr("r",u*ot).attr("transform","translate("+u/2+",0)").attr("cx",function(n){var i=n.xcode?t(n.xcode):n.xshort?t(n.xshort):t(n.x);return i+e}).attr("cy",function(n){var t=a&&c.brokenAxis&&+n.y<a?r(+n.y):i(+n.y);return t-c.medianStripeWidth/2+c.medianStrokeWidth})}if(h.attr("opacity",0).transition().duration(s).delay(function(){return s>0?f*50:0}).attr("opacity",1),n.t!==undefined&&(n.t==="e"&&c.showEstimation||n.t==="f"&&c.showForecast))if(p=n.t==="e"?c.estimationType:c.forecastType,p!=="Solid"){var b=d3.select(this),k=this.cloneNode(!0),v=d3.select(k),g=n.t==="e"?c.estimationDrawStyle:c.forecastDrawStyle;v.datum(b.datum());v.attr("fill","url("+c.baseLoc+c.container+g+"_"+n.t+")");b.node().parentNode.appendChild(k);w.addMouseInteraction(v,c,o)}else d=n.t==="e"?c.estimationColor:c.forecastColor,h.attr("fill",d),w.addMouseInteraction(h,c,o);else w.addMouseInteraction(h,c,o)}})}else if(c.medianType==="line"){b=d3.curveMonotoneX;c.medianLineStyle==="linear"&&(b=d3.curveLinear);var st=d3.line().defined(function(n){return!isNaN(n.y)}).x(function(n){var i=n.xcode?t(n.xcode):n.xshort?t(n.xshort):t(n.x);return i+e+u/2}).y(function(n){return a&&c.brokenAxis&&+n.y<a?r(+n.y):i(+n.y)}).curve(b),tt=n.append("g").attr("class","lines"),v=[],p=0,d=!1,k=[];for(l=0;l<c.medianDataset.length;l++)c.medianDataset[l].y===null||isNaN(c.medianDataset[l].y)?(k=c.medianDataset.slice(p,l),v.push(k),p=l+1):c.medianDataset[l].special&&!d?(d=!0,k=c.medianDataset.slice(p,l),v.push(k),p=l>0?l-1:l):!c.medianDataset[l].special&&d&&(d=!1,k=c.medianDataset.slice(p,l),v.push(k),p=l>0?l-1:l);for(v.push(c.medianDataset.slice(p,l)),y=0;y<v.length;y++){var ht=st(v[y]),it=tt.append("g").attr("class","line"),rt=it.append("path").attr("class","line line_1");rt.attr("d",ht).attr("stroke",function(){return c.medianLineColor}).attr("stroke-width",c.medianLineWidth).attr("fill","none");b="solid";v[y].length>1&&v[y][1].special&&(b="dot");chartutils.drawPoints(!0,v[y],t,i,r,-1,o,w,it,0);tt.selectAll("g.points").attr("transform","translate("+(e+u/2)+",0)");w.addLineStyleToPath(c,rt,b,v[y],c.medianLineWidth)}}}else c.medianDataset!==null&&typeof c.medianDataset=="number"&&(ut=d3.select(c.container+" svg g.labels"),w.drawAverageLine(n,i,c.medianColor,f,c.medianDataset,c.lineWidth,s,ut,c.averageLabel,c.averageLabelAlignment,h))}},{key:"addLineStyleToPath",value:function(n,t,i,r,u){if(d3.select(t.node()).attr("d")!==null){var e=t.node().getTotalLength(),f=e+" "+e;switch(i){case"dash":f="7, 3";break;case"dashdot":f="7, 3, 3, 3";break;case"dashdotdot":f="7, 3, 3, 3, 3, 3";break;case"dot":f="3, 3"}t.attr("stroke-width",u);i!=="solid"&&t.attr("stroke-dasharray",f).attr("stroke-dashoffset",e)}}},{key:"getLegendData",value:function(n){var t=this.settings,e=[],i,r,u,f,o;if(t.categorySet.length>0)for(i=0;i<t.categorySet.length;i++)o=t.categorySet[i],o.length>0&&(r=t.legendIconDefault,u=o,f=t.categoryColorList[i],e.push({type:r,color:f,text:u}));else for(i=0;i<n.length;i++)r=t.legendIconDefault,u=n[i].key,f=t.colorList[i],e.push({type:r,color:f,text:u});return t.medianDataset!==null&&(typeof t.medianDataset=="number"||typeof t.medianDataset=="object"&&t.medianDataset.length>0)&&(r=t.medianType,u=t.medianName,f=t.medianColor,e.push({type:r,color:f,text:u})),e}},{key:"triggerMouseOverByCode",value:function(n){this.settings.animateHover&&(d3.selectAll(".chart").selectAll("g.bar").each(function(t){if(t&&t.code===n){var i=d3.select(this);i.classed("hover",!0)}}),d3.selectAll(".chart").selectAll("g.points .point").each(function(t){if(t&&t.code===n){var i=d3.select(this);i.classed("hover",!0)}}))}},{key:"triggerMouseOutByCode",value:function(){var t,n,i;if(this.settings.animateHover)for(t=document.querySelectorAll("g.bar.hover, .point.hover"),n=0;n<t.length;n++)i=d3.select(t[n]),i.classed("hover",!1)}},{key:"reSize",value:function(){this.draw()}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_BenchmarkPie=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:"",colors:[],indicators:[],dataUnit:"",labelClass:"donut-center",margin:{top:10,right:10,bottom:10,left:10},showLabels:!0,showValues:!1,showNames:!0,useTooltip:!0,animate:!1,animateHover:!1,animateHoverOuterRing:!1,duration:1250,durationHover:200,onClickFunction:this.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",legendData:[],showlegend:!0,labelFontSize:10,labelFontColor:"rgb(0,0,0)",labelFontColorContrast:"rgb(255,255,255)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",showLabelContrast:!1,width:400,height:400,showOuterRing:!0,strokeColor:"#f0f0f8",strokeWidth:1,legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,targetBlank:!1,pieRotation:0,depthPartition:0,rotateLabels:!0,validContainer:!0,useCustomRadius:!1,radiusArray:[],categoryTickBorder:!1,strokeTickBorderWidth:5};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1);this.arc=null;this.arcOver=null}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.defaults,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);(n.width=i.width,n.height=i.height,n.width<5||n.height<5)||(d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height),chartutils.drawChartExtras(this,n),r.length<=0)||this.addChart(n.width,n.height,n.margin.left,n.margin.top)}}},{key:"addChart",value:function(n,t,i,r){var v,u,s,tt,o,ot,it,d,h;if(!(n<5)&&!(t<5)&&(v=this,u=this.settings,u.validContainer)){var rt=JSON.parse(u.dataset),y=d3.select(u.container+" svg"),g=y.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")");chartutils.drawSubtitle(this,n,t,g);var nt=y.select(".subtitleGroup").select(".subtitle").select("text").node(),ut=nt?nt.getBBox().height:0,p=n-u.margin.left-u.margin.right,w=t-u.margin.top-u.margin.bottom-ut,b=g.append("g").attr("class","elements").attr("transform","translate("+p/2+","+w/2+")");u.usePieLabel&&!u.pieLabelInside&&(p-=80,w-=80);for(var e=Math.min(p,w)/2,c=d3.hierarchy(rt,function(n){return n.children}).sum(function(n){return n.weight}),f=0,l=c;l.children;)f=l.depth,l=l.children[0];f=f+1;u.showOuterRing||(e=e/f*(f+1));s=0;u.depthPartition>0&&(s=e/f*u.depthPartition);tt=d3.partition().size([2*Math.PI,e]);tt(c);o=u.pieRotation*Math.PI/180;u.useCustomRadius&&u.radiusArray.length===f?(this.arc=d3.arc().startAngle(function(n){return n.x0+o}).endAngle(function(n){return n.x1+o}).innerRadius(function(n){return n.depth===0?n.y0:(e/f+1)*u.radiusArray.slice(0,n.depth).reduce(function(n,t){return n+t})}).outerRadius(function(n){return n.depth!==f&&(u.showOuterRing||n.depth!==f-1)?(e/f+1)*u.radiusArray.slice(0,n.depth+1).reduce(function(n,t){return n+t})-s:n.y1}),this.arcOver=d3.arc().startAngle(function(n){return n.x0+o}).endAngle(function(n){return n.x1+o}).innerRadius(function(n){if(u.animateHoverOuterring&&n.height===0)return n.y0;var t=n.depth===0?n.y0:(e/f+1)*u.radiusArray.slice(0,n.depth).reduce(function(n,t){return n+t});return t*.99}).outerRadius(function(n){var t=n.depth===f||!u.showOuterRing&&n.depth===f-1?n.y1:(e/f+1)*u.radiusArray.slice(0,n.depth+1).reduce(function(n,t){return n+t});return u.animateHoverOuterring&&n.height===0?t*1.04-s:u.categoryTickBorder&&n.depth===f||!u.showOuterRing&&n.depth===f-1?t:t*1.01-s})):(this.arc=d3.arc().startAngle(function(n){return n.x0+o}).endAngle(function(n){return n.x1+o}).innerRadius(function(n){return n.y0}).outerRadius(function(n){return n.y1-s}),this.arcOver=d3.arc().startAngle(function(n){return n.x0+o}).endAngle(function(n){return n.x1+o}).innerRadius(function(n){return u.animateHoverOuterring&&n.height===0?n.y0:n.y0*.99}).outerRadius(function(n){return u.animateHoverOuterring&&n.height===0?n.y1*1.04-s:n.y1*1.01-s}));var k=this.arc,ft=this.arcOver,et=chartutils.toolTip(u.useTooltip),a=b.selectAll("g.node").data(c.descendants()).enter().append("g").attr("class","node").append("path").attr("class",function(n){var t="";return n.data&&n.data.url&&(t=" chart-pointer"),"node_d"+n.depth+t}).attr("stroke",u.strokeColor).attr("stroke-width",u.strokeWidth+"px").attr("data-code",function(n){return n.data.varvalue}).attr("data-urltarget",function(){return u.targetBlank}).attr("fill",function(n){return u.colors(n.data.value)}),h=u.animate?u.duration:0;u.animate?a.transition().delay(function(n,t){return t*20}).ease(d3.easeLinear).duration(h).attrTween("d",function(n){var t=d3.interpolate({startAngle:0,endAngle:0},n);return function(n){return k(t(n))}}):a.attr("d",k);u.showOuterRing||a.style("visibility",function(n){return n.height===0?"hidden":"visible"});v.addMouseInteraction(a,u,et,k,ft);v.addPieLabelSlices(b,n,t,h,e,c);ot=!0;u.categoryTickBorder&&(it=u.useCustomRadius&&u.radiusArray.length===f?d3.arc().startAngle(function(n){return n.x0+o}).endAngle(function(n){return n.x1+o}).innerRadius(function(n){return n.depth===0?n.y0:(e/f+1)*u.radiusArray.slice(0,n.depth).reduce(function(n,t){return n+t})}).outerRadius(function(){return u.showOuterRing?e:e/(f+1)*f}):d3.arc().startAngle(function(n){return n.x0+o}).endAngle(function(n){return n.x1+o}).innerRadius(function(n){return n.y0}).outerRadius(function(){return e}),d=b.selectAll("g.nodeHelper").data(c.descendants().filter(function(n){return n.depth!==f})).enter().append("g").attr("class","nodeHelper").append("path").attr("class",function(n){var t="";return n.data&&n.data.url&&(t=" chart-pointer"),"node_d"+n.depth+t}).attr("stroke",u.strokeColor).attr("stroke-width",u.strokeTickBorderWidth+"px").attr("data-code",function(n){return n.data.varvalue}).attr("data-urltarget",function(){return u.targetBlank}).attr("fill","transparent").style("pointer-events","none"),h=u.animate?u.duration:0,d.transition().delay(h).ease(d3.easeLinear).duration(h).attr("d",it),u.showOuterRing||d.style("visibility",function(n){return n.height===0?"hidden":"visible"}));y.attr("class","animating").transition().delay(h).attr("class","")}}},{key:"addMouseInteraction",value:function(n,t,i,r,u){n.on("mouseover",function(n){var r=d3.select(this);t.animateHover&&(r.classed("hover",!0),r.attr("d",u).style("opacity","0.5").transition().duration(t.durationHover));t.onTooltipFunction(i,n,t,this)}).on("mousemove",function(n){t.onTooltipFunction(i,n,t,this)}).on("mouseout",function(){var n=d3.select(this);t.animateHover&&(n.classed("hover",!1),n.transition().duration(t.durationHover).attr("d",r).style("opacity","1"));i.hide()}).on("click touchstart",t.onClickFunction).on("contextmenu",t.onCMFunction)}},{key:"addPieLabelSlices",value:function(n,t,i,r,u,f){function l(n,t){n.each(function(){for(var i=d3.select(this),e=i.text().split(/\s+/).reverse(),n,r=[],l=0,c=!0,a=i.attr("y"),o=parseFloat(i.attr("dy")),f=i.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",o+"em"),s,h,u;e.length>0;)n=e.pop(),s=!1,n.indexOf("\\n")>=0&&(s=!0,n=n.replace("\\n","")),r.push(n),f.text(r.join(" ")),!c&&(s||f.node().getComputedTextLength()>=t&&(n.length||e.length)>1)&&(r.pop(),f.text(r.join(" ")),r=[n],f=i.append("tspan").attr("x",0).attr("y",o).attr("dy",++l*1.1+o+"em").text(n)),c=!1;h=i.selectAll("tspan");u=h.size();h.each(function(n){var i=d3.select(this),t=i.attr("dy");t=t.substring(0,t.length-2);u>1&&n!==""?i.attr("dy",+t-.25*u+"em"):u===1&&n!==""?i.attr("dy",+t+.25+"em"):i.attr("dy",+t-.25*u-.5+"em")})})}function a(n){var i=(n.x0+n.x1)/Math.PI*90,f;if(n.height===0){var t=Math.abs(360-e.pieRotation),r=t>180?t-180:t+180,u=e.pieRotation%180;return t>r&&(f=r,r=t,t=f),i>t&&i<r?i+(90+u):i-(90-u)}return 0}var e=this.settings,s=this.arc,c=f.y1-10,h,o;n.append("g").attr("transform","translate("+t/2+","+i/2+")");h=n.selectAll(".node").append("g").attr("class","label pie");o=h.append("text").attr("transform",function(n){if(n.depth!==0)return e.rotateLabels?"translate("+s.centroid(n)+") rotate("+a(n)+")":"translate("+s.centroid(n)+")"}).attr("font-size",e.labelFontSize+"px").attr("fill",function(n){return e.showLabelContrast?chartutils.getContrastLabelColor(e,e.labelFontColor,e.colors(n.data.value)):e.labelFontColor}).attr("dx","0").attr("dy","0").attr("text-anchor","middle").style("pointer-events","none").text(function(n){var t,i;return!e.showNames&&!e.showValues?"":(t="",e.showNames&&(t=n.data.label?n.data.label:n.data.name),e.showValues&&!n.data.label&&(i=n.data.value,i=n.data.valstr?n.data.valstr:i.toLocaleString(),t.length>0?t+=": "+i:t=i),e.showOuterRing?t:n.height===0?"":t)}).call(l,c).style("visibility","hidden");e.animate?o.transition().ease(d3.easeLinear).duration(r).delay(function(n,t){return t*20}).style("visibility","visible"):o.style("visibility","visible");n.selectAll("g.label.pie").each(function(){var t=d3.select(this).select("text").attr("transform"),n;d3.select(this).select("text").attr("transform","");n=d3.select(this).node().getBBox();d3.select(this).insert("rect","text").attr("class","labelBG").attr("height",n.height).attr("width",n.width+10).attr("x",n.x-5).attr("y",n.y).attr("transform",t).style("opacity","0");d3.select(this).select("text").attr("transform",t)})}},{key:"getLegendData",value:function(){var t=this.settings.indicators,r=[],n,i;if(t.length>=0)for(n=0;n<t.length;n++)if(i=t[n],i.length>0){var u=i,f=settings.colors[n];r.push({type:"",color:f,text:u})}return r}},{key:"reSize",value:function(){this.draw()}},{key:"updateData",value:function(){d3.selectAll(".chart").each(function(){var t=d3.select(this),n;g.value(function(n){return n[value]});n=t.selectAll("g.slices").selectAll("path");n=n.data(pie);n.attr("d",this.arc)})}},{key:"triggerMouseOverByCode",value:function(n){var t=this.settings,i,r;t.animateHover&&((i=this.arcOver,r=d3.select(t.container).select("svg").attr("class"),r.indexOf("animating")>=0)||d3.selectAll(".chart").selectAll("g.node").selectAll("path").each(function(r){if(r.code===n){var u=d3.select(this);u.classed("hover",!0);t.animateHover&&u.transition().duration(200).attr("d",i)}}))}},{key:"triggerMouseOutByCode",value:function(n){var t=this.settings,i,r,u;t.animateHover&&((i=d3.select(t.container).select("svg").attr("class"),i.indexOf("animating")>=0)||(r=this.arc,u=d3.selectAll(".chart").selectAll("g.node").selectAll("path").each(function(i){var f=i,u;i.code===n&&(u=d3.select(this),u.classed("hover",!1),t.animateHover&&u.transition().duration(200).attr("d",r))})))}},{key:"defaultOnClick",value:function(n){var t,i;n.data&&(t=n.data.url,t&&(i=this.getAttribute("data-urltarget")==="true",i?window.open(t):window.location.href=t))}},{key:"defaultTooltip",value:function(n,t){var u="",i,r;return t.data&&(i=t.data.name,i&&i.length>0&&(i=i.replace(/\\n/g," "),u+=i+": "),r=t.data.value,r=t.data.valstr!==undefined&&t.data.valstr!==null?t.data.valstr:r.toLocaleString(),u+=r),n.show("<span>"+u+"<\/span>")}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Column=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],medianDataset:[],categorySet:[],mirrorDataset:[],medianColor:"#333",medianColorList:[],medianType:"",medianName:"",medianShape:"circle",medianStripeWidth:0,medianSize:50,medianStrokeColor:"#fff",medianStrokeWidth:1,margin:{top:0,right:20,bottom:10,left:20},rotation:45,rotationy:0,yTicks:5,opacity:.8,lineWidth:2,barPadding:0,groupPadding:1,animate:!1,animateHover:!0,duration:1250,drawBarDelay:50,useTooltip:!0,showLegend:!0,legendData:[],dataPrefix:"",dataPostfix:"",dataUnit:"",colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],categoryColorList:[],title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",stacked:!1,mirrored:!1,axisColor:"rgb(0,0,0)",showGridLines:!0,gridLineColor:"rgb(0,0,0)",brokenAxis:!1,skipLabel:0,axisStartVal:0,width:0,height:0,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:chartutils.defaultTooltip,onLegendTooltipFunction:null,showAxes:!0,showAxisXLabels:!0,showValues:!1,forceDataLabel:!1,showAverage:!1,showInterval:!1,showEstimation:!1,showEmptyLabel:!1,showForecast:!1,averageLineWidth:2,averageLineColor:"black",customYMax:null,customYMin:null,customYStep:null,minYDefZero:!0,intervalStrokeColor:"black",intervalStrokeWidth:1,swapYaxis:!1,canSplitupText:!1,drawStyle:"default",forecastType:"Solid",forecastDrawStyle:"",forecastColor:"rgb(128,128,128)",estimationType:"Solid",estimationDrawStyle:"",estimationColor:"rgb(128,128,128)",showExtra:!1,extraType:"Solid",extraDataType:"",extraDrawStyle:"",extraColor:"rgb(128,128,128)",titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"rect",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,axisXFontSize:10,axisXFontColor:"rgb(0,0,0)",axisYFontSize:10,axisYFontColor:"rgb(0,0,0)",labelFontSize:10,labelFontColor:"rgb(0,0,0)",labelFontColorContrast:"rgb(255,255,255)",showLabelContrast:!1,showLabelInside:!1,bevelWidth:3,bevelColors:[],chartBackgroundColor:"transparent",validContainer:!0,clipPathCount:0,inlineAxis:!1,showBarBackground:!1,nrOfDec:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);if(n.width=i.width,n.height=i.height,!(n.width<1)&&!(n.height<1)){d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g");switch(n.drawStyle){case"cylinder":chartutils.addCylinderDefs(this,!0);break;case"gradient":chartutils.addGradientDefs(this,!0);break;case"lighttodark":chartutils.addLightToDarkDefs(this,!0);break;case"emboss":case"wedge":n.bevelColors=chartutils.getBevelColors(this)}((n.showEstimation&&n.estimationType!=="Solid"||n.showForecast&&n.forecastType!=="Solid"||n.showExtra&&n.extraType!=="Solid")&&chartutils.addHatchDefs(this),chartutils.drawChartExtras(this,n),r.length<=0)||this.addChart(n.width,n.height,0,0)}}}},{key:"addChart",value:function(n,t,i,r){var u,dt,hi,ci,nt,gt,et,w,ni,at,li,ti,ii,gr,f,o,di,e,nr,v,vt,s,tr,ui,ir,rr,ur,yt,ai,pt,vi,fr,fi,yi,tt,sr,k,cr,lr,wt;if(!(n<50)&&!(t<10)&&(u=this.settings,u.validContainer)){var y,p,ot,ut,s,st,bt,ft,ht=this,c=u.dataset,kt=d3.select(u.container+" svg"),d=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(c),a=d.length,bi=c.map(function(n){return+n.y}),ar=d3.range(a).map(function(n){return d[n].values.map(function(n){return n.y>=0?+n.y:0})}),vr=d3.range(a).map(function(n){return d[n].values.map(function(n){return n.y<0?+n.y:0})}),yr=d3.stack().keys(d3.range(a))(d3.transpose(ar)),h=u.stacked?d3.max(yr,function(n){return d3.max(n,function(n){return n[1]})}):d3.max(bi);if(u.mirrorDataset.length>0){var ki=u.mirrorDataset,ei=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(ki),oi=ei.length,pr=ki.map(function(n){return+n.y}),wr=d3.range(oi).map(function(n){return ei[n].values.map(function(n){return n.y>=0?+n.y:0})}),tu=d3.range(oi).map(function(n){return ei[n].values.map(function(n){return n.y<0?+n.y:0})}),br=d3.stack().keys(d3.range(oi))(d3.transpose(wr)),kr=u.stacked?d3.max(br,function(n){return d3.max(n,function(n){return n[1]})}):d3.max(pr);h=Math.max(h,kr)}h=Math.round(h*10)/10;h=u.customYMax===null?h:u.customYMax;var ct=kt.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),l=ct.append("g").attr("class","axes"),g=ct.append("g").attr("class","elements"),dr=l.append("rect").attr("width",0).attr("height",0),si=u.margin.top,lt="";for(chartutils.drawSubtitle(this,n,t,ct),dt=u.margin.top,s=0;s<c.length;s++)c[s].x&&(lt.length<=0||lt.length<c[s].x.length)&&(lt=c[s].x);if(y=kt.append("text").style("font-size",u.axisXFontSize+"px").text(lt),hi=y.node().getBBox(),p=hi.width,ot=hi.height,ci=c.length/a,y.remove(),y=kt.append("text").style("font-size",u.axisYFontSize+"px").text(lt),ut=y.node().getBBox().height,y.remove(),nt=u.inlineAxis?p:p+10,ci*ot*1.8<t&&(u.canSplitupText=!0),p>n/2)for(nt=0,gt=n/2,s=0;s<c.length;s++){if(et="",w="",ci*ot*1.8<t){for(ni=c[s].x.split(" "),at=0;at<ni.length;at++)w+=w.length===0?ni[at]:" "+ni[at],y=kt.append("text").style("font-size",u.axisYFontSize+"px").text(w),p=y.node().getBBox().width,p<=gt&&p>nt&&(nt=p),p>gt&&(li=w.lastIndexOf(" "),et+=w.substr(0,li)+"\n",w=w.substr(li+1)),y.remove();et+=w}else et=c[s].x,nt=gt;c[s].x=et;u.medianDataset!==null&&typeof u.medianDataset=="object"&&u.medianDataset.length===c.length&&(u.medianDataset[s].x=et)}if(ti=u.margin.left,u.showAxes&&!u.inlineAxis&&(ti+=nt),ii=r===0||r===t?u.margin.top:dt-si,ii+=u.inlineAxis?ut:0,gr=r===0?u.margin.top:dt-si,l.attr("transform","translate("+ti+","+ii+")"),g.attr("transform","translate("+ti+","+ii+")"),f=n-u.margin.left-u.margin.right,o=t-u.margin.bottom,o-=r===0?u.margin.top:dt-si,u.inlineAxis?o-=ut:f=f-nt,!(o<=10)&&!(f<=20)){di=d3.stack().keys(d3.range(a))(d3.transpose(vr));e=u.stacked?d3.min(di,function(n){return d3.min(n,function(n){return n[1]})}):d3.min(bi);e=u.customYMin===null?e:u.customYMin;e=u.stacked&&u.axisStartVal!==0?u.axisStartVal:e;u.minYDefZero&&e>0?e=0:u.minYDefZero&&e<0&&h<0&&(h=0);e===h&&(h=e+1);var ri=chartutils.getNiceRange(e,h,u.nrOfDec),gi=u.customYMin===null||u.customYMax===null,b=u.brokenAxis&&e>0&&(!gi||gi&&ri.minValue>0)?f/8:0;if(b>30&&(b=30),nr=u.mirrored?[f/2+b,f]:[b,f],v=d3.scaleLinear().range(nr),u.customYMin!==null&&u.customYMax!==null?v.domain([e,h]):(e=ri.minValue,h=ri.maxValue,v.domain([e,h]),u.customYStep=ri.step),vt=[],u.customYStep!==null&&u.customYStep!==0)for(bt=(h-e)/u.customYStep,ft=chartutils.nbrOfDecimals(u.customYStep),ft=ft>3?3:ft,s=0;s<=bt;s++)tr=Math.round((e+s*u.customYStep)*1e3)/1e3,vt.push(tr.toFixed(ft));if(ui=chartutils.getXAxisLinear(v,this,f,vt),u.customYStep!==null&&u.customYStep!==0&&ui.ticks(bt),ir=this.drawXAxis(ui,l,o,f,ut,!1),u.showAxisXLabels&&l.selectAll("g.tick").each(function(){var t=this.transform.baseVal.consolidate().matrix,n=d3.select(this).select("text"),i=n.node().getBBox().width;t.e+i/2>f+u.margin.right&&n.attr("text-anchor","end")}),e<0&&u.showAxes&&(st=vt,st.length<=0&&(st=ui.tickValues()),st.indexOf(0)>=0?(rr=st.indexOf(0),l.selectAll(".x.axis").select("g.tick:nth-child("+(rr+2)+")").select("line").attr("opacity","1").attr("stroke","black")):(ur=l.selectAll(".x.axis").select("line").attr("y2"),l.selectAll(".x.axis").append("g").attr("class","tick").attr("transform","translate("+v(0)+",0)").append("line").attr("opacity",1).attr("stroke","black").attr("y2",ur))),u.mirrored&&(yt=d3.scaleLinear().range([f/2-b,0]),u.customYMin!==null&&e>0?yt.domain([e,h]):yt.domain([e,h]).nice(),ai=chartutils.getXAxisLinear(yt,this,f,vt),u.customYStep!==null&&u.customYStep!==0&&ai.ticks(bt),this.drawXAxis(ai,l,o,f,ut,!1)),u.brokenAxis&&b>0&&(fi=u.mirrored?[f/2,f/2-b]:[0,b],pt=d3.scaleLinear().range(fi),pt.domain([0,e]),fr=chartutils.getXAxisLinear(pt,this,f,[0..toFixed(ft)]),this.drawXAxis(fr,l,o,f,ut,!0),u.mirrored&&(fi=[f/2,f/2+b],vi=d3.scaleLinear().range(fi),vi.domain([0,e]))),o-=ir,!(o<=10)){yi=[o,0];u.swapYaxis&&(yi=[0,o]);tt=d3.scaleBand().range(yi);tt.domain(c.map(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x}));var nu=this.getYAxis(tt,d,o,ot),er=!1,or=null;c.length>0&&c[0].xcode&&(er=!0,or=d3.nest().key(function(n){return n.xcode}).entries(c));this.drawYAxis(l,nu,f,t,ot,er,or);var pi=chartutils.toolTip(u.useTooltip),it=0,wi=tt.bandwidth();u.autoCalcBarWidth?(sr=u.stacked?.25:1/(a+1)/2,it=wi*sr):it=Math.ceil(o/1e3*u.groupPadding);k=(wi-it*2-u.barPadding*(u.dataset.length/a))/a;u.stacked&&(k=wi-it*2-u.barPadding);k<=0&&(k=1);u.inlineAxis&&(u.stacked?l.select(".y.axis").selectAll("text").attr("dy",-(k/2+u.axisYFontSize/3+2)+"px"):l.select(".y.axis").selectAll("text").attr("dy",-(a*k/2+u.axisYFontSize/3)+"px"));var rt=u.animate?rt=u.duration:0,iu=ct.selectAll(".x.axis"),hr=u.container.replace("#","")+"_"+u.clipPathCount;u.clipPathCount++;ct.append("clipPath").attr("id","chart-clip_"+hr).append("rect").attr("x",0).attr("y",0).attr("height",o).attr("width",f);g.attr("clip-path","url(#chart-clip_"+hr+")");dr.attr("fill",u.chartBackgroundColor).attr("x",1).attr("width",f-1).attr("y",0).attr("height",o);cr=u.mirrored?a:0;this.drawBars(f,d,g,v,pt,tt,e,it,k,rt,pi,!1,cr);u.mirrored&&(lr=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(u.mirrorDataset),this.drawBars(f,lr,g,yt,vi,tt,e,it,k,rt,pi,!0,0));ht.drawMedianData(g,v,pt,tt,k*a,o,it,pi,rt);u.showAverage&&(ht=this,u.stacked?(wt=0,d.forEach(function(n){var t=0;n.values.forEach(function(n){t+=+n.y});t=t/n.values.length;wt+=t}),wt=wt,ht.drawAverageLine(g,v,u.averageLineColor,o,wt,u.averageLineWidth,rt)):d.forEach(function(n,t){var i=0,r=0;n.values.forEach(function(n){n.y===null||isNaN(n.y)||(r++,i+=+n.y)});i=r>0?i/r:i/n.values.length;d.length>1?ht.drawAverageLine(g,v,u.categoryColorList[t],o,i,u.lineWidth,rt):ht.drawAverageLine(g,v,u.averageLineColor,o,i,u.averageLineWidth,rt)}))}}}}},{key:"drawBars",value:function(n,t,i,r,u,f,e,o,s,h,c,l,a){var v=this.settings,d=v.labelFontSize,k=v.labelFontColor,g=this,y=[],p=[],w=[],b;e<0&&(e=0);b=v.brokenAxis&&e>0?u(0):r(e);l&&b++;t.forEach(function(t,nt){var tt=i.selectAll("bar").data(t.values).enter().append("g").attr("class","bar");tt.each(function(t,i){var fi,dt,ti,ii,hi,ri,li,yi,gt,ni,pi,wi;if(!isNaN(t.y)){var rt=d3.select(this),gi=t.xcode?f(t.xcode):t.xshort?f(t.xshort):f(t.x),nr=v.stacked?0:s*nt+v.barPadding*nt*2,ut=gi+o+nr;v.showBarBackground&nt===0&&(fi=v.container.replace("#","")+"_column_empty",g.addEmptyColumnHatch(v.container,v.axisYFontColor,fi),rt.append("rect").attr("class","bgbar").attr("fill","url('#"+fi+"')").attr("y",ut).attr("x",0).attr("width",n).attr("height",s));p[i]===undefined&&(p[i]=0);w[i]===undefined&&(w[i]=0);y[i]===undefined&&(y[i]=0);var st=+t.y<0?!0:!1,tt=t.y===null?0:+t.y<e&&e>0&&v.brokenAxis?Math.abs(u(+t.y)-b):Math.abs(r(+t.y)-b),it=st?r(Math.min(e,+t.y))+w[i]:e>0&&v.brokenAxis?u(Math.min(0,+t.y))-p[i]:r(Math.min(e,+t.y))+p[i],ft=st?r(Math.min(e,+t.y))+w[i]:+t.y<e&&e>0&&v.brokenAxis?u(Math.min(0,+t.y))-p[i]:r(Math.max(e,+t.y))+p[i];if(v.stacked&&(ft=st?r(Math.max(e,+t.y))+w[i]:+t.y<e&&e>0&&v.brokenAxis?u(Math.max(0,+t.y))-p[i]:r(Math.max(e,+t.y))+p[i]),v.stacked&&v.brokenAxis&&e>0&&(st?tt=0:+t.y+y[i]<=e?(tt=Math.abs(u(+t.y)-b),y[i]+=+t.y):+t.y+y[i]>e&&y[i]<e?(dt=e-y[i],ti=Math.abs(+t.y-dt),tt=Math.abs(u(dt)-b)+Math.abs(r(ti)-r(0)),y[i]+=+t.y):(tt=Math.abs(r(+t.y)-r(0)),y[i]+=+t.y)),v.stacked&&v.brokenAxis&&e>0&&(st?it=0:y[i]<=e?it=u(y[i]):y[i]>e&&y[i]-+t.y<e?(dt=e-(y[i]-+t.y),ti=Math.abs(+t.y-dt),it=r(e)-(r(0)-r(ti))):it=r(y[i]),v.mirrored?l?(it=b-tt-Math.abs(w[i]),ft=it+tt):(it=b+p[i],ft=it+tt):l?(it=it+tt,ft=it+tt):(it=it-tt,ft=it+tt)),v.mirrored&&tt>1&&(tt=tt-1),v.mirrored&&!l&&(it=it+1),v.stacked&&(!v.stacked||v.brokenAxis&&e>0)||(l&&(it=it-tt+w[i]),l&&v.stacked&&(ft=ft+tt+w[i])),v.stacked&&(st||l?w[i]-=tt:p[i]+=tt),v.drawStyle==="emboss"||v.drawStyle==="wedge"){var et=v.bevelColors[nt],ai=t.t!==undefined&&(t.t==="e"&&v.showEstimation||t.t==="f"&&v.showForecast),vi=t.t==="e"?v.estimationType:v.forecastType;ai&&vi==="Solid"&&(yi=t.t==="e"?v.estimationColor:v.forecastColor,et=chartutils.createGradientColors(yi));ni=gt=v.drawStyle==="wedge"?v.bevelWidth=s/2:v.bevelWidth;gt>tt&&(gt=tt/2);ni>s&&(ni=s/2);var ht=it,ct=it+gt,lt=it+tt-gt,at=it+tt,vt=ut,yt=ut+ni,pt=ut+s-ni,wt=ut+s,tr=v.drawStyle==="wedge"?et[0]:et[1],ir=v.drawStyle==="wedge"?et[2]:et[1],rr=et[3],ur=v.drawStyle==="wedge"?et[2]:et[3],fr=rt.append("polygon"),er=rt.append("polygon"),or=rt.append("polygon"),sr=rt.append("polygon");fr.attr("points",ht+","+vt+" "+ct+","+yt+" "+ct+","+pt+" "+ht+","+wt).attr("fill",ir);er.attr("points",ht+","+vt+" "+at+","+vt+" "+lt+","+yt+" "+ct+","+yt).attr("fill",tr);or.attr("points",at+","+vt+" "+at+","+wt+" "+lt+","+pt+" "+lt+","+yt).attr("fill",ur);sr.attr("points",ht+","+wt+" "+ct+","+pt+" "+lt+","+pt+" "+at+","+wt).attr("fill",rr);v.drawStyle==="emboss"&&(pi=rt.append("polygon"),pi.attr("points",ct+","+yt+" "+lt+","+yt+" "+lt+","+pt+" "+ct+","+pt).attr("fill",et[0]));ai&&vi!=="Solid"&&(ri=t.t==="e"?v.estimationDrawStyle:v.forecastDrawStyle,wi=rt.append("polygon"),wi.attr("points",ht+","+vt+" "+at+","+vt+" "+at+","+wt+" "+ht+","+wt).attr("fill","url("+v.baseLoc+v.container+ri+"_"+t.t+")"))}else if(ii=rt.append("rect"),ii.attr("fill",function(n){if(n.catCode!==undefined&&n.catCode!==null&&n.catCode<v.categoryColorList.length)return v.categoryColorList[n.catCode];switch(v.drawStyle){case"cylinder":return"url("+v.container+"cylinder_"+(nt+a)+")";case"gradient":return"url("+v.container+"gradient_"+(nt+a)+")";case"lighttodark":return"url("+v.container+"ltod_"+(nt+a)+")";case"emboss":case"wedge":default:return v.colorList[nt+a]}}).attr("y",ut).attr("height",s).attr("x",b).attr("width",0).transition().duration(h).delay(function(){return h>0?i*v.drawBarDelay:0}).attr("width",tt).attr("x",it),t.t!==undefined&&(t.t==="e"&&v.showEstimation||t.t==="f"&&v.showForecast||t.t===v.extraDataType&&v.showExtra))if(hi=t.t==="e"?v.estimationType:t.t==="f"?v.forecastType:v.extraType,hi!=="Solid"){var ei=ii,ci=ei.node().cloneNode(!0),oi=d3.select(ci);oi.datum(ei.datum());oi.transition().duration(h).delay(function(){return h>0?i*v.drawBarDelay:0}).attr("width",tt).attr("x",it);ri=t.t==="e"?v.estimationDrawStyle:t.t==="f"?v.forecastDrawStyle:v.extraDrawStyle;oi.attr("fill","url("+v.baseLoc+v.container+ri+"_"+t.t+")");ei.node().parentNode.appendChild(ci)}else li=t.t==="e"?v.estimationColor:t.t==="f"?v.forecastColor:v.extraColor,ii.attr("fill",li);if(rt.attr("data-title",function(n){if(n.name)return n.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.namecode?n.namecode:n.name}).attr("data-value",function(n){return n.ystring!==undefined?n.ystring:Number(n.y).toLocaleString()}),g.addMouseInteraction(rt,v,c),v.showInterval&&t.ri){var ui=r(Math.max(0,+t.y-+t.ri)),si=r(Math.max(0,+t.y+ +t.ri)),bi=ut+s/2;rt.append("line").attr("x1",ui).attr("x2",si).attr("y1",bi).attr("y2",bi).attr("stroke-width",v.intervalStrokeWidth).attr("stroke",v.intervalStrokeColor);rt.append("line").attr("x1",ui).attr("x2",ui).attr("y1",ut+s/6).attr("y2",ut+5*s/6).attr("stroke-width",v.intervalStrokeWidth).attr("stroke",v.intervalStrokeColor);ui>=0&&rt.append("line").attr("x1",si).attr("x2",si).attr("y1",ut+s/6).attr("y2",ut+5*s/6).attr("stroke-width",v.intervalStrokeWidth).attr("stroke",v.intervalStrokeColor)}if(v.showValues||v.showEmptyLabel){var hr="label "+(v.stacked?"middle":"start"),ki=rt.append("g").attr("class","labels"),di=ki.append("rect").style("opacity","0").attr("width",0).attr("height",0),bt=ki.append("text").attr("class",hr).attr("y",ut+s/2).attr("dy",.35*d+"px").attr("text-anchor","start").attr("font-size",d+"px").attr("fill",function(){return v.showLabelContrast&&v.stacked?chartutils.getContrastLabelColor(v,k,v.colorList[nt+a]):k}).style("visibility","hidden").text(function(n){var t="";return(t=n.ystring!==undefined?n.ystring:Number(n.y).toLocaleString(),n.empty)?t:v.dataPostfix.length>0&&t.indexOf(v.dataPostfix)>=0?v.dataPrefix+t:v.dataPrefix+t+v.dataPostfix}).transition().delay(h).on("end",function(){var r,i,n;try{r="visible";i=d3.select(this);chartutils.wrapCenterText(i,v);var u=i.node().getBBox(),f=u.width,e=u.height;(v.showValues||t.empty)&&!t.hideLabel&&(v.forceDataLabel||v.showEmptyLabel&&(!v.showEmptyLabel||t.empty)||!(e>s*1.2||v.stacked&&f>tt-4))?(i.style("visibility",r),n=d3.select(this).node().getBBox(),di.attr("class","labelBG").attr("height",n.height).attr("width",n.width+8).attr("x",n.x-4).attr("y",n.y)):r="hidden"}catch(o){}}),ot=v.stacked?ft-tt/2:ft+5,kt=bt.node().getBBox().width;l&&!v.stacked||st&&!v.stacked?ot-kt-10>0?ot-=kt+10:bt.attr("fill",function(n){if(!v.showLabelContrast)return k;var t=n.catCode!==undefined&&n.catCode!==null&&n.catCode<v.categoryColorList.length?v.categoryColorList[n.catCode]:v.colorList[nt+a];return chartutils.getContrastLabelColor(v,k,t)}):v.stacked||(v.showLabelInside&&ot>kt+10&&(ot-=kt+10,bt.attr("fill",function(n){if(!v.showLabelContrast)return k;var t=n.catCode!==undefined&&n.catCode!==null&&n.catCode<v.categoryColorList.length?v.categoryColorList[n.catCode]:v.colorList[nt+a];return chartutils.getContrastLabelColor(v,k,t)})),ot+kt>n&&(ot-=kt+10,bt.attr("fill",function(n){if(!v.showLabelContrast)return k;var t=n.catCode!==undefined&&n.catCode!==null&&n.catCode<v.categoryColorList.length?v.categoryColorList[n.catCode]:v.colorList[nt+a];return chartutils.getContrastLabelColor(v,k,t)})));t.empty&&(bt.attr("class","label start"),ot=5,di.attr("x",1));bt.attr("x",ot)}}})})}},{key:"addEmptyColumnHatch",value:function(n,t,i){var u,f,e,o=d3.select(n+" svg"),r=o.select("defs"),s="ForwardDiagonal";r.empty()&&(r=o.append("defs"));r.select(i).empty()&&(u=r.append("pattern").attr("id",i),f=chartutils.getPatternWidth(s),u.attr("patternUnits","userSpaceOnUse").attr("width",f).attr("height",f),e=u.append("path"),e.attr("d",chartutils.getHatchPath(s)).attr("stroke",t).attr("stroke-width",1))}},{key:"drawXAxis",value:function(n,t,i,r,u,f){var o=this.settings,c=o.axisYFontSize,v=o.axisYFontColor,w=f?"x axis broken":"x axis",b=f?t.select(".x.axis").attr("transform"):"",s=t.append("g").attr("class",w),l,a,y,e,h,p;return s.call(n),o.showAxes&&o.showAxisXLabels?(s.selectAll("text").attr("text-anchor","middle").attr("fill",v).attr("font-size",c+"px").attr("transform",function(){var n=d3.select(this).attr("x"),t;return n===null&&(n=0),t=d3.select(this).attr("y"),"rotate("+o.rotation+", "+n+","+t+")"}),o.rotation>0&&o.rotation<180||o.rotation<-180&&o.rotation>-360?s.selectAll("text").attr("text-anchor","start"):o.rotation===0||o.rotation===360?s.selectAll("text").attr("text-anchor","middle"):s.selectAll("text").attr("text-anchor","end")):(s.selectAll("text").remove(),u=0),l=Math.ceil(s.node().getBBox().height),a=i-l-u,a-=o.dataUnit.length>0?c:0,f?s.attr("transform",b):s.attr("transform","translate(0,"+a+")"),n.tickSizeInner(-a),s.call(n),o.showAxes?(s.selectAll("line").attr("opacity",o.showGridLines?.2:0).attr("stroke",o.gridLineColor),f?(s.selectAll("line").attr("opacity","0"),o.mirrored?(s.select("path.domain").each(function(){e=this.getBBox()}),h="M"+e.x+",0.5L"+(e.x+e.width*6/8)+",0.5",h+="M"+(e.x+e.width*6/8+e.width/2)+",0.5L"+(e.x+e.width*5/8+e.width/2)+",5",h+="M"+(e.x+e.width*5/8+e.width/2)+",5L"+(e.x+e.width/2+e.width/2)+",-8",h+="M"+(e.x+e.width/2+e.width/2)+",-8L"+(e.x+e.width*3/8+e.width/2)+",8",h+="M"+(e.x+e.width*3/8+e.width/2)+",8L"+(e.x+e.width/4+e.width/2)+",0.5",h+="M"+(e.x+e.width*6/8+e.width/2)+",0.5L"+(e.x+e.width+e.width)+",0.5"):(s.select("path.domain").each(function(){e=this.getBBox()}),h="M"+e.x+",0.5L"+(e.x+e.width/4)+",0.5",h+="M"+(e.x+e.width*6/8)+",0.5L"+(e.x+e.width*5/8)+",5",h+="M"+(e.x+e.width*5/8)+",5L"+(e.x+e.width/2)+",-8",h+="M"+(e.x+e.width/2)+",-8L"+(e.x+e.width*3/8)+",8",h+="M"+(e.x+e.width*3/8)+",8L"+(e.x+e.width/4)+",0.5",h+="M"+(e.x+e.width*6/8)+",0.5L"+(e.x+e.width)+",0.5"),s.select("path.domain").attr("d",h),s.selectAll("text").remove()):(y=s.append("text"),y.attr("y",l+u).attr("x",r/2).style("text-anchor","middle").attr("font-size",c+"px").attr("fill",v).text(o.dataUnit)),s.select("path.domain").attr("stroke",o.axisColor),p=l+u,p+(o.dataUnit.length>0?c:0)):(t.selectAll(".x.axis").selectAll("line").remove(),t.selectAll("path.domain").attr("stroke-width","0px"),0)}},{key:"getYAxis",value:function(n,t,i,r){var u=this.settings,s=u.dataset,e=1,o,f,h,c;for(u.skipLabel>0&&(e=u.skipLabel),o=Math.ceil(s.length/e/t.length);i/o<r*.9;)o/=2,u.skipLabel>0?e+=u.skipLabel:e++;return f=n.domain(),u.mirrored&&(f=f.reverse()),f=f.filter(function(n,t){return!(t%e)}),u.mirrored&&(f=f.reverse()),h=u.inlineAxis?-2:10,c=d3.axisLeft().scale(n).ticks(s.length).tickValues(f).tickSizeInner(0).tickSizeOuter(0).tickPadding(h),c}},{key:"drawYAxis",value:function(n,t,i,r,u,f,e){var o=this.settings,c=o.axisXFontSize,l=o.axisXFontColor,s=n.append("g").attr("class","y axis"),h="end";(o.rotationy<270&&o.rotationy>90||o.rotationy<-90&&o.rotationy>-270)&&(h="start");o.inlineAxis&&(h=h==="start"?"end":"start");s.call(t);f&&s.selectAll("text").text(function(n,t){for(var i=t;i<e.length;i++)if(e[i].key.toString()===n.toString())return e[i].values[0].x;return e[t].values[0].x});o.showAxes?s.selectAll("text").attr("transform","rotate("+o.rotationy+",0,0)").attr("text-anchor",h).attr("font-size",c+"px").attr("fill",l).attr("data-title",function(n,t){var r,i;if(f){for(r=e[t].values[0].x,i=t;i<e.length;i++)if(e[i].key.toString()===n.toString()){r=e[i].values[0].x;break}return r.replace(/</g,"&lt;").replace(/>/g,"&gt;")}return n.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n}):s.selectAll("text").remove();s.attr("transform","translate(-1,0)");s.selectAll("line").attr("visibility","hidden");o.showAxes&&(o.inlineAxis?(s.selectAll("text").call(chartutils.truncate,i,o).attr("text-anchor",h),s.selectAll("text").each(function(){d3.select(this).append("title").text(d3.select(this).attr("data-title"))})):s.selectAll("text").call(chartutils.wrapYLabel));n.select(".y.axis").selectAll("path").attr("stroke",o.axisColor).attr("stroke-width",function(){return o.showAxes?"1px":"0px"});n.select(".y.axis").selectAll("g.tick").attr("data-title",function(n,t){var r,i;if(f){for(r=e[t].values[0].x,i=t;i<e.length;i++)if(e[i].key.toString()===n.toString()){r=e[i].values[0].x;break}return r.replace(/</g,"&lt;").replace(/>/g,"&gt;")}return n.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n});o.inlineAxis&&n.select(".y.axis path.domain").attr("opacity",0);s.selectAll("text").on("click touchstart",o.onClickFunction).on("contextmenu",o.onCMFunction);o.canSplitupText||s.selectAll("text").text(function(n,t){var u=n,r,s,h,c;if(f)for(r=t;r<e.length;r++)if(e[r].key.toString()===n.toString()){u=e[r].values[0].x;break}return s=d3.select(this).node().getBBox().width,s>(i*2+o.margin.left+o.margin.right)/2?(h=(i*2+o.margin.left+o.margin.right)/2/s,c=Math.round(u.length*h),u.substr(0,c)+"..."):u})}},{key:"addMouseInteraction",value:function(n,t,i){n.on("mouseover, mousemove",function(n){if(!n.ignoreTT){var r=d3.select(this);t.animateHover&&r.classed("hover",!0);t.onTooltipFunction(i,n,t,this)}}).on("mouseout",function(){if(t.animateHover){var n=d3.select(this);n.classed("hover",!1)}i.hide()}).on("click touchstart",t.onClickFunction).on("contextmenu",t.onCMFunction)}},{key:"drawAverageLine",value:function(n,t,i,r,u,f,e){var o=t(u);isNaN(o)||n.append("g").attr("class","avgline").attr("transform","translate("+o+",0)").append("line").transition().attr("x2",0).attr("y2",0).attr("stroke",i).attr("stroke-width",f+"px").transition().duration(e).attr("y2",r)}},{key:"drawMedianData",value:function(n,t,i,r,u,f,e,o,s){var h=this.settings,l=this,c=null,a,y;if(i&&(a=i.ticks(),c=a[a.length-1]),h.medianDataset!==null&&typeof h.medianDataset=="object"){if(h.medianType==="point"){var v=h.medianShape==="circle"?"circle":"rect",p=n.append("g").attr("class","points").selectAll(v).data(h.medianDataset).enter().append(v).attr("fill",function(n,t){return h.medianColorList.length===0?h.medianColor:h.medianColorList[t]}).attr("class","point").attr("stroke",h.medianStrokeColor).attr("stroke-width",h.medianStrokeWidth+"px").attr("data-title",function(n){if(n.name)return n.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.namecode?n.namecode:n.name}),w=Math.sqrt(Math.pow(h.medianSize/100,2)*Math.pow(h.medianSize/100,2)),b=h.medianSize/200;p.each(function(n,f){var a,v,p,k,nt;if(n.y!==null&&!isNaN(n.y)){a=d3.select(this);switch(h.medianShape){case"diamond":v=u*w;p=(u-v)/2;a.attr("width",v).attr("height",v).attr("transform",function(n){var o=t(+n.y),f;return c&&h.brokenAxis&&+n.y<c&&(o=i(+n.y)),f=n.xcode?r(n.xcode):n.xshort?r(n.xshort):r(n.x),f+=u/2,f+=e,"rotate(45,"+o+","+f+")"}).attr("y",function(n){var t=n.xcode?r(n.xcode):n.xshort?r(n.xshort):r(n.x);return t+e+p}).attr("x",function(n){var r=t(+n.y);return c&&h.brokenAxis&&+n.y<c&&(r=i(+n.y)),r-v/2});break;case"stripe":a.attr("width",h.medianStripeWidth).attr("height",u).attr("y",function(n){var t=n.xcode?r(n.xcode):n.xshort?r(n.xshort):r(n.x);return t+e}).attr("x",function(n){var r=t(+n.y);return c&&h.brokenAxis&&+n.y<c&&(r=i(+n.y)),r-h.medianStripeWidth/2+h.medianStrokeWidth});break;default:a.attr("r",u*b).attr("transform","translate(0,"+(e+u/2)+")").attr("cy",function(n){return n.xcode?r(n.xcode):n.xshort?r(n.xshort):r(n.x)}).attr("cx",function(n){var r=t(+n.y);return c&&h.brokenAxis&&+n.y<c&&(r=i(+n.y)),r})}if(a.attr("opacity",0).transition().duration(s).delay(function(){return s>0?f*50:0}).attr("opacity",1),n.t!==undefined&&(n.t==="e"&&h.showEstimation||n.t==="f"&&h.showForecast))if(k=n.t==="e"?h.estimationType:h.forecastType,k!=="Solid"){var d=d3.select(this),g=this.cloneNode(!0),y=d3.select(g),tt=n.t==="e"?h.estimationDrawStyle:h.forecastDrawStyle;y.attr("opacity",0).transition().duration(s).delay(function(){return s>0?f*50:0}).attr("opacity",1);y.datum(d.datum());y.style("fill","url("+h.baseLoc+h.container+tt+"_"+n.t+")");d.node().parentNode.appendChild(g);l.addMouseInteraction(y,h,o)}else nt=n.t==="e"?h.estimationColor:h.forecastColor,a.attr("fill",nt),l.addMouseInteraction(a,h,o);else l.addMouseInteraction(a,h,o)}})}}else h.medianDataset!==null&&typeof h.medianDataset=="number"&&(y=t(h.medianDataset),n.append("g").attr("transform","translate("+y+",0)").append("line").attr("x2",0).attr("y2",f).attr("stroke",h.medianColor).attr("stroke-width",h.lineWidth+"px"))}},{key:"getLegendData",value:function(n){var t=this.settings,e=[],i,r,u,f,o;if(n.length<=1){if(t.categorySet.length>0)for(i=0;i<t.categorySet.length;i++)o=t.categorySet[i],o.length>0&&(r=t.legendIconDefault,u=o,f=t.categoryColorList[i],e.push({type:r,color:f,text:u}))}else for(i=0;i<n.length;i++)r=t.legendIconDefault,u=n[i].key,f=t.colorList[i],e.push({type:r,color:f,text:u});return t.medianDataset!==null&&(typeof t.medianDataset=="number"||typeof t.medianDataset=="object"&&t.medianDataset.length>0)&&(r=t.medianType,u=t.medianName,f=t.medianColor,e.push({type:r,color:f,text:u})),e}},{key:"triggerMouseOverByCode",value:function(n){this.settings.animateHover&&(d3.selectAll(".chart").selectAll("g.bar").each(function(t){if(t.code===n){var i=d3.select(this);i.classed("hover",!0)}}),d3.selectAll(".chart").selectAll("g.points .point").each(function(t){if(t.code===n){var i=d3.select(this);i.classed("hover",!0)}}))}},{key:"triggerMouseOutByCode",value:function(){var t,n,i;if(this.settings.animateHover)for(t=document.querySelectorAll("g.bar.hover, .point.hover"),n=0;n<t.length;n++)i=d3.select(t[n]),i.classed("hover",!1)}},{key:"reSize",value:function(){this.draw()}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Empty=function(){function n(t,i){_classCallCheck(this,n);this.defaults={margin:{top:0,right:0,bottom:0,left:0},showLegend:!0,legendData:[],dataset:[],title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",width:0,height:0,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"box",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,useTooltip:!0,validContainer:!0,onLegendTooltipFunction:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings,t,i,r;n.validContainer&&((t=this.containerElement,i=chartutils.getChartDimensions(t),n.width=i.width,n.height=i.height,n.width<50||n.height<50)||(r=d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g"),(n.showEstimation&&n.estimationType!=="Solid"||n.showForecast&&n.forecastType!=="Solid")&&chartutils.addHatchDefs(this),chartutils.drawChartExtras(this,n)))}},{key:"addChart",value:function(n,t,i,r){var u,f,e;n<50||t<50||(u=this.settings,u.validContainer)&&(f=d3.select(u.container+" svg"),e=f.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),chartutils.drawSubtitle(this,n,t,e))}},{key:"showTooltip",value:function(n,t){var i=chartutils.toolTip(!0);i.show(n,t)}},{key:"hideTooltip",value:function(){var n=chartutils.toolTip(!0);n.hide()}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Gauge=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],tresholdDataset:[],tresholdDataLabels:[],tresholdColorlist:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],gaugeColor:"rgb(0,0,0)",dataColor:"rgb(255,255,255)",gaugeRatio:25,isAngular:!1,isCircular:!1,maximum:100,minimum:0,dataText:"",dataUnit:"",labelClass:"gauge-center",minAngle:-90,maxAngle:90,margin:{top:10,right:10,bottom:10,left:10},useTooltip:!0,animate:!1,animateHover:!0,duration:1250,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",showlegend:!1,legendData:[],legendIconDefault:"rect",width:0,height:0,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",maxLegendWidth:0,legendHeight:0,labelFontSize:10,labelFontColor:"rgb(0,0,0)",chartBackgroundColor:"transparent",valueFontSize:10,valueFontColor:"rgb(0,0,0)",validContainer:!0,shortNotation:!0,nrOfDec:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1);this.pie=d3.pie().sort(null);this.arc=null;this.arcOver=null}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var i=n.dataset,r=this.containerElement,t=chartutils.getChartDimensions(r);(n.width=t.width,n.height=t.height,n.width<50||n.height<50)||(d3.select(n.container).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height),chartutils.drawChartExtras(this,n),i.length>0&&this.addChart(n.width,n.height,0,0))}}},{key:"addChart",value:function(n,t,i,r){var e,u,h,c,o,nt,ft;if(!(n<1)&&!(t<1)&&(e=this,u=this.settings,u.validContainer)){var l=u.dataset,tt=d3.select(u.container+" svg"),a=tt.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")");chartutils.drawSubtitle(this,n,t,a);var it=tt.select(".subtitleGroup").select(".subtitle").select("text").node(),v=it?it.getBBox().height:0,v=v>0&&v<25?25:v,y=n-u.margin.left-u.margin.right,w=t-u.margin.top-u.margin.bottom-v,s=Math.min(y,w)/2,b=s*(100-u.gaugeRatio)/100,f=s;this.arc=d3.arc().innerRadius(b).outerRadius(f);this.arcOver=d3.arc().innerRadius(b).outerRadius(f*1.05);this.pie=d3.pie().sort(null).startAngle(u.minAngle*Math.PI/180).endAngle(u.maxAngle*Math.PI/180);!u.isAngular&&!u.isCircular&&u.minAngle>=-90&&u.maxAngle<=90&&(u.margin.top+=s/2);var k=this.arc,rt=this.arcOver,ut=chartutils.toolTip(u.useTooltip),d="translate("+(u.margin.left+y/2)+","+(u.margin.top+s)+")",et=a.append("rect").attr("transform",d),g=a.append("g").attr("class","slices").attr("transform",d),p=a.append("g").attr("class","label").attr("transform",d),ot=u.isAngular||u.minAngle>=-90&&u.maxAngle<=90||u.isCircular?f*2:f;if(et.attr("fill",u.chartBackgroundColor).attr("x",-f).attr("width",f*2).attr("y",-f).attr("height",ot),h=u.animate?u.duration:0,!(l.length<=0)){if(u.isAngular){if(u.tresholdDataset.length<=0)return;for(c=[],o=0;o<u.tresholdDataset.length;o++)o===0?c.push(u.tresholdDataset[o]-u.minimum):c.push(u.tresholdDataset[o]-u.tresholdDataset[o-1]);c.push(u.maximum-u.tresholdDataset[u.tresholdDataset.length-1]);e.addAngularArc(k,rt,c,g,u,h,ut);e.addAngularPointer(k,l,g,u,h,s);e.addTresholdValues(p,f*1.2,y,w)}else nt=[l[0]-u.minimum],ft=u.maximum-u.minimum-(l[0]-u.minimum),nt.push(ft),e.addSolidArc(k,rt,nt,g,u,h,ut),!u.isCircular&&u.minAngle>=-90&&u.maxAngle<=90?e.addMinMaxLabel(p,b,f):u.isCircular||e.addTresholdValues(p,f*1.2,y,w);e.addGaugeLabelCenter(p,n,t,h,s)}}}},{key:"addSolidArc",value:function(n,t,i,r,u,f,e){var s=this,o;r.selectAll("path.background").data(this.pie([1])).enter().append("path").attr("class","background").attr("fill",function(){return u.gaugeColor}).transition().ease(d3.easeLinear).duration(0).attrTween("d",function(t){var i=d3.interpolate({startAngle:u.minAngle*Math.PI/180,endAngle:u.maxAngle*Math.PI/180},t);return function(t){return n(i(t))}});o=r.selectAll("path.foreground").data(this.pie(i)).enter().append("path").attr("class","foreground").attr("fill",function(n,t){return t===0?u.dataColor:u.gaugeColor});r.select("path:last-child").remove();o.transition().ease(d3.easeLinear).duration(f).attrTween("d",function(t){var i=d3.interpolate({startAngle:u.minAngle*Math.PI/180,endAngle:u.minAngle*Math.PI/180},t);return function(t){return n(i(t))}});setTimeout(function(){s.addMouseInteraction(o,u,e,n,t)},f)}},{key:"addAngularArc",value:function(n,t,i,r,u){var f=r.selectAll("path.background").data(this.pie(i)).enter().append("path").attr("class","background").attr("fill",function(n,t){return u.tresholdColorlist[t]});f.transition().ease(d3.easeLinear).duration(0).attrTween("d",function(t){var i=d3.interpolate({startAngle:u.minAngle*Math.PI/180,endAngle:u.minAngle*Math.PI/180},t);return function(t){return n(i(t))}})}},{key:"addAngularPointer",value:function(n,t,i,r,u,f){var e=t[0];isNaN(e)||e<r.minimum?e=r.minimum:e>r.maximum&&(e=r.maximum);var s=[[0,f*.55],[-5,f*.7],[-5,f*1.1],[5,f*1.1],[5,f*.7],[0,f*.55]],h=d3.line().curve(d3.curveLinear),c=i.append("g").data([s]).attr("class","pointer"),o=180+r.minAngle,l=c.append("path").attr("d",h).attr("transform","rotate("+o+")").attr("fill",r.labelFontColor),a=r.maxAngle-r.minAngle,v=r.maximum-r.minimum,y=(e-r.minimum)/v*a;l.transition().duration(u).ease(d3.easeLinear).attrTween("transform",function(){var n=d3.interpolate(o,y+o);return function(t){return"rotate("+n(t)+")"}})}},{key:"addMouseInteraction",value:function(n,t,i,r,u){n.on("mouseover",function(n,r){if(t.isAngular||r===0){var f=d3.select(this);f.classed("hover",!0);t.animateHover&&f.transition().duration(200).attr("d",u);t.onTooltipFunction(i,n,t,this,r)}}).on("mousemove",function(n,r){if(t.isAngular||r===0)t.onTooltipFunction(i,n,t,this,r)}).on("mouseout",function(){var n=d3.select(this),u=d3.select(n.node().parentNode);n.classed("hover",!1);t.animateHover&&n.transition().duration(200).attr("d",r);i.hide()}).on("click touchstart",function(n,i){return typeof t.onClickFunction[i]=="function"?t.onClickFunction[i]():typeof t.onClickFunction=="function"?t.onClickFunction():void 0}).on("contextmenu",t.onCMFunction)}},{key:"addGaugeLabelCenter",value:function(n,t,i,r,u){var l=this,f=this.settings,e=n.append("svg:text").attr("text-anchor","middle").attr("fill",f.valueFontColor).attr("font-size",f.valueFontSize+"px").attr("font-weight","bold").attr("class",f.labelClass).text(f.dataText).style("display","block"),c=u*(100-f.gaugeRatio)/100,s=c*2,h=e.node().getBBox().width,o;h/s&&(o=s/h,o>=.5&&o<1&&e.attr("font-size",f.valueFontSize*o+"px"));e.transition().ease(d3.easeLinear).duration(r).tween("text",function(){var t=d3.interpolate(0,f.dataset[0]),n=this;if(f.dataset[0]<=1||isNaN(f.dataset[0])){n.textContent=f.dataText;chartutils.wrapCenterText(e,f);return}return function(i){i===1?(n.textContent=f.dataText,chartutils.wrapCenterText(e,f)):n.textContent=Math.round(t(i)*1)/1}});e.style("display","block").attr("transform",function(){var r=d3.select(n.node().parentNode).select("g.slices"),t=r.node().getBBox(),i=t.height+t.y;return(f.isAngular||f.isCircular||f.minAngle<-90&&f.maxAngle>90)&&(i=f.valueFontSize/3),"translate(0,"+i+")"})}},{key:"addMinMaxLabel",value:function(n,t,i){for(var f,e,r=this.settings,u=0;u<2;u++)f=u===0?r.maximum:r.minimum,e=u===0?"translate("+(t+(i-t)/2)+",15)":"translate("+-(t+(i-t)/2)+",15)",n.append("text").attr("transform",e).attr("text-anchor","middle").attr("font-size",r.labelFontSize+"px").attr("fill",r.labelFontColor).text(r.shortNotation?chartutils.abbreviateNumber(f,r):chartutils.numberFormat(f,chartutils.nbrOfDecimals(f),r.lang,r.customLang))}},{key:"addTresholdValues",value:function(n,t){var i=this.settings,r=[i.minimum].concat(i.tresholdDataset).concat([i.maximum]);n.selectAll("text.treshold").data(r).enter().append("text").attr("class","treshold").attr("dy",i.labelFontSize/2).attr("transform",function(n){var u=i.maxAngle-i.minAngle,f=i.maximum-i.minimum,e=(n-i.minimum)/f*u,o=i.minAngle-90,r=o+e;return"rotate("+r+") translate("+t+") rotate("+r*-1+")"}).attr("text-anchor","middle").attr("font-size",i.labelFontSize+"px").attr("fill",i.labelFontColor).text(function(n){return i.shortNotation?chartutils.abbreviateNumber(n,i):chartutils.numberFormat(n,chartutils.nbrOfDecimals(n),i.lang,i.customLang)})}},{key:"getLegendData",value:function(){var n=this.settings,r=[],t,u,f,e,i;if(n.tresholdDataLabels.length>0)for(t=0;t<n.tresholdDataLabels.length;t++)i=n.tresholdDataLabels[t],i.length>0&&(u=n.legendIconDefault,f=i,e=n.tresholdColorlist[t],r.push({type:u,color:e,text:f}));return r}},{key:"reSize",value:function(){this.draw()}},{key:"defaultTooltip",value:function(){return}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Line=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,type:"line",dataset:[],datasetY1:[],categorySet:[],medianDataset:[],medianColor:"#333",margin:{top:0,right:0,bottom:0,left:0},rotation:45,rotationy:0,autoRotation:!1,autoXSplitText:!1,lineWidth:2,line2Width:2,useTooltip:!0,dataPrefix:"",dataPrefixY1:"",dataPostfix:"",dataPostfixY1:"",dataUnit:"",dataUnitY1:"",colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],categoryColorList:[],title:"",titleSubtitle:"",subtitle:"",nodata:"",source:"",animate:!1,animateHover:!0,duration:1250,skipLabel:0,lineStyle:"cardinal",showAxes:!0,showAxisXLabels:!0,axisColor:"rgb(0,0,0)",showGridLines:!0,gridLineColor:"rgb(0,0,0)",brokenAxis:!1,showLegend:!0,legendData:[],showValues:!1,fontsize:10,useMarker:!1,markerColor:"default",markerBorderColor:"black",markerStyle:"circle",markerSize:8,customYMax:null,customYMin:null,customYStep:null,customY2Max:null,customY2Min:null,customY2Step:null,customizedYMax:null,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:chartutils.defaultTooltip,onLegendTooltipFunction:null,width:0,height:0,minYDefZero:!0,lineStyles:"",titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"line",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,axisXFontSize:10,axisXFontColor:"rgb(0,0,0)",axisYFontSize:10,axisYFontColor:"rgb(0,0,0)",labelFontSize:10,labelFontColor:"rgb(0,0,0)",useLinearScale:!1,chartBackgroundColor:"transparent",validContainer:!0,axisXLength:null,clipPathCount:0,inlineAxis:!1,axisTickSpace:10,nrOfDec:null,averageLabel:"",averageLabelAlignment:"left"};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);(n.width=i.width,n.height=i.height,n.width<20||n.height<20)||(n.animate=n.useAnimation||n.animate,d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g"),chartutils.drawChartExtras(this,n),r.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var u,s,vt,gi,nr,rr,ur,si,dt,gt,o,f,l,hi,it,ni,ti,ci,fr,li,ai,y,a,vi,ct,ri,ut,ft,or,et,lt,c,yi,pi,rt,nt,ii,wi,sr,lr,fi,ei,ar;if(!(n<20)&&!(t<20)&&(u=this.settings,u.validContainer)){var p,w,ot,di,st,h,g=u.dataset,wt=u.datasetY1,bt=d3.select(u.container+" svg"),ht=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(g),vr=g.map(function(n){return+n.y}),e=u.customYMin===null?d3.min(g,function(n){return+n.y}):u.customYMin;if(u.minYDefZero&&e>0&&(e=0),s=u.customYMax===null?d3.max(vr):u.customYMax,e===s&&(s=e+1),e!==undefined&&s!==undefined){u.inlineAxis&&u.averageLabel.length>0&&u.medianDataset!==null&&typeof u.medianDataset=="number"&&(e>u.medianDataset?e=u.medianDataset:s<u.medianDataset&&(s=u.medianDataset));vt=!1;wt.length>0&&(gi=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(wt),vt=!0,nr=wt.map(function(n){return+n.y}));var yt=bt.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),b=yt.append("g").attr("class","axes"),tt=yt.append("g").attr("class","elements"),yr=b.append("rect").attr("width",0).attr("height",0),tr=u.margin.top;chartutils.drawSubtitle(this,n,t,yt);var ir=u.margin.top,k=chartutils.getNiceRange(e,s,u.nrOfDec),kt=u.customYMin===null||u.customYMax===null,oi=u.customYStep;if(kt||u.customYStep===null||u.customYStep===0?(oi=k.step,h=chartutils.nbrOfDecimals(oi),h=h>3?3:h):h=chartutils.nbrOfDecimals(u.customYStep),rr=u.customizedYMax?u.customizedYMax:s,ur=u.dataPrefix+chartutils.numberFormat(rr,h,u.lang,u.customLang)+u.dataPostfix,p=bt.append("text").attr("font-size",u.axisYFontSize+"px").text(ur),si=p.node().getBBox(),w=si.width,ot=si.height,p.remove(),p=bt.append("text").style("font-size",u.axisXFontSize+"px").text("1234567,890"),di=p.node().getBBox().height,p.remove(),dt=u.margin.left,dt+=u.inlineAxis?0:ot+w,gt=r===0?u.margin.top:ir-tr,gt+=u.inlineAxis?ot:0,b.attr("transform","translate("+dt+","+gt+")"),tt.attr("transform","translate("+dt+","+gt+")"),o=n-u.margin.left-u.margin.right,f=t-u.margin.bottom,f-=r===0?u.margin.top:ir-tr,u.inlineAxis?f-=ot:o=o-w-ot,!(o<1)&&!(f<1)){if(it=w*1.5,it<25&&(it=25),ni=20,u.inlineAxis&&u.averageLabel.length>0&&u.medianDataset!==null&&typeof u.medianDataset=="number"&&(p=bt.append("text").attr("class","label").style("font-size",u.labelFontSize+"px").text(u.averageLabel),ni+=p.node().getBBox().width,p.remove()),u.useLinearScale){var er=g.map(function(n){return+n.x}),pr=d3.max(er),wr=d3.min(er),ci=u.inlineAxis?[it,o-ni]:[0,o];l=d3.scaleLinear().range(ci);l.domain([wr,pr]);hi=chartutils.getXAxisLinear(l,this,o,[])}else ti=o-ni,vt&&(ti=o-it),ci=u.inlineAxis?[it,ti]:[0,o],fr=u.inlineAxis?ti-it:o,l=d3.scalePoint().range(ci),l.domain(g.map(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x})),hi=chartutils.getXAxis(ht,l,this,fr);if(li=!1,ai=null,g.length>0&&g[0].xcode&&(li=!0,ai=d3.nest().key(function(n){return n.xcode}).entries(g)),f=chartutils.drawXAxis(hi,this,b,o,f,di,!1,li,ai),u.inlineAxis&&b.select(".x.axis").selectAll("g.tick").each(function(){var r=chartutils._getTranslateMatrix(d3.select(this)),t=this.getBBox(),i=r.e,n=t.width,u,f;i&&n&&i+n+t.x>o&&(u=i+n-o,u<n&&(f=o-n-t.x,d3.select(this).attr("transform","translate("+f+","+r.f+")")))}),y=u.brokenAxis&&e>0&&(!kt||kt&&k.minValue>0)?f/5:0,kt&&k.minValue>0&&k.minValue-k.step<=0&&(e=0,k=chartutils.getNiceRange(e,s,u.nrOfDec),y=0),y>30&&(y=30),a=d3.scaleLinear().range([f-y,0]),vi=!1,u.customYMin!==null&&u.customYMax!==null?a.domain([e,s]):(e=k.minValue,s=k.maxValue,a.domain([e,s]),u.customYStep=k.step,vi=!0),e!==undefined&&s!==undefined){if(rt=[],u.customYStep!==null&&u.customYStep!==0)for(st=Math.round((s-e)/u.customYStep),h=chartutils.nbrOfDecimals(u.customYStep),h=h>3?3:h,nt=0;nt<=st;nt++)ii=Math.round((e+nt*u.customYStep)*1e3)/1e3,rt.push(ii.toFixed(h));if(ct=chartutils.getYAxis(o,f,a,rt,this,vi),u.customYStep!==null&&u.customYStep!==0&&ct.ticks(st),ri=a.domain(),ut=ct.tickValues(),u.brokenAxis&&e>0&&ut.length>=2){var h=chartutils.nbrOfDecimals(ri[1]),h=h>3?3:h,oi=+ut[ut.length-1]-+ut[ut.length-2];ri[0]-oi<=0&&(e=0,a.domain([0,ri[1]]),ct.tickValues([0].concat(ut)),a.range([f,0]))}if(chartutils.drawYAxis(ct,this,b,f,w),u.brokenAxis&&e>0&&(ft=d3.scaleLinear().range([f,f-y]),ft.domain([0,e]),or=chartutils.getYAxis(o,f,ft,[0..toFixed(h)],this),chartutils.drawYAxis(or,this,b,f,w,!0)),e<0&&s>0&&chartutils.drawZeroLine(a,ct,b),c=e,vt){if(c=u.customY2Min===null?d3.min(wt,function(n){return n.y}):u.customY2Min,u.minYDefZero&&c>0&&(c=0),y=u.brokenAxis&&c>0?f/4:0,y>30&&(y=30),s=u.customY2Max===null?d3.max(nr):u.customY2Max,et=d3.scaleLinear().range([f-y,0]),c===s&&(s=c+1),yi=a.ticks().length,pi=chartutils.getNiceTickRangeY1(c,s,yi),u.customY2Min!==null&&u.customY2Max!==null?et.domain([c,s]):et.domain([c,pi[yi-1]]),rt=[],u.customY2Step!==null&&u.customY2Step!==0)for(st=Math.round((s-c)/u.customY2Step),h=chartutils.nbrOfDecimals(u.customY2Step),h=h>3?3:h,nt=0;nt<=st;nt++)ii=Math.round((c+nt*u.customY2Step)*1e3)/1e3,rt.push(ii.toFixed(h));else rt=pi;wi=chartutils.getY1Axis(o,f,et,rt,this);u.customY2Step!==null&&u.customY2Step!==0&&wi.ticks(st);chartutils.drawY1Axis(wi,this,b,o,f,w,!1);u.brokenAxis&&c>0&&(lt=d3.scaleLinear().range([f,f-y]),lt.domain([0,c]),sr=chartutils.getY1Axis(o,f,lt,[0],this),chartutils.drawY1Axis(sr,this,b,o,f,w,!0))}var hr=chartutils.toolTip(u.useTooltip),bi=u.lineStyle==="linear"?bi=d3.curveLinear:d3.curveMonotoneX,br=d3.line().defined(function(n){return!isNaN(+n.y)}).x(function(n){return n.xcode?l(n.xcode):n.xshort?l(n.xshort):l(n.x)}).y(function(n){return u.brokenAxis&&+n.y<e&&ft!==undefined?ft(+n.y):a(+n.y)}).curve(bi),kr=d3.line().defined(function(n){return!isNaN(+n.y)}).x(function(n){return n.xcode?l(n.xcode):n.xshort?l(n.xshort):l(n.x)}).y(function(n){return u.brokenAxis&&+n.y<c?lt(+n.y):et(+n.y)}).curve(bi),pt=u.animate?u.duration:0,ki=u.container.replace("#","")+"_"+u.clipPathCount;u.clipPathCount++;u.inlineAxis&&(t+=ot);u.animate?yt.append("clipPath").attr("id","chart-clip_"+ki).append("rect").attr("x",-u.markerSize/2).attr("y",-4).attr("height",f+8).attr("width",0).transition().duration(pt).ease(d3.easeLinear).attr("width",o+u.markerSize):yt.append("clipPath").attr("id","chart-clip_"+ki).append("rect").attr("x",-u.markerSize/2).attr("y",-4).attr("height",f+8).attr("width",o+u.markerSize);tt.attr("clip-path","url(#chart-clip_"+ki+")");yr.attr("fill",u.chartBackgroundColor).attr("x",1).attr("width",o-1).attr("y",0).attr("height",f);var v=0,d=this,cr=tt.append("g").attr("class","lines"),at=u.lineStyles.split(";"),ui=[];if(ht.length>0)for(lr=ht[0].values.length,fi=0;fi<lr;fi++)ei=ht[0].values[fi],ei&&ei.x&&ei.x.indexOf("_skiplabel_")<0&&ui.push([]);ht.forEach(function(n,t){var r=[],o=0,h=!1,b=!1,s=[],k=n.values.length,i,c,y,f,p,w;if(t!==0||n.key!=="undefined"||!(ht.length>1)){for(i=0;i<k;i++)n.values[i].y===null||isNaN(n.values[i].y)?(s=n.values.slice(o,i),r.push(s),o=i+1):n.values[i].special&&!h?(h=!0,s=n.values.slice(o,i),r.push(s),o=i>0?i-1:i):!n.values[i].special&&h&&(h=!1,c=i+1,k<c&&(c=i),s=n.values.slice(o,c),r.push(s),o=i),isNaN(n.values[i].y)||n.values[i].y===null||(b=!0,y=n.values[i],y.colorIndex=v,y.yScale=u.brokenAxis&&n.values[i].y<e?ft:a,ui[i].push(y));for(r.push(n.values.slice(o,i)),f=0;f<r.length;f++){var tt=br(r[f]),g=cr.append("g").attr("class","line").attr("data-code",n.key),nt=g.append("path").attr("class","line line_"+t);nt.attr("d",tt).attr("stroke",function(){return u.colorList[v]}).attr("fill","none");chartutils.drawPoints(!1,r[f],l,a,ft,v,hr,d,g,pt);p="solid";r[f].length>1&&r[f][1].special?p="dot":at.length>0&&at.length>v&&(w=at[v],w.length>0&&(p=w));d.addLineStyleToPath(u,nt,p,r[f],u.lineWidth)}(b||n.key!=="undefined")&&v++}});vt&&gi.forEach(function(n,t){for(var h,a,f,y,p,r=[],e=0,s=!1,w=!1,o=[],b=n.values.length,i=0;i<b;i++)n.values[i].y===null||isNaN(n.values[i].y)?(o=n.values.slice(e,i),r.push(o),e=i+1):n.values[i].special&&!s?(s=!0,o=n.values.slice(e,i),r.push(o),e=i>0?i-1:i):!n.values[i].special&&s&&(s=!1,h=i+1,b<h&&(h=i),o=n.values.slice(e,h),r.push(o),e=i),isNaN(n.values[i].y)||n.values[i].y===null||(w=!0,a=n.values[i],a.colorIndex=v,a.yScale=u.brokenAxis&&n.values[i].y<c?lt:et,ui[i].push(a));for(r.push(n.values.slice(e,i)),f=0;f<r.length;f++){var nt=kr(r[f]),k=cr.append("g").attr("class","line").attr("data-code",n.key),g=k.append("path").attr("class","line lineY1_"+t);g.attr("d",nt).attr("stroke",function(){return u.colorList[v]}).attr("fill","none");chartutils.drawPoints(!0,r[f],l,et,lt,v,hr,d,k,pt);y="solid";r[f].length>1&&r[f][1].special?y="dot":at.length>0&&at.length>v&&(p=at[v],p.length>0&&(y=p));d.addLineStyleToPath(u,g,y,r[f],u.line2Width)}(w||n.key!=="undefined")&&v++});u.medianDataset!==null&&typeof u.medianDataset=="number"&&d.drawAverageLine(tt,a,u.medianColor,o,u.medianDataset,u.lineWidth,pt,tt,u.averageLabel,u.averageLabelAlignment,w);u.showValues&&(ar=d.sortLabelArray(ui),d.drawLabelsSorted(ar,l,d,tt,f),setTimeout(function(){d.showLabels(tt)},pt))}}}}}},{key:"drawAverageLine",value:function(n,t,i,r,u,f,e,o,s,h,c){var l=this.settings,a=t(u),v;if(!isNaN(a)&&!(a<0)&&(v=0,l.inlineAxis&&(v=c+12),n.append("g").attr("class","avgline").attr("transform","translate("+v+","+a+")").append("line").transition().attr("x2",0).attr("y2",0).attr("stroke",i).attr("stroke-width",f+"px").transition().duration(e).attr("x2",r),o&&s)){h||(h="left");var y=o.append("g").attr("class","avglabel label bar"),w=y.append("rect").style("opacity","0"),p=h==="left"?"start":"end";y.append("text").attr("class","label"+p).attr("font-size",l.labelFontSize+"px").attr("fill",l.showLabelContrast?chartutils.getContrastLabelColor(l,l.labelFontColor,l.chartBackgroundColor):l.labelFontColor).attr("text-anchor",p).attr("dy",.85*l.labelFontSize+"px").attr("x",function(){return h==="left"?4:r-4}).attr("y",a-l.labelFontSize).transition().delay(e).on("end",function(){var t=d3.select(this);t.text(s);chartutils.wrapCenterText(t,l);var n=t.node().getBBox(),i=n.width,r=n.height;w.attr("class","labelBG").attr("height",r).attr("width",i+8).attr("x",n.x-4).attr("y",n.y)})}}},{key:"sortLabelArray",value:function(n){for(var r,u,i=[],t=0;t<n.length;t++)r=n[t],u=r.sort(function(n,t){return n.y-t.y}),i.push(u);return i}},{key:"addLineStyleToPath",value:function(n,t,i,r,u){if(d3.select(t.node()).attr("d")!==null){var e=t.node().getTotalLength(),f=e+" "+e;switch(i){case"dash":f="7, 3";break;case"dashdot":f="7, 3, 3, 3";break;case"dashdotdot":f="7, 3, 3, 3, 3, 3";break;case"dot":f="3, 3"}t.attr("stroke-width",u);i!=="solid"&&t.attr("stroke-dasharray",f).attr("stroke-dashoffset",e)}}},{key:"getLegendData",value:function(n){var i=this.settings,e=[],t,r,u,f,o;if(n.length<=0||i.categorySet.length>0){if(i.categorySet.length>0)for(t=0;t<i.categorySet.length;t++)o=i.categorySet[t],o.length>0&&(r=i.legendIconDefault,u=o,f=i.categoryColorList[t],e.push({type:r,color:f,text:u}))}else for(t=0;t<n.length;t++)r=i.legendIconDefault,u=n[t].key,f=i.colorList[t],e.push({type:r,color:f,text:u});return e}},{key:"drawLabelsSorted",value:function(n,t,i,r,u){for(var y=i.settings,l=n.length,e=0,p=r.append("g").attr("class","labels"),s=[],c,a,h,v,f,o,e=0;e<l;e++)for(c=n[e],a=c.length,h=0;h<a;h++)v=c[h],this.drawLabel(v,p,t,e,l,y,s,u);for(e=0;e<s.length;e++)for(f=s[e],o=0;o<e;o++)if(e!==o&&(chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o])||f.label.y<0)){if(f.label.y+=20+f.label.height,!chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o])&&(o-1===e||!chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o-1]))&&(o-2===e||!chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o-2]))&&(o-3===e||!chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o-3]))&&(o-4===e||!chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o-4]))&&(o-5===e||!chartutils.isBBoxOverlappingBBoxOrPoint(f.label,s[o-5]))&&f.label.height+f.label.y<u){f.labelElement.attr("transform","translate(0,"+(15+f.label.height)+")");continue}f.labelElement.remove();f.label={x:-100,y:-100,width:0,height:0}}}},{key:"drawLabel",value:function(n,t,i,r,u,f,e){var h,o;if(!isNaN(n.y)){var c=t.append("g").attr("class","label line").attr("style","visibility:hidden"),s,l,a=s=n.xcode?i(n.xcode):n.xshort?i(n.xshort):i(n.x),v=r===u-1||i.range()[1]===a;c.append("text").attr("text-anchor",function(){return r===0?"start":v?"end":"middle"}).attr("x",function(){return a=s=n.xcode?i(n.xcode):n.xshort?i(n.xshort):i(n.x),r===0&&(s+=4),r===u-1&&(s-=1),s}).attr("y",function(){return l=n.yScale(n.y)-10}).attr("fill",f.labelFontColor).attr("font-size",f.labelFontSize).text(function(){return n.ystring!==undefined?n.ystring:Number(n.y).toLocaleString()});h=c.node().getBBox();o={x:Math.max(4,h.x)-4,y:h.y,height:h.height,width:h.width+6};e.push({labelElement:c,label:o,point:{x:a,y:l+10}});c.insert("rect","text").attr("class","labelBG").attr("height",o.height).attr("width",o.width).attr("x",o.x+1).attr("y",o.y).attr("stroke",f.colorList[n.colorIndex])}}},{key:"showLabels",value:function(n){n.selectAll("g.label").attr("style",null)}},{key:"triggerMouseOverByCode",value:function(n){if(this.settings.animateHover){var t=d3.selectAll(".chart").selectAll("g.line"),i=!1;t.each(function(){var t=d3.select(this),r=t.attr("data-code");r===n?(t.classed("hover",!0),t.classed("empty",!1),i=!0):t.classed("empty",!0)});i||t.classed("empty",!1)}}},{key:"triggerMouseOutByCode",value:function(){if(this.settings.animateHover)var n=d3.selectAll(".chart").selectAll("g.line").classed("empty",!1).classed("hover",!1)}},{key:"reSize",value:function(){this.draw()}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Map=function(){function n(t,i){if(_classCallCheck(this,n),this.defaults={dataset:[],colorList:["black"],margin:{top:0,right:10,bottom:10,left:10},jsonLocation:"",geoJsonString:null,useTooltip:!0,dataUnit:"",strokeColor:"white",emptyStrokeColor:"#d3d3d3",strokeWidth:.5,createDropdown:!1,onClickFunction:this.zoomed,onSearchClickFunction:this.zoomed,showLegend:!0,title:"",subtitle:"",disableZoom:!1,zoomOnClick:!0,width:0,height:0,labelItems:[],useLabelItems:!1,labelMin:0,emptyValue:"-",varDropdownText:"",periodDropdownText:"",dropDownFirst:!1,periodDropDownLast:!1,searchPlaceHolder:"Zoek...",mapHoverClass:"maphover",dialogSelect:!1,path:null,zoomFactor:1,useShadowFilter:!1,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",titleMargin:0,sourceMargin:0,legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendItemsMargin:0},this.settings=chartutils.deepExtend(this.defaults,i),this.settings.container=t,this.containerElement=document.querySelector(t),this.containerElement===null)throw"chart element with id "+t+" does not exist";}return _createClass(n,[{key:"draw",value:function(){function ft(f,e){var l,h,c,o,a,y,ft,nt,ct;if(f)throw f;if(n.path=null,l=null,e.projection&&e.projection==="carthesian"){r.selectAll("path").remove();var d=13562.62,et=306838.8,ot=278026.1,g=614064.9;e.bbox&&(d=e.bbox[1],et=e.bbox[0],ot=e.bbox[3],g=e.bbox[2]);a=g-et;y=ot-d;o=Math.min(t,i)/Math.max(a,y);var it=g*o,rt=-d*o,st=y*o,ht=a*o,p=i-st,k=t-ht,ut=Math.min(p,k);ut>0&&(p===ut?(h=st+p,o=h/y,c=a*o,c>t&&(c=t,o=c/a,h=y*o),k=t-c,p=i-h):k===ut&&(c=ht+k,o=c/a,h=y*o,h>i&&(h=i,o=h/y,c=a*o),k=t-c,p=i-h),it=g*o,rt=-d*o);rt+=p/2;it+=k/2;l=v.affineTransformation(o,0,0,-o,rt,it,this.stream);n.path=d3.geoPath().projection(l)}else{ft=d3.geoCentroid(e);o=6850;nt=[i/2,t/2];l=d3.geoMercator().scale(o).center(ft).translate(nt);n.path=d3.geoPath().projection(l);var s=n.path.bounds(e),lt=s[1][0]-s[0][0],at=s[1][1]-s[0][1],vt=(s[0][0]+s[1][0])/2,yt=(s[0][1]+s[1][1])/2;o=o/Math.max(lt/i,at/t);nt=[i-(s[0][0]+s[1][0])/2,t-(s[0][1]+s[1][1])/2];l=d3.geoMercator().center(ft).scale(o*.92).translate(nt);n.path=n.path.projection(l)}ct=u.selectAll("g").select("path").data(e.features).enter().append("path").attr("d",n.path).attr("class","area");v.update(tt,b,0);ct.on("mouseover",function(t){var u,i,r;if(n.dialogSelect){setTimeout(function(){n.dialogSelect=!1},500);return}return u=t.properties.name,t.properties.naam&&(u=t.properties.naam),d3.select(n.container+" path."+n.mapHoverClass).classed(n.mapHoverClass,!1),d3.select(this).classed(n.mapHoverClass,!0),i=t.properties.VALUE,i===undefined&&(i=""),i=n.useLabelItems?n.labelItems[i]:i.toLocaleString(),r="",i.length>0&&(r=": ",r=isNaN(i)?i:i+n.dataUnit),w.show("<span>"+u+r+"<\/span>")}).on("click",function(t,i){v.settings.onClickFunction(this,i,n)}).on("mousemove",function(t){var r,i,u;if(n.dialogSelect){setTimeout(function(){n.dialogSelect=!1},500);return}return r=t.properties.name,t.properties.naam&&(r=t.properties.naam),i=t.properties.VALUE,i===undefined&&(i=""),i=n.useLabelItems?n.labelItems[i]:i.toLocaleString(),u="",i.length>0&&(u=": "+(isNaN(i)?i:i+n.dataUnit)),w.show("<span>"+r+u+"<\/span>")}).on("mouseout",function(){return d3.select(this).classed(n.mapHoverClass,!1),w.hide()}).on("mousedown",function(){d3.event.stopImmediatePropagation()})}var v=this,n=this.settings,h=this.containerElement,k=n.dataset,f,e,i,t,r,u,y,a,d,g,p,nt,o,b;n.height=h.offsetHeight;n.width=h.offsetWidth;(n.width<=0||n.height<=0)&&(n.width=chartutils.getDocumentWidth(),n.height=chartutils.getDocumentHeight());f=d3.nest().key(function(n){return n.variable}).entries(k);e=d3.nest().key(function(n){return n.period}).entries(k);n.showLegend&&(n.margin.bottom+=40);i=n.width-n.margin.left-n.margin.right;t=n.height-n.margin.top-n.margin.bottom;n.createDropdown&&(t-=40);r=d3.select(h).append("svg");r.attr("width",i);r.attr("height",t);r.attr("overflow","hidden");u=r.append("g").attr("class","map");chartutils.drawText(this,n.title,null,"title");chartutils.drawSubtitle(this,n.width,n.height,r);y=n.titleHeight?n.titleHeight:0;u.attr("transform","translate(0,"+y+")");n.useShadowFilter&&(t=t-10,a=r.append("filter"),a.attr("id","dropShadow"),d=a.append("feGaussianBlur"),d.attr("in","SourceAlpha").attr("stdDeviation",3/n.zoomFactor),g=a.append("feOffset"),g.attr("dx",2/n.zoomFactor).attr("dy",4/n.zoomFactor),p=a.append("feMerge"),p.append("feMergeNode"),nt=p.append("feMergeNode"),nt.attr("in","SourceGraphic"),u.style("filter","url('#dropShadow')"));n.disableZoom||r.call(d3.zoom().scaleExtent([1,8]).translateExtent([[0,0],[i,t]]).on("zoom",function(){d3.event.transform.y+=y;u.attr("transform",d3.event.transform);n.zoomFactor=d3.event.transform.k;u.selectAll("path.area").style("stroke-width",n.strokeWidth/d3.event.transform.k);u.selectAll("circle.middleFill").attr("r",5/n.zoomFactor).attr("stroke-width",4/n.zoomFactor+"px");u.selectAll("circle.innerBorder").attr("r",3/n.zoomFactor).attr("stroke-width",1/n.zoomFactor+"px");u.selectAll("circle.outerBorder").attr("r",7/n.zoomFactor).attr("stroke-width",1/n.zoomFactor+"px")}));var w=chartutils.toolTip(n.useTooltip),tt=d3.map(),c=0,l=0,et=e.length,it=!1,rt=!1;for(o=0;o<f[0].values.length;o++)if(o%et==0){var ot=f[0].values[o].name,ut=f[0].values[o].val,s=parseFloat(ut);if(isNaN(s)){rt=!0;continue}o!==0&&it?(c>s&&(c=s),l<s&&(l=s)):(c=s,l=s,it=!0);tt.set(ot,+ut)}n.useLabelItems&&(c=n.labelMin,l=n.labelMax);n.useLabelItems||(b=d3.scaleQuantize().domain([c,l]).range(d3.range(n.colorList.length).map(function(n){return n})));n.geoJsonString!==null?ft(!1,JSON.parse(n.geoJsonString)):d3.queue().defer(d3.json,n.jsonLocation).await(ft);n.showLegend&&this.createMapLegend(b,c,l,rt);h.insertAdjacentHTML("afterbegin",'<div class="mapHandlers"><\/div>');n.createDropdown&&(n.periodDropDownLast&&e.length>1&&this.createMapSelectPeriodDropdown(e),n.dropDownFirst&&this.createMapDropdown(f[0],e.length),n.periodDropDownLast||e.length>1&&this.createMapSelectPeriodDropdown(e),f.length>1&&this.createMapSelectVariableDropdown(f),n.dropDownFirst||this.createMapDropdown(f[0],e.length));(!n.disableZoom||n.disableZoom&&n.zoomOnClick)&&this.createResetZoom();$(h).off().on("click",function(){$(h).find(".searchresults, .mapselectlist.variable, .mapselectlist.period").addClass("hidden")})}},{key:"zoomed",value:function(n,t){var i,u,f,o,e,s,h;this.parentNode===undefined?(i=n.parentNode.parentNode.parentNode,u=n.parentNode,f=n.parentNode.parentNode):(i=this.parentNode.parentNode.parentNode,u=this.parentNode,f=this.parentNode.parentNode);o=d3.select(u).selectAll("path");d3.select(this.container+" path."+this.mapHoverClass).classed(this.mapHoverClass,!1);e=!1;o.each(function(n,i){e||i===t&&(s=d3.select(this),h=this,e=!0)});var r=s.node().getBBox(),c=r.x+r.width/2,l=r.y+r.height/2,a=d3.select(f).select("g.map");this.zoomOnClick&&(d3.zoomIdentity.translate(-c,-l).scale(4),a.transition().duration(750).attr("transform","translate("+i.offsetWidth/2+","+i.offsetHeight/2+")scale(4)translate("+-c+","+-l+")"));d3.select(h).classed(this.mapHoverClass,!0)}},{key:"removeMarkers",value:function(){var n=this.settings,t=d3.select(n.container).select("g.map");t.selectAll("g.mapmarker").remove()}},{key:"drawMarker",value:function(n,t){var r=this.settings,f=d3.select(r.container).select("g.map"),o={type:"Feature",geometry:{type:"Point",coordinates:[n,t]}},e,i,u;f.selectAll("g").select("path").data([o]).enter().append("path").attr("d",r.path).attr("class","marker");e=f.select(".marker");i=e.node().getBBox();e.remove();u=f.append("g").attr("class","mapmarker");u.append("circle").attr("class","middleFill").attr("cx",i.x+i.width/2).attr("cy",i.y+i.height/2).attr("r",5/r.zoomFactor).attr("fill","none").attr("stroke-width",4/r.zoomFactor+"px").attr("stroke","black").style("pointer-events","none");u.append("circle").attr("class","outerBorder").attr("cx",i.x+i.width/2).attr("cy",i.y+i.height/2).attr("r",7/r.zoomFactor).attr("fill","none").attr("stroke-width",1/r.zoomFactor+"px").attr("stroke","white").style("pointer-events","none");u.append("circle").attr("class","innerBorder").attr("cx",i.x+i.width/2).attr("cy",i.y+i.height/2).attr("r",3/r.zoomFactor).attr("fill","none").attr("stroke-width",1/r.zoomFactor+"px").attr("stroke","white").style("pointer-events","none")}},{key:"update",value:function(n,t,i){var r=this.settings,u=this.containerElement,f=d3.select(u).select("svg").selectAll("g").selectAll("path").transition().duration(i).style("fill",function(i){var u=i.properties.name,f,e,o,h,s;if(i.properties.naam&&(u=i.properties.naam),f=n.get(String(u)),typeof f!="undefined")i.properties.VALUE=n.get(String(u));else{for(e=0;e<r.dataset.length;e++)if(o=r.dataset[e],o.name===u){f=o.val;break}i.properties.VALUE=f}return r.useLabelItems?(h=i.properties.VALUE-r.labelMin,r.colorList[h]):(s=t(n.get(String(u))),typeof s!="undefined"?r.colorList[s]:"transparent")}).style("stroke",function(i){var u=i.properties.name,e,f;return(i.properties.naam&&(u=i.properties.naam),r.useLabelItems)?(e=i.properties.VALUE-r.labelMin,r.strokeColor):(f=t(n.get(String(u))),typeof f!="undefined"?r.strokeColor:r.emptyStrokeColor)}).style("stroke-width",r.strokeWidth)}},{key:"createMapLegend",value:function(n,t,i,r){var c,o,v,f,y;if(n){var e=this.settings,s=this.containerElement,u=s.getElementsByClassName("maplegend");u.length>0?(u=u[0],u.innerText=""):(s.insertAdjacentHTML("beforeend",'<div class="mapcontainer"><div class="maplegend"><\/div><\/div>'),u=s.getElementsByClassName("maplegend")[0]);var l=n.domain(),p=(l[1]-l[0])/n.range().length,a=d3.range(0,n.range().length).map(function(n){return n*p}),h="";for(e.dataUnit==="%"&&(h=e.dataUnit),u.insertAdjacentHTML("beforeend",'<div class="legendunit"><span>'+h+"<\/span><\/div>"),c="",o=0;o<a.length;o++)v=a[o]+t,f=v,Math.round(f)!==f&&(f=f.toFixed(1)),c+="<li class='listitem' style='border-top-color: "+e.colorList[o]+"'><span class='legenditem'>"+f+h+"<\/span><\/li>";c+="<li class='listitem max'><span class='legenditem'>"+i+h+"<\/span><\/li>";u.insertAdjacentHTML("beforeend","<div class='legendlist'>"+c+"<\/div>");r&&(y=s.getElementsByClassName("mapcontainer")[0],y.insertAdjacentHTML("beforeend",'<div class="maplegendempty"><div class="mapemptycolor" style="border: 1px solid '+e.emptyStrokeColor+';"><\/div><div class="mapemptyvalue">'+e.emptyValue+"<\/div><\/div>"))}}},{key:"findSVGElement",value:function(n){var t=this.settings,u=d3.select(t.container+" svg g").selectAll("path"),r=this,i=!1;d3.select(t.container+" svg g").selectAll("path").each(function(u,f){if(!i){var o=d3.select(this),e=u.properties.name;if(u.properties.naam&&(e=u.properties.naam),e===n){r.settings.onSearchClickFunction(this,f,t);i=!0}}})}},{key:"getSearchResults",value:function(n,t,i){var v=this.settings,c=this.containerElement,r,o,u=$(c).find(".searchresults"),e,h,s,l,a,f;if(u.empty(),e=0,i&&u.hasClass("hidden"))for(r=0;r<n.length;r++)e++,u.append("<button class='searchitem'><span>"+n[r]+"<\/span><\/button>");else if(!i&&t.length>0)if(t.indexOf(" ")>0)for(r=0;r<n.length;r++)o=n[r].toLowerCase(),o.indexOf(t)>=0&&(e++,u.append("<button class='searchitem'><span>"+n[r]+"<\/span><\/button>"));else for(r=0;r<n.length;r++)for(o=n[r].toLowerCase(),h=o.split(" "),s=0;s<h.length;s++)l=h[s],l.indexOf(t)===0&&(e++,u.append("<button class='searchitem'><span>"+n[r]+"<\/span><\/button>"));e>0?u.removeClass("hidden"):u.addClass("hidden");a=$(c).find(".searchitem");f=this;a.off().on("click",function(){f.settings.dialogSelect=!0;$(f.containerElement).find(".searchresults").addClass("hidden");var n=f.containerElement.querySelector(".inputareasearch");$(f.settings.container).find(".inputareasearch").val(this.innerText);f.findSVGElement(this.innerText)})}},{key:"createResetZoom",value:function(){var r=this.settings,t=this.containerElement,i=t.getElementsByClassName("mapresetzoom"),n;i.length>0?i=searchElement[0]:(t.getElementsByClassName("mapHandlers")[0].insertAdjacentHTML("afterbegin",'<div class="mapresetzoom"><\/div>'),i=t.getElementsByClassName("mapresetzoom")[0]);$(i).append('<button class="resetzoom" title="reset zoom"><li class="far fa-search-minus"><\/li><\/button>');n=this;$(t).find(".resetzoom").on("click",function(){var f=n.settings,t=n.containerElement,u=d3.select(n.settings.container).select("g.map"),i=t.offsetWidth/2,r=t.offsetHeight/2;d3.zoomIdentity.translate(-i,-r).scale(4);u.transition().duration(750).attr("transform","translate("+t.offsetWidth/2+","+(t.offsetHeight/2+n.settings.margin.top/2)+")scale(1)translate("+-i+","+-r+")")})}},{key:"createMapDropdown",value:function(n,t){for(var u,i,o=this.settings,r=this.containerElement,f=[],e=0;e<n.values.length;e++)e%t==0&&f.push(n.values[e].name);f.sort();u=r.getElementsByClassName("mapsearch");u.length>0?(u=u[0],u.innerText=""):(r.getElementsByClassName("mapHandlers")[0].insertAdjacentHTML("afterbegin",'<div class="mapsearch"><\/div>'),u=r.getElementsByClassName("mapsearch")[0]);$(u).append('<input class="inputareasearch" type="text" placeholder="'+o.searchPlaceHolder+'"/><button class="showallarea"><li class="far fa-chevron-down"><\/li><\/button>');$(u).append('<div class="searchresults hidden">hidden<\/div>');i=this;$(r).find(".showallarea").on("click",function(n){$(i.settings.container).find(".inputareasearch").val("");n.preventDefault();n.stopPropagation();$(r).find(".mapselectlist.variable, .mapselectlist.period").addClass("hidden");i.getSearchResults(f,"",!0)});$(r).find(".inputareasearch").off().on("focus",function(){$(r).find(".mapselectlist.variable, .mapselectlist.period").addClass("hidden")});$(r).find(".inputareasearch").off().on("keyup",function(n){var u=$(this).val(),t,r;n.which===13?(i.settings.dialogSelect=!0,t=$(i.containerElement).find(".searchresults").find(".searchitem"),t.length>0&&($(i.containerElement).find(".searchresults").addClass("hidden"),r=t[0],$(i.settings.container).find(".inputareasearch").val(r.innerText),i.findSVGElement(r.innerText))):i.getSearchResults(f,u.toLowerCase())})}},{key:"createMapSelectPeriodDropdown",value:function(n){for(var u=this.settings,i=this.containerElement,f=[],r,o,s,e,t=0;t<n.length;t++)f.push(n[t].key);for(r=i.getElementsByClassName("mapselect period"),r.length>0?(r=r[0],r.innerText=""):(i.getElementsByClassName("mapHandlers")[0].insertAdjacentHTML("afterbegin",'<div class="mapselect period"><\/div>'),r=i.getElementsByClassName("mapselect period")[0]),o=f[0],u.periodDropdownText.length>0&&(o=u.periodDropdownText),$(r).append('<button class="mapselected period" type="text" data-value="'+f[0]+'" placeholder="test"><span>'+o+'<\/span><\/button><button class="openmapselect period"><li class="far fa-chevron-down"><\/li><\/button>'),$(r).append('<div class="mapselectlist period hidden"><\/div>'),s=$(i).find(".mapselectlist.period"),t=0;t<f.length;t++)s.append("<button class='selectitem period' value='"+t+"'><span>"+f[t]+"<\/span><\/button>");e=this;$(i).find(".openmapselect.period, .mapselect.period").on("click",function(n){n.preventDefault();n.stopPropagation();$(i).find(".searchresults").addClass("hidden");$(i).find(".mapselectlist.variable").addClass("hidden");$(i).find(".mapselectlist.period").toggleClass("hidden")});$(i).find(".selectitem.period").on("click",function(r){var c;r.preventDefault();r.stopPropagation();e.settings.dialogSelect=!0;$(i).find(".mapselected.period span").text($(this).text());$(i).find(".mapselectlist.period").addClass("hidden");$(i).find(".mapselected.period").attr("data-value",$(this).text());var h=$(this).val(),l=d3.map(),o=0,s=0,a=!1,v=!1,y=$(i).find(".mapselected.variable").attr("data-value");for(t=0;t<n[h].values.length;t++)if(y===undefined||y===n[h].values[t].variable){var w=n[h].values[t].name,p=n[h].values[t].val,f=parseFloat(p);if(isNaN(f)){v=!0;continue}t!==0&&a?(o>f&&(o=f),s<f&&(s=f)):(o=f,s=f,a=!0);l.set(w,+p)}u.useLabelItems||(c=d3.scaleQuantize().domain([o,s]).range(d3.range(u.colorList.length).map(function(n){return n})));u.showLegend&&e.createMapLegend(c,o,s,v);e.update(l,c,500)})}},{key:"createMapSelectVariableDropdown",value:function(n){for(var u=this.settings,i=this.containerElement,f=[],r,o,s,e,t=0;t<n.length;t++)f.push(n[t].key);for(r=i.getElementsByClassName("mapselect variable"),r.length>0?(r=r[0],r.innerText=""):(i.getElementsByClassName("mapHandlers")[0].insertAdjacentHTML("afterbegin",'<div class="mapselect variable"><\/div>'),r=i.getElementsByClassName("mapselect variable")[0]),o=f[0],u.varDropdownText.length>0&&(o=u.varDropdownText),$(r).append('<button class="mapselected variable" type="text" data-value="'+f[0]+'"><span>'+o+'<\/span><\/button><button class="openmapselect variable"><li class="far fa-chevron-down"><\/li><\/button>'),$(r).append('<div class="mapselectlist variable hidden"><\/div>'),s=$(i).find(".mapselectlist.variable"),t=0;t<f.length;t++)s.append("<button class='selectitem variable' value='"+t+"'><span>"+f[t]+"<\/span><\/button>");e=this;$(i).find(".openmapselect.variable, .mapselect.variable").on("click",function(n){n.preventDefault();n.stopPropagation();$(i).find(".searchresults").addClass("hidden");$(i).find(".mapselectlist.period").addClass("hidden");$(i).find(".mapselectlist.variable").toggleClass("hidden")});$(i).find(".selectitem.variable").on("click",function(r){var c;r.preventDefault();r.stopPropagation();e.settings.dialogSelect=!0;$(i).find(".mapselected.variable span").text($(this).text());$(i).find(".mapselectlist.variable").addClass("hidden");$(i).find(".mapselected.variable").attr("data-value",$(this).text());var h=$(this).val(),l=d3.map(),o=0,s=0,a=!1,v=!1,y=$(i).find(".mapselected.period").attr("data-value");for(t=0;t<n[h].values.length;t++)if(y===undefined||y===n[h].values[t].period){var w=n[h].values[t].name,p=n[h].values[t].val,f=parseFloat(p);if(isNaN(f)){v=!0;continue}t!==0&&a?(o>f&&(o=f),s<f&&(s=f)):(o=f,s=f,a=!0);l.set(w,+p)}u.useLabelItems||(c=d3.scaleQuantize().domain([o,s]).range(d3.range(u.colorList.length).map(function(n){return n})));u.showLegend&&e.createMapLegend(c,o,s,v);e.update(l,c,500)})}},{key:"reSize",value:function(){this.draw()}},{key:"affineTransformation",value:function(n,t,i,r,u,f,e){return d3.geoTransform({point:function(o,s){e.point(n*o+t*s+u,i*o+r*s+f)},sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}})}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Pie=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],datasetStr:[],colors:[],indicators:[],useDonut:!1,donutRatio:25,labelText:"",labelValue:0,labelShift:!1,dataUnit:"",centerLabelUnit:"",labelClass:"donut-center",margin:{top:10,right:10,bottom:10,left:10},useCenterLabel:!1,useBottomLabel:!1,usePieLabel:!1,showValues:!0,showNames:!1,showEstimation:!1,showForecast:!1,pieLabelInside:!0,useTooltip:!0,animate:!1,animateHover:!0,duration:1250,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",showlegend:!1,legendData:[],width:0,height:0,drawStyle:"default",forecastType:"Solid",forecastDrawStyle:"",forecastColor:"rgb(128,128,128)",estimationType:"Solid",estimationDrawStyle:"",estimationColor:"rgb(128,128,128)",showExtra:!1,extraType:"Solid",extraDataType:"",extraDrawStyle:"",extraColor:"rgb(128,128,128)",titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,labelFontSize:10,calcLabelFontSize:-1,centerLabelFontSize:14,labelFontColor:"rgb(0,0,0)",labelFontColorContrast:"rgb(255,255,255)",showLabelContrast:!1,chartBackgroundColor:"transparent",datasetDouble:[],datasetDoubleStr:[],colorsDouble:[],useDoubleDonut:!1,validContainer:!0,iconSrc:"",iconColor:"rgb(0,0,0)",nrOfDec:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1);this.pie=d3.pie().sort(null);this.arc=null;this.arcOver=null}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var i=n.dataset,r=this.containerElement,t=chartutils.getChartDimensions(r);(n.width=t.width,n.height=t.height,n.width<1||n.height<1)||(d3.select(n.container).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height),(n.showEstimation&&n.estimationType!=="Solid"||n.showForecast&&n.forecastType!=="Solid"||n.showExtra&&n.extraType!=="Solid")&&chartutils.addHatchDefs(this),chartutils.drawChartExtras(this,n),i.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var l,u,o,c,e,s;if(!(n<1)&&!(t<1)&&(l=this,u=this.settings,u.validContainer)){var b=u.dataset,v=d3.select(u.container+" svg"),h=v.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")");chartutils.drawSubtitle(this,n,t,h);var y=v.select(".subtitleGroup").select(".subtitle").select("text").node(),k=y?y.getBBox().height:0,a=n-u.margin.left-u.margin.right,f=t-u.margin.top-u.margin.bottom-k;u.usePieLabel&&!u.pieLabelInside&&(u.margin.top+u.margin.bottom<50?(u.margin.top+=25,u.margin.bottom+=25,f-=50):(u.margin.top+=15,u.margin.bottom+=15,f-=30),u.margin.left+u.margin.right<50?(u.margin.left+=25,u.margin.right+=25,a-=50):(u.margin.left+=15,u.margin.right+=15,a-=30));o=Math.min(a,f)/2;u.drawStyle!=="default"&&chartutils.addCircleDefs(this,u.colors,o);c=u.useDonut?o*(100-u.donutRatio)/100:0;e=o;this.arc=d3.arc().innerRadius(c).outerRadius(e);this.arcOver=d3.arc().innerRadius(c).outerRadius(e*1.05);var d=this.arc,g=this.arcOver,p=chartutils.toolTip(u.useTooltip),nt=h.append("rect").attr("transform","translate("+n/2+","+(u.margin.top+f/2)+")").attr("width",0).attr("height",0),tt=h.append("g").attr("class","slices").attr("transform","translate("+n/2+","+(u.margin.top+f/2)+")");if(nt.attr("fill",u.chartBackgroundColor).attr("x",-e).attr("width",e*2).attr("y",-e).attr("height",e*2),s=0,u.animate&&(s=u.duration),l.addArc(d,g,b,tt,u,u.colors,s,p),u.useDoubleDonut){var it=h.append("g").attr("class","slices").attr("transform","translate("+n/2+","+(u.margin.top+f/2)+")"),w=o*(100-2*u.donutRatio)/100,rt=d3.arc().innerRadius(w-2).outerRadius(c-2),ut=d3.arc().innerRadius(w*.94).outerRadius(c-2);l.addArc(rt,ut,u.datasetDouble,it,u,u.colorsDouble,s,p)}l.addPieLabels(h,a,f,s,o);v.attr("class","animating").transition().delay(s).attr("class","")}}},{key:"pointIsInArc",value:function(n,t,i){var u=i.outerRadius()(t),f=i.startAngle()(t),e=i.endAngle()(t),o=n.x*n.x+n.y*n.y,r=Math.atan2(n.x,-n.y);return r=r<0?r+Math.PI*2:r,o<=u*u&&f<=r&&r<=e}},{key:"addArc",value:function(n,t,i,r,u,f,e,o){var l=this,c=r.selectAll("path").data(this.pie(i)).enter().append("path").attr("fill",function(n,t){return u.drawStyle!=="default"?"url("+u.baseLoc+u.container+u.drawStyle+"_"+t+")":f[t]}).attr("data-title",function(n,t){return u.indicators[t]?u.indicators[t].replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;"):""}).style("display",function(n){return n.startAngle===n.endAngle?"none":"block"}),h,a,v;if(c.transition().ease(d3.easeLinear).duration(e).attrTween("d",function(t){var i=d3.interpolate({startAngle:0,endAngle:0},t);return function(t){return n(i(t))}}),u.showEstimation||u.showForecast||u.showExtra){var s=u.showForecast?"f":u.showEstimation>0?"e":u.extraDataType,y=s==="e"?u.estimationDrawStyle:s==="f"?u.forecastDrawStyle:u.extraDrawStyle,p=s==="e"?u.estimationType:s==="f"?u.forecastType:u.extraType;p!=="Solid"?(h=r.selectAll("g.slices path"),u.showExtra&&(h=r.select("g.slices path:last-child")),h.each(function(){var i=d3.select(this),r=i.node().cloneNode(!0),t=d3.select(r);t.datum(i.datum());t.attr("class","clone").attr("fill","url("+u.baseLoc+u.container+y+"_"+s+")");t.transition().ease(d3.easeLinear).duration(e).attrTween("d",function(t){var i=d3.interpolate({startAngle:0,endAngle:0},t);return function(t){return n(i(t))}});c.node().parentNode.appendChild(r)}),a=r.selectAll("g.slices path.clone"),u.showExtra&&(a=r.selectAll("g.slices path:not(.clone)")),setTimeout(function(){l.addMouseInteraction(a,u,o,n,t)},e)):(h=r.selectAll("g.slices path"),v=s==="e"?u.estimationColor:u.forecastColor,h.each(function(){var n=d3.select(this);n.attr("fill",v)}),setTimeout(function(){l.addMouseInteraction(c,u,o,n,t)},e))}else setTimeout(function(){l.addMouseInteraction(c,u,o,n,t)},e)}},{key:"addMouseInteraction",value:function(n,t,i,r,u){n.on("mouseover",function(n,r){var f=d3.select(this),e;if(f.attr("class")==="clone"&&(e=d3.select(f.node().parentNode),f=e.selectAll("path[data-title='"+f.attr("data-title")+"']")),f.classed("hover",!0),t.animateHover&&f.transition().duration(200).attr("d",u),t.onTooltipFunction!==null)t.onTooltipFunction(i,n,t,this,r)}).on("mousemove",function(n,r){if(t.onTooltipFunction!==null)t.onTooltipFunction(i,n,t,this,r)}).on("mouseout",function(){var n=d3.select(this),u=d3.select(n.node().parentNode);n=u.selectAll("path[data-title='"+n.attr("data-title")+"']");n.classed("hover",!1);t.animateHover&&n.transition().duration(200).attr("d",r);i.hide()}).on("click touchstart",function(n,i){if(typeof t.onClickFunction[i]=="function")return t.onClickFunction[i](n,i);if(typeof t.onClickFunction=="function")return t.onClickFunction(n,i)}).on("contextmenu",t.onCMFunction)}},{key:"addPieLabels",value:function(n,t,i,r,u){this.settings.useCenterLabel&&this.addPieLabelCenter(n,t,i,r,u);this.settings.usePieLabel&&this.addPieLabelSlices(n,t,i,r,u)}},{key:"addPieLabelCenter",value:function(n,t,i,r,u){var f=this.settings,h,c,e=Math.min(t/2,i/2)*((100-f.donutRatio)/100)-f.labelFontSize,o,l;if(f.iconSrc.length>0&&e>15&&(o=new XMLHttpRequest,o.open("GET",f.iconSrc,!0),o.send(),o.onload=function(){var r=n.append("g"),s=r.append("g"),u;s.node().parentNode.appendChild(o.responseXML.documentElement);u=r.select("svg");c=i/2-e+f.labelFontSize/4;h=t/2-e/2+(f.margin.left+f.margin.right)/2;r.attr("transform","translate("+h+","+c+")");u.attr("width",e).attr("height",e).attr("fill",function(){return f.iconColor?f.iconColor:f.labelFontColor})}),h=t/2,c=i/2,f.iconSrc.length>0&&e>15,f.labelText&&f.labelText.length>0){var a=n.append("g").attr("transform","translate("+h+","+c+")"),s=a.append("svg:text").attr("text-anchor","middle").attr("fill",function(){return f.labelColor?f.labelColor:f.labelFontColor}).attr("class",f.labelClass).text(f.labelText).attr("font-size",f.centerLabelFontSize+"px").style("visibility","hidden"),p=u*(100-f.donutRatio)/100,v=p*2,y=s.node().getBBox().width;y/v&&(l=v/y,l>=.5&&l<1&&s.attr("font-size",f.centerLabelFontSize*l+"px"));s.transition().ease(d3.easeLinear).duration(r).tween("text",function(){var t=d3.interpolate(0,f.labelValue),n=this;if(f.labelValue===0){n.textContent=f.labelText;return}return function(i){if(i===1)n.textContent=f.labelText,chartutils.wrapCenterText(s,f);else{var r=f.dataUnit;f.centerLabelUnit.length>0&&(r="");n.textContent=Math.round(t(i)*1)/1+r}}});setTimeout(function(){s.style("visibility","visible").attr("transform",function(){var n=d3.select(this).node().getBBox().height;return"translate("+(f.margin.left+f.margin.right)/2+","+(f.margin.top+n/4)+")"})},1);f.centerLabelUnit.length>0&&a.append("text").text(f.centerLabelUnit).attr("text-anchor","middle").attr("fill",function(){return f.labelColor?f.labelColor:f.labelFontColor}).attr("class",f.labelClass).attr("font-size",f.centerLabelFontSize*.6+"px").attr("y",f.centerLabelFontSize*1.5).attr("x",(f.margin.left+f.margin.right)/2)}}},{key:"addPieLabelSlices",value:function(n,t,i,r,u){var f=this.settings,o=this,c=f.dataset,e=this.arc,h=n.append("g").attr("transform","translate("+(f.margin.left+t/2)+","+(f.margin.top+i/2)+")"),l=h.attr("class","labels pie").selectAll("text").data(this.pie(c)),s=l.enter().append("g").attr("class","label pie");s.attr("visibility","hidden");s.transition().delay(r).attr("visibility","visible");s.append("text").attr("font-size",function(){return f.calcLabelFontSize>0?f.calcLabelFontSize+"px":f.labelFontSize+"px"}).attr("fill",function(n,t){var i=f.labelColor?f.labelColor:f.labelFontColor,r=f.colors[t];return f.labelShift&&(r=f.chartBackgroundColor),f.showLabelContrast&&f.pieLabelInside?chartutils.getContrastLabelColor(f,i,r):i}).attr("transform",function(n){var h=e.centroid(n),t=h[0],i=h[1],r,o,s;return f.pieLabelInside?f.useDonut?f.labelShift?(r=f.donutRatio>=50?1.3:1.12,"translate("+t*r+","+i*r+")"):"translate("+t+","+i+")":f.labelShift?"translate("+t*2+","+i*2+")":"translate("+t*1.2+","+i*1.2+")":(o=Math.sqrt(t*t+i*i),s=u+15,"translate("+t/o*s+","+i/o*s+")")}).attr("dy",.35*f.labelFontSize+"px").attr("text-anchor",function(n){return f.pieLabelInside?"middle":(n.endAngle+n.startAngle)/2>Math.PI?"end":"start"}).attr("class","pie-label").text(function(n,t){var i="";if(n.value<=0){d3.select(this.parentNode).remove();return}return f.showNames&&f.indicators[t]&&(i+=f.indicators[t],f.showValues&&(i+=": ")),f.showValues&&(i+=f.datasetStr.length>0?f.datasetStr[t]:n.value.toLocaleString()),i}).each(function(n){var s=d3.select(this);if(chartutils.wrapCenterText(s,f),n.startAngle!==n.endAngle){var r=this.getBBox(),u=e.centroid(n),h=f.useDonut?u[0]*.8:u[0]*1.2,c=f.useDonut?u[1]*.8:u[1]*1.2,t={x:r.x,y:r.y,width:r.width,height:r.height};t.x=t.x>0?t.x*1.1:t.x*.9;t.y=t.y>0?t.y*1.1:t.y*.9;t.width=t.width*.9;t.height=t.height*.9;var i={x:h+t.x,y:c+t.y},l={x:i.x+t.width,y:i.y},a={x:i.x,y:i.y+t.height},v={x:i.x+t.width,y:i.y+t.height};n.visible=o.pointIsInArc(i,n,e)&&o.pointIsInArc(l,n,e)&&o.pointIsInArc(a,n,e)&&o.pointIsInArc(v,n,e)}else n.visible=!0;s.attr("font-size",f.labelFontSize+"px")}).style("display",function(n){return n.visible?null:"none"});h.attr("class","labels").selectAll("g").each(function(){var n=d3.select(this).node().getBBox(),t;d3.select(this).insert("rect","text").attr("class","labelBG").attr("height",n.height).attr("width",n.width+10).attr("x",n.x-5).attr("y",n.y).style("opacity","0");(f.useDonut||f.labelShift)&&(t=Math.max(n.height/2,n.width/2),d3.select(this).insert("circle","text").attr("class","labelBG_pie").attr("r",t*1.3).attr("cx",n.x+n.width/2).attr("cy",n.y+n.height/2).attr("fill",f.chartBackgroundColor).style("opacity","0"))})}},{key:"getLegendData",value:function(){var r=this.settings,t=r.indicators,u=[],n,i;if(t.length>=0)for(n=0;n<t.length;n++)if(i=t[n],i.length>0){var f=r.legendIconDefault,e=i,o=this.settings.colors[n];u.push({type:f,color:o,text:e})}return u}},{key:"reSize",value:function(){this.draw()}},{key:"updateData",value:function(n){d3.selectAll(".chart").each(function(t,i){var u=n[i],f=this.pie(u),e=d3.select(this),r;g.value(function(n){return n[value]});r=e.selectAll("g.slices").selectAll("path");r=r.data(f);r.attr("d",this.arc)})}},{key:"triggerMouseOverByCode",value:function(n){var t=this.settings,i,r;t.animateHover&&((i=this.arcOver,r=d3.select(t.container).select("svg").attr("class"),r.indexOf("animating")>=0)||d3.selectAll(".chart").selectAll("g.slices").selectAll("path").each(function(r){if(r.code===n){var u=d3.select(this);u.classed("hover",!0);t.animateHover&&u.transition().duration(200).attr("d",i)}}))}},{key:"triggerMouseOutByCode",value:function(n){var t=this.settings,i,r;t.animateHover&&((i=d3.select(t.container).select("svg").attr("class"),i.indexOf("animating")>=0)||(r=this.arc,d3.selectAll(".chart").selectAll("g.slices").selectAll("path").each(function(i){if(i.code===n){var u=d3.select(this);u.classed("hover",!1);t.animateHover&&u.transition().duration(200).attr("d",r)}})))}},{key:"defaultTooltip",value:function(n,t,i,r,u){var f="",e;return i.indicators[u]&&(f+=i.indicators[u]+": "),e="",e=i.datasetStr.length>0&&i.datasetStr[u].length>0?i.datasetStr[u]:Number(t.value).toLocaleString(),f+=e+i.dataUnit,n.show("<span>"+f+"<\/span>")}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Radar=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],categorySet:[],useMarker:!1,markerBorderColor:"black",markerStyle:"circle",markerSize:8,margin:{top:0,right:20,bottom:10,left:20},rotation:45,rotationy:0,rotateRadar:!1,ignoreTextBBox:!1,wrapRadarLabels:!1,yTicks:5,opacity:.8,lineWidth:2,animate:!1,animateHover:!0,duration:1250,useTooltip:!0,showLegend:!0,usePoints:!1,pointRadius:2,legendData:[],legendPosition:"",labelLegendData:[],labelLegendPosition:"",dataPrefix:"",dataPostfix:"",dataUnit:"",colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",width:0,height:0,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,showValues:!1,customYMax:null,customYMin:null,customYStep:null,autoRotation:!1,drawStyle:"radar",gridLineSize:"1",gridLineColor:"gray",axisLineSize:"1",axisLineColor:"gray",minYDefZero:!0,maxLabelLength:100,maxLabelWidth:75,useLetterLabel:!1,lineStyles:"",strokeWidth:2,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"line",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,axisXFontSize:10,axisXFontColor:"rgb(0,0,0)",axisYFontSize:10,axisYFontColor:"rgb(0,0,0)",labelFontSize:10,labelFontColor:"rgb(0,0,0)",chartBackgroundColor:"transparent",validContainer:!0,axisTickSpace:10,skewedAxis:!1,nrOfDec:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);(n.width=i.width,n.height=i.height,n.width<50||n.height<50)||(d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g"),chartutils.drawChartExtras(this,n),n.labelLegendData&&n.labelLegendData.length>0&&chartutils.drawLegend(n.labelLegendData,this,!0),r.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var u,tt,v,lt,it,at,vt,o,oi,ri,k,ht,pt,wt,bt,hi,ci,h,p,c,e,rt,kt,li,dt,gt;if(!(n<50)&&!(t<50)&&(u=this.settings,u.validContainer)){var d,a,g,ut=this,ti,ot,o,w=u.dataset,st=d3.select(u.container+" svg"),vi=d3.nest().key(function(n){return n.namecode?n.namecode:n.name}).entries(w),f=d3.nest().key(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x}).entries(w),yi=w.map(function(n){return+n.y}),b=u.customYMin===null?d3.min(w,function(n){return+n.y}):u.customYMin,nt=u.customYMax===null?d3.max(yi):u.customYMax;u.minYDefZero&&b>0&&(b=0);b===nt&&(nt=b+1);var ii=st.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),ft=ii.append("g").attr("class","axes"),ct=ii.append("g").attr("class","elements"),ei=ft.append("polygon");ei.on("mouseover, mousemove",function(){ut.onTooltip(this,rt,this)}).on("mouseout",function(){rt.hide()});var pi=u.margin.top,wi=u.margin.top,et="";for(chartutils.drawSubtitle(this,n,t,ii),o=0;o<w.length;o++)(et.length<=0||et.length<w[o].x.length)&&(et=w[o].x);if(et.length>u.maxLabelLength&&(u.useLetterLabel=!0,et="A"),d=st.append("text").style("font-size",u.axisXFontSize+"px").attr("y",u.axisXFontSize).attr("dy",u.axisXFontSize).text(et),a=d.node().getBBox().width,g=d.node().getBBox().height,d.remove(),u.wrapRadarLabels&&!u.useLetterLabel){for(a=0,g=0,o=0;o<w.length;o++)d=st.append("text").style("font-size",u.axisXFontSize+"px").attr("y",u.axisXFontSize).attr("dy",u.axisXFontSize).text(w[o].x),d.call(chartutils.wrapRadarLabels,u.maxLabelWidth,!0),a+=d.node().getBBox().width,g+=d.node().getBBox().height,d.remove();a=Math.round(a/(w.length*2));g=Math.round(g/w.length)}if(u.ignoreTextBBox&&(a=0),tt=n-u.margin.left-u.margin.right-2*a,v=t-u.margin.bottom-3*g,u.wrapRadarLabels&&(v=t-u.margin.bottom-2.1*g),u.wrapRadarLabels&&!u.ignoreTextBBox&&(a=a*2),lt=r===0?u.margin.top:wi-pi,v-=lt,ft.attr("transform","translate(0,"+lt/2+")"),ct.attr("transform","translate(0,"+lt/2+")"),!(tt<=10)&&!(v<=10)){if(it=d3.scaleLinear().range([v,0]),at=chartutils.getNiceRange(b,nt,u.nrOfDec),u.customYMin!==null&&u.customYMax!==null?it.domain([b,nt]):(b=at.minValue,nt=at.maxValue,it.domain([b,nt]),u.customYStep=at.step),vt=[],u.customYStep!==null&&u.customYStep!==0&&u.customYStep<=nt-b)for(ti=(nt-b)/u.customYStep,ot=chartutils.nbrOfDecimals(u.customYStep),ot=ot>3?3:ot,o=0;o<=ti;o++)oi=Math.round((b+o*u.customYStep)*1e3)/1e3,vt.push(oi.toFixed(ot));ri=chartutils.getYAxis(tt,v,it,vt,this,!0);u.customYStep!==null&&u.customYStep!==0&&ri.ticks(ti);k=it.ticks();vt.length>0&&(k=ri.tickValues());var y=k.length,bi=y,rr=k[y-1],l=Math.min(tt/2,v/2)*.95,ki=ft.append("g").attr("class","axislines"),yt=0,s=0;if(u.rotateRadar&&(s+=Math.PI/f.length),f.length%2!=0&&tt>v){var e=v/2*((y-1)/y),di=e*Math.cos(Math.floor(f.length/2)*2*Math.PI/f.length+s)*-1,si=v/2+(v/2-di)/2;si*2<tt&&(l=si*.95)}for(ht=u.axisTickSpace,(!ht||ht<u.axisYFontSize)&&(ht=u.axisYFontSize);l/(bi/(yt+1))<ht;)yt++;if(yt>0){for(pt=[],o=0;o<y;o++)o%yt*2==0?pt.push(k[o]):pt.push("");k=pt}for(wt="",o=0;o<f.length;o++)o!==0&&(wt+=","),bt=0,u.rotateRadar&&(bt=1),hi=l*(1-1*Math.sin((f.length-o-bt)*2*Math.PI/f.length+s)),ci=l*(1-1*Math.cos((f.length-o-bt)*2*Math.PI/f.length+s)),wt+=hi+","+ci;for(h=n/2,u.labelLegendData.length>0&&u.labelLegendPosition==="left"?h=n-l-a-u.margin.right:u.labelLegendData.length>0&&u.labelLegendPosition==="right"?h=u.margin.left+l+a:n/2-l-a<u.margin.left&&(h+=(u.margin.left-(n/2-l-a))/2),p=v/2+u.margin.bottom/2+u.margin.top/2+g/2,f.length%2!=0&&tt>v&&(p=l/.95+u.margin.bottom/2+u.margin.top/2+g/2),ei.attr("points",wt).attr("fill",u.chartBackgroundColor).attr("transform","translate("+(h-l)+", "+(p-l)+")"),c=0;c<y;c++)e=l*(c/y),k[c].toString().length>0&&ki.selectAll(".webline").data(f).enter().append("line").attr("x1",function(n,t){return e*(1-1*Math.sin(t*2*Math.PI/f.length+s))}).attr("y1",function(n,t){return e*(1-1*Math.cos(t*2*Math.PI/f.length+s))}).attr("x2",function(n,t){return e*(1-1*Math.sin((t+1)*2*Math.PI/f.length+s))}).attr("y2",function(n,t){return e*(1-1*Math.cos((t+1)*2*Math.PI/f.length+s))}).attr("class","line").style("stroke",u.gridLineColor).style("stroke-width",u.gridLineSize+"px").attr("transform","translate("+(h-e)+", "+(p-e)+")");if(rt=chartutils.toolTip(u.useTooltip),u.skewedAxis)for(kt=ft.append("g").attr("class","axis label"),c=0;c<y;c++){e=l*(c/y);var gi=h+e*Math.sin(0*Math.PI/f.length+s),nr=p+e*Math.cos(0*Math.PI/f.length+s)*-1,tr=h+e*Math.sin(2*Math.PI/f.length+s),ir=p+e*Math.cos(2*Math.PI/f.length+s)*-1,ur=Math.cos((Math.PI-2*Math.PI/f.length)/2)*e*Math.cos(1*Math.PI/f.length+s);kt.append("text").attr("x",function(){return(tr+gi)/2}).attr("y",function(){return(ir+nr)/2}).attr("class","legend").style("font-size",u.axisYFontSize+"px").attr("fill",u.axisYFontColor).attr("text-anchor","middle").text(function(){if(k[c].toString().length>0){var t=Number(k[c]),n=chartutils.nbrOfDecimals(t);return n=n>3?3:n,u.dataPrefix+chartutils.numberFormat(t,n,u.lang,u.customLang)+u.dataPostfix}return""})}else for(kt=ft.append("g").attr("class","axis label"),c=0;c<y;c++)e=l*(c/y),kt.append("text").attr("x",function(){return e}).attr("y",function(){return e*(1-1*Math.cos(s))+5}).attr("class","legend").style("font-size",u.axisYFontSize+"px").attr("fill",u.axisYFontColor).attr("transform","translate("+(h-e+5)+", "+(p-e)+")").text(function(){if(k[c].toString().length>0){var t=Number(k[c]),n=chartutils.nbrOfDecimals(t);return n=n>3?3:n,chartutils.numberFormat(t,n,u.lang,u.customLang).concat(u.dataUnit==="%"?"%":"")}return""});li=ft.append("g").attr("class","axis lines");e=l*((y-1)/y);dt=li.selectAll(".axis").data(f).enter().append("g").attr("class","axis").attr("dataindex",function(n,t){return t});dt.append("line").attr("x1",h).attr("y1",p).attr("x2",function(n,t){return h+e*Math.sin(t*2*Math.PI/f.length+s)}).attr("y2",function(n,t){return p+e*Math.cos(t*2*Math.PI/f.length+s)*-1}).style("stroke",u.axisLineColor).style("stroke-width",u.axisLineSize+"px");gt=dt.append("text");gt.attr("class","label").attr("data-title",function(n){return n.values[0].x.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.key}).text(function(n,t){var i=n.values[0].t==="e"||n.values[0].t==="f"?"*":"";return u.useLetterLabel?String.fromCharCode(65+t)+i:n.values[0].x+i}).attr("text-anchor",function(n,t){var r=h+e*Math.sin(t*2*Math.PI/f.length+s),i="middle";return r<h?i="end":r>h&&(i="start"),i}).attr("dy",u.axisXFontSize/2);gt.attr("font-size",u.axisXFontSize+"px").attr("fill",u.axisXFontColor).attr("x",function(n,t){return h+e*1.1*Math.sin(t*2*Math.PI/f.length+s)}).attr("y",function(n,t){return p+e*1.1*Math.cos(t*2*Math.PI/f.length+s)*-1});u.wrapRadarLabels&&gt.call(chartutils.wrapRadarLabels,u.maxLabelWidth);dt.on("mouseover, mousemove",function(n){return ut.settings.onTooltipFunction(rt,n.values,ut.settings,this,!1)}).on("mouseout",function(){st.select("g.chart").selectAll("g.points circle").attr("r",u.pointRadius);rt.hide()}).on("click touchstart",u.onClickFunction).on("contextmenu",u.onCMFunction);var ai=it.domain()[1],ui=it.domain()[0],fi=u.lineStyles.split(";"),ni=u.animate?u.duration:0;vi.forEach(function(n,t){for(var r,d,g,l,a,v,o,y,w,b=n.values,c=[],k="",i=0;i<b.length;i++){if(r=0,isNaN(n.values[i].y)||n.values[i].y===null)continue;else r=(+b[i].y-ui)/(ai-ui);r<0&&(r=0);d=h+e*r*Math.sin(i*2*Math.PI/f.length+s);g=p+e*r*Math.cos(i*2*Math.PI/f.length+s)*-1;c.push([+d,+g]);k+=" "+h+","+p}switch(u.drawStyle){case"line":l="radar line";break;case"radar":default:l="radar"}a="solid";fi.length>0&&fi.length>t&&(v=fi[t],v.length>0&&(a=v));o="0";switch(a){case"dash":o="7, 3";break;case"dashdot":o="7, 3, 3, 3";break;case"dashdotdot":o="7, 3, 3, 3, 3, 3";break;case"dot":o="3, 3"}y=ct.selectAll(".area").data([c]).enter().append("g").attr("class",l);y.append("polygon").attr("class","radar_"+t).attr("data-title",function(){if(n.values[0].name)return n.values[0].name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",n.key).style("stroke-width",u.strokeWidth+"px").style("stroke",u.colorList[t]).style("stroke-dasharray",o).style("fill",u.colorList[t]).attr("points",k).transition().duration(ni).delay(function(n,t){return ni>0?t*150:0}).attr("points",function(n){for(var i="",t=0;t<n.length;t++)t!==0&&(i+=","),i=i+n[t][0]+","+n[t][1];return i});u.usePoints&&(w=ct.append("g").attr("class","points"),w=w.selectAll("circle").data(c).enter().append("circle").attr("pointer-events","none").attr("data-code",function(n,t){return t}).attr("cx",function(n){return n[0]}).attr("cy",function(n){return n[1]}).attr("r",0).attr("fill",u.colorList[t]).transition().duration(ni).delay(function(){return ni>0?t*150:0}).attr("r",u.pointRadius));y.on("mouseover, mousemove",function(){var n,t;u.animateHover&&(d3.select(this.parentNode).selectAll(".radar").classed("empty",!0),n=d3.select(this),n.classed("hover",!0),n.classed("empty",!1));t=d3.select(this).select("polygon").node();ut.onTooltip(this,rt,t)}).on("mouseout",function(){if(u.animateHover){d3.selectAll(".radar").classed("empty",!1);var n=d3.select(this);n.classed("hover",!1);st.select("g.chart").selectAll("g.points circle").attr("r",u.pointRadius)}rt.hide()}).on("click touchstart",u.onClickFunction).on("contextmenu",u.onCMFunction)});u.showValues&&ut.drawLabelBox(ut,f,n,t,e,ct,ui,ai,h,p)}}}},{key:"drawLabelBox",value:function(n,t,i,r,u,f,e,o,s,h){var l=n.settings,a=[],p=l.labelFontSize,v=0,c=0;l.rotateRadar&&(c+=Math.PI/axisElements.length);t.forEach(function(n){v=0;for(var t=0;t<n.values.length;t++)v=Math.max(+n.values[t].y,v);a.push(v)});var b=a[a.length-1],w=f.append("text").attr("font-size",p+"px").text(b),y=w.node().getBBox().height;w.remove();t.forEach(function(n,i){var r=f.append("g").attr("class","labels"),b=s+u*1.15*Math.sin(i*(2*Math.PI/t.length+c)),k=h+u*1.15*Math.cos(i*(2*Math.PI/t.length+c))*-1,d=n.values.length*y,g=a[i],v=(+g-e)/(o-e),nt=s+u*v*Math.sin(i*(2*Math.PI/t.length+c)),tt=h+u*v*Math.cos(i*(2*Math.PI/t.length+c))*-1,it=(nt+b)/2,w=(tt+k)/2;r.selectAll("text").data(n.values).enter().append("g").attr("class","label radarlabel").append("text").attr("text-anchor",function(){var r=s+u*Math.sin(i*2*Math.PI/t.length+c),n="middle";return r<s?n="start":r>s&&(n="end"),n}).attr("x",it-10).attr("y",function(n,t){return i===0&&!l.rotateRadar?w+t*y*1.1:w-d/2+t*y*1.1}).attr("font-size",p+"px").attr("fill",l.labelFontColor).text(function(n){return n.ystring!==undefined?n.ystring:isNaN(n.y)?"":Number(n.y).toLocaleString()});r.selectAll("g").each(function(n,t){var i=d3.select(this).node().getBBox();d3.select(this).insert("rect","text").attr("class","labelBG").attr("height",i.height).attr("width",i.width+10).attr("x",i.x-5).attr("y",i.y).attr("stroke",l.colorList[t]).attr("fill-opacity",0).attr("fill","white")})})}},{key:"getLegendData",value:function(n){var i=this.settings,e=[],t,r,u,f,o;if(n.length<=0||i.categorySet.length>0){if(i.categorySet.length>0)for(t=0;t<i.categorySet.length;t++)o=i.categorySet[t],o.length>0&&(r=i.legendIconDefault,u=o,f=i.categoryColorList[t],e.push({type:r,color:f,text:u}))}else for(t=0;t<n.length;t++)r=i.legendIconDefault,u=n[t].key,f=i.colorList[t],e.push({type:r,color:f,text:u});return e}},{key:"triggerMouseOverByCode",value:function(n){if(this.settings.animateHover){var t=!1,i=d3.selectAll(".chart").selectAll("g.radar");i.each(function(i){var r=d3.select(this);i.code===n?(r.classed("hover",!0),r.classed("empty",!1),t=!0):r.classed("empty",!0)});t||i.each(function(){var n=d3.select(this);n.classed("hover",!1);n.classed("empty",!1)})}}},{key:"triggerMouseOutByCode",value:function(){this.settings.animateHover&&d3.selectAll(".chart").selectAll("g.radar").each(function(){var n=d3.select(this);n.classed("hover",!1);n.classed("empty",!1)})}},{key:"reSize",value:function(){this.draw()}},{key:"defaultTooltip",value:function(n,t,i,r){var h=d3.select(r),u="",f,e,o,s;if(t.length>0)for(o=t[0],o.x&&o.x.length>0&&(u+="<p class='tt-indicator'>"+o.x+"<\/p>"),s=0;s<t.length;s++)f=t[s],f.x&&f.x.length>0&&(u+="<p class='tt-indicator'>"+f.name),e=h.attr("data-value"),e=e||f.ystring!==undefined?f.ystring:Number(f.y).toLocaleString()+chartSettings.options.perc,e.length>0&&(u+=u.length>0?": ":"",u+="<span class='tt-value'>"+e+"<\/span>"),u+="<\/p>";n.show(u)}},{key:"onTooltip",value:function(n,t,i){var r=d3.mouse(n),u=this.getDataPointsByXY(r,i.getAttribute("points"));return this.settings.onTooltipFunction(t,u,this.settings,n,!1)}},{key:"getDataPointsByXY",value:function(n,t){for(var s=n[0],h=n[1],r=t.split(","),u=99999,f=-1,e=[],i=0;i<r.length/2;i++){var c=r[i*2],l=r[i*2+1],o=Math.sqrt(Math.pow(s-c,2)+Math.pow(h-l,2));o<u&&(u=o,f=i)}for(i=f;i<this.settings.dataset.length;)e.push(this.settings.dataset[i]),i+=r.length/2;return e}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Sankey=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],dataUnit:"",margin:{top:10,right:10,bottom:10,left:10},showNames:!0,useTooltip:!0,animate:!1,animateHover:!0,duration:1250,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",showlegend:!1,legendData:[],width:0,height:0,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,labelFontSize:10,labelFontColor:"rgb(0,0,0)",labelFontColorContrast:"rgb(255,255,255)",showLabelContrast:!1,chartBackgroundColor:"transparent",validContainer:!0,nrOfDec:null,borderColor:"rgb(0,0,0)",borderWidth:2,nodeWidth:20,nodePadding:10,nodeColor:"rgb(128,128,128)",nodeStroke:"rgb(0,0,0)",nodeStrokeWidth:0,strokeOpacity:.5,inlineAxis:!0,_mouseOutTimeout:null,emptyLinks:!1,flip:!1};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var i=n.dataset,r=this.containerElement,t=chartutils.getChartDimensions(r);(n.width=t.width,n.height=t.height,n.width<1||n.height<1)||(d3.select(n.container).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height),chartutils.drawChartExtras(this,n),i.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var o,u,p;if(!(n<1)&&!(t<1)&&(o=this,u=o.settings,u.validContainer)){var e=u.dataset,s=chartutils.toolTip(u.useTooltip),h=d3.select(u.container+" svg"),c=h.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),f=c.append("g").attr("class","elements"),w=f.append("rect").attr("width",0).attr("height",0);chartutils.drawSubtitle(this,n,t,c);var l=h.select(".subtitleGroup").select(".subtitle").select("text").node(),b=l?l.getBBox().height:0,y=n-u.margin.left-u.margin.right,a=t-u.margin.top-u.margin.bottom,v=r===0?u.margin.top:0;u.showNames&&(v+=u.labelFontSize,a-=u.labelFontSize);f.attr("transform","translate("+u.margin.left+","+v+")");p=this.getSankey(u,e,y,a);this.addLinks(f,e,u,s);this.addNodes(f,e,u,s)}}},{key:"getSankey",value:function(n,t,i,r){var f,u,e;return n.inlineAxis&&n.showNames&&n.labelFontSize>=n.nodePadding&&(f=r/(n.labelFontSize*2),f>t.nodes.length?n.nodePadding=n.labelFontSize*2:n.showNames=!1),u={},t.nodes.forEach(function(n){u[n.id]=n}),t.links=t.links.map(function(n){return{source:u[n.source],target:u[n.target],value:n.value}}),e=d3.sankey().nodeWidth(n.nodeWidth).nodePadding(n.nodePadding).size([i,r]).iterations([0]),e(t)}},{key:"addLinks",value:function(n,t,i,r){var u=n.append("g").attr("class","links").selectAll(".link").data(t.links),f=u.enter().append("path").attr("class","link").attr("data-index",function(n){return n.index}).attr("d",d3.sankeyLinkHorizontal()).attr("stroke",function(n){return!i.flip&&n.source.ci!==undefined&&n.source.ci>=0?i.colorList[n.source.ci]:i.flip&&n.target.ci!==undefined&&n.target.ci>=0?i.colorList[n.target.ci]:i.colorList[n.source.index]}).attr("stroke-opacity",i.strokeOpacity).attr("stroke-width",function(n){return Math.max(0,n.width)}).sort(function(n,t){return t.dy-n.dy});this.addMouseInteraction(n,f,i,r)}},{key:"addNodes",value:function(n,t,i,r){var u=n.append("g").attr("class","nodes").selectAll(".node").data(t.nodes).enter().append("g").attr("class","node").attr("transform",function(n){var t=isNaN(n.y0)?0:n.y0;return"translate("+n.x0+","+t+")"}),o=u.append("rect").attr("height",function(n){return isNaN(n.y1)||isNaN(n.y0)?0:n.y1-n.y0}).attr("width",function(n){return n.x1-n.x0}).attr("data-index",function(n){return n.index}).attr("data-code",function(n){return n.namecode!==undefined&&n.namecode!==null?n.namecode:n.name}).attr("fill",function(n){return n.ci!==undefined&&n.ci>=0?i.colorList[n.ci]:n.layer<=0&&!i.flip?i.colorList[n.index]:i.nodeColor}).attr("stroke",i.nodeStroke).attr("stroke-width",i.nodeStrokeWidth);if(this.addMouseInteraction(n,o,i,r),i.showNames){var f=0,e=u.append("g").attr("class","label sankey").attr("transform",function(n,t){var e=n.depth!==0?n.x1-n.x0:0,r=i.labelFontSize/-2,u;return i.emptyLinks&&(n.depth===0?(f++,r+=i.labelFontSize*t):(u=t-f,r+=i.labelFontSize*u)),"translate("+e+","+r+")"}),s=e.append("text");s.text(function(n){return n.name}).attr("text-anchor",function(n){return n.depth===0?"start":"end"}).attr("font-size",i.labelFontSize).attr("fill",i.labelFontColor).attr("opacity",function(n){return!isNaN(n.y1)&&!isNaN(n.y0)&&n.y1-n.y0>0?1:.5});this.addMouseInteraction(n,e,i,r)}}},{key:"addMouseInteraction",value:function(n,t,i,r){t.on("mouseenter",function(t){var s,e,o,r,f,u;if(clearTimeout(i._mouseOutTimeout),i.animateHover)if(n.selectAll("path.link").classed("unfocus",!0).classed("focus",!1),n.selectAll("g.node rect").classed("unfocus",!0).classed("focus",!1),t.source&&t.target)s=d3.select(this),s.classed("focus",!0),e=t.source.index,o=t.target.index,n.select("g.node rect[data-index='"+e+"']").classed("focus",!0),n.select("g.node rect[data-index='"+o+"']").classed("focus",!0);else for(r=[],r=r.concat(t.sourceLinks).concat(t.targetLinks),f=0;f<r.length;f++)if(u=r[f],u.width>0){var h=u.index,e=u.source.index,o=u.target.index;n.selectAll("path.link[data-index='"+h+"']").classed("focus",!0);n.select("g.node rect[data-index='"+e+"']").classed("focus",!0);n.select("g.node rect[data-index='"+o+"']").classed("focus",!0)}});t.on("mouseover, mousemove",function(n){i.onTooltipFunction(r,n,i,this)}).on("mouseout",function(){i.animateHover&&(clearTimeout(i._mouseOutTimeout),i._mouseOutTimeout=setTimeout(function(){n.selectAll("path.link").classed("unfocus",!1).classed("focus",!1);n.selectAll("g.node rect").classed("unfocus",!1).classed("focus",!1)},200));r.hide()}).on("click touchstart",i.onClickFunction).on("contextmenu",i.onCMFunction)}},{key:"reSize",value:function(){this.draw()}},{key:"triggerMouseOverByCode",value:function(n){var t=this.settings,i;t.animateHover&&(i=!1,d3.select(t.container).selectAll("g.chart").selectAll("g.node").each(function(r){var o,u,e,f;if(!i&&(o=r.namecode!==undefined&&r.namecode!==null?r.namecode:r.name,o===n&&r.depth===0&&!t.flip||o===n&&r.depth===1&&t.flip))for(d3.select(t.container).selectAll("path.link").classed("unfocus",!0).classed("focus",!1),d3.select(t.container).selectAll("g.node rect").classed("unfocus",!0).classed("focus",!1),u=[],u=u.concat(r.sourceLinks).concat(r.targetLinks),e=0;e<u.length;e++)if(f=u[e],f.width>0){var s=f.index,h=f.source.index,c=f.target.index;d3.select(t.container).selectAll("path.link[data-index='"+s+"']").classed("focus",!0);d3.select(t.container).select("g.node rect[data-index='"+h+"']").classed("focus",!0);d3.select(t.container).select("g.node rect[data-index='"+c+"']").classed("focus",!0)}}))}},{key:"triggerMouseOutByCode",value:function(){this.settings.animateHover&&(d3.select(this.settings.container).selectAll("path.link").classed("unfocus",!1).classed("focus",!1),d3.select(this.settings.container).selectAll("g.node rect").classed("unfocus",!1).classed("focus",!1))}},{key:"defaultTooltip",value:function(n,t,i){var f="",r,u;if(t)return r="",r=t.source&&t.target?t.source.name+" &#11208; "+t.target.name:t.name,r&&r.length>0&&(r=r.replace(/\\n/g," "),f+=r+": "),u=t.value,u=t.valstr!==undefined&&t.valstr!==null?t.data.valstr:chartutils.numberFormat(u,"",i.lang,i.customLang),f+=u,n.show("<span>"+f+"<\/span>")}},{key:"showTooltip",value:function(n,t){var i=chartutils.toolTip(!0);i.show(n,t)}},{key:"hideTooltip",value:function(){var n=chartutils.toolTip(!0);n.hide()}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Scatter=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],categorySet:[],margin:{top:0,right:0,bottom:0,left:0},rotation:45,rotationy:0,autoRotation:!1,autoXSplitText:!1,lineWidth:2,line2Width:2,useTooltip:!0,dataPrefix:"",dataPrefixY1:"",dataPostfix:"",dataPostfixY1:"",dataUnit:"",dataUnitY1:"",colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],categoryColorList:[],title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",animate:!1,animateHover:!0,duration:1250,skipLabel:0,lineStyle:"cardinal",showLegend:!0,legendData:[],showValues:!1,showNames:!1,fontsize:10,pointBorderColor:"black",pointBorderSize:1,pointStyle:"circle",pointSize:8,pointColor:"#999",customYMax:null,customYMin:null,customYStep:null,customXMax:null,customXMin:null,customXStep:null,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,width:0,height:0,showAxes:!0,showAxisXLabels:!0,axisColor:"rgb(0,0,0)",brokenAxis:!1,showGridLines:!0,gridLineColor:"rgb(0,0,0)",showAverage:!1,averageColor:"black",averageWidth:2,showRegression:!1,regressionColor:"black",regressionWidth:2,regressionFormula_a:0,regressionFormula_b:0,minYDefZero:!0,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"point",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,axisXFontSize:10,axisXFontColor:"rgb(0,0,0)",axisYFontSize:10,axisYFontColor:"rgb(0,0,0)",labelFontSize:10,labelFontColor:"rgb(0,0,0)",chartBackgroundColor:"transparent",showNormlines:!1,normlinesColor:"rgb(100,100,100)",normlinesDashStyle:"solid",normlinesWidth:2,normlinesX:0,normlinesY:0,showNormAreas:!0,normAreaColorList:["#900","#b45f06","#bf9000","#38761d"],validContainer:!0,clipPathCount:0,swapXAxisDomain:!1,swapYAxisDomain:!1,inlineAxis:!1,axisTickSpace:10,nrOfDec:null};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var r=n.dataset,t=this.containerElement,i=chartutils.getChartDimensions(t);(n.width=i.width,n.height=i.height,n.width<50||n.height<50)||(n.animate=n.useAnimation||n.animate,d3.select(t).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height).append("g"),chartutils.drawChartExtras(this,n),r.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var u,v,s,w,et,ot,h,c,tr,p,ui,y,fi,b,ir,vt,rr,ft,yt,a,ei,pt,wt,st,ur,bt,or,yi,ct,lt,l,o,hi,kt,dt;if(!(n<50)&&!(t<50)&&(u=this.settings,u.validContainer)){var k,ut,d,pi,g,gt,ni,ti,ii,nt,at=u.dataset,wi=0,ci=d3.select(u.container+" svg"),sr=at.map(function(n){return+n.y}),hr=at.map(function(n){return+n.x}),e=u.customYMin===null?d3.min(at,function(n){return+n.y}):u.customYMin;u.minYDefZero&&e>0&&(e=0);v=u.customYMax===null?d3.max(sr):u.customYMax;e===v&&(v=e+1);s=u.customXMin===null?d3.min(at,function(n){return+n.y}):u.customXMin;u.minYDefZero&&s>0&&(s=0);w=u.customXMax===null?d3.max(hr):u.customXMax;s===w&&(w=s+1);var tt=ci.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),bi=tt.append("g").attr("class","norm"),it=tt.append("g").attr("class","axes"),ki=it.append("rect").attr("width",0).attr("height",0),ri=tt.append("g").attr("class","norm"),li=tt.append("g").attr("class","elements"),di=u.margin.top;chartutils.drawSubtitle(this,n,t,tt);var gi=u.margin.top,ft=chartutils.getNiceRange(e,v,u.nrOfDec),ai=u.customYMin===null||u.customYMax===null,nr=u.customYStep;if(ai||u.customYStep===null||u.customYStep===0?(nr=ft.step,nt=chartutils.nbrOfDecimals(nr),nt=nt>3?3:nt):nt=chartutils.nbrOfDecimals(u.customYStep),k=ci.append("text").attr("font-size",u.axisYFontSize+"px").text(v),ut=k.node().getBBox().width,d=k.node().getBBox().height,k.remove(),k=ci.append("text").attr("font-size",u.axisXFontSize+"px").text(w),pi=k.node().getBBox().height,k.remove(),et=u.margin.left,et+=u.inlineAxis?0:d+ut,ot=r===0?u.margin.top:gi-di,ot+=u.inlineAxis?d:0,it.attr("transform","translate("+et+","+ot+")"),li.attr("transform","translate("+et+","+ot+")"),ri.attr("transform","translate("+et+","+ot+")"),bi.attr("transform","translate("+et+","+ot+")"),h=n-u.margin.left-u.margin.right,c=t-u.margin.bottom,c-=r===0?u.margin.top:gi-di,u.inlineAxis?c-=d:h=h-ut-d,u.swapXAxisDomain&&(tr=s,s=w,w=tr),y=ut*1.5,y<50&&(y=50),y=u.inlineAxis?y:0,st=u.inlineAxis?[y,h-20]:[y,h],p=d3.scaleLinear().range(st),u.customXMin!==null&&u.customXMax!==null?p.domain([s,w]):p.domain([s,w]).nice(),fi=[],u.customXStep!==null&&u.customXStep!==0)for(g=(w-s)/u.customXStep,b=0;b<=g;b++)fi.push(Math.round((s+b*u.customXStep)*1e3)/1e3);if(ui=chartutils.getXAxisLinear(p,this,h,fi),ir=y>0&&s>0?y:0,c=chartutils.drawXAxis(ui,this,it,h,c,pi,!0,!1,null,!1,ir),u.customXStep!==null&&(g=(u.customXMax-u.customXMin)/u.customXStep,ui.ticks(g)),u.brokenAxis&&y>0&&s>0&&(st=[0,y],vt=d3.scaleLinear().range(st),vt.domain([0,s]),rr=chartutils.getXAxisLinear(vt,this,h,[wi.toFixed(nt)]),chartutils.drawXAxis(rr,this,it,h,c+u.axisXFontSize,0,!0,!1,null,!0,y)),ft=chartutils.getNiceRange(e,v,u.nrOfDec),yt=u.brokenAxis&&e>0&&(!ai||ai&&ft.minValue>0)?c/4:0,yt>30&&(yt=30),a=d3.scaleLinear().range([c-yt,0]),u.customYMin!==null&&u.customYMax!==null?u.swapYAxisDomain?a.domain([v,e]):a.domain([e,v]):(e=ft.minValue,v=ft.maxValue,u.swapYAxisDomain?a.domain([v,e]):a.domain([e,v]),u.customYStep=ft.step),ei=[],u.customYStep!==null&&u.customYStep!==0)for(g=(v-e)/u.customYStep,b=0;b<=g;b++)ei.push(Math.round((e+b*u.customYStep)*1e3)/1e3);pt=chartutils.getYAxis(h,c,a,ei,this);u.customYStep!==null&&u.customYStep!==0&&pt.ticks(g);chartutils.drawYAxis(pt,this,it,c,ut);u.brokenAxis&&e>0&&(st=[c,c-yt],wt=d3.scaleLinear().range(st),wt.domain([0,e]),ur=chartutils.getYAxis(h,c,wt,[wi.toFixed(nt)],this),chartutils.drawYAxis(ur,this,it,c,ut,!0));e<0&&chartutils.drawZeroLine(a,pt,it);var fr=chartutils.toolTip(u.useTooltip),ht=u.animate?u.duration:0,cr=u.animate?cr=u.duration/at.length:0,lr=u.pointStyle==="circle"?"circle":"rect",f=u.pointSize;u.pointStyle==="diamond"&&(f=Math.sqrt(Math.pow(u.pointSize,2)/2));bt=li.selectAll("point").data(u.dataset).enter().append("g").attr("class","point").append(lr).attr("fill",function(n){return n.ci<0||n.ci>=u.colorList.length?u.pointColor:u.colorList[n.ci]}).attr("fill-opacity",0).attr("class","scatter-point").attr("stroke",u.pointBorderColor).attr("stroke-width","0px").attr("data-title",function(n){if(n.name)return n.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.namecode?n.namecode:n.name}).attr("data-valuex",function(n){return n.xstring!==undefined?n.xstring:Number(n.x).toLocaleString()}).attr("data-valuey",function(n){return n.ystring!==undefined?n.ystring:Number(n.y).toLocaleString()}).attr("data-valuez",function(n){return n.zstring!==undefined?n.zstring:n.z!==undefined?Number(n.z).toLocaleString():""}).on("mouseover, mousemove",function(n){var t=d3.select(this);if(u.animateHover&&(t.classed("hover",!0),!t.classed("multipoint")))switch(u.pointStyle){case"diamond":break;case"square":t.transition().duration(100).attr("width",f*2).attr("height",f*2).attr("transform","translate("+-f/2+","+-f/2+")");break;default:t.transition().duration(100).attr("r",f)}u.onTooltipFunction(fr,n,u,this)}).on("mouseout",function(){if(u.animateHover){var n=d3.select(this);if(n.classed("hover",!1),!n.classed("multipoint"))switch(u.pointStyle){case"diamond":break;case"square":n.transition().duration(100).attr("width",f).attr("height",f).attr("transform","translate(0,0)");break;default:n.transition().duration(100).attr("r",f/2)}}fr.hide()}).on("click touchstart",u.onClickFunction).on("contextmenu",u.onCMFunction);bt.transition().duration(ht).attr("fill-opacity",.8).attr("stroke-width",u.pointBorderSize+"px");var vr=tt.select(".x.axis"),ar=u.inlineAxis?-d:0,er=u.container.replace("#","")+"_"+u.clipPathCount;u.clipPathCount++;or=u.inlineAxis?t+d:t;tt.append("clipPath").attr("id","chart-clip_"+er).append("rect").attr("x",0).attr("y",ar).attr("height",or).attr("width",h);li.attr("clip-path","url(#chart-clip_"+er+")");ki.attr("fill",u.chartBackgroundColor).attr("x",1).attr("width",h-1).attr("y",0).attr("height",c);u.showNormAreas&&ki.attr("fill-opacity",0);var oi=0,si=0,vi=0,rt=[];for(bt.each(function(n){var o=d3.select(this),t,i,v=d3.select(this.parentNode),c,r,l;if(u.dataset.length<50&&(c=v.append("text").attr("class","label").style("visibility","hidden").attr("font-size",u.labelFontSize+"px").attr("fill",u.labelFontColor).attr("name",function(n){return n.name}).text(function(n){var t=u.showNames?n.name+" ":"";return u.showValues&&(t=n.xstring!==undefined?t+n.xstring:t+Number(n.x).toLocaleString(),t+=" ",t=n.ystring!==undefined?t+n.ystring:t+Number(n.y).toLocaleString(),t+=" ",u.categorySet[2]!==undefined&&n.z!==undefined&&(t=(n.zstring!==undefined?t+n.zstring:t+Number(n.z).toLocaleString)+" ")),t}).attr("x",function(n){var r=d3.select(this),t,i;if(isNaN(n.x)||isNaN(n.y))t=null,r.text("");else if(i=r.node().getBBox().width,t=Math.max(p(+n.x)-i/2,5),t+i>h)return t+(h-(t+i));return t}).attr("y",function(n){var i=d3.select(this),t,r;return isNaN(n.x)||isNaN(n.y)?(t=null,i.text("")):(r=i.node().getBBox().height,t=a(+n.y)-f),t}).transition().delay(ht).on("end",function(){var n=d3.select(this);n.style("visibility","visible")})),!isNaN(n.x)&&!isNaN(n.y)){oi+=+n.x;si+=+n.y;vi++;t=n.x<s?vt(n.x):p(n.x);i=n.y<e?wt(n.y):a(n.y);switch(u.pointStyle){case"diamond":o.attr("width",f).attr("height",f).attr("transform",function(){return"rotate(45,"+t+","+i+")"}).attr("x",t-u.pointSize/2).attr("y",i-u.pointSize/2);break;case"square":o.attr("width",f).attr("height",f).attr("x",t-f/2).attr("y",i)-f/2;break;default:o.attr("r",f/2).attr("cx",t).attr("cy",i)}}u.dataset.length<50&&(r=c.node().getBBox(),l={x:r.x,y:r.y,height:r.height,width:r.width+6},rt.push({labelElement:c,label:l,point:{x:t,y:i}}))}),rt.sort(function(n,t){return n.point.y-t.point.y}),bt.each(function(n,t){var r=d3.select(this),i=d3.select(this.parentNode);bt.each(function(f,e){var o=d3.select(this),s,h,c;if(t!==e)if(s=d3.select(this.parentNode),n.x!==f.x||n.y!==f.y||isNaN(n.x)||isNaN(n.y)||n.overlapping&&f.overlapping)n.x===f.x&&n.y===f.y&&n.overlapping&&f.overlapping&&(n.pointcount=n.pointcount+1,i.select("text.multipoint").text(n.pointcount));else{if(i.select("circle").attr("r",u.pointSize/1.25),s.select("circle").attr("r",0),h=o.attr("cx"),c=o.attr("cy"),n.overlapping||r.classed("multipoint",!0),!f.overlapping){o.classed("multipoint",!0);s.append("text").attr("class","multipoint").attr("x",h).attr("y",c).attr("dy",u.pointSize/3+"px").attr("text-anchor","middle").text("2").attr("font-size",u.pointSize+"px").attr("fill",u.pointBorderColor).style("visibility","hidden").transition().delay(ht).on("end",function(){d3.select(this).style("visibility","visible")})}n.overlapping=!0;f.overlapping=!0;n.pointcount=1;f.pointcount=1}})}),yi=rt.length,ct=0;ct<yi;ct++)for(l=rt[ct],lt=0;lt<yi;lt++)if(lt!==ct&&(o=rt[lt],hi=o.isHidden?!1:chartutils.isBBoxOverlappingBBoxOrPoint(l.label,o),hi||chartutils.isBBoxOverlappingPoint(l.label,o.point,f/2))){if(!l.movedDown&&!o.movedDown&&l.label.y>=o.label.y){if(l.label.y+=l.label.height+f*2,hi=o.isHidden?!1:o.movedDown?!0:chartutils.isBBoxOverlappingBBoxOrPoint(l.label,o),!hi&&!chartutils.isBBoxOverlappingPoint(l.label,o.point,f/2)){l.labelElement.attr("transform","translate(0,"+(l.label.height/2+f*2)+")");l.movedDown=!0;o.movedDown=!0;rt[ct]=l;continue}}else if(!l.movedDown&&!o.isHidden)continue;o.labelElement.attr("transform","translate(-1000,-1000)");o.label={x:-1e3,y:-1e3,width:0,height:0};o.movedDown=!1;o.isHidden=!0;rt[lt]=o}oi=oi/vi;si=si/vi;kt=a.ticks();ei.length>0&&(kt=pt.tickValues());ti=kt[0];ii=kt[kt.length-1];dt=p.ticks();fi.length>0&&(dt=ui.tickValues());gt=dt[0];ni=dt[dt.length-1];u.showNormlines&&this.drawNormLines(p,a,ht,ri,bi,gt,ni,ti,ii);u.showAverage&&this.drawAverageLines(p,a,vt,wt,ht,ri,oi,si,gt,ni,ti,ii);u.showRegression&&this.drawRegressionLine(p,a,ht,ri,gt,ni,ti,ii)}}},{key:"updateLabelArray",value:function(n,t){var r=n[t],i=r.labelElement.node().getBBox();r.label={x:i.x,y:i.y,height:i.height,width:i.width+6}}},{key:"drawAverageLines",value:function(n,t,i,r,u,f,e,o,s,h,c,l){var a=this.settings,v;e>=s&&e<=h&&(v=t(c),r&&(v=r(0)),f.append("line").attr("class","average x").attr("stroke",a.averageColor).attr("stroke-width",a.averageWidth).attr("x1",n(e)).attr("y1",v).attr("x2",n(e)).attr("y2",v).transition().duration(u).attr("x2",n(e)).attr("y2",t(l)));o>=c&&o<=l&&f.append("line").attr("class","average y").attr("stroke",a.averageColor).attr("stroke-width",a.averageWidth).attr("x1",n(s)).attr("y1",t(o)).attr("x2",n(s)).attr("y2",t(o)).transition().duration(u).attr("x2",n(h)).attr("y2",t(o))}},{key:"drawNormLines",value:function(n,t,i,r,u,f,e,o,s){var l=this.settings,h=l.normlinesX,c=l.normlinesY;l.showNormAreas&&(h=Math.min(h,e),h=Math.max(h,f),c=Math.min(c,s),c=Math.max(c,o),u.append("rect").attr("class","norm area0").attr("fill",l.normAreaColorList[0]).attr("x",n(f)+1).attr("width",n(h)-n(f)).attr("y",t(c)).attr("height",t(o)-t(c)),u.append("rect").attr("class","norm area1").attr("fill",l.normAreaColorList[1]).attr("x",n(f)+1).attr("width",n(h)-n(f)).attr("y",t(s)).attr("height",t(c)-t(s)),u.append("rect").attr("class","norm area2").attr("fill",l.normAreaColorList[2]).attr("x",n(h)).attr("width",n(e)-n(h)).attr("y",t(s)).attr("height",t(c)-t(s)),u.append("rect").attr("class","norm area3").attr("fill",l.normAreaColorList[3]).attr("x",n(h)).attr("width",n(e)-n(h)).attr("y",t(c)).attr("height",t(o)-t(c)));h>=f&&h<=e&&r.append("line").attr("class","norm x").attr("stroke",l.normlinesColor).attr("stroke-width",l.normlinesWidth).attr("x1",n(h)).attr("y1",t(o)).attr("x2",n(h)).attr("y2",t(o)).transition().duration(i).attr("x2",n(h)).attr("y2",t(s));c>=o&&c<=s&&r.append("line").attr("class","norm y").attr("stroke",l.normlinesColor).attr("stroke-width",l.normlinesWidth).attr("x1",n(f)).attr("y1",t(c)).attr("x2",n(f)).attr("y2",t(c)).transition().duration(i).attr("x2",n(e)).attr("y2",t(c))}},{key:"drawRegressionLine",value:function(n,t,i,r,u,f,e,o){var s=this.settings,h=s.regressionFormula_a+s.regressionFormula_b*u,c=s.regressionFormula_a+s.regressionFormula_b*f,l=u,a=f;h<e?(h=e,l=(h-s.regressionFormula_a)/s.regressionFormula_b):h>o&&(h=o,l=(h-s.regressionFormula_a)/s.regressionFormula_b);c>o?(c=o,a=(c-s.regressionFormula_a)/s.regressionFormula_b):c<e&&(c=e,a=(c-s.regressionFormula_a)/s.regressionFormula_b);r.append("line").attr("class","regression").attr("stroke",s.regressionColor).attr("stroke-width",s.regressionWidth).attr("x1",n(l)).attr("y1",t(h)).attr("x2",n(l)).attr("y2",t(h)).transition().duration(i).attr("x2",n(a)).attr("y2",t(c))}},{key:"getLegendData",value:function(n){var i=this.settings,r=[],t,u,f,e;if(n.length>1)for(t=0;t<n.length;t++)u=i.legendIconDefault,f=n[t].key,e=i.colorList[t],r.push({type:u,color:e,text:f});return r}},{key:"reSize",value:function(){this.draw()}},{key:"defaultTooltip",value:function(n,t,i,r){var h=d3.select(r),u="<span>"+t.name+"<br/>",a=h.attr("data-valuex"),v=h.attr("data-valuey"),o=h.attr("data-valuez"),c=h.classed("multipoint"),l;i.categorySet[2]!==undefined&&c&&(u="<table><tr><td>"+t.name+"<\/td><td>"+o+"<\/td><\/tr>");c&&(l=d3.select(r.parentNode.parentNode),l.selectAll("g.point circle").each(function(n){if(t.name!==n.name&&t.xstring===n.xstring&&t.ystring===n.ystring){var r=d3.select(this).attr("data-valuez");i.categorySet[2]!==undefined?(r=i.dataPostfix.length>0&&r.indexOf(i.dataPostfix)>=0?i.dataPrefix+r:i.dataPrefix+r+i.dataPostfix,u+="<tr><td>"+n.name+"<\/td><td>"+r+"<\/td><\/tr>"):(u+=n.name+"<br/>",o.length>0&&(o+=" | "+r))}}));var f=a,e=v,s=o;return i.dataPostfix.length>0&&f.indexOf(i.dataPostfix)>=0?(f=i.dataPrefix+f,e=i.dataPrefix+e,s=i.dataPrefix+s):(f=i.dataPrefix+f+i.dataPostfix,e=i.dataPrefix+e+i.dataPostfix,s=i.dataPrefix+s+i.dataPostfix),c&&i.categorySet[2]!==undefined?(u+="<\/table>",u=i.categorySet[0]+"<br />"+f+"<br /><br />"+i.categorySet[1]+"<br />"+e+"<br /><br />"+i.categorySet[2]+"<br />"+u):(u+=i.categorySet[0]+": "+f+"<br> "+i.categorySet[1]+": "+e,i.categorySet[2]!==undefined&&o.length>0&&(u+="<br/>"+i.categorySet[2]+": "+s),u+="<\/span>"),n.show(u)}}]),n}();_createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}();ABFCharts_Treemap=function(){function n(t,i){_classCallCheck(this,n);this.defaults={lang:"nl",baseLoc:"",customLang:null,dataset:[],colorList:["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],colorScale:null,dataUnit:"",dataUnit2:"",margin:{top:10,right:10,bottom:10,left:10},showValues:!1,showNames:!0,useTooltip:!0,animate:!1,animateHover:!0,duration:1250,onClickFunction:chartutils.defaultOnClick,onCMFunction:chartutils.defaultOnCM,onTooltipFunction:this.defaultTooltip,onLegendTooltipFunction:null,title:"",titleSubtitle:"",subtitle:"",source:"",nodata:"",showlegend:!1,legendData:[],width:0,height:0,titleMargin:0,titleFontSize:12,titleFontColor:"rgb(0,0,0)",titleBackgroundColor:"rgb(255,255,255)",subtitleFontSize:12,subtitleFontColor:"rgb(0,0,0)",sourceMargin:0,sourceFontSize:12,sourceFontColor:"rgb(0,0,0)",sourceBackgroundColor:"transparent",legendMargin:0,verticalLegendMarginTop:0,legendIconMargin:0,legendIconDefault:"",legendItemsMargin:0,legendFontSize:12,legendFontColor:"rgb(0,0,0)",legendBackgroundColor:"transparent",centerLegendRows:!1,maxLegendWidth:0,legendHeight:0,labelFontSize:10,labelFontColor:"rgb(0,0,0)",labelFontColorContrast:"rgb(255,255,255)",showLabelContrast:!1,chartBackgroundColor:"transparent",validContainer:!0,nrOfDec:null,borderColor:"rgb(0,0,0)",borderWidth:2,showEstimation:!1,showForecast:!1,forecastType:"Solid",forecastDrawStyle:"",forecastColor:"rgb(128,128,128)",estimationType:"Solid",estimationDrawStyle:"",estimationColor:"rgb(128,128,128)",showExtra:!1,extraType:"Solid",extraDataType:"",extraDrawStyle:"",extraColor:"rgb(128,128,128)",secondVar:!1,varCategories:[]};this.settings=chartutils.deepExtend(this.defaults,i);this.settings.container=t;this.containerElement=document.querySelector(t);this.containerElement===null&&(window.console&&console.log("chart element with id "+t+" does not exist"),this.settings.validContainer=!1)}return _createClass(n,[{key:"changeSettings",value:function(n){this.settings=chartutils.deepExtend(this.settings,n)}},{key:"draw",value:function(){var n=this.settings;if(n.validContainer){var i=n.dataset,r=this.containerElement,t=chartutils.getChartDimensions(r);(n.width=t.width,n.height=t.height,n.width<1||n.height<1)||(d3.select(n.container).append("svg").attr("viewBox","0 0 "+n.width+" "+n.height),(n.showEstimation&&n.estimationType!=="Solid"||n.showForecast&&n.forecastType!=="Solid"||n.showExtra&&n.extraType!=="Solid")&&chartutils.addHatchDefs(this),chartutils.drawChartExtras(this,n),i.length<=0)||this.addChart(n.width,n.height,0,0)}}},{key:"addChart",value:function(n,t,i,r){var s,u,e,a,o,f,v,y;if(!(n<1)&&!(t<1)&&(s=this,u=s.settings,u.validContainer)){var p=u.dataset,w=d3.select(u.container+" svg"),h=w.append("g").attr("class","chart").attr("transform","translate("+i+","+r+")"),c=h.append("g").attr("class","elements"),l=u.margin.top,b=u.margin.bottom;chartutils.drawSubtitle(this,n,t,h);e=u.margin.top;a=r===0?u.margin.top:e-l;c.attr("transform","translate(0,"+a+")");o=n-u.margin.left-u.margin.right;f=t-u.margin.top-u.margin.bottom;f-=r===0?u.margin.top:e-l;v=this.getTreemapStructure(u,p,o,f);y=u.animate?u.duration:0;this.drawTreemapParts(c,v.leaves(),o,f,y)}}},{key:"getTreemapStructure",value:function(n,t,i,r){var u=d3.treemap().tile(d3.treemapResquarify).size([i,r]).round(!0),f=d3.hierarchy(t,function(n){return n.children}).sum(function(t){return n.secondVar&&t.value2!==undefined?Math.abs(+t.value2):Math.abs(+t.value)}).sort(function(t,i){return n.secondVar&&t.value2!==undefined&&i.value2!==undefined?i.height-t.height||i.value2-t.value2:i.height-t.height||i.value-t.value});return u(f)}},{key:"drawTreemapParts",value:function(n,t,i,r,u){var o=this,f=o.settings,h=n.selectAll("g.node").data(t).enter().append("g").attr("class","node"),c=chartutils.toolTip(f.useTooltip),e=h.append("rect"),s;o.addMouseInteraction(e,f,c);e.attr("data-title",function(n){return n.data&&n.data.name?n.data.name.replace(/</g,"&lt;").replace(/>/g,"&gt;"):""}).attr("data-code",function(n){return n.data&&n.data.namecode!==undefined&&n.data.namecode!==null?n.namecode:n.name});e.attr("x",0).attr("y",0).attr("width",0).attr("height",0).transition().duration(u).attr("x",function(n){return n.x0}).attr("y",function(n){return n.y0}).attr("width",function(n){var t=n.x1-n.x0;return t>0?t:0}).attr("height",function(n){var t=n.y1-n.y0;return t>0?t:0}).attr("fill",function(n){return f.colorList&&n.data.ci!==undefined?f.colorList[n.data.ci]:f.colorScale(+n.data.value)}).attr("stroke",f.borderColor).attr("stroke-width",f.borderWidth+"px");(f.showEstimation||f.showForecast||f.showExtra)&&(s=n.selectAll("g.node rect"),s.each(function(n){if(n.data.t){var t=n.data.t,o=t==="e"?f.estimationDrawStyle:t==="f"?f.forecastDrawStyle:f.extraDrawStyle,s=t==="e"?f.estimationType:t==="f"?f.forecastType:f.extraType;if(s!=="Solid"){var i=d3.select(this),e=i.node().cloneNode(!0),r=d3.select(e);r.datum(i.datum());r.attr("class","clone").attr("fill","url("+f.baseLoc+f.container+o+"_"+t+")");r.attr("x",0).attr("y",0).attr("width",0).attr("height",0).transition().duration(u).attr("x",function(n){return n.x0}).attr("y",function(n){return n.y0}).attr("width",function(n){var t=n.x1-n.x0;return t>0?t:0}).attr("height",function(n){var t=n.y1-n.y0;return t>0?t:0});i.node().parentNode.appendChild(e)}}}));(f.showNames||f.showValues)&&this.drawTreemapLabels(n,u)}},{key:"drawTreemapLabels",value:function(n,t){var i=this.settings,r=n.selectAll("g.node").append("g").attr("class","label treemap"),u;i.showNames&&(u=r.append("text").attr("class","label").attr("x",function(n){return n.x0+(n.x1-n.x0)/2}).attr("y",function(n){return n.y0+(n.y1-n.y0)/2+i.labelFontSize/3}).attr("font-size",i.labelFontSize+"px").attr("fill",function(n){var t="rgb(255,255,255)";return t=i.colorList&&n.data.ci?i.colorList[n.data.ci]:i.colorScale(n.data.value),chartutils.getContrastLabelColor(i,i.labelFontColor,t)}).text(function(n){return n.data.name}).style("visibility","hidden").transition().delay(t).on("end",function(n){var r=n.x1-n.x0-15,u=n.y1-n.y0,t=d3.select(this);r<10||u<i.labelFontSize?t.remove():(t.style("visibility","visible"),t.call(chartutils.truncate,r,i,"middle"))}));i.showValues&&(this.drawValueLabels(r,t),i.secondVar&&this.drawValueSecondLabels(r,t))}},{key:"drawValueLabels",value:function(n,t){var i=this.settings;n.append("text").attr("class","value").attr("x",function(n){return n.x0+(n.x1-n.x0)/2}).attr("y",function(n){return n.y0+(n.y1-n.y0)/2+i.labelFontSize*1.5}).attr("font-size",function(n){var u=i.width,f=i.height,e=n.x1-n.x0,o=n.y1-n.y0,r=o*e/(u*f)*100,t=i.labelFontSize;return r>25?t=i.labelFontSize*2.5:r>15?t=i.labelFontSize*2:r>10?t=i.labelFontSize*1.5:r>5&&(t=i.labelFontSize*1.25),t+"px"}).attr("fill",function(n){var t="rgb(255,255,255)";return t=i.colorList&&n.data.ci!==undefined?i.colorList[n.data.ci]:i.colorScale(n.data.value),chartutils.getContrastLabelColor(i,i.labelFontColor,t)}).text(function(n){var t;return i.secondVar?(t=n.data.value2,n.data.valstr2!==undefined&&n.data.valstr2!==null?n.data.valstr2:t?chartutils.numberFormat(t,"",i.lang,i.customLang)+i.dataUnit2:""):(t=n.data.value,n.data.valstr!==undefined&&n.data.valstr!==null?n.data.valstr:t?chartutils.numberFormat(t,"",i.lang,i.customLang)+i.dataUnit:"")}).style("visibility","hidden").transition().delay(t).on("end",function(n){var f=n.x1-n.x0-15,s=n.y1-n.y0,t=d3.select(this),h=t.node().getBBox().width,e=t.node().getBBox().height,r=t.node().parentNode.childNodes.length,o=r>1?i.labelFontSize:i.labelFontSize/2,u=!1;f<10||f<h||s<o+e?u=!0:(t.attr("y",n.y0+(n.y1-n.y0)/2+o).style("visibility","visible"),chartutils.wrapCenterText(t,i),r>1&&t.attr("dy",e/2));(r>1&&!u||r>2)&&d3.select(t.node().parentNode).attr("transform","translate(0,"+-i.labelFontSize/2+")");u&&t.remove()}).attr("text-anchor","middle")}},{key:"drawValueSecondLabels",value:function(n,t){var i=this.settings;n.append("rect").attr("class","labelBG treemap").attr("x",0).attr("y",0).attr("width",0).attr("height",0);n.append("text").attr("class","value2").attr("x",function(n){return n.x1}).attr("y",function(n){return n.y1}).attr("font-size",i.labelFontSize*.85+"px").attr("fill",function(n){var t="rgb(255,255,255)";return t=i.colorList&&n.data.ci!==undefined?i.colorList[n.data.ci]:i.colorScale(n.data.value),chartutils.getContrastLabelColor(i,i.labelFontColor,t)}).text(function(n){var t=n.data.value;return n.data.valstr!==undefined&&n.data.valstr!==null?n.data.valstr:t?chartutils.numberFormat(t,"",i.lang,i.customLang)+i.dataUnit:""}).style("visibility","hidden").transition().delay(t).on("end",function(n){var e=n.x1-n.x0-15,s=n.y1-n.y0,r=d3.select(this),h=d3.select(r.node().parentNode),u=r.node().getBBox(),f=u.width,o=u.height,c=r.node().parentNode.childNodes.length,l=c>1?i.labelFontSize*1.4:i.labelFontSize/2,t;r.attr("x",n.x1-10);e<10||e<f||s<l+o*3?r.remove():(t=h.select("rect.labelBG"),t.attr("width",f+10),t.attr("x",n.x1-15-f),t.attr("y",u.y),t.attr("height",o),t.attr("fill","rgba(255,255,255,0.1)"),t.attr("rx",5),r.style("visibility","visible"))}).attr("text-anchor","end")}},{key:"addMouseInteraction",value:function(n,t,i){n.on("mouseover, mousemove",function(n){if(!n.data.ignoreTT){var r=d3.select(this);t.animateHover&&r.classed("hover",!0);t.onTooltipFunction(i,n,t,this)}}).on("mouseout",function(){if(t.animateHover){var n=d3.select(this);n.classed("hover",!1)}i.hide()}).on("click touchstart",t.onClickFunction).on("contextmenu",t.onCMFunction)}},{key:"reSize",value:function(){this.draw()}},{key:"triggerMouseOverByCode",value:function(){}},{key:"triggerMouseOutByCode",value:function(){}},{key:"defaultTooltip",value:function(n,t,i){var f="",e,r,u;if(t.data)return e=i.secondVar&&i.varCategories.length>1,r=t.data.name,r&&r.length>0&&(r=r.replace(/\\n/g," "),f+=e?r+"<br />":r+": "),u=t.data.value,u=t.data.valstr!==undefined&&t.data.valstr!==null?t.data.valstr:chartutils.numberFormat(u,"",i.lang,i.customLang),e&&(f+=i.varCategories[0]+": "),f+=u,e&&(f+="<br />",u=t.data.value2,u=t.data.valstr2!==undefined&&t.data.valstr2!==null?t.data.valstr2:chartutils.numberFormat(value2,"",i.lang,i.customLang),f+=i.varCategories[1]+": "+u),n.show("<span>"+f+"<\/span>")}},{key:"showTooltip",value:function(n,t){var i=chartutils.toolTip(!0);i.show(n,t)}},{key:"hideTooltip",value:function(){var n=chartutils.toolTip(!0);n.hide()}}]),n}();chartutils={deepExtend:function(n){for(var i,t,r=chartutils.clone(n)||{},u=1;u<arguments.length;u++)if(i=arguments[u],i)for(t in i)i.hasOwnProperty(t)&&(r[t]=typeof i[t]=="object"&&i[t]!==null&&t.indexOf("dataset")<0?chartutils.deepExtend(r[t],i[t]):i[t]);return r},clone:function(n){var r,t,i;if(!n)return n;if(r=[Number,String,Boolean],r.forEach(function(i){n instanceof i&&(t=i(n))}),typeof t=="undefined")if(Object.prototype.toString.call(n)==="[object Array]")t=[],n.forEach(function(n,i){t[i]=chartutils.clone(n)});else if(typeof n=="object"){if(n.nodeType&&typeof n.cloneNode=="function")t=n.cloneNode(!0);else if(!n.prototype)if(n instanceof Date)t=new Date(n);else{t={};for(i in n)t[i]=chartutils.clone(n[i])}}else t=n;return t},toolTip:function(n){var i={},r=document.querySelector("div.chart-tooltip"),t;return(r===null||r.length===0)&&(t=document.createElement("div"),t.style.display="none",t.classList?t.classList.add("chart-tooltip"):t.className="chart-tooltip",document.body.appendChild(t)),i.div=d3.select("div.chart-tooltip"),i.useTooltip=n,i.show=function(n,t){var f;if(this.useTooltip){var i=this.div,u=10,r=-25;d3.event?(u+=d3.event.pageX,r+=d3.event.pageY):t&&(u+=t.x,r+=t.y);i.html(n);i.style("left",u+"px");i.style("top",r+"px");i.style("display","inline-block");var e=chartutils.getDocumentWidth(),h=chartutils.getDocumentHeight(),o=i.node().getBoundingClientRect(),s=o.width;u+s>e&&(i.style("left",e-s*1.5+"px"),r+=35,i.style("top",r+"px"));f=o.height;r+f>h+window.pageYOffset&&i.style("top",r-f*1.5+"px")}},i.hide=function(){this.div.style("display","none")},i},defaultOnClick:function(){return},defaultOnCM:function(){return},defaultTooltip:function(n,t,i,r,u){var s=d3.select(r),o=t.x?t.x:"",f,e;return t.name&&(o+=o.length>0?", ":"",o+=t.name),f=s.attr("data-value"),f===null&&(f=t.ystring!==undefined?f=t.ystring:Number(t.y).toLocaleString()),u?(e=f,e=i.dataPostfix.length>0&&f.indexOf(i.dataPostfixY1)>=0?i.dataPrefixY1+f:i.dataPrefixY1+f+i.dataPostfixY1,n.show("<span>"+o+": "+e+"<\/span>")):(e=f,e=i.dataPostfix.length>0&&f.indexOf(i.dataPostfix)>=0?i.dataPrefix+f:i.dataPrefix+f+i.dataPostfix,n.show("<span>"+o+": "+e+"<\/span>"))},getDocumentWidth:function(){var n=0;return typeof innerWidth=="number"?n=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?n=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(n=document.body.clientWidth),n},getDocumentHeight:function(){var n=0;return typeof innerHeight=="number"?n=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?n=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(n=document.body.clientHeight),n},drawText:function(n,t,i,r){var u=n.settings,o,h;if(t.length>0){var k=n.containerElement,v=u.height,l=u.width,d=d3.select(k).select("svg"),w=0,b=d.append("g").attr("class",r+"Group"),g=b.append("rect"),y="white",nt=b.append("g").attr("class",r),a=14,p="rgb(0,0,0)",f=0;r==="title"||r==="nodata"?(a=u.titleFontSize,p=u.titleFontColor,y=u.titleBackgroundColor||"white",f=u.titleMargin):r==="titlesubtitle"?(p=u.titleFontColor,y=u.titleBackgroundColor||"white",f=u.titleMargin):r==="source"&&(a=u.sourceFontSize,p=u.sourceFontColor,y=u.sourceBackgroundColor,f=u.sourceMargin);o=nt.append("text").attr("font-size",a+"px").attr("font-weight",r==="title"?"bold":"normal").attr("fill",p).text(t).attr("dy",0);o.call(this.wrap,l,u);h="topcenter";i&&(h=i);var s=o.node().getBBox(),w=s.height,c=0,e=0;switch(h){case"topleft":c=u.margin.top+a+f;e=0+s.width/2;break;case"topcenter":c=u.margin.top+a+f;e=l/2;break;case"topright":c=u.margin.top+a+f;e=l-s.width;break;case"bottomleft":c=v-u.margin.bottom-f;e=0+s.width/2;break;case"bottomcenter":c=v-u.margin.bottom-f;e=l/2;break;case"bottomright":c=v-u.margin.bottom-f;e=l-s.width;break;case"center":c=v/2;e=l/2}r==="source"&&(h==="topleft"||h==="bottomleft")?(o.selectAll("tspan").attr("text-anchor","start"),o.attr("transform","translate(15,-5)")):r==="source"&&(h==="topright"||h==="bottomright")?(o.selectAll("tspan").attr("text-anchor","start"),e-=u.margin.right+15,o.attr("transform","translate("+e+",-5)")):o.attr("transform","translate("+e+",0)");o.attr("y",c);s=o.node().getBBox();g.attr("fill",y).attr("x",s.x).attr("width",s.width).attr("y",s.y).attr("height",w).attr("transform","translate("+e+",0)")}switch(h){case"topleft":case"topcenter":case"topright":u.margin.top+=w+5+f*2;break;case"bottomleft":case"bottomcenter":case"bottomright":u.margin.bottom+=w+f*2}},drawSubtitle:function(n,t,i,r){var u=n.settings,v;if(u.subtitle.length>0){var s=u.subtitleFontSize,p=u.subtitleFontColor,c=0,y=r.append("g").attr("class","subtitleGroup"),w=y.append("rect"),b=y.append("g").attr("class","subtitle"),e=b.append("text").attr("font-size",s+"px").attr("fill",p).text(u.subtitle).attr("dy",0);u.truncateSubtitle?(e.call(this.truncate,t,u),e.append("title").text(u.subtitle)):e.call(this.wrap,t,u);var f=e.node().getBBox(),c=f.height,l=u.subtitlePosition?u.subtitlePosition:"topcenter",h=0,o=0,a=u.title.length>0?u.margin.top:0;switch(l){case"topleft":h=a+s;o=0+f.width/2;break;case"topcenter":h=a+s;o=t/2;break;case"topright":h=a+s;o=t-f.width;break;case"bottomleft":h=i-u.margin.bottom-s;o=0+f.width/2;break;case"bottomcenter":h=i-u.margin.bottom-s;o=t/2;break;case"bottomright":h=i-u.margin.bottom-s;o=t-f.width}v=0;e.selectAll("tspan").size()>1&&l.indexOf("top")<0&&(v=c/2);e.attr("transform","translate("+o+",0)");e.attr("y",h-v);f=e.node().getBBox();w.attr("fill","transparent").attr("x",f.x).attr("width",f.width).attr("y",f.y).attr("height",c).attr("transform","translate("+o+",0)")}switch(l){case"topleft":case"topcenter":case"topright":u.margin.top+=c;break;case"bottomleft":case"bottomcenter":case"bottomright":u.margin.bottom+=c}},getYAxis:function(n,t,i,r,u,f){var o=u.settings,h,d=o.inlineAxis?-2:10,g=-n,p,l,e,c,a,s,v,b;if(h=d3.axisLeft().scale(i).tickSizeInner(g).tickSizeOuter(0).tickPadding(d),r.length>0)h.tickValues(r).tickFormat(function(n){return o.dataPrefix+chartutils.numberFormat(n,"",o.lang,o.customLang)+o.dataPostfix});else{for(p=i.ticks(),l=0,s=0;s<p.length;s++)l=Math.max(l,chartutils.nbrOfDecimals(p[s]));h.ticks().tickFormat(function(n){return o.dataPrefix+chartutils.numberFormat(n,l,o.lang,o.customLang)+o.dataPostfix})}for(e=i.ticks(),r.length>0&&(e=r),c=o.axisTickSpace,(!c||c<o.axisYFontSize)&&(c=o.axisYFontSize);e.length>2&&t/e.length<c;){for(a=[],s=0;s<e.length;s++)s%2==0&&a.push(e[s]);e=a;h.tickValues(a)}if(f&&e.length>2&&(v=i.domain(),b=+e[e.length-1],b<v[1])){var k=+e[e.length-1]-+e[e.length-2],y=+e[e.length-1]+k,w=chartutils.nbrOfDecimals(k),w=w>3?3:w;y=y.toFixed(w);e.push(y);v[1]=y;h.tickValues(e);i.domain(v)}return h},drawYAxis:function(n,t,i,r,u,f){var s=t.settings,l=s.axisYFontSize,y=s.axisYFontColor,v=s.rotationy<270&&s.rotationy>90||s.rotationy<-90&&s.rotationy>-270?"start":"end",k=f?"y axis left broken":"y axis left",h=i.append("g").attr("class",k),c,p,a,e,o;if(s.inlineAxis&&(v=v==="start"?"end":"start"),h.call(n),s.showAxes){if(c=h.selectAll("text"),c.attr("transform","rotate("+s.rotationy+",-10,0)").attr("text-anchor",v).attr("font-size",l+"px").attr("fill",y).attr("dy",s.inlineAxis?-(l/3):l/3+"px"),p=c.nodes()[c.size()-1].getBBox().width,a=0,c.each(function(){var n=this.getBBox().width-p;n>a&&(a=n)}),!f){var w=h.append("text"),b=i.select(".y.axis").selectAll("g.tick").nodes(),d=d3.select(b[b.length-1]).select("text").node().getBBox().x;w.attr("y",r/2).attr("x",d-10-a).style("text-anchor","middle").attr("font-size",l+"px").attr("fill",y).text(s.dataUnit);w.attr("transform",function(){var t=d3.select(this).attr("x"),n;return t===null&&(t=0),n=d3.select(this).attr("y"),n===null&&(n=0),"rotate(-90, "+t+","+n+")"}).call(this.wrapYUnit,r)}h.selectAll("line").attr("opacity",s.showGridLines?.2:0).attr("stroke",s.gridLineColor);f?(h.selectAll("line").attr("opacity","0"),s.inlineAxis?(s.mirrored?(h.select("path.domain").each(function(){e=this.getBBox()}),o="M"+u/2+","+(e.y+e.height*6/8+e.height/2)+"L"+(u/2+5)+","+(e.y+e.height*5/8+e.height/2),o+="M"+(u/2+5)+","+(e.y+e.height*5/8+e.height/2)+"L"+(u/2-8)+","+(e.y+e.height/2+e.height/2),o+="M"+(u/2-8)+","+(e.y+e.height/2+e.height/2)+"L"+(u/2+8)+","+(e.y+e.height*3/8+e.height/2),o+="M"+(u/2+8)+","+(e.y+e.height*3/8+e.height/2)+"L"+u/2+","+(e.y+e.height/4+e.height/2),h.select("g.tick").remove()):(h.select("path.domain").each(function(){e=this.getBBox()}),o="M"+u/2+","+(e.y+e.height*6/8)+"L"+(u/2+5)+","+(e.y+e.height*5/8),o+="M"+(u/2+5)+","+(e.y+e.height*5/8)+"L"+(u/2-8)+","+(e.y+e.height/2),o+="M"+(u/2-8)+","+(e.y+e.height/2)+"L"+(u/2+8)+","+(e.y+e.height*3/8),o+="M"+(u/2+8)+","+(e.y+e.height*3/8)+"L"+u/2+","+(e.y+e.height/4)),c.remove()):s.mirrored?(h.select("path.domain").each(function(){e=this.getBBox()}),o="M0.5,"+e.y+"L0.5,"+(e.y+e.height*6/8),o+="M0.5,"+(e.y+e.height*6/8+e.height/2)+"L5,"+(e.y+e.height*5/8+e.height/2),o+="M5,"+(e.y+e.height*5/8+e.height/2)+"L-8,"+(e.y+e.height/2+e.height/2),o+="M-8,"+(e.y+e.height/2+e.height/2)+"L8,"+(e.y+e.height*3/8+e.height/2),o+="M8,"+(e.y+e.height*3/8+e.height/2)+"L0.5,"+(e.y+e.height/4+e.height/2),o+="M0.5,"+(e.y+e.height*6/8+e.height/2)+"L0.5,"+(e.y+e.height+e.height)):(h.select("path.domain").each(function(){e=this.getBBox()}),o="M0.5,"+e.y+"L0.5,"+(e.y+e.height/4),o+="M0.5,"+(e.y+e.height*6/8)+"L5,"+(e.y+e.height*5/8),o+="M5,"+(e.y+e.height*5/8)+"L-8,"+(e.y+e.height/2),o+="M-8,"+(e.y+e.height/2)+"L8,"+(e.y+e.height*3/8),o+="M8,"+(e.y+e.height*3/8)+"L0.5,"+(e.y+e.height/4),o+="M0.5,"+(e.y+e.height*6/8)+"L0.5,"+(e.y+e.height)),h.select("g.tick").remove(),h.select("path.domain").attr("d",o)):s.inlineAxis&&h.select("path.domain").attr("opacity",0);h.select("path.domain").attr("stroke",s.axisColor)}else h.selectAll("text").remove(),i.selectAll(".y.axis").selectAll("line").remove(),h.selectAll("path.domain").attr("stroke-width","0px")},drawY1Axis:function(n,t,i,r,u,f,e){var s=t.settings,l=s.axisYFontSize,v=s.axisYFontColor,a=s.rotationy<270&&s.rotationy>90||s.rotationy<-90&&s.rotationy>-270?"end":"start",k=e?"y axis right broken":"y axis right",h=i.append("g").attr("class",k),y,o,c;if(s.inlineAxis&&(a=a==="start"?"end":"start"),h.attr("transform","translate( "+r+", 0 )").call(n),y=h.selectAll("text"),h.selectAll("text").attr("transform","rotate("+s.rotationy+",10,0)").attr("text-anchor",a).attr("font-size",l+"px").attr("fill",v).attr("dy",s.inlineAxis?-(l/3):l/3+"px"),!e){var p=h.append("text"),w=i.select(".y.axis.right").selectAll("g.tick").nodes(),b=d3.select(w[w.length-1]).select("text").node().getBBox(),d=b.x,g=b.width;p.attr("y",u/2).attr("x",d+g+10).style("text-anchor","middle").attr("font-size",l+"px").attr("fill",v).text(s.dataUnitY1);p.attr("transform",function(){var t=d3.select(this).attr("x"),n;return t===null&&(t=0),n=d3.select(this).attr("y"),n===null&&(n=0),"rotate(90, "+t+","+n+")"})}h.selectAll("line").attr("opacity","0").attr("stroke",s.gridLineColor);e?(h.selectAll("line").attr("opacity","0"),s.inlineAxis?(h.select("path.domain").each(function(){o=this.getBBox()}),f=f>20?f:20,c="M-"+f/2+","+(o.y+o.height*6/8)+"L-"+(f/2-5)+","+(o.y+o.height*5/8),c+="M-"+(f/2-5)+","+(o.y+o.height*5/8)+"L-"+(f/2+8)+","+(o.y+o.height/2),c+="M-"+(f/2+8)+","+(o.y+o.height/2)+"L-"+(f/2-8)+","+(o.y+o.height*3/8),c+="M-"+(f/2-8)+","+(o.y+o.height*3/8)+"L-"+f/2+","+(o.y+o.height/4),y.remove()):(h.select("path.domain").each(function(){o=this.getBBox()}),c="M"+o.x+","+(o.y+o.height)+"H0.5V"+(o.y+o.height*5/8-2)+"H0.5",c+="M-6,"+(o.y+o.height/2)+"L6,"+(o.y+o.height*3/8),c+="M-6,"+(o.y+o.height*5/8)+"L6,"+(o.y+o.height/2),c+="M"+o.x+","+(o.y+o.height*3/8+2)+"H0.5V"+o.y+"H0.5"),h.select("path.domain").attr("d",c)):s.inlineAxis&&h.select("path.domain").attr("opacity",0)},getY1Axis:function(n,t,i,r,u){var f=u.settings,l=f.inlineAxis?-2:10,c=d3.axisRight().scale(i).tickSizeInner(-n).tickSizeOuter(0).tickPadding(l).ticks().tickValues(r).tickFormat(function(n){return f.dataPrefixY1+chartutils.numberFormat(n,"",f.lang,f.customLang)+f.dataPostfixY1}),e=i.ticks(),o,h,s;for(r.length>0&&(e=r),o=f.axisTickSpace,(!o||o<f.axisYFontSize)&&(o=f.axisYFontSize);e.length>2&&t/e.length<o;){for(h=[],s=0;s<e.length;s++)s%2==0&&h.push(e[s]);e=h;c.tickValues(h)}return c},getXAxis:function(n,t,i,r){var h,y,f,g,u=i.settings,e=u.dataset,c=u.skipLabel>0?u.skipLabel:1,nt=u.axisXLength?u.axisXLength/c:Math.ceil(e.length/n.length)/c,l=20,ut=!0,b,k,a,d,p,v,tt,it,rt,w,et,ot;if(u.autoRotation||u.autoXSplitText){b=d3.select(u.container+" svg");k=e.map(function(n){return n.x});k.sort(function(n,t){return t.length>n.length?1:n.length>t.length?-1:0});f=k[0];var o=b.append("text").text(f).attr("font-size",u.axisXFontSize+"px").attr("transform","rotate("+u.rotation+")"),ft=o.node().getBBox(),s=ft.width*1.1,st=ft.height;if(o.remove(),l=s,a=.95*r/nt,u.type&&u.type==="line"&&(d=u.width-r-1.3*u.margin.right,d<a&&d>0&&(a=d)),a<l&&(l=a,u.autoRotation&&(p=k.map(function(n){return n.split(" ")}),p=p.reduce(function(n,t){return n.concat(t)},[]),p.sort(function(n,t){return t.length>n.length?1:n.length>t.length?-1:0}),f=p[0],o=b.append("text").attr("font-size",u.axisXFontSize+"px").text(f),s=o.node().getBBox().width*1.1,o.remove(),s>a&&(u.rotation=270,l=st)),u.rotation!==270)){for(ut=!1,o=b.append("text").attr("font-size",u.axisXFontSize+"px"),h=0;h<e.length;h++){for(g=e[h].x.split(" "),v="",f="",y=0;y<g.length;y++)y>0&&(f+=" "),f+=g[y],o.text(f),s=o.node().getBBox().width*1.1,s>a&&(tt=f.lastIndexOf(" "),it=f.substr(0,tt),it.length>0&&(v+=it+"\n"),f=f.substr(tt+1),u.autoXSplitText&&(o.text(f),s=o.node().getBBox().width,s>l&&(l=s)));v+=f;e[h].x=v;u.medianDataset!==null&&typeof u.medianDataset=="object"&&u.medianDataset.length===e.length&&(u.medianDataset[h].x=v);u.datasetY1!==null&&u.datasetY1!==undefined&&u.datasetY1.length===e.length&&(u.datasetY1[h].x=v)}o.remove()}t.domain(e.map(function(n){return n.xcode?n.xcode:n.xshort?n.xshort:n.x}))}while(Math.round(.95*(r/nt))<Math.round(l))u.skipLabel>0?c+=u.skipLabel:c++,nt=u.axisXLength?u.axisXLength/c:Math.ceil(e.length/n.length)/c;return rt=!1,w=null,e.length>0&&e[0].xcode&&(rt=!0,w=d3.nest().key(function(n){return n.xcode}).entries(e)),et=t.domain().filter(function(n,t){if(n!==undefined){var i=n;return i.indexOf("_skiplabel_")>=0?!1:(rt&&(i=w[t].values[0].xshort?w[t].values[0].xshort:w[t].values[0].x),i.indexOf("\n")>=0&&ut?!0:!(t%c))}}),ot=d3.axisBottom().scale(t).tickSizeInner(0).tickSizeOuter(0).tickPadding(10).ticks(e.length).tickValues(et),ot},getXAxisLinear:function(n,t,i,r){var u=t.settings,h=u.skipLabel>0?u.skipLabel:1,f=r.length>0?r:n.ticks(),c=f.length/h,e=20,o=f[f.length-1],b=d3.select(u.container+" svg"),l,s,p,w;for(u.mirrored&&(i=i/2),isNaN(Number(o))||(o=Number(o).toLocaleString()),l=0;l<f.length;l++)s=f[l],isNaN(Number(s))||(s=Number(s).toLocaleString()),s.length>o.length&&(o=s);o+=u.dataPostfix;var v=b.append("text").text(o).attr("font-size",u.axisXFontSize+"px").attr("transform","rotate("+u.rotation+")"),y=v.node().getBBox(),a=y.width,k=y.height;for(v.remove(),e=a,u.autoRotation?i/(c*1.15)<e&&(e=k,u.rotation=270):!u.autoRotation&&u.autoXSplitText&&(e=1.25*e);i/(c*1.15)<e;)u.skipLabel>0?h+=u.skipLabel:h++,c=f.length/h;return u.autoRotation&&i/(c*1.15)>=a&&(e=a,u.rotation=0),p=f.filter(function(n,t){return!(t%h)}),w=d3.axisBottom().scale(n).tickSizeInner(0).tickSizeOuter(0).tickPadding(10).ticks().tickValues(p).tickFormat(function(n){return u.dataPrefix+chartutils.numberFormat(n,"",u.lang,u.customLang)+u.dataPostfix}),w},drawXAxis:function(n,t,i,r,u,f,e,o,s,h,c){var l=t.settings,d=l.axisXFontColor,p=l.axisXFontSize,nt=h?"x axis broken":"x axis",v=i.append("g").attr("class",nt),y,k,b,w,a,g;v.call(n);y=v.selectAll("text");l.showAxes&&l.showAxisXLabels&&(o&&y.text(function(n,t){if(p<=0)return"";for(var i=t;i<s.length;i++)if(s[i].key===n)return s[i].values[0].xshort?s[i].values[0].xshort:s[i].values[0].x;return s[t].values[0].xshort?s[t].values[0].xshort:s[t].values[0].x}),l.rotation===270&&y.text(function(n,t){var i=n,r,f,e,h;if(isNaN(n)||(i=n.toLocaleString()),o)for(r=t;r<s.length;r++)if(s[r].key===n){i=s[r].values[0].x;break}return f=d3.select(this).node().getBBox().width,f>u/2?(e=u/2/f,h=Math.round(i.length*e),i.substr(0,h)+"..."):i}),p<=0?y.remove():(y.attr("text-anchor","middle").call(this.wrapXLabel).attr("transform",function(){var n=d3.select(this).attr("x"),t;return n===null&&(n=0),t=d3.select(this).attr("y"),"rotate("+l.rotation+", "+n+","+t+")"}),l.rotation>0&&l.rotation<180||l.rotation<-180&&l.rotation>-360?y.style("text-anchor","start"):(l.rotation<360&&l.rotation>180||l.rotation<0&&l.rotation>-180)&&y.style("text-anchor","end"),k=Math.abs(l.rotation),k!==0&&k!==180&&k!==360&&y.selectAll("tspan").attr("dy",function(){var n=d3.select(this).attr("dy");return n===null&&(n=0),n=n.replace("em",""),n/3+"em"}),y.attr("data-title",function(n,t){var r,i;if(o){for(r=s[t].values[0].x,i=t;i<s.length;i++)if(s[i].key===n){r=s[i].values[0].x;break}return r.replace(/</g,"&lt;").replace(/>/g,"&gt;")}return n}).attr("data-code",function(n){return n}).attr("fill",d).attr("font-size",p+"px")),b=Math.ceil(v.node().getBBox().height),l.margin.bottom+=b+f,l.showAxisXLabels&&!h&&(u-=b+f));l.showAxes&&l.showAxisXLabels||y.remove();v.attr("transform","translate(0,"+u+")");v.selectAll("line").attr("visibility","hidden");v.selectAll("g.tick").attr("data-title",function(n,t){var r,i;if(o){for(r=s[t].values[0].x,i=t;i<s.length;i++)if(s[i].key===n){r=s[i].values[0].x;break}return r.replace(/</g,"&lt;").replace(/>/g,"&gt;")}return n}).attr("data-code",function(n){return n});v.selectAll("text").on("click touchstart",l.onClickFunction).on("contextmenu",l.onCMFunction);return(i.select(".x.axis").selectAll("path").attr("stroke",l.axisColor).attr("stroke-width",function(){return l.showAxes?"1px":"0px"}),l.inlineAxis&&(w="M0,0V0.5H"+r+"V0",e&&c>0&&!h?w="M"+c+",0V0.5H"+r+"V0":e&&c>0&&h&&(v.select("path.domain").each(function(){a=this.getBBox()}),w="M"+a.x+",0.5L"+(a.x+a.width/4)+",0.5",w+="M"+(a.x+a.width*6/8)+",0.5L"+(a.x+a.width*5/8)+",5",w+="M"+(a.x+a.width*5/8)+",5L"+(a.x+a.width/2)+",-8",w+="M"+(a.x+a.width/2)+",-8L"+(a.x+a.width*3/8)+",8",w+="M"+(a.x+a.width*3/8)+",8L"+(a.x+a.width/4)+",0.5",w+="M"+(a.x+a.width*6/8)+",0.5L"+(a.x+a.width)+",0.5"),g=h?".x.axis.broken":".x.axis",i.select(g).select("path.domain").attr("d",w),h&&i.select(g).select("g.tick").remove()),e&&!h)?(this._drawXAxisTitle(v,l.showAxisXLabels?b:0,f,u,r,p,d,l.dataUnitY1,l),u-p-f/2):e?(v.attr("transform","translate(0,"+Math.round(u-p-f/2)+")"),u-p-f/2):l.xAxisTitle?(this._drawXAxisTitle(v,l.showAxisXLabels?b:0,f,u,r,p,d,l.xAxisTitle,l),Math.round(u-p-f/2)):u},_drawXAxisTitle:function(n,t,i,r,u,f,e,o){var s=n.append("text");s.attr("y",t+i).attr("x",u/2).style("text-anchor","middle").attr("font-size",f+"px").attr("fill",e).text(o);n.attr("transform","translate(0,"+Math.round(r-f-i/2)+")")},drawZeroLine:function(n,t,i){var r=t.tickValues(),u,f;r===null&&(r=n.ticks());r.indexOf(0)>=0?(u=r.indexOf(0),i.selectAll(".y.axis").select("g.tick:nth-child("+(u+2)+")").select("line").attr("opacity","1").attr("stroke","black")):(f=i.select(".y.axis").select("line").attr("x2"),i.selectAll(".y.axis").append("g").attr("class","tick").attr("transform","translate(0,"+n(0)+")").append("line").attr("opacity",1).attr("stroke","black").attr("x2",f))},wrapXLabel:function(n){n.each(function(){var n=d3.select(this),t=n.text().split("\n").reverse(),i,u=n.attr("y"),f=parseFloat(n.attr("dy")),r=0;for(n.text(null);t.length>0;)i=t.pop(),n.append("tspan").attr("x",0).attr("y",u).attr("dy",r*1.1+f+"em").text(i),r++})},wrapYLabel:function(n){n.each(function(){var n=d3.select(this),i=n.text().split("\n").reverse(),r,t=n.attr("y"),f=parseFloat(n.attr("dy")),u=0;for(n.text(null),t||(t=0);i.length>0;)r=i.pop(),n.append("tspan").attr("x",-10).attr("y",t).attr("dy",u*1.1+f+"em").text(r),u++})},wrapYUnit:function(n,t){n.each(function(){for(var n=d3.select(this),u=n.node().getComputedTextLength(),i=n.text(),r=i;u>t&&i.length>0;)i=i.slice(0,-1),r=i+"...",n.text(r),u=n.node().getComputedTextLength();n.text(null).append("tspan").text(r)})},wrapLegendLabels:function(n,t){n.each(function(){for(var r=d3.select(this),e=r.text().split(/(-|\s+)/).reverse(),i,n=[],h=0,o=r.attr("y"),s=r.attr("x"),u=r.text(null).append("tspan").attr("x",s).attr("y",o).attr("dy","0em").attr("text-anchor","start"),f;e.length>0;)i=e.pop(),n.push(i),f=n.indexOf("-"),f>0&&f<n.length-1&&(i=[n.pop(),n.pop(),n.pop()].reverse().join(""),n.push(i)),u.text(n.join(" ")),u.node().getComputedTextLength()>t*.95&&(n.pop(),u.text(n.join(" ")),n=[i],u=r.append("tspan").attr("x",s).attr("y",o).attr("dy",++h*1+"em").attr("text-anchor","start").text(i))})},wrap:function(n,t,i){n.each(function(){for(var n=d3.select(this),f=n.text().split(/\s+/).reverse(),r,i=[],s=0,e=n.attr("y"),o=parseFloat(n.attr("dy")),u=n.text(null).append("tspan").attr("x",0).attr("y",e).attr("dy",o+"em").attr("text-anchor","middle");f.length>0;)r=f.pop(),i.push(r),u.text(i.join(" ")),u.node().getComputedTextLength()>t*.95&&(i.pop(),u.text(i.join(" ")),i=[r],u=n.append("tspan").attr("x",0).attr("y",e).attr("dy",++s*1.1+o+"em").attr("text-anchor","middle").text(r))});i.titleHeight?i.titleHeight+=n.node().getBBox().height:i.titleHeight=n.node().getBBox().height},truncate:function(n,t,i,r){n.each(function(){var i=d3.select(this),u=i.text(),n=u,f=i.node().getBBox().width,e=r&&r.length>0?r:"middle";for(i.attr("text-anchor",e);u.length>0&&f>t*.95;)n=n.substr(0,n.length-1),i.text(n),f=i.node().getBBox().width;u!==n&&(n+="...",i.text(n))});i.titleHeight?i.titleHeight+=n.node().getBBox().height:i.titleHeight=n.node().getBBox().height},wrapRadarLabels:function(n,t,i){n.each(function(n,r){var u=d3.select(this),y=u.node().getBBox().height,c=u.text().trim().split(/\s+/).reverse(),s,f=[],e=0,l=1,a=u.attr("y"),h=y,v=u.attr("x"),o=u.text(null).append("tspan").attr("x",v).attr("y",a);for(o.attr("dy",e*h+"px");c.length>0;)s=c.pop(),f.push(s),o.text(f.join(" ")),o.node().getComputedTextLength()>t*.95&&(f.pop(),o.text(f.join(" ")),f=[s],o=u.append("tspan").attr("x",v).attr("y",a).attr("dy",++e*l*h+"px").text(s));r!==0||i||(e=e*-1-1,u.selectAll("tspan").each(function(){d3.select(this).attr("dy",++e*l*h+"px")}))})},drawLegend:function(n,t,i){var r=t.settings,u;if(n===null||n.length<=0){if(r.legendHeight<=0)return;n=[]}u=i&&r.labelLegendPosition?r.labelLegendPosition:r.legendPosition?r.legendPosition:"bottom";switch(u){case"top":case"bottom":this.drawHorizontalLegend(n,u,t);break;case"left":case"right":this.drawVerticalLegend(n,u,t)}var e=t.containerElement,o=d3.select(e).select("svg").select("g.legend"),f=chartutils.toolTip(r.useTooltip);o.selectAll("text, rect, circle").each(function(){var n=d3.select(this),i=n.attr("data-chartrefcode");if(t.triggerMouseOverByCode&&i)n.on("mouseover",function(){t.triggerMouseOverByCode(i)}).on("mouseout",function(){t.triggerMouseOutByCode(i)});if(t.settings.onLegendTooltipFunction!==null)n.on("mouseover, mousemove",function(){t.settings.onLegendTooltipFunction(f,this)}).on("mouseout",function(){f.hide()})})},drawHorizontalLegend:function(n,t,i){var f=i.settings,ui=i.containerElement,y=f.legendFontSize,ot=f.legendFontColor,fi=f.height,tt=f.width,wt=d3.select(ui).select("svg"),a=wt.append("g").attr("class","legend"),st=a.append("rect"),e=0,c,u,o=parseInt(y),rt=0,ei=0,s,ht=!1,ct=[],h,bt=f.legendMargin,lt=f.legendIconMargin,kt=f.legendItemsMargin,l,it,r,k,dt,gt,at,ft,ni,v,d,et,ti,g,ut,vt,ii,w,ri,nt,b,yt,p,pt;st.style("display","none");switch(t){case"top":s=f.margin.top;break;case"bottom":s=fi-f.margin.bottom-5}for(l=a.append("g").attr("class","legendrow"),it=0;it<n.length;it++){u=parseInt(y);r=n[it];r.iconsize>0&&(u=r.iconsize,o=r.maxiconsize);c&&(e+=y+c.node().getBBox().width);k=r.text;c=l.append("text").attr("font-size",y+"px").attr("fill",ot).text(k).attr("data-chartrefcode",r.code).attr("data-legendobject",encodeURIComponent(JSON.stringify(r)));rt=c.node().getBBox().width;ei=c.node().getBBox().height;dt=r.addseperator?3:2;e+rt+dt*u>tt||r.rowstart?(ct.push(e),ht=!0,e=0,it!==0&&(c.remove(),l=a.append("g").attr("class","legendrow"),rt>tt&&(gt=tt/(rt+u),at=Math.round(k.length*gt)-5,at>=5&&(k=k.substr(0,at)+"...")),c=l.append("text").attr("font-size",y+"px").attr("fill",ot).text(k).attr("data-chartrefcode",r.code).attr("data-legendobject",encodeURIComponent(JSON.stringify(r))),s+=1.5*o+kt/2)):r.addseperator===!0&&(e=e+u,ut=o!==u?o/2+y/2:u,l.append("text").attr("font-size",y+"px").attr("fill",ot).text("|").attr("x",e-u-2).attr("y",s+ut-2));(r.typeset==="Forecast"||r.typeset==="Estimation")&&r.type==="box"&&(ft=r.color.indexOf("#")===0?this.hexToRgb(r.color):this._getRgbArray(r.color),ni=ft[0]+ft[1]+ft[2],ni>600&&l.append("rect").attr("x",e).attr("y",s).attr("width",u).attr("height",u).attr("fill","rgb(128,128,128)"));switch(r.type){case"box":default:v=r.color.trim();(r.typeset==="Forecast"||r.typeset==="Estimation")&&(v==="rgb(255,255,255)"||v==="#fff"||v=="#ffffff")&&l.append("rect").attr("x",e).attr("y",s+o/2-u/2).attr("width",u).attr("height",u).attr("fill","rgb(128,128,128)").attr("data-chartrefcode",r.code);h=l.append("rect").attr("x",e).attr("y",s+o/2-u/2).attr("width",u).attr("height",u).attr("fill",v).attr("data-chartrefcode",r.code);break;case"point":case"elipse":v=r.color.trim();(r.typeset==="Forecast"||r.typeset==="Estimation")&&(v==="rgb(255,255,255)"||v==="#fff"||v=="#ffffff")&&l.append("circle").attr("cx",e+u/2).attr("cy",s+o/2).attr("r",u/2).attr("fill","rgb(128,128,128)").attr("data-chartrefcode",r.code);h=l.append("circle").attr("cx",e+u/2).attr("cy",s+o/2).attr("r",u/2).attr("fill",r.color).attr("data-chartrefcode",r.code);break;case"line":if(h=l.append("line").attr("x1",e).attr("x2",e+u).attr("y1",s+u/2).attr("y2",s+u/2).attr("stroke-width","3px").attr("stroke",r.color).attr("data-chartrefcode",r.code),r.linetype&&r.linetype!=="solid"){d="";switch(r.linetype){case"dash":default:d="4, 3";break;case"dashdot":d="4, 2, 2,2";break;case"dashdotdot":d="2, 2, 4, 2, 2";break;case"dot":d="2, 2"}h.attr("stroke-dasharray",d)}case"empty":case"none":case"object":}h&&h.attr("data-legendobject",encodeURIComponent(JSON.stringify(r)));(r.typeset==="Image"||r.typeset==="Object")&&r.imagesrc&&r.imagesrc.length>0&&(et=a.append("image"),et.attr("xlink:href","data:image/png;base64,"+r.imagesrc).attr("x",e).attr("y",s),ti=et.node().getBBox(),g=ti.height,g===0&&(g=r.typeset==="Object"?32:175),et.attr("width",g).attr("height",g),o=g);r.outlinecolor&&h.attr("stroke-width","1px").attr("stroke",r.outlinecolor);r.outlinecolor&&r.textcolor&&r.outlinecolor===r.textcolor&&c.attr("fill",r.textcolor);r.typeset==="Forecast"&&(r.type==="box"||r.type==="point"||r.type==="elipse")?h.attr("fill","url("+f.baseLoc+f.container+f.forecastDrawStyle+"_f)"):r.typeset==="Forecast"&&r.type==="line"?(h.attr("stroke",f.forecastColor),h.attr("stroke-dasharray","2,2")):r.typeset==="Estimation"&&(r.type==="box"||r.type==="point"||r.type==="elipse")?h.attr("fill","url("+f.baseLoc+f.container+f.estimationDrawStyle+"_e)"):r.typeset==="Estimation"&&r.type==="line"&&(h.attr("stroke",f.estimationColor),h.attr("stroke-dasharray","2,2"));r.type==="empty"?c.attr("x",e+2+lt).attr("y",s+u-2):(ut=o!==u?o/2+y/2:u,vt=o!==u&&r.type==="object"?e+o+2:e+u+2+lt,r.outlinecolor&&(vt+=2),c.attr("x",vt).attr("y",s+ut-2));ii=o!==u&&r.type==="object"?o:u;e+=ii+lt+kt/2}c&&(e+=c.node().getBBox().width);w=0;ht?(ct.push(e),ri=Math.max.apply(Math,ct),w=tt-ri):w=tt-e;nt=a.node().getBBox();b=nt.height;ht&&f.centerLegendRows&&(yt=wt.node().getBBox().width,a.selectAll("g.legendrow").each(function(){var n=d3.select(this),i=n.node().getBBox(),t=i.width;t<yt&&n.attr("transform","translate("+(yt-t)/2+",0)")}));w<=5&&(w=5);p=w/2;switch(f.legendAlignment){case"left":p=15;break;case"right":p=w-f.margin.right-15;p=p>5?p:5}pt=b;f.legendHeight>0&&(b=f.legendHeight);switch(t){case"top":f.margin.top+=b+10+bt;a.attr("transform","translate("+p+",0)");break;case"bottom":f.margin.bottom+=b+15+bt;a.attr("transform","translate("+p+","+(-b-5)+")");f.legendHeight>0&&pt>b+15&&chartutils.createLegendScroller(f,a,pt)}st.style("display","block");st.attr("fill",f.legendBackgroundColor).attr("x",nt.x).attr("width",nt.width).attr("y",nt.y).attr("height",nt.height)},drawVerticalLegend:function(n,t,i){for(var r,c,rt,nt,a,yt,p,b,ut,v,ft,et,w,d,ot,f=i.settings,st=i.containerElement,k=f.legendFontSize,ht=f.legendFontColor,ct=f.width,lt=d3.select(st).select("svg"),s=lt.append("g").attr("class","legend"),at=s.append("rect"),h=0,l,u,y=parseInt(k),o=f.margin.top+5,e,tt=f.legendMargin,vt=f.legendIconMargin,it=f.legendItemsMargin,g=0;g<n.length;g++){u=parseInt(k);r=n[g];r.iconsize>0&&(u=r.iconsize,y=r.maxiconsize);l&&(c=u,rt=l.selectAll("tspan").size(),rt>0&&(c=l.selectAll("tspan").size()*c),e&&(nt=e.node().getBBox().width,c=nt*2>c?nt:c),o+=c>u?1.2*c+it/2:1.5*c+it/2);l=s.append("text").attr("font-size",k+"px").attr("fill",ht).text(r.text).attr("data-chartrefcode",r.code).attr("data-legendobject",encodeURIComponent(JSON.stringify(r)));switch(r.type){case"box":default:a=r.color.trim();(r.typeset==="Forecast"||r.typeset==="Estimation")&&(a==="rgb(255,255,255)"||a==="#fff"||a=="#ffffff")&&s.append("rect").attr("x",h).attr("y",o).attr("width",u).attr("height",u).attr("fill","rgb(128,128,128)").attr("data-chartrefcode",r.code);e=s.append("rect").attr("x",h).attr("y",o).attr("width",u).attr("height",u).attr("fill",a).attr("data-chartrefcode",r.code);break;case"point":case"elipse":yt=h+u/2;r.iconsize>0&&(h=(y-u)/2);(r.typeset==="Forecast"||r.typeset==="Estimation")&&(a==="rgb(255,255,255)"||a==="#fff"||a=="#ffffff")&&rowGroup.append("circle").attr("cx",h+u/2).attr("cy",o+u/2).attr("r",u/2).attr("fill","rgb(128,128,128)").attr("data-chartrefcode",r.code);e=s.append("circle").attr("cx",h+u/2).attr("cy",o+u/2).attr("r",u/2).attr("fill",r.color).attr("data-chartrefcode",r.code);break;case"line":if(e=s.append("line").attr("x1",h).attr("x2",h+u).attr("y1",o+u/2).attr("y2",o+u/2).attr("stroke-width","3px").attr("stroke",r.color).attr("data-chartrefcode",r.code),r.linetype&&r.linetype!=="solid"){p="";switch(r.linetype){case"dash":default:p="4, 3";break;case"dashdot":p="4, 2, 2,2";break;case"dashdotdot":p="2, 2, 4, 2, 2";break;case"dot":p="2, 2"}e.attr("stroke-dasharray",p)}break;case"empty":case"none":case"object":e=null}e&&e.attr("data-legendobject",encodeURIComponent(JSON.stringify(r)));r.outlinecolor&&e.attr("stroke-width","1px").attr("stroke",r.outlinecolor);r.outlinecolor&&r.textcolor&&r.outlinecolor===r.textcolor&&l.attr("fill",r.textcolor);(r.typeset==="Image"||r.typeset==="Object")&&r.imagesrc&&r.imagesrc.length>0&&(b=s.append("image"),b.attr("xlink:href","data:image/png;base64,"+r.imagesrc).attr("x",h).attr("y",o),ut=b.node().getBBox(),v=ut.height,v===0&&(v=r.typeset==="Object"?32:175),b.attr("width",v).attr("height",v),y=v,r.typeset==="Object"&&b.attr("y",o+u/4),o+=v-1.5*u);r.typeset==="Forecast"&&(r.type==="box"||r.type==="point"||r.type==="elipse")?e.attr("fill","url("+f.baseLoc+f.container+f.forecastDrawStyle+"_f)"):r.typeset==="Forecast"&&r.type==="line"?(e.attr("stroke",f.forecastColor),e.attr("stroke-dasharray","2,2")):r.typeset==="Estimation"&&(r.type==="box"||r.type==="point"||r.type==="elipse")?e.attr("fill","url("+f.baseLoc+f.container+f.estimationDrawStyle+"_e)"):r.typeset==="Estimation"&&r.type==="line"&&(e.attr("stroke",f.estimationColor),e.attr("stroke-dasharray","2,2"));r.type==="empty"&&r.typeset!=="Image"?l.attr("x",0).attr("y",o+u-2):(ft=y!==u?(u+k)/2:u,et=y!==u?y+2:u+2+vt,l.attr("x",et).attr("y",o+ft-2));f.maxLegendWidth>0&&l.call(this.wrapLegendLabels,f.maxLegendWidth,f)}w=s.node().getBBox();d=w.width;switch(t){case"left":f.margin.left+=d+10+tt;s.attr("transform","translate(10,"+f.verticalLegendMarginTop+")");break;case"right":f.margin.right+=d+10+tt;ot=ct-d-10;s.attr("transform","translate("+ot+","+f.verticalLegendMarginTop+")")}at.attr("fill",f.legendBackgroundColor).attr("x",w.x).attr("width",w.width).attr("y",w.y).attr("height",w.height)},createLegendScroller:function(n,t,i){var e=t.select("g.legendrow").node().getBBox().height*1.2,o=Math.ceil((i-(n.legendHeight+15))/e),s=d3.select(n.container+" svg"),r=s.append("g").attr("class","legendscroll").attr("data-position",0).attr("data-total",o),u=r.append("g").attr("class","arrowUp").attr("transform","translate("+(n.width-12.5)+","+(n.height-30)+")"),f=r.append("g").attr("class","arrowDown").attr("transform","translate("+(n.width-12.5)+","+(n.height-15)+")");u.append("rect").attr("width",15).attr("height",15).attr("x",-2.5).attr("y",-2.5).attr("fill","transparent");u.append("polygon").attr("points","5,0 10,10 0,10").attr("fill",n.legendFontColor).style("opacity",.4);f.append("rect").attr("width",15).attr("height",15).attr("x",-2.5).attr("y",-2.5).attr("fill","transparent");f.append("polygon").attr("points","0,0 10,0 5,10").attr("fill",n.legendFontColor);f.on("click touchstart",function(){var n;if(d3.event.preventDefault(),d3.event.stopPropagation(),!t.classed("scrolling")){var e=t.select("g.legendrow").node().getBBox().height,u=t.node().transform.baseVal.consolidate().matrix,o=u.e,s=u.f,i=Number(r.attr("data-position")),f=Number(r.attr("data-total"));if(i<f){t.selectAll("g.legendrow").each(function(n,t){var r=d3.select(this);t<=+i&&r.transition().duration(200).style("opacity","0")});n=i+1;n>0&&r.select(".arrowUp").select("polygon").style("opacity",1);r.attr("data-position",n);f===n&&r.select(".arrowDown").select("polygon").style("opacity",.4);t.classed("scrolling",!0);t.transition().duration(350).attr("transform","translate("+o+","+(s-e*1.2)+")").on("end",function(){d3.select(this).classed("scrolling",!1)})}}});u.on("click touchstart",function(){var i;if(d3.event.preventDefault(),d3.event.stopPropagation(),!t.classed("scrolling")){var f=t.select("g.legendrow").node().getBBox().height,u=t.node().transform.baseVal.consolidate().matrix,e=u.e,o=u.f,n=Number(r.attr("data-position"));if(n>0){t.selectAll("g.legendrow").each(function(t,i){var r=d3.select(this);i===+n-1&&r.transition().delay(100).duration(200).style("opacity","1")});i=n-1;r.attr("data-position",i);i<=0&&r.select(".arrowUp").select("polygon").style("opacity",.4);r.select(".arrowDown").select("polygon").style("opacity",1);t.classed("scrolling",!0);t.transition().duration(350).attr("transform","translate("+e+","+(o+f*1.2)+")").on("end",function(){d3.select(this).classed("scrolling",!1)})}}})},getNiceRange:function(n,t,i){var f=chartutils.calculateNiceRange(n,t),s,o,r,e,u;if(i!==null&&i!==undefined&&i>=0&&(s=chartutils.nbrOfDecimals(f.step),s>i)){if(o=f.maxValue/f.step,r=chartutils.roundOff(f.step,i),r<=0)switch(i){case 0:default:r=1;break;case 1:r=.1;break;case 2:r=.01;break;case 3:r=.001;break;case 4:r=.0001;break;case 5:r=1e-5}return o=Math.round(o/(r/f.step)),e=r*o,u=chartutils.roundOff(f.minValue,i),chartutils.roundOff(e-u,i)<=r*2&&(u>=r*2?u-=r*2:u>=r&&(u-=r),e+=r*2,u=chartutils.roundOff(u,i),e=chartutils.roundOff(e,i)),{minValue:u,maxValue:e,step:r}}return f},calculateNiceRange:function(n,t){var u=Math.round(n*1e3)/1e3,i=Math.round(t*1e3)/1e3,v,h,c,o;(u===i||Math.abs(u-i)<1e-7)&&(u*=1.01,i/=1.01);i<u&&(v=u,u=i,i=v);h=(i-u)/2;c=(i+u)/2;i=c+1.01*h;u=c-1.01*h;i===0&&u===0&&(i=1);var s=Math.log(i-u)/Math.log(10),f=Math.pow(10,s-Math.floor(s)),e=0,r=0;f>0&&f<=2.5?(r=.2,e=.05):f>2.5&&f<5?(r=.5,e=.1):f>5&&f<7.5?(r=1,e=.2):(r=2,e=.5);r=Math.pow(10,Math.floor(s))*r;e=Math.pow(10,Math.floor(s))*e;var l=Math.floor(u/r),a=Math.ceil(i/r),y=n>=0,p=t<=0;return(u=l*r,i=a*r,y&&u<0?u=0:p&&i>0&&(i=0),o={minValue:u,maxValue:i,step:r},t>=999&&t<=1000.5)?(o.maxValue=1e3,o):t>=99&&t<=100.5?(o.maxValue=100,o):n<=-99&&n>=-100.5?(o.minValue=-100,o):n<=-999&&n>=-1e3?(o.minValue=-1e3,o):(u-=Math.abs(u)/100,i+=Math.abs(i)/100,s=Math.log(i-u)/Math.log(10),f=Math.pow(10,s-Math.floor(s)),e=0,r=0,f>0&&f<=2.5?(r=.2,e=.05):f>2.5&&f<5?(r=.4,e=.1):f>5&&f<7.5?(r=1,e=.2):(r=2,e=.5),r=Math.pow(10,Math.floor(s))*r,e=Math.pow(10,Math.floor(s))*e,l=Math.floor(u/r),a=Math.ceil(i/r),u=l*r,i=a*r,o={minValue:u,maxValue:i,step:r},t>=80&&t<=100&&i>100&&(o.maxValue=100),o)},getNiceTickRangeY1:function(n,t,i){for(var u=(t-n)/(i-1),o=Math.ceil(Math.log(u)*Math.LOG10E-1),f=Math.pow(10,o),s=Math.ceil(u/f)*f,e=[],r=0;r<i;r++)e.push(n+r*s);return e},drawPoints:function(n,t,i,r,u,f,e,o,s,h){var c=o.settings,p=c.markerSize/2,a,l,v,y;if(!(p<=0)){a=s.append("g").attr("class","points");l=null;u&&(v=u.ticks(),l=v[v.length-1]);a.selectAll("circle.point").data(t).enter().append("circle").attr("class","point").attr("cx",function(n){return n.xcode?i(n.xcode):n.xshort?i(n.xshort):i(n.x)}).attr("data-title",function(n){if(n.name)return n.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")}).attr("data-code",function(n){return n.namecode?n.namecode:n.name}).attr("cy",function(n){return isNaN(n.y)?null:l&&c.brokenAxis&&+n.y<l?u(+n.y):r(n.y)}).attr("data-value",function(n){var t="";return n.ystring!==undefined?t=n.ystring:isNaN(n.y)||(t=Number(n.y).toLocaleString()),t}).attr("r",p).attr("fill","transparent").transition().delay(h).attr("stroke-width",function(){return c.useMarker?2:0}).attr("stroke",function(){return c.markerBorderColor}).attr("fill",function(){return c.useMarker?c.markerColor!=="default"?c.markerColor:f<0?c.medianLineColor:c.colorList[f]:"transparent"});y=a.selectAll("circle.point[data-value='']");y.size()>0&&y.remove();s.selectAll("circle.point").on("mouseover, mousemove",function(t){var i=d3.select(this);c.animateHover&&i.attr("stroke",function(){return c.colorList[f]}).attr("stroke-width",2);c.onTooltipFunction(e,t,c,this,n)}).on("mousemove",function(n){var t=d3.select(this);c.animateHover&&t.attr("stroke",function(){return c.colorList[f]}).attr("stroke-width",2);c.onTooltipFunction(e,n,c,this)}).on("mouseout",function(){c.animateHover&&d3.select(this).attr("stroke",function(){return c.useMarker?c.markerBorderColor:"none"}).attr("fill",function(){return c.useMarker?c.markerColor!=="default"?c.markerColor:f<0?c.medianLineColor:c.colorList[f]:"transparent"});e.hide()});s.selectAll("circle").on("click touchstart",c.onClickFunction).on("contextmenu",c.onCMFunction)}},drawLabels:function(n,t,i,r,u,f,e,o){var s=e.settings,h=o.append("g").attr("class","labels");h.selectAll("text").data(t.values).enter().append("g").attr("class","label line").append("text").attr("text-anchor","middle").attr("x",function(n){return n.xshort?i(n.xshort):i(n.x)}).attr("y",function(n){return isNaN(n.y)?r(0):r(n.y)-10}).attr("fill",s.labelFontColor).text(function(n){var t="";return n.ystring!==undefined?t=n.ystring:isNaN(n.y)||(t=Number(n.y).toLocaleString()),t});h.selectAll("g").each(function(){var n=d3.select(this).node().getBBox();d3.select(this).insert("rect","text").attr("class","labelBG").attr("height",n.height).attr("width",n.width+10).attr("x",n.x-5).attr("y",n.y).attr("stroke",s.colorList[u])})},empty:function(n){while(n.firstChild)n.removeChild(n.firstChild)},updateSetting:function(n,t){chartutils.deepExtend(n.settings,t)},isBBoxOverlappingBBoxOrPoint:function(n,t){if(n===undefined||t===undefined)return!1;var i=t.label.x+t.label.width>=n.x&&n.x+n.width>=t.label.x,r=t.label.y+t.label.height>=n.y&&n.y+n.height>=t.label.y,u=n.x+n.width>=t.point.x&&t.point.x>=n.x,f=n.y+n.height>=t.point.y&&t.point.y>=n.y;return i&&r||u&&f},isBBoxOverlappingPoint:function(n,t,i){if(n===undefined||t===undefined)return!1;var r=n.x<=t.x-i&&n.x+n.width>=t.x-i,u=n.x<=t.x+i&&n.x+n.width>=t.x+i,f=n.y<=t.y-i&&n.y+n.height>=t.y-i,e=n.y<=t.y+i&&n.y+n.height>=t.y+i,o=r||u,s=f||e;return o&&s},addCircleDefs:function(n,t,i){var f=n.settings,s=d3.select(f.container+" svg"),o=s.select("defs"),l=t.length,e,h,r;for(o.empty()&&(o=s.append("defs")),h=f.container.replace("#",""),e=0;e<l;e++){var a=t[e],u=this.createGradientColors(a),c=h+f.drawStyle+"_"+e;o.select("radialGradient#"+c).node()===null&&(r=o.append("radialGradient").attr("gradientUnits","userSpaceOnUse").attr("cx",0).attr("cy",0).attr("r",i).attr("id",c),f.drawStyle==="softedge"&&f.useDonut?(r.append("stop").attr("offset","0%").attr("stop-color",u[3]),r.append("stop").attr("offset","60%").attr("stop-color",u[0]),r.append("stop").attr("offset","80%").attr("stop-color",u[0]),r.append("stop").attr("offset","100%").attr("stop-color",u[3])):f.drawStyle==="softedge"?(r.append("stop").attr("offset","80%").attr("stop-color",u[0]),r.append("stop").attr("offset","100%").attr("stop-color",u[3])):f.drawStyle==="concave"?(r.append("stop").attr("offset","40%").attr("stop-color",u[0]),r.append("stop").attr("offset","90%").attr("stop-color",u[1]),r.append("stop").attr("offset","91%").attr("stop-color",u[0])):r.append("stop").attr("offset","0%").attr("stop-color",u[0]))}},addCylinderDefs:function(n,t){var r=n.settings,o=r.colorList,s=d3.select(r.container+" svg"),u=s.select("defs"),h,i;for(u.empty()&&(u=s.append("defs")),h=r.container.replace("#",""),i=0;i<o.length;i++){var c=o[i],f=this.createGradientColors(c),l=t?"rotate(90)":"rotate(0)",e=u.append("linearGradient").attr("gradientTransform",l).attr("id",h+"cylinder_"+i);e.append("stop").attr("offset","0%").attr("stop-color",f[0]);e.append("stop").attr("offset","30%").attr("stop-color",f[1]);e.append("stop").attr("offset","95%").attr("stop-color",f[3])}},addLightToDarkDefs:function(n,t){var e=n.settings,o=e.colorList,s=d3.select(e.container+" svg"),r=s.select("defs"),i;for(r.empty()&&(r=s.append("defs")),i=0;i<o.length;i++){var h=o[i],u=this.createGradientColors(h),c=t?"rotate(0)":"rotate(90)",f=r.append("linearGradient").attr("gradientTransform",c).attr("id","ltod_"+i);f.append("stop").attr("offset","0%").attr("stop-color",u[1]);f.append("stop").attr("offset","50%").attr("stop-color",u[0]);f.append("stop").attr("offset","100%").attr("stop-color",u[3])}},getBevelColors:function(n){for(var u,f=n.settings,i=f.colorList,r=[],t=0;t<i.length;t++)u=i[t],r.push(this.createGradientColors(u));return r},addGradientDefs:function(n,t){var r=n.settings,f=r.colorList,e=d3.select(r.container+" svg"),u=e.select("defs"),o,i;for(u.empty()&&(u=e.append("defs")),o=r.container.replace("#",""),i=0;i<f.length;i++){var c=f[i],s=this.createGradientColors(c),l=t?"rotate(100)":"rotate(10)",h=u.append("linearGradient").attr("gradientTransform",l).attr("id",o+"gradient_"+i);h.append("stop").attr("offset","0%").attr("stop-color",s[0]);h.append("stop").attr("offset","100%").attr("stop-color",s[1])}},addHatchDefs:function(n){var t=n.settings,i,r,u,o=d3.select(t.container+" svg"),f=o.select("defs"),e;f.empty()&&(f=o.append("defs"));e=t.container.replace("#","");t.showEstimation&&t.estimationType!=="Solid"&&(i=f.append("pattern").attr("id",e+t.estimationDrawStyle+"_e"),r=chartutils.getPatternWidth(t.estimationDrawStyle),i.attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r),u=i.append("path"),u.attr("d",chartutils.getHatchPath(t.estimationDrawStyle)).attr("stroke",t.estimationColor).attr("stroke-width",1));t.showForecast&&t.forecastType!=="Solid"&&(i=f.append("pattern").attr("id",e+t.forecastDrawStyle+"_f"),r=chartutils.getPatternWidth(t.forecastDrawStyle),i.attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r),u=i.append("path"),u.attr("d",chartutils.getHatchPath(t.forecastDrawStyle)).attr("stroke",t.forecastColor).attr("stroke-width",1));t.showExtra&&t.extraType!=="Solid"&&t.extraDataType&&(i=f.append("pattern").attr("id",e+t.extraDrawStyle+"_"+t.extraDataType),r=chartutils.getPatternWidth(t.extraDrawStyle),i.attr("patternUnits","userSpaceOnUse").attr("width",r).attr("height",r),u=i.append("path"),u.attr("d",chartutils.getHatchPath(t.extraDrawStyle)).attr("stroke",t.extraColor).attr("stroke-width",1))},getPatternWidth:function(n){switch(n){case"BackwardDiagonal":case"ForwardDiagonal":case"Cross":case"Horizontal":case"Vertical":case"DashedHorizontal":case"DashedVertical":case"Percent05":return 10;case"DarkDownwardDiagonal":case"DarkUpwardDiagonal":return 4;case"DarkHorizontal":case"DarkVertical":case"DashedDownwardDiagonal":case"DashedUpwardDiagonal":return 5;default:return 10}},getHatchPath:function(n){switch(n){case"BackwardDiagonal":return"M-1,1 l2,-2 M0,10 l10,-10 M9,11 l2,-2";case"ForwardDiagonal":return"M-1,9 l2,2 M0,0 l10,10 M9,-1 L11,1";case"Cross":return"M0,0 l11,0 M0,0 L0,11";case"DarkDownwardDiagonal":return"M-1,3 l2,2 M0,0 l4,4 M3,-1 L5,1";case"Horizontal":return"M0,0 L10,0";case"Vertical":return"M0,0 L0,10";case"DarkHorizontal":return"M0,0 L5,0";case"DarkVertical":return"M0,0 L0,5";case"DarkUpwardDiagonal":return"M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2";case"DashedDownwardDiagonal":return"M0,0 l3,5";case"DashedUpwardDiagonal":return"M0,5 l3,-5";case"DashedHorizontal":return"M0,1 l6,0 M4,6 l6,0";case"DashedVertical":return"M1,0 l0,6 M6,4 l0,6";case"Percent05":return"M1,0 L0,1 M5,6 L6,5 M10,11 L11,10";default:return"M-1,1 l2,-2 M0,10 l10,-10 M9,11 l2,-2"}},createGradientColors:function(n){var t=[];if(n.indexOf("rgb")>=0?t=n.replace(/[^\d,]/g,"").split(","):n.indexOf("#")===0&&(t=this.hexToRgb(n)),t.length>=3){var i=t[0],r=t[1],u=t[2],f=255-i,e=255-r,o=255-u,s=Math.round(+i+f/2),h=Math.round(+r+e/2),c=Math.round(+u+o/2),l="rgb("+s+","+h+","+c+")",a=Math.round(i*.5),v=Math.round(r*.5),y=Math.round(u*.5),p="rgb("+a+","+v+","+y+")",w=Math.round(i*.75),b=Math.round(r*.75),k=Math.round(u*.75),d="rgb("+w+","+b+","+k+")";return[n,l,d,p]}},hexToRgb:function(n){var t;return n=n.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(n,t,i,r){return t+t+i+i+r+r}),t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null},createContrastLabelColor:function(n,t){var i=t.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(","),r=i[0],u=i[1],f=i[2],e=(r*299+u*587+f*114)/1e3;return e>=125?n.labelFontColor:n.labelFontColorContrast},getContrastLabelColor:function(n,t,i){var e=[],r=[],u,o,f;return!t||!i?t:(e=t.indexOf("#")===0?this.hexToRgb(t):this._getRgbArray(t),r=i.indexOf("#")===0?this.hexToRgb(i):this._getRgbArray(i),e.length<3||r.length<3)?t:(f=this._getContrast(e,r),f>=4.5)?t:(u=n.labelFontColorContrast,o=u.indexOf("#")===0?this.hexToRgb(u):this._getRgbArray(u),o.length<3)?t:(f=this._getContrast(o,r),f>=4.5)?u:this._getContrast([255,255,255],r)>=4.5?"rgb(255,255,255)":"rgb(0,0,0)"},_getRgbLuminacity:function(n,t,i){var r=[n,t,i],f,u;if(!(r.length<3)){for(f=0;f<r.length;f++)u=r[f],u=u/255,r[f]=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return r[0]*.2126+r[1]*.7152+r[2]*.0722}},_getContrast:function(n,t){var i=this._getRgbLuminacity(n[0],n[1],n[2])+.05,r=this._getRgbLuminacity(t[0],t[1],t[2])+.05;return Math.round(Math.max(i,r)/Math.min(i,r)*100)/100},_getRgbArray:function(n){return n.replace(/^(rgb|rgba)\(/,"").replace(/\)$/,"").replace(/\s/g,"").split(",")},abbreviateNumber:function(n,t){var f=n,u,o,i;if(n>=1e3){var e=Math.floor(((""+n).length-1)/3),r="";for(u=3;u>=1;u--)if(r=parseFloat((e!==0?n/Math.pow(1e3,e):n).toPrecision(u)),o=(r+"").replace(/[^a-zA-Z 0-9]+/g,""),o.length<=3)break;r%1!=0?(i=chartutils.nbrOfDecimals(r),i=i>3?3:i,r=chartutils.numberFormat(r,i,t.lang,t.customLang)):r=chartutils.numberFormat(r,0,t.lang,t.customLang);f=r+["","k","m","b","t"][e]}else i=chartutils.nbrOfDecimals(n),i=i>3?3:i,f=chartutils.numberFormat(n,i,t.lang,t.customLang);return f},drawChartExtras:function(n,t){if(chartutils.drawText(n,t.source,t.sourcePosition,"source"),chartutils.drawText(n,t.title,t.titlePosition,"title"),chartutils.drawText(n,t.titleSubtitle,t.titlePosition,"titlesubtitle"),t.showLegend){var i=t.legendData,r=d3.nest().key(function(n){return n.name}).entries(t.dataset);(i===null||i.length<=0)&&n.getLegendData&&(i=n.getLegendData(r));chartutils.drawLegend(i,n)}chartutils.drawText(n,t.nodata,"center","nodata")},getChartDimensions:function(n){chartutils.empty(n);var t=n.offsetWidth,i=n.offsetHeight,r=n.getAttribute("data-svgwidth"),u=n.getAttribute("data-svgheight");return r&&u&&(t=parseInt(r),i=parseInt(u)),{width:t,height:i}},numberFormat:function(n,t,i,r){var o,u,h,f,s;if(t.toString().length<=0&&(f=n.toString().split("."),f.length>1&&(t=f[1].length)),o=chartutils.roundOff(n,t),isNaN(o))return NaN;u=r;h=o.toString();u===null&&(i||(i="nl"),u=chartutils.getLanguageSigns(i));var e=h.split("."),c=u.thousandsSep!==null&&u.thousandsSep!==undefined?u.thousandsSep:".",l=u.decimalPoint!==null&&u.decimalPoint!==undefined?u.decimalPoint:",";if(e[0]=e[0].replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+c),t>0){for(f=e.length>1?e[1]:"",s=f.length;s<t;s++)f+="0";e[1]=f}return e.join(l)},getLanguageSigns:function(n){n||(n="nl");switch(n.toLowerCase()){case"nl":case"nl-nl":case"de":case"de-de":case"es":case"es-es":return{decimalPoint:",",thousandsSep:"."};case"fr":case"fr-fr":return{decimalPoint:",",thousandsSep:" "};case"en-en":case"en-us":case"es-us":default:return{decimalPoint:".",thousandsSep:","}}},roundOff:function(n,t){if(typeof t=="undefined"||+t==0)return Math.round(n);if(+t<0){var i=t*-1;return i*Math.round(+n/i)}return(n=+n,t=+t,!(typeof t=="number"&&t%1==0))?NaN:(n=n.toString().split("e"),n=Math.round(+(n[0]+"e"+(n[1]?+n[1]+t:t))),n=n.toString().split("e"),+(n[0]+"e"+(n[1]?+n[1]-t:-t)))},nbrOfDecimals:function(n){if(Math.floor(n)===n)return 0;var t=parseFloat(n.toFixed(10)).toString().split(".");return t.length>1?t[1].length:0},wrapCenterText:function(n,t){var f=n.text(),u=t.customLang,e="",i,h,c,r;if(u=u===null||u===undefined?chartutils.getLanguageSigns(t.lang):u,e=u.decimalPoint!==null&&u.decimalPoint!==undefined?u.decimalPoint:",",f.indexOf(e)>=0){if(r=f.split(e),r.length>1){i=n;i.text(null);i.append("tspan").text(r[0]);var l=r.splice(1,r.length-1),s=l.join(e),o=s.split("(");o.length>1&&(s=o[0]);i.append("tspan").attr("class","small").text(e+s);o.length>1&&(h=o.splice(1,o.length-1),c=h.join("("),i.append("tspan").text("("+c))}}else if(t.dataUnit.length>0&&f.indexOf(t.dataUnit)>=0){if(r=f.split(t.dataUnit),r.length>1){var i=n,a,v=i.attr("y"),y=parseFloat(i.attr("dy"));i.text(null);i.append("tspan").text(r[0]);i.append("tspan").attr("class","small").text(r[1]+t.dataUnit)}}else if(t.labelSplitSmall&&t.labelSplitSmall.length>0&&f.indexOf(t.labelSplitSmall)>=0&&(r=f.split(t.labelSplitSmall),r.length>1)){var i=n,a,v=i.attr("y"),y=parseFloat(i.attr("dy"));i.text(null);i.append("tspan").text(r[0]);i.append("tspan").attr("class","small").text(r[1]+t.labelSplitSmall)}},_getTranslateMatrix:function(n){return n.node().transform.baseVal.consolidate().matrix}},function(){var n=function n(t,i){var r,u,f=t.nodeType,e,o,s;if(f===3)i.push(t.textContent.replace(/&/,"&amp;").replace(/</,"&lt;").replace(">","&gt;"));else if(f===1){if(i.push("<",t.tagName),t.hasAttributes())for(e=t.attributes,r=0,u=e.length;r<u;++r)o=e.item(r),i.push(" ",o.name,"='",o.value,"'");if(t.hasChildNodes()){for(i.push(">"),s=t.childNodes,r=0,u=s.length;r<u;++r)n(s.item(r),i);i.push("<\/",t.tagName,">")}else i.push("/>")}else if(f===8)i.push("<!--",t.nodeValue,"-->");else throw"Error serializing XML. Unhandled node of type: "+f;},t=document.createElement("svg");t.innerHTML===undefined&&Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){for(var i=[],t=this.firstChild;t;)n(t,i),t=t.nextSibling;return i.join("")},set:function(n){for(var i;this.firstChild;)this.removeChild(this.firstChild);try{i=new DOMParser;i.async=!1;n=n.replace("&amp;","&#x26;");for(var r="<svg xmlns='http://www.w3.org/2000/svg'>"+n+"<\/svg>",u=i.parseFromString(r,"text/xml").documentElement,t=u.firstChild;t;)this.appendChild(this.ownerDocument.importNode(t,!0)),t=t.nextSibling}catch(f){throw new Error("Error parsing XML string");}},configurable:!0});t.innerSVG===undefined&&Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(n){this.innerHTML=n},configurable:!0})}()