dc=function(){"use strict";var a={version:"1.6.0",constants:{CHART_CLASS:"dc-chart",DEBUG_GROUP_CLASS:"debug",STACK_CLASS:"stack",DESELECTED_CLASS:"deselected",SELECTED_CLASS:"selected",NODE_INDEX_NAME:"__index__",GROUP_INDEX_NAME:"__group_index__",DEFAULT_CHART_GROUP:"__default_chart_group__",EVENT_DELAY:40,NEGLIGIBLE_NUMBER:1e-10},_renderlet:null};return a.chartRegistry=function(){function b(b){return b||(b=a.constants.DEFAULT_CHART_GROUP),c[b]||(c[b]=[]),b}var c={};return{has:function(a){for(var b in c)if(c[b].indexOf(a)>=0)return!0;return!1},register:function(a,d){d=b(d),c[d].push(a)},clear:function(){c={}},list:function(a){return a=b(a),c[a]}}}(),a.registerChart=function(b,c){a.chartRegistry.register(b,c)},a.hasChart=function(b){return a.chartRegistry.has(b)},a.deregisterAllCharts=function(){a.chartRegistry.clear()},a.filterAll=function(b){for(var c=a.chartRegistry.list(b),d=0;d<c.length;++d)c[d].filterAll()},a.renderAll=function(b){for(var c=a.chartRegistry.list(b),d=0;d<c.length;++d)c[d].render();null!==a._renderlet&&a._renderlet(b)},a.redrawAll=function(b){for(var c=a.chartRegistry.list(b),d=0;d<c.length;++d)c[d].redraw();null!==a._renderlet&&a._renderlet(b)},a.transition=function(a,b,c){if(0>=b||void 0===b)return a;var d=a.transition().duration(b);return c instanceof Function&&c(d),d},a.units={},a.units.integers=function(a,b){return Math.abs(b-a)},a.units.ordinal=function(a,b,c){return c},a.units.fp={},a.units.fp.precision=function(b){var c=function(b,d){var e=Math.abs((d-b)/c.resolution);return a.utils.isNegligible(e-Math.floor(e))?Math.floor(e):Math.ceil(e)};return c.resolution=b,c},a.round={},a.round.floor=function(a){return Math.floor(a)},a.round.ceil=function(a){return Math.ceil(a)},a.round.round=function(a){return Math.round(a)},a.override=function(a,b,c){var d=a[b];a["_"+b]=d,a[b]=c},a.renderlet=function(b){return arguments.length?(a._renderlet=b,a):a._renderlet},a.instanceOfChart=function(a){return a instanceof Object&&a.__dc_flag__},a.errors={},a.errors.Exception=function(a){var b=void 0!==a?a:"Unexpected internal error";this.message=b,this.toString=function(){return b}},a.errors.InvalidStateException=function(){a.errors.Exception.apply(this,arguments)},a.dateFormat=d3.time.format("%m/%d/%Y"),a.printers={},a.printers.filters=function(b){for(var c="",d=0;d<b.length;++d)d>0&&(c+=", "),c+=a.printers.filter(b[d]);return c},a.printers.filter=function(b){var c="";return b&&(b instanceof Array?b.length>=2?c="["+a.utils.printSingleValue(b[0])+" -> "+a.utils.printSingleValue(b[1])+"]":b.length>=1&&(c=a.utils.printSingleValue(b[0])):c=a.utils.printSingleValue(b)),c},a.utils={},a.utils.printSingleValue=function(b){var c=""+b;return b instanceof Date?c=a.dateFormat(b):"string"==typeof b?c=b:a.utils.isFloat(b)?c=a.utils.printSingleValue.fformat(b):a.utils.isInteger(b)&&(c=Math.round(b)),c},a.utils.printSingleValue.fformat=d3.format(".2f"),a.utils.add=function(a,b){if("string"==typeof b&&(b=b.replace("%","")),a instanceof Date){"string"==typeof b&&(b=+b);var c=new Date;return c.setTime(a.getTime()),c.setDate(a.getDate()+b),c}if("string"==typeof b){var d=+b/100;return a>0?a*(1+d):a*(1-d)}return a+b},a.utils.subtract=function(a,b){if("string"==typeof b&&(b=b.replace("%","")),a instanceof Date){"string"==typeof b&&(b=+b);var c=new Date;return c.setTime(a.getTime()),c.setDate(a.getDate()-b),c}if("string"==typeof b){var d=+b/100;return 0>a?a*(1+d):a*(1-d)}return a-b},a.utils.GroupStack=function(){function a(a){c[a]||(c[a]=[])}var b,c=[[]],d=[];this.setDataPoint=function(b,d,e){a(b),c[b][d]=e},this.getDataPoint=function(b,d){a(b);var e=c[b][d];return void 0===e&&(e=0),e},this.addGroup=function(a,c){return c||(c=b),d.push([a,c]),d.length-1},this.getGroupByIndex=function(a){return d[a][0]},this.getAccessorByIndex=function(a){return d[a][1]},this.size=function(){return d.length},this.clear=function(){c=[],d=[]},this.setDefaultAccessor=function(a){b=a},this.getDataLayers=function(){return c},this.toLayers=function(){for(var a=[],b=0;b<c.length;++b){for(var d={index:b,points:[]},e=c[b],f=0;f<e.length;++f)d.points.push(e[f]);a.push(d)}return a}},a.utils.isNumber=function(a){return a===+a},a.utils.isFloat=function(a){return a===+a&&a!==(0|a)},a.utils.isInteger=function(a){return a===+a&&a===(0|a)},a.utils.isNegligible=function(b){return void 0===b||b<a.constants.NEGLIGIBLE_NUMBER&&b>-a.constants.NEGLIGIBLE_NUMBER},a.utils.groupMax=function(b,c){var d=d3.max(b.all(),function(a){return c(a)});return a.utils.isNegligible(d)&&(d=0),d},a.utils.groupMin=function(b,c){var d=d3.min(b.all(),function(a){return c(a)});return a.utils.isNegligible(d)&&(d=0),d},a.utils.nameToId=function(a){return a.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},a.utils.appendOrSelect=function(a,b){var c=a.select(b);return c.empty()&&(c=a.append(b)),c},a.utils.createLegendable=function(a,b,c,d){var e={name:a._getGroupName(b,d),data:b};return"function"==typeof a.colors&&(e.color=a.colors()(c)),e},a.utils.safeNumber=function(b){return a.utils.isNumber(+b)?+b:0},a.events={current:null},a.events.trigger=function(b,c){return c?(a.events.current=b,setTimeout(function(){b==a.events.current&&b()},c),void 0):(b(),void 0)},a.cumulative={},a.cumulative.Base=function(){this._keyIndex=[],this._map={},this.sanitizeKey=function(a){return a+=""},this.clear=function(){this._keyIndex=[],this._map={}},this.size=function(){return this._keyIndex.length},this.getValueByKey=function(a){a=this.sanitizeKey(a);var b=this._map[a];return b},this.setValueByKey=function(a,b){return a=this.sanitizeKey(a),this._map[a]=b},this.indexOfKey=function(a){return a=this.sanitizeKey(a),this._keyIndex.indexOf(a)},this.addToIndex=function(a){a=this.sanitizeKey(a),this._keyIndex.push(a)},this.getKeyByIndex=function(a){return this._keyIndex[a]}},a.cumulative.Sum=function(){a.cumulative.Base.apply(this,arguments),this.add=function(a,b){b||(b=0),void 0===this.getValueByKey(a)?(this.addToIndex(a),this.setValueByKey(a,b)):this.setValueByKey(a,this.getValueByKey(a)+b)},this.minus=function(a,b){this.setValueByKey(a,this.getValueByKey(a)-b)},this.cumulativeSum=function(a){var b=this.indexOfKey(a);if(0>b)return 0;for(var c=0,d=0;b>=d;++d){var e=this.getKeyByIndex(d);c+=this.getValueByKey(e)}return c}},a.cumulative.Sum.prototype=new a.cumulative.Base,a.cumulative.CountUnique=function(){function b(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c}a.cumulative.Base.apply(this,arguments),this.add=function(a,b){void 0===this.getValueByKey(a)&&(this.setValueByKey(a,{}),this.addToIndex(a)),void 0!==b&&(void 0===this.getValueByKey(a)[b]&&(this.getValueByKey(a)[b]=0),this.getValueByKey(a)[b]+=1)},this.minus=function(a,b){this.getValueByKey(a)[b]-=1,this.getValueByKey(a)[b]<=0&&delete this.getValueByKey(a)[b]},this.count=function(a){return b(this.getValueByKey(a))},this.cumulativeCount=function(a){var b=this.indexOfKey(a);if(0>b)return 0;for(var c=0,d=0;b>=d;++d){var e=this.getKeyByIndex(d);c+=this.count(e)}return c}},a.cumulative.CountUnique.prototype=new a.cumulative.Base,a.baseChart=function(b){function c(a,b,c){var d=a.anchor(),e="__names__";c&&c!=a.valueAccessor()||(c="default"),b[e]||(b[e]={}),b[e][d]||(b[e][d]={a:[],n:[]});var f=b[e][d].a.indexOf(c);return-1==f&&(f=b[e][d].a.length,b[e][d].a[f]=c,b[e][d].n[f]={name:""}),b[e][d].n[f]}function d(){return n=b.root().append("svg").attr("width",b.width()).attr("height",b.height())}function e(a){E.splice(E.indexOf(a),1),h(),b._invokeFilteredListener(a)}function f(a){E.push(a),h(),b._invokeFilteredListener(a)}function g(){E=[],h(),b._invokeFilteredListener(null)}function h(){if(b.dataSet()&&void 0!==b.dimension().filter){var a=F(b.dimension(),E);E=a?a:E}}function i(){for(var a=0;a<A.length;++a)A[a](b)}b.__dc_flag__=!0;var j,k,l,m,n,o,p=200,q=200,r=function(a){return a.key},s=function(a){return a.value},t=function(a){return a.key},u=function(a){return a.key},v=!1,w=function(a){return a.key+": "+a.value},x=!1,y=750,z=a.printers.filters,A=[],B=a.constants.DEFAULT_CHART_GROUP,C=function(){},D={preRender:C,postRender:C,preRedraw:C,postRedraw:C,filtered:C,zoomed:C},E=[],F=function(a,b){return a.filter(null),0===b.length?a.filter(null):1===b.length?a.filter(b[0]):a.filterFunction(function(a){return b.indexOf(a)>=0}),b};return b.width=function(a){return arguments.length?(p=a,b):p},b.height=function(a){return arguments.length?(q=a,b):q},b.dimension=function(a){return arguments.length?(j=a,b.expireCache(),b):j},b.group=function(a,c){return arguments.length?(k=a,b.expireCache(),"string"==typeof c&&b._setGroupName(k,c),b):k},b._getGroupName=function(a,d){return c(b,a,d).name},b._setGroupName=function(a,d,e){c(b,a,e).name=d},b.ordering=function(a){return arguments.length?(t=a,b.expireCache(),b):t},b.computeOrderedGroups=function(a){var c=a?a:b.group().all().slice(0);if(c.length<2)return c;var d=crossfilter.quicksort.by(b.ordering());return d(c,0,c.length)},b.filterAll=function(){return b.filter(null)},b.dataSet=function(){return void 0!==j&&void 0!==k},b.select=function(a){return m.select(a)},b.selectAll=function(a){return m?m.selectAll(a):null},b.anchor=function(c,d){return arguments.length?(a.instanceOfChart(c)?(l=c.anchor(),m=c.root()):(l=c,m=d3.select(l),m.classed(a.constants.CHART_CLASS,!0),a.registerChart(b,d)),B=d,b):l},b.anchorName=function(){var a=b.anchor();return a&&a.id?a.id:a?a.replace("#",""):""},b.root=function(a){return arguments.length?(m=a,b):m},b.svg=function(a){return arguments.length?(n=a,b):n},b.resetSvg=function(){return b.select("svg").remove(),d()},b.filterPrinter=function(a){return arguments.length?(z=a,b):z},b.turnOnControls=function(){return m&&(b.selectAll(".reset").style("display",null),b.selectAll(".filter").text(z(b.filters())).style("display",null)),b},b.turnOffControls=function(){return m&&(b.selectAll(".reset").style("display","none"),b.selectAll(".filter").style("display","none").text(b.filter())),b},b.transitionDuration=function(a){return arguments.length?(y=a,b):y},b.render=function(){if(D.preRender(b),void 0===j)throw new a.errors.InvalidStateException("Mandatory attribute chart.dimension is missing on chart[#"+b.anchorName()+"]");if(void 0===k)throw new a.errors.InvalidStateException("Mandatory attribute chart.group is missing on chart[#"+b.anchorName()+"]");var c=b.doRender();return o&&o.render(),b.activateRenderlets("postRender"),c},b.activateRenderlets=function(a){b.transitionDuration()>0&&n?n.transition().duration(b.transitionDuration()).each("end",function(){i(),a&&D[a](b)}):(i(),a&&D[a](b))},b.redraw=function(){D.preRedraw(b);var a=b.doRedraw();return b.activateRenderlets("postRedraw"),a},b._invokeFilteredListener=function(a){void 0!==a&&D.filtered(b,a)},b._invokeZoomedListener=function(){D.zoomed(b)},b.hasFilter=function(a){return arguments.length?E.indexOf(a)>=0:E.length>0},b.filter=function(a){return arguments.length?(null===a?g():b.hasFilter(a)?e(a):f(a),null!==m&&b.hasFilter()?b.turnOnControls():b.turnOffControls(),b):E.length>0?E[0]:null},b.filters=function(){return E},b.highlightSelected=function(b){d3.select(b).classed(a.constants.SELECTED_CLASS,!0),d3.select(b).classed(a.constants.DESELECTED_CLASS,!1)},b.fadeDeselected=function(b){d3.select(b).classed(a.constants.SELECTED_CLASS,!1),d3.select(b).classed(a.constants.DESELECTED_CLASS,!0)},b.resetHighlight=function(b){d3.select(b).classed(a.constants.SELECTED_CLASS,!1),d3.select(b).classed(a.constants.DESELECTED_CLASS,!1)},b.onClick=function(c){var d=b.keyAccessor()(c);a.events.trigger(function(){b.filter(d),a.redrawAll(b.chartGroup())})},b.filterHandler=function(a){return arguments.length?(F=a,b):F},b.doRender=function(){return b},b.doRedraw=function(){return b},b.legendables=function(){return[]},b.legendHighlight=function(){},b.legendReset=function(){},b.keyAccessor=function(a){return arguments.length?(r=a,b):r},b.valueAccessor=function(a){return arguments.length?(s=a,b):s},b.label=function(a){return arguments.length?(u=a,v=!0,b):u},b.renderLabel=function(a){return arguments.length?(v=a,b):v},b.title=function(a){return arguments.length?(w=a,x=!0,b):w},b.renderTitle=function(a){return arguments.length?(x=a,b):x},b.renderlet=function(a){return A.push(a),b},b.chartGroup=function(a){return arguments.length?(B=a,b):B},b.expireCache=function(){return b},b.legend=function(a){return arguments.length?(o=a,o.parent(b),b):o},b.on=function(a,c){return D[a]=c,b},b},a.marginable=function(a){var b={top:10,right:50,bottom:30,left:30};return a.margins=function(c){return arguments.length?(b=c,a):b},a.effectiveWidth=function(){return a.width()-a.margins().left-a.margins().right},a.effectiveHeight=function(){return a.height()-a.margins().top-a.margins().bottom},a},a.coordinateGridChart=function(b){function c(a){b.elasticX()&&!b.isOrdinal()?w.domain([b.xAxisMin(),b.xAxisMax()]):b.isOrdinal()&&0===w.domain().length&&w.domain(b.computeOrderedGroups().map(function(a){return a.key})),b.isOrdinal()?b.prepareOrdinalXAxis():w.range([0,b.xAxisLength()]),F=F.scale(b.x()).orient("bottom"),d(a)}function d(c){var d=c.selectAll("g."+p);if(R){d.empty()&&(d=c.insert("g",":first-child").attr("class",n+" "+p).attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var e=F.tickValues()?F.tickValues():w.ticks(F.ticks()[0]),f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",function(a){return w(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return w(a)}).attr("y2",0).attr("opacity",0);a.transition(g,b.transitionDuration()).attr("opacity",1),a.transition(f,b.transitionDuration()).attr("x1",function(a){return w(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return w(a)}).attr("y2",0),f.exit().remove()}else d.selectAll("line").remove()}function e(a){(void 0===z||b.elasticY())&&(z=d3.scale.linear(),z.domain([b.yAxisMin(),b.yAxisMax()]).rangeRound([b.yAxisHeight(),0])),z.range([b.yAxisHeight(),0]),K=K.scale(z).orient("left"),f(a)}function f(c){var d=c.selectAll("g."+o);if(Q){var e=K.tickValues()?K.tickValues():z.ticks(K.ticks()[0]);d.empty()&&(d=c.insert("g",":first-child").attr("class",n+" "+o).attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",1).attr("y1",function(a){return z(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return z(a)}).attr("opacity",0);a.transition(g,b.transitionDuration()).attr("opacity",1),a.transition(f,b.transitionDuration()).attr("x1",1).attr("y1",function(a){return z(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return z(a)}),f.exit().remove()}else d.selectAll("line").remove()}function g(){return b.xAxisY()-b.margins().top}function h(){var c=b.extendBrush();b.redrawBrush(u),b.brushIsEmpty(c)?a.events.trigger(function(){b.filter(null),a.redrawAll(b.chartGroup())}):a.events.trigger(function(){b.filter(null),b.filter([c[0],c[1]]),a.redrawAll(b.chartGroup())},a.constants.EVENT_DELAY)}function i(){return b.anchorName()+"-clip"}function j(){var c=a.utils.appendOrSelect(t,"defs"),d=a.utils.appendOrSelect(c,"clipPath").attr("id",i()),e=2*W;a.utils.appendOrSelect(d,"rect").attr("width",b.xAxisLength()+e).attr("height",b.yAxisHeight()+e)}function k(){V&&b.root().call(d3.behavior.zoom().x(b.x()).scaleExtent(T).on("zoom",function(){b.focus(b.x().domain()),b._invokeZoomedListener(),l()}))}function l(){if(D){var c=b.x().domain();if(U){var d=D.xOriginalDomain(),e=[c[0]<d[0]?c[0]:d[0],c[1]>d[1]?c[1]:d[1]];D.focus(e)}else D.focus(c);D.filter(null),D.filter(c),a.events.trigger(function(){a.redrawAll(b.chartGroup())})}}function m(a){return a instanceof Array&&a.length>1}var n="grid-line",o="horizontal",p="vertical",q="y-axis-label",r="x-axis-label",s=12;b=a.colorChart(a.marginable(a.baseChart(b))),b.colors(d3.scale.category10());var t,u,v,w,x,y,z,A,B,C,D,E,F=d3.svg.axis(),G=a.units.integers,H=0,I=!1,J=0,K=d3.svg.axis(),L=0,M=!1,N=0,O=d3.svg.brush(),P=!0,Q=!1,R=!1,S=!1,T=[-10,100],U=!0,V=!1,W=0;return b.title(function(a){return a.data.key+": "+a.data.value}),b.rescale=function(){C=void 0,b.xUnitCount()},b.rangeChart=function(a){return arguments.length?(D=a,D.focusChart(b),b):D},b.zoomScale=function(a){return arguments.length?(T=a,b):T},b.zoomOutRestrict=function(a){return arguments.length?(U=a,b):U},b._generateG=function(a){return t=void 0===a?b.svg():a,u=t.append("g"),v=u.append("g").attr("class","chart-body").attr("transform","translate("+b.margins().left+", "+b.margins().top+")").attr("clip-path","url(#"+i()+")"),u},b.g=function(a){return arguments.length?(u=a,b):u},b.mouseZoomable=function(a){return arguments.length?(V=a,b):V},b.chartBodyG=function(a){return arguments.length?(v=a,b):v},b.x=function(a){return arguments.length?(w=a,x=w.domain(),b):w},b.xOriginalDomain=function(){return x},b.xUnits=function(a){return arguments.length?(G=a,b):G},b.xAxis=function(a){return arguments.length?(F=a,b):F},b.elasticX=function(a){return arguments.length?(I=a,b):I},b.xAxisPadding=function(a){return arguments.length?(H=a,b):H},b.xUnitCount=function(){if(void 0===C){var a=b.xUnits()(b.x().domain()[0],b.x().domain()[1],b.x().domain());C=a instanceof Array?a.length:a}return C},b.isOrdinal=function(){return b.xUnits()===a.units.ordinal},b.prepareOrdinalXAxis=function(a){a||(a=b.xUnitCount());for(var c=[],d=b.xAxisLength()/(a+1),e=d/2,f=0;a>f;f++)c[f]=e,e+=d;w.range(c)},b.renderXAxis=function(c){var d=c.selectAll("g.x");d.empty()&&(d=c.append("g").attr("class","axis x").attr("transform","translate("+b.margins().left+","+b.xAxisY()+")"));var e=c.selectAll("text."+r);e.empty()&&b.xAxisLabel()&&(e=c.append("text").attr("transform","translate("+b.xAxisLength()/2+","+(b.height()-J)+")").attr("class",r).attr("text-anchor","middle").text(b.xAxisLabel())),b.xAxisLabel()&&e.text()!=b.xAxisLabel()&&axisYLab.text(b.xAxisLabel()),a.transition(d,b.transitionDuration()).call(F)},b.xAxisY=function(){return b.height()-b.margins().bottom},b.xAxisLength=function(){return b.effectiveWidth()},b.xAxisLabel=function(a,c){return arguments.length?(y=a,b.margins().bottom-=J,J=void 0===c?s:c,b.margins().bottom+=J,b):y},b.renderYAxis=function(c){var d=c.selectAll("g.y");d.empty()&&(d=c.append("g").attr("class","axis y").attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var e=c.selectAll("text."+q);e.empty()&&b.yAxisLabel()&&(e=c.append("text").attr("transform","translate("+N+","+b.yAxisHeight()/2+"),rotate(-90)").attr("class",q).attr("text-anchor","middle").text(b.yAxisLabel())),b.yAxisLabel()&&e.text()!=b.yAxisLabel()&&e.text(b.yAxisLabel()),a.transition(d,b.transitionDuration()).call(K)},b.yAxisX=function(){return b.margins().left},b.yAxisLabel=function(a,c){return arguments.length?(A=a,b.margins().left-=N,N=void 0===c?s:c,b.margins().left+=N,b):A},b.y=function(a){return arguments.length?(z=a,b):z},b.yAxis=function(a){return arguments.length?(K=a,b):K},b.elasticY=function(a){return arguments.length?(M=a,b):M},b.renderHorizontalGridLines=function(a){return arguments.length?(Q=a,b):Q},b.renderVerticalGridLines=function(a){return arguments.length?(R=a,b):R},b.xAxisMin=function(){var c=d3.min(b.group().all(),function(a){return b.keyAccessor()(a)});return a.utils.subtract(c,H)},b.xAxisMax=function(){var c=d3.max(b.group().all(),function(a){return b.keyAccessor()(a)});return a.utils.add(c,H)},b.yAxisMin=function(){var c=d3.min(b.group().all(),function(a){return b.valueAccessor()(a)});return c=a.utils.subtract(c,L)},b.yAxisMax=function(){var c=d3.max(b.group().all(),function(a){return b.valueAccessor()(a)});return c=a.utils.add(c,L)},b.yAxisPadding=function(a){return arguments.length?(L=a,b):L},b.yAxisHeight=function(){return b.effectiveHeight()},b.round=function(a){return arguments.length?(B=a,b):B},a.override(b,"filter",function(a){return arguments.length?(b._filter(a),a?b.brush().extent(a):b.brush().clear(),b):b._filter()}),b.brush=function(a){return arguments.length?(O=a,b):O},b.renderBrush=function(a){if(b.isOrdinal()&&(P=!1),P){O.on("brush",h);var c=a.append("g").attr("class","brush").attr("transform","translate("+b.margins().left+","+b.margins().top+")").call(O.x(b.x()));c.selectAll("rect").attr("height",g()),c.selectAll(".resize").append("path").attr("d",b.resizeHandlePath),b.hasFilter()&&b.redrawBrush(a)}},b.extendBrush=function(){var a=O.extent();return b.round()&&(a[0]=a.map(b.round())[0],a[1]=a.map(b.round())[1],u.select(".brush").call(O.extent(a))),a},b.brushIsEmpty=function(a){return O.empty()||!a||a[1]<=a[0]},b.redrawBrush=function(a){if(P){b.filter()&&b.brush().empty()&&b.brush().extent(b.filter());var c=a.select("g.brush");c.call(b.brush().x(b.x())),c.selectAll("rect").attr("height",g())}b.fadeDeselectedArea()},b.fadeDeselectedArea=function(){},b.resizeHandlePath=function(a){var b=+("e"==a),c=b?1:-1,d=g()/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)},b.clipPadding=function(a){return arguments.length?(W=a,b):W},b.doRender=function(){if(void 0===w)throw new a.errors.InvalidStateException("Mandatory attribute chart.x is missing on chart[#"+b.anchorName()+"]");return b.resetSvg(),b.dataSet()&&(b._generateG(),j(),c(b.g()),e(b.g()),b.plotData(),b.renderXAxis(b.g()),b.renderYAxis(b.g()),b.renderBrush(b.g()),k()),b},b.doRedraw=function(){return c(b.g()),e(b.g()),b.plotData(),b.elasticY()&&b.renderYAxis(b.g()),(b.elasticX()||S)&&b.renderXAxis(b.g()),b.redrawBrush(b.g()),b},b.subRender=function(){return b.dataSet()&&b.plotData(),b},b.brushOn=function(a){return arguments.length?(P=a,b):P},b.focus=function(a){S=!0,m(a)?b.x().domain(a):b.x().domain(b.xOriginalDomain()),b.rescale(),b.redraw(),m(a)||(S=!1)},b.refocused=function(){return S},b.focusChart=function(c){return arguments.length?(E=c,b.on("filtered",function(b){a.events.trigger(function(){E.focus(b.filter()),E.filter(b.filter()),a.redrawAll(b.chartGroup())})}),b):E},b},a.colorChart=function(b){var c=d3.scale.category20c(),d=[0,c.range().length],e=function(e){var f=d;"function"==typeof d&&(f=d.call(b));var g=f[0],h=f[1];if(isNaN(e)&&(e=0),!a.utils.isNumber(h))return c(e);var i=b.colors().range().length,j=(h-g)/i,k=Math.abs(Math.min(i-1,Math.round((e-g)/j)));return b.colors()(k)},f=function(a,b){return b};return b.colors=function(a){if(!arguments.length)return c;if(a instanceof Array){c=d3.scale.ordinal().range(a);for(var e=[],f=0;f<a.length;++f)e.push(f);c.domain(e)}else c=a;return d=[0,c.range().length],b},b.colorCalculator=function(a){return arguments.length?(e=a,b):e},b.getColor=function(a,b){return e(f(a,b))},b.colorAccessor=function(a){return arguments.length?(f=a,b):f},b.colorDomain=function(a){return arguments.length?(d=a,b):d},b},a.stackableChart=function(b){function c(){var a=[];if(b.x()){var c,d=b.x().domain();if(b.isOrdinal()){var e=d3.set(d);c=function(a){return e.has(a.x)}}else c=function(a){return a.x>=d[0]&&a.x<=d[d.length-1]};b.stackLayers().forEach(function(b){b.points.forEach(function(b){c(b)&&a.push(b)})})}else b.stackLayers().forEach(function(b){a=a.concat(b.points)});return a}function d(a,c){return b.getKeyAccessorByIndex(a)(c)}function e(a,c){return b.getValueAccessorByIndex(a)(c)}function f(a,b){for(var c=0;c<a.length;++c){var f=a[c],g=d(b,f),h=e(b,f);k.setDataPoint(b,c,{data:f,x:g,y:h,layer:b})}}var g,h,i,j,k=new a.utils.GroupStack,l=d3.layout.stack().offset("zero").order("default").values(function(a){return a.points});return b.stack=function(a,c,d){return arguments.length||k.clear(),"string"==typeof c?b._setGroupName(a,c,d):"function"==typeof c&&(d=c),k.setDefaultAccessor(b.valueAccessor()),k.addGroup(a,d),b.expireCache(),b},b.expireCache=function(){return g=null,h=null,i=null,j=null,b},b.allGroups=function(){if(null===g){g=[],g.push(b.group());for(var a=0;a<k.size();++a)g.push(k.getGroupByIndex(a))}return g},b.allValueAccessors=function(){if(null===h){h=[],h.push(b.valueAccessor());for(var a=0;a<k.size();++a)h.push(k.getAccessorByIndex(a))}return h},b.getValueAccessorByIndex=function(a){return b.allValueAccessors()[a]},b.yAxisMin=function(){var d,e=c();return d=d3.min(e,function(a){return a.y+a.y0<a.y0?a.y+a.y0:a.y0}),d=a.utils.subtract(d,b.yAxisPadding())},b.yAxisMax=function(){var d,e=c();return d=d3.max(e,function(a){return a.y+a.y0}),d=a.utils.add(d,b.yAxisPadding())},b.allKeyAccessors=function(){if(null===i){i=[],i.push(b.keyAccessor());for(var a=0;a<k.size();++a)i.push(b.keyAccessor())}return i},b.getKeyAccessorByIndex=function(a){return b.allKeyAccessors()[a]},b.xAxisMin=function(){for(var c=null,d=b.allGroups(),e=0;e<d.length;++e){var f=d[e],g=a.utils.groupMin(f,b.getKeyAccessorByIndex(e));(null===c||c>g)&&(c=g)}return a.utils.subtract(c,b.xAxisPadding())},b.xAxisMax=function(){for(var c=null,d=b.allGroups(),e=0;e<d.length;++e){var f=d[e],g=a.utils.groupMax(f,b.getKeyAccessorByIndex(e));(null===c||g>c)&&(c=g)}return a.utils.add(c,b.xAxisPadding())},b.calculateDataPointMatrixForAll=function(){for(var a=b.allGroups(),c=0;c<a.length;++c){var d=a[c],e=d.all();f(e,c)}},b.getChartStack=function(){return k},a.override(b,"valueAccessor",function(a){return arguments.length?(b.expireCache(),b._valueAccessor(a)):b._valueAccessor()}),a.override(b,"keyAccessor",function(a){return arguments.length?(b.expireCache(),b._keyAccessor(a)):b._keyAccessor()}),b.stackLayout=function(a){return arguments.length?(l=a,b):l},b.stackLayers=function(a){return arguments.length?(j=a,void 0):(null===j&&(b.calculateDataPointMatrixForAll(),j=b.stackLayout()(k.toLayers())),j)},b.colorAccessor(function(a){return a.layer||a.index}),b.legendables=function(){var c=[];return g.forEach(function(d,e){c.push(a.utils.createLegendable(b,d,e,b.getValueAccessorByIndex(e)))}),c},b},a.abstractBubbleChart=function(b){var c=.3,d=10;b.BUBBLE_NODE_CLASS="node",b.BUBBLE_CLASS="bubble",b.MIN_RADIUS=10,b=a.colorChart(b),b.renderLabel(!0),b.renderTitle(!1);var e=d3.scale.linear().domain([0,100]),f=function(a){return a.r};b.r=function(a){return arguments.length?(e=a,b):e},b.radiusValueAccessor=function(a){return arguments.length?(f=a,b):f},b.rMin=function(){var a=d3.min(b.group().all(),function(a){return b.radiusValueAccessor()(a)});return a},b.rMax=function(){var a=d3.max(b.group().all(),function(a){return b.radiusValueAccessor()(a)});return a},b.bubbleR=function(a){var c=b.radiusValueAccessor()(a),d=b.r()(c);return(isNaN(d)||0>=c)&&(d=0),d};var g=function(a){return b.label()(a)},h=function(a){return b.bubbleR(a)>d?1:0};b.doRenderLabel=function(c){if(b.renderLabel()){var d=c.select("text");d.empty()&&(d=c.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",b.onClick)),d.attr("opacity",0).text(g),a.transition(d,b.transitionDuration()).attr("opacity",h)}},b.doUpdateLabels=function(c){if(b.renderLabel()){var d=c.selectAll("text").text(g);a.transition(d,b.transitionDuration()).attr("opacity",h)}};var i=function(a){return b.title()(a)};return b.doRenderTitles=function(a){if(b.renderTitle()){var c=a.select("title");c.empty()&&a.append("title").text(i)}},b.doUpdateTitles=function(a){b.renderTitle()&&a.selectAll("title").text(i)},b.minRadiusWithLabel=function(a){return arguments.length?(d=a,b):d},b.maxBubbleRelativeSize=function(a){return arguments.length?(c=a,b):c},b.initBubbleColor=function(c,d){return this[a.constants.NODE_INDEX_NAME]=d,b.getColor(c,d)},b.updateBubbleColor=function(c){return b.getColor(c,this[a.constants.NODE_INDEX_NAME])},b.fadeDeselectedArea=function(){b.hasFilter()?b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(a){b.isSelectedNode(a)?b.highlightSelected(this):b.fadeDeselected(this)}):b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(){b.resetHighlight(this)})},b.isSelectedNode=function(a){return b.hasFilter(a.key)},b.onClick=function(c){var d=c.key;a.events.trigger(function(){b.filter(d),a.redrawAll(b.chartGroup())})},b},a.pieChart=function(b,c){function d(){if(C.dataSet()){var a=p();w=w?w:d3.min([C.width(),C.height()])/2;var b=C.buildArcs(),c=a(C.assembleCappedData());if(x){var d=x.selectAll("g."+z).data(c);e(d,b,c),j(c,b),n(d),o()}}}function e(a,b,c){var d=f(a);g(d,b),h(d),i(c,b)}function f(a){var b=a.enter().append("g").attr("class",function(a,b){return z+" _"+b});return b}function g(a,b){var c=a.append("path").attr("fill",function(a,b){return C.getColor(a,b)}).on("click",u).attr("d",function(a,c){return v(a,c,b)});c.transition().duration(C.transitionDuration()).attrTween("d",s)}function h(a){C.renderTitle()&&a.append("title").text(function(a){return C.title()(a)})}function i(b,c){if(C.renderLabel()){var d=x.selectAll("text."+z).data(b);d.exit().remove();var e=d.enter().append("text").attr("class",function(a,b){return z+" _"+b}).on("click",u);a.transition(e,C.transitionDuration()).attr("transform",function(a){a.innerRadius=C.innerRadius(),a.outerRadius=w;var b=c.centroid(a);return isNaN(b[0])||isNaN(b[1])?"translate(0,0)":"translate("+b+")"}).attr("text-anchor","middle").text(function(a){var b=a.data;return r(b)||q(a)?"":C.label()(a)})}}function j(a,b){k(a,b),l(a,b),m(a)}function k(b,c){var d=x.selectAll("g."+z).data(b).select("path").attr("d",function(a,b){return v(a,b,c)});a.transition(d,C.transitionDuration(),function(a){a.attrTween("d",s)}).attr("fill",function(a,b){return C.getColor(a,b)})}function l(b,c){if(C.renderLabel()){var d=x.selectAll("text."+z).data(b);a.transition(d,C.transitionDuration()).attr("transform",function(a){a.innerRadius=C.innerRadius(),a.outerRadius=w;var b=c.centroid(a);return isNaN(b[0])||isNaN(b[1])?"translate(0,0)":"translate("+b+")"}).attr("text-anchor","middle").text(function(a){var b=a.data;return r(b)||q(a)?"":C.label()(a)})}}function m(a){C.renderTitle()&&x.selectAll("g."+z).data(a).select("title").text(function(a){return C.title()(a)})}function n(a){a.exit().remove()}function o(){C.hasFilter()?C.selectAll("g."+z).each(function(a){C.isSelectedSlice(a)?C.highlightSelected(this):C.fadeDeselected(this)}):C.selectAll("g."+z).each(function(){C.resetHighlight(this)})}function p(){return d3.layout.pie().sort(null).value(function(a){return C.valueAccessor()(a)})}function q(a){var b=a.endAngle-a.startAngle;return isNaN(b)||B>b}function r(a){return 0===C.valueAccessor()(a)}function s(a){a.innerRadius=C.innerRadius();var b=this._current;t(b)&&(b={startAngle:0,endAngle:0});var c=d3.interpolate(b,a);return this._current=c(0),function(a){return v(c(a),0,C.buildArcs())}}function t(a){return!a||isNaN(a.startAngle)||isNaN(a.endAngle)}function u(a){C.onClick(a.data)}function v(a,b,c){var d=c(a,b);return d.indexOf("NaN")>=0&&(d="M0,0"),d}var w,x,y=.5,z="pie-slice",A=0,B=y,C=a.capped(a.colorChart(a.baseChart({})));return C.slicesCap=C.cap,C.label(function(a){return C.keyAccessor()(a.data)}),C.renderLabel(!0),C.title(function(a){return C.keyAccessor()(a.data)+": "+C.valueAccessor()(a.data)}),C.transitionDuration(350),C.doRender=function(){return C.resetSvg(),x=C.svg().append("g").attr("transform","translate("+C.cx()+","+C.cy()+")"),d(),C},C.innerRadius=function(a){return arguments.length?(A=a,C):A},C.radius=function(a){return arguments.length?(w=a,C):w},C.cx=function(){return C.width()/2},C.cy=function(){return C.height()/2},C.buildArcs=function(){return d3.svg.arc().outerRadius(w).innerRadius(A)},C.isSelectedSlice=function(a){return C.hasFilter(C.keyAccessor()(a.data))},C.doRedraw=function(){return d(),C},C.minAngleForLabel=function(a){return arguments.length?(B=a,C):B},C.anchor(b,c)},a.barChart=function(b,c){function d(b){return a.utils.safeNumber(Math.abs(m.y()(b.y+b.y0)-m.y()(b.y0)))}function e(b,c){var e=b.selectAll("rect.bar").data(c.points);e.enter().append("rect").attr("class","bar").attr("fill",m.getColor).append("title").text(m.title()),m.isOrdinal()&&e.on("click",h),a.transition(e,m.transitionDuration()).attr("x",function(b){var c=m.x()(b.x);return(o||m.isOrdinal())&&(c-=j/2),a.utils.safeNumber(c)}).attr("y",function(b){var c=m.y()(b.y+b.y0);return b.y<0&&(c-=d(b)),a.utils.safeNumber(c)}).attr("width",j).attr("height",function(a){return d(a)}).select("title").text(m.title()),a.transition(e.exit(),m.transitionDuration()).attr("height",0).remove()}function f(){if(void 0===j){var a=m.isOrdinal()?g()+1:g(),b=Math.floor((m.xAxisLength()-(a-1)*n)/a);
(1/0==b||isNaN(b)||k>b)&&(b=k),j=b}}function g(){return void 0===i&&(i=m.xUnitCount()),i}function h(a){m.onClick(a.data)}var i,j,k=1,l=2,m=a.stackableChart(a.coordinateGridChart({})),n=l,o=!1;return a.override(m,"rescale",function(){m._rescale(),i=void 0,j=void 0,g()}),m.plotData=function(){var a=m.chartBodyG().selectAll("g.stack").data(m.stackLayers());f(),a.enter().append("g").attr("class",function(a,b){return"stack _"+b}),a.each(function(a,b){var c=d3.select(this);e(c,a,b)}),m.stackLayers(null)},m.fadeDeselectedArea=function(){var b=m.chartBodyG().selectAll("rect.bar"),c=m.brush().extent();if(m.isOrdinal())m.hasFilter()?(b.classed(a.constants.SELECTED_CLASS,function(a){return m.hasFilter(m.keyAccessor()(a.data))}),b.classed(a.constants.DESELECTED_CLASS,function(a){return!m.hasFilter(m.keyAccessor()(a.data))})):(b.classed(a.constants.SELECTED_CLASS,!1),b.classed(a.constants.DESELECTED_CLASS,!1));else if(m.brushIsEmpty(c))b.classed(a.constants.DESELECTED_CLASS,!1);else{var d=c[0],e=c[1];b.classed(a.constants.DESELECTED_CLASS,function(a){var b=m.keyAccessor()(a.data);return d>b||b>=e})}},m.centerBar=function(a){return arguments.length?(o=a,m):o},m.gap=function(a){return arguments.length?(n=a,m):n},m.extendBrush=function(){var a=m.brush().extent();return m.round()&&!o&&(a[0]=a.map(m.round())[0],a[1]=a.map(m.round())[1],m.chartBodyG().select(".brush").call(m.brush().extent(a))),a},m.legendHighlight=function(a){m.select(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!0),m.select(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!0)},m.legendReset=function(a){m.selectAll(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!1),m.selectAll(".chart-body").selectAll("rect.bar").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!1)},m.anchor(b,c)},a.lineChart=function(b,c){function d(b,c){var d=d3.svg.line().x(function(a){return s.x()(a.x)}).y(function(a){return s.y()(a.y+a.y0)}).interpolate(v).tension(w);m&&d.defined(m),b.append("path").attr("class","line").attr("stroke",s.getColor).attr("fill",s.getColor),a.transition(c.select("path.line"),s.transitionDuration()).attr("d",function(a){return f(d(a.points))})}function e(b,c){if(t){var d=d3.svg.area().x(function(a){return s.x()(a.x)}).y(function(a){return s.y()(a.y+a.y0)}).y0(function(a){return s.y()(a.y0)}).interpolate(v).tension(w);m&&d.defined(m),b.append("path").attr("class","area").attr("fill",s.getColor).attr("d",function(a){return f(d(a.points))}),a.transition(c.select("path.area"),s.transitionDuration()).attr("d",function(a){return f(d(a.points))})}}function f(a){return!a||a.indexOf("NaN")>=0?"M0,0":a}function g(b){s.brushOn()||b.each(function(){var b=d3.select(this),c=b.select("g."+o);c.empty()&&(c=b.append("g").attr("class",o)),h(c);var d=c.selectAll("circle."+p).data(c.datum().points);d.enter().append("circle").attr("class",p).attr("r",u).attr("fill",s.getColor).style("fill-opacity",1e-6).style("stroke-opacity",1e-6).on("mousemove",function(){var a=d3.select(this);i(a),j(a,c)}).on("mouseout",function(){var a=d3.select(this);k(a),l(c)}).append("title").text(s.title()),d.attr("cx",function(b){return a.utils.safeNumber(s.x()(b.x))}).attr("cy",function(b){return a.utils.safeNumber(s.y()(b.y+b.y0))}).select("title").text(s.title()),d.exit().remove()})}function h(a){var b=a.select("path."+q).empty()?a.append("path").attr("class",q):a.select("path."+q);b.style("display","none").attr("stroke-dasharray","5,5");var c=a.select("path."+r).empty()?a.append("path").attr("class",r):a.select("path."+r);c.style("display","none").attr("stroke-dasharray","5,5")}function i(a){return a.style("fill-opacity",.8),a.style("stroke-opacity",.8),a}function j(a,b){var c=a.attr("cx"),d=a.attr("cy");b.select("path."+q).style("display","").attr("d","M0 "+d+"L"+c+" "+d),b.select("path."+r).style("display","").attr("d","M"+c+" "+s.yAxisHeight()+"L"+c+" "+d)}function k(a){a.style("fill-opacity",1e-6).style("stroke-opacity",1e-6)}function l(a){a.select("path."+q).style("display","none"),a.select("path."+r).style("display","none")}var m,n=5,o="dc-tooltip",p="dot",q="yRef",r="xRef",s=a.stackableChart(a.coordinateGridChart({})),t=!1,u=n,v="linear",w=.7;return s.transitionDuration(500),s.plotData=function(){var a=s.chartBodyG().selectAll("g.stack").data(s.stackLayers()),b=a.enter().append("g").attr("class",function(a,b){return"stack _"+b});d(b,a),e(b,a),g(a),s.stackLayers(null)},s.interpolate=function(a){return arguments.length?(v=a,s):v},s.tension=function(a){return arguments.length?(w=a,s):w},s.defined=function(a){return arguments.length?(m=a,s):m},s.renderArea=function(a){return arguments.length?(t=a,s):t},s.dotRadius=function(a){return arguments.length?(u=a,s):u},s.legendHighlight=function(a){s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!0),s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!0)},s.legendReset=function(a){s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")==a.color}).classed("highlight",!1),s.selectAll(".chart-body").selectAll("path").filter(function(){return d3.select(this).attr("fill")!=a.color}).classed("fadeout",!1)},s.anchor(b,c)},a.dataCount=function(b,c){var d=d3.format(",d"),e=a.baseChart({});return e.doRender=function(){return e.selectAll(".total-count").text(d(e.dimension().size())),e.selectAll(".filter-count").text(d(e.group().value())),e},e.doRedraw=function(){return e.doRender()},e.anchor(b,c)},a.dataTable=function(b,c){function d(){var a=l.root().selectAll("tbody").data(e(),function(a){return l.keyAccessor()(a)}),b=a.enter().append("tbody");return b.append("tr").attr("class",k).append("td").attr("class",h).attr("colspan",n.length).html(function(a){return l.keyAccessor()(a)}),a.exit().remove(),b}function e(){g||(g=crossfilter.quicksort.by(o));var a=l.dimension().top(m);return d3.nest().key(l.group()).sortKeys(p).sortValues(p).entries(g(a,0,a.length))}function f(a){for(var b=a.order().selectAll("tr."+i).data(function(a){return a.values}),c=b.enter().append("tr").attr("class",i),d=0;d<n.length;++d){var e=n[d];c.append("td").attr("class",j+" _"+d).html(function(a){return e(a)})}return b.exit().remove(),b}var g,h="dc-table-label",i="dc-table-row",j="dc-table-column",k="dc-table-group",l=a.baseChart({}),m=25,n=[],o=function(a){return a},p=d3.ascending;return l.doRender=function(){return l.selectAll("tbody").remove(),f(d()),l},l.doRedraw=function(){return l.doRender()},l.size=function(a){return arguments.length?(m=a,l):m},l.columns=function(a){return arguments.length?(n=a,l):n},l.sortBy=function(a){return arguments.length?(o=a,l):o},l.order=function(a){return arguments.length?(p=a,l):p},l.anchor(b,c)},a.bubbleChart=function(b,c){function d(b){var c=b.enter().append("g");c.attr("class",i.BUBBLE_NODE_CLASS).attr("transform",k).append("circle").attr("class",function(a,b){return i.BUBBLE_CLASS+" _"+b}).on("click",i.onClick).attr("fill",i.initBubbleColor).attr("r",0),a.transition(b,i.transitionDuration()).attr("r",function(a){return i.bubbleR(a)}).attr("opacity",function(a){return i.bubbleR(a)>0?1:0}),i.doRenderLabel(c),i.doRenderTitles(c)}function e(b){a.transition(b,i.transitionDuration()).attr("transform",k).selectAll("circle."+i.BUBBLE_CLASS).attr("fill",i.updateBubbleColor).attr("r",function(a){return i.bubbleR(a)}).attr("opacity",function(a){return i.bubbleR(a)>0?1:0}),i.doUpdateLabels(b),i.doUpdateTitles(b)}function f(a){a.exit().remove()}function g(a){var b=i.x()(i.keyAccessor()(a));return isNaN(b)&&(b=0),b}function h(a){var b=i.y()(i.valueAccessor()(a));return isNaN(b)&&(b=0),b}var i=a.abstractBubbleChart(a.coordinateGridChart({})),j=!1;i.transitionDuration(750);var k=function(a){return"translate("+g(a)+","+h(a)+")"};return i.elasticRadius=function(a){return arguments.length?(j=a,i):j},i.plotData=function(){j&&i.r().domain([i.rMin(),i.rMax()]),i.r().range([i.MIN_RADIUS,i.xAxisLength()*i.maxBubbleRelativeSize()]);var a=i.chartBodyG().selectAll("g."+i.BUBBLE_NODE_CLASS).data(i.group().all());d(a),e(a),f(a),i.fadeDeselectedArea()},i.renderBrush=function(){},i.redrawBrush=function(){i.fadeDeselectedArea()},i.anchor(b,c)},a.compositeChart=function(b,c){function d(a,b){a._generateG(j.g()),a.g().attr("class",i+" _"+b)}function e(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].yAxisMin());return a}function f(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].yAxisMax());return a}function g(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].xAxisMin());return a}function h(){for(var a=[],b=0;b<k.length;++b)a.push(k[b].xAxisMax());return a}var i="sub",j=a.coordinateGridChart({}),k=[];return j.transitionDuration(500),j.group({}),a.override(j,"_generateG",function(){for(var a=this.__generateG(),b=0;b<k.length;++b){var c=k[b];d(c,b),void 0===c.dimension()&&c.dimension(j.dimension()),void 0===c.group()&&c.group(j.group()),c.chartGroup(j.chartGroup()),c.svg(j.svg()),c.xUnits(j.xUnits()),c.transitionDuration(j.transitionDuration()),c.brushOn(j.brushOn())}return a}),j.plotData=function(){for(var a=0;a<k.length;++a){var b=k[a];void 0===b.g()&&d(b,a),b.x(j.x()),b.y(j.y()),b.xAxis(j.xAxis()),b.yAxis(j.yAxis()),b.plotData(),b.activateRenderlets()}},j.fadeDeselectedArea=function(){for(var a=0;a<k.length;++a){var b=k[a];b.brush(j.brush()),b.fadeDeselectedArea()}},j.compose=function(a){k=a;for(var b=0;b<k.length;++b){var c=k[b];c.height(j.height()),c.width(j.width()),c.margins(j.margins())}return j},j.children=function(){return k},j.yAxisMin=function(){return d3.min(e())},j.yAxisMax=function(){return a.utils.add(d3.max(f()),j.yAxisPadding())},j.xAxisMin=function(){return a.utils.subtract(d3.min(g()),j.xAxisPadding())},j.xAxisMax=function(){return a.utils.add(d3.max(h()),j.xAxisPadding())},j.legendables=function(){var b=[];return k.forEach(function(c,d){var e=c.legendables();e.length>1?b.push.apply(b,e):b.push(a.utils.createLegendable(c,c.group(),d,c.valueAccessor()))}),b},j.legendHighlight=function(a){for(var b=0;b<k.length;++b){var c=k[b];c.legendHighlight(a)}},j.legendReset=function(a){for(var b=0;b<k.length;++b){var c=k[b];c.legendReset(a)}},j.anchor(b,c)},a.geoChoroplethChart=function(b,c){function d(a){var b=e();if(f(a)){var c=g(a);m(c,a,b),n(c,a,b)}}function e(){for(var a={},b=o.group().all(),c=0;c<b.length;++c)a[o.keyAccessor()(b[c])]=o.valueAccessor()(b[c]);return a}function f(a){return l(a).keyAccessor}function g(b){var c=o.svg().selectAll(h(b)).classed("selected",function(a){return i(b,a)}).classed("deselected",function(a){return j(b,a)}).attr("class",function(c){var d=l(b).name,e=a.utils.nameToId(l(b).keyAccessor(c)),f=d+" "+e;return i(b,c)&&(f+=" selected"),j(b,c)&&(f+=" deselected"),f});return c}function h(a){return"g.layer"+a+" g."+l(a).name}function i(a,b){return o.hasFilter()&&o.hasFilter(k(a,b))}function j(a,b){return o.hasFilter()&&!o.hasFilter(k(a,b))}function k(a,b){return l(a).keyAccessor(b)}function l(a){return r[a]}function m(b,c,d){var e=b.select("path").attr("fill",function(){var a=d3.select(this).attr("fill");return a?a:"none"}).on("click",function(a){return o.onClick(a,c)});a.transition(e,o.transitionDuration()).attr("fill",function(a,b){return o.getColor(d[l(c).keyAccessor(a)],b)})}function n(a,b,c){o.renderTitle()&&a.selectAll("title").text(function(a){var d=k(b,a),e=c[d];return o.title()({key:d,value:e})})}var o=a.colorChart(a.baseChart({}));o.colorAccessor(function(a){return a});var p,q=d3.geo.path(),r=[];return o.doRender=function(){o.resetSvg();for(var a=0;a<r.length;++a){var b=o.svg().append("g").attr("class","layer"+a),c=b.selectAll("g."+l(a).name).data(l(a).data).enter().append("g").attr("class",l(a).name);c.append("path").attr("fill","white").attr("d",q),c.append("title"),d(a)}p=!1},o.onClick=function(b,c){var d=l(c).keyAccessor(b);a.events.trigger(function(){o.filter(d),a.redrawAll(o.chartGroup())})},o.doRedraw=function(){for(var a=0;a<r.length;++a)d(a),p&&o.svg().selectAll("g."+l(a).name+" path").attr("d",q);p=!1},o.overlayGeoJson=function(a,b,c){for(var d=0;d<r.length;++d)if(r[d].name==b)return r[d].data=a,r[d].keyAccessor=c,o;return r.push({name:b,data:a,keyAccessor:c}),o},o.projection=function(a){return q.projection(a),p=!0,o},o.geoJsons=function(){return r},o.removeGeoJson=function(a){for(var b=[],c=0;c<r.length;++c){var d=r[c];d.name!=a&&b.push(d)}return r=b,o},o.anchor(b,c)},a.bubbleOverlay=function(b,c){function d(){return i=m.select("g."+j),i.empty()&&(i=m.svg().append("g").attr("class",j)),i}function e(){var b=f();n.forEach(function(c){var d=g(c,b),e=d.select("circle."+l);e.empty()&&(e=d.append("circle").attr("class",l).attr("r",0).attr("fill",m.initBubbleColor).on("click",m.onClick)),a.transition(e,m.transitionDuration()).attr("r",function(a){return m.bubbleR(a)}),m.doRenderLabel(d),m.doRenderTitles(d)})}function f(){var a={};return m.group().all().forEach(function(b){a[m.keyAccessor()(b)]=b}),a}function g(b,c){var d=k+" "+a.utils.nameToId(b.name),e=i.select("g."+a.utils.nameToId(b.name));return e.empty()&&(e=i.append("g").attr("class",d).attr("transform","translate("+b.x+","+b.y+")")),e.datum(c[b.name]),e}function h(){var b=f();n.forEach(function(c){var d=g(c,b),e=d.select("circle."+l);a.transition(e,m.transitionDuration()).attr("r",function(a){return m.bubbleR(a)}).attr("fill",m.updateBubbleColor),m.doUpdateLabels(d),m.doUpdateTitles(d)})}var i,j="bubble-overlay",k="node",l="bubble",m=a.abstractBubbleChart(a.baseChart({})),n=[];return m.transitionDuration(750),m.radiusValueAccessor(function(a){return a.value}),m.point=function(a,b,c){return n.push({name:a,x:b,y:c}),m},m.doRender=function(){return i=d(),m.r().range([m.MIN_RADIUS,m.width()*m.maxBubbleRelativeSize()]),e(),m.fadeDeselectedArea(),m},m.doRedraw=function(){return h(),m.fadeDeselectedArea(),m},m.debug=function(b){if(b){var c=m.select("g."+a.constants.DEBUG_GROUP_CLASS);c.empty()&&(c=m.svg().append("g").attr("class",a.constants.DEBUG_GROUP_CLASS));var d=c.append("text").attr("x",10).attr("y",20);c.append("rect").attr("width",m.width()).attr("height",m.height()).on("mousemove",function(){var a=d3.mouse(c.node()),b=a[0]+", "+a[1];d.text(b)})}else m.selectAll(".debug").remove();return m},m.anchor(b,c),m},a.rowChart=function(b,c){function d(){if(!q||r){var a=d3.extent(s,x.valueAccessor());a[0]>0&&(a[0]=0),q=d3.scale.linear().domain(a).range([0,x.effectiveWidth()]),y.scale(q)}}function e(){var b=p.select("g.axis");d(),b.empty()&&(b=p.append("g").attr("class","axis").attr("transform","translate(0, "+x.effectiveHeight()+")")),a.transition(b,x.transitionDuration()).call(y)}function f(){p.selectAll("g.tick").select("line.grid-line").remove(),p.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-x.effectiveHeight()})}function g(){s=x.assembleCappedData(),e(),f();var a=p.selectAll("g."+w).data(s);h(a),i(a),j(a)}function h(a){var b=a.enter().append("g").attr("class",function(a,b){return w+" _"+b});b.append("rect").attr("width",0),l(b),m(a)}function i(a){a.exit().remove()}function j(b){var c=s.length,d=(x.effectiveHeight()-(c+1)*v)/c,e=b.attr("transform",function(a,b){return"translate(0,"+((b+1)*v+b*d)+")"}).select("rect").attr("height",d).attr("fill",x.getColor).on("click",n).classed("deselected",function(a){return x.hasFilter()?!x.isSelectedRow(a):!1}).classed("selected",function(a){return x.hasFilter()?x.isSelectedRow(a):!1});a.transition(e,x.transitionDuration()).attr("width",function(a){var b=q(0)==-1/0?q(1):q(0);return Math.abs(b-q(x.valueAccessor()(a)))}).attr("transform",o),k(b),m(b)}function k(a){x.renderTitle()&&(a.selectAll("title").remove(),a.append("title").text(function(a){return x.title()(a)}))}function l(a){x.renderLabel()&&a.append("text").on("click",n)}function m(b){if(x.renderLabel()){var c=b.select("text").attr("x",t).attr("y",u).on("click",n).attr("class",function(a,b){return w+" _"+b}).text(function(a){return x.label()(a)});a.transition(c,x.transitionDuration()).attr("transform",o)}}function n(a){x.onClick(a)}function o(a){var b=q(x.valueAccessor()(a)),c=q(0),d=b>c?c:b;return"translate("+d+",0)"}var p,q,r,s,t=10,u=15,v=5,w="row",x=a.capped(a.marginable(a.colorChart(a.baseChart({})))),y=d3.svg.axis().orient("bottom");return x.rowsCap=x.cap,x.doRender=function(){return x.resetSvg(),p=x.svg().append("g").attr("transform","translate("+x.margins().left+","+x.margins().top+")"),g(),x},x.title(function(a){return x.keyAccessor()(a)+": "+x.valueAccessor()(a)}),x.label(function(a){return x.keyAccessor()(a)}),x.x=function(a){return arguments.length?(q=a,x):q},x.doRedraw=function(){return g(),x},x.xAxis=function(){return y},x.gap=function(a){return arguments.length?(v=a,x):v},x.elasticX=function(a){return arguments.length?(r=a,x):r},x.labelOffsetX=function(a){return arguments.length?(t=a,x):t},x.labelOffsetY=function(a){return arguments.length?(u=a,x):u},x.isSelectedRow=function(a){return x.hasFilter(x.keyAccessor()(a))},x.anchor(b,c)},a.legend=function(){function a(){return i+h}var b,c,d=2,e={},f=0,g=0,h=12,i=5;return e.parent=function(a){return arguments.length?(b=a,e):b},e.render=function(){c=b.svg().append("g").attr("class","dc-legend").attr("transform","translate("+f+","+g+")");var e=c.selectAll("g.dc-legend-item").data(b.legendables()).enter().append("g").attr("class","dc-legend-item").attr("transform",function(b,c){return"translate(0,"+c*a()+")"}).on("mouseover",function(a){b.legendHighlight(a)}).on("mouseout",function(a){b.legendReset(a)});e.append("rect").attr("width",h).attr("height",h).attr("fill",function(a){return a.color}),e.append("text").text(function(a){return a.name}).attr("x",h+d).attr("y",function(){return h/2+(this.clientHeight?this.clientHeight:13)/2-2})},e.x=function(a){return arguments.length?(f=a,e):f},e.y=function(a){return arguments.length?(g=a,e):g},e.gap=function(a){return arguments.length?(i=a,e):i},e.itemHeight=function(a){return arguments.length?(h=a,e):h},e},a.capped=function(b){var c=1/0,d="Others",e=function(a){var c=d3.sum(a,b.valueAccessor()),e=b.group().all(),f=d3.sum(e,b.valueAccessor()),g=a.map(b.keyAccessor()),h=e.map(b.keyAccessor()),i=d3.set(g),j=h.filter(function(a){return!i.has(a)});a.push({others:j,key:d,value:f-c})};return b.assembleCappedData=function(){if(1/0==c)return b.computeOrderedGroups();var a=b.group().top(c);return a=b.computeOrderedGroups(a),e&&e(a),a},b.cap=function(a){return arguments.length?(c=a,b):c},b.othersLabel=function(a){return arguments.length?(d=a,b):d},b.othersGrouper=function(a){return arguments.length?(e=a,b):e},a.override(b,"onClick",function(a){a.others&&a.others.forEach(function(a){b.filter(a)}),b._onClick(a)}),b},a.numberDisplay=function(b,c){var d="number-display",e=d3.format(".2s"),f=a.baseChart({});return f.dimension({}),f.value=function(){var a=f.group().all&&f.group().all()[0]||f.group().value();return f.valueAccessor()(a)},f.transitionDuration(250),f.doRender=function(){var a=f.value(),b=f.selectAll("."+d);return b.empty()&&(b=b.data([0]).enter().append("span").attr("class",d)),b.transition().duration(f.transitionDuration()).ease("quad-out-in").tween("text",function(){var b=d3.interpolateNumber(this.lastValue||0,a);return this.lastValue=a,function(a){this.textContent=f.formatNumber()(b(a))}}),f},f.doRedraw=function(){return f.doRender()},f.formatNumber=function(a){return arguments.length?(e=a,f):e},f.anchor(b,c)},a}();
//# sourceMappingURL=dc.min.js.map