!function(t,e){"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):e(t):e(t)}("undefined"!=typeof window?window:this,function(t,e){"use strict";var a={};return a.util={},a.util.inherits=function(t){function e(){}return e.prototype=t.prototype||t,new e},a.util.getUniqueId=function(){return(new Date).getTime()},a.util.getMax=function(t,e){switch(e){case"stepup":return this.getStepMaxValue(t);case"normal":return this.getMaxValue(t);case"percent":return 100;case"waterfall":return this.getWaterfallMaxValue(t);default:console.error("Unknown classification for chart",e)}},a.util.getMaxValue=function(t){return d3.max(t.categories.map(function(e){return d3.max(t.dataset[e].map(function(t){return t.value}))}))},a.util.getStepMaxValue=function(t){var e=t.dataset[t.categories[0]].map(function(){return 0}),a=e.map(function(){return 0});return t.categories.map(function(n){t.dataset[n].map(function(t,n){t.resetSum===!0&&(e[n]=0),e[n]+=t.value,a[n]=d3.max([e[n],a[n]])})}),d3.max(a)},a.util.getWaterfallMaxValue=function(t){var e=t.categories.map(function(){return 0});return t.categories.map(function(a,n){var r=0;t.dataset[a].map(function(t){r+=t.value,e[n]e;e+=1){for(s=[],s.push(t.dataset[t.categories[0]][e].name),a=0,n=t.categories.length;n>a;a+=1)s.push(t.dataset[t.categories[a]][e].value);o.push(s)}return o},a.util.getLabelArray=function(t,e){return t.dataset[t.categories[e?e:0]].map(function(t){return t.name})},a.util.getCategoryArray=function(t){return t.categories.map(function(t){return t})},a.util.getCategoryData=function(t,e){return e.map(function(e){return t.dataset[e].map(function(t){return t.value})})},a.util.transposeData=function(t){var e,a,n,r,o,s,i,l,c={},f=t.dataset[t.categories[0]].map(function(t){return t.name});for(e=0,n=f.length;n>e;e+=1)c[f[e]]=[];for(e=0,n=t.categories.length;n>e;e+=1)for(s=t.categories[e],a=0,r=t.dataset[s].length;r>a;a+=1)i=t.dataset[s][a].name,l=t.dataset[s][a].value,o=t.dataset[s][a].resetSum,c[i].push({name:s,value:l,resetSum:o});t.categories=f,t.dataset=c},a.util.getPascalCasedName=function(t){return t.substring(0,1).toUpperCase()+t.substring(1)},a.util.getColorBand=function(t,e){{var n=0;t.graph.palette||"Default"}return t.graph.custompalette&&0!==t.graph.custompalette.length?(n=t.graph.custompalette.length,t.graph.custompalette[e%n]):(n=a.palette[t.graph.palette].length,a.palette[t.graph.palette][e%n])},a.util.formatClassName=function(t){var e=t.trim().replace(/[^A-Za-z0-9_\-]/g,"-").toLowerCase();return e},a.util.svgToPng=function(e,a){if(this.isCanvasSupported()){var n=d3.select(e.frame.node().parentNode).html(),r=document.createElement("canvas"),o=r.getContext("2d");r.setAttribute("width",d3.select(e.frame.node()).attr("width")),r.setAttribute("height",d3.select(e.frame.node()).attr("height")),o.drawSvg(n),r.toBlob(function(e){var a=document.createElement("a");document.body.appendChild(a),a.style="display: none";var n=t.URL.createObjectURL(e);a.href=n,a.download="png_download"+Math.ceil(1e5*Math.random())+".png",a.click()},"image/png"),a.call()}else console.log("uvCharts: Download feature is not supported in this version of browser")},a.util.isDownloadSupported=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return"function"==typeof e.drawSvg&&"function"==typeof t.toBlob},a.util.isCanvasSupported=function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},a.util.endAll=function(t,e){var a=0;t.each(function(){++a}).each("end",function(){--a||e.apply(this,arguments)})},a.util.getClassName=function(t,e){var n=a.util.formatClassName(e);return d3.select(t).attr("class")?-1!==d3.select(t).attr("class").split(" ").indexOf(n)?d3.select(t).attr("class"):d3.select(t).attr("class")+" "+n:n},a.util.getLabelValue=function(t,e){if(void 0!==t.config.label.formatter)return t.config.label.formatter(e.value);var a=e.value%1===0?e.value:e.value.toFixed(t.config.label.precision);return t.config.label.prefix+String(a)+t.config.label.suffix},a.util._deepClone=function(t,e){if("object"==typeof e){var n=!0;for(var r in e)n=!1,e.hasOwnProperty(r)&&(void 0===t&&(t=Array.isArray(e)?[]:{}),t[r]=a.util._deepClone(t[r],e[r]));n&&(t=Array.isArray(e)?[]:{})}else t=e;return t},a.util.extend=function(){if(void 0===arguments[0]||null===arguments[0])return arguments[0];for(var t=1;t=t.config.dimension.width&&(t.config.legend.legendstart=t.config.legend.legendstart+1,n=100*a-t.config.dimension.width*t.config.legend.legendstart,r=20*t.config.legend.legendstart),"translate("+n+","+r+")"}}).attr("class",function(e,n){var r="categories"===t.config.legend.legendtype?t.categories[n]:t.labels[n];return a.util.getClassName(this,"cl-"+r)}).attr("disabled","false").on("mouseover",function(e,a){t.effects[e].mouseover&&"function"==typeof t.effects[e].mouseover&&t.effects[e].mouseover()}).on("mouseout",function(e,a){t.effects[e].mouseout&&"function"==typeof t.effects[e].mouseout&&t.effects[e].mouseout()}).on("click",function(e,n){a.effects.legend.click(n,this,t)}),t.legends.append("rect").classed(a.constants.classes.legendsign,!0).attr("height",t.config.legend.symbolsize).attr("width",t.config.legend.symbolsize).style("fill",function(e,n){return a.util.getColorBand(t.config,n)}).style("stroke","none"),t.legends.append("text").classed(a.constants.classes.legendlabel,!0).text(function(e,a){return"categories"===t.config.legend.legendtype?t.categories[a]:t.labels[a]}).attr("dx",t.config.legend.textmargin).attr("dy",".71em").attr("text-anchor","start").style("stroke",t.config.legend.color).style("fill",t.config.legend.color).style("stroke-width",t.config.legend.strokewidth).style("font-family",t.config.legend.fontfamily).style("font-size",t.config.legend.fontsize).style("font-weight",t.config.legend.fontweight),this},a.Graph.prototype.finalize=function(t){var e=this;return e.drawHorizontalAxis().drawVerticalAxis(),e.frame.selectAll("text").style("cursor","default"),t&&console.log(e),this},a.Graph.prototype.remove=function(){return this.frame.remove(),this},a.Graph.prototype.removeCaption=function(){return this.caption.remove(),this},a.Graph.prototype.removeLegend=function(){return this.legends[0]&&this.legends[0].parentNode.remove(),this},a.Graph.prototype.removePanel=function(){return this.panel.remove(),this},a.Graph.prototype.removeHorAxis=function(){return this.panel.selectAll("g."+a.constants.classes.horaxis+" >*").remove(),this.panel.selectAll("line."+a.constants.classes.horaxis).remove(),this},a.Graph.prototype.removeVerAxis=function(){return this.panel.selectAll("g."+a.constants.classes.veraxis+" >*").remove(),this.panel.selectAll("line."+a.constants.classes.veraxis).remove(),this},a.Graph.prototype.width=function(t){return t?(this.config.dimension.width=t,this):this.config.dimension.width},a.Graph.prototype.height=function(t){return t?(this.config.dimension.height=t,this):this.config.dimension.height},a.Graph.prototype.top=function(t){return t?(this.config.margin.top=t,this):this.config.margin.top},a.Graph.prototype.bottom=function(t){return t?(this.config.margin.bottom=t,this):this.config.margin.bottom},a.Graph.prototype.left=function(t){return t?(this.config.margin.left=t,this):this.config.margin.left},a.Graph.prototype.right=function(t){return t?(this.config.margin.right=t,this):this.config.margin.right},a.Graph.prototype.position=function(t){return t?(this.config.meta.position=t,this):this.config.meta.position},a.Graph.prototype.caption=function(t){return t?(this.config.meta.caption=t,this):this.config.meta.caption},a.Graph.prototype.subCaption=function(t){return t?(this.config.meta.subCaption=t,this):this.config.meta.caption},a.Graph.prototype.isDownloadable=function(t){return t?(this.config.meta.isDownload=t,this):this.config.meta.isDownload},a.Graph.prototype.max=function(){return null!==this.axes.meta.max?this.axes.meta.max:(this.axes.meta.max=a.util.getMax(this.graphdef,this.graphdef.stepup),this)},a.Graph.prototype.min=function(){return null!==this.axes.meta.min?this.axes.meta.min:(this.axes.meta.min=a.util.getMin(this.graphdef,this.graphdef.stepup),this)},a.Graph.prototype.toggleGraphGroup=function(t){{var e=this,n=e.categories[t],r=e.frame.select("g.cge-"+a.util.formatClassName(n)).style("display");a.util.getColorBand(e.config,t)}return e.frame.selectAll("g.cge-"+a.util.formatClassName(n)).style("display","none"===r?null:"none"),this},a.AreaGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.areagroups=[],n.dataset=a.util.getDataArray(n.graphdef);var r,o,s,i,l=n.graphdef.dataset[n.graphdef.categories[0]];for(n.axes["Horizontal"===n.config.graph.orientation?"ver":"hor"].scale.domain(l.map(function(t){return t.name})),s=0,i=n.dataset.length;i>s;s+=1)o=n.chart.append("g").classed("cg-"+a.util.formatClassName(n.categories[s]),!0).append("g").classed("cge-"+a.util.formatClassName(n.categories[s]),!0).datum(n.dataset[s]),r={path:o,linefunc:void 0,areafunc:void 0,line:void 0,area:void 0},n["draw"+n.config.graph.orientation+"Area"](r,s),n.areagroups.push(r);n.finalize()},a.AreaGraph.prototype=a.util.inherits(a.Graph),a.AreaGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="normal",this},a.AreaGraph.prototype.drawHorizontalArea=function(t,e){var n=this,r=a.util.getColorBand(n.config,e);n.axes.ver.scale.rangePoints([0,n.height()]),t.linefunc=d3.svg.line().x(function(t){return n.axes.hor.scale(t.value)}).y(function(t){return n.axes.ver.scale(t.name)+n.axes.ver.scale.rangeBand()/2}).interpolate(n.config.area.interpolation), t.areafunc=d3.svg.area().x0(n.axes.hor.scale(0)).x1(t.linefunc.x()).y(t.linefunc.y()).interpolate(n.config.area.interpolation),t.area=t.path.append("svg:path").classed(a.constants.classes.areapath+e,!0).attr("d",t.areafunc).style("opacity",n.config.area.opacity).style("-moz-opacity",n.config.area.opacity).style("fill",r),t.line=t.path.append("svg:path").classed(a.constants.classes.linepath+e,!0).attr("d",t.linefunc).style("stroke","white").style("fill","none"),t.path.selectAll("."+a.constants.classes.dot).data(n.dataset[e]).enter().append("circle").classed(a.constants.classes.dot,!0).attr("cx",t.linefunc.x()).attr("cy",t.linefunc.y()).attr("r",3.5).style("fill","white")},a.AreaGraph.prototype.drawVerticalArea=function(t,e){var n=this,r=a.util.getColorBand(n.config,e);n.axes.hor.scale.rangePoints([0,n.width()]),t.linefunc=d3.svg.line().x(function(t){return n.axes.hor.scale(t.name)+n.axes.hor.scale.rangeBand()/2}).y(function(t){return n.axes.ver.scale(t.value)}).interpolate(n.config.area.interpolation),t.areafunc=d3.svg.area().x(t.linefunc.x()).y0(t.linefunc.y()).y1(n.axes.ver.scale(0)).interpolate(n.config.area.interpolation),t.area=t.path.append("svg:path").classed(a.constants.classes.areapath+e,!0).attr("d",t.areafunc).style("opacity",n.config.area.opacity).style("-moz-opacity",n.config.area.opacity).style("fill",r),t.line=t.path.append("svg:path").classed(a.constants.classes.linepath+e,!0).attr("d",t.linefunc).style("stroke","white").style("fill","none"),t.path.selectAll("."+a.constants.classes.dot).data(n.dataset[e]).enter().append("circle").classed(a.constants.classes.dot,!0).attr("cx",t.linefunc.x()).attr("cy",t.linefunc.y()).attr("r",3.5).style("fill","white")},a.BarGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.bargroups={},n.axes["Horizontal"===n.config.graph.orientation?"ver":"hor"].scale.domain(n.labels);var r,o,s=n.categories.length;for(r=0;s>r;r+=1)o=n.categories[r],n.bargroups[o]=n.chart.append("g").classed("cg-"+a.util.formatClassName(o),!0),n["draw"+n.config.graph.orientation+"Bars"](r);n.finalize()},a.BarGraph.prototype=a.util.inherits(a.Graph),a.BarGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="normal",this},a.BarGraph.prototype.drawHorizontalBars=function(t){var e=this,n=a.util.getColorBand(this.config,t),r=e.categories.length,o=e.bargroups[e.categories[t]].selectAll("g").data(e.graphdef.dataset[e.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(e.categories[t]),!0).attr("transform",function(t){return t.value<0?"scale(-1,1)":void 0});o.append("rect").classed(a.util.formatClassName(e.categories[t]),!0).classed("cr-"+a.util.formatClassName(e.categories[t]),!0).attr("height",e.axes.ver.scale.rangeBand()/r).attr("x",function(t){return t.value<0?-e.axes.hor.scale(0):e.axes.hor.scale(0)}).attr("y",function(t){return e.axes.ver.scale(t.name)}).attr("width",0).style("stroke",e.config.bar.strokecolor).style("fill",n).transition().duration(e.config.effects.duration).delay(function(t,a){return a*e.config.effects.duration}).attr("width",function(t){return e.axes.hor.scale(Math.abs(t.value))-e.axes.hor.scale(0)}).call(a.util.endAll,function(n,r){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(e,t)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(e,t)),"function"==typeof e.config.graph.clickCallback&&d3.select(this.parentNode.parentNode).selectAll("rect").on("click",function(t){e.config.graph.clickCallback.apply(null,[t])})}),o.append("text").attr("x",function(t){return e.axes.hor.scale(0)}).attr("y",function(t){return e.axes.ver.scale(t.name)+e.axes.ver.scale.rangeBand()/r/2}).attr("dx",function(t){return t.value<0?"-20px":"4px"}).attr("dy",".35em").attr("text-anchor","start").classed("cr-"+a.util.formatClassName(e.categories[t]),!0).style("fill",e.config.label.showlabel?a.util.getColorBand(e.config,t):"none").style("font-family",e.config.bar.fontfamily).style("font-size",e.config.bar.fontsize).style("font-weight",e.config.bar.fontweight).style("transform",function(t){return t.value<0?"scale(-1,1)":"scale(1,1)"}).style("opacity",0).text(function(t){return a.util.getLabelValue(e,t)}).transition().duration(e.config.effects.duration).delay(function(t,a){return a*e.config.effects.duration}).style("opacity",1).attr("x",function(t){return e.axes.hor.scale(t.value)}),o.append("svg:title").text(function(n,r){return a.util.getTooltipText(e,e.categories[t],e.labels[r],n)}),e.bargroups[e.categories[t]].attr("transform","translate(0,"+t*e.axes.ver.scale.rangeBand()/r+")")},a.BarGraph.prototype.drawVerticalBars=function(t){var e=this,n=a.util.getColorBand(this.config,t),r=e.categories.length,o=e.bargroups[e.categories[t]].selectAll("g").data(e.graphdef.dataset[e.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(e.categories[t]),!0).attr("transform",function(t){return t.value<0?"scale(1, -1)":void 0});o.append("rect").classed(a.util.formatClassName(e.categories[t]),!0).classed("cr-"+a.util.formatClassName(e.categories[t]),!0).attr("height",0).attr("width",e.axes.hor.scale.rangeBand()/r).attr("x",function(t){return e.axes.hor.scale(t.name)}).attr("y",function(t){return(t.value<0?-1:1)*(e.height()-e.axes.ver.scale(0))}).style("stroke",e.config.bar.strokecolor).style("fill",n).transition().duration(e.config.effects.duration).delay(t*e.config.effects.duration).attr("height",function(t){return Math.abs(e.axes.ver.scale(0)-e.axes.ver.scale(t.value))}).call(a.util.endAll,function(n,r){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(e,t)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(e,t)),"function"==typeof e.config.graph.clickCallback&&d3.select(this.parentNode.parentNode).selectAll("rect").on("click",function(t){e.config.graph.clickCallback.apply(null,[t])})}),o.append("text").attr("transform",function(t){return t.value<0?"scale(1,1)":"scale(1,-1)"}).attr("x",function(t){return e.axes.hor.scale(t.name)+e.axes.hor.scale.rangeBand()/r/2}).attr("y",function(t){return e.height()-e.axes.ver.scale(0)}).attr("dx",0).attr("dy",function(t){return t.value<0?"2em":".35em"}).attr("text-anchor","middle").classed("cr-"+a.util.formatClassName(e.categories[t]),!0).style("fill",e.config.label.showlabel?a.util.getColorBand(e.config,t):"none").style("font-family",e.config.bar.fontfamily).style("font-size",e.config.bar.fontsize).style("font-weight",e.config.bar.fontweight).style("opacity",0).text(function(t){return a.util.getLabelValue(e,t)}).transition().duration(e.config.effects.duration).delay(t*e.config.effects.duration).style("opacity",1).attr("y",function(t){return-(e.height()-e.axes.ver.scale(t.value))-10}),o.append("svg:title").text(function(n,r){return a.util.getTooltipText(e,e.categories[t],e.labels[r],n)}),e.bargroups[e.categories[t]].attr("transform","translate("+t*e.axes.hor.scale.rangeBand()/r+","+e.height()+") scale(1,-1)")},a.DonutGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.radius=2*Math.min(n.height(),n.width())/5,n.center={x:n.width()/2,y:n.height()/2},n.category=t.categories[0];var r=a.util.getCategoryData(n.graphdef,[n.category]),o=d3.svg.arc().innerRadius(n.radius*n.config.donut.factor).outerRadius(n.radius),s=d3.layout.pie();n.chart.data(r),n.arcs=n.chart.selectAll("g.arc").data(s).enter().append("g").classed(a.constants.classes.arc+a.util.formatClassName(n.category),!0).attr("transform","translate("+n.center.x+","+n.center.y+")"),n.arcs.append("path").attr("d",o).style("fill",function(t,e){return a.util.getColorBand(n.config,e)}).style("stroke",n.config.donut.strokecolor).style("stroke-width",n.config.donut.strokewidth).on("mouseover",a.effects.donut.mouseover(n.center,o,n.config)).on("mouseout",a.effects.donut.mouseout(n.center,n.config)),"function"==typeof n.config.graph.clickCallback&&n.arcs.on("click",function(t){n.config.graph.clickCallback.apply(null,[t])}),n.arcs.append("text").attr("transform",function(t){return"translate("+o.centroid(t)+")"}).attr("dy",".35em").attr("text-anchor","middle").style("fill",n.config.label.showlabel?n.config.donut.fontfill:"none").style("font-family",n.config.donut.fontfamily).style("font-size",n.config.donut.fontsize).style("font-weight",n.config.donut.fontweight).style("font-variant",n.config.donut.fontvariant).text(function(t){return a.util.getLabelValue(n,t)}),n.arcs.append("svg:title").text(function(t,e){return a.util.getTooltipText(n,n.category,n.labels[e],t)})},a.DonutGraph.prototype=a.util.inherits(a.Graph),a.DonutGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="normal",t.config.legend.legendtype="labels",this},a.LineGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.linegroups={},n.dataset=a.util.getDataArray(n.graphdef);var r,o,s,i=n.categories.length,l=n.labels;for(n.axes["Horizontal"===n.config.graph.orientation?"ver":"hor"].scale.domain(l),s=0;i>s;s+=1)o=n.chart.append("g").classed("cg-"+a.util.formatClassName(n.categories[s]),!0).append("g").classed("cge-"+a.util.formatClassName(n.categories[s]),!0).datum(n.dataset[s]),r={path:o,func:void 0},n["draw"+n.config.graph.orientation+"Lines"](r,s),n.linegroups[n.categories[s]]=r;n.finalize()},a.LineGraph.prototype=a.util.inherits(a.Graph),a.LineGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="normal",t.config.scale.ordinality=0,this},a.LineGraph.prototype.drawHorizontalLines=function(t,e){var n=this,r=n.axes,o=(n.config,a.util.getColorBand(n.config,e));return n.axes.ver.scale.rangePoints([0,n.height()]),t.func=d3.svg.line().x(function(t){return r.hor.scale(t.value)}).y(function(t){return r.ver.scale(t.name)+r.ver.scale.rangeBand()/2}).interpolate(a.config.line.interpolation),t.path.append("path").classed("cr-"+a.util.formatClassName(n.categories[e]),!0).attr("d",t.func).style("fill","none").style("stroke",o).style("stroke-width",n.config.line.strokewidth).style("stroke-opacity",n.config.line.strokeopacity).transition().duration(3*n.config.effects.duration).delay(2*e*n.config.effects.duration).style("stroke-opacity",1).call(a.util.endAll,function(t,r){d3.select(this.parentNode.parentNode).selectAll("path").on("mouseover",a.effects.line.mouseover(n,e)),d3.select(this.parentNode.parentNode).selectAll("path").on("mouseout",a.effects.line.mouseout(n,e)),d3.select(this.parentNode.parentNode).selectAll("circle").on("mouseover",a.effects.line.mouseover(n,e)),d3.select(this.parentNode.parentNode).selectAll("circle").on("mouseout",a.effects.line.mouseout(n,e))}),n.config.line.showcircles&&t.path.selectAll("circle").data(n.dataset[e]).enter().append("circle").classed("cr-"+a.util.formatClassName(n.categories[e]),!0).attr("cx",t.func.x()).attr("cy",t.func.y()).attr("r",n.config.line.circleradius).style("fill",o).style("fill-opacity",n.config.line.circleopacity).style("stroke","#fff").append("svg:title").text(function(t,r){return a.util.getTooltipText(n,n.categories[e],n.labels[r],t)}),t.path.selectAll("text").data(n.dataset[e]).enter().append("text").attr("x",function(t){return r.hor.scale(t.value)}).attr("y",function(t){return r.ver.scale(t.name)+r.ver.scale.rangeBand()/2}).attr("dx",10).attr("dy",".35em").attr("text-anchor","start").style("opacity",0).classed("cr-"+a.util.formatClassName(n.categories[e]),!0).style("fill",n.config.label.showlabel?a.util.getColorBand(n.config,e):"none").style("font-family",n.config.line.fontfamily).style("font-size",n.config.line.fontsize).style("font-weight",n.config.line.fontweight).text(function(t){return a.util.getLabelValue(n,t)}).transition().duration(3*n.config.effects.duration).delay(2*e*n.config.effects.duration).style("opacity",1),this},a.LineGraph.prototype.drawVerticalLines=function(t,e){var n=this,r=n.axes,o=(n.config,a.util.getColorBand(n.config,e));return n.axes.hor.scale.rangePoints([0,n.width()]),t.func=d3.svg.line().x(function(t){return r.hor.scale(t.name)+r.hor.scale.rangeBand()/2}).y(function(t){return r.ver.scale(t.value)}).interpolate(a.config.line.interpolation),t.path.append("path").attr("d",t.func).classed("cr-"+a.util.formatClassName(n.categories[e]),!0).style("fill","none").style("stroke",o).style("stroke-width",n.config.line.strokewidth).style("stroke-opacity",n.config.line.strokeopacity).transition().duration(n.config.effects.duration).delay(2*e*n.config.effects.duration).style("stroke-opacity",1).call(a.util.endAll,function(t,r){d3.select(this.parentNode.parentNode).selectAll("path").on("mouseover",a.effects.line.mouseover(n,e)),d3.select(this.parentNode.parentNode).selectAll("path").on("mouseout",a.effects.line.mouseout(n,e)),d3.select(this.parentNode.parentNode).selectAll("circle").on("mouseover",a.effects.line.mouseover(n,e)),d3.select(this.parentNode.parentNode).selectAll("circle").on("mouseout",a.effects.line.mouseout(n,e))}),n.config.line.showcircles&&t.path.selectAll("circle").data(n.dataset[e]).enter().append("circle").attr("cx",t.func.x()).attr("cy",t.func.y()).attr("r",n.config.line.circleradius).classed("cr-"+a.util.formatClassName(n.categories[e]),!0).style("fill",o).style("fill-opacity",n.config.line.circleopacity).style("stroke","#fff").append("svg:title").text(function(t,r){return a.util.getTooltipText(n,n.categories[e],n.labels[r],t)}),t.path.selectAll("text").data(n.dataset[e]).enter().append("text").attr("x",function(t){return r.hor.scale(t.name)+r.hor.scale.rangeBand()/2}).attr("y",function(t){return r.ver.scale(t.value)-20}).attr("dx",0).attr("dy",".71em").attr("text-anchor","middle").classed("cr-"+a.util.formatClassName(n.categories[e]),!0).style("fill",n.config.label.showlabel?a.util.getColorBand(n.config,e):"none").style("font-family",n.config.line.fontfamily).style("font-size",n.config.line.fontsize).style("font-weight",n.config.line.fontweight).style("opacity",0).text(function(t){return a.util.getLabelValue(n,t)}).transition().duration(3*n.config.effects.duration).delay(2*e*n.config.effects.duration).style("opacity",1),this},a.PercentAreaGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init();{var r=d3.layout.stack().offset("zero")(n.categories.map(function(e){return t.dataset[e].map(function(t){return{x:t.name,y:+t.value}})})),o=n.labels;n.categories}n.axes["Horizontal"===n.config.graph.orientation?"ver":"hor"].scale.domain(o),n.areagroup=n.chart.selectAll("g.areagroup").data(r).enter().append("g").attr("class",function(t,e){return a.util.getClassName(this,"cge-"+n.categories[e])}),n["draw"+n.config.graph.orientation+"Area"](),n.finalize()},a.PercentAreaGraph.prototype=a.util.inherits(a.Graph),a.PercentAreaGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="percent",this},a.PercentAreaGraph.prototype.drawHorizontalArea=function(){var t=this,e=t.axes,n=t.categories,r=t.config,o=a.util.getSumUpArray(t.graphdef);e.ver.scale.rangePoints([0,t.height()]);for(var s=0;ss;s+=1)l=a.util.getColorBand(n.config,s),r=n.chart.append("g").classed("cg-"+n.categories[s],!0),o=r.selectAll("g").data(n.graphdef.dataset[n.categories[s]]).enter().append("g").classed("cge-"+a.util.formatClassName(n.categories[s]),!0),n["draw"+a.util.getPascalCasedName(n.config.graph.orientation)+"Bars"](o,f,u,s),"Vertical"===n.config.graph.orientation&&r.attr("transform","translate(0,"+2*n.height()+") scale(1,-1)"),n.bargroups.push(r);n.finalize()},a.PercentBarGraph.prototype=a.util.inherits(a.Graph),a.PercentBarGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="percent",t.config.scale.ordinality=0,this},a.PercentBarGraph.prototype.drawHorizontalBars=function(t,e,n,r){var o=this,s=this.axes,i=a.util.getColorBand(this.config,r),l=(this.config,a.util.getSumUpArray(this.graphdef));t.append("rect").attr("height",s.ver.scale.rangeBand()).attr("width",0).attr("x",function(t,n){var r=s.hor.scale(a.util.getPercentage(e[n],l[n]));return e[n]+=t.value,r}).attr("y",function(t){return s.ver.scale(t.name)}).classed("cr-"+a.util.formatClassName(o.categories[r]),!0).style("stroke","none").style("fill",i).transition().duration(o.config.effects.duration).delay(r*o.config.effects.duration).attr("width",function(t,e){return s.hor.scale(a.util.getPercentage(t.value,l[e]))}).call(a.util.endAll,function(t,e){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(o,r,o.config.effects.textcolor)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(o,r,o.config.effects.textcolor))}),t.append("text").attr("y",function(t){return s.ver.scale(t.name)+s.ver.scale.rangeBand()/2}).attr("dx",0).attr("dy",".35em").attr("text-anchor","end").classed("cr-"+a.util.formatClassName(o.categories[r]),!0).style("fill",o.config.label.showlabel?o.config.effects.textcolor:"none").style("font-family",this.config.bar.fontfamily).style("font-size",this.config.bar.fontsize).style("font-weight",this.config.bar.fontweight).text(function(t,n){return s.hor.scale(a.util.getPercentage(e[n],l[n]))>15?String(Math.round(a.util.getPercentage(t.value,l[n]))):null}).transition().duration(o.config.effects.duration).delay(r*o.config.effects.duration).attr("x",function(t,e){return n[e]+=t.value,s.hor.scale(a.util.getPercentage(n[e],l[e]))-5})},a.PercentBarGraph.prototype.drawVerticalBars=function(t,e,n,r){var o=this,s=this.height(),i=this.axes,l=a.util.getColorBand(this.config,r),c=(this.config,a.util.getSumUpArray(this.graphdef));t.append("rect").attr("height",0).attr("width",i.hor.scale.rangeBand()).attr("x",function(t){return i.hor.scale(t.name)}).attr("y",function(t,n){var r=i.ver.scale(a.util.getPercentage(e[n],c[n]));return e[n]-=t.value,r}).classed("cr-"+a.util.formatClassName(o.categories[r]),!0).style("stroke","none").style("fill",l).transition().duration(o.config.effects.duration).delay(r*o.config.effects.duration).attr("height",function(t,e){return s-i.ver.scale(a.util.getPercentage(t.value,c[e]))}).call(a.util.endAll,function(t,e){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(o,r,o.config.effects.textcolor)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(o,r,o.config.effects.textcolor))}),t.append("text").attr("transform","scale(1,-1)").attr("x",function(t){return i.hor.scale(t.name)+i.hor.scale.rangeBand()/2}).attr("y",-s+5).attr("dy",".71em").attr("text-anchor","middle").classed("cr-"+a.util.formatClassName(o.categories[r]),!0).style("fill",o.config.label.showlabel?o.config.effects.textcolor:"none").style("font-family",this.config.bar.fontfamily).style("font-size",this.config.bar.fontsize).style("font-weight",this.config.bar.fontweight).text(function(t,e){return s-i.ver.scale(a.util.getPercentage(t.value,c[e]))>15?String(Math.round(a.util.getPercentage(t.value,c[e]))):null}).transition().duration(o.config.effects.duration).delay(r*o.config.effects.duration).attr("y",function(t,e){return n[e]+=t.value,-(2*s-i.ver.scale(a.util.getPercentage(n[e],c[e])))+5})},a.PieGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.radius=2*Math.min(n.height(),n.width())/5,n.center={x:n.width()/2,y:n.height()/2},n.category=t.categories[0];var r=a.util.getCategoryData(n.graphdef,[n.category]),o=d3.svg.arc().innerRadius(0).outerRadius(n.radius),s=d3.layout.pie();n.chart.data(r),n.arcs=n.chart.selectAll("g.arc").data(s).enter().append("g").classed(a.constants.classes.arc+a.util.formatClassName(n.category),!0).attr("class",function(t,e){return a.util.getClassName(this,"cge-"+n.labels[e])}).attr("transform","translate("+n.center.x+","+n.center.y+")"),n.arcs.append("path").attr("d",o).style("fill",function(t,e){return a.util.getColorBand(n.config,e)}).style("stroke",n.config.pie.strokecolor).style("stroke-width",n.config.pie.strokewidth).on("mouseover",a.effects.pie.mouseover(n,n.center,o,n.config)).on("mouseout",a.effects.pie.mouseout(n,n.center,n.config)),n.arcs.append("text").attr("transform",function(t){return"translate("+o.centroid(t)+")"}).attr("dy",".35em").attr("text-anchor","middle").style("fill",n.config.label.showlabel?n.config.pie.fontfill:"none").style("font-family",n.config.pie.fontfamily).style("font-size",n.config.pie.fontsize).style("font-weight",n.config.pie.fontweight).style("font-variant",n.config.pie.fontvariant).text(function(t){return a.util.getLabelValue(n,t)}),n.arcs.append("svg:title").text(function(t,e){return a.util.getTooltipText(n,n.category,n.labels[e],t)}),"function"==typeof n.config.graph.clickCallback&&n.arcs.on("click",function(t){n.config.graph.clickCallback.apply(null,[t])})},a.PieGraph.prototype=a.util.inherits(a.Graph),a.PieGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="normal",t.config.legend.legendtype="labels",this},a.PolarAreaGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.maxRadius=2*Math.min(n.height(),n.width())/5,n.center={x:n.width()/2,y:n.height()/2},n.category=n.categories[0];for(var r=a.util.getCategoryData(n.graphdef,[n.category]),o=r[0].map(function(t,e){return t}),s=d3.layout.pie().value(function(t){return n.max()/r[0].length}),i=[],l=d3.svg.arc().innerRadius(0).outerRadius(function(t,e){return o[e]*n.maxRadius/n.max()}),c=1;c<=n.config.axis.ticks;c++)i[c]=n.maxRadius/n.config.axis.ticks*c;n.chart.data(r),n.arcs=n.chart.selectAll("g.arc").data(s).enter().append("g").classed(a.constants.classes.arc+a.util.formatClassName(n.category),!0).attr("transform","translate("+n.center.x+","+n.center.y+")"),n.arcs.append("path").attr("d",l).style("fill",function(t,e){return a.util.getColorBand(n.config,e)}).style("stroke",n.config.pie.strokecolor).style("stroke-width",n.config.pie.strokewidth),n.arcs.append("svg:title").text(function(t,e){return a.util.getTooltipText(n,n.category,n.labels[e],t)}),n.chart.selectAll("."+a.constants.classes.circleticks).data(i).enter().append("svg:g").classed(a.constants.classes.circleticks,!0).append("svg:circle").attr("r",function(t,e){return t}).style("stroke",n.config.axis.strokecolor).style("opacity",n.config.axis.opacity).style("fill","none").attr("transform","translate("+n.center.x+","+n.center.y+")"),"function"==typeof n.config.graph.clickCallback&&n.arcs.on("click",function(t){n.config.graph.clickCallback.apply(null,[t])})},a.PolarAreaGraph.prototype=a.util.inherits(a.Graph),a.PolarAreaGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="normal",t.config.legend.legendtype="labels",this},a.StackedAreaGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init();var r=d3.layout.stack().offset(n.config.area.offset)(n.categories.map(function(e){return t.dataset[e].map(function(t){return{x:t.name,y:+t.value}})}));n.axes["Horizontal"===n.config.graph.orientation?"ver":"hor"].scale.domain(n.labels.map(function(t){return t})),n.areagroup=n.chart.append("g").selectAll("g").data(r).enter().append("g").attr("class",function(t,e){return a.util.getClassName(this,"cge-"+n.categories[e])}),n["draw"+n.config.graph.orientation+"Area"](),n.finalize()},a.StackedAreaGraph.prototype=a.util.inherits(a.Graph),a.StackedAreaGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="stepup",this},a.StackedAreaGraph.prototype.drawHorizontalArea=function(){var t=this,e=t.axes,n=t.categories,r=t.config;e.ver.scale.rangePoints([0,t.height()]);for(var o=0;or;r+=1)n.bargroups[n.categories[r]]=n.chart.append("g").classed("cg-"+a.util.formatClassName(n.categories[r]),!0),n["draw"+n.config.graph.orientation+"Bars"](r,i,l);n.finalize()},a.StackedBarGraph.prototype=a.util.inherits(a.Graph),a.StackedBarGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="stepup",this},a.StackedBarGraph.prototype.drawHorizontalBars=function(t,e,n){var r=this,o=this.axes,s=a.util.getColorBand(this.config,t),i=this.config,l=this.bargroups[this.categories[t]],c=l.selectAll("g").data(this.graphdef.dataset[r.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(r.categories[t]),!0);c.append("rect").attr("height",o.ver.scale.rangeBand()).attr("width",0).attr("x",function(t,a){var n=o.hor.scale(e[a]);return e[a]+=t.value,n}).attr("y",function(t){return o.ver.scale(t.name)}).classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("stroke","none").style("fill",s).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).attr("width",function(t,a){return o.hor.scale(e[a])-o.hor.scale(e[a]-t.value)}).each("end",function(e,n){d3.select(this).on("mouseover",a.effects.bar.mouseover(r,t,r.config.effects.textcolor)),d3.select(this).on("mouseout",a.effects.bar.mouseout(r,t,r.config.effects.textcolor)),"function"==typeof r.config.graph.clickCallback&&d3.select(this).on("click",function(t){r.config.graph.clickCallback.apply(null,[t])})}),c.append("text").attr("y",function(t){return o.ver.scale(t.name)+o.ver.scale.rangeBand()/2}).attr("dx",0).attr("dy",".35em").attr("text-anchor","end").classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("fill",r.config.label.showlabel?r.config.effects.textcolor:"none").style("font-family",i.bar.fontfamily).style("font-size",i.bar.fontsize).style("font-weight",i.bar.fontweight).style("opacity",0).text(function(t){return o.hor.scale(t.value)>15?a.util.getLabelValue(r,t):null}).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).style("opacity",1).attr("x",function(t,e){return n[e]+=t.value,o.hor.scale(n[e])-5}),c.append("svg:title").text(function(e,n){return a.util.getTooltipText(r,r.categories[t],r.labels[n],e)})},a.StackedBarGraph.prototype.drawVerticalBars=function(t,e,n){var r=this,o=this.height(),s=this.axes,i=a.util.getColorBand(this.config,t),l=this.config,c=this.bargroups[r.categories[t]],f=c.selectAll("g").data(this.graphdef.dataset[r.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(r.categories[t]),!0);f.append("rect").attr("height",0).attr("width",s.hor.scale.rangeBand()).attr("x",function(t){return s.hor.scale(t.name)}).attr("y",function(t,a){var n=s.ver.scale(e[a]);return e[a]-=t.value,n}).classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("stroke","none").style("fill",i).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).attr("height",function(t,a){return-(s.ver.scale(-e[a])-s.ver.scale(-e[a]-t.value))}).each("end",function(e,n){d3.select(this).on("mouseover",a.effects.bar.mouseover(r,t,r.config.effects.textcolor)),d3.select(this).on("mouseout",a.effects.bar.mouseout(r,t,r.config.effects.textcolor)),"function"==typeof r.config.graph.clickCallback&&d3.select(this).on("click",function(t){r.config.graph.clickCallback.apply(null,[t])})}),f.append("text").attr("transform","scale(1,-1)").attr("x",function(t){return s.hor.scale(t.name)+s.hor.scale.rangeBand()/2}).attr("y",-o+5).attr("dy",".71em").attr("text-anchor","middle").classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("fill",r.config.label.showlabel?r.config.effects.textcolor:"none").style("font-family",l.bar.fontfamily).style("font-size",l.bar.fontsize).style("font-weight",l.bar.fontweight).style("opacity",0).text(function(t){ return o-s.ver.scale(t.value)>15?a.util.getLabelValue(r,t):null}).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).style("opacity",1).attr("y",function(t,e){return n[e]+=t.value,-(2*o-s.ver.scale(n[e]))+5}),f.append("svg:title").text(function(e,n){return a.util.getTooltipText(r,r.categories[t],r.labels[n],e)}),c.attr("transform","translate(0,"+2*this.height()+") scale(1,-1)")},a.StepUpBarGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),this.bargroups={};var r,o=n.categories.length,s=n.labels.map(function(t){return 0}),i=n.labels.map(function(t){return 0});for(n.axes["Horizontal"===this.config.graph.orientation?"ver":"hor"].scale.domain(this.labels),r=0;o>r;r+=1)n.bargroups[n.categories[r]]=this.chart.append("g").classed("cg-"+a.util.formatClassName(n.categories[r]),!0),n["draw"+n.config.graph.orientation+"Bars"](r,s,i);n.finalize()},a.StepUpBarGraph.prototype=a.util.inherits(a.Graph),a.StepUpBarGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="stepup",this},a.StepUpBarGraph.prototype.drawHorizontalBars=function(t,e,n){var r=this,o=r.categories.length,s=a.util.getColorBand(r.config,t),i=r.bargroups[r.categories[t]],l=i.selectAll("g").data(r.graphdef.dataset[r.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(r.categories[t]),!0);l.append("rect").attr("height",r.axes.ver.scale.rangeBand()/o).attr("width",0).attr("transform",function(t){return t.value<0?"scale(-1,1)":"scale(1,1)"}).attr("x",function(t,a){t.resetSum===!0&&(e[a]=0);var n=r.axes.hor.scale(e[a]);return e[a]+=t.value,t.value<0?-n:n}).attr("y",function(t){return r.axes.ver.scale(t.name)}).classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("stroke","none").style("fill",s).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).attr("width",function(t,a){return Math.abs(r.axes.hor.scale(e[a])-r.axes.hor.scale(e[a]-t.value))}).call(a.util.endAll,function(e,n){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(r,t)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(r,t))}),l.append("text").attr("y",function(t){return r.axes.ver.scale(t.name)+r.axes.ver.scale.rangeBand()/o/2}).attr("dx",function(t){return t.value<0?-16:4}).attr("dy",".35em").attr("text-anchor","start").classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("fill",r.config.label.showlabel?a.util.getColorBand(r.config,t):"none").style("opacity",0).style("font-family",r.config.bar.fontfamily).style("font-size",r.config.bar.fontsize).style("font-weight",r.config.bar.fontweight).text(function(t){return a.util.getLabelValue(r,t)}).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).style("opacity",1).attr("x",function(t,e){return t.resetSum===!0&&(n[e]=0),n[e]+=t.value,r.axes.hor.scale(n[e])}),l.append("svg:title").text(function(e,n){return a.util.getTooltipText(r,r.categories[t],r.labels[n],e)}),i.attr("transform","translate(0,"+t*r.axes.ver.scale.rangeBand()/o+")")},a.StepUpBarGraph.prototype.drawVerticalBars=function(t,e,n){var r=this,o=r.categories.length,s=a.util.getColorBand(r.config,t),i=r.bargroups[r.categories[t]],l=i.selectAll("g").data(r.graphdef.dataset[r.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(r.categories[t]),!0);l.append("rect").attr("height",0).attr("width",r.axes.hor.scale.rangeBand()/o).attr("transform",function(t){return t.value<0?"scale(1,-1)":"scale(1,1)"}).attr("x",function(t){return r.axes.hor.scale(t.name)}).attr("y",function(t,a){t.resetSum===!0&&(e[a]=0);var n=2*r.height()-r.axes.ver.scale(e[a]);return e[a]+=t.value,t.value<0?-n:n}).classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("stroke","none").style("fill",s).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).attr("height",function(t,a){return Math.abs(r.axes.ver.scale(-e[a])-r.axes.ver.scale(-e[a]-t.value))}).call(a.util.endAll,function(e,n){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(r,t)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(r,t))}),l.append("text").attr("transform","scale(1,-1)").attr("x",function(t){return r.axes.hor.scale(t.name)+r.axes.hor.scale.rangeBand()/o/2}).attr("y",-r.height()-10).attr("dy",function(t){return t.value<0?"2.3em":".71em"}).attr("text-anchor","middle").classed("cr-"+a.util.formatClassName(r.categories[t]),!0).style("fill",r.config.label.showlabel?a.util.getColorBand(r.config,t):"none").style("font-family",r.config.bar.fontfamily).style("font-size",r.config.bar.fontsize).style("font-weight",r.config.bar.fontweight).style("opacity",0).text(function(t){return a.util.getLabelValue(r,t)}).transition().duration(r.config.effects.duration).delay(t*r.config.effects.duration).style("opacity",1).attr("y",function(t,e){return t.resetSum===!0&&(n[e]=0),n[e]+=t.value,-(2*r.height()-r.axes.ver.scale(n[e]))-10}),l.append("svg:title").text(function(e,n){return a.util.getTooltipText(r,r.categories[t],r.labels[n],e)}),i.attr("transform","translate("+t*r.axes.hor.scale.rangeBand()/o+","+2*r.height()+") scale(1,-1)")},a.Table=function(){this.caption=void 0,this.position=void 0,this.graphdef=void 0,this.table=void 0,this.header=void 0,this.body=void 0,this.bodyrows={}},a.Table.prototype.init=function(t,e){this.graphdef=t,this.config=a.util.extend({},e),this.position=this.config.meta.pos||"body",this.table=d3.select(this.position).append("table").classed(this.config.table.tableclass,!0),this.header=this.table.append("thead").classed(this.config.table.headerclass,!0),this.body=this.table.append("tbody").classed(this.config.table.bodyclass,!0),this.footer=this.table.append("tfoot").classed(this.config.table.footerclass,!0)},a.Table.prototype.finalize=function(){},a.TableGraph=function(t,e){a.Table.apply(this,[t]),this.init(t,e),"Horizontal"===this.config.graph.orientation?this.setHorTable():this.setVerTable(),this.finalize()},a.TableGraph.prototype=a.util.inherits(a.Table),a.TableGraph.prototype.setHorTable=function(){var t=this.graphdef.categories,e=a.util.getTabularArray(this.graphdef);t.unshift(""),this.header.append("tr").selectAll("td").data(t).enter().append("td").text(function(t){return t}),t.shift(),this.bodyrows=this.body.selectAll("tr").data(e).enter().append("tr"),this.bodyrows.selectAll("td").data(function(t,a){return e[a]}).enter().append("td").attr("class",function(t,e){var a=0===e?"chart3rtablelabel":"chart3rtabledata";return d3.select(this).attr("class")+a}).text(function(t){return t})},a.TableGraph.prototype.setVerTable=function(){var t=a.util.getLabelArray(this.graphdef),e=this.graphdef.dataset;t.unshift(""),this.header.append("tr").selectAll("td").data(t).enter().append("td").text(function(t){return t}),t.shift(),this.bodyrows=this.body.selectAll("tr").data(this.graphdef.categories).enter().append("tr"),this.bodyrows.selectAll("td").data(function(t){var a,n,r=[];for(r.push(t),a=0,n=e[t].length;n>a;a+=1)r.push(e[t][a].value);return r}).enter().append("td").attr("class",function(t,e){var a=0===e?"chart3rtablelabel":"chart3rtabledata";return d3.select(this).attr("class")+a}).text(function(t){return t})},a.WaterfallGraph=function(t,e){var n=this;a.Graph.call(n,t,e).setDefaults().init(),n.bargroups={},n.axes["Horizontal"===n.config.graph.orientation?"ver":"hor"].scale.domain(n.labels);{var r;n.categories.length}r=n.categories[0],n.bargroups[r]=n.chart.append("g").classed("cg-"+a.util.formatClassName(r),!0),n["draw"+n.config.graph.orientation+"Bars"](0),n.finalize()},a.WaterfallGraph.prototype=a.util.inherits(a.Graph),a.WaterfallGraph.prototype.setDefaults=function(){var t=this;return t.graphdef.stepup="waterfall",t.config.legend.showlegends=!1,this},a.WaterfallGraph.prototype.drawHorizontalBars=function(t){var e=this,n=e.categories.length,r=a.util.getColorBand(e.config,t),o=e.bargroups[e.categories[t]],s=0,i=0,l=o.selectAll("g").data(e.graphdef.dataset[e.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(e.categories[t]),!0);l.append("rect").attr("height",e.axes.ver.scale.rangeBand()/n-2).attr("width",0).attr("x",function(t,a){var n=t.value<0?s+t.value:s;return s+=t.value,e.axes.hor.scale(n)}).attr("y",function(t){return e.axes.ver.scale(t.name)}).classed("cr-"+a.util.formatClassName(e.categories[t]),!0).style("stroke","none").style("fill",r).transition().duration(e.config.effects.duration).delay(t*e.config.effects.duration).attr("width",function(t){return e.axes.hor.scale(Math.abs(t.value))}).call(a.util.endAll,function(n,r){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(e,t)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(e,t))}),l.append("text").attr("y",function(t){return e.axes.ver.scale(t.name)+e.axes.ver.scale.rangeBand()/n/2}).attr("dx",4).attr("dy",".35em").attr("text-anchor","start").classed("cr-"+a.util.formatClassName(e.categories[t]),!0).style("fill",e.config.label.showlabel?a.util.getColorBand(e.config,t):"none").style("font-family",e.config.bar.fontfamily).style("font-size",e.config.bar.fontsize).style("font-weight",e.config.bar.fontweight).text(function(t){return a.util.getLabelValue(e,t)}).transition().duration(e.config.effects.duration).delay(t*e.config.effects.duration).attr("x",function(t,a){var n=t.value<0?i:i+t.value;return i+=t.value,e.axes.hor.scale(n)}),l.append("svg:title").text(function(n,r){return a.util.getTooltipText(e,e.categories[t],e.labels[r],n)}),o.attr("transform","translate(0,"+t*e.axes.ver.scale.rangeBand()/n+")")},a.WaterfallGraph.prototype.drawVerticalBars=function(t){var e=this,n=a.util.getColorBand(this.config,t),r=e.categories.length,o=0,s=0,i=e.bargroups[e.categories[t]].selectAll("g").data(e.graphdef.dataset[e.categories[t]]).enter().append("g").classed("cge-"+a.util.formatClassName(e.categories[t]),!0);i.append("rect").classed("cr-"+a.util.formatClassName(e.categories[t]),!0).attr("height",0).attr("width",0).attr("x",function(t){return e.axes.hor.scale(t.name)}).attr("y",function(t){var a=t.value<0?o+t.value:o;return o+=t.value,e.height()-e.axes.ver.scale(a)}).style("stroke",e.config.bar.strokecolor).style("fill",n).transition().duration(e.config.effects.duration).delay(t*e.config.effects.duration).attr("height",function(t){return e.height()-e.axes.ver.scale(Math.abs(t.value))}).attr("width",e.axes.hor.scale.rangeBand()/r-2).call(a.util.endAll,function(n,r){d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseover",a.effects.bar.mouseover(e,t)),d3.select(this.parentNode.parentNode).selectAll("rect").on("mouseout",a.effects.bar.mouseout(e,t))}),i.append("text").attr("transform","scale(1,-1)").attr("x",function(t){return e.axes.hor.scale(t.name)+e.axes.hor.scale.rangeBand()/r/2}).attr("y",-10).attr("dx",0).attr("dy",".35em").attr("text-anchor","middle").classed("cr-"+a.util.formatClassName(e.categories[t]),!0).style("fill",e.config.label.showlabel?a.util.getColorBand(e.config,t):"none").style("font-family",e.config.bar.fontfamily).style("font-size",e.config.bar.fontsize).style("font-weight",e.config.bar.fontweight).text(function(t){return a.util.getLabelValue(e,t)}).transition().duration(e.config.effects.duration).delay(t*e.config.effects.duration).attr("y",function(t){s+=t.value;var a=t.value<0?s-t.value:s;return-(e.height()-e.axes.ver.scale(a))-10}),i.append("svg:title").text(function(n,r){return a.util.getTooltipText(e,e.categories[t],e.labels[r],n)}),e.bargroups[e.categories[t]].attr("transform","translate("+t*e.axes.hor.scale.rangeBand()/r+","+e.height()+") scale(1,-1)")},e||(t.uv={chart:a.chart}),{chart:a.chart}});