UNPKG

dc

Version:

A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js

20 lines (19 loc) 105 kB
/*! * dc 3.0.7 * 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(nt,V){"use strict";var rt={version:"3.0.7",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};rt.chartRegistry=function(){var r={};function i(t){return t||(t=rt.constants.DEFAULT_CHART_GROUP),r[t]||(r[t]=[]),t}return{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},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 r,e,n,i,a,t=0;function h(t,e){for(var n=0;n<t.length;n++)if(t[n].key===e)return t[n]}return rt.utils.uniqueId=function(){return++t},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},rt.logger=((r={enableDebugLog:!(e={}),warn:function(t){return console&&(console.warn?console.warn(t):console.log&&console.log(t)),r}}).warnOnce=function(t){return e[t]||(e[t]=!0,rt.logger.warn(t)),r},r.debug=function(t){return r.enableDebugLog&&console&&(console.debug?console.debug(t):console.log&&console.log(t)),r},r.deprecate=function(t,e){var n=!1;return function(){return n||(r.warn(e),n=!0),t.apply(this,arguments)}},r),rt.config=(a=i=["#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?(a=t,n):(a===i&&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."),a)},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();var u,c,s,d,f,h=200,g=function(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().width;return e&&h<e?e:h},p=g,y=200,v=function(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().height;return e&&y<e?e:y},x=v,m=!1,A=rt.pluck("key"),b=rt.pluck("value"),_=rt.pluck("key"),k=rt.pluck("key"),D=!1,C=function(t){return r.keyAccessor()(t)+": "+r.valueAccessor()(t)},w=!0,L=!1,R=750,E=0,M=rt.printers.filters,S=["dimension","group"],O=rt.constants.DEFAULT_CHART_GROUP,B=nt.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),F=[],T=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},N=function(t){return t.all()};function H(){o&&(m?o.attr("viewBox")||o.attr("viewBox","0 0 "+r.width()+" "+r.height()):o.attr("width",r.width()).attr("height",r.height()))}function G(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?(x=t?"function"==typeof t?t:rt.utils.constant(t):v,c=void 0,r):(rt.utils.isNumber(c)||(c=x(a.node())),c)},r.width=function(t){return arguments.length?(p=t?"function"==typeof t?t:rt.utils.constant(t):g,u=void 0,r):(rt.utils.isNumber(u)||(u=p(a.node())),u)},r.minWidth=function(t){return arguments.length?(h=t,r):h},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?(N="function"==typeof t?t:rt.utils.constant(t),r.expireCache(),r):N.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?(k=t,s=V.quicksort.by(k),r.expireCache(),r):k},r._computeOrderedGroups=function(t){var e=t.slice(0);return e.length<=1?e:(s||(s=V.quicksort.by(k)),s(e,0,e.length))},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(),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 O=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"),H(),o},r.filterPrinter=function(t){return arguments.length?(M=t,r):M},r.controlsUseVisibility=function(t){return arguments.length?(L=t,r):L},r.turnOnControls=function(){if(a){var t=r.controlsUseVisibility()?"visibility":"display";r.selectAll(".reset").style(t,null),r.selectAll(".filter").text(M(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?(R=t,r):R},r.transitionDelay=function(t){return arguments.length?(E=t,r):E},r._mandatoryAttributes=function(t){return arguments.length?(S=t,r):S},r.render=function(){c=u=void 0,B.call("preRender",r,r),S&&S.forEach(G);var t=r._doRender();return d&&d.render(),r._activateRenderlets("postRender"),t},r._activateRenderlets=function(t){B.call("pretransition",r,r),0<r.transitionDuration()&&o?o.transition().duration(r.transitionDuration()).delay(r.transitionDelay()).on("end",function(){B.call("renderlet",r,r),t&&B.call(t,r,r)}):(B.call("renderlet",r,r),t&&B.call(t,r,r))},r.redraw=function(){H(),B.call("preRedraw",r,r);var t=r._doRedraw();return d&&d.render(),r._activateRenderlets("postRedraw"),t},r.commitHandler=function(t){return arguments.length?(f=t,r):f},r.redrawGroup=function(){return f?f(!1,function(t,e){t?console.log(t):rt.redrawAll(r.chartGroup())}):rt.redrawAll(r.chartGroup()),r},r.renderGroup=function(){return f?f(!1,function(t,e){t?console.log(t):rt.renderAll(r.chartGroup())}):rt.renderAll(r.chartGroup()),r},r._invokeFilteredListener=function(t){void 0!==t&&B.call("filtered",r,r,t)},r._invokeZoomedListener=function(){B.call("zoomed",r,r)};var P=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?(P=t,r):P},r.hasFilter=function(t){return P(F,t)};var U=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?(U=t,r):U};var Y=function(t,e){return t.push(e),t};r.addFilterHandler=function(t){return arguments.length?(Y=t,r):Y};var z=function(t){return[]};return r.resetFilterHandler=function(t){return arguments.length?(z=t,r):z},r.replaceFilter=function(t){return F=z(F),r.filter(t),r},r.filter=function(t){if(!arguments.length)return 0<F.length?F[0]:null;var e=F;return t instanceof Array&&t[0]instanceof Array&&!t.isFiltered?t[0].forEach(function(t){e=P(e,t)?U(e,t):Y(e,t)}):e=null===t?z(e):P(e,t)?U(e,t):Y(e,t),F=function(t){if(r.dimension()&&r.dimension().filter){var e=T(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 F},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?(T=t,r):T},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?(A=t,r):A},r.valueAccessor=function(t){return arguments.length?(b=t,r):b},r.label=function(t,e){return arguments.length?(_=t,(void 0===e||e)&&(D=!0),r):_},r.renderLabel=function(t){return arguments.length?(D=t,r):D},r.title=function(t){return arguments.length?(C=t,r):C},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,O),O=t,l||rt.registerChart(r,O),r):O},r.expireCache=function(){return r},r.legend=function(t){return arguments.length?((d=t).parent(r),r):d},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 B.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=nt.scaleOrdinal(rt.config.defaultColors()),r=!0,i=function(t){return e.keyAccessor()(t)};return e.colors=function(t){return arguments.length?(n=t instanceof Array?nt.scaleQuantize().range(t):"function"==typeof t?t:rt.utils.constant(t),e):n},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?(i=t,r=!1,e):i},e.defaultColorAccessor=function(){return r},e.colorDomain=function(t){return arguments.length?(n.domain(t),e):n.domain()},e.calculateColorDomain=function(){var t=[nt.min(e.data(),e.colorAccessor()),nt.max(e.data(),e.colorAccessor())];return n.domain(t),e},e.getColor=function(t,e){return n(i.call(this,t,e))},e.colorCalculator=rt.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},rt.coordinateGridMixin=function(u){var i,n,r,o,a,l,c="grid-line",s="horizontal",d="vertical",f="y-axis-label",h="x-axis-label",g="custom-brush-handle";(u=rt.colorMixin(rt.marginMixin(rt.baseMixin(u)))).colors(nt.scaleOrdinal(nt.schemeCategory10)),u._mandatoryAttributes().push("x");var p,y,v,x,m,e,t,A,b,_=nt.axisBottom(),k=rt.units.integers,D=0,C=nt.timeDay,w=!1,L=0,R=null,E=0,M=!1,S=0,O=nt.brushX(),B=!0,F=!1,T=!1,N=!1,H=!1,G=[1,1/0],P=!0,U=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(a).domain();u.focus(t,!1)}),Y=nt.zoom().on("zoom",null),z=!1,V=!1,I=0,X=.5,q=0,W=!1;function j(t,e){u.isOrdinal()?(o.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!"),o=nt.scaleBand().domain(o.domain())),(u.elasticX()||0===o.domain().length)&&o.domain(u._ordinalXDomain())):u.elasticX()&&o.domain([u.xAxisMin(),u.xAxisMax()]);var n=o.domain();!e&&rt.utils.arraysEqual(y,n)||u.rescale(),y=n,u.isOrdinal()?o.range([0,u.xAxisLength()]).paddingInner(q).paddingOuter(u._useOuterPadding()?X:0):o.range([0,u.xAxisLength()]),_=_.scale(u.x()),function(t){var e=t.select("g."+d);if(N){e.empty()&&(e=t.insert("g",":first-child").attr("class",c+" "+d).attr("transform","translate("+u.margins().left+","+u.margins().top+")"));var n=_.tickValues()?_.tickValues():"function"==typeof o.ticks?o.ticks.apply(o,_.tickArguments()):o.domain(),r=e.selectAll("line").data(n),i=r.enter().append("line").attr("x1",function(t){return o(t)}).attr("y1",u._xAxisY()-u.margins().top).attr("x2",function(t){return o(t)}).attr("y2",0).attr("opacity",0);rt.transition(i,u.transitionDuration(),u.transitionDelay()).attr("opacity",1);var a=i.merge(r);rt.transition(a,u.transitionDuration(),u.transitionDelay()).attr("x1",function(t){return o(t)}).attr("y1",u._xAxisY()-u.margins().top).attr("x2",function(t){return o(t)}).attr("y2",0),r.exit().remove()}else e.selectAll("line").remove()}(t)}function K(){return W?nt.axisRight():nt.axisLeft()}function Z(){return u.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*I;rt.utils.appendOrSelect(n,"rect").attr("width",u.xAxisLength()+r).attr("height",u.yAxisHeight()+r).attr("transform","translate(-"+I+", -"+I+")")}function Q(t){u.isOrdinal()&&(B=!1),j(u.g(),t),u._prepareYAxis(u.g()),u.plotData(),(u.elasticX()||H||t)&&u.renderXAxis(u.g()),(u.elasticY()||H||t)&&u.renderYAxis(u.g()),t?u.renderBrush(u.g(),!1):u.redrawBrush(u.filter(),H),u.fadeDeselectedArea(u.filter()),H=!1}function $(t,e){var n,r;n=(r=t)instanceof Array&&1<r.length?(u.x().domain(t),rt.filters.RangedFilter(t[0],t[1])):(u.x().domain(l),null),u.replaceFilter(n),u.rescale(),u.redraw(),e||(A&&!rt.utils.arraysEqual(u.filter(),A.filter())&&rt.events.trigger(function(){A.replaceFilter(n),A.redraw()}),u._invokeZoomedListener(),rt.events.trigger(function(){u.redrawGroup()},rt.constants.EVENT_DELAY))}function tt(){var t,e,n,r,i;U&&U.transform(u.root(),(t=u.x().domain(),n=a,r=((e=l)[1]-e[0])/(t[1]-t[0]),i=-1*n(t[0]),nt.zoomIdentity.scale(r).translate(i,0)))}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 u.rescale=function(){return H=!(t=void 0),u},u.resizing=function(){return H},u.rangeChart=function(t){return arguments.length?((A=t).focusChart(u),u):A},u.zoomScale=function(t){return arguments.length?(G=t,u):G},u.zoomOutRestrict=function(t){return arguments.length?(P=t,u):P},u._generateG=function(t){i=void 0===t?u.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("+u.margins().left+", "+u.margins().top+")").attr("clip-path","url("+e+"#"+Z()+")"),n},u.g=function(t){return arguments.length?(n=t,u):n},u.mouseZoomable=function(t){return arguments.length?(V=t,u):V},u.chartBodyG=function(t){return arguments.length?(r=t,u):r},u.x=function(t){return arguments.length?(l=(o=t).domain(),u.rescale(),u):o},u.xOriginalDomain=function(){return l},u.xUnits=function(t){return arguments.length?(k=t,u):k},u.xAxis=function(t){return arguments.length?(_=t,u):_},u.elasticX=function(t){return arguments.length?(w=t,u):w},u.xAxisPadding=function(t){return arguments.length?(D=t,u):D},u.xAxisPaddingUnit=function(t){return arguments.length?(C=t,u):C},u.xUnitCount=function(){return void 0===t&&(u.isOrdinal()?t=u.x().domain().length:(t=u.xUnits()(u.x().domain()[0],u.x().domain()[1]))instanceof Array&&(t=t.length)),t},u.useRightYAxis=function(t){return arguments.length?(W!==t&&R&&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."),W=t,u):W},u.isOrdinal=function(){return u.xUnits()===rt.units.ordinal},u._useOuterPadding=function(){return!0},u._ordinalXDomain=function(){return u._computeOrderedGroups(u.data()).map(u.keyAccessor())},u.renderXAxis=function(t){var e=t.select("g.x");e.empty()&&(e=t.append("g").attr("class","axis x").attr("transform","translate("+u.margins().left+","+u._xAxisY()+")"));var n=t.select("text."+h);n.empty()&&u.xAxisLabel()&&(n=t.append("text").attr("class",h).attr("transform","translate("+(u.margins().left+u.xAxisLength()/2)+","+(u.height()-L)+")").attr("text-anchor","middle")),u.xAxisLabel()&&n.text()!==u.xAxisLabel()&&n.text(u.xAxisLabel()),rt.transition(e,u.transitionDuration(),u.transitionDelay()).attr("transform","translate("+u.margins().left+","+u._xAxisY()+")").call(_),rt.transition(n,u.transitionDuration(),u.transitionDelay()).attr("transform","translate("+(u.margins().left+u.xAxisLength()/2)+","+(u.height()-L)+")")},u._xAxisY=function(){return u.height()-u.margins().bottom},u.xAxisLength=function(){return u.effectiveWidth()},u.xAxisLabel=function(t,e){return arguments.length?(p=t,u.margins().bottom-=L,L=void 0===e?12:e,u.margins().bottom+=L,u):p},u._prepareYAxis=function(t){if(void 0===v||u.elasticY()){void 0===v&&(v=nt.scaleLinear());var e=u.yAxisMin()||0,n=u.yAxisMax()||0;v.domain([e,n]).rangeRound([u.yAxisHeight(),0])}v.range([u.yAxisHeight(),0]),R||(R=K()),R.scale(v),u._renderHorizontalGridLinesForAxis(t,v,R)},u.renderYAxisLabel=function(t,e,n,r){r=r||S;var i=u.g().select("text."+f+"."+t+"-label"),a=u.margins().top+u.yAxisHeight()/2;i.empty()&&e&&(i=u.g().append("text").attr("transform","translate("+r+","+a+"),rotate("+n+")").attr("class",f+" "+t+"-label").attr("text-anchor","middle").text(e)),e&&i.text()!==e&&i.text(e),rt.transition(i,u.transitionDuration(),u.transitionDelay()).attr("transform","translate("+r+","+a+"),rotate("+n+")")},u.renderYAxisAt=function(t,e,n){var r=u.g().select("g."+t);r.empty()&&(r=u.g().append("g").attr("class","axis "+t).attr("transform","translate("+n+","+u.margins().top+")")),rt.transition(r,u.transitionDuration(),u.transitionDelay()).attr("transform","translate("+n+","+u.margins().top+")").call(e)},u.renderYAxis=function(){var t=W?u.width()-u.margins().right:u._yAxisX();u.renderYAxisAt("y",R,t);var e=W?u.width()-S:S,n=W?90:-90;u.renderYAxisLabel("y",u.yAxisLabel(),n,e)},u._renderHorizontalGridLinesForAxis=function(t,e,n){var r=t.select("g."+s);if(T){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",c+" "+s).attr("transform","translate("+u.margins().left+","+u.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",u.xAxisLength()).attr("y2",function(t){return e(t)}).attr("opacity",0);rt.transition(o,u.transitionDuration(),u.transitionDelay()).attr("opacity",1);var l=o.merge(a);rt.transition(l,u.transitionDuration(),u.transitionDelay()).attr("x1",1).attr("y1",function(t){return e(t)}).attr("x2",u.xAxisLength()).attr("y2",function(t){return e(t)}),a.exit().remove()}else r.selectAll("line").remove()},u._yAxisX=function(){return u.useRightYAxis()?u.width()-u.margins().right:u.margins().left},u.yAxisLabel=function(t,e){return arguments.length?(x=t,u.margins().left-=S,S=void 0===e?12:e,u.margins().left+=S,u):x},u.y=function(t){return arguments.length?(v=t,u.rescale(),u):v},u.yAxis=function(t){return arguments.length?(R=t,u):(R||(R=K()),R)},u.elasticY=function(t){return arguments.length?(M=t,u):M},u.renderHorizontalGridLines=function(t){return arguments.length?(T=t,u):T},u.renderVerticalGridLines=function(t){return arguments.length?(N=t,u):N},u.xAxisMin=function(){var t=nt.min(u.data(),function(t){return u.keyAccessor()(t)});return rt.utils.subtract(t,D,C)},u.xAxisMax=function(){var t=nt.max(u.data(),function(t){return u.keyAccessor()(t)});return rt.utils.add(t,D,C)},u.yAxisMin=function(){var t=nt.min(u.data(),function(t){return u.valueAccessor()(t)});return rt.utils.subtract(t,E)},u.yAxisMax=function(){var t=nt.max(u.data(),function(t){return u.valueAccessor()(t)});return rt.utils.add(t,E)},u.yAxisPadding=function(t){return arguments.length?(E=t,u):E},u.yAxisHeight=function(){return u.effectiveHeight()},u.round=function(t){return arguments.length?(e=t,u):e},u._rangeBandPadding=function(t){return arguments.length?(q=t,u):q},u._outerRangeBandPadding=function(t){return arguments.length?(X=t,u):X},rt.override(u,"filter",function(t){return arguments.length?(u._filter(t),u.redrawBrush(t,!1),u):u._filter()}),u.brush=function(t){return arguments.length?(O=t,u):O},u.renderBrush=function(t,e){B&&(O.on("start brush end",u._brushing),m=t.append("g").attr("class","brush").attr("transform","translate("+u.margins().left+","+u.margins().top+")"),u.setBrushExtents(),u.createBrushHandlePaths(m,e),u.redrawBrush(u.filter(),e))},u.createBrushHandlePaths=function(t){var e=t.selectAll("path."+g).data([{type:"w"},{type:"e"}]);(e=e.enter().append("path").attr("class",g).merge(e)).attr("d",u.resizeHandlePath)},u.extendBrush=function(t){return t&&u.round()&&(t[0]=u.round()(t[0]),t[1]=u.round()(t[1])),t},u.brushIsEmpty=function(t){return!t||t[1]<=t[0]},u._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(u.x().invert)),t=u.extendBrush(t),u.redrawBrush(t,!1);var e=u.brushIsEmpty(t)?null:rt.filters.RangedFilter(t[0],t[1]);rt.events.trigger(function(){u.applyBrushSelection(e)},rt.constants.EVENT_DELAY)}},u.applyBrushSelection=function(t){u.replaceFilter(t),u.redrawGroup()},u.setBrushExtents=function(t){O.extent([[0,0],[u.effectiveWidth(),u.effectiveHeight()]]),m.call(O)},u.redrawBrush=function(n,t){if(B&&m)if(H&&u.setBrushExtents(t),n){var e=[o(n[0]),o(n[1])],r=rt.optionalTransition(t,u.transitionDuration(),u.transitionDelay())(m);r.call(O.move,e),r.selectAll("path."+g).attr("display",null).attr("transform",function(t,e){return"translate("+o(n[e])+", 0)"}).attr("d",u.resizeHandlePath)}else m.call(O.move,null),m.selectAll("path."+g).attr("display","none");u.fadeDeselectedArea(n)},u.fadeDeselectedArea=function(t){},u.resizeHandlePath=function(t){var e=+("e"===(t=t.type)),n=e?1:-1,r=u.effectiveHeight()/3;return"M"+.5*n+","+r+"A6,6 0 0 "+e+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*r+"ZM"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)},u.clipPadding=function(t){return arguments.length?(I=t,u):I},u._preprocessData=function(){},u._doRender=function(){return u.resetSvg(),u._preprocessData(),u._generateG(),J(),Q(!0),a=o.copy(),V?u._enableMouseZoom():z&&u._disableMouseZoom(),u},u._doRedraw=function(){return u._preprocessData(),Q(!1),J(),u},u._enableMouseZoom=function(){z=!0;var t=[[0,0],[u.effectiveWidth(),u.effectiveHeight()]];if(U.scaleExtent(G).extent(t).duration(u.transitionDuration()),P){var e=Math.max(G[0],1);U.translateExtent(t).scaleExtent([e,G[1]])}u.root().call(U),tt()},u._disableMouseZoom=function(){u.root().call(Y)},u.focus=function(t,e){P&&(t=et(t,l),A&&(t=et(t,A.x().domain()))),$(t,e),tt()},u.refocused=function(){return!rt.utils.arraysEqual(u.x().domain(),l)},u.focusChart=function(t){return arguments.length?(b=t,u.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)})}),u):b},u.brushOn=function(t){return arguments.length?(B=t,u):B},u.parentBrushOn=function(t){return arguments.length?(F=t,u):F},u.gBrush=function(){return m},u},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};var u=function(t){return r.label()(t)},c=function(t){return r.bubbleR(t)>n},s=function(t){return c(t)?1:0},d=function(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)}};var f=function(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 _,k,D,n,r,C,w="pie-slice",L="pie-label",R="pie-slice-group",E="pie-label-group",M="empty-chart",S="empty",i=0,a=0,o=.5,O=!1,B=rt.capMixin(rt.colorMixin(rt.baseMixin({})));function l(){var t=nt.min([B.width(),B.height()])/2;_=k&&k<t?k:t;var e,n,r,i,a,o,l,u,c,s,d,f,h,g,p,y,v,x=H(),m=nt.pie().sort(null).value(B.cappedValueAccessor);if(nt.sum(B.data(),B.cappedValueAccessor)?(e=m(B.data()),D.classed(M,!1)):(e=m([{key:S,value:1,others:[S]}]),D.classed(M,!0)),D){var A=D.select("g."+R).selectAll("g."+w).data(e),b=D.select("g."+E).selectAll("text."+L).data(e);v=b,A.exit().remove(),v.exit().remove(),c=b,s=x,d=e,f=A.enter().append("g").attr("class",function(t,e){return w+" _"+e}),g=s,p=f.append("path").attr("fill",U).on("click",Y).attr("d",function(t,e){return z(t,e,g)}),(y=rt.transition(p,B.transitionDuration(),B.transitionDelay())).attrTween&&y.attrTween("d",P),h=f,B.renderTitle()&&h.append("title").text(function(t){return B.title()(t.data)}),function(t,e,n){if(B.renderLabel()){var r=t.enter().append("text").attr("class",function(t,e){var n=w+" "+L+" _"+e;return C&&(n+=" external"),n}).on("click",Y).on("mouseover",function(t,e){T(e,!0)}).on("mouseout",function(t,e){T(e,!1)});F(r,n),C&&O&&N(e,n)}}(c,d,s),n=o=e,r=l=x,i=D.selectAll("g."+w).data(n).select("path").attr("d",function(t,e){return z(t,e,r)}),(a=rt.transition(i,B.transitionDuration(),B.transitionDelay())).attrTween&&a.attrTween("d",P),a.attr("fill",U),function(t,e){if(B.renderLabel()){var n=D.selectAll("text."+L).data(t);F(n,e),C&&O&&N(t,e)}}(o,l),u=o,B.renderTitle()&&D.selectAll("g."+w).data(u).select("title").text(function(t){return B.title()(t.data)}),B.hasFilter()?B.selectAll("g."+w).each(function(t){G(t)?B.highlightSelected(this):B.fadeDeselected(this)}):B.selectAll("g."+w).each(function(){B.resetHighlight(this)}),rt.transition(D,B.transitionDuration(),B.transitionDelay()).attr("transform","translate("+B.cx()+","+B.cy()+")")}}function F(t,e){B._applyLabelText(t),rt.transition(t,B.transitionDuration(),B.transitionDelay()).attr("transform",function(t){return function(t,e){var n;n=C?nt.arc().outerRadius(_-a+C).innerRadius(_-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 T(t,e){B.select("g.pie-slice._"+t).classed("highlight",e)}function N(t,r){var e=D.selectAll("polyline."+w).data(t);e.exit().remove(),e=e.enter().append("polyline").attr("class",function(t,e){return"pie-path _"+e+" "+w}).on("click",Y).on("mouseover",function(t,e){T(e,!0)}).on("mouseout",function(t,e){T(e,!1)}).merge(e);var i=nt.arc().outerRadius(_-a+C).innerRadius(_-a),n=rt.transition(e,B.transitionDuration(),B.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 H(){return nt.arc().outerRadius(_-a).innerRadius(i)}function G(t){return B.hasFilter(B.cappedKeyAccessor(t.data))}function P(t){t.innerRadius=i;var e,n=this._current;n=!(e=n)||isNaN(e.startAngle)||isNaN(e.endAngle)?{startAngle:0,endAngle:0}:{startAngle:n.startAngle,endAngle:n.endAngle};var r=nt.interpolate(n,t);return this._current=r(0),function(t){return z(r(t),0,H())}}function U(t,e){return B.getColor(t.data,e)}function Y(t,e){D.attr("class")!==M&&B.onClick(t.data,e)}function z(t,e,n){var r=n(t,e);return 0<=r.indexOf("NaN")&&(r="M0,0"),r}function u(e,n){B.selectAll("g.pie-slice").each(function(t){e.name===t.data.key&&nt.select(this).classed("highlight",n)})}return B.colorAccessor(B.cappedKeyAccessor),B.title(function(t){return B.cappedKeyAccessor(t)+": "+B.cappedValueAccessor(t)}),B.slicesCap=B.cap,B.label(B.cappedKeyAccessor),B.renderLabel(!0),B.transitionDuration(350),B.transitionDelay(0),B._doRender=function(){return B.resetSvg(),(D=B.svg().append("g").attr("transform","translate("+B.cx()+","+B.cy()+")")).append("g").attr("class",R),D.append("g").attr("class",E),l(),B},B._applyLabelText=function(t){t.text(function(t){var e,n,r,i=t.data;return r=i,(0===B.cappedValueAccessor(r)||(n=(e=t).endAngle-e.startAngle,isNaN(n)||n<o))&&!G(t)?"":B.label()(t.data)})},B.externalRadiusPadding=function(t){return arguments.length?(a=t,B):a},B.innerRadius=function(t){return arguments.length?(i=t,B):i},B.radius=function(t){return arguments.length?(k=t,B):k},B.cx=function(t){return arguments.length?(n=t,B):n||B.width()/2},B.cy=function(t){return arguments.length?(r=t,B):r||B.height()/2},B._doRedraw=function(){return l(),B},B.minAngleForLabel=function(t){return arguments.length?(o=t,B):o},B.emptyTitle=function(t){return 0===arguments.length?S:(S=t,B)},B.externalLabels=function(t){return 0===arguments.length?C:(C=t||void 0,B)},B.drawPaths=function(t){return 0===arguments.length?O:(O=t,B)},B.legendables=function(){return B.data().map(function(t,e){var n={name:t.key,data:t.value,others:t.others,chart:B};return n.color=B.getColor(t,e),n})},B.legendHighlight=function(t){u(t,!0)},B.legendReset=function(t){u(t,!1)},B.legendToggle=function(t){B.onClick({key:t.name,others:t.others})},B.anchor(t,e)},rt.sunburstChart=function(t,e){var v,x,n,r,m,A="pie-slice",b="empty-chart",i="empty",a=0,o=.5,_=rt.capMixin(rt.colorMixin(rt.baseMixin({})));function l(t){return t.path?t.value:_.cappedValueAccessor(t)}function u(){v=v||nt.min([_.width(),_.height()])/2;var t,e,n,r,i,a,o,l,u,c,s,d,f,h,g,p=D();if(nt.sum(_.data(),_.valueAccessor())?((t=C(rt.utils.toHierarchy(_.data(),_.valueAccessor()))).shift(),x.classed(b,!1)):(t=C(rt.utils.toHierarchy([],function(t){return t.value})),x.classed(b,!0)),x){var y=x.selectAll("g."+A).data(t);u=p,c=t,s=y.enter().append("g").attr("class",function(t,e){return A+" _"+e+" "+A+"-level-"+t.depth}),f=u,h=s.append("path").attr("fill",L).on("click",R).attr("d",function(t){return E(f,t)}),(g=rt.transition(h,_.transitionDuration())).attrTween&&g.attrTween("d",w),d=s,_.renderTitle()&&d.append("title").text(function(t){return _.title()(t)}),function(t,e){if(_.renderLabel()){var n=x.selectAll("text."+A).data(t);n.exit().remove();var r=n.enter().append("text").attr("class",function(t,e){var n=A+" _"+e;return m&&(n+=" external"),n}).on("click",R);k(r,e)}}(c,u),e=a=t,n=o=p,r=x.selectAll("g."+A).data(e).select("path").attr("d",function(t,e){return E(n,t)}),(i=rt.transition(r,_.transitionDuration())).attrTween&&i.attrTween("d",w),i.attr("fill",L),function(t,e){if(_.renderLabel()){var n=x.selectAll("text."+A).data(t);k(n,e)}}(a,o),l=a,_.renderTitle()&&x.selectAll("g."+A).data(l).select("title").text(function(t){return _.title()(t)}),y.exit().remove(),_.hasFilter()?_.selectAll("g."+A).each(function(t){!function(t){for(var e=0;e<_.filters().length;e++){var n=_.filters()[e];if(n.isFiltered(t))return!0}return!1}(t.path)?_.fadeDeselected(this):_.highlightSelected(this)}):_.selectAll("g."+A).each(function(t){_.resetHighlight(this)})}}function k(t,e){rt.transition(t,_.transitionDuration()).attr("transform",function(t){return function(t,e){var n;n=m?nt.svg.arc().outerRadius(v+m).innerRadius(v+m).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 0===l(t)||(n=(e=t).x1-e.x0,isNaN(n)||n<o)?"":_.label()(t);var e,n})}function D(){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?a:Math.sqrt(t.y0)}).outerRadius(function(t){return Math.sqrt(t.y1)})}function C(t){var e=nt.hierarchy(t).sum(function(t){return t.children?0:l(t)}).sort(function(t,e){return nt.ascending(t.data.path,e.data.path)});return nt.partition().size([2*Math.PI,v*v])(e),e.descendants().map(function(t){return t.key=t.data.key,t.path=t.data.path,t})}function w(e){var t,n=this._current;(!(t=n)||isNaN(t.x0)||isNaN(t.y0))&&(n={x0:0,x1:0,y0:0,y1:0});var r={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},i=nt.interpolate(n,r);return this._current=i(0),function(t){return E(D(),Object.assign({},e,i(t)))}}function L(t,e){return _.getColor(t.data,e)}function c(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<_.filters().length;r++){var i=_.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),_.filter(r[a])}rt.events.trigger(function(){i||_.filter(n),_.redrawGroup()})}function R(t,e){x.attr("class")!==b&&c(t)}function E(t,e){var n=t(e);return 0<=n.indexOf("NaN")&&(n="M0,0"),n}function s(e,n){_.selectAll("g.pie-slice").each(function(t){e.name===t.key&&nt.select(this).classed("highlight",n)})}return _.colorAccessor(_.cappedKeyAccessor),_.title(function(t){return _.cappedKeyAccessor(t)+": "+l(t)}),_.label(_.cappedKeyAccessor),_.renderLabel(!0),_.transitionDuration(350),_.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}),_._doRender=function(){return _.resetSvg(),x=_.svg().append("g").attr("transform","translate("+_.cx()+","+_.cy()+")"),u(),_},_.innerRadius=function(t){return arguments.length?(a=t,_):a},_.radius=function(t){return arguments.length?(v=t,_):v},_.cx=function(t){return arguments.length?(n=t,_):n||_.width()/2},_.cy=function(t){return arguments.length?(r=t,_):r||_.height()/2},_.minAngleForLabel=function(t){return arguments.length?(o=t,_):o},_.emptyTitle=function(t){return 0===arguments.length?i:(i=t,_)},_.externalLabels=function(t){return 0===arguments.length?m:(m=t||void 0,_)},_._doRedraw=function(){return u(),_},_.onClick=R,_.legendables=function(){return _.data().map(function(t,e){var n={name:t.key,data:t.value,others:t.others,chart:_};return n.color=_.getColor(t,e),n})},_.legendHighlight=function(t){s(t,!0)},_.legendReset=function(t){s(t,!1)},_.legendToggle=function(t){_.onClick({key:t.name,others:t.others})},_.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()&&void 0!==i&&(e+=i/2),rt.utils.safeNumber(e)}function s(t){var e=l.y()(t.y+t.y0);return t.y<0&&(e-=u(t)),rt.utils.safeNumber(e-n)}function d(t){var e=l.x()(t.x);return r&&(e-=o/2),l.isOrdinal()&&void 0!==i&&(e+=i/2),rt.utils.safeNumber(e)}function f(e,n){return function(){var t=nt.select(this).attr("fill")===e;return n?!t:t}}return rt.override(l,"rescale",function(){return l._rescale(),o=void 0,l}),rt.override(l,"render",function(){return l.round()&&r&&!a&&rt.logger.warn("By default, brush rounding is disabled if bars are centered. See dc.js bar chart API documentation for details."),l._render()}),l.label(function(t){return rt.utils.printSingleValue(t.y0+t.y)},!1),l.plotData=function(){var t=l.chartBodyG().selectAll("g.stack").data(l.data());!function(){if(void 0===o){var t=l.xUnitCount();((o=l.isOrdinal()&&void 0===i?Math.floor(l.x().bandwidth()):i?Math.floor((l.xAxisLength()-(t-1)*i)/t):Math.floor(l.xAxisLength()/(1+l.barPadding())/t))===1/0||isNaN(o)||o<1)&&(o=1)}}();var r=(t=t.enter().append("g").attr("class",function(t,e){return"stack _"+e}).merge(t)).size()-1;t.each(function(t,e){var n=nt.select(this);!function(t,e,n){var r=t.selectAll("rect.bar").data(n.values,rt.pluck("x")),i=r.enter().append("rect").attr("