/*! * dc 3.0.6 * http://dc-js.github.io/dc.js/ * Copyright 2012-2016 Nick Zhu & the dc.js Developers * https://github.com/dc-js/dc.js/blob/master/AUTHORS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ !function(){function t(t,e){"use strict";var n={version:"3.0.6",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};n.chartRegistry=function(){function t(t){return t||(t=n.constants.DEFAULT_CHART_GROUP),e[t]||(e[t]=[]),t}var e={};return{has:function(t){for(var n in e)if(e[n].indexOf(t)>=0)return!0;return!1},register:function(n,r){r=t(r),e[r].push(n)},deregister:function(n,r){r=t(r);for(var i=0;i=0||void 0!==e)&&(a=a.duration(e)),(r>=0||void 0!==r)&&(a=a.delay(r)),a},n.optionalTransition=function(t,e,r,i){return t?function(t){return n.transition(t,e,r,i)}:function(t){return t}},n.afterTransition=function(t,e){if(t.empty()||!t.duration)e.call(t);else{var n=0;t.each(function(){++n}).on("end",function(){--n||e.call(t)})}},n.units={},n.units.integers=function(t,e){return Math.abs(e-t)},n.units.ordinal=function(){throw new Error("dc.units.ordinal should not be called - it is a placeholder")},n.units.fp={},n.units.fp.precision=function(t){var e=function(t,r){var i=Math.abs((r-t)/e.resolution);return n.utils.isNegligible(i-Math.floor(i))?Math.floor(i):Math.ceil(i)};return e.resolution=t,e},n.round={},n.round.floor=function(t){return Math.floor(t)},n.round.ceil=function(t){return Math.ceil(t)},n.round.round=function(t){return Math.round(t)},n.override=function(t,e,n){var r=t[e];t["_"+e]=r,t[e]=n},n.renderlet=function(t){return arguments.length?(n._renderlet=t,n):n._renderlet},n.instanceOfChart=function(t){return t instanceof Object&&t.__dcFlag__&&!0},n.errors={},n.errors.Exception=function(t){var e=t||"Unexpected internal error";this.message=e,this.toString=function(){return e},this.stack=(new Error).stack},n.errors.Exception.prototype=Object.create(Error.prototype),n.errors.Exception.prototype.constructor=n.errors.Exception,n.errors.InvalidStateException=function(){n.errors.Exception.apply(this,arguments)},n.errors.InvalidStateException.prototype=Object.create(n.errors.Exception.prototype),n.errors.InvalidStateException.prototype.constructor=n.errors.InvalidStateException,n.errors.BadArgumentException=function(){n.errors.Exception.apply(this,arguments)},n.errors.BadArgumentException.prototype=Object.create(n.errors.Exception.prototype),n.errors.BadArgumentException.prototype.constructor=n.errors.BadArgumentException,n.dateFormat=t.timeFormat("%m/%d/%Y"),n.printers={},n.printers.filters=function(t){for(var e="",r=0;r0&&(e+=", "),e+=n.printers.filter(t[r]);return e},n.printers.filter=function(t){var e="";return void 0!==t&&null!==t&&(t instanceof Array?t.length>=2?e="["+t.map(function(t){return n.utils.printSingleValue(t)}).join(" -> ")+"]":t.length>=1&&(e=n.utils.printSingleValue(t[0])):e=n.utils.printSingleValue(t)),e},n.pluck=function(t,e){return e?function(n,r){return e.call(n,n[t],r)}:function(e){return e[t]}},n.utils={},n.utils.printSingleValue=function(t){var e=""+t;return t instanceof Date?e=n.dateFormat(t):"string"==typeof t?e=t:n.utils.isFloat(t)?e=n.utils.printSingleValue.fformat(t):n.utils.isInteger(t)&&(e=Math.round(t)),e},n.utils.printSingleValue.fformat=t.format(".2f"),n.utils.toTimeFunc=function(t){return"time"+t.charAt(0).toUpperCase()+t.slice(1)},n.utils.add=function(e,r,i){if("string"==typeof r&&(r=r.replace("%","")),e instanceof Date)return"string"==typeof r&&(r=+r),"millis"===i?new Date(e.getTime()+r):("function"!=typeof(i=i||t.timeDay)&&(i=t[n.utils.toTimeFunc(i)]),i.offset(e,r));if("string"==typeof r){var a=+r/100;return e>0?e*(1+a):e*(1-a)}return e+r},n.utils.subtract=function(e,r,i){if("string"==typeof r&&(r=r.replace("%","")),e instanceof Date)return"string"==typeof r&&(r=+r),"millis"===i?new Date(e.getTime()-r):("function"!=typeof(i=i||t.timeDay)&&(i=t[n.utils.toTimeFunc(i)]),i.offset(e,-r));if("string"==typeof r){var a=+r/100;return e<0?e*(1+a):e*(1-a)}return e-r},n.utils.isNumber=function(t){return t===+t},n.utils.isFloat=function(t){return t===+t&&t!==(0|t)},n.utils.isInteger=function(t){return t===+t&&t===(0|t)},n.utils.isNegligible=function(t){return!n.utils.isNumber(t)||t-n.constants.NEGLIGIBLE_NUMBER},n.utils.clamp=function(t,e,n){return tn?n:t},n.utils.constant=function(t){return function(){return t}};var r=0;n.utils.uniqueId=function(){return++r},n.utils.nameToId=function(t){return t.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},n.utils.appendOrSelect=function(t,e,n){n=n||e;var r=t.select(e);return r.empty()&&(r=t.append(n)),r},n.utils.safeNumber=function(t){return n.utils.isNumber(+t)?+t:0},n.utils.arraysEqual=function(t,e){return!t&&!e||!(!t||!e)&&(t.length===e.length&&t.every(function(t,n){return t.valueOf()===e[n].valueOf()}))},n.utils.arraysIdentical=function(t,e){var n=t.length;if(n!==e.length)return!1;for(;n--;)if(t[n]!==e[n])return!1;return!0},n.utils.allChildren=function(t){var e=[];if(e.push(t.path),console.log("currentNode",t),t.children)for(var r=0;r=this[0]&&t=e[0][0]&&n=e[0][1]&&r=e.length))return!1;for(var n=0;nx?e:x},v=m,A=200,b=function(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().height;return e&&e>A?e:A},_=b,k=!1,D=n.pluck("key"),C=n.pluck("value"),w=n.pluck("key"),M=!1,E=function(t){return r.keyAccessor()(t)+": "+r.valueAccessor()(t)},L=!0,R=!1,S=n.pluck("key"),O=750,T=0,F=n.printers.filters,B=["dimension","group"],N=n.constants.DEFAULT_CHART_GROUP,P=t.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),H=[],z=function(t,e){return 0===e.length?t.filter(null):1!==e.length||e[0].isFiltered?1===e.length&&"RangedFilter"===e[0].filterType?t.filterRange(e[0]):t.filterFunction(function(t){for(var n=0;n=t)return!0}return!1}):t.filterExact(e[0]),e},G=function(t){return t.all()};r.height=function(t){return arguments.length?(_=t?"function"==typeof t?t:n.utils.constant(t):b,h=void 0,r):(n.utils.isNumber(h)||(h=_(u.node())),h)},r.width=function(t){return arguments.length?(v=t?"function"==typeof t?t:n.utils.constant(t):m,f=void 0,r):(n.utils.isNumber(f)||(f=v(u.node())),f)},r.minWidth=function(t){return arguments.length?(x=t,r):x},r.minHeight=function(t){return arguments.length?(A=t,r):A},r.useViewBoxResizing=function(t){return arguments.length?(k=t,r):k},r.dimension=function(t){return arguments.length?(o=t,r.expireCache(),r):o},r.data=function(t){return arguments.length?(G="function"==typeof t?t:n.utils.constant(t),r.expireCache(),r):G.call(r,l)},r.group=function(t,e){return arguments.length?(l=t,r._groupName=e,r.expireCache(),r):l},r.ordering=function(t){return arguments.length?(S=t,g=e.quicksort.by(S),r.expireCache(),r):S},r._computeOrderedGroups=function(t,n){var r=t.slice(0),i=g;return r.length<=1?r:(2===arguments.length?i=e.quicksort.by(n):1!==arguments.length||g||(i=e.quicksort.by(ordering)),i(r,0,r.length))},r.filterAll=function(){return r.filter(null)},r.select=function(t){return u.select(t)},r.selectAll=function(t){return u?u.selectAll(t):null},r.anchor=function(e,i){if(!arguments.length)return c;if(n.instanceOfChart(e))c=e.anchor(),u=e.root(),d=!0;else{if(!e)throw new n.errors.BadArgumentException("parent must be defined");c=e.select&&e.classed?e.node():e,(u=t.select(c)).classed(n.constants.CHART_CLASS,!0),n.registerChart(r,i),d=!1}return N=i,r},r.anchorName=function(){var t=r.anchor();return t&&t.id?t.id:t&&t.replace?t.replace("#",""):"dc-chart"+r.chartID()},r.root=function(t){return arguments.length?(u=t,r):u},r.svg=function(t){return arguments.length?(s=t,r):s},r.resetSvg=function(){return r.select("svg").remove(),s=r.root().append("svg"),i(),s},r.filterPrinter=function(t){return arguments.length?(F=t,r):F},r.controlsUseVisibility=function(t){return arguments.length?(R=t,r):R},r.turnOnControls=function(){if(u){var t=r.controlsUseVisibility()?"visibility":"display";r.selectAll(".reset").style(t,null),r.selectAll(".filter").text(F(r.filters())).style(t,null)}return r},r.turnOffControls=function(){if(u){var t=r.controlsUseVisibility()?"visibility":"display",e=r.controlsUseVisibility()?"hidden":"none";r.selectAll(".reset").style(t,e),r.selectAll(".filter").style(t,e).text(r.filter())}return r},r.transitionDuration=function(t){return arguments.length?(O=t,r):O},r.transitionDelay=function(t){return arguments.length?(T=t,r):T},r._mandatoryAttributes=function(t){return arguments.length?(B=t,r):B},r.render=function(){h=f=void 0,P.call("preRender",r,r),B&&B.forEach(a);var t=r._doRender();return p&&p.render(),r._activateRenderlets("postRender"),t},r._activateRenderlets=function(t){P.call("pretransition",r,r),r.transitionDuration()>0&&s?s.transition().duration(r.transitionDuration()).delay(r.transitionDelay()).on("end",function(){P.call("renderlet",r,r),t&&P.call(t,r,r)}):(P.call("renderlet",r,r),t&&P.call(t,r,r))},r.redraw=function(){i(),P.call("preRedraw",r,r);var t=r._doRedraw();return p&&p.render(),r._activateRenderlets("postRedraw"),t},r.commitHandler=function(t){return arguments.length?(y=t,r):y},r.redrawGroup=function(){return y?y(!1,function(t,e){t?console.log(t):n.redrawAll(r.chartGroup())}):n.redrawAll(r.chartGroup()),r},r.renderGroup=function(){return y?y(!1,function(t,e){t?console.log(t):n.renderAll(r.chartGroup())}):n.renderAll(r.chartGroup()),r},r._invokeFilteredListener=function(t){void 0!==t&&P.call("filtered",r,r,t)},r._invokeZoomedListener=function(){P.call("zoomed",r,r)};var I=function(t,e){return null===e||void 0===e?t.length>0:t.some(function(t){return e<=t&&e>=t})};r.hasFilterHandler=function(t){return arguments.length?(I=t,r):I},r.hasFilter=function(t){return I(H,t)};var V=function(t,e){for(var n=0;n=e){t.splice(n,1);break}return t};r.removeFilterHandler=function(t){return arguments.length?(V=t,r):V};var U=function(t,e){return t.push(e),t};r.addFilterHandler=function(t){return arguments.length?(U=t,r):U};var Y=function(t){return[]};return r.resetFilterHandler=function(t){return arguments.length?(Y=t,r):Y},r.replaceFilter=function(t){return H=Y(H),r.filter(t),r},r.filter=function(t){if(!arguments.length)return H.length>0?H[0]:null;var e=H;return t instanceof Array&&t[0]instanceof Array&&!t.isFiltered?t[0].forEach(function(t){e=I(e,t)?V(e,t):U(e,t)}):e=null===t?Y(e):I(e,t)?V(e,t):U(e,t),H=function(t){if(r.dimension()&&r.dimension().filter){var e=z(r.dimension(),t);e&&(t=e)}return t}(e),r._invokeFilteredListener(t),null!==u&&r.hasFilter()?r.turnOnControls():r.turnOffControls(),r},r.filters=function(){return H},r.highlightSelected=function(e){t.select(e).classed(n.constants.SELECTED_CLASS,!0),t.select(e).classed(n.constants.DESELECTED_CLASS,!1)},r.fadeDeselected=function(e){t.select(e).classed(n.constants.SELECTED_CLASS,!1),t.select(e).classed(n.constants.DESELECTED_CLASS,!0)},r.resetHighlight=function(e){t.select(e).classed(n.constants.SELECTED_CLASS,!1),t.select(e).classed(n.constants.DESELECTED_CLASS,!1)},r.onClick=function(t){var e=r.keyAccessor()(t);n.events.trigger(function(){r.filter(e),r.redrawGroup()})},r.filterHandler=function(t){return arguments.length?(z=t,r):z},r._doRender=function(){return r},r._doRedraw=function(){return r},r.legendables=function(){return[]},r.legendHighlight=function(){},r.legendReset=function(){},r.legendToggle=function(){},r.isLegendableHidden=function(){return!1},r.keyAccessor=function(t){return arguments.length?(D=t,r):D},r.valueAccessor=function(t){return arguments.length?(C=t,r):C},r.label=function(t,e){return arguments.length?(w=t,(void 0===e||e)&&(M=!0),r):w},r.renderLabel=function(t){return arguments.length?(M=t,r):M},r.title=function(t){return arguments.length?(E=t,r):E},r.renderTitle=function(t){return arguments.length?(L=t,r):L},r.renderlet=n.logger.deprecate(function(t){return r.on("renderlet."+n.utils.uniqueId(),t),r},'chart.renderlet has been deprecated. Please use chart.on("renderlet.", renderletFunction)'),r.chartGroup=function(t){return arguments.length?(d||n.deregisterChart(r,N),N=t,d||n.registerChart(r,N),r):N},r.expireCache=function(){return r},r.legend=function(t){return arguments.length?((p=t).parent(r),r):p},r.chartID=function(){return r.__dcFlag__},r.options=function(t){var e=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(var i in t)"function"==typeof r[i]?t[i]instanceof Array&&-1!==e.indexOf(i)?r[i].apply(r,t[i]):r[i].call(r,t[i]):n.logger.debug("Not a valid option setter name: "+i);return r},r.on=function(t,e){return P.on(t,e),r},r},n.marginMixin=function(t){var e={top:10,right:50,bottom:30,left:30};return t.margins=function(n){return arguments.length?(e=n,t):e},t.effectiveWidth=function(){return t.width()-t.margins().left-t.margins().right},t.effectiveHeight=function(){return t.height()-t.margins().top-t.margins().bottom},t.hasMargins=function(){return 0!==e.top||0!==e.bottom||0!==e.left||0!==e.right},t},n.colorMixin=function(e){var r=t.scaleOrdinal(n.config.defaultColors()),i=!0,a=function(t){return e.keyAccessor()(t)};return e.colors=function(i){return arguments.length?(r=i instanceof Array?t.scaleQuantize().range(i):"function"==typeof i?i:n.utils.constant(i),e):r},e.ordinalColors=function(n){return e.colors(t.scaleOrdinal().range(n))},e.linearColors=function(n){return e.colors(t.scaleLinear().range(n).interpolate(t.interpolateHcl))},e.colorAccessor=function(t){return arguments.length?(a=t,i=!1,e):a},e.defaultColorAccessor=function(){return i},e.colorDomain=function(t){return arguments.length?(r.domain(t),e):r.domain()},e.calculateColorDomain=function(){var n=[t.min(e.data(),e.colorAccessor()),t.max(e.data(),e.colorAccessor())];return r.domain(n),e},e.getColor=function(t,e){return r(a.call(this,t,e))},e.colorCalculator=n.logger.deprecate(function(t){return arguments.length?(e.getColor=t,e):e.getColor},"colorMixin.colorCalculator has been deprecated. Please colorMixin.colors and colorMixin.colorAccessor instead"),e},n.coordinateGridMixin=function(e){function r(r,i){e.isOrdinal()?(x.bandwidth||(n.logger.warn("For compatibility with d3v4+, dc.js d3.0 ordinal bar/line/bubble charts need d3.scaleBand() for the x scale, instead of d3.scaleOrdinal(). Replacing .x() with a d3.scaleBand with the same domain - make the same change in your code to avoid this warning!"),x=t.scaleBand().domain(x.domain())),(e.elasticX()||0===x.domain().length)&&x.domain(e._ordinalXDomain())):e.elasticX()&&x.domain([e.xAxisMin(),e.xAxisMax()]);var a=x.domain();!i&&n.utils.arraysEqual(b,a)||e.rescale(),b=a,e.isOrdinal()?x.range([0,e.xAxisLength()]).paddingInner($).paddingOuter(e._useOuterPadding()?Q:0):x.range([0,e.xAxisLength()]),L=L.scale(e.x()),function(t){var r=t.select("g."+f);if(U){r.empty()&&(r=t.insert("g",":first-child").attr("class",d+" "+f).attr("transform","translate("+e.margins().left+","+e.margins().top+")"));var i=L.tickValues()?L.tickValues():"function"==typeof x.ticks?x.ticks.apply(x,L.tickArguments()):x.domain(),a=r.selectAll("line").data(i),o=a.enter().append("line").attr("x1",function(t){return x(t)}).attr("y1",e._xAxisY()-e.margins().top).attr("x2",function(t){return x(t)}).attr("y2",0).attr("opacity",0);n.transition(o,e.transitionDuration(),e.transitionDelay()).attr("opacity",1);var l=o.merge(a);n.transition(l,e.transitionDuration(),e.transitionDelay()).attr("x1",function(t){return x(t)}).attr("y1",e._xAxisY()-e.margins().top).attr("x2",function(t){return x(t)}).attr("y2",0),a.exit().remove()}else r.selectAll("line").remove()}(r)}function i(){return tt?t.axisRight():t.axisLeft()}function a(){return e.anchorName().replace(/[ .#=\[\]"]/g,"-")+"-clip"}function o(){var t=n.utils.appendOrSelect(g,"defs"),r=a(),i=n.utils.appendOrSelect(t,"#"+r,"clipPath").attr("id",r),o=2*J;n.utils.appendOrSelect(i,"rect").attr("width",e.xAxisLength()+o).attr("height",e.yAxisHeight()+o).attr("transform","translate(-"+J+", -"+J+")")}function l(t){e.isOrdinal()&&(G=!1),r(e.g(),t),e._prepareYAxis(e.g()),e.plotData(),(e.elasticX()||Y||t)&&e.renderXAxis(e.g()),(e.elasticY()||Y||t)&&e.renderYAxis(e.g()),t?e.renderBrush(e.g(),!1):e.redrawBrush(e.filter(),Y),e.fadeDeselectedArea(e.filter()),Y=!1}function c(t,r){var i;!function(t){return t instanceof Array&&t.length>1}(t)?(e.x().domain(v),i=null):(e.x().domain(t),i=n.filters.RangedFilter(t[0],t[1])),e.replaceFilter(i),e.rescale(),e.redraw(),r||(M&&!n.utils.arraysEqual(e.filter(),M.filter())&&n.events.trigger(function(){M.replaceFilter(i),M.redraw()}),e._invokeZoomedListener(),n.events.trigger(function(){e.redrawGroup()},n.constants.EVENT_DELAY))}function u(){X&&X.transform(e.root(),function(e,n,r){var i=(n[1]-n[0])/(e[1]-e[0]),a=-1*r(e[0]);return t.zoomIdentity.scale(i).translate(a,0)}(e.x().domain(),v,m))}function s(t,e){return t&&2===t.length&&e&&2===e.length?((t[0]>e[1]||t[1]e[0]?t[0]:e[0],t[1]=t[0]&&e.x<=t[t.length-1]}}()),t.values=e.evadeDomainFilter()?a:t.domainValues}function i(t){var e=c.map(n.pluck("name")).indexOf(t);return c[e]}function a(){var t=e.data().map(function(t){return t.domainValues});return Array.prototype.concat.apply([],t)}function o(t){return!t.hidden}var l=t.stack(),c=[],u={},s=!1,d=!1;return e.stack=function(t,n,r){if(!arguments.length)return c;arguments.length<=2&&(r=n);var i={group:t};return"string"==typeof n&&(i.name=n),"function"==typeof r&&(i.accessor=r),c.push(i),e},n.override(e,"group",function(t,n,r){return arguments.length?(c=[],u={},e.stack(t,n),r&&e.valueAccessor(r),e._group(t,n)):e._group()}),e.hidableStacks=function(t){return arguments.length?(s=t,e):s},e.hideStack=function(t){var n=i(t);return n&&(n.hidden=!0),e},e.showStack=function(t){var n=i(t);return n&&(n.hidden=!1),e},e.getValueAccessorByIndex=function(t){return c[t].accessor||e.valueAccessor()},e.yAxisMin=function(){var r=t.min(a(),function(t){return t.y<0?t.y+t.y0:t.y0});return n.utils.subtract(r,e.yAxisPadding())},e.yAxisMax=function(){var r=t.max(a(),function(t){return t.y>0?t.y+t.y0:t.y0});return n.utils.add(r,e.yAxisPadding())},e.xAxisMin=function(){var r=t.min(a(),n.pluck("x"));return n.utils.subtract(r,e.xAxisPadding(),e.xAxisPaddingUnit())},e.xAxisMax=function(){var r=t.max(a(),n.pluck("x"));return n.utils.add(r,e.xAxisPadding(),e.xAxisPaddingUnit())},n.override(e,"title",function(t,n){return t?"function"==typeof t?e._title(t):t===e._groupName&&"function"==typeof n?e._title(n):"function"!=typeof n?u[t]||e._title():(u[t]=n,e):e._title()}),e.stackLayout=function(t){return arguments.length?(l=t,e):l},e.evadeDomainFilter=function(t){return arguments.length?(d=t,e):d},e.data(function(){var t=c.filter(o);if(!t.length)return[];t.forEach(r);var n=t[0].values.map(function(e,n){var r={x:e.x};return t.forEach(function(t){r[t.name]=t.values[n].y}),r}),i=t.map(function(t){return t.name});return e.stackLayout().keys(i)(n).forEach(function(e,n){e.forEach(function(e,r){t[n].values[r].y0=e[0],t[n].values[r].y1=e[1]})}),t}),e._ordinalXDomain=function(){var t=a().map(n.pluck("data"));return e._computeOrderedGroups(t).map(e.keyAccessor())},e.colorAccessor(function(t){return this.layer||this.name||t.name||t.layer}),e.legendables=function(){return c.map(function(t,n){return{chart:e,name:t.name,hidden:t.hidden||!1,color:e.getColor.call(t,t.values,n)}})},e.isLegendableHidden=function(t){var e=i(t.name);return!!e&&e.hidden},e.legendToggle=function(t){s&&(e.isLegendableHidden(t)?e.showStack(t.name):e.hideStack(t.name),e.renderGroup())},e},n.capMixin=function(e){var r=1/0,i=!0,a="Others";e.ordering(function(t){return-t.value});var o=function(t){return-t.value},l=function(n,r){var i=t.sum(r,e.valueAccessor()),a=r.map(e.keyAccessor());return i>0?n.concat([{others:a,key:e.othersLabel(),value:i}]):n};return e.cappedKeyAccessor=function(t,n){return t.hasOwnProperty("others")?t.key:e.keyAccessor()(t,n)},e.cappedValueAccessor=function(t,n){return t.hasOwnProperty("others")?t.value:e.valueAccessor()(t,n)},e.data(function(t){if(r===1/0)return e._computeOrderedGroups(t.all());var n,a=t.all();if(a=e._computeOrderedGroups(a,o),r)if(i)n=a.slice(r),a=a.slice(0,r);else{var c=Math.max(0,a.length-r);n=a.slice(0,c),a=a.slice(c)}return l?l(a,n):a}),e.cap=function(t){return arguments.length?(r=t,e):r},e.takeFront=function(t){return arguments.length?(i=t,e):i},e.othersLabel=function(t){return arguments.length?(a=t,e):a},e.othersGrouper=function(t){return arguments.length?(l=t,e):l},n.override(e,"onClick",function(t){t.others&&e.filter([t.others]),e._onClick(t)}),e},n.bubbleMixin=function(e){var r=.3,i=10,a=!1,o=!1;e.BUBBLE_NODE_CLASS="node",e.BUBBLE_CLASS="bubble",e.MIN_RADIUS=10,(e=n.colorMixin(e)).renderLabel(!0),e.data(function(n){var r=n.all();if(a){var i=e.radiusValueAccessor();r.sort(function(e,n){return t.descending(i(e),i(n))})}return r});var l=t.scaleLinear().domain([0,100]),c=function(t){return t.r};e.r=function(t){return arguments.length?(l=t,e):l},e.elasticRadius=function(t){return arguments.length?(o=t,e):o},e.calculateRadiusDomain=function(){o&&e.r().domain([e.rMin(),e.rMax()])},e.radiusValueAccessor=function(t){return arguments.length?(c=t,e):c},e.rMin=function(){return t.min(e.data(),function(t){return e.radiusValueAccessor()(t)})},e.rMax=function(){return t.max(e.data(),function(t){return e.radiusValueAccessor()(t)})},e.bubbleR=function(t){var n=e.radiusValueAccessor()(t),r=e.r()(n);return(isNaN(r)||n<=0)&&(r=0),r};var u=function(t){return e.label()(t)},s=function(t){return e.bubbleR(t)>i},d=function(t){return s(t)?1:0},f=function(t){return s(t)?"all":"none"};e._doRenderLabel=function(t){if(e.renderLabel()){var r=t.select("text");r.empty()&&(r=t.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",e.onClick)),r.attr("opacity",0).attr("pointer-events",f).text(u),n.transition(r,e.transitionDuration(),e.transitionDelay()).attr("opacity",d)}},e.doUpdateLabels=function(t){if(e.renderLabel()){var r=t.select("text").attr("pointer-events",f).text(u);n.transition(r,e.transitionDuration(),e.transitionDelay()).attr("opacity",d)}};var h=function(t){return e.title()(t)};return e._doRenderTitles=function(t){if(e.renderTitle()){t.select("title").empty()&&t.append("title").text(h)}},e.doUpdateTitles=function(t){e.renderTitle()&&t.select("title").text(h)},e.sortBubbleSize=function(t){return arguments.length?(a=t,e):a},e.minRadius=function(t){return arguments.length?(e.MIN_RADIUS=t,e):e.MIN_RADIUS},e.minRadiusWithLabel=function(t){return arguments.length?(i=t,e):i},e.maxBubbleRelativeSize=function(t){return arguments.length?(r=t,e):r},e.fadeDeselectedArea=function(t){e.hasFilter()?e.selectAll("g."+e.BUBBLE_NODE_CLASS).each(function(t){e.isSelectedNode(t)?e.highlightSelected(this):e.fadeDeselected(this)}):e.selectAll("g."+e.BUBBLE_NODE_CLASS).each(function(){e.resetHighlight(this)})},e.isSelectedNode=function(t){return e.hasFilter(t.key)},e.onClick=function(t){var r=t.key;n.events.trigger(function(){e.filter(r),e.redrawGroup()})},e},n.pieChart=function(e,r){function i(){return t.pie().sort(null).value(a.cappedValueAccessor)}var a={tweenType:"pie"};return["base","color","cap","legendable","text","pieType"].forEach(function(t){a=n[t+"Mixin"](a)}),a.slicesCap=a.cap,a.filteredData=function(){return a.data()},a.prepareData=function(t,e){return e?i()([{key:a.emptyTitle(),value:1,others:[a.emptyTitle()]}]):i()(t)},a.__clickHandler=function(t,e){a.onClick(t.data,e)},a.isSelectedElement=function(t){return a.hasFilter(a.cappedKeyAccessor(t.data))},a.anchor(e,r)},n.legendableMixin=function(e){function n(n,r,i){e.selectAll("g."+e.elementCssClass).each(function(e){n.name===e.data.key&&t.select(this).classed("highlight",i)}),t.select(r).classed("highlight",i)}return e.legendablesData=function(){return e.data()},e.legendables=function(){return e.legendablesData().map(function(t,n){var r={name:t.key,data:t.value,others:t.others,chart:e};return r.color=e.getColor(t,n),r}).sort(function(e,n){return t.ascending(e.name,n.name)})},e.legendHighlight=function(t,e){n(t,e,!0)},e.legendReset=function(t,e){n(t,e,!1)},e.legendToggle=function(t,n){e.onClick({key:t.name,others:t.others})},e},n.highlighterMixin=function(t){var e=[];return t._highlightableClasses=function(n){return arguments.length?(e=n,t):e},t._highlightElement=function(n,r){e.forEach(function(e){t.select(e+"._"+n).classed("highlight",r)})},t._highlightFilter=function(){t.hasFilter()?e.forEach(function(e){t.selectAll(e).each(function(e){t.isSelectedElement(e)?t.highlightSelected(this):t.fadeDeselected(this)})}):e.forEach(function(e){t.selectAll(e).each(function(){t.resetHighlight(this)})})},t},n.pieTypeMixin=function(e){function r(){var n=0;!function(){var n=t.min([e.width(),e.height()])/2;d=f&&f=0&&(n="M0,0"),n}function s(t){y=e.collapse(y.id===t.id?e.nodes[0]:t)}var d,f,h,g,p,y,x="pie-slice",m="pie-label",v="pie-path",A="pie-slice-group",b="pie-label-group",_="pie-path-group",k=0,D=0,C=.5,w=0,M=!1,E=!1;(e=n.emptyChartMixin(e)).colorAccessor(e.cappedKeyAccessor),(e=n.highlighterMixin(e)._highlightableClasses(["g."+x])).elementCssClass=x,e.renderLabel(!0),e.transitionDuration(350),e.transitionDelay(0),e._doRender=function(){return E||("slice"===e.tweenType?(T=S,F=O,B=P,j=X,q=K,L,R,G=I,V=U,e.onClick=z):B=N,e.text.setChartTextFunctions(),E=!0),e.resetSvg(),(h=e.svg().append("g").attr("transform","translate("+e.cx()+","+e.cy()+")")).append("g").attr("class",A),h.append("g").attr("class",b),h.append("g").attr("class",_),e._doRedraw()},e._doRedraw=function(){return r(),e};var L=function(t){return R(t)?e.label()(t):""},R=function(t){if(!e.isSelectedElement(t)){if(l(t))return!1;if(o(t))return!(0!==t.height||!w)}},S=function(t){return t.x0},O=function(t){return t.x1},T=function(t){return t.startAngle},F=function(t){return t.endAngle},B=function(t){},N=function(e){e.innerRadius=k;var n=this._current;n=function(t){return!t||isNaN(T(t))||isNaN(F(t))}(n)?{startAngle:0,endAngle:0}:{startAngle:n.startAngle,endAngle:n.endAngle};var r=t.interpolate(n,e);return this._current=r(0),function(t){return u(j(),r(t))}},P=function(e){var n=this._current;(function(t){return!t||isNaN(t.x0)||isNaN(t.y0)})(n)&&(n={x0:0,x1:0,y0:0,y1:0});var r={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},i=t.interpolate(n,r);return this._current=i(0),function(t){return u(j(),Object.assign({},e,i(t)))}},H=function(e,n){var r=n._current||{startAngle:0,endAngle:0,radius:0},i=t.interpolate(r,e);return n._current=i(0),function(t){return W(i(t))}},z=function(t,n){h.attr("class")!==e.emptyCssClass()&&e.__clickHandler(t,n)},G=function(e,n){var r;return r=w?t.arc().innerRadius(d-D+w).outerRadius(d-D+w).centroid(e):n.centroid(e),isNaN(r[0])||isNaN(r[1])?"translate(0,0)":"translate("+r+")"},I=function(e,n){var r;return r=w&&0===e.height?t.arc().innerRadius(d-D+w).outerRadius(d-D+w).centroid(e.hasOwnProperty("x0")?{startAngle:e.x1,endAngle:e.x0}:e):n.centroid(e),isNaN(r[0])||isNaN(r[1])?"translate(0,0)":"translate("+r+")"},V=function(t){return{radius:w?d-D+w:Math.max(0,(k+d)/2),startAngle:t.startAngle,endAngle:t.endAngle}},U=function(t){return{radius:Math.max(0,(e._d3.scale.y(t.y0)+e._d3.scale.y(t.y1))/2),startAngle:e._d3.scale.x(t.x0),endAngle:e._d3.scale.x(t.x1)}},Y=function(t){return W(V(t))},W=function(e){var n=[e.startAngle,e.endAngle],r=(e.startAngle+e.endAngle)/2,i=-8,a=r>.5*Math.PI&&r<1.5*Math.PI;a&&(n.reverse(),i=8),e.radius+i<0&&(i=0);var o=t.path();return o.arc(0,0,e.radius+i,n[0]-.5*Math.PI,n[1]-.5*Math.PI,a),o.toString()},j=function(){return t.arc().innerRadius(k).outerRadius(d-D)},X=function(){return t.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x1)))}).innerRadius(function(t){return Math.max(0,e._d3.scale.y(t.y0))}).outerRadius(function(t){return Math.max(0,e._d3.scale.y(t.y1))})},q=function(){return t.arc().innerRadius(d-D).outerRadius(d-D+w)},K=function(){return t.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x1)))}).innerRadius(d-D).outerRadius(d-D+w)};return e.collapse=function(n){var r=t.interpolate(e._d3.scale.x.domain(),[n.x0,n.x1]),i=t.interpolate(e._d3.scale.y.domain(),[n.y0,1]),a=t.interpolate(e._d3.scale.y.range(),[n.y0?20:e.innerRadius(),e.radius()-e.externalRadiusPadding()]),o=e.svg().transition().tween("scale",function(){return function(t){e._d3.scale.x.domain(r(t)),e._d3.scale.y.domain(i(t)).range(a(t))}});return o.selectAll("."+A+" path").attrTween("d",function(t){return function(e){return j()(t)}}),o.selectAll(".label-path").attrTween("d",function(t){return H(V(t),this)}),n},e.externalRadiusPadding=function(t){return arguments.length?(D=t,e):D},e.innerRadius=function(t){return arguments.length?(k=t,e):k},e.radius=function(t){return arguments.length?(f=t,e):f||d},e.cx=function(t){return arguments.length?(g=t,e):g||e.width()/2},e.cy=function(t){return arguments.length?(p=t,e):p||e.height()/2},e.minAngleForLabel=function(t){return arguments.length?(C=t,e):C},e.externalLabels=function(t){return 0===arguments.length?w:(w=t||void 0,e)},e.drawPaths=function(t){return 0===arguments.length?M:(M=t,e)},e};var i={path:{direct:function(){return[]},l_shape:function(t,e,n,r){return[{x:n,y:e}]},l_shape_alt:function(t,e,n,r){return[{x:t,y:r}]},dogleg:function(t,e,n,r){return[{x:t,y:(e+r)/2},{x:(t+n)/2,y:(e+r)/2},{x:n,y:(e+r)/2}]},dogleg_alt:function(t,e,n,r){return[{x:(t+n)/2,y:e},{x:(t+n)/2,y:(e+r)/2},{x:(t+n)/2,y:r}]}},cartesian:{},radial:{}};return Object.keys(i.path).forEach(function(e){i.cartesian[e]=function(){return t.mklink(function(t,n,r,a,o){var l=i.path[e](n,r,a,o);t.moveTo(n,r),l.forEach(function(e){t.lineTo(e.x,e.y)}),t.lineTo(a,o)})},i.radial[e]=function(){return t.mklink(function(n,r,a,o,l){var c=r===o?[]:i.path[e](r,a,o,l),u=t.pointRadial(r,a),s={x:r,y:a};n.moveTo(u[0],u[1]),c.push({x:o,y:l}),c.forEach(function(e,r){var i=t.pointRadial(e.x,e.y);e.x===s.x?n.lineTo(i[0],i[1]):n.arc(0,0,e.y,s.x-.5*Math.PI,e.x-.5*Math.PI,e.x>s.x?0:1),s={x:e.x,y:e.y}})})}}),n.diagonalMixin=function(e){var n="curved";return e.diagonalTypes=function(){return["curved"].concat(Object.keys(i.path))},e.diagonal=function(t){return 0===arguments.length?e._setDiagonal(n):(n=t,e._setDiagonal(n),e)},e._setDiagonal=function(r){0===arguments.length&&(r=n);var a="cartesian";if(e.hasOwnProperty("_d3")||(e._d3={}),"curved"!==r){e.radialLayout()&&(a="radial");try{return e.horizontalOrientation()?e._d3.diagonal=i[a][r]().x(function(t){return t.y}).y(function(t){return t.x}):e._d3.diagonal=i[a][r]().x(function(t){return t.x}).y(function(t){return t.y}),e._d3.diagonal}catch(t){throw t}}return e.radialLayout()?e._d3.diagonal=t.linkRadial().angle(function(t){return t.x}).radius(function(t){return t.y}):e.horizontalOrientation()?e._d3.diagonal=t.linkHorizontal().x(function(t){return t.y}).y(function(t){return t.x}):e._d3.diagonal=t.linkVertical().x(function(t){return t.x}).y(function(t){return t.y}),e._d3.diagonal},e},n.clusterLayoutMixin=function(e){e.layout={};var n={};["nodeSize","separation","round"].forEach(function(t){e.layout[t]=function(r){return arguments.length?(n[t]=r,e):n.hasOwnProperty(t)?n[t]:e._layout()[t]()}});var r="cluster",i=64,a="symbolCircle",o=["Circle","Cross","Diamond","Square","Star","Triangle","Wye"].map(function(t){return"symbol"+t});return e.layoutType=function(t){return 0===arguments.length?r:"cluster"!==t&&"tree"!==t?(console.log('Could not set layoutType; permitted values are "cluster" and "tree"'),e):(r=t,e)},e.nodeMarkerSize=function(t){return 0===arguments.length?i:(i=t,e)},e.nodeMarkerSymbol=function(t){if(0===arguments.length)return a;if(!o.includes(t))throw"Illegal symbol type: "+t;return a=t,e},e._layout=function(){var i=t[r]();for(var a in n)i[a](n[a]);return n.size||n.nodeSize||(e.radialLayout()?i.size([2*Math.PI,Math.min(e.effectiveHeight(),e.effectiveWidth())/2]):i.size([e.effectiveHeight(),e.effectiveWidth()])),i},e},n.clusterChart=function(e,r){function i(t,e){f.attr("class")!==d.emptyCssClass()&&d.__clickHandler(t,e)}function a(){var e=d.filteredData(),n=0===e.length,r=d.prepareData(e,n);r.x0=r.x,r.y0=r.y;var a=0;if(d.source=r,f){f.classed(d.emptyCssClass(),n),f.attr("transform",p);var _=f.select("g."+v).selectAll("path."+y).data(r.descendants().slice(1),function(t){return t.id||(t.id=++a)}),k=f.select("g."+A).selectAll("g."+x).data(r.descendants(),function(t){return t.id||(t.id=++a)});if(d.radialLayout()){var D={};r.descendants().forEach(function(t){D.hasOwnProperty(t.y)?D[t.y]++:D[t.y]=1});!function(t,e){t.exit().transition(e).attr("r",1e-6);t.enter().append("circle").attr("r",1e-6).attr("class","circClass").merge(t).transition(e).attr("r",function(t){return t})}(f.select("g."+b).selectAll("circle.circClass").data(Object.keys(D)),C)}var C=t.transition().duration(d.transitionDuration()).delay(d.transitionDelay());!function(e,n){var r=t.symbol().size(1e-6).type(t[d.nodeMarkerSymbol()]),a=e.exit().transition(n);a.attr("transform",function(t){return h(d.source)}).remove(),a.select("path").attr("d",r()),a.select("text").style("opacity",0);var f=e.enter().append("g").attr("class",u).attr("transform",function(t){return h({x:d.source.x0,y:d.source.y0})}).on("mouseover",o).on("mouseout",l),p=f.append("path").attr("d",r()).attr("class","node-"+d.nodeMarkerSymbol()).on("click",d.collapsible()?c:i);d.renderTitle()&&d.text.addTitleElements(p);d.renderLabel()&&f.append("text").attr("class",m).text(function(t){return d.label()(t)}).style("opacity",0).attr("dy",function(t){return t.height?"-.35em":".35em"}).style("text-anchor",function(t){return d.radialLayout()?t.x0})},e.prepareData=function(t,n){var r,i;return n?i=e.layoutData([],e._layout()):(r=e.stratify(t),i=e.layoutData(r,e._layout())),i},e.layoutData=function(n,r){var i=e.valueAccessor();return e.hasOwnProperty("cap")&&e.cap()!==1/0&&(i=e.cappedValueAccessor),r(n.sum(function(t){return i(t)||0}).sort(function(n,r){return t.ascending(e.ordering()(n),e.ordering()(r))}))},e.createMissingAncestors=function(t,e){for(var n=[],r=t.map(function(t){return{data:t,ix:e(t).join("\0")}}).sort(function(t,e){return t.ix===e.ix?0:t.ix>e.ix}).map(function(t){return t.data}),i=[],a=0;a=0;c--)r=o[c],n.utils.arraysIdentical(r,i)&&(l=!0),t.filter(o[c]);if(!l)return a},t},n.hierarchyClickHandlerMixin=function(t){return t.__clickHandler=function(e){var r=t.filterOnDatum(e);n.events.trigger(function(){void 0!==r&&t.filter(r),t.redrawGroup()})},t},n.textMixin=function(t){var e,r={uncapped:{acc:t.keyAccessor(),data_acc:function(e){return t.keyAccessor()(e.data)}},capped:{acc:t.cappedKeyAccessor,data_acc:function(e){return t.cappedKeyAccessor(e.data)}},label:function(t){return l(e(t))},title:function(t){return l(e(t))+": "+o(t)},title_this:function(t){return l(e(t),this)+": "+o(t)},label_this:function(t){return l(e(t),this)},display:function(t){return t},displaySep:function(t,e){return"string"==typeof t?t:t.length>1?e&&e.separator?t.join(e.separator):t.slice(-1)[0]:0===t.length?e&&e.rootName?e.rootName:"":t[0]}},i="uncapped",a={},o=t.valueAccessor(),l=r.display,c={};return t.text={},t.text.addTitleElements=function(e){e.append("title").text(function(e){return t.title()(e)})},t.text.bboxFit=function(t,e){var n=t.getBBox();return n.width>=e.x1-e.x0||n.height>=e.y1-e.y0},t.text.bboxFitCircle=function(t,e){var n=t.getBBox();return n.width+2>=2*e.r||n.height+2>=2*e.r},t.renderLabel(!0),t.text.setChartTextFunctions=function(){t.hasOwnProperty("cap")&&t.cap()!==1/0&&(i="capped",o=t.cappedValueAccessor),e=r[i].data_acc,t.text.hasOwnProperty("rootName")&&(l=r.displaySep,a={rootName:t.text.rootName(),separator:t.text.keySeparator()}),r.bound={title:r.title_this.bind(a),label:r.label_this.bind(a)},c.title||t._title(r.bound.title),c.label||t._label(r.bound.label)},n.override(t,"title",function(e){return arguments.length?(c.title=!0,t._title(e)):t._title()}),n.override(t,"label",function(e){return arguments.length?(c.label=!0,t._label(e)):t._label()}),t},n.hierarchyTextMixin=function(t){t=n.textMixin(t);var e={rootName:"root",keySeparator:null};return["rootName","keySeparator"].forEach(function(n){t.text[n]=function(r){return arguments.length?(e[n]=r,t):e.hasOwnProperty(n)?e[n]:""}}),t},n.hierarchyAccessorHandlerMixin=function(t){var e=n.pluck("key"),r=n.pluck("value");return t.keyAccessor=function(n){return arguments.length?(e=n,t.keyAccessorCustom=!0,t):e},t.valueAccessor=function(e){return arguments.length?(r=e,t.valueAccessorCustom=!0,t):r},n.override(t,"cappedValueAccessor",function(e){try{var n=t._cappedValueAccessor(e);if(n)return n;throw"No value returned"}catch(t){return e.data&&e.data.key&&e.value?e.value:0}}),n.override(t,"cappedKeyAccessor",function(e){var n=t._cappedKeyAccessor(e);return"string"==typeof n?[n]:n}),t},n.orientationMixin=function(t){var e=!1;return t.horizontalOrientation=function(n){return arguments.length?(e=n,t):e},t},n.radialLayoutMixin=function(t){var e=!1;return t.radialLayout=function(n){return arguments.length?(e=n,t):e},t},n.emptyChartMixin=function(t){var e="empty-chart",n="empty";return t.emptyTitle=function(e){return 0===arguments.length?n:(n=e,t)},t.emptyCssClass=function(n){return 0===arguments.length?e:(e=n,t)},t},n.collapsibleMixin=function(t){var e=!1;return t.collapsible=function(n){return arguments.length?(e=n,t):e},t},n.packLayoutMixin=function(e){e.layout={};var n={};return["radius","padding","size"].forEach(function(t){e.layout[t]=function(r){return arguments.length?(n[t]=r,e):n.hasOwnProperty(t)?n[t]:e._layout()[t]()}}),e._layout=function(){var r=t.pack();for(var i in n)r[i](n[i]);return n.size||r.size([e.effectiveWidth(),e.effectiveHeight()]),r},e},n.packChart=function(e,r){function i(t,e){c.attr("class")!==g.emptyCssClass()&&g.__clickHandler(t,e)}function a(t,e){return u+" _"+e+" "+u+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal")}function o(t,e){return g.getColor(t.data,e)}function l(){var e=g.filteredData(),n=0===e.length,r=g.prepareData(e,n),l=0;if(r[0],c){c.classed(g.emptyCssClass(),n),c.attr("transform","translate("+g.margins().left+","+g.margins().top+")");!function(t,e){var n=t.exit().transition(e);n.remove(),n.select("text").attr("opacity",0);var r=t.enter().append("g").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("class",a).each(function(t){t.node=this}).on("mouseover",function(t,e){g._highlightElement(e,!0)}).on("mouseout",function(t,e){g._highlightElement(e,!1)}).on("click",i);r.append("circle").attr("id",function(t){return"circ-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")}).attr("r",0).style("fill","transparent"),g.renderTitle()&&g.text.addTitleElements(r);r.append("clipPath").attr("id",function(t){return"clip-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")}).append("use").attr("xlink:href",function(t){return"#circ-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")}),r.append("text").attr("clip-path",function(t){return"url(#clip-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")+")"}).attr("opacity",0).attr("text-anchor","middle").attr("dy",".35em").text(function(t){return g.label()(t)}).attr("class",s);var l=t.merge(r).transition(e);l.attr("transform",function(t){return"translate("+t.x+","+t.y+")"}),l.select("circle").attr("r",function(t){return isNaN(t.r)?0:t.r}).style("fill",o),l.select("text").attr("opacity",function(t){return 0!==g.valueAccessor()(t)?1:0}).attr("class",function(t){return isNaN(t.r)||t.height>0||t.r=i})}},f.centerBar=function(t){return arguments.length?(g=t,f):g},n.override(f,"onClick",function(t){f._onClick(t.data)}),f.barPadding=function(t){return arguments.length?(f._rangeBandPadding(t),h=void 0,f):f._rangeBandPadding()},f._useOuterPadding=function(){return void 0===h},f.outerPadding=f._outerRangeBandPadding,f.gap=function(t){return arguments.length?(h=t,f):h},f.extendBrush=function(t){return t&&f.round()&&(!g||p)&&(t[0]=f.round()(t[0]),t[1]=f.round()(t[1])),t},f.alwaysUseRounding=function(t){return arguments.length?(p=t,f):p},f.legendHighlight=function(t){f.isLegendableHidden(t)||f.g().selectAll("rect.bar").classed("highlight",c(t.color)).classed("fadeout",c(t.color,!0))},f.legendReset=function(){f.g().selectAll("rect.bar").classed("highlight",!1).classed("fadeout",!1)},n.override(f,"xAxisMax",function(){var t=this._xAxisMax();if("resolution"in f.xUnits()){t+=f.xUnits().resolution}return t}),f.anchor(e,r)},n.lineChart=function(e,r){function i(t,e){return m.getColor.call(t,t.values,e)}function a(){var e=null;if(D)return D;if("function"==typeof C)e=C;else{e={linear:t.curveLinear,"linear-closed":t.curveLinearClosed,step:t.curveStep,"step-before":t.curveStepBefore,"step-after":t.curveStepAfter,basis:t.curveBasis,"basis-open":t.curveBasisOpen,"basis-closed":t.curveBasisClosed,bundle:t.curveBundle,cardinal:t.curveCardinal,"cardinal-open":t.curveCardinalOpen,"cardinal-closed":t.curveCardinalClosed,monotone:t.curveMonotoneX}[C]}return e||(e=t.curveLinear),null!==w&&("function"!=typeof e.tension?n.logger.warn("tension was specified but the curve/interpolate does not support it."):e=e.tension(w)),e}function o(t){return!t||t.indexOf("NaN")>=0?"M0,0":t}function l(e,r){if("always"===m.xyTipsOn()||!m.brushOn()&&!m.parentBrushOn()&&m.xyTipsOn()){var i=h+"-list",a=e.select("g."+i);a.empty()&&(a=e.append("g").attr("class",i)),r.each(function(e,r){var i=e.values;d&&(i=i.filter(d));var o=a.select("g."+h+"._"+r);o.empty()&&(o=a.append("g").attr("class",h+" _"+r)),function(t){(t.select("path."+p).empty()?t.append("path").attr("class",p):t.select("path."+p)).style("display","none").attr("stroke-dasharray","5,5");(t.select("path."+y).empty()?t.append("path").attr("class",y):t.select("path."+y)).style("display","none").attr("stroke-dasharray","5,5")}(o);var l=o.selectAll("circle."+g).data(i,n.pluck("x")),s=l.enter().append("circle").attr("class",g).attr("cx",function(t){return n.utils.safeNumber(m.x()(t.x))}).attr("cy",function(t){return n.utils.safeNumber(m.y()(t.y+t.y0))}).attr("r",c()).style("fill-opacity",_).style("stroke-opacity",k).attr("fill",m.getColor).attr("stroke",m.getColor).on("mousemove",function(){var e=t.select(this);!function(t){t.style("fill-opacity",.8),t.style("stroke-opacity",.8),t.attr("r",A)}(e),function(t,e){var n=t.attr("cx"),r=t.attr("cy"),i="M"+(m._yAxisX()-m.margins().left)+" "+r+"L"+n+" "+r,a="M"+n+" "+m.yAxisHeight()+"L"+n+" "+r;e.select("path."+p).style("display","").attr("d",i),e.select("path."+y).style("display","").attr("d",a)}(e,o)}).on("mouseout",function(){!function(t){t.style("fill-opacity",_).style("stroke-opacity",k).attr("r",c())}(t.select(this)),function(t){t.select("path."+p).style("display","none"),t.select("path."+y).style("display","none")}(o)}).merge(l);s.call(u,e),n.transition(s,m.transitionDuration()).attr("cx",function(t){return n.utils.safeNumber(m.x()(t.x))}).attr("cy",function(t){return n.utils.safeNumber(m.y()(t.y+t.y0))}).attr("fill",m.getColor),l.exit().remove()})}}function c(){return b||A}function u(t,e){m.renderTitle()&&(t.select("title").remove(),t.append("title").text(n.pluck("data",m.title(e.name))))}function s(e,n,r){return function(){var i=t.select(this),a=i.attr("stroke")===e&&i.attr("stroke-dasharray")===(n instanceof Array?n.join(","):null)||i.attr("fill")===e;return r?!a:a}}var d,f,h="dc-tooltip",g="dot",p="yRef",y="xRef",x=3,m=n.stackMixin(n.coordinateGridMixin({})),v=!1,A=5,b=null,_=1e-6,k=1e-6,D=null,C=null,w=null,M=!0;return m.transitionDuration(500),m.transitionDelay(0),m._rangeBandPadding(1),m.plotData=function(){var e=m.chartBodyG(),r=e.select("g.stack-list");r.empty()&&(r=e.append("g").attr("class","stack-list"));var c=r.selectAll("g.stack").data(m.data()),u=c.enter().append("g").attr("class",function(t,e){return"stack _"+e});(function(e,r){var l=t.line().x(function(t){return m.x()(t.x)}).y(function(t){return m.y()(t.y+t.y0)}).curve(a());d&&l.defined(d);var c=e.append("path").attr("class","line").attr("stroke",i);f&&c.attr("stroke-dasharray",f),n.transition(r.select("path.line"),m.transitionDuration(),m.transitionDelay()).attr("stroke",i).attr("d",function(t){return o(l(t.values))})})(u,c=u.merge(c)),function(e,r){if(v){var l=t.area().x(function(t){return m.x()(t.x)}).y1(function(t){return m.y()(t.y+t.y0)}).y0(function(t){return m.y()(t.y0)}).curve(a());d&&l.defined(d),e.append("path").attr("class","area").attr("fill",i).attr("d",function(t){return o(l(t.values))}),n.transition(r.select("path.area"),m.transitionDuration(),m.transitionDelay()).attr("fill",i).attr("d",function(t){return o(l(t.values))})}}(u,c),l(e,c),m.renderLabel()&&function(e){e.each(function(e,r){var i=t.select(this).selectAll("text.lineLabel").data(e.values,n.pluck("x")),a=i.enter().append("text").attr("class","lineLabel").attr("text-anchor","middle").merge(i);n.transition(a,m.transitionDuration()).attr("x",function(t){return n.utils.safeNumber(m.x()(t.x))}).attr("y",function(t){var e=m.y()(t.y+t.y0)-x;return n.utils.safeNumber(e)}).text(function(t){return m.label()(t)}),n.transition(i.exit(),m.transitionDuration()).attr("height",0).remove()})}(c)},m.curve=function(t){return arguments.length?(D=t,m):D},m.interpolate=n.logger.deprecate(function(t){return arguments.length?(C=t,m):C},"dc.lineChart.interpolate has been deprecated since version 3.0 use dc.lineChart.curve instead"),m.tension=n.logger.deprecate(function(t){return arguments.length?(w=t,m):w},"dc.lineChart.tension has been deprecated since version 3.0 use dc.lineChart.curve instead"),m.defined=function(t){return arguments.length?(d=t,m):d},m.dashStyle=function(t){return arguments.length?(f=t,m):f},m.renderArea=function(t){return arguments.length?(v=t,m):v},m.label(function(t){return n.utils.printSingleValue(t.y0+t.y)},!1),m.xyTipsOn=function(t){return arguments.length?(M=t,m):M},m.dotRadius=function(t){return arguments.length?(A=t,m):A},m.renderDataPoints=function(t){return arguments.length?(t?(_=t.fillOpacity||.8,k=t.strokeOpacity||0,b=t.radius||2):(_=1e-6,k=1e-6,b=null),m):{fillOpacity:_,strokeOpacity:k,radius:b}},m.legendHighlight=function(t){m.isLegendableHidden(t)||m.g().selectAll("path.line, path.area").classed("highlight",s(t.color,t.dashstyle)).classed("fadeout",s(t.color,t.dashstyle,!0))},m.legendReset=function(){m.g().selectAll("path.line, path.area").classed("highlight",!1).classed("fadeout",!1)},n.override(m,"legendables",function(){var t=m._legendables();return f?t.map(function(t){return t.dashstyle=f,t}):t}),m.anchor(e,r)},n.dataCount=function(e,r){var i=t.format(",d"),a=n.baseMixin({}),o={some:"",all:""};return a.html=function(t){return arguments.length?(t.all&&(o.all=t.all),t.some&&(o.some=t.some),a):o},a.formatNumber=function(t){return arguments.length?(i=t,a):i},a._doRender=function(){var t=a.dimension().size(),e=a.group().value(),n=i(t),r=i(e);return t===e&&""!==o.all?a.root().html(o.all.replace("%total-count",n).replace("%filter-count",r)):""!==o.some?a.root().html(o.some.replace("%total-count",n).replace("%filter-count",r)):(a.selectAll(".total-count").text(n),a.selectAll(".filter-count").text(r)),a},a._doRedraw=function(){return a._doRender()},a.anchor(e,r)},n.dataTable=function(e,r){function i(){var e=!0;if(h.forEach(function(t){e&="function"==typeof t}),!e){var n=d.selectAll("thead").data([0]);n.exit().remove();var r=(n=n.enter().append("thead").merge(n)).selectAll("tr").data([0]);r.exit().remove();var i=(r=r.enter().append("tr").merge(r)).selectAll("th").data(h);i.exit().remove(),i.enter().append("th").merge(i).attr("class",s).html(function(t){return d._doColumnHeaderFormat(t)})}var l=d.root().selectAll("tbody").data(function(){var e;e=p===t.ascending?d.dimension().bottom(f):d.dimension().top(f);return t.nest().key(d.group()).sortKeys(p).entries(e.sort(function(t,e){return p(g(t),g(e))}).slice(y,a))}(),function(t){return d.keyAccessor()(t)}),c=l.enter().append("tbody");return!0===x&&c.append("tr").attr("class",u).append("td").attr("class",o).attr("colspan",h.length).html(function(t){return d.keyAccessor()(t)}),l.exit().remove(),c}var a,o="dc-table-label",l="dc-table-row",c="dc-table-column",u="dc-table-group",s="dc-table-head",d=n.baseMixin({}),f=25,h=[],g=function(t){return t},p=t.ascending,y=0,x=!0;return d._doRender=function(){return d.selectAll("tbody").remove(),function(t){var e=t.order().selectAll("tr."+l).data(function(t){return t.values}),n=e.enter().append("tr").attr("class",l);h.forEach(function(t,e){n.append("td").attr("class",c+" _"+e).html(function(e){return d._doColumnValueFormat(t,e)})}),e.exit().remove()}(i()),d},d._doColumnValueFormat=function(t,e){return"function"==typeof t?t(e):"string"==typeof t?e[t]:t.format(e)},d._doColumnHeaderFormat=function(t){return"function"==typeof t?d._doColumnHeaderFnToString(t):"string"==typeof t?d._doColumnHeaderCapitalize(t):String(t.label)},d._doColumnHeaderCapitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},d._doColumnHeaderFnToString=function(t){var e=String(t),n=e.indexOf("return ");if(n>=0){var r=e.lastIndexOf(";");if(r>=0){(e=e.substring(n+7,r)).indexOf("numberFormat")>=0&&(e=e.replace("numberFormat",""))}}return e},d._doRedraw=function(){return d._doRender()},d.size=function(t){return arguments.length?(f=t,d):f},d.beginSlice=function(t){return arguments.length?(y=t,d):y},d.endSlice=function(t){return arguments.length?(a=t,d):a},d.columns=function(t){return arguments.length?(h=t,d):h},d.sortBy=function(t){return arguments.length?(g=t,d):g},d.order=function(t){return arguments.length?(p=t,d):p},d.showGroups=function(t){return arguments.length?(x=t,d):x},d.anchor(e,r)},n.dataGrid=function(e,r){function i(){var e=c.root().selectAll("div."+l).data(function(){var e=c.dimension().top(u);return t.nest().key(c.group()).sortKeys(f).entries(e.sort(function(t,e){return f(d(t),d(e))}).slice(h,a))}(),function(t){return c.keyAccessor()(t)}),n=e.enter().append("div").attr("class",l);return g&&n.html(function(t){return g(t)}),e.exit().remove(),n}var a,o="dc-grid-item",l="dc-grid-top",c=n.baseMixin({}),u=999,s=function(t){return"you need to provide an html() handling param: "+JSON.stringify(t)},d=function(t){return t},f=t.ascending,h=0,g=function(t){return"

"+c.keyAccessor()(t)+"

"};return c._doRender=function(){return c.selectAll("div."+l).remove(),function(t){var e=t.order().selectAll("div."+o).data(function(t){return t.values});e.exit().remove(),e=e.enter().append("div").attr("class",o).html(function(t){return s(t)}).merge(e)}(i()),c},c._doRedraw=function(){return c._doRender()},c.beginSlice=function(t){return arguments.length?(h=t,c):h},c.endSlice=function(t){return arguments.length?(a=t,c):a},c.size=function(t){return arguments.length?(u=t,c):u},c.html=function(t){return arguments.length?(s=t,c):s},c.htmlGroup=function(t){return arguments.length?(g=t,c):g},c.sortBy=function(t){return arguments.length?(d=t,c):d},c.order=function(t){return arguments.length?(f=t,c):f},c.anchor(e,r)},n.bubbleChart=function(t,e){var r=n.bubbleMixin(n.coordinateGridMixin({}));r.transitionDuration(750),r.transitionDelay(0);var i=function(t){return"translate("+function(t){var e=r.x()(r.keyAccessor()(t));return!isNaN(e)&&isFinite(e)||(e=0),e}(t)+","+function(t){var e=r.y()(r.valueAccessor()(t));return!isNaN(e)&&isFinite(e)||(e=0),e}(t)+")"};return r.plotData=function(){r.calculateRadiusDomain(),r.r().range([r.MIN_RADIUS,r.xAxisLength()*r.maxBubbleRelativeSize()]);var t=r.data(),e=r.chartBodyG().selectAll("g."+r.BUBBLE_NODE_CLASS).data(t,function(t){return t.key});r.sortBubbleSize()&&e.order(),function(t){t.exit().remove()}(e),function(t){n.transition(t,r.transitionDuration(),r.transitionDelay()).attr("transform",i).select("circle."+r.BUBBLE_CLASS).attr("fill",r.getColor).attr("r",function(t){return r.bubbleR(t)}).attr("opacity",function(t){return r.bubbleR(t)>0?1:0}),r.doUpdateLabels(t),r.doUpdateTitles(t)}(e=function(t){var e=t.enter().append("g");return e.attr("class",r.BUBBLE_NODE_CLASS).attr("transform",i).append("circle").attr("class",function(t,e){return r.BUBBLE_CLASS+" _"+e}).on("click",r.onClick).attr("fill",r.getColor).attr("r",0),t=e.merge(t),n.transition(t,r.transitionDuration(),r.transitionDelay()).select("circle."+r.BUBBLE_CLASS).attr("r",function(t){return r.bubbleR(t)}).attr("opacity",function(t){return r.bubbleR(t)>0?1:0}),r._doRenderLabel(e),r._doRenderTitles(e),t}(e)),r.fadeDeselectedArea(r.filter())},r.renderBrush=function(){},r.redrawBrush=function(t,e){r.fadeDeselectedArea(t)},r.anchor(t,e)},n.compositeChart=function(e,r){function i(e,r){var i,a,s,d,h;return e&&(i=t.min(c(o())),a=n.utils.add(t.max(u(o())),f.yAxisPadding())),r&&(s=t.min(c(l())),d=n.utils.add(t.max(u(l())),f.yAxisPadding())),f.alignYAxes()&&e&&r&&(h=function(t,e,n,r){var i=(r-n)/(e-t);return{lyAxisMin:Math.min(t,n/i),lyAxisMax:Math.max(e,r/i),ryAxisMin:Math.min(n,t*i),ryAxisMax:Math.max(r,e*i)}}(i,a,s,d)),h||{lyAxisMin:i,lyAxisMax:a,ryAxisMin:s,ryAxisMax:d}}function a(t,e){t._generateG(f.g()),t.g().attr("class",d+" _"+e)}function o(){return h.filter(function(t){return!t.useRightYAxis()})}function l(){return h.filter(function(t){return t.useRightYAxis()})}function c(t){return t.map(function(t){return t.yAxisMin()})}function u(t){return t.map(function(t){return t.yAxisMax()})}var s,d="sub",f=n.coordinateGridMixin({}),h=[],g={},p=!1,y=!0,x=!1,m=t.axisRight(),v=0,A=12,b=!1;return f._mandatoryAttributes([]),f.transitionDuration(500),f.transitionDelay(0),n.override(f,"_generateG",function(){for(var t=this.__generateG(),e=0;e0&&!b?f._renderHorizontalGridLinesForAxis(f.g(),f.y(),f.yAxis()):l().length>0&&f._renderHorizontalGridLinesForAxis(f.g(),s,m)},f.renderYAxis=function(){0!==o().length&&(f.renderYAxisAt("y",f.yAxis(),f.margins().left),f.renderYAxisLabel("y",f.yAxisLabel(),-90)),0!==l().length&&(f.renderYAxisAt("yr",f.rightYAxis(),f.width()-f.margins().right),f.renderYAxisLabel("yr",f.rightYAxisLabel(),90,f.width()-A))},f.plotData=function(){for(var t=0;t0&&(e[0]=0),e[1]<0&&(e[1]=0),d=t.scaleLinear().domain(e).range([0,D.effectiveWidth()])}C.scale(d)}(),e.empty()&&(e=s.append("g").attr("class","axis")),e.attr("transform","translate(0, "+D.effectiveHeight()+")"),n.transition(e,D.transitionDuration(),D.transitionDelay()).call(C)}function a(){h=D.data(),i(),s.selectAll("g.tick").select("line.grid-line").remove(),s.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-D.effectiveHeight()});var t=s.selectAll("g."+b).data(h);!function(t){t.exit().remove()}(t),function(t){var e,r=h.length;e=A||(D.effectiveHeight()-(r+1)*v)/r;y||(p=e/2);var i=t.attr("transform",function(t,n){return"translate(0,"+((n+1)*v+n*e)+")"}).select("rect").attr("height",e).attr("fill",D.getColor).on("click",l).classed("deselected",function(t){return!!D.hasFilter()&&!u(t)}).classed("selected",function(t){return!!D.hasFilter()&&u(t)});n.transition(i,D.transitionDuration(),D.transitionDelay()).attr("width",function(t){return Math.abs(o()-d(D.valueAccessor()(t)))}).attr("transform",c),function(t){D.renderTitle()&&(t.select("title").remove(),t.append("title").text(D.title()))}(t),function(t){if(D.renderLabel()){var e=t.select("text").attr("x",g).attr("y",p).attr("dy",x).on("click",l).attr("class",function(t,e){return b+" _"+e}).text(function(t){return D.label()(t)});n.transition(e,D.transitionDuration(),D.transitionDelay()).attr("transform",c)}if(D.renderTitleLabel()){var r=t.select("."+_).attr("x",D.effectiveWidth()-m).attr("y",p).attr("dy",x).attr("text-anchor","end").on("click",l).attr("class",function(t,e){return _+" _"+e}).text(function(t){return D.title()(t)});n.transition(r,D.transitionDuration(),D.transitionDelay()).attr("transform",c)}}(t)}(t=function(t){var e=t.enter().append("g").attr("class",function(t,e){return b+" _"+e});return e.append("rect").attr("width",0),function(t){D.renderLabel()&&t.append("text").on("click",l),D.renderTitleLabel()&&t.append("text").attr("class",_).on("click",l)}(e),e}(t).merge(t))}function o(){var t=d(0);return t===-1/0||t!=t?d(1):t}function l(t){D.onClick(t)}function c(t){var e=d(D.cappedValueAccessor(t)),n=o();return"translate("+(e>n?n:e)+",0)"}function u(t){return D.hasFilter(D.cappedKeyAccessor(t))}var s,d,f,h,g=10,p=15,y=!1,x="0.35em",m=2,v=5,A=!1,b="row",_="titlerow",k=!1,D=n.capMixin(n.marginMixin(n.colorMixin(n.baseMixin({})))),C=t.axisBottom();return D.rowsCap=D.cap,D._doRender=function(){return D.resetSvg(),s=D.svg().append("g").attr("transform","translate("+D.margins().left+","+D.margins().top+")"),a(),D},D.title(function(t){return D.cappedKeyAccessor(t)+": "+D.cappedValueAccessor(t)}),D.label(D.cappedKeyAccessor),D.x=function(t){return arguments.length?(d=t,D):d},D.renderTitleLabel=function(t){return arguments.length?(k=t,D):k},D._doRedraw=function(){return a(),D},D.xAxis=function(t){return arguments.length?(C=t,this):C},D.fixedBarHeight=function(t){return arguments.length?(A=t,D):A},D.gap=function(t){return arguments.length?(v=t,D):v},D.elasticX=function(t){return arguments.length?(f=t,D):f},D.labelOffsetX=function(t){return arguments.length?(g=t,D):g},D.labelOffsetY=function(t){return arguments.length?(p=t,y=!0,D):p},D.titleLabelOffsetX=function(t){return arguments.length?(m=t,D):m},D.anchor(e,r)},n.legend=function(){function t(){return u+c}var e,r,i,a={},o=0,l=0,c=12,u=5,s=!1,d=560,f=70,h=!1,g=n.pluck("name");return a.parent=function(t){return arguments.length?(e=t,a):e},a.render=function(){e.svg().select("g.dc-legend").remove(),i=e.svg().append("g").attr("class","dc-legend").attr("transform","translate("+o+","+l+")");var a=e.legendables();void 0!==r&&(a=a.slice(0,r));var p=i.selectAll("g.dc-legend-item").data(a).enter().append("g").attr("class","dc-legend-item").on("mouseover",function(t){e.legendHighlight(t,this)}).on("mouseout",function(t){e.legendReset(t,this)}).on("click",function(t){t.chart.legendToggle(t,this)});i.selectAll("g.dc-legend-item").classed("fadeout",function(t){return t.chart.isLegendableHidden(t)}),a.some(n.pluck("dashstyle"))?p.append("line").attr("x1",0).attr("y1",c/2).attr("x2",c).attr("y2",c/2).attr("stroke-width",2).attr("stroke-dasharray",n.pluck("dashstyle")).attr("stroke",n.pluck("color")):p.append("rect").attr("width",c).attr("height",c).attr("fill",function(t){return t?t.color:"blue"}),p.append("text").text(g).attr("x",c+2).attr("y",function(){return c/2+(this.clientHeight?this.clientHeight:13)/2-2});var y=0,x=0;p.attr("transform",function(e,n){if(s){var r=!0===h?this.getBBox().width+u:f;y+r>d&&y>0&&(++x,y=0);var i="translate("+y+","+x*t()+")";return y+=r,i}return"translate(0,"+n*t()+")"})},a.x=function(t){return arguments.length?(o=t,a):o},a.y=function(t){return arguments.length?(l=t,a):l},a.gap=function(t){return arguments.length?(u=t,a):u},a.itemHeight=function(t){return arguments.length?(c=t,a):c},a.horizontal=function(t){return arguments.length?(s=t,a):s},a.legendWidth=function(t){return arguments.length?(d=t,a):d},a.itemWidth=function(t){return arguments.length?(f=t,a):f},a.autoItemWidth=function(t){return arguments.length?(h=t,a):h},a.legendText=function(t){return arguments.length?(g=t,a):g},a.maxItems=function(t){return arguments.length?(r=n.utils.isNumber(t)?t:void 0,a):r},a},n.htmlLegend=function(){var e,r,i,a,o={},l=n.pluck("name"),c=!1,u=!1;return o.parent=function(t){return arguments.length?(e=t,o):e},o.render=function(){var t=c?"dc-legend-item-horizontal":"dc-legend-item-vertical";r.select("div.dc-html-legend").remove();var o=r.append("div").attr("class","dc-html-legend");o.attr("style","max-width:"+r.nodes()[0].style.width);var s=e.legendables(),d=e.filters();void 0!==i&&(s=s.slice(0,i));var f=a||t,h=o.selectAll("div."+f).data(s).enter().append("div").classed(f,!0).on("mouseover",e.legendHighlight).on("mouseout",e.legendReset).on("click",e.legendToggle);u&&h.classed(n.constants.SELECTED_CLASS,function(t){return-1!==d.indexOf(t.name)}),h.append("span").attr("class","dc-legend-item-color").style("background-color",n.pluck("color")),h.append("span").attr("class","dc-legend-item-label").attr("title",l).text(l)},o.container=function(e){return arguments.length?(r=t.select(e),o):r},o.legendItemClass=function(t){return arguments.length?(a=t,o):a},o.highlightSelected=function(t){return arguments.length?(u=t,o):u},o.horizontal=function(t){return arguments.length?(c=t,o):c},o.legendText=function(t){return arguments.length?(l=t,o):l},o.maxItems=function(t){return arguments.length?(i=n.utils.isNumber(t)?t:void 0,o):i},o},n.scatterPlot=function(e,r){function i(t,e){return u(t)?b[e]?Math.pow(h,2):Math.pow(g,2):Math.pow(x,2)}function a(t,e){l.renderTitle()&&(t.selectAll("title").remove(),t.append("title").text(function(t){return l.title()(t)}))}function o(e,r){var i=l.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return e(t.select(this))}),a=c.size();c.size(Math.pow(r,2)),n.transition(i,l.transitionDuration(),l.transitionDelay()).attr("d",c),c.size(a)}var l=n.coordinateGridMixin({}),c=t.symbol(),u=function(t){return t.value},s=l.keyAccessor();l.keyAccessor(function(t){return s(t)[0]}),l.valueAccessor(function(t){return s(t)[1]}),l.colorAccessor(function(){return l._groupName}),l.title(function(t){return l.keyAccessor()(t)+","+l.valueAccessor()(t)+": "+l.existenceAccessor()(t)});var d=function(t){return"translate("+l.x()(l.keyAccessor()(t))+","+l.y()(l.valueAccessor()(t))+")"},f=7,h=5,g=3,p=null,y=1,x=0,m=0,v=1,A=null,b=[];return l.brush(t.brush()),c.size(i),n.override(l,"_filter",function(t){return arguments.length?l.__filter(n.filters.RangedTwoDimensionalFilter(t)):l.__filter()}),l.plotData=function(){var t=l.chartBodyG().selectAll("path.symbol").data(l.data());n.transition(t.exit(),l.transitionDuration(),l.transitionDelay()).attr("opacity",0).remove(),(t=t.enter().append("path").attr("class","symbol").attr("opacity",0).attr("fill",l.getColor).attr("transform",d).merge(t)).call(a,l.data()),t.each(function(t,e){b[e]=!l.filter()||l.filter().isFiltered([l.keyAccessor()(t),l.valueAccessor()(t)])}),n.transition(t,l.transitionDuration(),l.transitionDelay()).attr("opacity",function(t,e){return u(t)?b[e]?v:l.excludedOpacity():m}).attr("fill",function(t,e){return A&&!u(t)?A:l.excludedColor()&&!b[e]?l.excludedColor():l.getColor(t)}).attr("transform",d).attr("d",c)},l.existenceAccessor=function(t){return arguments.length?(u=t,this):u},l.symbol=function(t){return arguments.length?(c.type(t),l):c.type()},l.customSymbol=function(t){return arguments.length?((c=t).size(i),l):c},l.symbolSize=function(t){return arguments.length?(h=t,l):h},l.highlightedSize=function(t){return arguments.length?(f=t,l):f},l.excludedSize=function(t){return arguments.length?(g=t,l):g},l.excludedColor=function(t){return arguments.length?(p=t,l):p},l.excludedOpacity=function(t){return arguments.length?(y=t,l):y},l.hiddenSize=l.emptySize=function(t){return arguments.length?(x=t,l):x},l.emptyColor=function(t){return arguments.length?(A=t,l):A},l.emptyOpacity=function(t){return arguments.length?(m=t,l):m},l.nonemptyOpacity=function(t){return arguments.length?(v=t,l):m},l.legendables=function(){return[{chart:l,name:l._groupName,color:l.getColor()}]},l.legendHighlight=function(e){o(function(t){return t.attr("fill")===e.color},f),l.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return t.select(this).attr("fill")!==e.color}).classed("fadeout",!0)},l.legendReset=function(e){o(function(t){return t.attr("fill")===e.color},h),l.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return t.select(this).attr("fill")!==e.color}).classed("fadeout",!1)},l.createBrushHandlePaths=function(){},l.extendBrush=function(t){return l.round()&&(t[0]=t[0].map(l.round()),t[1]=t[1].map(l.round())),t},l.brushIsEmpty=function(t){return!t||t[0][0]>=t[1][0]||t[0][1]>=t[1][1]},l._brushing=function(){if(t.event.sourceEvent&&(!t.event.sourceEvent.type||-1===["start","brush","end"].indexOf(t.event.sourceEvent.type))){var e=t.event.selection,r=l.brushIsEmpty(e);e&&(e=e.map(function(t){return t.map(function(t,e){return(0===e?l.x():l.y()).invert(t)})}),e=l.extendBrush(e),r=r&&l.brushIsEmpty(e)),l.redrawBrush(e,!1);var i=r?null:n.filters.RangedTwoDimensionalFilter(e);n.events.trigger(function(){l.replaceFilter(i),l.redrawGroup()},n.constants.EVENT_DELAY)}},l.redrawBrush=function(t,e){var r=l.brush(),i=l.gBrush();if(l.brushOn()&&i)if(l.resizing()&&l.setBrushExtents(e),t){t=t.map(function(t){return t.map(function(t,e){return(0===e?l.x():l.y())(t)})});n.optionalTransition(e,l.transitionDuration(),l.transitionDelay())(i).call(r.move,t)}else i.call(r.move,t);l.fadeDeselectedArea(t)},l.setBrushY=function(t){t.call(l.brush().y(l.y()))},l.anchor(e,r)},n.numberDisplay=function(e,r){var i,a=t.format(".2s"),o=n.baseMixin({}),l={one:"",some:"",none:""};return o._mandatoryAttributes(["group"]),o.ordering(function(t){return t.value}),o.html=function(t){return arguments.length?(t.none?l.none=t.none:t.one?l.none=t.one:t.some&&(l.none=t.some),t.one?l.one=t.one:t.some&&(l.one=t.some),t.some?l.some=t.some:t.one&&(l.some=t.one),o):l},o.value=function(){return o.data()},o.data(function(t){var e=t.value?t.value():function(t){if(!t.length)return null;var e=o._computeOrderedGroups(t);return e[e.length-1]}(t.all());return o.valueAccessor()(e)}),o.transitionDuration(250),o.transitionDelay(0),o._doRender=function(){var e=o.value(),n=o.selectAll(".number-display");n.empty()&&(n=n.data([0]).enter().append("span").attr("class","number-display").merge(n)),n.transition().duration(o.transitionDuration()).delay(o.transitionDelay()).ease(t.easeQuad).tween("text",function(){var n=isFinite(i)?i:0,r=t.interpolateNumber(n||0,e);i=e;var a=this;return function(t){var n=null,i=o.formatNumber()(r(t));0===e&&""!==l.none?n=l.none:1===e&&""!==l.one?n=l.one:""!==l.some&&(n=l.some),a.innerHTML=n?n.replace("%number",i):i}})},o._doRedraw=function(){return o._doRender()},o.formatNumber=function(t){return arguments.length?(a=t,o):a},o.anchor(e,r)},n.heatMap=function(e,r){function i(t,e){var r=g.selectAll(".box-group").filter(function(n){return n.key[t]===e}),i=r.filter(function(t){return!g.hasFilter(t.key)});n.events.trigger(function(){var t=(i.empty()?r:i).data().map(function(t){return n.filters.TwoDimensionalFilter(t.key)});g._filter([t]),g.redrawGroup()})}var a,o,l,c=t.ascending,u=t.ascending,s=t.scaleBand(),d=t.scaleBand(),f=6.75,h=6.75,g=n.colorMixin(n.marginMixin(n.baseMixin({})));g._mandatoryAttributes(["group"]),g.title(g.colorAccessor());var p=function(t){return t},y=function(t){return t};g.colsLabel=function(t){return arguments.length?(p=t,g):p},g.rowsLabel=function(t){return arguments.length?(y=t,g):y};var x=function(t){i(0,t)},m=function(t){i(1,t)},v=function(t){var e=t.key;n.events.trigger(function(){g.filter(e),g.redrawGroup()})};return n.override(g,"filter",function(t){return arguments.length?g._filter(n.filters.TwoDimensionalFilter(t)):g._filter()}),g.rows=function(t){return arguments.length?(l=t,g):l},g.rowOrdering=function(t){return arguments.length?(u=t,g):u},g.cols=function(t){return arguments.length?(o=t,g):o},g.colOrdering=function(t){return arguments.length?(c=t,g):c},g._doRender=function(){return g.resetSvg(),a=g.svg().append("g").attr("class","heatmap").attr("transform","translate("+g.margins().left+","+g.margins().top+")"),g._doRedraw()},g._doRedraw=function(){var t=g.data(),e=g.rows()||t.map(g.valueAccessor()),r=g.cols()||t.map(g.keyAccessor());u&&(e=e.sort(u)),c&&(r=r.sort(c)),e=d.domain(e),r=s.domain(r);var i=e.domain().length,o=r.domain().length,l=Math.floor(g.effectiveWidth()/o),p=Math.floor(g.effectiveHeight()/i);r.rangeRound([0,g.effectiveWidth()]),e.rangeRound([g.effectiveHeight(),0]);var y=a.selectAll("g.box-group").data(g.data(),function(t,e){return g.keyAccessor()(t,e)+"\0"+g.valueAccessor()(t,e)});y.exit().remove();var x=y.enter().append("g").attr("class","box-group");x.append("rect").attr("class","heat-box").attr("fill","white").attr("x",function(t,e){return r(g.keyAccessor()(t,e))}).attr("y",function(t,n){return e(g.valueAccessor()(t,n))}).on("click",g.boxOnClick()),g.renderTitle()&&(x.append("title"),y.select("title").text(g.title())),y=x.merge(y),n.transition(y.select("rect"),g.transitionDuration(),g.transitionDelay()).attr("x",function(t,e){return r(g.keyAccessor()(t,e))}).attr("y",function(t,n){return e(g.valueAccessor()(t,n))}).attr("rx",f).attr("ry",h).attr("fill",g.getColor).attr("width",l).attr("height",p);var m=a.select("g.cols");m.empty()&&(m=a.append("g").attr("class","cols axis"));var v=m.selectAll("text").data(r.domain());v.exit().remove(),v=v.enter().append("text").attr("x",function(t){return r(t)+l/2}).style("text-anchor","middle").attr("y",g.effectiveHeight()).attr("dy",12).on("click",g.xAxisOnClick()).text(g.colsLabel()).merge(v),n.transition(v,g.transitionDuration(),g.transitionDelay()).text(g.colsLabel()).attr("x",function(t){return r(t)+l/2}).attr("y",g.effectiveHeight());var A=a.select("g.rows");A.empty()&&(A=a.append("g").attr("class","rows axis"));var b=A.selectAll("text").data(e.domain());return b.exit().remove(),b=b.enter().append("text").style("text-anchor","end").attr("x",0).attr("dx",-2).attr("y",function(t){return e(t)+p/2}).attr("dy",6).on("click",g.yAxisOnClick()).text(g.rowsLabel()).merge(b),n.transition(b,g.transitionDuration(),g.transitionDelay()).text(g.rowsLabel()).attr("y",function(t){return e(t)+p/2}),g.hasFilter()?g.selectAll("g.box-group").each(function(t){g.isSelectedNode(t)?g.highlightSelected(this):g.fadeDeselected(this)}):g.selectAll("g.box-group").each(function(){g.resetHighlight(this)}),g},g.boxOnClick=function(t){return arguments.length?(v=t,g):v},g.xAxisOnClick=function(t){return arguments.length?(x=t,g):x},g.yAxisOnClick=function(t){return arguments.length?(m=t,g):m},g.xBorderRadius=function(t){return arguments.length?(f=t,g):f},g.yBorderRadius=function(t){return arguments.length?(h=t,g):h},g.isSelectedNode=function(t){return g.hasFilter(t.key)},g.anchor(e,r)},function(){function e(t){return[0,t.length-1]}function r(e){return[t.quantile(e,.25),t.quantile(e,.5),t.quantile(e,.75)]}t.box=function(){function i(e){e.each(function(e,n){e=e.map(s).sort(t.ascending);var r,i,b=t.select(this),_=e.length;if(0!==_){var k=e.quartiles=f(e),D=d&&d.call(this,e,n),C=D&&D.map(function(t){return e[t]}),w=D?t.range(0,D[0]).concat(t.range(D[1]+1,_)):t.range(_);v?(r=e[0],i=e[_-1]):(r=e[D[0]],i=e[D[1]]);var M=t.range(D[0],D[1]+1),E=t.scaleLinear().domain(u&&u.call(this,e,n)||[r,i]).range([o,0]),L=this.__chart__||t.scaleLinear().domain([0,1/0]).range(E.range());this.__chart__=E;var R=b.selectAll("line.center").data(C?[C]:[]);R.enter().insert("line","rect").attr("class","center").attr("x1",a/2).attr("y1",function(t){return L(t[0])}).attr("x2",a/2).attr("y2",function(t){return L(t[1])}).style("opacity",1e-6).transition().duration(l).delay(c).style("opacity",1).attr("y1",function(t){return E(t[0])}).attr("y2",function(t){return E(t[1])}),R.transition().duration(l).delay(c).style("opacity",1).attr("x1",a/2).attr("x2",a/2).attr("y1",function(t){return E(t[0])}).attr("y2",function(t){return E(t[1])}),R.exit().transition().duration(l).delay(c).style("opacity",1e-6).attr("y1",function(t){return E(t[0])}).attr("y2",function(t){return E(t[1])}).remove();var S=b.selectAll("rect.box").data([k]);S.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(t){return L(t[2])}).attr("width",a).attr("height",function(t){return L(t[0])-L(t[2])}).style("fill-opacity",g?.1:1).transition().duration(l).delay(c).attr("y",function(t){return E(t[2])}).attr("height",function(t){return E(t[0])-E(t[2])}),S.transition().duration(l).delay(c).attr("width",a).attr("y",function(t){return E(t[2])}).attr("height",function(t){return E(t[0])-E(t[2])});var O=b.selectAll("line.median").data([k[1]]);O.enter().append("line").attr("class","median").attr("x1",0).attr("y1",L).attr("x2",a).attr("y2",L).transition().duration(l).delay(c).attr("y1",E).attr("y2",E),O.transition().duration(l).delay(c).attr("x1",0).attr("x2",a).attr("y1",E).attr("y2",E);var T=b.selectAll("line.whisker").data(C||[]);if(T.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",L).attr("x2",a).attr("y2",L).style("opacity",1e-6).transition().duration(l).delay(c).attr("y1",E).attr("y2",E).style("opacity",1),T.transition().duration(l).delay(c).attr("x1",0).attr("x2",a).attr("y1",E).attr("y2",E).style("opacity",1),T.exit().transition().duration(l).delay(c).attr("y1",E).attr("y2",E).style("opacity",1e-6).remove(),v){var F=A?"outlierBold":"outlier",B=A?3:5,N=A?function(){return Math.floor(Math.random()*(a*x)+1+(a-a*x)/2)}:function(){return a/2},P=b.selectAll("circle."+F).data(w,Number);P.enter().insert("circle","text").attr("class",F).attr("r",B).attr("cx",N).attr("cy",function(t){return L(e[t])}).style("opacity",1e-6).transition().duration(l).delay(c).attr("cy",function(t){return E(e[t])}).style("opacity",.6),m&&(P.selectAll("title").remove(),P.append("title").text(function(t){return e[t]})),P.transition().duration(l).delay(c).attr("cx",N).attr("cy",function(t){return E(e[t])}).style("opacity",.6),P.exit().transition().duration(l).delay(c).attr("cy",0).style("opacity",1e-6).remove()}if(g){var H=b.selectAll("circle.data").data(M);H.enter().insert("circle","text").attr("class","data").attr("r",p).attr("cx",function(){return Math.floor(Math.random()*(a*x)+1+(a-a*x)/2)}).attr("cy",function(t){return L(e[t])}).style("opacity",1e-6).transition().duration(l).delay(c).attr("cy",function(t){return E(e[t])}).style("opacity",y),m&&(H.selectAll("title").remove(),H.append("title").text(function(t){return e[t]})),H.transition().duration(l).delay(c).attr("cx",function(){return Math.floor(Math.random()*(a*x)+1+(a-a*x)/2)}).attr("cy",function(t){return E(e[t])}).style("opacity",y),H.exit().transition().duration(l).delay(c).attr("cy",0).style("opacity",1e-6).remove()}var z=h||E.tickFormat(8),G=b.selectAll("text.box").data(k);G.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(t,e){return 1&e?6:-6}).attr("x",function(t,e){return 1&e?a:0}).attr("y",L).attr("text-anchor",function(t,e){return 1&e?"start":"end"}).text(z).transition().duration(l).delay(c).attr("y",E),G.transition().duration(l).delay(c).text(z).attr("x",function(t,e){return 1&e?a:0}).attr("y",E);var I=b.selectAll("text.whisker").data(C||[]);I.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",a).attr("y",L).text(z).style("opacity",1e-6).transition().duration(l).delay(c).attr("y",E).style("opacity",1),I.transition().duration(l).delay(c).text(z).attr("x",a).attr("y",E).style("opacity",1),I.exit().transition().duration(l).delay(c).attr("y",E).style("opacity",1e-6).remove(),delete e.quartiles}}),t.timerFlush()}var a=1,o=1,l=0,c=0,u=null,s=Number,d=e,f=r,h=null,g=!1,p=3,y=.3,x=.8,m=!1,v=!0,A=!1;return i.width=function(t){return arguments.length?(a=t,i):a},i.height=function(t){return arguments.length?(o=t,i):o},i.tickFormat=function(t){return arguments.length?(h=t,i):h},i.showOutliers=function(t){return arguments.length?(v=t,i):v},i.boldOutlier=function(t){return arguments.length?(A=t,i):A},i.renderDataPoints=function(t){return arguments.length?(g=t,i):g},i.renderTitle=function(t){return arguments.length?(m=t,i):m},i.dataOpacity=function(t){return arguments.length?(y=t,i):y},i.dataWidthPortion=function(t){return arguments.length?(x=t,i):x},i.duration=function(t){return arguments.length?(l=t,i):l},i.domain=function(t){return arguments.length?(u=null===t?t:"function"==typeof t?t:n.utils.constant(t),i):u},i.value=function(t){return arguments.length?(s=t,i):s},i.whiskers=function(t){return arguments.length?(d=t,i):d},i.quartiles=function(t){return arguments.length?(f=t,i):f},i}}(),n.boxPlot=function(e,r){function i(){return t.min(l.data(),function(e){return t.min(l.valueAccessor()(e))})}function a(){return t.max(l.data(),function(e){return t.max(l.valueAccessor()(e))})}function o(){return(a()-i())/l.effectiveHeight()}var l=n.coordinateGridMixin({}),c=function(t){return function(e){var n=e.quartiles[0],r=e.quartiles[2],i=(r-n)*t,a=-1,o=e.length;do{++a}while(e[a]r+i);return[a,o]}}(1.5),u=t.box(),s=null,d=!1,f=.3,h=.8,g=!0,p=!1,y=8,x=function(t,e){return l.isOrdinal()?l.x().bandwidth():t/(1+l.boxPadding())/e};l.x(t.scaleBand()),l.xUnits(n.units.ordinal),l.data(function(t){return t.all().map(function(t){return t.map=function(e){return e.call(t,t)},t}).filter(function(t){return 0!==l.valueAccessor()(t).length})}),l.boxPadding=l._rangeBandPadding,l.boxPadding(.8),l.outerPadding=l._outerRangeBandPadding,l.outerPadding(.5),l.boxWidth=function(t){return arguments.length?(x="function"==typeof t?t:n.utils.constant(t),l):x};var m=function(t,e){return"translate("+l.x()(l.keyAccessor()(t,e))+", 0)"};return l._preprocessData=function(){l.elasticX()&&l.x().domain([])},l.plotData=function(){var e=x(l.effectiveWidth(),l.xUnitCount());u.whiskers(c).width(e).height(l.effectiveHeight()).value(l.valueAccessor()).domain(l.y().domain()).duration(l.transitionDuration()).tickFormat(s).renderDataPoints(d).dataOpacity(f).dataWidthPortion(h).renderTitle(l.renderTitle()).showOutliers(g).boldOutlier(p);var r=l.chartBodyG().selectAll("g.box").data(l.data(),l.keyAccessor());!function(e){n.transition(e,l.transitionDuration(),l.transitionDelay()).attr("transform",m).call(u).each(function(e){var n=l.getColor(e,0);t.select(this).select("rect.box").attr("fill",n),t.select(this).selectAll("circle.data").attr("fill",n)})}(function(t){var e=t.enter().append("g");return e.attr("class","box").attr("transform",m).call(u).on("click",function(t){l.filter(l.keyAccessor()(t)),l.redrawGroup()}),e.merge(t)}(r)),function(t){t.exit().remove().call(u)}(r),l.fadeDeselectedArea(l.filter())},l.fadeDeselectedArea=function(t){if(l.hasFilter())if(l.isOrdinal())l.g().selectAll("g.box").each(function(t){l.isSelectedNode(t)?l.highlightSelected(this):l.fadeDeselected(this)});else{if(!l.brushOn()&&!l.parentBrushOn())return;var e=t[0],n=t[1],r=l.keyAccessor();l.g().selectAll("g.box").each(function(t){var i=r(t);i=n?l.fadeDeselected(this):l.highlightSelected(this)})}else l.g().selectAll("g.box").each(function(){l.resetHighlight(this)})},l.isSelectedNode=function(t){return l.hasFilter(l.keyAccessor()(t))},l.yAxisMin=function(){var t=y*o();return n.utils.subtract(i()-t,l.yAxisPadding())},l.yAxisMax=function(){var t=y*o();return n.utils.add(a()+t,l.yAxisPadding())},l.tickFormat=function(t){return arguments.length?(s=t,l):s},l.yRangePadding=function(t){return arguments.length?(y=t,l):y},l.renderDataPoints=function(t){return arguments.length?(d=t,l):d},l.dataOpacity=function(t){return arguments.length?(f=t,l):f},l.dataWidthPortion=function(t){return arguments.length?(h=t,l):h},l.showOutliers=function(t){return arguments.length?(g=t,l):g},l.boldOutlier=function(t){return arguments.length?(p=t,l):p},l.anchor(e,r)},n.selectMenu=function(e,r){function i(e,n){var r,i=t.event.target;if(i.selectedOptions){r=Array.prototype.slice.call(i.selectedOptions).map(function(t){return t.value})}else{r=[].slice.call(t.event.target.options).filter(function(t){return t.selected}).map(function(t){return t.value})}1===r.length&&""===r[0]?r=s||null:u||1!==r.length||(r=r[0]),l.onChange(r)}var a,o="dc-select-option",l=n.baseMixin({}),c="Select all",u=!1,s=null,d=null,f=function(t,e){return l.keyAccessor()(t)>l.keyAccessor()(e)?1:l.keyAccessor()(e)>l.keyAccessor()(t)?-1:0},h=function(t){return l.valueAccessor()(t)>0};l.data(function(t){return t.all().filter(h)}),l._doRender=function(){return l.select("select").remove(),(a=l.root().append("select").classed("dc-select-menu",!0)).append("option").text(c).attr("value",""),l._doRedraw(),l};var g=window.navigator.userAgent;return g.indexOf("Trident/")>0&&-1===g.indexOf("MSIE")&&(l.redraw=l.render),l._doRedraw=function(){return u?a.attr("multiple",!0):a.attr("multiple",null),null!==d?a.attr("size",d):a.attr("size",null),function(){var t=a.selectAll("option."+o).data(l.data(),function(t){return l.keyAccessor()(t)});t.exit().remove(),t.enter().append("option").classed(o,!0).attr("value",function(t){return l.keyAccessor()(t)}).merge(t).text(l.title()),a.selectAll("option."+o).sort(f),a.on("change",i)}(),l.hasFilter()&&u?a.selectAll("option").property("selected",function(t){return void 0!==t&&l.filters().indexOf(String(l.keyAccessor()(t)))>=0}):l.hasFilter()?a.property("value",l.filter()):a.property("value",""),l},l.onChange=function(t){t&&u?l.replaceFilter([t]):t?l.replaceFilter(t):l.filterAll(),n.events.trigger(function(){l.redrawGroup()})},l.order=function(t){return arguments.length?(f=t,l):f},l.promptText=function(t){return arguments.length?(c=t,l):c},l.filterDisplayed=function(t){return arguments.length?(h=t,l):h},l.multiple=function(t){return arguments.length?(u=t,l):u},l.promptValue=function(t){return arguments.length?(s=t,l):s},l.numberVisible=function(t){return arguments.length?(d=t,l):d},l.size=n.logger.deprecate(l.numberVisible,"selectMenu.size is ambiguous - use numberVisible instead"),l.anchor(e,r)},n.textFilterWidget=function(t,e){var r=n.baseMixin({}),i=function(t){return t.toLowerCase()},a=function(t){return t=i(t),function(e){return-1!==i(e).indexOf(t)}},o="search";return r.group(function(){throw"the group function on textFilterWidget should never be called, please report the issue"}),r._doRender=function(){r.select("input").remove();return r.root().append("input").classed("dc-text-filter-input",!0).on("input",function(){r.dimension().filterFunction(a(this.value)),n.events.trigger(function(){n.redrawAll()},n.constants.EVENT_DELAY)}),r._doRedraw(),r},r._doRedraw=function(){return r.root().selectAll("input").attr("placeholder",o),r},r.normalize=function(t){return arguments.length?(i=t,r):i},r.placeHolder=function(t){return arguments.length?(o=t,r):o},r.filterFunctionFactory=function(t){return arguments.length?(a=t,r):a},r.anchor(t,e)},n.cboxMenu=function(e,r){function i(e,n){var r;t.select(t.event.target).datum()?(r=t.select(this).selectAll("input").filter(function(t){if(t)return this.checked}).nodes().map(function(t){return t.value}),u||1!==r.length||(r=r[0])):r=d||null,l.onChange(r)}var a,o="dc-cbox-item",l=n.baseMixin({}),c="Select all",u=!1,s="radio",d=null,f=Math.floor(1e5*Math.random())+1,h=function(t,e){return l.keyAccessor()(t)>l.keyAccessor()(e)?1:l.keyAccessor()(e)>l.keyAccessor()(t)?-1:0},g=function(t){return l.valueAccessor()(t)>0};return l.data(function(t){return t.all().filter(g)}),l._doRender=function(){return l._doRedraw()},l._doRedraw=function(){return l.select("ul").remove(),a=l.root().append("ul").classed("dc-cbox-group",!0),function(){var t=a.selectAll("li."+o).data(l.data(),function(t){return l.keyAccessor()(t)});if(t.exit().remove(),(t=t.enter().append("li").classed(o,!0).merge(t)).append("input").attr("type",s).attr("value",function(t){return l.keyAccessor()(t)}).attr("name","domain_"+f).attr("id",function(t,e){return"input_"+f+"_"+e}),t.append("label").attr("for",function(t,e){return"input_"+f+"_"+e}).text(l.title()),u)a.append("li").append("input").attr("type","reset").text(c).on("click",i);else{var e=a.append("li");e.append("input").attr("type",s).attr("value",d).attr("name","domain_"+f).attr("id",function(t,e){return"input_"+f+"_all"}).property("checked",!0),e.append("label").attr("for",function(t,e){return"input_"+f+"_all"}).text(c)}a.selectAll("li."+o).sort(h),a.on("change",i)}(),l.hasFilter()&&u?a.selectAll("input").property("checked",function(t){return t&&l.filters().indexOf(String(l.keyAccessor()(t)))>=0||!1}):l.hasFilter()&&a.selectAll("input").property("checked",function(t){return!!t&&l.keyAccessor()(t)===l.filter()}),l},l.onChange=function(t){t&&u?l.replaceFilter([t]):t?l.replaceFilter(t):l.filterAll(),n.events.trigger(function(){l.redrawGroup()})},l.order=function(t){return arguments.length?(h=t,l):h},l.promptText=function(t){return arguments.length?(c=t,l):c},l.filterDisplayed=function(t){return arguments.length?(g=t,l):g},l.multiple=function(t){return arguments.length?(u=t,s=u?"checkbox":"radio",l):u},l.promptValue=function(t){return arguments.length?(d=t,l):d},l.anchor(e,r)},n.abstractBubbleChart=n.bubbleMixin,n.baseChart=n.baseMixin,n.capped=n.capMixin,n.colorChart=n.colorMixin,n.coordinateGridChart=n.coordinateGridMixin,n.marginable=n.marginMixin,n.stackableChart=n.stackMixin,n.d3=t,n.crossfilter=e,n}if("function"==typeof define&&define.amd)define(["d3","crossfilter2"],t);else if("object"==typeof module&&module.exports){var e=require("d3"),n=require("crossfilter2");"function"!=typeof n&&(n=n.crossfilter),module.exports=t(e,n)}else this.dc=t(d3,crossfilter)}();