forked from dc-js/dc.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdc.min.js
3 lines (3 loc) · 61 KB
/
dc.min.js
1
2
3
dc=function(){"use strict";var a={version:"1.7.0-dev",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};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(a){a?delete c[a]: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(b){a.chartRegistry.clear(b)},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"function"==typeof c&&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__&&!0},a.errors={},a.errors.Exception=function(a){var b=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.pluck=function(a,b){return function(c,d){return b?b.call(this,c[a],d):c[a]}},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){d[a]||(d[a]=[])}var b,c,d=[[]],e=[];this.setDataPoint=function(b,c,e){a(b),d[b][c]=e},this.getDataPoint=function(b,c){a(b);var e=d[b][c];return void 0===e&&(e=0),e},this.addGroup=function(a,c){return c||(c=b),e.push([a,c]),e.length-1},this.addNamedGroup=function(a,b,c){var d=this.addGroup(a,c);return e[d].name=b,b},this.getGroupByIndex=function(a){return e[a][0]},this.getAccessorByIndex=function(a){return e[a][1]},this.size=function(){return e.length},this.clear=function(){d=[],e=[]},this.setDefaultAccessor=function(a){b=a},this.getDataLayers=function(){return d},this.clearDataLayers=function(){d=[[]]},this.showGroups=function(a,b){b&&(c=!1),this.toggleGroups(a,!1)},this.hideGroups=function(a,b){b&&(c=!0),this.toggleGroups(a,!0)},this.toggleGroups=function(a,b){for(var c=0;c<e.length;++c)e[c].name===a&&(e[c].hidden=b)},this.toLayers=function(){for(var a=[],b=0;b<d.length;++b)if(!(0===b&&c||b>0&&e[b-1].hidden)){for(var f={index:b,points:[]},g=d[b],h=0;h<g.length;++h)f.points.push(g[h]);a.push(f)}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};var b=0;return a.utils.uniqueId=function(){return++b},a.utils.groupMax=function(b,c){var d=d3.max(b.all(),c);return a.utils.isNegligible(d)&&(d=0),d},a.utils.groupMin=function(b,c){var d=d3.min(b.all(),c);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,c),data:b};return d&&(e.color=d),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,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 o=b.root().append("svg").attr("width",b.width()).attr("height",b.height())}function e(c){if(!b[c]||!b[c]())throw new a.errors.InvalidStateException("Mandatory attribute chart."+c+" is missing on chart[#"+b.anchorName()+"]")}function f(a){I.splice(I.indexOf(a),1),i(),b._invokeFilteredListener(a)}function g(a){I.push(a),i(),b._invokeFilteredListener(a)}function h(){I=[],i(),b._invokeFilteredListener(null)}function i(){if(b.dimension()&&b.dimension().filter){var a=J(b.dimension(),I);I=a?a:I}}function j(){for(var a=0;a<D.length;++a)D[a](b)}b.__dc_flag__=a.utils.uniqueId();var k,l,m,n,o,p,q=function(a){return a&&a.getBoundingClientRect&&a.getBoundingClientRect().width||200},r=q,s=function(a){return a&&a.getBoundingClientRect&&a.getBoundingClientRect().height||200},t=s,u=a.pluck("key"),v=a.pluck("value"),w=a.pluck("key"),x=a.pluck("key"),y=!1,z=function(a){return b.keyAccessor()(a)+": "+b.valueAccessor()(a)},A=!1,B=750,C=a.printers.filters,D=[],E=["dimension","group"],F=a.constants.DEFAULT_CHART_GROUP,G=function(){},H={preRender:G,postRender:G,preRedraw:G,postRedraw:G,filtered:G,zoomed:G},I=[],J=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},K=function(a){return a.all()};return b.width=function(a){return arguments.length?(r=d3.functor(a||q),b):r(n.node())},b.height=function(a){return arguments.length?(t=d3.functor(a||s),b):t(n.node())},b.dimension=function(a){return arguments.length?(k=a,b.expireCache(),b):k},b.data=function(a){return arguments.length?(K=d3.functor(a),b.expireCache(),b):K.call(b,l)},b.group=function(a,c){return arguments.length?(l=a,b.expireCache(),"string"==typeof c&&b._setGroupName(l,c),b):l},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?(w=a,b.expireCache(),b):w},b.computeOrderedGroups=function(a){var c=a.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!==k&&void 0!==l},b.select=function(a){return n.select(a)},b.selectAll=function(a){return n?n.selectAll(a):null},b.anchor=function(c,d){return arguments.length?(a.instanceOfChart(c)?(m=c.anchor(),n=c.root()):(m=c,n=d3.select(m),n.classed(a.constants.CHART_CLASS,!0),a.registerChart(b,d)),F=d,b):m},b.anchorName=function(){var a=b.anchor();return a&&a.id?a.id:a&&a.replace?a.replace("#",""):""+b.chartID()},b.root=function(a){return arguments.length?(n=a,b):n},b.svg=function(a){return arguments.length?(o=a,b):o},b.resetSvg=function(){return b.select("svg").remove(),d()},b.filterPrinter=function(a){return arguments.length?(C=a,b):C},b.turnOnControls=function(){return n&&(b.selectAll(".reset").style("display",null),b.selectAll(".filter").text(C(b.filters())).style("display",null)),b},b.turnOffControls=function(){return n&&(b.selectAll(".reset").style("display","none"),b.selectAll(".filter").style("display","none").text(b.filter())),b},b.transitionDuration=function(a){return arguments.length?(B=a,b):B},b._mandatoryAttributes=function(a){return arguments.length?(E=a,b):E},b.render=function(){H.preRender(b),E&&E.forEach(e);var a=b.doRender();return p&&p.render(),b.activateRenderlets("postRender"),a},b.activateRenderlets=function(a){b.transitionDuration()>0&&o?o.transition().duration(b.transitionDuration()).each("end",function(){j(),a&&H[a](b)}):(j(),a&&H[a](b))},b.redraw=function(){H.preRedraw(b);var a=b.doRedraw();return b.activateRenderlets("postRedraw"),a},b._invokeFilteredListener=function(a){void 0!==a&&H.filtered(b,a)},b._invokeZoomedListener=function(){H.zoomed(b)},b.hasFilter=function(a){return arguments.length?I.indexOf(a)>=0:I.length>0},b.filter=function(a){return arguments.length?(a instanceof Array&&a[0]instanceof Array?(a[0].forEach(function(a){b.hasFilter(a)?I.splice(I.indexOf(a),1):I.push(a)}),i(),b._invokeFilteredListener(a)):null===a?h():b.hasFilter(a)?f(a):g(a),null!==n&&b.hasFilter()?b.turnOnControls():b.turnOffControls(),b):I.length>0?I[0]:null},b.filters=function(){return I},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?(J=a,b):J},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?(u=a,b):u},b.valueAccessor=function(a){return arguments.length?(v=a,b):v},b.label=function(a){return arguments.length?(x=a,y=!0,b):x},b.renderLabel=function(a){return arguments.length?(y=a,b):y},b.title=function(a){return arguments.length?(z=a,A=!0,b):z},b.renderTitle=function(a){return arguments.length?(A=a,b):A},b.renderlet=function(a){return D.push(a),b},b.chartGroup=function(a){return arguments.length?(F=a,b):F},b.expireCache=function(){return b},b.legend=function(a){return arguments.length?(p=a,p.parent(b),b):p},b.on=function(a,c){return H[a]=c,b},b.chartID=function(){return b.__dc_flag__},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){if(b.elasticX()&&!b.isOrdinal())v.domain([b.xAxisMin(),b.xAxisMax()]);else if(b.isOrdinal()&&0===v.domain().length){var c=b.computeOrderedGroups(b.data());v.domain(c.map(b.keyAccessor()))}b.isOrdinal()?b.prepareOrdinalXAxis():v.range([0,b.xAxisLength()]),E=E.scale(b.x()).orient("bottom"),d(a)}function d(c){var d=c.selectAll("g."+o);if(Q){d.empty()&&(d=c.insert("g",":first-child").attr("class",m+" "+o).attr("transform","translate("+b.yAxisX()+","+b.margins().top+")"));var e=E.tickValues()?E.tickValues():v.ticks(E.ticks()[0]),f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",function(a){return v(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return v(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 v(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return v(a)}).attr("y2",0),f.exit().remove()}else d.selectAll("line").remove()}function e(a){(void 0===y||b.elasticY())&&(y=d3.scale.linear(),y.domain([b.yAxisMin(),b.yAxisMax()]).rangeRound([b.yAxisHeight(),0])),y.range([b.yAxisHeight(),0]),J=J.scale(y).orient("left"),f(a)}function f(c){var d=c.selectAll("g."+n);if(P){var e=J.tickValues()?J.tickValues():y.ticks(J.ticks()[0]);d.empty()&&(d=c.insert("g",":first-child").attr("class",m+" "+n).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 y(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return y(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 y(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return y(a)}),f.exit().remove()}else d.selectAll("line").remove()}function g(){return b.xAxisY()-b.margins().top}function h(){return b.anchorName()+"-clip"}function i(){var c=a.utils.appendOrSelect(s,"defs"),d=a.utils.appendOrSelect(c,"clipPath").attr("id",h()),e=2*V;a.utils.appendOrSelect(d,"rect").attr("width",b.xAxisLength()+e).attr("height",b.yAxisHeight()+e)}function j(){U&&b.root().call(d3.behavior.zoom().x(b.x()).scaleExtent(S).on("zoom",function(){b.focus(b.x().domain()),b._invokeZoomedListener(),k()}))}function k(){if(C){var c=b.x().domain();if(T){var d=C.xOriginalDomain(),e=[c[0]<d[0]?c[0]:d[0],c[1]>d[1]?c[1]:d[1]];C.focus(e)}else C.focus(c);C.filter(null),C.filter(c),a.events.trigger(function(){a.redrawAll(b.chartGroup())})}}function l(a){return a instanceof Array&&a.length>1}var m="grid-line",n="horizontal",o="vertical",p="y-axis-label",q="x-axis-label",r=12;b=a.colorChart(a.marginable(a.baseChart(b))),b.colors(d3.scale.category10()),b._mandatoryAttributes().push("x");var s,t,u,v,w,x,y,z,A,B,C,D,E=d3.svg.axis(),F=a.units.integers,G=0,H=!1,I=0,J=d3.svg.axis(),K=0,L=!1,M=0,N=d3.svg.brush(),O=!0,P=!1,Q=!1,R=!1,S=[-10,100],T=!0,U=!1,V=0;return b.rescale=function(){B=void 0,b.xUnitCount()},b.rangeChart=function(a){return arguments.length?(C=a,C.focusChart(b),b):C},b.zoomScale=function(a){return arguments.length?(S=a,b):S},b.zoomOutRestrict=function(a){return arguments.length?(T=a,b):T},b._generateG=function(a){return s=void 0===a?b.svg():a,t=s.append("g"),u=t.append("g").attr("class","chart-body").attr("transform","translate("+b.margins().left+", "+b.margins().top+")").attr("clip-path","url(#"+h()+")"),t},b.g=function(a){return arguments.length?(t=a,b):t},b.mouseZoomable=function(a){return arguments.length?(U=a,b):U},b.chartBodyG=function(a){return arguments.length?(u=a,b):u},b.x=function(a){return arguments.length?(v=a,w=v.domain(),b):v},b.xOriginalDomain=function(){return w},b.xUnits=function(a){return arguments.length?(F=a,b):F},b.xAxis=function(a){return arguments.length?(E=a,b):E},b.elasticX=function(a){return arguments.length?(H=a,b):H},b.xAxisPadding=function(a){return arguments.length?(G=a,b):G},b.xUnitCount=function(){if(void 0===B){var a=b.xUnits()(b.x().domain()[0],b.x().domain()[1],b.x().domain());B=a instanceof Array?a.length:a}return B},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;v.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."+q);e.empty()&&b.xAxisLabel()&&(e=c.append("text").attr("transform","translate("+b.xAxisLength()/2+","+(b.height()-I)+")").attr("class",q).attr("text-anchor","middle").text(b.xAxisLabel())),b.xAxisLabel()&&e.text()!=b.xAxisLabel()&&axisYLab.text(b.xAxisLabel()),a.transition(d,b.transitionDuration()).call(E)},b.xAxisY=function(){return b.height()-b.margins().bottom},b.xAxisLength=function(){return b.effectiveWidth()},b.xAxisLabel=function(a,c){return arguments.length?(x=a,b.margins().bottom-=I,I=void 0===c?r:c,b.margins().bottom+=I,b):x},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."+p);e.empty()&&b.yAxisLabel()&&(e=c.append("text").attr("transform","translate("+M+","+b.yAxisHeight()/2+"),rotate(-90)").attr("class",p).attr("text-anchor","middle").text(b.yAxisLabel())),b.yAxisLabel()&&e.text()!=b.yAxisLabel()&&e.text(b.yAxisLabel()),a.transition(d,b.transitionDuration()).call(J)},b.yAxisX=function(){return b.margins().left},b.yAxisLabel=function(a,c){return arguments.length?(z=a,b.margins().left-=M,M=void 0===c?r:c,b.margins().left+=M,b):z},b.y=function(a){return arguments.length?(y=a,b):y},b.yAxis=function(a){return arguments.length?(J=a,b):J},b.elasticY=function(a){return arguments.length?(L=a,b):L},b.renderHorizontalGridLines=function(a){return arguments.length?(P=a,b):P},b.renderVerticalGridLines=function(a){return arguments.length?(Q=a,b):Q},b.xAxisMin=function(){var c=d3.min(b.data(),function(a){return b.keyAccessor()(a)});return a.utils.subtract(c,G)},b.xAxisMax=function(){var c=d3.max(b.data(),function(a){return b.keyAccessor()(a)});return a.utils.add(c,G)},b.yAxisMin=function(){var c=d3.min(b.data(),function(a){return b.valueAccessor()(a)});return c=a.utils.subtract(c,K)},b.yAxisMax=function(){var c=d3.max(b.data(),function(a){return b.valueAccessor()(a)});return c=a.utils.add(c,K)},b.yAxisPadding=function(a){return arguments.length?(K=a,b):K},b.yAxisHeight=function(){return b.effectiveHeight()},b.round=function(a){return arguments.length?(A=a,b):A},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?(N=a,b):N},b.renderBrush=function(a){if(b.isOrdinal()&&(O=!1),O){N.on("brush",b._brushing);var c=a.append("g").attr("class","brush").attr("transform","translate("+b.margins().left+","+b.margins().top+")").call(N.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=N.extent();return b.round()&&(a[0]=a.map(b.round())[0],a[1]=a.map(b.round())[1],t.select(".brush").call(N.extent(a))),a},b.brushIsEmpty=function(a){return N.empty()||!a||a[1]<=a[0]},b._brushing=function(){var c=b.extendBrush();b.redrawBrush(t),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)},b.redrawBrush=function(a){if(O){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?(V=a,b):V},b._preprocessData=function(){},b.doRender=function(){return b.resetSvg(),b._generateG(),i(),b._preprocessData(),c(b.g()),e(b.g()),b.plotData(),b.renderXAxis(b.g()),b.renderYAxis(b.g()),b.renderBrush(b.g()),j(),b},b.doRedraw=function(){return b._preprocessData(),c(b.g()),e(b.g()),b.plotData(),b.elasticY()&&b.renderYAxis(b.g()),(b.elasticX()||R)&&b.renderXAxis(b.g()),b.redrawBrush(b.g()),b},b.subRender=function(){return b.plotData(),b},b.brushOn=function(a){return arguments.length?(O=a,b):O},b.focus=function(a){R=!0,l(a)?b.x().domain(a):b.x().domain(b.xOriginalDomain()),b.rescale(),b.redraw(),l(a)||(R=!1)},b.refocused=function(){return R},b.focusChart=function(c){return arguments.length?(D=c,b.on("filtered",function(b){a.events.trigger(function(){D.focus(b.filter()),D.filter(b.filter()),a.redrawAll(b.chartGroup())})}),b):D},b},a.colorChart=function(a){var b=d3.scale.category20c(),c=function(b){return a.keyAccessor()(b)},d=function(c){return b(c,a)};return a.colors=function(c){return arguments.length?(b=c instanceof Array?d3.scale.quantize().range(c):c,a):b},a.ordinalColors=function(b){return a.colors(d3.scale.ordinal().range(b))},a.linearColors=function(b){return a.colors(d3.scale.linear().range(b).interpolate(d3.interpolateHcl))},a.colorAccessor=function(b){return arguments.length?(c=b,a):c},a.colorDomain=function(c){return arguments.length?(b.domain(c),a):b.domain()},a.calculateColorDomain=function(){var c=[d3.min(a.data(),a.colorAccessor()),d3.max(a.data(),a.colorAccessor())];b.domain(c)},a.getColor=function(a,b){return d(c(a,b))},a.colorCalculator=function(b){return arguments.length?(d=b,a):d},a},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){a.all().forEach(function(a,d){var e=b.getKeyAccessorByIndex(c)(a),f=b.getValueAccessorByIndex(c)(a);i.setDataPoint(c,d,{data:a,x:e,y:f,layer:c})})}var e,f,g,h,i=new a.utils.GroupStack,j=d3.layout.stack().offset("zero").order("default").values(function(a){return a.points});return b.stack=function(a,c,d){return arguments.length||i.clear(),i.setDefaultAccessor(b.valueAccessor()),"string"==typeof c?(b._setGroupName(a,c,d),i.addNamedGroup(a,c,d)):(d=c,i.addGroup(a,d)),b.expireCache(),b},b.hideStack=function(a){i.hideGroups(a,b._getGroupName(b.group())==a)},b.showStack=function(a){i.showGroups(a,b._getGroupName(b.group())==a)},b.expireCache=function(){return e=null,f=null,g=null,h=null,b},b.allGroups=function(){if(null===e){e=[],e.push(b.group());for(var a=0;a<i.size();++a)e.push(i.getGroupByIndex(a))}return e},b.allValueAccessors=function(){if(null===f){f=[],f.push(b.valueAccessor());for(var a=0;a<i.size();++a)f.push(i.getAccessorByIndex(a))}return f},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===g){g=[],g.push(b.keyAccessor());for(var a=0;a<i.size();++a)g.push(b.keyAccessor())}return g},b.getKeyAccessorByIndex=function(a){return b.allKeyAccessors()[a]},b.xAxisMin=function(){var c=b.allGroups().reduce(function(c,d,e){var f=a.utils.groupMin(d,b.getKeyAccessorByIndex(e));return null===c||c>f?f:c},null);return a.utils.subtract(c,b.xAxisPadding())},b.xAxisMax=function(){var c=b.allGroups().reduce(function(c,d,e){var f=a.utils.groupMax(d,b.getKeyAccessorByIndex(e));return null===c||f>c?f:c},null);return a.utils.add(c,b.xAxisPadding())},b.calculateDataPointMatrixForAll=function(){i.clearDataLayers(),b.allGroups().forEach(d)},b.getChartStack=function(){return i},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?(j=a,b):j},b.stackLayers=function(a){return arguments.length?(h=a,void 0):(null===h&&(b.calculateDataPointMatrixForAll(),h=b.stackLayout()(i.toLayers())),h)},b._layerColorAccessor=function(a){return void 0===a.layer?a.index:a.layer},b.colorAccessor(b._layerColorAccessor),b.legendables=function(){return b.allGroups().map(function(c,d){return a.utils.createLegendable(b,c,b.getValueAccessorByIndex(d),b.colorCalculator()(d))})},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),b.data(function(a){return a.top(1/0)});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.data(),function(a){return b.radiusValueAccessor()(a)});return a},b.rMax=function(){var a=d3.max(b.data(),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.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(){z=z?z:d3.min([F.width(),F.height()])/2;var a=p(),b=r(),c=b(F.data());if(A){var d=A.selectAll("g."+C).data(c);e(d,a,c),j(c,a),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 C+" _"+b});return b}function g(a,b){var c=a.append("path").attr("fill",w).on("click",x).attr("d",function(a,c){return y(a,c,b)});c.transition().duration(F.transitionDuration()).attrTween("d",u)}function h(a){F.renderTitle()&&a.append("title").text(function(a){return F.title()(a)})}function i(b,c){if(F.renderLabel()){var d=A.selectAll("text."+C).data(b);d.exit().remove();var e=d.enter().append("text").attr("class",function(a,b){return C+" _"+b}).on("click",x);a.transition(e,F.transitionDuration()).attr("transform",function(a){a.innerRadius=F.innerRadius(),a.outerRadius=F.radius();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 t(b)||s(a)?"":F.label()(a.data)})}}function j(a,b){k(a,b),l(a,b),m(a)}function k(b,c){var d=A.selectAll("g."+C).data(b).select("path").attr("d",function(a,b){return y(a,b,c)});a.transition(d,F.transitionDuration(),function(a){a.attrTween("d",u)}).attr("fill",w)}function l(b,c){if(F.renderLabel()){var d=A.selectAll("text."+C).data(b);a.transition(d,F.transitionDuration()).attr("transform",function(a){a.innerRadius=D,a.outerRadius=z;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 t(b)||s(a)?"":F.label()(a.data)})}}function m(a){F.renderTitle()&&A.selectAll("g."+C).data(a).select("title").text(function(a){return F.title()(a.data)})}function n(a){a.exit().remove()}function o(){F.hasFilter()?F.selectAll("g."+C).each(function(a){q(a)?F.highlightSelected(this):F.fadeDeselected(this)}):F.selectAll("g."+C).each(function(){F.resetHighlight(this)})}function p(){return d3.svg.arc().outerRadius(z).innerRadius(D)}function q(a){return F.hasFilter(F.cappedKeyAccessor(a.data))}function r(){return d3.layout.pie().sort(null).value(F.cappedValueAccessor)}function s(a){var b=a.endAngle-a.startAngle;return isNaN(b)||E>b}function t(a){return 0===F.cappedValueAccessor(a)}function u(a){a.innerRadius=D;var b=this._current;v(b)&&(b={startAngle:0,endAngle:0});var c=d3.interpolate(b,a);return this._current=c(0),function(a){return y(c(a),0,p())}}function v(a){return!a||isNaN(a.startAngle)||isNaN(a.endAngle)}function w(a,b){return F.getColor(a.data,b)}function x(a,b){F.onClick(a.data,b)}function y(a,b,c){var d=c(a,b);return d.indexOf("NaN")>=0&&(d="M0,0"),d}var z,A,B=.5,C="pie-slice",D=0,E=B,F=a.capped(a.colorChart(a.baseChart({})));return F.colorAccessor(F.cappedKeyAccessor),F.title(function(a){return F.cappedKeyAccessor(a)+": "+F.cappedValueAccessor(a)}),F.slicesCap=F.cap,F.label(F.cappedKeyAccessor),F.renderLabel(!0),F.transitionDuration(350),F.doRender=function(){return F.resetSvg(),A=F.svg().append("g").attr("transform","translate("+F.cx()+","+F.cy()+")"),d(),F},F.innerRadius=function(a){return arguments.length?(D=a,F):D},F.radius=function(a){return arguments.length?(z=a,F):z},F.cx=function(){return F.width()/2},F.cy=function(){return F.height()/2},F.doRedraw=function(){return d(),F},F.minAngleForLabel=function(a){return arguments.length?(E=a,F):E},F.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,a.pluck("data",m.keyAccessor()));e.enter().append("rect").attr("class","bar").attr("fill",m.getColor),m.renderTitle()&&e.append("title").text(a.pluck("data",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(a.pluck("data",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){var b=d3.select(this);e(b,a)}),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)},a.override(m,"xAxisMax",function(){var a=this._xAxisMax();if("resolution"in m.xUnits()){var b=m.xUnits().resolution;a+=b}return a}),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,c){if(!s.brushOn()){var d=o+"-list",e=b.select("g."+d);e.empty()&&(e=b.append("g").attr("class",d)),c.each(function(b,c){var d=d3.select(this),f=d.datum().points;m&&(f=f.filter(m));var g=e.select("g."+o+"._"+c);g.empty()&&(g=e.append("g").attr("class",o+" _"+c)),h(g);var n=g.selectAll("circle."+p).data(f);n.enter().append("circle").attr("class",p).attr("r",u).attr("fill",function(){return s.colorCalculator()(c)}).style("fill-opacity",1e-6).style("stroke-opacity",1e-6).on("mousemove",function(){var a=d3.select(this);i(a),j(a,g)}).on("mouseout",function(){var a=d3.select(this);k(a),l(g)}).append("title").text(a.pluck("data",s.title())),n.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(a.pluck("data",s.title())),n.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(),b=a.selectAll("g.stack-list");b.empty()&&(b=a.append("g").attr("class","stack-list"));var c=b.selectAll("g.stack").data(s.stackLayers()),f=c.enter().append("g").attr("class",function(a,b){return"stack _"+b});d(f,c),e(f,c),g(a,c),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){var b=a.order().selectAll("tr."+i).data(function(a){return a.values}),c=b.enter().append("tr").attr("class",i);return n.forEach(function(a,b){c.append("td").attr("class",j+" _"+b).html(a)}),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.getColor).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.getColor).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.data(),i.keyAccessor());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=[],l=!1;return j._mandatoryAttributes([]),j.transitionDuration(500),a.override(j,"_generateG",function(){for(var a=this.__generateG(),b=0;b<k.length;++b){var c=k[b];d(c,b),c.dimension()||c.dimension(j.dimension()),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];b.g()||d(b,a),l&&b.colors(j.colors()),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){return k=a,k.forEach(function(a,b){a.height(j.height()),a.width(j.width()),a.margins(j.margins()),a.title(j.title()),l&&a.colorAccessor()===a._layerColorAccessor&&a.colorCalculator(function(){return a.colors()(b)})}),j},j.children=function(){return k},j.shareColors=function(a){return arguments.length?(l=a,j):l},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){l&&c.colors(j.colors());var e=c.legendables();e.length?b.push.apply(b,e):b.push(a.utils.createLegendable(c,c.group(),c.valueAccessor(),c.colorCalculator()(d)))}),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.seriesChart=function(b,c){function d(a,b){return d3.ascending(h.keyAccessor()(a),h.keyAccessor()(b))}function e(a){i[a].g()&&i[a].g().remove(),delete i[a]}function f(){Object.keys(i).map(e),i={}}var g,h=a.compositeChart(b,c),i={},j=a.lineChart,k=d3.ascending,l=d;return h._mandatoryAttributes().push("seriesAccessor","chart"),h.shareColors(!0),h._preprocessData=function(){var a,b=[],d=d3.nest().key(g);k&&d.sortKeys(k),l&&d.sortValues(l);var f=d.entries(h.data()),m=f.map(function(d,e){var f=i[d.key]||j.call(h,h,c,d.key,e);return i[d.key]||(a=!0),i[d.key]=f,b.push(d.key),f.dimension(h.dimension()).group({all:d3.functor(d.values)},d.key).keyAccessor(h.keyAccessor()).valueAccessor(h.valueAccessor()).colorCalculator(function(){return f.colors()(d.key)})});Object.keys(i).filter(function(a){return-1===b.indexOf(a)}).forEach(function(b){e(b),a=!0}),h._compose(m),a&&h.legend()&&h.legend().render()},h.chart=function(a){return arguments.length?(j=a,f(),h):j},h.seriesAccessor=function(a){return arguments.length?(g=a,f(),h):g},h.seriesSort=function(a){return arguments.length?(k=a,f(),h):k},h.valueSort=function(a){return arguments.length?(l=a,f(),h):l},h._compose=h.compose,delete h.compose,h},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.data(),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||0});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.getColor).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.data().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.getColor),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(!r||s){var a=d3.extent(t,y.cappedValueAccessor);a[0]>0&&(a[0]=0),r=d3.scale.linear().domain(a).range([0,y.effectiveWidth()])}z.scale(r)}function e(){var b=q.select("g.axis");d(),b.empty()&&(b=q.append("g").attr("class","axis").attr("transform","translate(0, "+y.effectiveHeight()+")")),a.transition(b,y.transitionDuration()).call(z)}function f(){q.selectAll("g.tick").select("line.grid-line").remove(),q.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-y.effectiveHeight()})}function g(){t=y.data(),e(),f();var a=q.selectAll("g."+x).data(t);h(a),i(a),j(a)}function h(a){var b=a.enter().append("g").attr("class",function(a,b){return x+" _"+b});b.append("rect").attr("width",0),l(b),m(a)}function i(a){a.exit().remove()}function j(b){var c=t.length,d=(y.effectiveHeight()-(c+1)*w)/c,e=b.attr("transform",function(a,b){return"translate(0,"+((b+1)*w+b*d)+")"}).select("rect").attr("height",d).attr("fill",y.getColor).on("click",n).classed("deselected",function(a){return y.hasFilter()?!p(a):!1}).classed("selected",function(a){return y.hasFilter()?p(a):!1});a.transition(e,y.transitionDuration()).attr("width",function(a){var b=r(0)==-1/0?r(1):r(0);return Math.abs(b-r(y.valueAccessor()(a)))}).attr("transform",o),k(b),m(b)}function k(a){y.renderTitle()&&(a.selectAll("title").remove(),a.append("title").text(y.title()))}function l(a){y.renderLabel()&&a.append("text").on("click",n)}function m(b){if(y.renderLabel()){var c=b.select("text").attr("x",u).attr("y",v).on("click",n).attr("class",function(a,b){return x+" _"+b}).text(function(a){return y.label()(a)});a.transition(c,y.transitionDuration()).attr("transform",o)}}function n(a){y.onClick(a)}function o(a){var b=r(y.cappedValueAccessor(a)),c=r(0),d=b>c?c:b;return"translate("+d+",0)"}function p(a){return y.hasFilter(y.cappedKeyAccessor(a))}var q,r,s,t,u=10,v=15,w=5,x="row",y=a.capped(a.marginable(a.colorChart(a.baseChart({})))),z=d3.svg.axis().orient("bottom");return y.rowsCap=y.cap,y.doRender=function(){return y.resetSvg(),q=y.svg().append("g").attr("transform","translate("+y.margins().left+","+y.margins().top+")"),g(),y},y.title(function(a){return y.cappedKeyAccessor(a)+": "+y.cappedValueAccessor(a)}),y.label(y.cappedKeyAccessor),y.x=function(a){return arguments.length?(r=a,y):r},y.doRedraw=function(){return g(),y},y.xAxis=function(){return z},y.gap=function(a){return arguments.length?(w=a,y):w},y.elasticX=function(a){return arguments.length?(s=a,y):s},y.labelOffsetX=function(a){return arguments.length?(u=a,y):u},y.labelOffsetY=function(a){return arguments.length?(v=a,y):v},y.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(){b.svg().select("g.dc-legend").remove(),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)});f>c&&a.push({others:j,key:d,value:f-c})};return b.cappedKeyAccessor=function(a,c){return a.others?a.key:b.keyAccessor()(a,c)},b.cappedValueAccessor=function(a,c){return a.others?a.value:b.valueAccessor()(a,c)},b.data(function(a){if(1/0==c)return b.computeOrderedGroups(a.all());var d=a.top(c);return d=b.computeOrderedGroups(d),e&&e(d),d}),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&&b.filter([a.others]),b._onClick(a)}),b},a.scatterPlot=function(b,c){var d=a.coordinateGridChart({}),e=function(a){return"translate("+d.x()(d.keyAccessor()(a))+","+d.y()(d.valueAccessor()(a))+")"},f=3;return d.transitionDuration(0),d.plotData=function(){var b=d.chartBodyG().selectAll("circle.symbol").data(d.data());b.enter().append("circle").attr("class","symbol").attr("fill",d.getColor(0)).attr("transform",e),a.transition(b,d.transitionDuration()).attr("transform",e).attr("r",f),a.transition(b.filter(function(a){return 0===d.valueAccessor()(a)}),d.transitionDuration()).attr("r",0).remove(),a.transition(b.exit(),d.transitionDuration()).attr("r",0).remove()},d.symbolSize=function(a){return arguments.length?(f=a,d):f},d.anchor(b,c)},a.numberDisplay=function(b,c){var d="number-display",e=d3.format(".2s"),f=a.baseChart({});return f._mandatoryAttributes(["group"]),f.value=function(){return f.data()},f.data(function(a){var b=a.value&&a.value()||a.top(1)[0];return f.valueAccessor()(b)}),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.heatMap=function(b,c){function d(a,b,c){return!b||c[b-1]!=a}var e,f,g,h=a.colorChart(a.marginable(a.baseChart({})));return h._mandatoryAttributes(["group"]),h.title(h.colorAccessor()),h.boxOnClick=function(){},h.xAxisOnClick=function(){},h.yAxisOnClick=function(){},h.rows=function(a){if(arguments.length)return g=a,h;if(g)return g;var b=h.data().map(h.valueAccessor());return b.sort(d3.ascending),d3.scale.ordinal().domain(b.filter(d))},h.cols=function(a){if(arguments.length)return f=a,h;if(f)return f;var b=h.data().map(h.keyAccessor());return b.sort(d3.ascending),d3.scale.ordinal().domain(b.filter(d))},h.doRender=function(){return h.resetSvg(),e=h.svg().append("g").attr("class","heatmap").attr("transform","translate("+h.margins().left+","+h.margins().top+")"),h.doRedraw()},h.doRedraw=function(){var b=h.rows(),c=h.cols(),d=b.domain().length,f=c.domain().length,g=Math.floor(h.effectiveWidth()/f),i=Math.floor(h.effectiveHeight()/d);c.rangeRoundBands([0,h.effectiveWidth()]),b.rangeRoundBands([h.effectiveHeight(),0]);var j=e.selectAll("g.box-group").data(h.data(),function(a,b){return h.keyAccessor()(a,b)+"\x00"+h.valueAccessor()(a,b)}),k=j.enter().append("g").attr("class","box-group");k.append("rect").attr("fill","white").on("click",h.boxOnClick),k.append("title").text(function(a){return h.title()(a)}),a.transition(j.select("rect"),h.transitionDuration()).attr("class","heat-box").attr("x",function(a,b){return c(h.keyAccessor()(a,b))}).attr("y",function(a,c){return b(h.valueAccessor()(a,c))}).attr("rx",.15*g).attr("ry",.15*i).attr("fill",h.getColor).attr("width",g).attr("height",i),j.exit().remove();var l=e.selectAll("g.cols");l.empty()&&(l=e.append("g").attr("class","cols axis")),l.selectAll("text").data(c.domain()).enter().append("text").attr("x",function(a){return c(a)+g/2}).style("text-anchor","middle").attr("y",h.effectiveHeight()).attr("dy",12).on("click",h.xAxisOnClick).text(function(a){return a});var m=e.selectAll("g.rows");m.empty()&&(m=e.append("g").attr("class","rows axis")),m.selectAll("text").data(b.domain()).enter().append("text").attr("y",function(a){return b(a)+i/2}).attr("dy",6).style("text-anchor","end").attr("x",0).attr("dx",-2).on("click",h.yAxisOnClick).text(function(a){return a})},h.anchor(b,c)},function(){function a(a){return[0,a.length-1]}function b(a){return[d3.quantile(a,.25),d3.quantile(a,.5),d3.quantile(a,.75)]}d3.box=function(){function c(a){a.each(function(a,b){a=a.map(h).sort(d3.ascending);var c=d3.select(this),l=a.length,m=a[0],n=a[l-1],o=a.quartiles=j(a),p=i&&i.call(this,a,b),q=p&&p.map(function(b){return a[b]}),r=p?d3.range(0,p[0]).concat(d3.range(p[1]+1,l)):d3.range(l),s=d3.scale.linear().domain(g&&g.call(this,a,b)||[m,n]).range([e,0]),t=this.__chart__||d3.scale.linear().domain([0,1/0]).range(s.range());this.__chart__=s;var u=c.selectAll("line.center").data(q?[q]:[]);u.enter().insert("line","rect").attr("class","center").attr("x1",d/2).attr("y1",function(a){return t(a[0])}).attr("x2",d/2).attr("y2",function(a){return t(a[1])}).style("opacity",1e-6).transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.transition().duration(f).style("opacity",1).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}),u.exit().transition().duration(f).style("opacity",1e-6).attr("y1",function(a){return s(a[0])}).attr("y2",function(a){return s(a[1])}).remove();var v=c.selectAll("rect.box").data([o]);v.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(a){return t(a[2])}).attr("width",d).attr("height",function(a){return t(a[0])-t(a[2])}).transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])}),v.transition().duration(f).attr("y",function(a){return s(a[2])}).attr("height",function(a){return s(a[0])-s(a[2])});var w=c.selectAll("line.median").data([o[1]]);w.enter().append("line").attr("class","median").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).transition().duration(f).attr("y1",s).attr("y2",s),w.transition().duration(f).attr("y1",s).attr("y2",s);var x=c.selectAll("line.whisker").data(q||[]);x.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",t).attr("x2",d).attr("y2",t).style("opacity",1e-6).transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1),x.exit().transition().duration(f).attr("y1",s).attr("y2",s).style("opacity",1e-6).remove();var y=c.selectAll("circle.outlier").data(r,Number);y.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",d/2).attr("cy",function(b){return t(a[b])}).style("opacity",1e-6).transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1),y.exit().transition().duration(f).attr("cy",function(b){return s(a[b])}).style("opacity",1e-6).remove();var z=k||s.tickFormat(8),A=c.selectAll("text.box").data(o);A.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return 1&b?6:-6}).attr("x",function(a,b){return 1&b?d:0}).attr("y",t).attr("text-anchor",function(a,b){return 1&b?"start":"end"}).text(z).transition().duration(f).attr("y",s),A.transition().duration(f).text(z).attr("y",s);var B=c.selectAll("text.whisker").data(q||[]);B.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",d).attr("y",t).text(z).style("opacity",1e-6).transition().duration(f).attr("y",s).style("opacity",1),B.transition().duration(f).text(z).attr("y",s).style("opacity",1),B.exit().transition().duration(f).attr("y",s).style("opacity",1e-6).remove()}),d3.timer.flush()}var d=1,e=1,f=0,g=null,h=Number,i=a,j=b,k=null;return c.width=function(a){return arguments.length?(d=a,c):d},c.height=function(a){return arguments.length?(e=a,c):e},c.tickFormat=function(a){return arguments.length?(k=a,c):k},c.duration=function(a){return arguments.length?(f=a,c):f},c.domain=function(a){return arguments.length?(g=null==a?a:d3.functor(a),c):g},c.value=function(a){return arguments.length?(h=a,c):h},c.whiskers=function(a){return arguments.length?(i=a,c):i},c.quartiles=function(a){return arguments.length?(j=a,c):j},c}}(),a.boxPlot=function(b,c){function d(){return g.group().all().map(function(a){return a.map=function(){return g.valueAccessor()(a)},a})}function e(a){return function(b){for(var c=b.quartiles[0],d=b.quartiles[2],e=(d-c)*a,f=-1,g=b.length;b[++f]<c-e;);for(;b[--g]>d+e;);return[f,g]}}var f,g=a.coordinateGridChart({}),h=1.5,i=e,j=i(h),k=d3.box();return g.yAxisPadding(12),g.plotData=function(){f=.2*g.effectiveWidth()/(g.xUnitCount()+1),k.whiskers(j).width(f).height(g.effectiveHeight()).domain(g.y().domain());var a=Array.prototype.slice.call(g.x().domain(),0);g.chartBodyG().selectAll("g.box").data(d()).enter().append("g").attr("class","box").attr("transform",function(a,b){return"translate("+(g.x()(b)-f/2)+",0)"}).call(k),g.x().domain(a)},g.yAxisMin=function(){var b=d3.min(g.group().all(),function(a){return d3.min(g.valueAccessor()(a))});return b=a.utils.subtract(b,g.yAxisPadding())},g.yAxisMax=function(){var b=d3.max(g.group().all(),function(a){return d3.max(g.valueAccessor()(a))});return b=a.utils.add(b,g.yAxisPadding())},g.anchor(b,c)},a}();
//# sourceMappingURL=dc.min.js.map