forked from dc-js/dc.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dc.min.js
4 lines (4 loc) · 62.9 KB
/
dc.min.js
1
2
3
4
dc=function(){"use strict";var a={version:"2.0.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.disableTransitions=!1,a.transition=function(b,c,d){if(0>=c||void 0===c||a.disableTransitions)return b;var e=b.transition().duration(c);return"function"==typeof d&&d(e),e},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 b?function(c,d){return b.call(c,c[a],d)}:function(b){return b[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.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!a.utils.isNumber(b)||b<a.constants.NEGLIGIBLE_NUMBER&&b>-a.constants.NEGLIGIBLE_NUMBER},a.utils.clamp=function(a,b,c){return b>a?b:a>c?c:a};var b=0;return a.utils.uniqueId=function(){return++b},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.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.baseChart=function(b){function c(){return n=b.root().append("svg").attr("width",b.width()).attr("height",b.height())}function d(c){if(!b[c]||!b[c]())throw new a.errors.InvalidStateException("Mandatory attribute chart."+c+" is missing on chart[#"+b.anchorName()+"]")}function e(a){K.splice(K.indexOf(a),1),h(),b._invokeFilteredListener(a)}function f(a){K.push(a),h(),b._invokeFilteredListener(a)}function g(){K=[],h(),b._invokeFilteredListener(null)}function h(){if(b.dimension()&&b.dimension().filter){var a=L(b.dimension(),K);K=a?a:K}}function i(){for(var a=0;a<F.length;++a)F[a](b)}b.__dc_flag__=a.utils.uniqueId();var j,k,l,m,n,o,p,q=200,r=function(a){var b=a&&a.getBoundingClientRect&&a.getBoundingClientRect().width;return b&&b>q?b:q},s=r,t=200,u=function(a){var b=a&&a.getBoundingClientRect&&a.getBoundingClientRect().height;return b&&b>t?b:t},v=u,w=a.pluck("key"),x=a.pluck("value"),y=a.pluck("key"),z=a.pluck("key"),A=!1,B=function(a){return b.keyAccessor()(a)+": "+b.valueAccessor()(a)},C=!1,D=750,E=a.printers.filters,F=[],G=["dimension","group"],H=a.constants.DEFAULT_CHART_GROUP,I=function(){},J={preRender:I,postRender:I,preRedraw:I,postRedraw:I,filtered:I,zoomed:I},K=[],L=function(a,b){return a.filter(null),0===b.length?a.filter(null):a.filterFunction(function(a){for(var c=0;c<b.length;c++){var d=b[c];if(d.isFiltered&&d.isFiltered(a))return!0;if(d==a)return!0}return!1}),b},M=function(a){return a.all()};return b.width=function(a){return arguments.length?(s=d3.functor(a||r),b):s(m.node())},b.height=function(a){return arguments.length?(v=d3.functor(a||u),b):v(m.node())},b.minWidth=function(a){return arguments.length?(q=a,b):q},b.minHeight=function(a){return arguments.length?(t=a,b):t},b.dimension=function(a){return arguments.length?(j=a,b.expireCache(),b):j},b.data=function(a){return arguments.length?(M=d3.functor(a),b.expireCache(),b):M.call(b,k)},b.group=function(a,c){return arguments.length?(k=a,b._groupName=c,b.expireCache(),b):k},b.ordering=function(a){return arguments.length?(z=a,o=crossfilter.quicksort.by(z),b.expireCache(),b):z},b.computeOrderedGroups=function(a){return a.length<=1?a:(o||(o=crossfilter.quicksort.by(z)),o(a,0,a.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)),H=d,b):l},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?(m=a,b):m},b.svg=function(a){return arguments.length?(n=a,b):n},b.resetSvg=function(){return b.select("svg").remove(),c()},b.filterPrinter=function(a){return arguments.length?(E=a,b):E},b.turnOnControls=function(){return m&&(b.selectAll(".reset").style("display",null),b.selectAll(".filter").text(E(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?(D=a,b):D},b._mandatoryAttributes=function(a){return arguments.length?(G=a,b):G},b.render=function(){J.preRender(b),G&&G.forEach(d);var a=b.doRender();return p&&p.render(),b.activateRenderlets("postRender"),a},b.activateRenderlets=function(a){b.transitionDuration()>0&&n?n.transition().duration(b.transitionDuration()).each("end",function(){i(),a&&J[a](b)}):(i(),a&&J[a](b))},b.redraw=function(){J.preRedraw(b);var a=b.doRedraw();return p&&p.render(),b.activateRenderlets("postRedraw"),a},b.redrawGroup=function(){a.redrawAll(b.chartGroup())},b._invokeFilteredListener=function(a){void 0!==a&&J.filtered(b,a)},b._invokeZoomedListener=function(){J.zoomed(b)},b.hasFilter=function(a){return arguments.length?K.indexOf(a)>=0:K.length>0},b.replaceFilter=function(a){K=[],b.filter(a)},b.filter=function(a){return arguments.length?(a instanceof Array&&a[0]instanceof Array?(a[0].forEach(function(a){b.hasFilter(a)?K.splice(K.indexOf(a),1):K.push(a)}),h(),b._invokeFilteredListener(a)):null===a?g():b.hasFilter(a)?e(a):f(a),null!==m&&b.hasFilter()?b.turnOnControls():b.turnOffControls(),b):K.length>0?K[0]:null},b.filters=function(){return K},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),b.redrawGroup()})},b.filterHandler=function(a){return arguments.length?(L=a,b):L},b.doRender=function(){return b},b.doRedraw=function(){return b},b.legendables=function(){return[]},b.legendHighlight=function(){},b.legendReset=function(){},b.legendToggle=function(){},b.isLegendableHidden=function(){return!1},b.keyAccessor=function(a){return arguments.length?(w=a,b):w},b.valueAccessor=function(a){return arguments.length?(x=a,b):x},b.label=function(a){return arguments.length?(y=a,A=!0,b):y},b.renderLabel=function(a){return arguments.length?(A=a,b):A},b.title=function(a){return arguments.length?(B=a,C=!0,b):B},b.renderTitle=function(a){return arguments.length?(C=a,b):C},b.renderlet=function(a){return F.push(a),b},b.chartGroup=function(a){return arguments.length?(H=a,b):H},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 J[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){b.elasticX()&&!b.isOrdinal()?x.domain([b.xAxisMin(),b.xAxisMax()]):b.isOrdinal()&&0===x.domain().length&&x.domain(b._ordinalXDomain()),b.isOrdinal()?x.rangeBands([0,b.xAxisLength()],_,$):x.range([0,b.xAxisLength()]),G=G.scale(b.x()),d(a)}function d(c){var d=c.selectAll("g."+q);if(S){d.empty()&&(d=c.insert("g",":first-child").attr("class",o+" "+q).attr("transform","translate("+b.margins().left+","+b.margins().top+")"));var e=G.tickValues()?G.tickValues():x.ticks(G.ticks()[0]),f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",function(a){return x(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return x(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 x(a)}).attr("y1",b.xAxisY()-b.margins().top).attr("x2",function(a){return x(a)}).attr("y2",0),f.exit().remove()}else d.selectAll("line").remove()}function e(c){var d=c.selectAll("g."+p);if(R){var e=L.tickValues()?L.tickValues():A.ticks(L.ticks()[0]);d.empty()&&(d=c.insert("g",":first-child").attr("class",o+" "+p).attr("transform","translate("+b.margins().left+","+b.margins().top+")"));var f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",1).attr("y1",function(a){return A(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return A(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 A(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return A(a)}),f.exit().remove()}else d.selectAll("line").remove()}function f(){return b.xAxisY()-b.margins().top}function g(){return b.anchorName()+"-clip"}function h(){var c=a.utils.appendOrSelect(u,"defs"),d=a.utils.appendOrSelect(c,"clipPath").attr("id",g()),e=2*Z;a.utils.appendOrSelect(d,"rect").attr("width",b.xAxisLength()+e).attr("height",b.yAxisHeight()+e)}function i(a){c(b.g()),b.prepareYAxis(b.g()),b.plotData(),(b.elasticX()||T||a)&&b.renderXAxis(b.g()),(b.elasticY()||a)&&b.renderYAxis(b.g()),a?b.renderBrush(b.g()):b.redrawBrush(b.g())}function j(){Y?b._enableMouseZoom():b._disableMouseZoom()}function k(){T=!0,V&&(b.x().domain(l(b.x().domain(),y)),E&&b.x().domain(l(b.x().domain(),E.x().domain())));var c=b.x().domain(),d=a.filters.RangedFilter(c[0],c[1]);b.replaceFilter(d),b.rescale(),b.redraw(),E&&!m(b.filter(),E.filter())&&a.events.trigger(function(){E.replaceFilter(d),E.redraw()}),b._invokeZoomedListener(),a.events.trigger(function(){b.redrawGroup()},a.constants.EVENT_DELAY),T=!m(c,y)}function l(a,b){var c=[];return c[0]=d3.max([a[0],b[0]]),c[1]=d3.min([a[1],b[1]]),c}function m(a,b){return a||b?0===a.length&&0===b.length?!0:a&&b&&a[0].valueOf()===b[0].valueOf()&&a[1].valueOf()===b[1].valueOf()?!0:!1:!0}function n(a){return a instanceof Array&&a.length>1}var o="grid-line",p="horizontal",q="vertical",r="y-axis-label",s="x-axis-label",t=12;b=a.colorChart(a.marginable(a.baseChart(b))),b.colors(d3.scale.category10()),b._mandatoryAttributes().push("x");var u,v,w,x,y,z,A,B,C,D,E,F,G=d3.svg.axis().orient("bottom"),H=a.units.integers,I=0,J=!1,K=0,L=d3.svg.axis().orient("left"),M=0,N=!1,O=0,P=d3.svg.brush(),Q=!0,R=!1,S=!1,T=!1,U=[1,1/0],V=!0,W=d3.behavior.zoom().on("zoom",k),X=d3.behavior.zoom().on("zoom",null),Y=!1,Z=0,$=.5,_=0,ab=!1;return b.rescale=function(){D=void 0},b.rangeChart=function(a){return arguments.length?(E=a,E.focusChart(b),b):E},b.zoomScale=function(a){return arguments.length?(U=a,b):U},b.zoomOutRestrict=function(a){return arguments.length?(U[0]=a?1:0,V=a,b):V},b._generateG=function(a){return u=void 0===a?b.svg():a,v=u.append("g"),w=v.append("g").attr("class","chart-body").attr("transform","translate("+b.margins().left+", "+b.margins().top+")").attr("clip-path","url(#"+g()+")"),v},b.g=function(a){return arguments.length?(v=a,b):v},b.mouseZoomable=function(a){return arguments.length?(Y=a,b):Y},b.chartBodyG=function(a){return arguments.length?(w=a,b):w},b.x=function(a){return arguments.length?(x=a,y=x.domain(),b):x},b.xOriginalDomain=function(){return y},b.xUnits=function(a){return arguments.length?(H=a,b):H},b.xAxis=function(a){return arguments.length?(G=a,b):G},b.elasticX=function(a){return arguments.length?(J=a,b):J},b.xAxisPadding=function(a){return arguments.length?(I=a,b):I},b.xUnitCount=function(){if(void 0===D){var a=b.xUnits()(b.x().domain()[0],b.x().domain()[1],b.x().domain());D=a instanceof Array?a.length:a}return D},b.useRightYAxis=function(a){return arguments.length?(ab=a,b):ab},b.isOrdinal=function(){return b.xUnits()===a.units.ordinal},b._ordinalXDomain=function(){var a=b.computeOrderedGroups(b.data());return a.map(b.keyAccessor())},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."+s);e.empty()&&b.xAxisLabel()&&(e=c.append("text").attr("transform","translate("+(b.margins().left+b.xAxisLength()/2)+","+(b.height()-K)+")").attr("class",s).attr("text-anchor","middle").text(b.xAxisLabel())),b.xAxisLabel()&&e.text()!=b.xAxisLabel()&&axisYLab.text(b.xAxisLabel()),a.transition(d,b.transitionDuration()).call(G)},b.xAxisY=function(){return b.height()-b.margins().bottom},b.xAxisLength=function(){return b.effectiveWidth()},b.xAxisLabel=function(a,c){return arguments.length?(z=a,b.margins().bottom-=K,K=void 0===c?t:c,b.margins().bottom+=K,b):z},b.prepareYAxis=function(a){(void 0===A||b.elasticY())&&(A=d3.scale.linear(),A.domain([b.yAxisMin(),b.yAxisMax()]).rangeRound([b.yAxisHeight(),0])),A.range([b.yAxisHeight(),0]),L=L.scale(A),ab&&L.orient("right"),e(a)},b.renderYAxisLabel=function(a,c,d,e){e=e||O;var f=b.g().selectAll("text."+r+"."+a+"-label");if(f.empty()&&c){var g=b.margins().top+b.yAxisHeight()/2;f=b.g().append("text").attr("transform","translate("+e+","+g+"),rotate("+d+")").attr("class",r+" "+a+"-label").attr("text-anchor","middle").text(c)}c&&f.text()!=c&&f.text(c)},b.renderYAxisAt=function(c,d,e){var f=b.g().selectAll("g."+c);f.empty()&&(f=b.g().append("g").attr("class","axis "+c).attr("transform","translate("+e+","+b.margins().top+")")),a.transition(f,b.transitionDuration()).call(d)},b.renderYAxis=function(){var a=ab?b.width()-b.margins().right:b.yAxisX();b.renderYAxisAt("y",L,a);var c=ab?b.width()-O:O,d=ab?90:-90;b.renderYAxisLabel("y",b.yAxisLabel(),d,c)},b.yAxisX=function(){return b.useRightYAxis()?b.width()-b.margins().right:b.margins().left},b.yAxisLabel=function(a,c){return arguments.length?(B=a,b.margins().left-=O,O=void 0===c?t:c,b.margins().left+=O,b):B},b.y=function(a){return arguments.length?(A=a,b):A},b.yAxis=function(a){return arguments.length?(L=a,b):L},b.elasticY=function(a){return arguments.length?(N=a,b):N},b.renderHorizontalGridLines=function(a){return arguments.length?(R=a,b):R},b.renderVerticalGridLines=function(a){return arguments.length?(S=a,b):S},b.xAxisMin=function(){var c=d3.min(b.data(),function(a){return b.keyAccessor()(a)});return a.utils.subtract(c,I)},b.xAxisMax=function(){var c=d3.max(b.data(),function(a){return b.keyAccessor()(a)});return a.utils.add(c,I)},b.yAxisMin=function(){var c=d3.min(b.data(),function(a){return b.valueAccessor()(a)});return a.utils.subtract(c,M)},b.yAxisMax=function(){var c=d3.max(b.data(),function(a){return b.valueAccessor()(a)});return a.utils.add(c,M)},b.yAxisPadding=function(a){return arguments.length?(M=a,b):M},b.yAxisHeight=function(){return b.effectiveHeight()},b.round=function(a){return arguments.length?(C=a,b):C},b._rangeBandPadding=function(a){return arguments.length?(_=a,b):_},b._outerRangeBandPadding=function(a){return arguments.length?($=a,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?(P=a,b):P},b.renderBrush=function(a){if(b.isOrdinal()&&(Q=!1),Q){P.on("brush",b._brushing),P.on("brushstart",b._disableMouseZoom),P.on("brushend",j);var c=a.append("g").attr("class","brush").attr("transform","translate("+b.margins().left+","+b.margins().top+")").call(P.x(b.x()));c.selectAll("rect").attr("height",f()),c.selectAll(".resize").append("path").attr("d",b.resizeHandlePath),b.hasFilter()&&b.redrawBrush(a)}},b.extendBrush=function(){var a=P.extent();return b.round()&&(a[0]=a.map(b.round())[0],a[1]=a.map(b.round())[1],v.select(".brush").call(P.extent(a))),a},b.brushIsEmpty=function(a){return P.empty()||!a||a[1]<=a[0]},b._brushing=function(){var c=b.extendBrush();if(b.redrawBrush(v),b.brushIsEmpty(c))a.events.trigger(function(){b.filter(null),b.redrawGroup()},a.constants.EVENT_DELAY);else{var d=a.filters.RangedFilter(c[0],c[1]);a.events.trigger(function(){b.replaceFilter(d),b.redrawGroup()},a.constants.EVENT_DELAY)}},b.redrawBrush=function(a){if(Q){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",f())}b.fadeDeselectedArea()},b.fadeDeselectedArea=function(){},b.resizeHandlePath=function(a){var b=+("e"==a),c=b?1:-1,d=f()/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+"ZM"+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?(Z=a,b):Z},b._preprocessData=function(){},b.doRender=function(){return b.resetSvg(),b._preprocessData(),b._generateG(),h(),i(!0),j(),b},b.doRedraw=function(){return b._preprocessData(),i(!1),b},b._enableMouseZoom=function(){W.x(b.x()).scaleExtent(U).size([b.width(),b.height()]),b.root().call(W)},b._disableMouseZoom=function(){b.root().call(X)},b.focus=function(a){n(a)?b.x().domain(a):b.x().domain(y),W.x(b.x()),k()},b.refocused=function(){return T},b.focusChart=function(c){return arguments.length?(F=c,b.on("filtered",function(b){m(b.filter(),F.filter())||a.events.trigger(function(){F.focus(b.filter())})}),b):F},b.brushOn=function(a){return arguments.length?(Q=a,b):Q},b},a.colorChart=function(a){var b=d3.scale.category20c(),c=!0,d=function(b){return a.keyAccessor()(b)};return a.colors=function(c){return arguments.length?(b=c instanceof Array?d3.scale.quantize().range(c):d3.functor(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?(d=b,c=!1,a):d},a.defaultColorAccessor=function(){return 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,c){return b(d.call(this,a,c))},a.colorCalculator=function(b){return arguments.length?(a.getColor=b,a):a.getColor},a},a.stackableChart=function(b){function c(a,c){var e=a.accessor||b.valueAccessor();return a.name=String(a.name||c),a.values=a.group.all().map(function(c,d){return{x:b.keyAccessor()(c,d),y:a.hidden?null:e(c,d),data:c,layer:a.name,hidden:a.hidden}}),a.values=a.values.filter(d()),a.values}function d(){if(!b.x())return d3.functor(!0);var a=b.x().domain();return b.isOrdinal()?function(){return!0}:function(b){return b.x>=a[0]&&b.x<=a[a.length-1]}}function e(b){var c=i.map(a.pluck("name")).indexOf(b);return i[c]}function f(){return b.data().reduce(function(a,b){return a.concat(b.values)},[])}function g(a){return!a.hidden}var h=d3.layout.stack().values(c),i=[],j={},k=!1;return b.stack=function(a,c,d){if(!arguments.length)return i;arguments.length<=2&&(d=c);var e={group:a};return"string"==typeof c&&(e.name=c),"function"==typeof d&&(e.accessor=d),i.push(e),b},a.override(b,"group",function(a,c,d){return arguments.length?(i=[],j={},b.stack(a,c),d&&b.valueAccessor(d),b._group(a,c)):b._group()}),b.hidableStacks=function(a){return arguments.length?(k=a,b):k},b.hideStack=function(a){var b=e(a);b&&(b.hidden=!0)},b.showStack=function(a){var b=e(a);b&&(b.hidden=!1)},b.allGroups=function(){return i.map(a.pluck("group"))},b.allValueAccessors=function(){return i.map(function(a){return a.accessor||b.valueAccessor()})},b.getValueAccessorByIndex=function(a){return i[a].accessor||b.valueAccessor()},b.yAxisMin=function(){var c=d3.min(f(),function(a){return a.y+a.y0<a.y0?a.y+a.y0:a.y0});return a.utils.subtract(c,b.yAxisPadding())},b.yAxisMax=function(){var c=d3.max(f(),function(a){return a.y+a.y0});return a.utils.add(c,b.yAxisPadding())},b.xAxisMin=function(){var c=d3.min(f(),a.pluck("x"));return a.utils.subtract(c,b.xAxisPadding())},b.xAxisMax=function(){var c=d3.max(f(),a.pluck("x"));return a.utils.add(c,b.xAxisPadding())},a.override(b,"title",function(a,c){return a?"function"==typeof a?b._title(a):a==b._groupName&&"function"==typeof c?b._title(c):"function"!=typeof c?j[a]||b._title():(j[a]=c,b):b._title()}),b.stackLayout=function(a){return arguments.length?(h=a,b):h},b.data(function(){var a=i.filter(g);return a.length?b.stackLayout()(a):[]}),b._ordinalXDomain=function(){return f().map(a.pluck("x"))},b.colorAccessor(function(a){var b=this.layer||this.name||a.name||a.layer;return b}),b.legendables=function(){return i.map(function(a,c){return{chart:b,name:a.name,color:b.getColor.call(a,a.values,c)}})},b.isLegendableHidden=function(a){var b=e(a.name);return b?b.hidden:!1},b.legendToggle=function(c){k&&(b.isLegendableHidden(c)?b.showStack(c.name):b.hideStack(c.name),a.renderAll(b.chartGroup()))},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(){C=C?C:d3.min([J.width(),J.height()])/2;var a=q(),b=s(),c=b(J.data());if(D){var d=D.selectAll("g."+G).data(c);e(d,a,c),k(c,a),o(d),p()}}function e(a,b,c){var d=f(a);g(d,b),h(d),j(c,b)}function f(a){var b=a.enter().append("g").attr("class",function(a,b){return G+" _"+b});return b}function g(a,b){var c=a.append("path").attr("fill",x).on("click",y).attr("d",function(a,c){return z(a,c,b)});c.transition().duration(J.transitionDuration()).attrTween("d",v)}function h(a){J.renderTitle()&&a.append("title").text(function(a){return J.title()(a)})}function i(b,c){a.transition(b,J.transitionDuration()).attr("transform",function(a){return A(a,c)}).attr("text-anchor","middle").text(function(a){var b=a.data;return u(b)||t(a)?"":J.label()(a.data)})}function j(a,b){if(J.renderLabel()){var c=D.selectAll("text."+G).data(a);c.exit().remove();var d=c.enter().append("text").attr("class",function(a,b){var c=G+" _"+b;return E&&(c+=" external"),c}).on("click",y);i(d,b)}}function k(a,b){l(a,b),m(a,b),n(a)}function l(b,c){var d=D.selectAll("g."+G).data(b).select("path").attr("d",function(a,b){return z(a,b,c)});a.transition(d,J.transitionDuration(),function(a){a.attrTween("d",v)}).attr("fill",x)}function m(a,b){if(J.renderLabel()){var c=D.selectAll("text."+G).data(a);i(c,b)}}function n(a){J.renderTitle()&&D.selectAll("g."+G).data(a).select("title").text(function(a){return J.title()(a.data)})}function o(a){a.exit().remove()}function p(){J.hasFilter()?J.selectAll("g."+G).each(function(a){r(a)?J.highlightSelected(this):J.fadeDeselected(this)}):J.selectAll("g."+G).each(function(){J.resetHighlight(this)})}function q(){return d3.svg.arc().outerRadius(C).innerRadius(H)}function r(a){return J.hasFilter(J.cappedKeyAccessor(a.data))}function s(){return d3.layout.pie().sort(null).value(J.cappedValueAccessor)}function t(a){var b=a.endAngle-a.startAngle;return isNaN(b)||I>b}function u(a){return 0===J.cappedValueAccessor(a)}function v(a){a.innerRadius=H;var b=this._current;w(b)&&(b={startAngle:0,endAngle:0});var c=d3.interpolate(b,a);return this._current=c(0),function(a){return z(c(a),0,q())}}function w(a){return!a||isNaN(a.startAngle)||isNaN(a.endAngle)}function x(a,b){return J.getColor(a.data,b)}function y(a,b){J.onClick(a.data,b)}function z(a,b,c){var d=c(a,b);return d.indexOf("NaN")>=0&&(d="M0,0"),d}function A(a,b){var c;return c=E?d3.svg.arc().outerRadius(C+E).innerRadius(C+E).centroid(a):b.centroid(a),isNaN(c[0])||isNaN(c[1])?"translate(0,0)":"translate("+c+")"}function B(a,b){J.selectAll("g.pie-slice").each(function(c){a.name==c.data.key&&d3.select(this).classed("highlight",b)})}var C,D,E,F=.5,G="pie-slice",H=0,I=F,J=a.capped(a.colorChart(a.baseChart({})));return J.colorAccessor(J.cappedKeyAccessor),J.title(function(a){return J.cappedKeyAccessor(a)+": "+J.cappedValueAccessor(a)}),J.slicesCap=J.cap,J.label(J.cappedKeyAccessor),J.renderLabel(!0),J.transitionDuration(350),J.doRender=function(){return J.resetSvg(),D=J.svg().append("g").attr("transform","translate("+J.cx()+","+J.cy()+")"),d(),J},J.innerRadius=function(a){return arguments.length?(H=a,J):H},J.radius=function(a){return arguments.length?(C=a,J):C},J.cx=function(){return J.width()/2},J.cy=function(){return J.height()/2},J.doRedraw=function(){return d(),J},J.minAngleForLabel=function(a){return arguments.length?(I=a,J):I},J.externalLabels=function(a){return 0===arguments.length?E:(E=a?a:void 0,J)},J.legendables=function(){return J.data().map(function(a,b){var c={name:a.key,data:a.value,others:a.others,chart:J};return c.color=J.getColor(a,b),c})},J.legendHighlight=function(a){B(a,!0)},J.legendReset=function(a){B(a,!1)},J.legendToggle=function(a){J.onClick({key:a.name,others:a.others})},J.anchor(b,c)},a.barChart=function(b,c){function d(b){return a.utils.safeNumber(Math.abs(l.y()(b.y+b.y0)-l.y()(b.y0)))}function e(b,c,e){var f=b.selectAll("rect.bar").data(e.values,a.pluck("x"));f.enter().append("rect").attr("class","bar").attr("fill",a.pluck("data",l.getColor)),l.renderTitle()&&f.append("title").text(a.pluck("data",l.title(e.name))),l.isOrdinal()&&f.on("click",g),a.transition(f,l.transitionDuration()).attr("x",function(b){var c=l.x()(b.x);return n&&(c-=i/2),l.isOrdinal()&&(c+=m/2),a.utils.safeNumber(c)}).attr("y",function(b){var c=l.y()(b.y+b.y0);return b.y<0&&(c-=d(b)),a.utils.safeNumber(c)}).attr("width",i).attr("height",function(a){return d(a)}).attr("fill",a.pluck("data",l.getColor)).select("title").text(a.pluck("data",l.title(e.name))),a.transition(f.exit(),l.transitionDuration()).attr("height",0).remove()}function f(){if(void 0===i){var a=l.xUnitCount();i=l.isOrdinal()&&!m?Math.floor(l.x().rangeBand()):m?Math.floor((l.xAxisLength()-(a-1)*m)/a):Math.floor(l.xAxisLength()/(1+l.barPadding())/a),(1/0==i||isNaN(i)||j>i)&&(i=j)}}function g(a){l.onClick(a.data)}function h(a,b){return function(){var c=d3.select(this),d=c.attr("fill")==a;return b?!d:d}}var i,j=1,k=2,l=a.stackableChart(a.coordinateGridChart({})),m=k,n=!1;return a.override(l,"rescale",function(){l._rescale(),i=void 0}),l.plotData=function(){var a=l.chartBodyG().selectAll("g.stack").data(l.data());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,b,a)})},l.fadeDeselectedArea=function(){var b=l.chartBodyG().selectAll("rect.bar"),c=l.brush().extent();if(l.isOrdinal())l.hasFilter()?(b.classed(a.constants.SELECTED_CLASS,function(a){return l.hasFilter(a.x)}),b.classed(a.constants.DESELECTED_CLASS,function(a){return!l.hasFilter(a.x)})):(b.classed(a.constants.SELECTED_CLASS,!1),b.classed(a.constants.DESELECTED_CLASS,!1));else if(l.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){return a.x<d||a.x>=e})}},l.centerBar=function(a){return arguments.length?(n=a,l):n},l.barPadding=function(a){return arguments.length?(l._rangeBandPadding(a),m=0,l):l._rangeBandPadding()},l.outerPadding=l._outerRangeBandPadding,l.gap=function(a){return arguments.length?(m=a,l):m
},l.extendBrush=function(){var a=l.brush().extent();return l.round()&&!n&&(a[0]=a.map(l.round())[0],a[1]=a.map(l.round())[1],l.chartBodyG().select(".brush").call(l.brush().extent(a))),a},l.legendHighlight=function(a){l.isLegendableHidden(a)||l.selectAll("rect.bar").classed("highlight",h(a.color)).classed("fadeout",h(a.color,!0))},l.legendReset=function(){l.selectAll("rect.bar").classed("highlight",!1).classed("fadeout",!1)},a.override(l,"xAxisMax",function(){var a=this._xAxisMax();if("resolution"in l.xUnits()){var b=l.xUnits().resolution;a+=b}return a}),l.anchor(b,c)},a.lineChart=function(b,c){function d(a,b){return x.getColor.call(a,a.values,b)}function e(b,c){var e=d3.svg.line().x(function(a){return x.x()(a.x)}).y(function(a){return x.y()(a.y+a.y0)}).interpolate(D).tension(E);p&&e.defined(p);var f=b.append("path").attr("class","line").attr("stroke",d);q&&f.attr("stroke-dasharray",q),a.transition(c.select("path.line"),x.transitionDuration()).attr("stroke",d).attr("d",function(a){return g(e(a.values))})}function f(b,c){if(y){var e=d3.svg.area().x(function(a){return x.x()(a.x)}).y(function(a){return x.y()(a.y+a.y0)}).y0(function(a){return x.y()(a.y0)}).interpolate(D).tension(E);p&&e.defined(p),b.append("path").attr("class","area").attr("fill",d).attr("d",function(a){return g(e(a.values))}),a.transition(c.select("path.area"),x.transitionDuration()).attr("fill",d).attr("d",function(a){return g(e(a.values))})}}function g(a){return!a||a.indexOf("NaN")>=0?"M0,0":a}function h(b,c){if(!x.brushOn()){var d=s+"-list",e=b.select("g."+d);e.empty()&&(e=b.append("g").attr("class",d)),c.each(function(b,c){var d=b.values;p&&(d=d.filter(p));var f=e.select("g."+s+"._"+c);f.empty()&&(f=e.append("g").attr("class",s+" _"+c)),i(f);var g=f.selectAll("circle."+t).data(d,a.pluck("x"));g.enter().append("circle").attr("class",t).attr("r",l()).attr("fill",x.getColor).style("fill-opacity",B).style("stroke-opacity",C).on("mousemove",function(){var a=d3.select(this);j(a),k(a,f)}).on("mouseout",function(){var a=d3.select(this);m(a),n(f)}).append("title").text(a.pluck("data",x.title(b.name))),g.attr("cx",function(b){return a.utils.safeNumber(x.x()(b.x))}).attr("cy",function(b){return a.utils.safeNumber(x.y()(b.y+b.y0))}).select("title").text(a.pluck("data",x.title(b.name))),g.exit().remove()})}}function i(a){var b=a.select("path."+u).empty()?a.append("path").attr("class",u):a.select("path."+u);b.style("display","none").attr("stroke-dasharray","5,5");var c=a.select("path."+v).empty()?a.append("path").attr("class",v):a.select("path."+v);c.style("display","none").attr("stroke-dasharray","5,5")}function j(a){return a.style("fill-opacity",.8),a.style("stroke-opacity",.8),a.attr("r",z),a}function k(a,b){var c=a.attr("cx"),d=a.attr("cy"),e=x.yAxisX()-x.margins().left,f="M"+e+" "+d+"L"+c+" "+d,g="M"+c+" "+x.yAxisHeight()+"L"+c+" "+d;b.select("path."+u).style("display","").attr("d",f),b.select("path."+v).style("display","").attr("d",g)}function l(){return A||z}function m(a){a.style("fill-opacity",B).style("stroke-opacity",C).attr("r",l())}function n(a){a.select("path."+u).style("display","none"),a.select("path."+v).style("display","none")}function o(a,b){return function(){var c=d3.select(this),d=c.attr("stroke")==a||c.attr("fill")==a;return b?!d:d}}var p,q,r=5,s="dc-tooltip",t="dot",u="yRef",v="xRef",w=1e-6,x=a.stackableChart(a.coordinateGridChart({})),y=!1,z=r,A=null,B=w,C=w,D="linear",E=.7;return x.transitionDuration(500),x.plotData=function(){var a=x.chartBodyG(),b=a.selectAll("g.stack-list");b.empty()&&(b=a.append("g").attr("class","stack-list"));var c=b.selectAll("g.stack").data(x.data()),d=c.enter().append("g").attr("class",function(a,b){return"stack _"+b});e(d,c),f(d,c),h(a,c)},x.interpolate=function(a){return arguments.length?(D=a,x):D},x.tension=function(a){return arguments.length?(E=a,x):E},x.defined=function(a){return arguments.length?(p=a,x):p},x.dashStyle=function(a){return arguments.length?(q=a,x):q},x.renderArea=function(a){return arguments.length?(y=a,x):y},x.dotRadius=function(a){return arguments.length?(z=a,x):z},x.renderDataPoints=function(a){return arguments.length?(a?(B=a.fillOpacity||.8,C=a.strokeOpacity||.8,A=a.radius||2):(B=w,C=w,A=null),x):{fillOpacity:B,strokeOpacity:C,radius:A}},x.legendHighlight=function(a){x.isLegendableHidden(a)||x.selectAll("path.line, path.area").classed("highlight",o(a.color)).classed("fadeout",o(a.color,!0))},x.legendReset=function(){x.selectAll("path.line, path.area").classed("highlight",!1).classed("fadeout",!1)},a.override(x,"legendables",function(){var a=x._legendables();return q?a.map(function(a){return a.dashstyle=q,a}):a}),x.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=k.root().selectAll("tbody").data(e(),function(a){return k.keyAccessor()(a)}),b=a.enter().append("tbody");return b.append("tr").attr("class",j).append("td").attr("class",g).attr("colspan",m.length).html(function(a){return k.keyAccessor()(a)}),a.exit().remove(),b}function e(){var a=k.dimension().top(l);return d3.nest().key(k.group()).sortKeys(o).entries(a.sort(function(a,b){return o(n(a),n(b))}))}function f(a){var b=a.order().selectAll("tr."+h).data(function(a){return a.values}),c=b.enter().append("tr").attr("class",h);return m.forEach(function(a,b){c.append("td").attr("class",i+" _"+b).html(a)}),b.exit().remove(),b}var g="dc-table-label",h="dc-table-row",i="dc-table-column",j="dc-table-group",k=a.baseChart({}),l=25,m=[],n=function(a){return a},o=d3.ascending;return k.doRender=function(){return k.selectAll("tbody").remove(),f(d()),k},k.doRedraw=function(){return k.doRender()},k.size=function(a){return arguments.length?(l=a,k):l},k.columns=function(a){return arguments.length?(m=a,k):m},k.sortBy=function(a){return arguments.length?(n=a,k):n},k.order=function(a){return arguments.length?(o=a,k):o},k.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()).selectAll("circle."+i.BUBBLE_CLASS).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(){(void 0===t.rightY()||t.elasticY())&&(t.rightY(d3.scale.linear()),t.rightY().domain([k(),n()]).rangeRound([t.yAxisHeight(),0])),t.rightY().range([t.yAxisHeight(),0]),t.rightYAxis(t.rightYAxis().scale(t.rightY())),t.rightYAxis().orient("right")}function e(){(void 0===t.y()||t.elasticY())&&(t.y(d3.scale.linear()),t.y().domain([j(),m()]).rangeRound([t.yAxisHeight(),0])),t.y().range([t.yAxisHeight(),0]),t.yAxis(t.yAxis().scale(t.y())),t.yAxis().orient("left")}function f(a,b){a._generateG(t.g()),a.g().attr("class",r+" _"+b)}function g(){return u.filter(function(a){return!a.useRightYAxis()})}function h(){return u.filter(function(a){return a.useRightYAxis()})}function i(a){return a.map(function(a){return a.yAxisMin()})}function j(){return d3.min(i(g()))}function k(){return d3.min(i(h()))}function l(a){return a.map(function(a){return a.yAxisMax()})}function m(){return a.utils.add(d3.max(l(g())),t.yAxisPadding())}function n(){return a.utils.add(d3.max(l(h())),t.yAxisPadding())}function o(){return u.map(function(a){return a.xAxisMin()})}function p(){return u.map(function(a){return a.xAxisMax()})}var q,r="sub",s=12,t=a.coordinateGridChart({}),u=[],v=!1,w=!0,x=d3.svg.axis(),y=0,z=s;return t._mandatoryAttributes([]),t.transitionDuration(500),a.override(t,"_generateG",function(){for(var a=this.__generateG(),b=0;b<u.length;++b){var c=u[b];f(c,b),c.dimension()||c.dimension(t.dimension()),c.group()||c.group(t.group()),c.chartGroup(t.chartGroup()),c.svg(t.svg()),c.xUnits(t.xUnits()),c.transitionDuration(t.transitionDuration()),c.brushOn(t.brushOn())}return a}),t.prepareYAxis=function(){0!==g().length&&e(),0!==h().length&&d()},t.renderYAxis=function(){0!==g().length&&(t.renderYAxisAt("y",t.yAxis(),t.margins().left),t.renderYAxisLabel("y",t.yAxisLabel(),-90)),0!==h().length&&(t.renderYAxisAt("yr",t.rightYAxis(),t.width()-t.margins().right),t.renderYAxisLabel("yr",t.rightYAxisLabel(),90,t.width()-z))},t.plotData=function(){for(var a=0;a<u.length;++a){var b=u[a];b.g()||f(b,a),v&&b.colors(t.colors()),b.x(t.x()),b.xAxis(t.xAxis()),b.useRightYAxis()?(b.y(t.rightY()),b.yAxis(t.rightYAxis())):(b.y(t.y()),b.yAxis(t.yAxis())),b.plotData(),b.activateRenderlets()}},t.fadeDeselectedArea=function(){for(var a=0;a<u.length;++a){var b=u[a];b.brush(t.brush()),b.fadeDeselectedArea()}},t.rightYAxisLabel=function(a,b){return arguments.length?(y=a,t.margins().right-=z,z=void 0===b?s:b,t.margins().right+=z,t):y},t.compose=function(a){return u=a,u.forEach(function(a){a.height(t.height()),a.width(t.width()),a.margins(t.margins()),w&&a.title(t.title())}),t},t.children=function(){return u},t.shareColors=function(a){return arguments.length?(v=a,t):v},t.shareTitle=function(a){return arguments.length?(w=a,t):w},t.rightY=function(a){return arguments.length?(q=a,t):q},t.xAxisMin=function(){return a.utils.subtract(d3.min(o()),t.xAxisPadding())},t.xAxisMax=function(){return a.utils.add(d3.max(p()),t.xAxisPadding())},t.legendables=function(){return u.reduce(function(a,b){return v&&b.colors(t.colors()),a.push.apply(a,b.legendables()),a},[])},t.legendHighlight=function(a){for(var b=0;b<u.length;++b){var c=u[b];c.legendHighlight(a)}},t.legendReset=function(a){for(var b=0;b<u.length;++b){var c=u[b];c.legendReset(a)}},t.rightYAxis=function(a){return arguments.length?(x=a,t):x},t.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())});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),o.redrawGroup()})},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 b(){return j+i}var c,d,e=2,f={},g=0,h=0,i=12,j=5,k=!1,l=560,m=70;return f.parent=function(a){return arguments.length?(c=a,f):c},f.render=function(){c.svg().select("g.dc-legend").remove(),d=c.svg().append("g").attr("class","dc-legend").attr("transform","translate("+g+","+h+")");var f=c.legendables(),j=d.selectAll("g.dc-legend-item").data(f).enter().append("g").attr("class","dc-legend-item").on("mouseover",function(a){c.legendHighlight(a)}).on("mouseout",function(a){c.legendReset(a)}).on("click",function(a){c.legendToggle(a)});d.selectAll("g.dc-legend-item").classed("fadeout",function(a){return a.chart.isLegendableHidden(a)}),f.some(a.pluck("dashstyle"))?j.append("line").attr("x1",0).attr("y1",i/2).attr("x2",i).attr("y2",i/2).attr("stroke-width",2).attr("stroke-dasharray",a.pluck("dashstyle")).attr("stroke",a.pluck("color")):j.append("rect").attr("width",i).attr("height",i).attr("fill",function(a){return a?a.color:"blue"}),j.append("text").text(a.pluck("name")).attr("x",i+e).attr("y",function(){return i/2+(this.clientHeight?this.clientHeight:13)/2-2});var n=0,o=0;j.attr("transform",function(a,c){if(k){var d="translate("+n+","+o*b()+")";return n+m>=l?(++o,n=0):n+=m,d}return"translate(0,"+c*b()+")"})},f.x=function(a){return arguments.length?(g=a,f):g},f.y=function(a){return arguments.length?(h=a,f):h},f.gap=function(a){return arguments.length?(j=a,f):j},f.itemHeight=function(a){return arguments.length?(i=a,f):i},f.horizontal=function(a){return arguments.length?(k=a,f):k},f.legendWidth=function(a){return arguments.length?(l=a,f):l},f.itemWidth=function(a){return arguments.length?(m=a,f):m},f},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)});return f>c?a.concat([{others:j,key:d,value:f-c}]):a};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(b,c){var d=l.selectAll(".box-group").filter(function(a){return a.key[b]==c}),e=d.filter(function(a){return!l.hasFilter(a.key)});a.events.trigger(function(){e.empty()?d.each(function(a){l.filter(a.key)}):e.each(function(a){l.filter(a.key)}),l.redrawGroup()})}function e(a,b,c){return!b||c[b-1]!=a}var f,g,h,i=6.75,j=i,k=i,l=a.colorChart(a.marginable(a.baseChart({})));l._mandatoryAttributes(["group"]),l.title(l.colorAccessor());var m=function(a){d(0,a)},n=function(a){d(1,a)},o=function(b){var c=b.key;a.events.trigger(function(){l.filter(c),l.redrawGroup()})};return a.override(l,"filter",function(b){return b?l._filter(a.filters.TwoDimensionalFilter(b)):l._filter()}),l.rows=function(a){if(arguments.length)return h=a,l;if(h)return h;var b=l.data().map(l.valueAccessor());return b.sort(d3.ascending),d3.scale.ordinal().domain(b.filter(e))},l.cols=function(a){if(arguments.length)return g=a,l;if(g)return g;var b=l.data().map(l.keyAccessor());return b.sort(d3.ascending),d3.scale.ordinal().domain(b.filter(e))},l.doRender=function(){return l.resetSvg(),f=l.svg().append("g").attr("class","heatmap").attr("transform","translate("+l.margins().left+","+l.margins().top+")"),l.doRedraw()},l.doRedraw=function(){var b=l.rows(),c=l.cols(),d=b.domain().length,e=c.domain().length,g=Math.floor(l.effectiveWidth()/e),h=Math.floor(l.effectiveHeight()/d);c.rangeRoundBands([0,l.effectiveWidth()]),b.rangeRoundBands([l.effectiveHeight(),0]);var i=f.selectAll("g.box-group").data(l.data(),function(a,b){return l.keyAccessor()(a,b)+"\x00"+l.valueAccessor()(a,b)}),m=i.enter().append("g").attr("class","box-group");m.append("rect").attr("class","heat-box").attr("fill","white").on("click",l.boxOnClick()),m.append("title").text(l.title()),a.transition(i.selectAll("rect"),l.transitionDuration()).attr("x",function(a,b){return c(l.keyAccessor()(a,b))}).attr("y",function(a,c){return b(l.valueAccessor()(a,c))}).attr("rx",j).attr("ry",k).attr("fill",l.getColor).attr("width",g).attr("height",h),i.exit().remove();var n=f.selectAll("g.cols");n.empty()&&(n=f.append("g").attr("class","cols axis")),n.selectAll("text").data(c.domain()).enter().append("text").attr("x",function(a){return c(a)+g/2}).style("text-anchor","middle").attr("y",l.effectiveHeight()).attr("dy",12).on("click",l.xAxisOnClick()).text(function(a){return a});var o=f.selectAll("g.rows");o.empty()&&(o=f.append("g").attr("class","rows axis")),o.selectAll("text").data(b.domain()).enter().append("text").attr("dy",6).style("text-anchor","end").attr("x",0).attr("dx",-2).on("click",l.yAxisOnClick()).text(function(a){return a}),a.transition(o.selectAll("text"),l.transitionDuration()).text(function(a){return a}).attr("y",function(a){return b(a)+h/2}),l.hasFilter()?l.selectAll("g.box-group").each(function(a){l.isSelectedNode(a)?l.highlightSelected(this):l.fadeDeselected(this)}):l.selectAll("g.box-group").each(function(){l.resetHighlight(this)})},l.boxOnClick=function(a){return arguments.length?(o=a,l):o},l.xAxisOnClick=function(a){return arguments.length?(m=a,l):m},l.yAxisOnClick=function(a){return arguments.length?(n=a,l):n},l.xBorderRadius=function(a){return arguments.length&&(j=a),j},l.yBorderRadius=function(a){return arguments.length&&(k=a),k},l.isSelectedNode=function(a){return l.hasFilter(a.key)},l.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(a){var b=a.enter().append("g");b.attr("class","box").attr("transform",o).call(l).on("click",function(a){h.filter(a.key),h.redrawGroup()})}function e(b){a.transition(b,h.transitionDuration()).attr("transform",o).call(l).each(function(){d3.select(this).select("rect.box").attr("fill",h.getColor)})}function f(a){a.exit().remove().call(l)}function g(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 h=a.coordinateGridChart({}),i=1.5,j=g,k=j(i),l=d3.box(),m=null,n=function(a,b){return h.isOrdinal()?h.x().rangeBand():a/(1+h.boxPadding())/b};h.yAxisPadding(12),h.x(d3.scale.ordinal()),h.xUnits(a.units.ordinal),h.data(function(a){return a.all().map(function(a){return a.map=function(b){return b.call(a,a)},a})}),h.boxPadding=h._rangeBandPadding,h.boxPadding(.8),h.outerPadding=h._outerRangeBandPadding,h.outerPadding(.5),h.boxWidth=function(a){return arguments.length?(n=d3.functor(a),h):n};var o=function(a,b){var c=h.x()(h.keyAccessor()(a,b));return"translate("+c+",0)"};return h.plotData=function(){var a=n(h.effectiveWidth(),h.xUnitCount());l.whiskers(k).width(a).height(h.effectiveHeight()).value(h.valueAccessor()).domain(h.y().domain()).duration(h.transitionDuration()).tickFormat(m);var b=h.chartBodyG().selectAll("g.box").data(h.data());d(b),e(b),f(b),h.fadeDeselectedArea()},h.fadeDeselectedArea=function(){h.hasFilter()?h.selectAll("g.box").each(function(a){h.isSelectedNode(a)?h.highlightSelected(this):h.fadeDeselected(this)}):h.selectAll("g.box").each(function(){h.resetHighlight(this)})},h.isSelectedNode=function(a){return h.hasFilter(a.key)},h.yAxisMin=function(){var b=d3.min(h.data(),function(a){return d3.min(h.valueAccessor()(a))});return a.utils.subtract(b,h.yAxisPadding())},h.yAxisMax=function(){var b=d3.max(h.data(),function(a){return d3.max(h.valueAccessor()(a))});return a.utils.add(b,h.yAxisPadding())},h.tickFormat=function(a){return arguments.length?(m=a,h):m
},h.anchor(b,c)},a}(),dc.filters={},dc.filters.RangedFilter=function(a,b){var c=Array(a,b);return c.isFiltered=function(a){return a>=this[0]&&a<this[1]},c},dc.filters.TwoDimensionalFilter=function(a){var b=a;return b.isFiltered=function(a){return a.length&&a.length==b.length&&a[0]==b[0]&&a[1]==b[1]},b};
//# sourceMappingURL=dc.min.js.map