dc
Version:
A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js
20 lines (19 loc) • 110 kB
JavaScript
/*!
* dc 3.1.4
* http://dc-js.github.io/dc.js/
* Copyright 2012-2019 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(nt,t){"use strict";var r,rt={version:"3.1.4",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};function i(t){return t=t||rt.constants.DEFAULT_CHART_GROUP,r[t]||(r[t]=[]),t}rt.chartRegistry=(r={},{has:function(t){for(var e in r)if(0<=r[e].indexOf(t))return!0;return!1},register:function(t,e){e=i(e),r[e].push(t)},deregister:function(t,e){e=i(e);for(var n=0;n<r[e].length;n++)if(r[e][n].anchorName()===t.anchorName()){r[e].splice(n,1);break}},clear:function(t){t?delete r[t]:r={}},list:function(t){return t=i(t),r[t]}}),rt.registerChart=function(t,e){rt.chartRegistry.register(t,e)},rt.deregisterChart=function(t,e){rt.chartRegistry.deregister(t,e)},rt.hasChart=function(t){return rt.chartRegistry.has(t)},rt.deregisterAllCharts=function(t){rt.chartRegistry.clear(t)},rt.filterAll=function(t){for(var e=rt.chartRegistry.list(t),n=0;n<e.length;++n)e[n].filterAll()},rt.refocusAll=function(t){for(var e=rt.chartRegistry.list(t),n=0;n<e.length;++n)e[n].focus&&e[n].focus()},rt.renderAll=function(t){for(var e=rt.chartRegistry.list(t),n=0;n<e.length;++n)e[n].render();null!==rt._renderlet&&rt._renderlet(t)},rt.redrawAll=function(t){for(var e=rt.chartRegistry.list(t),n=0;n<e.length;++n)e[n].redraw();null!==rt._renderlet&&rt._renderlet(t)},rt.disableTransitions=!1,rt.transition=function(t,e,n,r){if(rt.disableTransitions||e<=0)return t;var i=t.transition(r);return(0<=e||void 0!==e)&&(i=i.duration(e)),(0<=n||void 0!==n)&&(i=i.delay(n)),i},rt.optionalTransition=function(t,e,n,r){return t?function(t){return rt.transition(t,e,n,r)}:function(t){return t}},rt.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)})}},rt.units={},rt.units.integers=function(t,e){return Math.abs(e-t)},rt.units.ordinal=function(){throw new Error("dc.units.ordinal should not be called - it is a placeholder")},rt.units.fp={},rt.units.fp.precision=function(t){var r=function(t,e){var n=Math.abs((e-t)/r.resolution);return rt.utils.isNegligible(n-Math.floor(n))?Math.floor(n):Math.ceil(n)};return r.resolution=t,r},rt.round={},rt.round.floor=function(t){return Math.floor(t)},rt.round.ceil=function(t){return Math.ceil(t)},rt.round.round=function(t){return Math.round(t)},rt.override=function(t,e,n){var r=t[e];t["_"+e]=r,t[e]=n},rt.renderlet=function(t){return arguments.length?(rt._renderlet=t,rt):rt._renderlet},rt.instanceOfChart=function(t){return t instanceof Object&&t.__dcFlag__&&!0},Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;0<=--n&&e.item(n)!==this;);return-1<n}),rt.errors={},rt.errors.Exception=function(t){var e=t||"Unexpected internal error";this.message=e,this.toString=function(){return e},this.stack=(new Error).stack},rt.errors.Exception.prototype=Object.create(Error.prototype),rt.errors.Exception.prototype.constructor=rt.errors.Exception,rt.errors.InvalidStateException=function(){rt.errors.Exception.apply(this,arguments)},rt.errors.InvalidStateException.prototype=Object.create(rt.errors.Exception.prototype),rt.errors.InvalidStateException.prototype.constructor=rt.errors.InvalidStateException,rt.errors.BadArgumentException=function(){rt.errors.Exception.apply(this,arguments)},rt.errors.BadArgumentException.prototype=Object.create(rt.errors.Exception.prototype),rt.errors.BadArgumentException.prototype.constructor=rt.errors.BadArgumentException,rt.dateFormat=nt.timeFormat("%m/%d/%Y"),rt.printers={},rt.printers.filters=function(t){for(var e="",n=0;n<t.length;++n)0<n&&(e+=", "),e+=rt.printers.filter(t[n]);return e},rt.printers.filter=function(t){var e="";return null!=t&&(t instanceof Array?2<=t.length?e="["+t.map(function(t){return rt.utils.printSingleValue(t)}).join(" -> ")+"]":1<=t.length&&(e=rt.utils.printSingleValue(t[0])):e=rt.utils.printSingleValue(t)),e},rt.pluck=function(n,r){return r?function(t,e){return r.call(t,t[n],e)}:function(t){return t[n]}},rt.utils={},rt.utils.printSingleValue=function(t){var e=""+t;return t instanceof Date?e=rt.dateFormat(t):"string"==typeof t?e=t:rt.utils.isFloat(t)?e=rt.utils.printSingleValue.fformat(t):rt.utils.isInteger(t)&&(e=Math.round(t)),e},rt.utils.printSingleValue.fformat=nt.format(".2f"),rt.utils.toTimeFunc=function(t){return"time"+t.charAt(0).toUpperCase()+t.slice(1)},rt.utils.add=function(t,e,n){if("string"==typeof e&&(e=e.replace("%","")),t instanceof Date)return"string"==typeof e&&(e=+e),"millis"===n?new Date(t.getTime()+e):("function"!=typeof(n=n||nt.timeDay)&&(n=nt[rt.utils.toTimeFunc(n)]),n.offset(t,e));if("string"!=typeof e)return t+e;var r=+e/100;return 0<t?t*(1+r):t*(1-r)},rt.utils.subtract=function(t,e,n){if("string"==typeof e&&(e=e.replace("%","")),t instanceof Date)return"string"==typeof e&&(e=+e),"millis"===n?new Date(t.getTime()-e):("function"!=typeof(n=n||nt.timeDay)&&(n=nt[rt.utils.toTimeFunc(n)]),n.offset(t,-e));if("string"!=typeof e)return t-e;var r=+e/100;return t<0?t*(1+r):t*(1-r)},rt.utils.isNumber=function(t){return t===+t},rt.utils.isFloat=function(t){return t===+t&&t!==(0|t)},rt.utils.isInteger=function(t){return t===+t&&t===(0|t)},rt.utils.isNegligible=function(t){return!rt.utils.isNumber(t)||t<rt.constants.NEGLIGIBLE_NUMBER&&t>-rt.constants.NEGLIGIBLE_NUMBER},rt.utils.clamp=function(t,e,n){return t<e?e:n<t?n:t},rt.utils.constant=function(t){return function(){return t}};var a,e,n,o,l,u=0;function h(t,e){for(var n=0;n<t.length;n++)if(t[n].key===e)return t[n]}function c(t){return[0,t.length-1]}function s(t){return[nt.quantile(t,.25),nt.quantile(t,.5),nt.quantile(t,.75)]}return rt.utils.uniqueId=function(){return++u},rt.utils.nameToId=function(t){return t.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},rt.utils.appendOrSelect=function(t,e,n){n=n||e;var r=t.select(e);return r.empty()&&(r=t.append(n)),r},rt.utils.safeNumber=function(t){return rt.utils.isNumber(+t)?+t:0},rt.utils.arraysEqual=function(t,n){return!t&&!n||!(!t||!n)&&(t.length===n.length&&t.every(function(t,e){return t.valueOf()===n[e].valueOf()}))},rt.utils.allChildren=function(t){var e=[];if(e.push(t.path),console.log("currentNode",t),t.children)for(var n=0;n<t.children.length;n++)e=e.concat(rt.utils.allChildren(t.children[n]));return e},rt.utils.toHierarchy=function(t,e){for(var n={key:"root",children:[]},r=0;r<t.length;r++)for(var i=t[r],a=i.key,o=e(i),l=n,u=0;u<a.length;u++){var c,s=a.slice(0,u+1),d=l.children,f=a[u];u+1<a.length?(void 0===(c=h(d,f))&&(c={key:f,children:[],path:s},d.push(c)),l=c):(c={key:f,value:o,data:i,path:s},d.push(c))}return n},rt.utils.getAncestors=function(t){for(var e=[],n=t;n.parent;)e.unshift(n.name),n=n.parent;return e},rt.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},"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null===t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),r=1;r<arguments.length;r++){var i=arguments[r];if(null!==i)for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])}return n},writable:!0,configurable:!0}),rt.logger=((a={enableDebugLog:!(e={}),warn:function(t){return console&&(console.warn?console.warn(t):console.log&&console.log(t)),a}}).warnOnce=function(t){return e[t]||(e[t]=!0,rt.logger.warn(t)),a},a.debug=function(t){return a.enableDebugLog&&console&&(console.debug?console.debug(t):console.log&&console.log(t)),a},a.deprecate=function(t,e){var n=!1;return function(){return n||(a.warn(e),n=!0),t.apply(this,arguments)}},a.annotate=function(t,e){var n=!1;return function(){return n||(console.groupCollapsed(e),console.trace(),console.groupEnd(),n=!0),t.apply(this,arguments)}},a),rt.config=(l=o=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"],(n={}).defaultColors=function(t){return arguments.length?(l=t,n):(l===o&&rt.logger.warnOnce("You are using d3.schemeCategory20c, which has been removed in D3v5. See the explanation at https://github.com/d3/d3/blob/master/CHANGES.md#changes-in-d3-50. DC is using it for backward compatibility, however it will be changed in DCv3.1. You can change it by calling dc.config.defaultColors(newScheme). See https://github.com/d3/d3-scale-chromatic for some alternatives."),l)},n),rt.events={current:null},rt.events.trigger=function(t,e){e?(rt.events.current=t,setTimeout(function(){t===rt.events.current&&t()},e)):t()},rt.filters={},rt.filters.RangedFilter=function(t,e){var n=new Array(t,e);return n.isFiltered=function(t){return t>=this[0]&&t<this[1]},n.filterType="RangedFilter",n},rt.filters.TwoDimensionalFilter=function(t){if(null===t)return null;var e=t;return e.isFiltered=function(t){return t.length&&t.length===e.length&&t[0]===e[0]&&t[1]===e[1]},e.filterType="TwoDimensionalFilter",e},rt.filters.RangedTwoDimensionalFilter=function(t){if(null===t)return null;var r,e=t;return r=e[0]instanceof Array?[[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1])],[Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]]:[[t[0],-1/0],[t[1],1/0]],e.isFiltered=function(t){var e,n;return n=t instanceof Array?(e=t[0],t[1]):(e=t,r[0][1]),e>=r[0][0]&&e<r[1][0]&&n>=r[0][1]&&n<r[1][1]},e.filterType="RangedTwoDimensionalFilter",e},rt.filters.HierarchyFilter=function(t){if(null===t)return null;var n=t.slice(0);return n.isFiltered=function(t){if(!(n.length&&t&&t.length&&t.length>=n.length))return!1;for(var e=0;e<n.length;e++)if(t[e]!==n[e])return!1;return!0},n},rt.baseMixin=function(r){var e,n,i,a,o,l;r.__dcFlag__=rt.utils.uniqueId();function u(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().width;return e&&g<e?e:g}function c(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().height;return e&&y<e?e:y}var s,d,f,h,g=200,p=u,y=200,v=c,m=!1,x=rt.pluck("key"),A=rt.pluck("value"),b=rt.pluck("key"),_=rt.pluck("key"),k=!1,D=function(t){return r.keyAccessor()(t)+": "+r.valueAccessor()(t)},w=!0,C=!1,S=750,E=0,L=rt.printers.filters,M=["dimension","group"],R=rt.constants.DEFAULT_CHART_GROUP,O=nt.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),T=[],B=function(t,r){return 0===r.length?t.filter(null):1!==r.length||r[0].isFiltered?1===r.length&&"RangedFilter"===r[0].filterType?t.filterRange(r[0]):t.filterFunction(function(t){for(var e=0;e<r.length;e++){var n=r[e];if(n.isFiltered&&n.isFiltered(t))return!0;if(n<=t&&t<=n)return!0}return!1}):t.filterExact(r[0]),r},F=function(t){return t.all()};function N(){o&&(m?o.attr("viewBox")||o.attr("viewBox","0 0 "+r.width()+" "+r.height()):o.attr("width",r.width()).attr("height",r.height()))}function H(t){if(!r[t]||!r[t]())throw new rt.errors.InvalidStateException("Mandatory attribute chart."+t+" is missing on chart[#"+r.anchorName()+"]")}r.height=function(t){return arguments.length?(v=t?"function"==typeof t?t:rt.utils.constant(t):c,d=void 0,r):(rt.utils.isNumber(d)||(d=v(a.node())),d)},r.width=function(t){return arguments.length?(p=t?"function"==typeof t?t:rt.utils.constant(t):u,s=void 0,r):(rt.utils.isNumber(s)||(s=p(a.node())),s)},r.minWidth=function(t){return arguments.length?(g=t,r):g},r.minHeight=function(t){return arguments.length?(y=t,r):y},r.useViewBoxResizing=function(t){return arguments.length?(m=t,r):m},r.dimension=function(t){return arguments.length?(e=t,r.expireCache(),r):e},r.data=function(t){return arguments.length?(F="function"==typeof t?t:rt.utils.constant(t),r.expireCache(),r):F.call(r,n)},r.group=function(t,e){return arguments.length?(n=t,r._groupName=e,r.expireCache(),r):n},r.ordering=function(t){return arguments.length?(_=t,r.expireCache(),r):_},r._computeOrderedGroups=function(t){return Array.from(t).sort(function(t,e){return _(t)-_(e)})},r.filterAll=function(){return r.filter(null)},r.select=function(t){return a.select(t)},r.selectAll=function(t){return a?a.selectAll(t):null},r.anchor=function(t,e){if(!arguments.length)return i;if(rt.instanceOfChart(t))(i=t.anchor()).children&&(i="#"+t.anchorName()),a=t.root(),l=!0;else{if(!t)throw new rt.errors.BadArgumentException("parent must be defined");i=t.select&&t.classed?t.node():t,(a=nt.select(i)).classed(rt.constants.CHART_CLASS,!0),rt.registerChart(r,e),l=!1}return R=e,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?(a=t,r):a},r.svg=function(t){return arguments.length?(o=t,r):o},r.resetSvg=function(){return r.select("svg").remove(),o=r.root().append("svg"),N(),o},r.filterPrinter=function(t){return arguments.length?(L=t,r):L},r.controlsUseVisibility=function(t){return arguments.length?(C=t,r):C},r.turnOnControls=function(){if(a){var t=r.controlsUseVisibility()?"visibility":"display";r.selectAll(".reset").style(t,null),r.selectAll(".filter").text(L(r.filters())).style(t,null)}return r},r.turnOffControls=function(){if(a){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?(S=t,r):S},r.transitionDelay=function(t){return arguments.length?(E=t,r):E},r._mandatoryAttributes=function(t){return arguments.length?(M=t,r):M},r.render=function(){d=s=void 0,O.call("preRender",r,r),M&&M.forEach(H);var t=r._doRender();return f&&f.render(),r._activateRenderlets("postRender"),t},r._activateRenderlets=function(t){O.call("pretransition",r,r),0<r.transitionDuration()&&o?o.transition().duration(r.transitionDuration()).delay(r.transitionDelay()).on("end",function(){O.call("renderlet",r,r),t&&O.call(t,r,r)}):(O.call("renderlet",r,r),t&&O.call(t,r,r))},r.redraw=function(){N(),O.call("preRedraw",r,r);var t=r._doRedraw();return f&&f.render(),r._activateRenderlets("postRedraw"),t},r.commitHandler=function(t){return arguments.length?(h=t,r):h},r.redrawGroup=function(){return h?h(!1,function(t,e){t?console.log(t):rt.redrawAll(r.chartGroup())}):rt.redrawAll(r.chartGroup()),r},r.renderGroup=function(){return h?h(!1,function(t,e){t?console.log(t):rt.renderAll(r.chartGroup())}):rt.renderAll(r.chartGroup()),r},r._invokeFilteredListener=function(t){void 0!==t&&O.call("filtered",r,r,t)},r._invokeZoomedListener=function(){O.call("zoomed",r,r)};var G=function(t,e){return null==e?0<t.length:t.some(function(t){return e<=t&&t<=e})};r.hasFilterHandler=function(t){return arguments.length?(G=t,r):G},r.hasFilter=function(t){return G(T,t)};var P=function(t,e){for(var n=0;n<t.length;n++)if(t[n]<=e&&t[n]>=e){t.splice(n,1);break}return t};r.removeFilterHandler=function(t){return arguments.length?(P=t,r):P};var I=function(t,e){return t.push(e),t};r.addFilterHandler=function(t){return arguments.length?(I=t,r):I};var U=function(t){return[]};return r.resetFilterHandler=function(t){return arguments.length?(U=t,r):U},r.replaceFilter=function(t){return T=U(T),r.filter(t),r},r.filter=function(t){if(!arguments.length)return 0<T.length?T[0]:null;var e=T;return t instanceof Array&&t[0]instanceof Array&&!t.isFiltered?t[0].forEach(function(t){e=G(e,t)?P(e,t):I(e,t)}):e=null===t?U(e):G(e,t)?P(e,t):I(e,t),T=function(t){if(r.dimension()&&r.dimension().filter){var e=B(r.dimension(),t);e&&(t=e)}return t}(e),r._invokeFilteredListener(t),null!==a&&r.hasFilter()?r.turnOnControls():r.turnOffControls(),r},r.filters=function(){return T},r.highlightSelected=function(t){nt.select(t).classed(rt.constants.SELECTED_CLASS,!0),nt.select(t).classed(rt.constants.DESELECTED_CLASS,!1)},r.fadeDeselected=function(t){nt.select(t).classed(rt.constants.SELECTED_CLASS,!1),nt.select(t).classed(rt.constants.DESELECTED_CLASS,!0)},r.resetHighlight=function(t){nt.select(t).classed(rt.constants.SELECTED_CLASS,!1),nt.select(t).classed(rt.constants.DESELECTED_CLASS,!1)},r.onClick=function(t){var e=r.keyAccessor()(t);rt.events.trigger(function(){r.filter(e),r.redrawGroup()})},r.filterHandler=function(t){return arguments.length?(B=t,r):B},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?(x=t,r):x},r.valueAccessor=function(t){return arguments.length?(A=t,r):A},r.label=function(t,e){return arguments.length?(b=t,void 0!==e&&!e||(k=!0),r):b},r.renderLabel=function(t){return arguments.length?(k=t,r):k},r.title=function(t){return arguments.length?(D=t,r):D},r.renderTitle=function(t){return arguments.length?(w=t,r):w},r.renderlet=rt.logger.deprecate(function(t){return r.on("renderlet."+rt.utils.uniqueId(),t),r},'chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)'),r.chartGroup=function(t){return arguments.length?(l||rt.deregisterChart(r,R),R=t,l||rt.registerChart(r,R),r):R},r.expireCache=function(){return r},r.legend=function(t){return arguments.length?((f=t).parent(r),r):f},r.chartID=function(){return r.__dcFlag__},r.options=function(t){var e=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(var n in t)"function"==typeof r[n]?t[n]instanceof Array&&-1!==e.indexOf(n)?r[n].apply(r,t[n]):r[n].call(r,t[n]):rt.logger.debug("Not a valid option setter name: "+n);return r},r.on=function(t,e){return O.on(t,e),r},r},rt.marginMixin=function(e){var n={top:10,right:50,bottom:30,left:30};return e.margins=function(t){return arguments.length?(n=t,e):n},e.effectiveWidth=function(){return e.width()-e.margins().left-e.margins().right},e.effectiveHeight=function(){return e.height()-e.margins().top-e.margins().bottom},e},rt.colorMixin=function(e){var n,r=nt.scaleOrdinal(rt.config.defaultColors()),i=!0,a=function(t){return e.keyAccessor()(t)};return e.colors=function(t){return arguments.length?(r=t instanceof Array?nt.scaleQuantize().range(t):"function"==typeof t?t:rt.utils.constant(t),e):r},e.ordinalColors=function(t){return e.colors(nt.scaleOrdinal().range(t))},e.linearColors=function(t){return e.colors(nt.scaleLinear().range(t).interpolate(nt.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 t=[nt.min(e.data(),e.colorAccessor()),nt.max(e.data(),e.colorAccessor())];return r.domain(t),e},e.getColor=function(t,e){return n?n.call(this,t,e):r(a.call(this,t,e))},e.colorCalculator=function(t){return arguments.length?(n=t,e):n||e.getColor},e},rt.coordinateGridMixin=function(l){var i,n,r,a,e,o,u="grid-line",c="horizontal",s="vertical",d="y-axis-label",f="x-axis-label",h="custom-brush-handle";(l=rt.colorMixin(rt.marginMixin(rt.baseMixin(l)))).colors(nt.scaleOrdinal(nt.schemeCategory10)),l._mandatoryAttributes().push("x");var g,p,y,v,m,x,t,A,b,_=nt.axisBottom(),k=rt.units.integers,D=0,w=nt.timeDay,C=!1,S=0,E=null,L=0,M=!1,R=0,O=nt.brushX(),T=!0,B=!1,F=!1,N=!1,H=!1,G=[1,1/0],P=!0,I=nt.zoom().on("zoom",function(){if(!nt.event.sourceEvent)return;if(nt.event.sourceEvent.type&&-1!==["start","zoom","end"].indexOf(nt.event.sourceEvent.type))return;var t=nt.event.transform.rescaleX(e).domain();l.focus(t,!1)}),U=nt.zoom().on("zoom",null),Y=!1,z=!1,V=0,j=.5,q=0,X=!1;function W(t,e){l.isOrdinal()?(a.bandwidth||(rt.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!"),a=nt.scaleBand().domain(a.domain())),!l.elasticX()&&0!==a.domain().length||a.domain(l._ordinalXDomain())):l.elasticX()&&a.domain([l.xAxisMin(),l.xAxisMax()]);var n=a.domain();!e&&rt.utils.arraysEqual(p,n)||l.rescale(),p=n,l.isOrdinal()?a.range([0,l.xAxisLength()]).paddingInner(q).paddingOuter(l._useOuterPadding()?j:0):a.range([0,l.xAxisLength()]),_=_.scale(l.x()),function(t){var e=t.select("g."+s);if(N){e.empty()&&(e=t.insert("g",":first-child").attr("class",u+" "+s).attr("transform","translate("+l.margins().left+","+l.margins().top+")"));var n=_.tickValues()?_.tickValues():"function"==typeof a.ticks?a.ticks.apply(a,_.tickArguments()):a.domain(),r=e.selectAll("line").data(n),i=r.enter().append("line").attr("x1",function(t){return a(t)}).attr("y1",l._xAxisY()-l.margins().top).attr("x2",function(t){return a(t)}).attr("y2",0).attr("opacity",0);rt.transition(i,l.transitionDuration(),l.transitionDelay()).attr("opacity",.5),rt.transition(r,l.transitionDuration(),l.transitionDelay()).attr("x1",function(t){return a(t)}).attr("y1",l._xAxisY()-l.margins().top).attr("x2",function(t){return a(t)}).attr("y2",0),r.exit().remove()}else e.selectAll("line").remove()}(t)}function K(){return X?nt.axisRight():nt.axisLeft()}function Z(){return l.anchorName().replace(/[ .#=\[\]"]/g,"-")+"-clip"}function J(){var t=rt.utils.appendOrSelect(i,"defs"),e=Z(),n=rt.utils.appendOrSelect(t,"#"+e,"clipPath").attr("id",e),r=2*V;rt.utils.appendOrSelect(n,"rect").attr("width",l.xAxisLength()+r).attr("height",l.yAxisHeight()+r).attr("transform","translate(-"+V+", -"+V+")")}function Q(t){l.isOrdinal()&&(T=!1),W(l.g(),t),l._prepareYAxis(l.g()),l.plotData(),(l.elasticX()||H||t)&&l.renderXAxis(l.g()),(l.elasticY()||H||t)&&l.renderYAxis(l.g()),t?l.renderBrush(l.g(),!1):l.redrawBrush(l.filter(),H),l.fadeDeselectedArea(l.filter()),H=!1}function $(t,e){var n;n=function(t){return t instanceof Array&&1<t.length}(t)?(l.x().domain(t),rt.filters.RangedFilter(t[0],t[1])):(l.x().domain(o),null),l.replaceFilter(n),l.rescale(),l.redraw(),e||(A&&!rt.utils.arraysEqual(l.filter(),A.filter())&&rt.events.trigger(function(){A.replaceFilter(n),A.redraw()}),l._invokeZoomedListener(),rt.events.trigger(function(){l.redrawGroup()},rt.constants.EVENT_DELAY))}function tt(){I&&I.transform(l.root(),function(t,e,n){var r=(e[1]-e[0])/(t[1]-t[0]),i=-1*n(t[0]);return nt.zoomIdentity.scale(r).translate(i,0)}(l.x().domain(),o,e))}function et(t,e){return t&&2===t.length&&e&&2===e.length?((t[0]>e[1]||t[1]<e[0])&&console.warn("Could not intersect extents, will reset"),[t[0]>e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1]]):t}return l.rescale=function(){return H=!(t=void 0),l},l.resizing=function(){return H},l.rangeChart=function(t){return arguments.length?((A=t).focusChart(l),l):A},l.zoomScale=function(t){return arguments.length?(G=t,l):G},l.zoomOutRestrict=function(t){return arguments.length?(P=t,l):P},l._generateG=function(t){i=void 0===t?l.svg():t;var e=window.location.href.split("#")[0];return n=i.append("g"),r=n.append("g").attr("class","chart-body").attr("transform","translate("+l.margins().left+", "+l.margins().top+")").attr("clip-path","url("+e+"#"+Z()+")"),n},l.g=function(t){return arguments.length?(n=t,l):n},l.mouseZoomable=function(t){return arguments.length?(z=t,l):z},l.chartBodyG=function(t){return arguments.length?(r=t,l):r},l.x=function(t){return arguments.length?(o=(a=t).domain(),l.rescale(),l):a},l.xOriginalDomain=function(){return o},l.xUnits=function(t){return arguments.length?(k=t,l):k},l.xAxis=function(t){return arguments.length?(_=t,l):_},l.elasticX=function(t){return arguments.length?(C=t,l):C},l.xAxisPadding=function(t){return arguments.length?(D=t,l):D},l.xAxisPaddingUnit=function(t){return arguments.length?(w=t,l):w},l.xUnitCount=function(){return void 0===t&&(l.isOrdinal()?t=l.x().domain().length:(t=l.xUnits()(l.x().domain()[0],l.x().domain()[1]))instanceof Array&&(t=t.length)),t},l.useRightYAxis=function(t){return arguments.length?(X!==t&&E&&rt.logger.warn("Value of useRightYAxis has been altered, after yAxis was created. You might get unexpected yAxis behavior. Make calls to useRightYAxis sooner in your chart creation process."),X=t,l):X},l.isOrdinal=function(){return l.xUnits()===rt.units.ordinal},l._useOuterPadding=function(){return!0},l._ordinalXDomain=function(){return l._computeOrderedGroups(l.data()).map(l.keyAccessor())},l.renderXAxis=function(t){var e=t.select("g.x");e.empty()&&(e=t.append("g").attr("class","axis x").attr("transform","translate("+l.margins().left+","+l._xAxisY()+")"));var n=t.select("text."+f);n.empty()&&l.xAxisLabel()&&(n=t.append("text").attr("class",f).attr("transform","translate("+(l.margins().left+l.xAxisLength()/2)+","+(l.height()-S)+")").attr("text-anchor","middle")),l.xAxisLabel()&&n.text()!==l.xAxisLabel()&&n.text(l.xAxisLabel()),rt.transition(e,l.transitionDuration(),l.transitionDelay()).attr("transform","translate("+l.margins().left+","+l._xAxisY()+")").call(_),rt.transition(n,l.transitionDuration(),l.transitionDelay()).attr("transform","translate("+(l.margins().left+l.xAxisLength()/2)+","+(l.height()-S)+")")},l._xAxisY=function(){return l.height()-l.margins().bottom},l.xAxisLength=function(){return l.effectiveWidth()},l.xAxisLabel=function(t,e){return arguments.length?(g=t,l.margins().bottom-=S,S=void 0===e?12:e,l.margins().bottom+=S,l):g},l._prepareYAxis=function(t){if(void 0===y||l.elasticY()){void 0===y&&(y=nt.scaleLinear());var e=l.yAxisMin()||0,n=l.yAxisMax()||0;y.domain([e,n]).rangeRound([l.yAxisHeight(),0])}y.range([l.yAxisHeight(),0]),(E=E||K()).scale(y),l._renderHorizontalGridLinesForAxis(t,y,E)},l.renderYAxisLabel=function(t,e,n,r){r=r||R;var i=l.g().select("text."+d+"."+t+"-label"),a=l.margins().top+l.yAxisHeight()/2;i.empty()&&e&&(i=l.g().append("text").attr("transform","translate("+r+","+a+"),rotate("+n+")").attr("class",d+" "+t+"-label").attr("text-anchor","middle").text(e)),e&&i.text()!==e&&i.text(e),rt.transition(i,l.transitionDuration(),l.transitionDelay()).attr("transform","translate("+r+","+a+"),rotate("+n+")")},l.renderYAxisAt=function(t,e,n){var r=l.g().select("g."+t);r.empty()&&(r=l.g().append("g").attr("class","axis "+t).attr("transform","translate("+n+","+l.margins().top+")")),rt.transition(r,l.transitionDuration(),l.transitionDelay()).attr("transform","translate("+n+","+l.margins().top+")").call(e)},l.renderYAxis=function(){var t=X?l.width()-l.margins().right:l._yAxisX();l.renderYAxisAt("y",E,t);var e=X?l.width()-R:R,n=X?90:-90;l.renderYAxisLabel("y",l.yAxisLabel(),n,e)},l._renderHorizontalGridLinesForAxis=function(t,e,n){var r=t.select("g."+c);if(F){var i=n.tickValues()?n.tickValues():e.ticks?e.ticks.apply(e,n.tickArguments()):e.domain();r.empty()&&(r=t.insert("g",":first-child").attr("class",u+" "+c).attr("transform","translate("+l.margins().left+","+l.margins().top+")"));var a=r.selectAll("line").data(i),o=a.enter().append("line").attr("x1",1).attr("y1",function(t){return e(t)}).attr("x2",l.xAxisLength()).attr("y2",function(t){return e(t)}).attr("opacity",0);rt.transition(o,l.transitionDuration(),l.transitionDelay()).attr("opacity",.5),rt.transition(a,l.transitionDuration(),l.transitionDelay()).attr("x1",1).attr("y1",function(t){return e(t)}).attr("x2",l.xAxisLength()).attr("y2",function(t){return e(t)}),a.exit().remove()}else r.selectAll("line").remove()},l._yAxisX=function(){return l.useRightYAxis()?l.width()-l.margins().right:l.margins().left},l.yAxisLabel=function(t,e){return arguments.length?(v=t,l.margins().left-=R,R=void 0===e?12:e,l.margins().left+=R,l):v},l.y=function(t){return arguments.length?(y=t,l.rescale(),l):y},l.yAxis=function(t){return arguments.length?(E=t,l):E=E||K()},l.elasticY=function(t){return arguments.length?(M=t,l):M},l.renderHorizontalGridLines=function(t){return arguments.length?(F=t,l):F},l.renderVerticalGridLines=function(t){return arguments.length?(N=t,l):N},l.xAxisMin=function(){var t=nt.min(l.data(),function(t){return l.keyAccessor()(t)});return rt.utils.subtract(t,D,w)},l.xAxisMax=function(){var t=nt.max(l.data(),function(t){return l.keyAccessor()(t)});return rt.utils.add(t,D,w)},l.yAxisMin=function(){var t=nt.min(l.data(),function(t){return l.valueAccessor()(t)});return rt.utils.subtract(t,L)},l.yAxisMax=function(){var t=nt.max(l.data(),function(t){return l.valueAccessor()(t)});return rt.utils.add(t,L)},l.yAxisPadding=function(t){return arguments.length?(L=t,l):L},l.yAxisHeight=function(){return l.effectiveHeight()},l.round=function(t){return arguments.length?(x=t,l):x},l._rangeBandPadding=function(t){return arguments.length?(q=t,l):q},l._outerRangeBandPadding=function(t){return arguments.length?(j=t,l):j},rt.override(l,"filter",function(t){return arguments.length?(l._filter(t),l.redrawBrush(t,!1),l):l._filter()}),l.brush=function(t){return arguments.length?(O=t,l):O},l.renderBrush=function(t,e){T&&(O.on("start brush end",l._brushing),m=t.append("g").attr("class","brush").attr("transform","translate("+l.margins().left+","+l.margins().top+")"),l.setBrushExtents(),l.createBrushHandlePaths(m,e),l.redrawBrush(l.filter(),e))},l.createBrushHandlePaths=function(t){var e=t.selectAll("path."+h).data([{type:"w"},{type:"e"}]);(e=e.enter().append("path").attr("class",h).merge(e)).attr("d",l.resizeHandlePath)},l.extendBrush=function(t){return t&&l.round()&&(t[0]=l.round()(t[0]),t[1]=l.round()(t[1])),t},l.brushIsEmpty=function(t){return!t||t[1]<=t[0]},l._brushing=function(){if(nt.event.sourceEvent&&(!nt.event.sourceEvent.type||-1===["start","brush","end"].indexOf(nt.event.sourceEvent.type))){var t=nt.event.selection;t=t&&t.map(l.x().invert),t=l.extendBrush(t),l.redrawBrush(t,!1);var e=l.brushIsEmpty(t)?null:rt.filters.RangedFilter(t[0],t[1]);rt.events.trigger(function(){l.applyBrushSelection(e)},rt.constants.EVENT_DELAY)}},l.applyBrushSelection=function(t){l.replaceFilter(t),l.redrawGroup()},l.setBrushExtents=function(t){O.extent([[0,0],[l.effectiveWidth(),l.effectiveHeight()]]),m.call(O)},l.redrawBrush=function(n,t){if(T&&m)if(H&&l.setBrushExtents(t),n){var e=[a(n[0]),a(n[1])],r=rt.optionalTransition(t,l.transitionDuration(),l.transitionDelay())(m);r.call(O.move,e),r.selectAll("path."+h).attr("display",null).attr("transform",function(t,e){return"translate("+a(n[e])+", 0)"}).attr("d",l.resizeHandlePath)}else m.call(O.move,null),m.selectAll("path."+h).attr("display","none");l.fadeDeselectedArea(n)},l.fadeDeselectedArea=function(t){},l.resizeHandlePath=function(t){var e=+("e"===(t=t.type)),n=e?1:-1,r=l.effectiveHeight()/3;return"M"+.5*n+","+r+"A6,6 0 0 "+e+" "+6.5*n+","+(6+r)+"V"+(2*r-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*r+"ZM"+2.5*n+","+(8+r)+"V"+(2*r-8)+"M"+4.5*n+","+(8+r)+"V"+(2*r-8)},l.clipPadding=function(t){return arguments.length?(V=t,l):V},l._preprocessData=function(){},l._doRender=function(){return l.resetSvg(),l._preprocessData(),l._generateG(),J(),Q(!0),e=a.copy(),z?l._enableMouseZoom():Y&&l._disableMouseZoom(),l},l._doRedraw=function(){return l._preprocessData(),Q(!1),J(),l},l._enableMouseZoom=function(){Y=!0;var t=[[0,0],[l.effectiveWidth(),l.effectiveHeight()]];if(I.scaleExtent(G).extent(t).duration(l.transitionDuration()),P){var e=Math.max(G[0],1);I.translateExtent(t).scaleExtent([e,G[1]])}l.root().call(I),tt()},l._disableMouseZoom=function(){l.root().call(U)},l.focus=function(t,e){P&&(t=et(t,o),A&&(t=et(t,A.x().domain()))),$(t,e),tt()},l.refocused=function(){return!rt.utils.arraysEqual(l.x().domain(),o)},l.focusChart=function(t){return arguments.length?(b=t,l.on("filtered.dcjs-range-chart",function(t){t.filter()?rt.utils.arraysEqual(t.filter(),b.filter())||rt.events.trigger(function(){b.focus(t.filter(),!0)}):rt.events.trigger(function(){b.x().domain(b.xOriginalDomain(),!0)})}),l):b},l.brushOn=function(t){return arguments.length?(T=t,l):T},l.parentBrushOn=function(t){return arguments.length?(B=t,l):B},l.gBrush=function(){return m},l},rt.stackMixin=function(i){function n(n,t){var r=n.accessor||i.valueAccessor();n.name=String(n.name||t);var e=n.group.all().map(function(t,e){return{x:i.keyAccessor()(t,e),y:n.hidden?null:r(t,e),data:t,layer:n.name,hidden:n.hidden}});n.domainValues=e.filter(function(){if(!i.x())return rt.utils.constant(!0);var e=i.x().domain();if(i.isOrdinal())return function(){return!0};if(i.elasticX())return function(){return!0};return function(t){return t.x>=e[0]&&t.x<=e[e.length-1]}}()),n.values=i.evadeDomainFilter()?e:n.domainValues}var e=nt.stack(),a=[],r={},o=!1,l=!1;function u(t){var e=a.map(rt.pluck("name")).indexOf(t);return a[e]}function c(){var t=i.data().map(function(t){return t.domainValues});return Array.prototype.concat.apply([],t)}function s(t){return!t.hidden}return i.stack=function(t,e,n){if(!arguments.length)return a;arguments.length<=2&&(n=e);var r={group:t};return"string"==typeof e&&(r.name=e),"function"==typeof n&&(r.accessor=n),a.push(r),i},rt.override(i,"group",function(t,e,n){return arguments.length?(a=[],r={},i.stack(t,e),n&&i.valueAccessor(n),i._group(t,e)):i._group()}),i.hidableStacks=function(t){return arguments.length?(o=t,i):o},i.hideStack=function(t){var e=u(t);return e&&(e.hidden=!0),i},i.showStack=function(t){var e=u(t);return e&&(e.hidden=!1),i},i.getValueAccessorByIndex=function(t){return a[t].accessor||i.valueAccessor()},i.yAxisMin=function(){var t=nt.min(c(),function(t){return t.y<0?t.y+t.y0:t.y0});return rt.utils.subtract(t,i.yAxisPadding())},i.yAxisMax=function(){var t=nt.max(c(),function(t){return 0<t.y?t.y+t.y0:t.y0});return rt.utils.add(t,i.yAxisPadding())},i.xAxisMin=function(){var t=nt.min(c(),rt.pluck("x"));return rt.utils.subtract(t,i.xAxisPadding(),i.xAxisPaddingUnit())},i.xAxisMax=function(){var t=nt.max(c(),rt.pluck("x"));return rt.utils.add(t,i.xAxisPadding(),i.xAxisPaddingUnit())},rt.override(i,"title",function(t,e){return t?"function"==typeof t?i._title(t):t===i._groupName&&"function"==typeof e?i._title(e):"function"!=typeof e?r[t]||i._title():(r[t]=e,i):i._title()}),i.stackLayout=function(t){return arguments.length?(e=t,i):e},i.evadeDomainFilter=function(t){return arguments.length?(l=t,i):l},i.data(function(){var r=a.filter(s);if(!r.length)return[];r.forEach(n);var t=r[0].values.map(function(t,e){var n={x:t.x};return r.forEach(function(t){n[t.name]=t.values[e].y}),n}),e=r.map(function(t){return t.name});return i.stackLayout().keys(e)(t).forEach(function(t,n){t.forEach(function(t,e){r[n].values[e].y0=t[0],r[n].values[e].y1=t[1]})}),r}),i._ordinalXDomain=function(){var t=c().map(rt.pluck("data"));return i._computeOrderedGroups(t).map(i.keyAccessor())},i.colorAccessor(function(t){return this.layer||this.name||t.name||t.layer}),i.legendables=function(){return a.map(function(t,e){return{chart:i,name:t.name,hidden:t.hidden||!1,color:i.getColor.call(t,t.values,e)}})},i.isLegendableHidden=function(t){var e=u(t.name);return!!e&&e.hidden},i.legendToggle=function(t){o&&(i.isLegendableHidden(t)?i.showStack(t.name):i.hideStack(t.name),i.renderGroup())},i},rt.capMixin=function(i){var a=1/0,o=!0,e="Others";i.ordering(function(t){return-t.value});var l=function(t,e){var n=nt.sum(e,i.valueAccessor()),r=e.map(i.keyAccessor());return 0<n?t.concat([{others:r,key:i.othersLabel(),value:n}]):t};return i.cappedKeyAccessor=function(t,e){return t.others?t.key:i.keyAccessor()(t,e)},i.cappedValueAccessor=function(t,e){return t.others?t.value:i.valueAccessor()(t,e)},i.data(function(t){if(a===1/0)return i._computeOrderedGroups(t.all());var e,n=t.all();if(n=i._computeOrderedGroups(n),a)if(o)e=n.slice(a),n=n.slice(0,a);else{var r=Math.max(0,n.length-a);e=n.slice(0,r),n=n.slice(r)}return l?l(n,e):n}),i.cap=function(t){return arguments.length?(a=t,i):a},i.takeFront=function(t){return arguments.length?(o=t,i):o},i.othersLabel=function(t){return arguments.length?(e=t,i):e},i.othersGrouper=function(t){return arguments.length?(l=t,i):l},rt.override(i,"onClick",function(t){t.others&&i.filter([t.others]),i._onClick(t)}),i},rt.bubbleMixin=function(r){var e=.3,n=10,i=!1,a=!1;r.BUBBLE_NODE_CLASS="node",r.BUBBLE_CLASS="bubble",r.MIN_RADIUS=10,(r=rt.colorMixin(r)).renderLabel(!0),r.data(function(t){var e=t.all();if(i){var n=r.radiusValueAccessor();e.sort(function(t,e){return nt.descending(n(t),n(e))})}return e});var o=nt.scaleLinear().domain([0,100]),l=function(t){return t.r};r.r=function(t){return arguments.length?(o=t,r):o},r.elasticRadius=function(t){return arguments.length?(a=t,r):a},r.calculateRadiusDomain=function(){a&&r.r().domain([r.rMin(),r.rMax()])},r.radiusValueAccessor=function(t){return arguments.length?(l=t,r):l},r.rMin=function(){return nt.min(r.data(),function(t){return r.radiusValueAccessor()(t)})},r.rMax=function(){return nt.max(r.data(),function(t){return r.radiusValueAccessor()(t)})},r.bubbleR=function(t){var e=r.radiusValueAccessor()(t),n=r.r()(e);return(isNaN(n)||e<=0)&&(n=0),n};function u(t){return r.label()(t)}function c(t){return r.bubbleR(t)>n}function s(t){return c(t)?1:0}function d(t){return c(t)?"all":"none"}r._doRenderLabel=function(t){if(r.renderLabel()){var e=t.select("text");e.empty()&&(e=t.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",r.onClick)),e.attr("opacity",0).attr("pointer-events",d).text(u),rt.transition(e,r.transitionDuration(),r.transitionDelay()).attr("opacity",s)}},r.doUpdateLabels=function(t){if(r.renderLabel()){var e=t.select("text").attr("pointer-events",d).text(u);rt.transition(e,r.transitionDuration(),r.transitionDelay()).attr("opacity",s)}};function f(t){return r.title()(t)}return r._doRenderTitles=function(t){r.renderTitle()&&t.select("title").empty()&&t.append("title").text(f)},r.doUpdateTitles=function(t){r.renderTitle()&&t.select("title").text(f)},r.sortBubbleSize=function(t){return arguments.length?(i=t,r):i},r.minRadius=function(t){return arguments.length?(r.MIN_RADIUS=t,r):r.MIN_RADIUS},r.minRadiusWithLabel=function(t){return arguments.length?(n=t,r):n},r.maxBubbleRelativeSize=function(t){return arguments.length?(e=t,r):e},r.fadeDeselectedArea=function(t){r.hasFilter()?r.selectAll("g."+r.BUBBLE_NODE_CLASS).each(function(t){r.isSelectedNode(t)?r.highlightSelected(this):r.fadeDeselected(this)}):r.selectAll("g."+r.BUBBLE_NODE_CLASS).each(function(){r.resetHighlight(this)})},r.isSelectedNode=function(t){return r.hasFilter(t.key)},r.onClick=function(t){var e=t.key;rt.events.trigger(function(){r.filter(e),r.redrawGroup()})},r},rt.pieChart=function(t,e){var o,l,u,n,r,c,s="pie-slice",d="pie-label",f="pie-slice-group",h="pie-label-group",g="empty-chart",p="empty",i=0,a=0,y=.5,v=!1,m=rt.capMixin(rt.colorMixin(rt.baseMixin({})));function x(){var t=nt.min([m.width(),m.height()])/2;o=l&&l<t?l:t;var e,n=k(),r=nt.pie().sort(null).value(m.cappedValueAccessor);if(nt.sum(m.data(),m.cappedValueAccessor)?(e=r(m.data()),u.classed(g,!1)):(e=r([{key:p,value:1,others:[p]}]),u.classed(g,!0)),u){var i=u.select("g."+f).selectAll("g."+s).data(e),a=u.select("g."+h).selectAll("text."+d).data(e);!function(t,e){t.exit().remove(),e.exit().remove()}(i,a),function(t,e,n,r){var i=function(t){return t.enter().append("g").attr("class",function(t,e){return s+" _"+e})}(t);(function(t,n){var e=t.append("path").attr("fill",C).on("click",S).attr("d",function(t,e){return E(t,e,n)}),r=rt.transition(e,m.transitionDuration(),m.transitionDelay());r.attrTween&&r.attrTween("d",w)})(i,n),function(t){m.renderTitle()&&t.append("title").text(function(t){return m.title()(t.data)})}(i),function(t,e,n){if(m.renderLabel()){A(t.enter().append("text").attr("class",function(t,e){var n=s+" "+d+" _"+e;return c&&(n+=" external"),n}).on("click",S).on("mouseover",function(t,e){b(e,!0)}).on("mouseout",function(t,e){b(e,!1)}),n),c&&v&&_(e,n)}}(e,r,n)}(i,a,n,e),function(t,e){(function(t,n){var e=u.selectAll("g."+s).data(t).select("path").attr("d",function(t,e){return E(t,e,n)}),r=rt.transition(e,m.transitionDuration(),m.transitionDelay());r.attrTween&&r.attrTween("d",w);r.attr("fill",C)})(t,e),function(t,e){if(m.renderLabel()){A(u.selectAll("text."+d).data(t),e),c&&v&&_(t,e)}}(t,e),function(t){m.renderTitle()&&u.selectAll("g."+s).data(t).select("title").text(function(t){return m.title()(t.data)})}(t)}(e,n),m.hasFilter()?m.selectAll("g."+s).each(function(t){D(t)?m.highlightSelected(this):m.fadeDeselected(this)}):m.selectAll("g."+s).each(function(){m.resetHighlight(this)}),rt.transition(u,m.transitionDuration(),m.transitionDelay()).attr("transform","translate("+m.cx()+","+m.cy()+")")}}function A(t,e){m._applyLabelText(t),rt.transition(t,m.transitionDuration(),m.transitionDelay()).attr("transform",function(t){return function(t,e){var n;n=c?nt.arc().outerRadius(o-a+c).innerRadius(o-a+c).centroid(t):e.centroid(t);return isNaN(n[0])||isNaN(n[1])?"translate(0,0)":"translate("+n+")"}(t,e)}).attr("text-anchor","middle")}function b(t,e){m.select("g.pie-slice._"+t).classed("highlight",e)}function _(t,r){var e=u.selectAll("polyline."+s).data(t);e.exit().remove(),e=e.enter().append("polyline").attr("class",function(t,e){return"pie-path _"+e+" "+s}).on("click",S).on("mouseover",function(t,e){b(e,!0)}).on("mouseout",function(t,e){b(e,!1)}).merge(e);var i=nt.arc().outerRadius(o-a+c).innerRadius(o-a),n=rt.transition(e,m.transitionDuration(),m.transitionDelay());n.attrTween?n.attrTween("points",function(t){var e=this._current||t;e={startAngle:e.startAngle,endAngle:e.endAngle};var n=nt.interpolate(e,t);return this._current=n(0),function(t){var e=n(t);return[r.centroid(e),i.centroid(e)]}}):n.attr("points",function(t){return[r.centroid(t),i.centroid(t)]}),n.style("visibility",function(t){return t.endAngle-t.startAngle<1e-4?"hidden":"visible"})}function k(){return nt.arc().outerRadius(o-a).innerRadius(i)}function D(t){return m.hasFilter(m.cappedKeyAccessor(t.data))}function w(t){t.innerRadius=i;var e=this._current;e=function(t){return!t||isNaN(t.startAngle)||isNaN(t.endAngle)}(e)?{startAngle:0,endAngle:0}:{startAngle:e.startAngle,endAngle:e.endAngle};var n=nt.interpolate(e,t);return this._current=n(0),function(t){return E(n(t),0,k())}}function C(t,e){return m.getColor(t.data,e)}function S(t,e){u.attr("class")!==g&&m.onClick(t.data,e)}function E(t,e,n){var r=n(t,e);return 0<=r.indexOf("NaN")&&(r="M0,0"),r}function L(e,n){m.selectAll("g.pie-slice").each(function(t){e.name===t.data.key&&nt.select(this).classed("highlight",n)})}return m.colorAccessor(m.cappedKeyAccessor),m.title(function(t){return m.cappedKeyAccessor(t)+": "+m.cappedValueAccessor(t)}),m.slicesCap=m.cap,m.label(m.cappedKeyAccessor),m.renderLabel(!0),m.transitionDuration(350),m.transitionDelay(0),m._doRender=function(){return m.resetSvg(),(u=m.svg().append("g").attr("transform","translate("+m.cx()+","+m.cy()+")")).append("g").attr("class",f),u.append("g").attr("class",h),x(),m},m._applyLabelText=function(t){t.text(function(t){return!function(t){return 0===m.cappedValueAccessor(t)}(t.data)&&!function(t){var e=t.endAngle-t.startAngle;return isNaN(e)||e<y}(t)||D(t)?m.label()(t.data):""})},m.externalRadiusPadding=function(t){return arguments.length?(a=t,m):a},m.innerRadius=function(t){return arguments.length?(i=t,m):i},m.radius=function(t){return arguments.length?(l=t,m):l},m.cx=function(t){return arguments.length?(n=t,m):n||m.width()/2},m.cy=function(t){return arguments.length?(r=t,m):r||m.height()/2},m._doRedraw=function(){return x(),m},m.minAngleForLabel=function(t){return arguments.length?(y=t,m):y},m.emptyTitle=function(t){return 0===arguments.length?p:(p=t,m)},m.externalLabels=function(t){return 0===arguments.length?c:(c=t||void 0,m)},m.drawPaths=function(t){return 0===arguments.length?v:(v=t,m)},m.legendables=function(){return m.data().map(function(t,e){var n={name:t.key,data:t.value,others:t.others,chart:m};return n.color=m.getColor(t,e),n})},m.legendHighlight=function(t){L(t,!0)},m.legendReset=function(t){L(t,!1)},m.legendToggle=function(t){m.onClick({key:t.name,others:t.others})},m.anchor(t,e)},rt.sunburstChart=function(t,e){var i,a,o,n,r,l,u="pie-slice",c="empty-chart",s="empty",d=0,f=.5,h=rt.capMixin(rt.colorMixin(rt.baseMixin({})));function g(t){return t.path?t.value:h.cappedValueAccessor(t)}function p(){var t=nt.min([h.width(),h.height()])/2;i=a&&a<t?a:t;var e,n=v();if(nt.sum(h.data(),h.valueAccessor())?((e=m(rt.utils.toHierarchy(h.data(),h.valueAccessor()))).shift(),o.classed(c,!1)):(e=m(rt.utils.toHierarchy([],function(t){return t.value})),o.classed(c,!0)),o){var r=o.selectAll("g."+u).data(e);!function(t,e,n){var r=function(t){return t.enter().append("g").attr("class",function(t,e){return u+" _"+e+" "+u+"-level-"+t.depth})}(t);(function(t,e){var n=t.append("path").attr("fill",A).on("click",_).attr("d",function(t){return k(e,t)}),r=rt.transition(n,h.transitionDuration());r.attrTween&&r.attrTween("d",x)})(r,e),function(t){h.renderTitle()&&t.append("title").text(function(t){return h.title()(t)})}(r),function(t,e){if(h.renderLabel()){var n=o.selectAll("text."+u).data(t);n.exit().remove(),y(n.enter().append("text").attr("class",function(t,e){var n=u+" _"+e;return l&&(n+=" external"),n}).on("click",_),e)}}(n,e)}(r,n,e),function(t,e){(function(t,n){var e=o.selectAll("g."+u).data(t).select("path").attr("d",function(t,e){return k(n,t)}),r=rt.transition(e,h.transitionDuration());r.attrTween&&r.attrTween("d",x);r.attr("fill",A)})(t,e),function(t,e){if(h.renderLabel()){y(o.selectAll("text."+u).data(t),e)}}(t,e),function(t){h.renderTitle()&&o.selectAll("g."+u).data(t).select("title").text(function(t){return h.title()(t)})}(t)}(e,n),function(t){t.exit().remove()}(r),h.hasFilter()?h.selectAll("g."+u).each(function(t){!function(t){return function(t){for(var e=0;e<h.filters().length;e++)if(h.filters()[e].isFiltered(t))return!0;return!1}(t.path)}(t)?h.fadeDeselected(this):h.highlightSelected(this)}):h.selectAll("g."+u).each(function(t){h.resetHighlight(this)}),rt.transition(o,h.transitionDuration(),h.transitionDelay()).attr("transform","translate("+h.cx()+","+h.cy()+")")}}function y(t,e){rt.transition(t,h.transitionDuration()).attr("transform",function(t){return function(t,e){var n;n=l?nt.svg.arc().outerRadius(i+l).innerRadius(i+l).centroid(t):e.centroid(t);return isNaN(n[0])||isNaN(n[1])?"translate(0,0)":"translate("+n+")"}(t,e)}).attr("text-anchor","middle").text(function(t){return function(t){return 0===g(t)}(t)||function(t){var e=t.x1-t.x0;return isNaN(e)||e<f}(t)?"":h.label()(t)})}function v(){return nt.arc().startAngle(function(t){return t.x0}).endAngle(function(t){return t.x1}).innerRadius(function(t){return t.data.path&&1===t.data.path.length?d:Math.sqrt(t.y0)}).outerRadius(function(t){return Math.sqrt(t.y1)})}function m(t){var e=nt.hierarchy(t).sum(function(t){return t.children?0:g(t)}).sort(function(t,e){return nt.ascending(t.data.path,e.data.path)});return nt.partition().size([2*Math.PI,i*i])(e),e.descendants().map(function(t){return t.key=t.data.key,t.path=t.data.path,t})}function x(e){var t=this._current;!function(t){return!t||isNaN(t.x0)||isNaN(t.y0)}(t)||(t={x0:0,x1:0,y0:0,y1:0});var n={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},r=nt.interpolate(t,n);return this._current=r(0),function(t){return k(v(),Object.assign({},e,r(t)))}}function A(t,e){return h.getColor(t.data,e)}function b(t){for(var e=t.path||t.key,n=rt.filters.HierarchyFilter(e),r=function(t){for(var e=rt.filters.HierarchyFilter(t),n=[],r=0;r<h.filters().length;r++){var i=h.filters()[r];(i.isFiltered(t)||e.isFiltered(i))&&n.push(i)}return n}(e),i=!1,a=r.length-1;0<=a;a--){var o=r[a];rt.utils.arraysIdentical(o,e)&&(i=!0),h.filter(r[a])}rt.events.trigger(function(){i||h.filter(n),h.redrawGroup()})}function _(t,e){o.attr("class")!==c&&b(t)}function k(t,e){var n=t(e);return 0<=n.indexOf("NaN")&&(n="M0,0"),n}function D(e,n){h.selectAll("g.pie-slice").each(function(t){e.name===t.key&&nt.select(this).classed("highlight",n)})}return h.colorAccessor(h.cappedKeyAccessor),h.title(function(t){return h.cappedKeyAccessor(t)+": "+g(t)}),h.label(h.cappedKeyAccessor),h.renderLabel(!0),h.transitionDuration(350),h.filterHandler(function(t,r){return 0===r.length?t.filter(null):t.filterFunction(function(t){for(var e=0;e<r.length;e++){var n=r[e];if(n.isFiltered&&n.isFiltered(t))return!0}return!1}),r}),h._doRender=function(){return h.resetSvg(),o=h.svg().append("g").attr("transform","translate("+h.cx()+","+h.cy()+")"),p(),h},h.innerRadius=function(t){return arguments.length?(d=t,h):d},h.radius=function(t){return arguments.length?(a=t,h):a},h.cx=function(t){return arguments.length?(n=t,h):n||h.width()/2},h.cy=function(t){return arguments.length?(r=t,h):r||h.height()/2},h.minAngleForLabel=function(t){return arguments.length?(f=t,h):f},h.emptyTitle=function(t){return 0===arguments.length?s:(s=t,h)},h.externalLabels=function(t){return 0===arguments.length?l:(l=t||void 0,h)},h._doRedraw=function(){return p(),h},h.onClick=_,h.legendables=function(){return h.data().map(function(t,e){var n={name:t.key,data:t.value,others:t.others,chart:h};return n.color=h.getColor(t,e),n})},h.legendHighlight=function(t){D(t,!0)},h.legendReset=function(t){D(t,!1)},h.legendToggle=function(t){h.onClick({key:t.name,others:t.others})},h.anchor(t,e)},rt.barChart=function(t,e){var o,n=3,l=rt.stackMixin(rt.coordinateGridMixin({})),i=2,r=!1,a=!1;function u(t){return rt.utils.safeNumber(Math.abs(l.y()(t.y+t.y0)-l.y()(t.y0)))}function c(t){var e=l.x()(t.x);return r||(e+=o/2),l.isOrdinal(