23 lines
87 KiB
JavaScript
23 lines
87 KiB
JavaScript
/*!
|
|
* dc 2.1.9
|
|
* 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 a(a,b){"use strict";var c={version:"2.1.9",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};c.chartRegistry=function(){function a(a){return a||(a=c.constants.DEFAULT_CHART_GROUP),b[a]||(b[a]=[]),a}var b={};return{has:function(a){for(var c in b)if(b[c].indexOf(a)>=0)return!0;return!1},register:function(c,d){d=a(d),b[d].push(c)},deregister:function(c,d){d=a(d);for(var e=0;e<b[d].length;e++)if(b[d][e].anchorName()===c.anchorName()){b[d].splice(e,1);break}},clear:function(a){a?delete b[a]:b={}},list:function(c){return c=a(c),b[c]}}}(),c.registerChart=function(a,b){c.chartRegistry.register(a,b)},c.deregisterChart=function(a,b){c.chartRegistry.deregister(a,b)},c.hasChart=function(a){return c.chartRegistry.has(a)},c.deregisterAllCharts=function(a){c.chartRegistry.clear(a)},c.filterAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].filterAll()},c.refocusAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].focus&&b[d].focus()},c.renderAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].render();null!==c._renderlet&&c._renderlet(a)},c.redrawAll=function(a){for(var b=c.chartRegistry.list(a),d=0;d<b.length;++d)b[d].redraw();null!==c._renderlet&&c._renderlet(a)},c.disableTransitions=!1,c.transition=function(a,b,d,e){if(c.disableTransitions||b<=0)return a;var f=a.transition(e);return(b>=0||void 0!==b)&&(f=f.duration(b)),(d>=0||void 0!==d)&&(f=f.delay(d)),f},c.optionalTransition=function(a,b,d,e){return a?function(a){return c.transition(a,b,d,e)}:function(a){return a}},c.afterTransition=function(a,b){if(a.empty()||!a.duration)b.call(a);else{var c=0;a.each(function(){++c}).each("end",function(){--c||b.call(a)})}},c.units={},c.units.integers=function(a,b){return Math.abs(b-a)},c.units.ordinal=function(a,b,c){return c},c.units.fp={},c.units.fp.precision=function(a){var b=function(a,d){var e=Math.abs((d-a)/b.resolution);return c.utils.isNegligible(e-Math.floor(e))?Math.floor(e):Math.ceil(e)};return b.resolution=a,b},c.round={},c.round.floor=function(a){return Math.floor(a)},c.round.ceil=function(a){return Math.ceil(a)},c.round.round=function(a){return Math.round(a)},c.override=function(a,b,c){var d=a[b];a["_"+b]=d,a[b]=c},c.renderlet=function(a){return arguments.length?(c._renderlet=a,c):c._renderlet},c.instanceOfChart=function(a){return a instanceof Object&&a.__dcFlag__&&!0},c.errors={},c.errors.Exception=function(a){var b=a||"Unexpected internal error";this.message=b,this.toString=function(){return b},this.stack=(new Error).stack},c.errors.Exception.prototype=Object.create(Error.prototype),c.errors.Exception.prototype.constructor=c.errors.Exception,c.errors.InvalidStateException=function(){c.errors.Exception.apply(this,arguments)},c.errors.InvalidStateException.prototype=Object.create(c.errors.Exception.prototype),c.errors.InvalidStateException.prototype.constructor=c.errors.InvalidStateException,c.errors.BadArgumentException=function(){c.errors.Exception.apply(this,arguments)},c.errors.BadArgumentException.prototype=Object.create(c.errors.Exception.prototype),c.errors.BadArgumentException.prototype.constructor=c.errors.BadArgumentException,c.dateFormat=a.time.format("%m/%d/%Y"),c.printers={},c.printers.filters=function(a){for(var b="",d=0;d<a.length;++d)d>0&&(b+=", "),b+=c.printers.filter(a[d]);return b},c.printers.filter=function(a){var b="";return"undefined"!=typeof a&&null!==a&&(a instanceof Array?a.length>=2?b="["+c.utils.printSingleValue(a[0])+" -> "+c.utils.printSingleValue(a[1])+"]":a.length>=1&&(b=c.utils.printSingleValue(a[0])):b=c.utils.printSingleValue(a)),b},c.pluck=function(a,b){return b?function(c,d){return b.call(c,c[a],d)}:function(b){return b[a]}},c.utils={},c.utils.printSingleValue=function(a){var b=""+a;return a instanceof Date?b=c.dateFormat(a):"string"==typeof a?b=a:c.utils.isFloat(a)?b=c.utils.printSingleValue.fformat(a):c.utils.isInteger(a)&&(b=Math.round(a)),b},c.utils.printSingleValue.fformat=a.format(".2f"),c.utils.add=function(b,c,d){if("string"==typeof c&&(c=c.replace("%","")),b instanceof Date)return"string"==typeof c&&(c=+c),"millis"===d?new Date(b.getTime()+c):(d=d||"day",a.time[d].offset(b,c));if("string"==typeof c){var e=+c/100;return b>0?b*(1+e):b*(1-e)}return b+c},c.utils.subtract=function(b,c,d){if("string"==typeof c&&(c=c.replace("%","")),b instanceof Date)return"string"==typeof c&&(c=+c),"millis"===d?new Date(b.getTime()-c):(d=d||"day",a.time[d].offset(b,-c));if("string"==typeof c){var e=+c/100;return b<0?b*(1+e):b*(1-e)}return b-c},c.utils.isNumber=function(a){return a===+a},c.utils.isFloat=function(a){return a===+a&&a!==(0|a)},c.utils.isInteger=function(a){return a===+a&&a===(0|a)},c.utils.isNegligible=function(a){return!c.utils.isNumber(a)||a<c.constants.NEGLIGIBLE_NUMBER&&a>-c.constants.NEGLIGIBLE_NUMBER},c.utils.clamp=function(a,b,c){return a<b?b:a>c?c:a};var d=0;return c.utils.uniqueId=function(){return++d},c.utils.nameToId=function(a){return a.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},c.utils.appendOrSelect=function(a,b,c){c=c||b;var d=a.select(b);return d.empty()&&(d=a.append(c)),d},c.utils.safeNumber=function(a){return c.utils.isNumber(+a)?+a:0},c.logger={},c.logger.enableDebugLog=!1,c.logger.warn=function(a){return console&&(console.warn?console.warn(a):console.log&&console.log(a)),c.logger},c.logger.debug=function(a){return c.logger.enableDebugLog&&console&&(console.debug?console.debug(a):console.log&&console.log(a)),c.logger},c.logger.deprecate=function(a,b){function d(){return e||(c.logger.warn(b),e=!0),a.apply(this,arguments)}var e=!1;return d},c.events={current:null},c.events.trigger=function(a,b){return b?(c.events.current=a,void setTimeout(function(){a===c.events.current&&a()},b)):void a()},c.filters={},c.filters.RangedFilter=function(a,b){var c=new Array(a,b);return c.isFiltered=function(a){return a>=this[0]&&a<this[1]},c.filterType="RangedFilter",c},c.filters.TwoDimensionalFilter=function(a){if(null===a)return null;var b=a;return b.isFiltered=function(a){return a.length&&a.length===b.length&&a[0]===b[0]&&a[1]===b[1]},b.filterType="TwoDimensionalFilter",b},c.filters.RangedTwoDimensionalFilter=function(a){if(null===a)return null;var b,c=a;return b=c[0]instanceof Array?[[Math.min(a[0][0],a[1][0]),Math.min(a[0][1],a[1][1])],[Math.max(a[0][0],a[1][0]),Math.max(a[0][1],a[1][1])]]:[[a[0],-(1/0)],[a[1],1/0]],c.isFiltered=function(a){var c,d;return a instanceof Array?(c=a[0],d=a[1]):(c=a,d=b[0][1]),c>=b[0][0]&&c<b[1][0]&&d>=b[0][1]&&d<b[1][1]},c.filterType="RangedTwoDimensionalFilter",c},c.baseMixin=function(d){function e(){m&&(z?m.attr("viewBox")||m.attr("viewBox","0 0 "+d.width()+" "+d.height()):m.attr("width",d.width()).attr("height",d.height()))}function f(){return m=d.root().append("svg"),e(),m}function g(a){if(!d[a]||!d[a]())throw new c.errors.InvalidStateException("Mandatory attribute chart."+a+" is missing on chart[#"+d.anchorName()+"]")}function h(a){if(d.dimension()&&d.dimension().filter){var b=P(d.dimension(),a);b&&(a=b)}return a}d.__dcFlag__=c.utils.uniqueId();var i,j,k,l,m,n,o,p,q,r,s,t=200,u=function(a){var b=a&&a.getBoundingClientRect&&a.getBoundingClientRect().width;return b&&b>t?b:t},v=u,w=200,x=function(a){var b=a&&a.getBoundingClientRect&&a.getBoundingClientRect().height;return b&&b>w?b:w},y=x,z=!1,A=c.pluck("key"),B=c.pluck("value"),C=c.pluck("key"),D=c.pluck("key"),E=!1,F=function(a){return d.keyAccessor()(a)+": "+d.valueAccessor()(a)},G=!0,H=!1,I=750,J=0,K=c.printers.filters,L=["dimension","group"],M=c.constants.DEFAULT_CHART_GROUP,N=a.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),O=[],P=function(a,b){return 0===b.length?a.filter(null):1!==b.length||b[0].isFiltered?1===b.length&&"RangedFilter"===b[0].filterType?a.filterRange(b[0]):a.filterFunction(function(a){for(var c=0;c<b.length;c++){var d=b[c];if(d.isFiltered&&d.isFiltered(a))return!0;if(d<=a&&d>=a)return!0}return!1}):a.filterExact(b[0]),b},Q=function(a){return a.all()};d.height=function(b){return arguments.length?(y=a.functor(b||x),p=void 0,d):(c.utils.isNumber(p)||(p=y(l.node())),p)},d.width=function(b){return arguments.length?(v=a.functor(b||u),o=void 0,d):(c.utils.isNumber(o)||(o=v(l.node())),o)},d.minWidth=function(a){return arguments.length?(t=a,d):t},d.minHeight=function(a){return arguments.length?(w=a,d):w},d.useViewBoxResizing=function(a){return arguments.length?(z=a,d):z},d.dimension=function(a){return arguments.length?(i=a,d.expireCache(),d):i},d.data=function(b){return arguments.length?(Q=a.functor(b),d.expireCache(),d):Q.call(d,j)},d.group=function(a,b){return arguments.length?(j=a,d._groupName=b,d.expireCache(),d):j},d.ordering=function(a){return arguments.length?(D=a,q=b.quicksort.by(D),d.expireCache(),d):D},d._computeOrderedGroups=function(a){var c=a.slice(0);return c.length<=1?c:(q||(q=b.quicksort.by(D)),q(c,0,c.length))},d.filterAll=function(){return d.filter(null)},d.select=function(a){return l.select(a)},d.selectAll=function(a){return l?l.selectAll(a):null},d.anchor=function(b,e){if(!arguments.length)return k;if(c.instanceOfChart(b))k=b.anchor(),l=b.root(),n=!0;else{if(!b)throw new c.errors.BadArgumentException("parent must be defined");k=b.select&&b.classed?b.node():b,l=a.select(k),l.classed(c.constants.CHART_CLASS,!0),c.registerChart(d,e),n=!1}return M=e,d},d.anchorName=function(){var a=d.anchor();return a&&a.id?a.id:a&&a.replace?a.replace("#",""):"dc-chart"+d.chartID()},d.root=function(a){return arguments.length?(l=a,d):l},d.svg=function(a){return arguments.length?(m=a,d):m},d.resetSvg=function(){return d.select("svg").remove(),f()},d.filterPrinter=function(a){return arguments.length?(K=a,d):K},d.controlsUseVisibility=function(a){return arguments.length?(H=a,d):H},d.turnOnControls=function(){if(l){var a=d.controlsUseVisibility()?"visibility":"display";d.selectAll(".reset").style(a,null),d.selectAll(".filter").text(K(d.filters())).style(a,null)}return d},d.turnOffControls=function(){if(l){var a=d.controlsUseVisibility()?"visibility":"display",b=d.controlsUseVisibility()?"hidden":"none";d.selectAll(".reset").style(a,b),d.selectAll(".filter").style(a,b).text(d.filter())}return d},d.transitionDuration=function(a){return arguments.length?(I=a,d):I},d.transitionDelay=function(a){return arguments.length?(J=a,d):J},d._mandatoryAttributes=function(a){return arguments.length?(L=a,d):L},d.render=function(){p=o=void 0,N.preRender(d),L&&L.forEach(g);var a=d._doRender();return r&&r.render(),d._activateRenderlets("postRender"),a},d._activateRenderlets=function(a){N.pretransition(d),d.transitionDuration()>0&&m?m.transition().duration(d.transitionDuration()).delay(d.transitionDelay()).each("end",function(){N.renderlet(d),a&&N[a](d)}):(N.renderlet(d),a&&N[a](d))},d.redraw=function(){e(),N.preRedraw(d);var a=d._doRedraw();return r&&r.render(),d._activateRenderlets("postRedraw"),a},d.commitHandler=function(a){return arguments.length?(s=a,d):s},d.redrawGroup=function(){return s?s(!1,function(a,b){a?console.log(a):c.redrawAll(d.chartGroup())}):c.redrawAll(d.chartGroup()),d},d.renderGroup=function(){return s?s(!1,function(a,b){a?console.log(a):c.renderAll(d.chartGroup())}):c.renderAll(d.chartGroup()),d},d._invokeFilteredListener=function(a){void 0!==a&&N.filtered(d,a)},d._invokeZoomedListener=function(){N.zoomed(d)};var R=function(a,b){return null===b||"undefined"==typeof b?a.length>0:a.some(function(a){return b<=a&&b>=a})};d.hasFilterHandler=function(a){return arguments.length?(R=a,d):R},d.hasFilter=function(a){return R(O,a)};var S=function(a,b){for(var c=0;c<a.length;c++)if(a[c]<=b&&a[c]>=b){a.splice(c,1);break}return a};d.removeFilterHandler=function(a){return arguments.length?(S=a,d):S};var T=function(a,b){return a.push(b),a};d.addFilterHandler=function(a){return arguments.length?(T=a,d):T};var U=function(a){return[]};return d.resetFilterHandler=function(a){return arguments.length?(U=a,d):U},d.replaceFilter=function(a){return O=U(O),d.filter(a),d},d.filter=function(a){if(!arguments.length)return O.length>0?O[0]:null;var b=O;return a instanceof Array&&a[0]instanceof Array&&!a.isFiltered?a[0].forEach(function(a){b=R(b,a)?S(b,a):T(b,a)}):b=null===a?U(b):R(b,a)?S(b,a):T(b,a),O=h(b),d._invokeFilteredListener(a),null!==l&&d.hasFilter()?d.turnOnControls():d.turnOffControls(),d},d.filters=function(){return O},d.highlightSelected=function(b){a.select(b).classed(c.constants.SELECTED_CLASS,!0),a.select(b).classed(c.constants.DESELECTED_CLASS,!1)},d.fadeDeselected=function(b){a.select(b).classed(c.constants.SELECTED_CLASS,!1),a.select(b).classed(c.constants.DESELECTED_CLASS,!0)},d.resetHighlight=function(b){a.select(b).classed(c.constants.SELECTED_CLASS,!1),a.select(b).classed(c.constants.DESELECTED_CLASS,!1)},d.onClick=function(a){var b=d.keyAccessor()(a);c.events.trigger(function(){d.filter(b),d.redrawGroup()})},d.filterHandler=function(a){return arguments.length?(P=a,d):P},d._doRender=function(){return d},d._doRedraw=function(){return d},d.legendables=function(){return[]},d.legendHighlight=function(){},d.legendReset=function(){},d.legendToggle=function(){},d.isLegendableHidden=function(){return!1},d.keyAccessor=function(a){return arguments.length?(A=a,d):A},d.valueAccessor=function(a){return arguments.length?(B=a,d):B},d.label=function(a,b){return arguments.length?(C=a,(void 0===b||b)&&(E=!0),d):C},d.renderLabel=function(a){return arguments.length?(E=a,d):E},d.title=function(a){return arguments.length?(F=a,d):F},d.renderTitle=function(a){return arguments.length?(G=a,d):G},d.renderlet=c.logger.deprecate(function(a){return d.on("renderlet."+c.utils.uniqueId(),a),d},'chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)'),d.chartGroup=function(a){return arguments.length?(n||c.deregisterChart(d,M),M=a,n||c.registerChart(d,M),d):M},d.expireCache=function(){return d},d.legend=function(a){return arguments.length?(r=a,r.parent(d),d):r},d.chartID=function(){return d.__dcFlag__},d.options=function(a){var b=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(var e in a)"function"==typeof d[e]?a[e]instanceof Array&&b.indexOf(e)!==-1?d[e].apply(d,a[e]):d[e].call(d,a[e]):c.logger.debug("Not a valid option setter name: "+e);return d},d.on=function(a,b){return N.on(a,b),d},d},c.marginMixin=function(a){var b={top:10,right:50,bottom:30,left:30};return a.margins=function(c){return arguments.length?(b=c,a):b},a.effectiveWidth=function(){return a.width()-a.margins().left-a.margins().right},a.effectiveHeight=function(){return a.height()-a.margins().top-a.margins().bottom},a},c.colorMixin=function(b){var d=a.scale.category20c(),e=!0,f=function(a){return b.keyAccessor()(a)};return b.colors=function(c){return arguments.length?(d=c instanceof Array?a.scale.quantize().range(c):a.functor(c),b):d},b.ordinalColors=function(c){return b.colors(a.scale.ordinal().range(c))},b.linearColors=function(c){return b.colors(a.scale.linear().range(c).interpolate(a.interpolateHcl))},b.colorAccessor=function(a){return arguments.length?(f=a,e=!1,b):f},b.defaultColorAccessor=function(){return e},b.colorDomain=function(a){return arguments.length?(d.domain(a),b):d.domain()},b.calculateColorDomain=function(){var c=[a.min(b.data(),b.colorAccessor()),a.max(b.data(),b.colorAccessor())];return d.domain(c),b},b.getColor=function(a,b){return d(f.call(this,a,b))},b.colorCalculator=c.logger.deprecate(function(a){return arguments.length?(b.getColor=a,b):b.getColor},"colorMixin.colorCalculator has been deprecated. Please colorMixin.colors and colorMixin.colorAccessor instead"),b},c.coordinateGridMixin=function(b){function d(a,b){return!a||!b||a.length!==b.length||a.some(function(a,c){return a&&b[c]?a.toString()!==b[c].toString():a===b[c]})}function e(a,c){b.isOrdinal()?(b.elasticX()||0===z.domain().length)&&z.domain(b._ordinalXDomain()):b.elasticX()&&z.domain([b.xAxisMin(),b.xAxisMax()]);var e=z.domain();(c||d(C,e))&&b.rescale(),C=e,b.isOrdinal()?z.rangeBands([0,b.xAxisLength()],fa,b._useOuterPadding()?ea:0):z.range([0,b.xAxisLength()]),J=J.scale(b.x()),f(a)}function f(a){var d=a.select("g."+s);if(W){d.empty()&&(d=a.insert("g",":first-child").attr("class",q+" "+s).attr("transform","translate("+b.margins().left+","+b.margins().top+")"));var e=J.tickValues()?J.tickValues():"function"==typeof z.ticks?z.ticks(J.ticks()[0]):z.domain(),f=d.selectAll("line").data(e),g=f.enter().append("line").attr("x1",function(a){return z(a)}).attr("y1",b._xAxisY()-b.margins().top).attr("x2",function(a){return z(a)}).attr("y2",0).attr("opacity",0);c.transition(g,b.transitionDuration(),b.transitionDelay()).attr("opacity",1),c.transition(f,b.transitionDuration(),b.transitionDelay()).attr("x1",function(a){return z(a)}).attr("y1",b._xAxisY()-b.margins().top).attr("x2",function(a){return z(a)}).attr("y2",0),f.exit().remove()}else d.selectAll("line").remove()}function g(){return b._xAxisY()-b.margins().top}function h(){return b.anchorName().replace(/[ .#=\[\]"]/g,"-")+"-clip"}function i(){var a=c.utils.appendOrSelect(w,"defs"),d=h(),e=c.utils.appendOrSelect(a,"#"+d,"clipPath").attr("id",d),f=2*da;c.utils.appendOrSelect(e,"rect").attr("width",b.xAxisLength()+f).attr("height",b.yAxisHeight()+f).attr("transform","translate(-"+da+", -"+da+")")}function j(a){b.isOrdinal()&&(U=!1),e(b.g(),a),b._prepareYAxis(b.g()),b.plotData(),(b.elasticX()||Y||a)&&b.renderXAxis(b.g()),(b.elasticY()||Y||a)&&b.renderYAxis(b.g()),a?b.renderBrush(b.g(),!1):b.redrawBrush(b.g(),Y),b.fadeDeselectedArea(),Y=!1}function k(){ca?b._enableMouseZoom():ba&&b._disableMouseZoom()}function l(){if(X=!0,$){var a=A;H&&(a=m(a,H.x().domain()));var d=n(b.x().domain(),a);d&&b.x().domain(d)}var e=b.x().domain(),f=c.filters.RangedFilter(e[0],e[1]);b.replaceFilter(f),b.rescale(),b.redraw(),H&&!o(b.filter(),H.filter())&&c.events.trigger(function(){H.replaceFilter(f),H.redraw()}),b._invokeZoomedListener(),c.events.trigger(function(){b.redrawGroup()},c.constants.EVENT_DELAY),X=!o(e,A)}function m(a,b){return(a[0]>b[1]||a[1]<b[0])&&console.warn("could not intersect extents"),[Math.max(a[0],b[0]),Math.min(a[1],b[1])]}function n(a,b){var d=a[1]-a[0];return a[0]<b[0]?[b[0],Math.min(b[1],c.utils.add(b[0],d,"millis"))]:a[1]>b[1]?[Math.max(b[0],c.utils.subtract(b[1],d,"millis")),b[1]]:null}function o(a,b){return!a&&!b||!(!a||!b)&&(0===a.length&&0===b.length||a[0].valueOf()===b[0].valueOf()&&a[1].valueOf()===b[1].valueOf())}function p(a){return a instanceof Array&&a.length>1}var q="grid-line",r="horizontal",s="vertical",t="y-axis-label",u="x-axis-label",v=12;b=c.colorMixin(c.marginMixin(c.baseMixin(b))),b.colors(a.scale.category10()),b._mandatoryAttributes().push("x");var w,x,y,z,A,B,C,D,E,F,G,H,I,J=a.svg.axis().orient("bottom"),K=c.units.integers,L=0,M="day",N=!1,O=0,P=a.svg.axis().orient("left"),Q=0,R=!1,S=0,T=a.svg.brush(),U=!0,V=!1,W=!1,X=!1,Y=!1,Z=[1,1/0],$=!0,_=a.behavior.zoom().on("zoom",l),aa=a.behavior.zoom().on("zoom",null),ba=!1,ca=!1,da=0,ea=.5,fa=0,ga=!1;return b.rescale=function(){return G=void 0,Y=!0,b},b.resizing=function(){return Y},b.rangeChart=function(a){return arguments.length?(H=a,H.focusChart(b),b):H},b.zoomScale=function(a){return arguments.length?(Z=a,b):Z},b.zoomOutRestrict=function(a){return arguments.length?(Z[0]=a?1:0,$=a,b):$},b._generateG=function(a){w=void 0===a?b.svg():a;var c=window.location.href.split("#")[0];return x=w.append("g"),y=x.append("g").attr("class","chart-body").attr("transform","translate("+b.margins().left+", "+b.margins().top+")").attr("clip-path","url("+c+"#"+h()+")"),x},b.g=function(a){return arguments.length?(x=a,b):x},b.mouseZoomable=function(a){return arguments.length?(ca=a,b):ca},b.chartBodyG=function(a){return arguments.length?(y=a,b):y},b.x=function(a){return arguments.length?(z=a,A=z.domain(),b.rescale(),b):z},b.xOriginalDomain=function(){return A},b.xUnits=function(a){return arguments.length?(K=a,b):K},b.xAxis=function(a){return arguments.length?(J=a,b):J},b.elasticX=function(a){return arguments.length?(N=a,b):N},b.xAxisPadding=function(a){return arguments.length?(L=a,b):L},b.xAxisPaddingUnit=function(a){return arguments.length?(M=a,b):M},b.xUnitCount=function(){if(void 0===G){var a=b.xUnits()(b.x().domain()[0],b.x().domain()[1],b.x().domain());G=a instanceof Array?a.length:a}return G},b.useRightYAxis=function(a){return arguments.length?(ga=a,b):ga},b.isOrdinal=function(){return b.xUnits()===c.units.ordinal},b._useOuterPadding=function(){return!0},b._ordinalXDomain=function(){var a=b._computeOrderedGroups(b.data());return a.map(b.keyAccessor())},b.renderXAxis=function(a){var d=a.select("g.x");d.empty()&&(d=a.append("g").attr("class","axis x").attr("transform","translate("+b.margins().left+","+b._xAxisY()+")"));var e=a.select("text."+u);e.empty()&&b.xAxisLabel()&&(e=a.append("text").attr("class",u).attr("transform","translate("+(b.margins().left+b.xAxisLength()/2)+","+(b.height()-O)+")").attr("text-anchor","middle")),b.xAxisLabel()&&e.text()!==b.xAxisLabel()&&e.text(b.xAxisLabel()),c.transition(d,b.transitionDuration(),b.transitionDelay()).attr("transform","translate("+b.margins().left+","+b._xAxisY()+")").call(J),c.transition(e,b.transitionDuration(),b.transitionDelay()).attr("transform","translate("+(b.margins().left+b.xAxisLength()/2)+","+(b.height()-O)+")")},b._xAxisY=function(){return b.height()-b.margins().bottom},b.xAxisLength=function(){return b.effectiveWidth()},b.xAxisLabel=function(a,c){return arguments.length?(B=a,b.margins().bottom-=O,O=void 0===c?v:c,b.margins().bottom+=O,b):B},b._prepareYAxis=function(c){if(void 0===D||b.elasticY()){void 0===D&&(D=a.scale.linear());var d=b.yAxisMin()||0,e=b.yAxisMax()||0;D.domain([d,e]).rangeRound([b.yAxisHeight(),0])}D.range([b.yAxisHeight(),0]),P=P.scale(D),ga&&P.orient("right"),b._renderHorizontalGridLinesForAxis(c,D,P)},b.renderYAxisLabel=function(a,d,e,f){f=f||S;var g=b.g().select("text."+t+"."+a+"-label"),h=b.margins().top+b.yAxisHeight()/2;g.empty()&&d&&(g=b.g().append("text").attr("transform","translate("+f+","+h+"),rotate("+e+")").attr("class",t+" "+a+"-label").attr("text-anchor","middle").text(d)),d&&g.text()!==d&&g.text(d),c.transition(g,b.transitionDuration(),b.transitionDelay()).attr("transform","translate("+f+","+h+"),rotate("+e+")")},b.renderYAxisAt=function(a,d,e){var f=b.g().select("g."+a);f.empty()&&(f=b.g().append("g").attr("class","axis "+a).attr("transform","translate("+e+","+b.margins().top+")")),c.transition(f,b.transitionDuration(),b.transitionDelay()).attr("transform","translate("+e+","+b.margins().top+")").call(d)},b.renderYAxis=function(){var a=ga?b.width()-b.margins().right:b._yAxisX();b.renderYAxisAt("y",P,a);var c=ga?b.width()-S:S,d=ga?90:-90;b.renderYAxisLabel("y",b.yAxisLabel(),d,c)},b._renderHorizontalGridLinesForAxis=function(a,d,e){var f=a.select("g."+r);if(V){var g=e.tickValues()?e.tickValues():d.ticks(e.ticks()[0]);f.empty()&&(f=a.insert("g",":first-child").attr("class",q+" "+r).attr("transform","translate("+b.margins().left+","+b.margins().top+")"));var h=f.selectAll("line").data(g),i=h.enter().append("line").attr("x1",1).attr("y1",function(a){return d(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return d(a)}).attr("opacity",0);c.transition(i,b.transitionDuration(),b.transitionDelay()).attr("opacity",1),c.transition(h,b.transitionDuration(),b.transitionDelay()).attr("x1",1).attr("y1",function(a){return d(a)}).attr("x2",b.xAxisLength()).attr("y2",function(a){return d(a)}),h.exit().remove()}else f.selectAll("line").remove()},b._yAxisX=function(){return b.useRightYAxis()?b.width()-b.margins().right:b.margins().left},b.yAxisLabel=function(a,c){return arguments.length?(E=a,b.margins().left-=S,S=void 0===c?v:c,b.margins().left+=S,b):E},b.y=function(a){return arguments.length?(D=a,b.rescale(),b):D},b.yAxis=function(a){return arguments.length?(P=a,b):P},b.elasticY=function(a){return arguments.length?(R=a,b):R},b.renderHorizontalGridLines=function(a){return arguments.length?(V=a,b):V},b.renderVerticalGridLines=function(a){return arguments.length?(W=a,b):W},b.xAxisMin=function(){var d=a.min(b.data(),function(a){return b.keyAccessor()(a)});return c.utils.subtract(d,L,M)},b.xAxisMax=function(){var d=a.max(b.data(),function(a){return b.keyAccessor()(a)});return c.utils.add(d,L,M)},b.yAxisMin=function(){var d=a.min(b.data(),function(a){return b.valueAccessor()(a)});return c.utils.subtract(d,Q)},b.yAxisMax=function(){var d=a.max(b.data(),function(a){return b.valueAccessor()(a)});return c.utils.add(d,Q)},b.yAxisPadding=function(a){return arguments.length?(Q=a,b):Q},b.yAxisHeight=function(){return b.effectiveHeight()},b.round=function(a){return arguments.length?(F=a,b):F},b._rangeBandPadding=function(a){return arguments.length?(fa=a,b):fa},b._outerRangeBandPadding=function(a){return arguments.length?(ea=a,b):ea},c.override(b,"filter",function(a){return arguments.length?(b._filter(a),a?b.brush().extent(a):b.brush().clear(),b):b._filter()}),b.brush=function(a){return arguments.length?(T=a,b):T},b.renderBrush=function(a){if(U){T.on("brush",b._brushing),T.on("brushstart",b._disableMouseZoom),T.on("brushend",k);var c=a.append("g").attr("class","brush").attr("transform","translate("+b.margins().left+","+b.margins().top+")").call(T.x(b.x()));b.setBrushY(c,!1),b.setHandlePaths(c),b.hasFilter()&&b.redrawBrush(a,!1)}},b.setHandlePaths=function(a){a.selectAll(".resize").append("path").attr("d",b.resizeHandlePath)},b.setBrushY=function(a){a.selectAll("rect").attr("height",g()),a.selectAll(".resize path").attr("d",b.resizeHandlePath)},b.extendBrush=function(){var a=T.extent();return b.round()&&(a[0]=a.map(b.round())[0],a[1]=a.map(b.round())[1],x.select(".brush").call(T.extent(a))),a},b.brushIsEmpty=function(a){return T.empty()||!a||a[1]<=a[0]},b._brushing=function(){var a=b.extendBrush();if(b.redrawBrush(x,!1),b.brushIsEmpty(a))c.events.trigger(function(){b.filter(null),b.redrawGroup()},c.constants.EVENT_DELAY);else{var d=c.filters.RangedFilter(a[0],a[1]);c.events.trigger(function(){b.replaceFilter(d),b.redrawGroup()},c.constants.EVENT_DELAY)}},b.redrawBrush=function(a,d){if(U){b.filter()&&b.brush().empty()&&b.brush().extent(b.filter());var e=c.optionalTransition(d,b.transitionDuration(),b.transitionDelay())(a.select("g.brush"));b.setBrushY(e),e.call(b.brush().x(b.x()).extent(b.brush().extent()))}b.fadeDeselectedArea()},b.fadeDeselectedArea=function(){},b.resizeHandlePath=function(a){var b=+("e"===a),c=b?1:-1,d=g()/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)},b.clipPadding=function(a){return arguments.length?(da=a,b):da},b._preprocessData=function(){},b._doRender=function(){return b.resetSvg(),b._preprocessData(),b._generateG(),i(),j(!0),k(),b},b._doRedraw=function(){return b._preprocessData(),j(!1),i(),b},b._enableMouseZoom=function(){ba=!0,_.x(b.x()).scaleExtent(Z).size([b.width(),b.height()]).duration(b.transitionDuration()),b.root().call(_)},b._disableMouseZoom=function(){b.root().call(aa)},b.focus=function(a){p(a)?b.x().domain(a):b.x().domain(A),_.x(b.x()),l()},b.refocused=function(){return X},b.focusChart=function(a){return arguments.length?(I=a,b.on("filtered",function(a){a.filter()?o(a.filter(),I.filter())||c.events.trigger(function(){I.focus(a.filter())}):c.events.trigger(function(){I.x().domain(I.xOriginalDomain())})}),b):I},b.brushOn=function(a){return arguments.length?(U=a,b):U},b},c.stackMixin=function(b){function d(a,c){var d=a.accessor||b.valueAccessor();return a.name=String(a.name||c),a.values=a.group.all().map(function(c,e){return{x:b.keyAccessor()(c,e),y:a.hidden?null:d(c,e),data:c,layer:a.name,hidden:a.hidden}}),a.values=a.values.filter(e()),a.values}function e(){if(!b.x()||m)return a.functor(!0);var c=b.x().domain();return b.isOrdinal()?function(){return!0}:b.elasticX()?function(){return!0}:function(a){return a.x>=c[0]&&a.x<=c[c.length-1]}}function f(a){var b=j.map(c.pluck("name")).indexOf(a);return j[b]}function g(){var a=b.data().map(function(a){return a.values});return Array.prototype.concat.apply([],a)}function h(a){return!a.hidden}var i=a.layout.stack().values(d),j=[],k={},l=!1,m=!1;return b.stack=function(a,c,d){if(!arguments.length)return j;arguments.length<=2&&(d=c);var e={group:a};return"string"==typeof c&&(e.name=c),"function"==typeof d&&(e.accessor=d),j.push(e),b},c.override(b,"group",function(a,c,d){return arguments.length?(j=[],k={},b.stack(a,c),d&&b.valueAccessor(d),b._group(a,c)):b._group()}),b.hidableStacks=function(a){return arguments.length?(l=a,b):l},b.hideStack=function(a){var c=f(a);return c&&(c.hidden=!0),b},b.showStack=function(a){var c=f(a);return c&&(c.hidden=!1),b},b.getValueAccessorByIndex=function(a){return j[a].accessor||b.valueAccessor()},b.yAxisMin=function(){var d=a.min(g(),function(a){return a.y<0?a.y+a.y0:a.y0});return c.utils.subtract(d,b.yAxisPadding())},b.yAxisMax=function(){var d=a.max(g(),function(a){return a.y>0?a.y+a.y0:a.y0});return c.utils.add(d,b.yAxisPadding())},b.xAxisMin=function(){var d=a.min(g(),c.pluck("x"));return c.utils.subtract(d,b.xAxisPadding(),b.xAxisPaddingUnit())},b.xAxisMax=function(){var d=a.max(g(),c.pluck("x"));return c.utils.add(d,b.xAxisPadding(),b.xAxisPaddingUnit())},c.override(b,"title",function(a,c){return a?"function"==typeof a?b._title(a):a===b._groupName&&"function"==typeof c?b._title(c):"function"!=typeof c?k[a]||b._title():(k[a]=c,b):b._title()}),b.stackLayout=function(c){return arguments.length?(i=c,i.values()===a.layout.stack().values()&&i.values(d),b):i},b.evadeDomainFilter=function(a){return arguments.length?(m=a,b):m},b.data(function(){var a=j.filter(h);return a.length?b.stackLayout()(a):[]}),b._ordinalXDomain=function(){var a=g().map(c.pluck("data")),d=b._computeOrderedGroups(a);return d.map(b.keyAccessor())},b.colorAccessor(function(a){var b=this.layer||this.name||a.name||a.layer;return b}),b.legendables=function(){return j.map(function(a,c){return{chart:b,name:a.name,hidden:a.hidden||!1,color:b.getColor.call(a,a.values,c)}})},b.isLegendableHidden=function(a){var b=f(a.name);return!!b&&b.hidden},b.legendToggle=function(a){l&&(b.isLegendableHidden(a)?b.showStack(a.name):b.hideStack(a.name),b.renderGroup())},b},c.capMixin=function(b){var d=1/0,e=!0,f="Others";b.ordering(function(a){return-a.value});var g=function(c,d){var e=a.sum(d,b.valueAccessor()),f=d.map(b.keyAccessor());return e>0?c.concat([{others:f,key:b.othersLabel(),value:e}]):c};return b.cappedKeyAccessor=function(a,c){return a.others?a.key:b.keyAccessor()(a,c)},b.cappedValueAccessor=function(a,c){return a.others?a.value:b.valueAccessor()(a,c)},b.data(function(a){if(d===1/0)return b._computeOrderedGroups(a.all());var c,f=a.all();if(f=b._computeOrderedGroups(f),d)if(e)c=f.slice(d),f=f.slice(0,d);else{var h=Math.max(0,f.length-d);c=f.slice(0,h),f=f.slice(h)}return g?g(f,c):f}),b.cap=function(a){return arguments.length?(d=a,b):d},b.takeFront=function(a){return arguments.length?(e=a,b):e},b.othersLabel=function(a){return arguments.length?(f=a,b):f},b.othersGrouper=function(a){return arguments.length?(g=a,b):g},c.override(b,"onClick",function(a){a.others&&b.filter([a.others]),b._onClick(a)}),b},c.bubbleMixin=function(b){var d=.3,e=10,f=!1,g=!1;b.BUBBLE_NODE_CLASS="node",b.BUBBLE_CLASS="bubble",b.MIN_RADIUS=10,b=c.colorMixin(b),b.renderLabel(!0),b.data(function(c){var d=c.all();if(f){var e=b.radiusValueAccessor();d.sort(function(b,c){return a.descending(e(b),e(c))})}return d});var h=a.scale.linear().domain([0,100]),i=function(a){return a.r};b.r=function(a){return arguments.length?(h=a,b):h},b.elasticRadius=function(a){return arguments.length?(g=a,b):g},b.calculateRadiusDomain=function(){g&&b.r().domain([b.rMin(),b.rMax()])},b.radiusValueAccessor=function(a){return arguments.length?(i=a,b):i},b.rMin=function(){var c=a.min(b.data(),function(a){
|
|
return b.radiusValueAccessor()(a)});return c},b.rMax=function(){var c=a.max(b.data(),function(a){return b.radiusValueAccessor()(a)});return c},b.bubbleR=function(a){var c=b.radiusValueAccessor()(a),d=b.r()(c);return(isNaN(d)||c<=0)&&(d=0),d};var j=function(a){return b.label()(a)},k=function(a){return b.bubbleR(a)>e},l=function(a){return k(a)?1:0},m=function(a){return k(a)?"all":"none"};b._doRenderLabel=function(a){if(b.renderLabel()){var d=a.select("text");d.empty()&&(d=a.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",b.onClick)),d.attr("opacity",0).attr("pointer-events",m).text(j),c.transition(d,b.transitionDuration(),b.transitionDelay()).attr("opacity",l)}},b.doUpdateLabels=function(a){if(b.renderLabel()){var d=a.select("text").attr("pointer-events",m).text(j);c.transition(d,b.transitionDuration(),b.transitionDelay()).attr("opacity",l)}};var n=function(a){return b.title()(a)};return b._doRenderTitles=function(a){if(b.renderTitle()){var c=a.select("title");c.empty()&&a.append("title").text(n)}},b.doUpdateTitles=function(a){b.renderTitle()&&a.select("title").text(n)},b.sortBubbleSize=function(a){return arguments.length?(f=a,b):f},b.minRadius=function(a){return arguments.length?(b.MIN_RADIUS=a,b):b.MIN_RADIUS},b.minRadiusWithLabel=function(a){return arguments.length?(e=a,b):e},b.maxBubbleRelativeSize=function(a){return arguments.length?(d=a,b):d},b.fadeDeselectedArea=function(){b.hasFilter()?b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(a){b.isSelectedNode(a)?b.highlightSelected(this):b.fadeDeselected(this)}):b.selectAll("g."+b.BUBBLE_NODE_CLASS).each(function(){b.resetHighlight(this)})},b.isSelectedNode=function(a){return b.hasFilter(a.key)},b.onClick=function(a){var d=a.key;c.events.trigger(function(){b.filter(d),b.redrawGroup()})},b},c.pieChart=function(b,d){function e(){var b=a.min([W.width(),W.height()])/2;F=G&&G<b?G:b;var d,e=t(),g=v();if(a.sum(W.data(),W.valueAccessor())?(d=g(W.data()),H.classed(Q,!1)):(d=g([{key:R,value:1,others:[R]}]),H.classed(Q,!0)),H){var h=H.select("g."+O).selectAll("g."+M).data(d),i=H.select("g."+P).selectAll("text."+N).data(d);f(h,i,e,d),n(d,e),r(h,i),s(),c.transition(H,W.transitionDuration(),W.transitionDelay()).attr("transform","translate("+W.cx()+","+W.cy()+")")}}function f(a,b,c,d){var e=g(a);h(e,c),i(e),l(b,d,c)}function g(a){var b=a.enter().append("g").attr("class",function(a,b){return M+" _"+b});return b}function h(a,b){var d=a.append("path").attr("fill",A).on("click",B).attr("d",function(a,c){return C(a,c,b)}),e=c.transition(d,W.transitionDuration(),W.transitionDelay());e.attrTween&&e.attrTween("d",y)}function i(a){W.renderTitle()&&a.append("title").text(function(a){return W.title()(a.data)})}function j(a,b){W._applyLabelText(a),c.transition(a,W.transitionDuration(),W.transitionDelay()).attr("transform",function(a){return D(a,b)}).attr("text-anchor","middle")}function k(a,b){W.select("g.pie-slice._"+a).classed("highlight",b)}function l(a,b,c){if(W.renderLabel()){var d=a.enter().append("text").attr("class",function(a,b){var c=M+" "+N+" _"+b;return K&&(c+=" external"),c}).on("click",B).on("mouseover",function(a,b){k(b,!0)}).on("mouseout",function(a,b){k(b,!1)});j(d,c),K&&V&&m(b,c)}}function m(b,d){var e=H.selectAll("polyline."+M).data(b);e.enter().append("polyline").attr("class",function(a,b){return"pie-path _"+b+" "+M}).on("click",B).on("mouseover",function(a,b){k(b,!0)}).on("mouseout",function(a,b){k(b,!1)}),e.exit().remove();var f=a.svg.arc().outerRadius(F-T+K).innerRadius(F-T),g=c.transition(e,W.transitionDuration(),W.transitionDelay());g.attrTween?g.attrTween("points",function(b){var c=this._current||b;c={startAngle:c.startAngle,endAngle:c.endAngle};var e=a.interpolate(c,b);return this._current=e(0),function(a){var b=e(a);return[d.centroid(b),f.centroid(b)]}}):g.attr("points",function(a){return[d.centroid(a),f.centroid(a)]}),g.style("visibility",function(a){return a.endAngle-a.startAngle<1e-4?"hidden":"visible"})}function n(a,b){o(a,b),p(a,b),q(a)}function o(a,b){var d=H.selectAll("g."+M).data(a).select("path").attr("d",function(a,c){return C(a,c,b)}),e=c.transition(d,W.transitionDuration(),W.transitionDelay());e.attrTween&&e.attrTween("d",y),e.attr("fill",A)}function p(a,b){if(W.renderLabel()){var c=H.selectAll("text."+N).data(a);j(c,b),K&&V&&m(a,b)}}function q(a){W.renderTitle()&&H.selectAll("g."+M).data(a).select("title").text(function(a){return W.title()(a.data)})}function r(a,b){a.exit().remove(),b.exit().remove()}function s(){W.hasFilter()?W.selectAll("g."+M).each(function(a){u(a)?W.highlightSelected(this):W.fadeDeselected(this)}):W.selectAll("g."+M).each(function(){W.resetHighlight(this)})}function t(){return a.svg.arc().outerRadius(F-T).innerRadius(S)}function u(a){return W.hasFilter(W.cappedKeyAccessor(a.data))}function v(){return a.layout.pie().sort(null).value(W.cappedValueAccessor)}function w(a){var b=a.endAngle-a.startAngle;return isNaN(b)||b<U}function x(a){return 0===W.cappedValueAccessor(a)}function y(b){b.innerRadius=S;var c=this._current;c=z(c)?{startAngle:0,endAngle:0}:{startAngle:c.startAngle,endAngle:c.endAngle};var d=a.interpolate(c,b);return this._current=d(0),function(a){return C(d(a),0,t())}}function z(a){return!a||isNaN(a.startAngle)||isNaN(a.endAngle)}function A(a,b){return W.getColor(a.data,b)}function B(a,b){H.attr("class")!==Q&&W.onClick(a.data,b)}function C(a,b,c){var d=c(a,b);return d.indexOf("NaN")>=0&&(d="M0,0"),d}function D(b,c){var d;return d=K?a.svg.arc().outerRadius(F-T+K).innerRadius(F-T+K).centroid(b):c.centroid(b),isNaN(d[0])||isNaN(d[1])?"translate(0,0)":"translate("+d+")"}function E(b,c){W.selectAll("g.pie-slice").each(function(d){b.name===d.data.key&&a.select(this).classed("highlight",c)})}var F,G,H,I,J,K,L=.5,M="pie-slice",N="pie-label",O="pie-slice-group",P="pie-label-group",Q="empty-chart",R="empty",S=0,T=0,U=L,V=!1,W=c.capMixin(c.colorMixin(c.baseMixin({})));return W.colorAccessor(W.cappedKeyAccessor),W.title(function(a){return W.cappedKeyAccessor(a)+": "+W.cappedValueAccessor(a)}),W.slicesCap=W.cap,W.label(W.cappedKeyAccessor),W.renderLabel(!0),W.transitionDuration(350),W.transitionDelay(0),W._doRender=function(){return W.resetSvg(),H=W.svg().append("g").attr("transform","translate("+W.cx()+","+W.cy()+")"),H.append("g").attr("class",O),H.append("g").attr("class",P),e(),W},W._applyLabelText=function(a){a.text(function(a){var b=a.data;return!x(b)&&!w(a)||u(a)?W.label()(a.data):""})},W.externalRadiusPadding=function(a){return arguments.length?(T=a,W):T},W.innerRadius=function(a){return arguments.length?(S=a,W):S},W.radius=function(a){return arguments.length?(G=a,W):G},W.cx=function(a){return arguments.length?(I=a,W):I||W.width()/2},W.cy=function(a){return arguments.length?(J=a,W):J||W.height()/2},W._doRedraw=function(){return e(),W},W.minAngleForLabel=function(a){return arguments.length?(U=a,W):U},W.emptyTitle=function(a){return 0===arguments.length?R:(R=a,W)},W.externalLabels=function(a){return 0===arguments.length?K:(K=a?a:void 0,W)},W.drawPaths=function(a){return 0===arguments.length?V:(V=a,W)},W.legendables=function(){return W.data().map(function(a,b){var c={name:a.key,data:a.value,others:a.others,chart:W};return c.color=W.getColor(a,b),c})},W.legendHighlight=function(a){E(a,!0)},W.legendReset=function(a){E(a,!1)},W.legendToggle=function(a){W.onClick({key:a.name,others:a.others})},W.anchor(b,d)},c.barChart=function(b,d){function e(a){return c.utils.safeNumber(Math.abs(n.y()(a.y+a.y0)-n.y()(a.y0)))}function f(a,b,d){var f=a.selectAll("text.barLabel").data(d.values,c.pluck("x"));f.enter().append("text").attr("class","barLabel").attr("text-anchor","middle"),n.isOrdinal()&&(f.on("click",n.onClick),f.attr("cursor","pointer")),c.transition(f,n.transitionDuration(),n.transitionDelay()).attr("x",function(a){var b=n.x()(a.x);return p||(b+=j/2),c.utils.safeNumber(b)}).attr("y",function(a){var b=n.y()(a.y+a.y0);return a.y<0&&(b-=e(a)),c.utils.safeNumber(b-m)}).text(function(a){return n.label()(a)}),c.transition(f.exit(),n.transitionDuration(),n.transitionDelay()).attr("height",0).remove()}function g(a,b,d){var f=a.selectAll("rect.bar").data(d.values,c.pluck("x")),g=f.enter().append("rect").attr("class","bar").attr("fill",c.pluck("data",n.getColor)).attr("y",n.yAxisHeight()).attr("height",0);n.renderTitle()&&g.append("title").text(c.pluck("data",n.title(d.name))),n.isOrdinal()&&f.on("click",n.onClick),c.transition(f,n.transitionDuration(),n.transitionDelay()).attr("x",function(a){var b=n.x()(a.x);return p&&(b-=j/2),n.isOrdinal()&&void 0!==o&&(b+=o/2),c.utils.safeNumber(b)}).attr("y",function(a){var b=n.y()(a.y+a.y0);return a.y<0&&(b-=e(a)),c.utils.safeNumber(b)}).attr("width",j).attr("height",function(a){return e(a)}).attr("fill",c.pluck("data",n.getColor)).select("title").text(c.pluck("data",n.title(d.name))),c.transition(f.exit(),n.transitionDuration(),n.transitionDelay()).attr("x",function(a){return n.x()(a.x)}).attr("width",.9*j).remove()}function h(){if(void 0===j){var a=n.xUnitCount();j=n.isOrdinal()&&void 0===o?Math.floor(n.x().rangeBand()):o?Math.floor((n.xAxisLength()-(a-1)*o)/a):Math.floor(n.xAxisLength()/(1+n.barPadding())/a),(j===1/0||isNaN(j)||j<k)&&(j=k)}}function i(b,c){return function(){var d=a.select(this),e=d.attr("fill")===b;return c?!e:e}}var j,k=1,l=2,m=3,n=c.stackMixin(c.coordinateGridMixin({})),o=l,p=!1,q=!1;return c.override(n,"rescale",function(){return n._rescale(),j=void 0,n}),c.override(n,"render",function(){return n.round()&&p&&!q&&c.logger.warn("By default, brush rounding is disabled if bars are centered. See dc.js bar chart API documentation for details."),n._render()}),n.label(function(a){return c.utils.printSingleValue(a.y0+a.y)},!1),n.plotData=function(){var b=n.chartBodyG().selectAll("g.stack").data(n.data());h(),b.enter().append("g").attr("class",function(a,b){return"stack _"+b});var c=b.size()-1;b.each(function(b,d){var e=a.select(this);g(e,d,b),n.renderLabel()&&c===d&&f(e,d,b)})},n.fadeDeselectedArea=function(){var a=n.chartBodyG().selectAll("rect.bar"),b=n.brush().extent();if(n.isOrdinal())n.hasFilter()?(a.classed(c.constants.SELECTED_CLASS,function(a){return n.hasFilter(a.x)}),a.classed(c.constants.DESELECTED_CLASS,function(a){return!n.hasFilter(a.x)})):(a.classed(c.constants.SELECTED_CLASS,!1),a.classed(c.constants.DESELECTED_CLASS,!1));else if(n.brushIsEmpty(b))a.classed(c.constants.DESELECTED_CLASS,!1);else{var d=b[0],e=b[1];a.classed(c.constants.DESELECTED_CLASS,function(a){return a.x<d||a.x>=e})}},n.centerBar=function(a){return arguments.length?(p=a,n):p},c.override(n,"onClick",function(a){n._onClick(a.data)}),n.barPadding=function(a){return arguments.length?(n._rangeBandPadding(a),o=void 0,n):n._rangeBandPadding()},n._useOuterPadding=function(){return void 0===o},n.outerPadding=n._outerRangeBandPadding,n.gap=function(a){return arguments.length?(o=a,n):o},n.extendBrush=function(){var a=n.brush().extent();return!n.round()||p&&!q||(a[0]=a.map(n.round())[0],a[1]=a.map(n.round())[1],n.chartBodyG().select(".brush").call(n.brush().extent(a))),a},n.alwaysUseRounding=function(a){return arguments.length?(q=a,n):q},n.legendHighlight=function(a){n.isLegendableHidden(a)||n.g().selectAll("rect.bar").classed("highlight",i(a.color)).classed("fadeout",i(a.color,!0))},n.legendReset=function(){n.g().selectAll("rect.bar").classed("highlight",!1).classed("fadeout",!1)},c.override(n,"xAxisMax",function(){var a=this._xAxisMax();if("resolution"in n.xUnits()){var b=n.xUnits().resolution;a+=b}return a}),n.anchor(b,d)},c.lineChart=function(b,d){function e(a,b){return B.getColor.call(a,a.values,b)}function f(b,d){var f=a.svg.line().x(function(a){return B.x()(a.x)}).y(function(a){return B.y()(a.y+a.y0)}).interpolate(H).tension(I);s&&f.defined(s);var g=b.append("path").attr("class","line").attr("stroke",e);t&&g.attr("stroke-dasharray",t),c.transition(d.select("path.line"),B.transitionDuration(),B.transitionDelay()).attr("stroke",e).attr("d",function(a){return h(f(a.values))})}function g(b,d){if(C){var f=a.svg.area().x(function(a){return B.x()(a.x)}).y(function(a){return B.y()(a.y+a.y0)}).y0(function(a){return B.y()(a.y0)}).interpolate(H).tension(I);s&&f.defined(s),b.append("path").attr("class","area").attr("fill",e).attr("d",function(a){return h(f(a.values))}),c.transition(d.select("path.area"),B.transitionDuration(),B.transitionDelay()).attr("fill",e).attr("d",function(a){return h(f(a.values))})}}function h(a){return!a||a.indexOf("NaN")>=0?"M0,0":a}function i(b,d){if("always"===B.xyTipsOn()||!B.brushOn()&&B.xyTipsOn()){var e=v+"-list",f=b.select("g."+e);f.empty()&&(f=b.append("g").attr("class",e)),d.each(function(b,d){var e=b.values;s&&(e=e.filter(s));var g=f.select("g."+v+"._"+d);g.empty()&&(g=f.append("g").attr("class",v+" _"+d)),k(g);var h=g.selectAll("circle."+w).data(e,c.pluck("x"));h.enter().append("circle").attr("class",w).attr("r",n()).style("fill-opacity",F).style("stroke-opacity",G).attr("fill",B.getColor).on("mousemove",function(){var b=a.select(this);l(b),m(b,g)}).on("mouseout",function(){var b=a.select(this);o(b),p(g)}),h.call(q,b),c.transition(h,B.transitionDuration()).attr("cx",function(a){return c.utils.safeNumber(B.x()(a.x))}).attr("cy",function(a){return c.utils.safeNumber(B.y()(a.y+a.y0))}).attr("fill",B.getColor),h.exit().remove()})}}function j(b){b.each(function(b,d){var e=a.select(this),f=e.selectAll("text.lineLabel").data(b.values,c.pluck("x"));f.enter().append("text").attr("class","lineLabel").attr("text-anchor","middle"),c.transition(f,B.transitionDuration()).attr("x",function(a){return c.utils.safeNumber(B.x()(a.x))}).attr("y",function(a){var b=B.y()(a.y+a.y0)-A;return c.utils.safeNumber(b)}).text(function(a){return B.label()(a)}),c.transition(f.exit(),B.transitionDuration()).attr("height",0).remove()})}function k(a){var b=a.select("path."+x).empty()?a.append("path").attr("class",x):a.select("path."+x);b.style("display","none").attr("stroke-dasharray","5,5");var c=a.select("path."+y).empty()?a.append("path").attr("class",y):a.select("path."+y);c.style("display","none").attr("stroke-dasharray","5,5")}function l(a){return a.style("fill-opacity",.8),a.style("stroke-opacity",.8),a.attr("r",D),a}function m(a,b){var c=a.attr("cx"),d=a.attr("cy"),e=B._yAxisX()-B.margins().left,f="M"+e+" "+d+"L"+c+" "+d,g="M"+c+" "+B.yAxisHeight()+"L"+c+" "+d;b.select("path."+x).style("display","").attr("d",f),b.select("path."+y).style("display","").attr("d",g)}function n(){return E||D}function o(a){a.style("fill-opacity",F).style("stroke-opacity",G).attr("r",n())}function p(a){a.select("path."+x).style("display","none"),a.select("path."+y).style("display","none")}function q(a,b){B.renderTitle()&&(a.select("title").remove(),a.append("title").text(c.pluck("data",B.title(b.name))))}function r(b,c,d){return function(){var e=a.select(this),f=e.attr("stroke")===b&&e.attr("stroke-dasharray")===(c instanceof Array?c.join(","):null)||e.attr("fill")===b;return d?!f:f}}var s,t,u=5,v="dc-tooltip",w="dot",x="yRef",y="xRef",z=1e-6,A=3,B=c.stackMixin(c.coordinateGridMixin({})),C=!1,D=u,E=null,F=z,G=z,H="linear",I=.7,J=!0;return B.transitionDuration(500),B.transitionDelay(0),B._rangeBandPadding(1),B.plotData=function(){var a=B.chartBodyG(),b=a.select("g.stack-list");b.empty()&&(b=a.append("g").attr("class","stack-list"));var c=b.selectAll("g.stack").data(B.data()),d=c.enter().append("g").attr("class",function(a,b){return"stack _"+b});f(d,c),g(d,c),i(a,c),B.renderLabel()&&j(c)},B.interpolate=function(a){return arguments.length?(H=a,B):H},B.tension=function(a){return arguments.length?(I=a,B):I},B.defined=function(a){return arguments.length?(s=a,B):s},B.dashStyle=function(a){return arguments.length?(t=a,B):t},B.renderArea=function(a){return arguments.length?(C=a,B):C},B.label(function(a){return c.utils.printSingleValue(a.y0+a.y)},!1),B.xyTipsOn=function(a){return arguments.length?(J=a,B):J},B.dotRadius=function(a){return arguments.length?(D=a,B):D},B.renderDataPoints=function(a){return arguments.length?(a?(F=a.fillOpacity||.8,G=a.strokeOpacity||.8,E=a.radius||2):(F=z,G=z,E=null),B):{fillOpacity:F,strokeOpacity:G,radius:E}},B.legendHighlight=function(a){B.isLegendableHidden(a)||B.g().selectAll("path.line, path.area").classed("highlight",r(a.color,a.dashstyle)).classed("fadeout",r(a.color,a.dashstyle,!0))},B.legendReset=function(){B.g().selectAll("path.line, path.area").classed("highlight",!1).classed("fadeout",!1)},c.override(B,"legendables",function(){var a=B._legendables();return t?a.map(function(a){return a.dashstyle=t,a}):a}),B.anchor(b,d)},c.dataCount=function(b,d){var e=a.format(",d"),f=c.baseMixin({}),g={some:"",all:""};return f.html=function(a){return arguments.length?(a.all&&(g.all=a.all),a.some&&(g.some=a.some),f):g},f.formatNumber=function(a){return arguments.length?(e=a,f):e},f._doRender=function(){var a=f.dimension().size(),b=f.group().value(),c=e(a),d=e(b);return a===b&&""!==g.all?f.root().html(g.all.replace("%total-count",c).replace("%filter-count",d)):""!==g.some?f.root().html(g.some.replace("%total-count",c).replace("%filter-count",d)):(f.selectAll(".total-count").text(c),f.selectAll(".filter-count").text(d)),f},f._doRedraw=function(){return f._doRender()},f.anchor(b,d)},c.dataTable=function(b,d){function e(){var a=!0;if(p.forEach(function(b){a&="function"==typeof b}),!a){var b=n.selectAll("thead").data([0]);b.enter().append("thead"),b.exit().remove();var c=b.selectAll("tr").data([0]);c.enter().append("tr"),c.exit().remove();var d=c.selectAll("th").data(p);d.enter().append("th"),d.exit().remove(),d.attr("class",m).html(function(a){return n._doColumnHeaderFormat(a)})}var e=n.root().selectAll("tbody").data(f(),function(a){return n.keyAccessor()(a)}),g=e.enter().append("tbody");return t===!0&&g.append("tr").attr("class",l).append("td").attr("class",i).attr("colspan",p.length).html(function(a){return n.keyAccessor()(a)}),e.exit().remove(),g}function f(){var b;return b=r===a.ascending?n.dimension().bottom(o):n.dimension().top(o),a.nest().key(n.group()).sortKeys(r).entries(b.sort(function(a,b){return r(q(a),q(b))}).slice(s,h))}function g(a){var b=a.order().selectAll("tr."+j).data(function(a){return a.values}),c=b.enter().append("tr").attr("class",j);return p.forEach(function(a,b){c.append("td").attr("class",k+" _"+b).html(function(b){return n._doColumnValueFormat(a,b)})}),b.exit().remove(),b}var h,i="dc-table-label",j="dc-table-row",k="dc-table-column",l="dc-table-group",m="dc-table-head",n=c.baseMixin({}),o=25,p=[],q=function(a){return a},r=a.ascending,s=0,t=!0;return n._doRender=function(){return n.selectAll("tbody").remove(),g(e()),n},n._doColumnValueFormat=function(a,b){return"function"==typeof a?a(b):"string"==typeof a?b[a]:a.format(b)},n._doColumnHeaderFormat=function(a){return"function"==typeof a?n._doColumnHeaderFnToString(a):"string"==typeof a?n._doColumnHeaderCapitalize(a):String(a.label)},n._doColumnHeaderCapitalize=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},n._doColumnHeaderFnToString=function(a){var b=String(a),c=b.indexOf("return ");if(c>=0){var d=b.lastIndexOf(";");if(d>=0){b=b.substring(c+7,d);var e=b.indexOf("numberFormat");e>=0&&(b=b.replace("numberFormat",""))}}return b},n._doRedraw=function(){return n._doRender()},n.size=function(a){return arguments.length?(o=a,n):o},n.beginSlice=function(a){return arguments.length?(s=a,n):s},n.endSlice=function(a){return arguments.length?(h=a,n):h},n.columns=function(a){return arguments.length?(p=a,n):p},n.sortBy=function(a){return arguments.length?(q=a,n):q},n.order=function(a){return arguments.length?(r=a,n):r},n.showGroups=function(a){return arguments.length?(t=a,n):t},n.anchor(b,d)},c.dataGrid=function(b,d){function e(){var a=m.root().selectAll("div."+l).data(f(),function(a){return m.keyAccessor()(a)}),b=a.enter().append("div").attr("class",l);return s&&b.html(function(a){return s(a)}),a.exit().remove(),b}function f(){var b=m.dimension().top(n);return a.nest().key(m.group()).sortKeys(q).entries(b.sort(function(a,b){return q(p(a),p(b))}).slice(r,h))}function g(a){var b=a.order().selectAll("div."+j).data(function(a){return a.values});return b.enter().append("div").attr("class",j).html(function(a){return o(a)}),b.exit().remove(),b}var h,i="dc-grid-label",j="dc-grid-item",k="dc-grid-group",l="dc-grid-top",m=c.baseMixin({}),n=999,o=function(a){return"you need to provide an html() handling param: "+JSON.stringify(a)},p=function(a){return a},q=a.ascending,r=0,s=function(a){return"<div class='"+k+"'><h1 class='"+i+"'>"+m.keyAccessor()(a)+"</h1></div>"};return m._doRender=function(){return m.selectAll("div."+l).remove(),g(e()),m},m._doRedraw=function(){return m._doRender()},m.beginSlice=function(a){return arguments.length?(r=a,m):r},m.endSlice=function(a){return arguments.length?(h=a,m):h},m.size=function(a){return arguments.length?(n=a,m):n},m.html=function(a){return arguments.length?(o=a,m):o},m.htmlGroup=function(a){return arguments.length?(s=a,m):s},m.sortBy=function(a){return arguments.length?(p=a,m):p},m.order=function(a){return arguments.length?(q=a,m):q},m.anchor(b,d)},c.bubbleChart=function(a,b){function d(a){var b=a.enter().append("g");b.attr("class",i.BUBBLE_NODE_CLASS).attr("transform",j).append("circle").attr("class",function(a,b){return i.BUBBLE_CLASS+" _"+b}).on("click",i.onClick).attr("fill",i.getColor).attr("r",0),c.transition(a,i.transitionDuration(),i.transitionDelay()).select("circle."+i.BUBBLE_CLASS).attr("r",function(a){return i.bubbleR(a)}).attr("opacity",function(a){return i.bubbleR(a)>0?1:0}),i._doRenderLabel(b),i._doRenderTitles(b)}function e(a){c.transition(a,i.transitionDuration(),i.transitionDelay()).attr("transform",j).select("circle."+i.BUBBLE_CLASS).attr("fill",i.getColor).attr("r",function(a){return i.bubbleR(a)}).attr("opacity",function(a){return i.bubbleR(a)>0?1:0}),i.doUpdateLabels(a),i.doUpdateTitles(a)}function f(a){a.exit().remove()}function g(a){var b=i.x()(i.keyAccessor()(a));return isNaN(b)&&(b=0),b}function h(a){var b=i.y()(i.valueAccessor()(a));return isNaN(b)&&(b=0),b}var i=c.bubbleMixin(c.coordinateGridMixin({}));i.transitionDuration(750),i.transitionDelay(0);var j=function(a){return"translate("+g(a)+","+h(a)+")"};return i.plotData=function(){i.calculateRadiusDomain(),i.r().range([i.MIN_RADIUS,i.xAxisLength()*i.maxBubbleRelativeSize()]);var a=i.data(),b=i.chartBodyG().selectAll("g."+i.BUBBLE_NODE_CLASS).data(a,function(a){return a.key});i.sortBubbleSize()&&b.order(),d(b),e(b),f(b),i.fadeDeselectedArea()},i.renderBrush=function(){},i.redrawBrush=function(){i.fadeDeselectedArea()},i.anchor(a,b)},c.compositeChart=function(b,d){function e(a,b){var c,d,e,g,h;return a&&(c=m(),d=p()),b&&(e=n(),g=q()),w.alignYAxes()&&a&&b&&(h=f(c,d,e,g)),h||{lyAxisMin:c,lyAxisMax:d,ryAxisMin:e,ryAxisMax:g}}function f(a,b,c,d){var e=(d-c)/(b-a);return{lyAxisMin:Math.min(a,c/e),lyAxisMax:Math.max(b,d/e),ryAxisMin:Math.min(c,a*e),ryAxisMax:Math.max(d,b*e)}}function g(b){var c=void 0===w.rightY()||w.elasticY(),d=c||w.resizing();void 0===w.rightY()&&w.rightY(a.scale.linear()),c&&w.rightY().domain([b.ryAxisMin,b.ryAxisMax]),d&&w.rightY().rangeRound([w.yAxisHeight(),0]),w.rightY().range([w.yAxisHeight(),0]),w.rightYAxis(w.rightYAxis().scale(w.rightY())),w.rightYAxis().orient("right")}function h(b){var c=void 0===w.y()||w.elasticY(),d=c||w.resizing();void 0===w.y()&&w.y(a.scale.linear()),c&&w.y().domain([b.lyAxisMin,b.lyAxisMax]),d&&w.y().rangeRound([w.yAxisHeight(),0]),w.y().range([w.yAxisHeight(),0]),w.yAxis(w.yAxis().scale(w.y())),w.yAxis().orient("left")}function i(a,b){a._generateG(w.g()),a.g().attr("class",u+" _"+b)}function j(){return x.filter(function(a){return!a.useRightYAxis()})}function k(){return x.filter(function(a){return a.useRightYAxis()})}function l(a){return a.map(function(a){return a.yAxisMin()})}function m(){return a.min(l(j()))}function n(){return a.min(l(k()))}function o(a){return a.map(function(a){return a.yAxisMax()})}function p(){return c.utils.add(a.max(o(j())),w.yAxisPadding())}function q(){return c.utils.add(a.max(o(k())),w.yAxisPadding())}function r(){return x.map(function(a){return a.xAxisMin()})}function s(){return x.map(function(a){return a.xAxisMax()})}var t,u="sub",v=12,w=c.coordinateGridMixin({}),x=[],y={},z=!1,A=!0,B=!1,C=a.svg.axis(),D=0,E=v,F=!1;return w._mandatoryAttributes([]),w.transitionDuration(500),w.transitionDelay(0),c.override(w,"_generateG",function(){for(var a=this.__generateG(),b=0;b<x.length;++b){var c=x[b];i(c,b),c.dimension()||c.dimension(w.dimension()),c.group()||c.group(w.group()),c.chartGroup(w.chartGroup()),c.svg(w.svg()),c.xUnits(w.xUnits()),c.transitionDuration(w.transitionDuration(),w.transitionDelay()),c.brushOn(w.brushOn()),c.renderTitle(w.renderTitle()),c.elasticX(w.elasticX())}return a}),w._brushing=function(){for(var a=w.extendBrush(),b=w.brushIsEmpty(a),c=0;c<x.length;++c)x[c].replaceFilter(b?null:a)},w._prepareYAxis=function(){var a=0!==j().length,b=0!==k().length,c=e(a,b);a&&h(c),b&&g(c),j().length>0&&!F?w._renderHorizontalGridLinesForAxis(w.g(),w.y(),w.yAxis()):k().length>0&&w._renderHorizontalGridLinesForAxis(w.g(),t,C)},w.renderYAxis=function(){0!==j().length&&(w.renderYAxisAt("y",w.yAxis(),w.margins().left),w.renderYAxisLabel("y",w.yAxisLabel(),-90)),0!==k().length&&(w.renderYAxisAt("yr",w.rightYAxis(),w.width()-w.margins().right),w.renderYAxisLabel("yr",w.rightYAxisLabel(),90,w.width()-E))},w.plotData=function(){for(var a=0;a<x.length;++a){var b=x[a];b.g()||i(b,a),z&&b.colors(w.colors()),b.x(w.x()),b.xAxis(w.xAxis()),b.useRightYAxis()?(b.y(w.rightY()),b.yAxis(w.rightYAxis())):(b.y(w.y()),b.yAxis(w.yAxis())),b.plotData(),b._activateRenderlets()}},w.useRightAxisGridLines=function(a){return arguments?(F=a,w):F},w.childOptions=function(a){return arguments.length?(y=a,x.forEach(function(a){a.options(y)}),w):y},w.fadeDeselectedArea=function(){for(var a=0;a<x.length;++a){var b=x[a];b.brush(w.brush()),b.fadeDeselectedArea()}},w.rightYAxisLabel=function(a,b){return arguments.length?(D=a,w.margins().right-=E,E=void 0===b?v:b,w.margins().right+=E,w):D},w.compose=function(a){return x=a,x.forEach(function(a){a.height(w.height()),a.width(w.width()),a.margins(w.margins()),A&&a.title(w.title()),a.options(y)}),w},w.children=function(){return x},w.shareColors=function(a){return arguments.length?(z=a,w):z},w.shareTitle=function(a){return arguments.length?(A=a,w):A},w.rightY=function(a){return arguments.length?(t=a,w.rescale(),w):t},w.alignYAxes=function(a){return arguments.length?(B=a,w.rescale(),w):B},delete w.yAxisMin,delete w.yAxisMax,c.override(w,"xAxisMin",function(){return c.utils.subtract(a.min(r()),w.xAxisPadding())}),c.override(w,"xAxisMax",function(){return c.utils.add(a.max(s()),w.xAxisPadding())}),w.legendables=function(){return x.reduce(function(a,b){return z&&b.colors(w.colors()),a.push.apply(a,b.legendables()),a},[])},w.legendHighlight=function(a){for(var b=0;b<x.length;++b){var c=x[b];c.legendHighlight(a)}},w.legendReset=function(a){for(var b=0;b<x.length;++b){var c=x[b];c.legendReset(a)}},w.legendToggle=function(){console.log("composite should not be getting legendToggle itself")},w.rightYAxis=function(a){return arguments.length?(C=a,w):C},w.anchor(b,d)},c.seriesChart=function(b,d){function e(b,c){return a.ascending(i.keyAccessor()(b),i.keyAccessor()(c))}function f(a){j[a].g()&&j[a].g().remove(),delete j[a]}function g(){Object.keys(j).map(f),j={}}var h,i=c.compositeChart(b,d),j={},k=c.lineChart,l=a.ascending,m=e;return i._mandatoryAttributes().push("seriesAccessor","chart"),i.shareColors(!0),i._preprocessData=function(){var b,c=[],e=a.nest().key(h);l&&e.sortKeys(l),m&&e.sortValues(m);var g=e.entries(i.data()),n=g.map(function(e,f){var g=j[e.key]||k.call(i,i,d,e.key,f);return j[e.key]||(b=!0),j[e.key]=g,c.push(e.key),g.dimension(i.dimension()).group({all:a.functor(e.values)},e.key).keyAccessor(i.keyAccessor()).valueAccessor(i.valueAccessor()).brushOn(i.brushOn())});Object.keys(j).filter(function(a){return c.indexOf(a)===-1}).forEach(function(a){f(a),b=!0}),i._compose(n),b&&i.legend()&&i.legend().render()},i.chart=function(a){return arguments.length?(k=a,g(),i):k},i.seriesAccessor=function(a){return arguments.length?(h=a,g(),i):h},i.seriesSort=function(a){return arguments.length?(l=a,g(),i):l},i.valueSort=function(a){return arguments.length?(m=a,g(),i):m},i._compose=i.compose,delete i.compose,i},c.geoChoroplethChart=function(b,d){function e(a){var b=f();if(g(a)){var c=h(a);n(c,a,b),o(c,a,b)}}function f(){for(var a={},b=p.data(),c=0;c<b.length;++c)a[p.keyAccessor()(b[c])]=p.valueAccessor()(b[c]);return a}function g(a){return m(a).keyAccessor}function h(a){var b=p.svg().selectAll(i(a)).classed("selected",function(b){return j(a,b)}).classed("deselected",function(b){return k(a,b)}).attr("class",function(b){var d=m(a).name,e=c.utils.nameToId(m(a).keyAccessor(b)),f=d+" "+e;return j(a,b)&&(f+=" selected"),k(a,b)&&(f+=" deselected"),f});return b}function i(a){return"g.layer"+a+" g."+m(a).name}function j(a,b){return p.hasFilter()&&p.hasFilter(l(a,b))}function k(a,b){return p.hasFilter()&&!p.hasFilter(l(a,b))}function l(a,b){return m(a).keyAccessor(b)}function m(a){return s[a]}function n(b,d,e){var f=b.select("path").attr("fill",function(){var b=a.select(this).attr("fill");return b?b:"none"}).on("click",function(a){return p.onClick(a,d)});c.transition(f,p.transitionDuration(),p.transitionDelay()).attr("fill",function(a,b){return p.getColor(e[m(d).keyAccessor(a)],b)})}function o(a,b,c){p.renderTitle()&&a.selectAll("title").text(function(a){var d=l(b,a),e=c[d];return p.title()({key:d,value:e})})}var p=c.colorMixin(c.baseMixin({}));p.colorAccessor(function(a){return a||0});var q,r=a.geo.path(),s=[];return p._doRender=function(){p.resetSvg();for(var a=0;a<s.length;++a){var b=p.svg().append("g").attr("class","layer"+a),c=b.selectAll("g."+m(a).name).data(m(a).data).enter().append("g").attr("class",m(a).name);c.append("path").attr("fill","white").attr("d",r),c.append("title"),e(a)}q=!1},p.onClick=function(a,b){var d=m(b).keyAccessor(a);c.events.trigger(function(){p.filter(d),p.redrawGroup()})},p._doRedraw=function(){for(var a=0;a<s.length;++a)e(a),q&&p.svg().selectAll("g."+m(a).name+" path").attr("d",r);q=!1},p.overlayGeoJson=function(a,b,c){for(var d=0;d<s.length;++d)if(s[d].name===b)return s[d].data=a,s[d].keyAccessor=c,p;return s.push({name:b,data:a,keyAccessor:c}),p},p.projection=function(a){return r.projection(a),q=!0,p},p.geoJsons=function(){return s},p.geoPath=function(){return r},p.removeGeoJson=function(a){for(var b=[],c=0;c<s.length;++c){var d=s[c];d.name!==a&&b.push(d)}return s=b,p},p.anchor(b,d)},c.bubbleOverlay=function(b,d){function e(){return j=n.select("g."+k),j.empty()&&(j=n.svg().append("g").attr("class",k)),j}function f(){var a=g();n.calculateRadiusDomain(),o.forEach(function(b){var d=h(b,a),e=d.select("circle."+m);e.empty()&&(e=d.append("circle").attr("class",m).attr("r",0).attr("fill",n.getColor).on("click",n.onClick)),c.transition(e,n.transitionDuration(),n.transitionDelay()).attr("r",function(a){return n.bubbleR(a)}),n._doRenderLabel(d),n._doRenderTitles(d)})}function g(){var a={};return n.data().forEach(function(b){a[n.keyAccessor()(b)]=b}),a}function h(a,b){var d=l+" "+c.utils.nameToId(a.name),e=j.select("g."+c.utils.nameToId(a.name));return e.empty()&&(e=j.append("g").attr("class",d).attr("transform","translate("+a.x+","+a.y+")")),e.datum(b[a.name]),e}function i(){var a=g();n.calculateRadiusDomain(),o.forEach(function(b){var d=h(b,a),e=d.select("circle."+m);c.transition(e,n.transitionDuration(),n.transitionDelay()).attr("r",function(a){return n.bubbleR(a)}).attr("fill",n.getColor),n.doUpdateLabels(d),n.doUpdateTitles(d)})}var j,k="bubble-overlay",l="node",m="bubble",n=c.bubbleMixin(c.baseMixin({})),o=[];return n.transitionDuration(750),n.transitionDelay(0),n.radiusValueAccessor(function(a){return a.value}),n.point=function(a,b,c){return o.push({name:a,x:b,y:c}),n},n._doRender=function(){return j=e(),n.r().range([n.MIN_RADIUS,n.width()*n.maxBubbleRelativeSize()]),f(),n.fadeDeselectedArea(),n},n._doRedraw=function(){return i(),n.fadeDeselectedArea(),n},n.debug=function(b){if(b){var d=n.select("g."+c.constants.DEBUG_GROUP_CLASS);
|
|
d.empty()&&(d=n.svg().append("g").attr("class",c.constants.DEBUG_GROUP_CLASS));var e=d.append("text").attr("x",10).attr("y",20);d.append("rect").attr("width",n.width()).attr("height",n.height()).on("mousemove",function(){var b=a.mouse(d.node()),c=b[0]+", "+b[1];e.text(c)})}else n.selectAll(".debug").remove();return n},n.anchor(b,d),n},c.rowChart=function(b,d){function e(){if(!t||u){var b=a.extent(v,G.cappedValueAccessor);b[0]>0&&(b[0]=0),b[1]<0&&(b[1]=0),t=a.scale.linear().domain(b).range([0,G.effectiveWidth()])}H.scale(t)}function f(){var a=s.select("g.axis");e(),a.empty()&&(a=s.append("g").attr("class","axis")),a.attr("transform","translate(0, "+G.effectiveHeight()+")"),c.transition(a,G.transitionDuration(),G.transitionDelay()).call(H)}function g(){s.selectAll("g.tick").select("line.grid-line").remove(),s.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-G.effectiveHeight()})}function h(){v=G.data(),f(),g();var a=s.selectAll("g."+D).data(v);i(a),j(a),l(a)}function i(a){var b=a.enter().append("g").attr("class",function(a,b){return D+" _"+b});b.append("rect").attr("width",0),n(b)}function j(a){a.exit().remove()}function k(){var a=t(0);return a===-(1/0)||a!==a?t(1):a}function l(a){var b,d=v.length;b=C?C:(G.effectiveHeight()-(d+1)*B)/d,y||(x=b/2);var e=a.attr("transform",function(a,c){return"translate(0,"+((c+1)*B+c*b)+")"}).select("rect").attr("height",b).attr("fill",G.getColor).on("click",p).classed("deselected",function(a){return!!G.hasFilter()&&!r(a)}).classed("selected",function(a){return!!G.hasFilter()&&r(a)});c.transition(e,G.transitionDuration(),G.transitionDelay()).attr("width",function(a){return Math.abs(k()-t(G.valueAccessor()(a)))}).attr("transform",q),m(a),o(a)}function m(a){G.renderTitle()&&(a.select("title").remove(),a.append("title").text(G.title()))}function n(a){G.renderLabel()&&a.append("text").on("click",p),G.renderTitleLabel()&&a.append("text").attr("class",E).on("click",p)}function o(a){if(G.renderLabel()){var b=a.select("text").attr("x",w).attr("y",x).attr("dy",z).on("click",p).attr("class",function(a,b){return D+" _"+b}).text(function(a){return G.label()(a)});c.transition(b,G.transitionDuration(),G.transitionDelay()).attr("transform",q)}if(G.renderTitleLabel()){var d=a.select("."+E).attr("x",G.effectiveWidth()-A).attr("y",x).attr("dy",z).attr("text-anchor","end").on("click",p).attr("class",function(a,b){return E+" _"+b}).text(function(a){return G.title()(a)});c.transition(d,G.transitionDuration(),G.transitionDelay()).attr("transform",q)}}function p(a){G.onClick(a)}function q(a){var b=t(G.cappedValueAccessor(a)),c=k(),d=b>c?c:b;return"translate("+d+",0)"}function r(a){return G.hasFilter(G.cappedKeyAccessor(a))}var s,t,u,v,w=10,x=15,y=!1,z="0.35em",A=2,B=5,C=!1,D="row",E="titlerow",F=!1,G=c.capMixin(c.marginMixin(c.colorMixin(c.baseMixin({})))),H=a.svg.axis().orient("bottom");return G.rowsCap=G.cap,G._doRender=function(){return G.resetSvg(),s=G.svg().append("g").attr("transform","translate("+G.margins().left+","+G.margins().top+")"),h(),G},G.title(function(a){return G.cappedKeyAccessor(a)+": "+G.cappedValueAccessor(a)}),G.label(G.cappedKeyAccessor),G.x=function(a){return arguments.length?(t=a,G):t},G.renderTitleLabel=function(a){return arguments.length?(F=a,G):F},G._doRedraw=function(){return h(),G},G.xAxis=function(){return H},G.fixedBarHeight=function(a){return arguments.length?(C=a,G):C},G.gap=function(a){return arguments.length?(B=a,G):B},G.elasticX=function(a){return arguments.length?(u=a,G):u},G.labelOffsetX=function(a){return arguments.length?(w=a,G):w},G.labelOffsetY=function(a){return arguments.length?(x=a,y=!0,G):x},G.titleLabelOffsetX=function(a){return arguments.length?(A=a,G):A},G.anchor(b,d)},c.legend=function(){function a(){return k+j}var b,d,e,f=2,g={},h=0,i=0,j=12,k=5,l=!1,m=560,n=70,o=!1,p=c.pluck("name");return g.parent=function(a){return arguments.length?(b=a,g):b},g.render=function(){b.svg().select("g.dc-legend").remove(),e=b.svg().append("g").attr("class","dc-legend").attr("transform","translate("+h+","+i+")");var g=b.legendables();void 0!==d&&(g=g.slice(0,d));var q=e.selectAll("g.dc-legend-item").data(g).enter().append("g").attr("class","dc-legend-item").on("mouseover",function(a){b.legendHighlight(a)}).on("mouseout",function(a){b.legendReset(a)}).on("click",function(a){a.chart.legendToggle(a)});e.selectAll("g.dc-legend-item").classed("fadeout",function(a){return a.chart.isLegendableHidden(a)}),g.some(c.pluck("dashstyle"))?q.append("line").attr("x1",0).attr("y1",j/2).attr("x2",j).attr("y2",j/2).attr("stroke-width",2).attr("stroke-dasharray",c.pluck("dashstyle")).attr("stroke",c.pluck("color")):q.append("rect").attr("width",j).attr("height",j).attr("fill",function(a){return a?a.color:"blue"}),q.append("text").text(p).attr("x",j+f).attr("y",function(){return j/2+(this.clientHeight?this.clientHeight:13)/2-2});var r=0,s=0;q.attr("transform",function(b,c){if(l){var d=o===!0?this.getBBox().width+k:n;r+d>m&&r>0&&(++s,r=0);var e="translate("+r+","+s*a()+")";return r+=d,e}return"translate(0,"+c*a()+")"})},g.x=function(a){return arguments.length?(h=a,g):h},g.y=function(a){return arguments.length?(i=a,g):i},g.gap=function(a){return arguments.length?(k=a,g):k},g.itemHeight=function(a){return arguments.length?(j=a,g):j},g.horizontal=function(a){return arguments.length?(l=a,g):l},g.legendWidth=function(a){return arguments.length?(m=a,g):m},g.itemWidth=function(a){return arguments.length?(n=a,g):n},g.autoItemWidth=function(a){return arguments.length?(o=a,g):o},g.legendText=function(a){return arguments.length?(p=a,g):p},g.maxItems=function(a){return arguments.length?(d=c.utils.isNumber(a)?a:void 0,g):d},g},c.scatterPlot=function(b,d){function e(a,b){return j(a)?v[b]?Math.pow(n,2):Math.pow(o,2):Math.pow(r,2)}function f(a,b){h.renderTitle()&&(a.selectAll("title").remove(),a.append("title").text(function(a){return h.title()(a)}))}function g(b,d){var e=h.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return b(a.select(this))}),f=i.size();i.size(Math.pow(d,2)),c.transition(e,h.transitionDuration(),h.transitionDelay()).attr("d",i),i.size(f)}var h=c.coordinateGridMixin({}),i=a.svg.symbol(),j=function(a){return a.value},k=h.keyAccessor();h.keyAccessor(function(a){return k(a)[0]}),h.valueAccessor(function(a){return k(a)[1]}),h.colorAccessor(function(){return h._groupName}),h.title(function(a){return h.keyAccessor()(a)+","+h.valueAccessor()(a)+": "+h.existenceAccessor()(a)});var l=function(a){return"translate("+h.x()(h.keyAccessor()(a))+","+h.y()(h.valueAccessor()(a))+")"},m=7,n=5,o=3,p=null,q=1,r=0,s=0,t=1,u=null,v=[];return i.size(e),c.override(h,"_filter",function(a){return arguments.length?h.__filter(c.filters.RangedTwoDimensionalFilter(a)):h.__filter()}),h.plotData=function(){var a=h.chartBodyG().selectAll("path.symbol").data(h.data());a.enter().append("path").attr("class","symbol").attr("opacity",0).attr("fill",h.getColor).attr("transform",l),a.call(f,h.data()),a.each(function(a,b){v[b]=!h.filter()||h.filter().isFiltered([a.key[0],a.key[1]])}),c.transition(a,h.transitionDuration(),h.transitionDelay()).attr("opacity",function(a,b){return j(a)?v[b]?t:h.excludedOpacity():s}).attr("fill",function(a,b){return u&&!j(a)?u:h.excludedColor()&&!v[b]?h.excludedColor():h.getColor(a)}).attr("transform",l).attr("d",i),c.transition(a.exit(),h.transitionDuration(),h.transitionDelay()).attr("opacity",0).remove()},h.existenceAccessor=function(a){return arguments.length?(j=a,this):j},h.symbol=function(a){return arguments.length?(i.type(a),h):i.type()},h.customSymbol=function(a){return arguments.length?(i=a,i.size(e),h):i},h.symbolSize=function(a){return arguments.length?(n=a,h):n},h.highlightedSize=function(a){return arguments.length?(m=a,h):m},h.excludedSize=function(a){return arguments.length?(o=a,h):o},h.excludedColor=function(a){return arguments.length?(p=a,h):p},h.excludedOpacity=function(a){return arguments.length?(q=a,h):q},h.hiddenSize=h.emptySize=function(a){return arguments.length?(r=a,h):r},h.emptyColor=function(a){return arguments.length?(u=a,h):u},h.emptyOpacity=function(a){return arguments.length?(s=a,h):s},h.nonemptyOpacity=function(a){return arguments.length?(t=a,h):s},h.legendables=function(){return[{chart:h,name:h._groupName,color:h.getColor()}]},h.legendHighlight=function(b){g(function(a){return a.attr("fill")===b.color},m),h.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return a.select(this).attr("fill")!==b.color}).classed("fadeout",!0)},h.legendReset=function(b){g(function(a){return a.attr("fill")===b.color},n),h.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return a.select(this).attr("fill")!==b.color}).classed("fadeout",!1)},h.setHandlePaths=function(){},h.extendBrush=function(){var a=h.brush().extent();return h.round()&&(a[0]=a[0].map(h.round()),a[1]=a[1].map(h.round()),h.g().select(".brush").call(h.brush().extent(a))),a},h.brushIsEmpty=function(a){return h.brush().empty()||!a||a[0][0]>=a[1][0]||a[0][1]>=a[1][1]},h._brushing=function(){var a=h.extendBrush();if(h.redrawBrush(h.g()),h.brushIsEmpty(a))c.events.trigger(function(){h.filter(null),h.redrawGroup()});else{var b=c.filters.RangedTwoDimensionalFilter(a);c.events.trigger(function(){h.filter(null),h.filter(b),h.redrawGroup()},c.constants.EVENT_DELAY)}},h.setBrushY=function(a){a.call(h.brush().y(h.y()))},h.anchor(b,d)},c.numberDisplay=function(b,d){function e(a){if(!a.length)return null;var b=i._computeOrderedGroups(a);return b[b.length-1]}var f,g="number-display",h=a.format(".2s"),i=c.baseMixin({}),j={one:"",some:"",none:""};return i._mandatoryAttributes(["group"]),i.ordering(function(a){return a.value}),i.html=function(a){return arguments.length?(a.none?j.none=a.none:a.one?j.none=a.one:a.some&&(j.none=a.some),a.one?j.one=a.one:a.some&&(j.one=a.some),a.some?j.some=a.some:a.one&&(j.some=a.one),i):j},i.value=function(){return i.data()},i.data(function(a){var b=a.value?a.value():e(a.all());return i.valueAccessor()(b)}),i.transitionDuration(250),i.transitionDelay(0),i._doRender=function(){var b=i.value(),c=i.selectAll("."+g);c.empty()&&(c=c.data([0]).enter().append("span").attr("class",g)),c.transition().duration(i.transitionDuration()).delay(i.transitionDelay()).ease("quad-out-in").tween("text",function(){var c=isFinite(f)?f:0,d=a.interpolateNumber(c||0,b);return f=b,function(a){var c=null,e=i.formatNumber()(d(a));0===b&&""!==j.none?c=j.none:1===b&&""!==j.one?c=j.one:""!==j.some&&(c=j.some),this.innerHTML=c?c.replace("%number",e):e}})},i._doRedraw=function(){return i._doRender()},i.formatNumber=function(a){return arguments.length?(h=a,i):h},i.anchor(b,d)},c.heatMap=function(b,d){function e(a,b){var d=p.selectAll(".box-group").filter(function(c){return c.key[a]===b}),e=d.filter(function(a){return!p.hasFilter(a.key)});c.events.trigger(function(){var a=e.empty()?d:e,b=a.data().map(function(a){return c.filters.TwoDimensionalFilter(a.key)});p._filter([b]),p.redrawGroup()})}var f,g,h,i=6.75,j=a.ascending,k=a.ascending,l=a.scale.ordinal(),m=a.scale.ordinal(),n=i,o=i,p=c.colorMixin(c.marginMixin(c.baseMixin({})));p._mandatoryAttributes(["group"]),p.title(p.colorAccessor());var q=function(a){return a},r=function(a){return a};p.colsLabel=function(a){return arguments.length?(q=a,p):q},p.rowsLabel=function(a){return arguments.length?(r=a,p):r};var s=function(a){e(0,a)},t=function(a){e(1,a)},u=function(a){var b=a.key;c.events.trigger(function(){p.filter(b),p.redrawGroup()})};return c.override(p,"filter",function(a){return arguments.length?p._filter(c.filters.TwoDimensionalFilter(a)):p._filter()}),p.rows=function(a){return arguments.length?(h=a,p):h},p.rowOrdering=function(a){return arguments.length?(k=a,p):k},p.cols=function(a){return arguments.length?(g=a,p):g},p.colOrdering=function(a){return arguments.length?(j=a,p):j},p._doRender=function(){return p.resetSvg(),f=p.svg().append("g").attr("class","heatmap").attr("transform","translate("+p.margins().left+","+p.margins().top+")"),p._doRedraw()},p._doRedraw=function(){var a=p.data(),b=p.rows()||a.map(p.valueAccessor()),d=p.cols()||a.map(p.keyAccessor());k&&(b=b.sort(k)),j&&(d=d.sort(j)),b=m.domain(b),d=l.domain(d);var e=b.domain().length,g=d.domain().length,h=Math.floor(p.effectiveWidth()/g),i=Math.floor(p.effectiveHeight()/e);d.rangeRoundBands([0,p.effectiveWidth()]),b.rangeRoundBands([p.effectiveHeight(),0]);var q=f.selectAll("g.box-group").data(p.data(),function(a,b){return p.keyAccessor()(a,b)+"\0"+p.valueAccessor()(a,b)}),r=q.enter().append("g").attr("class","box-group");r.append("rect").attr("class","heat-box").attr("fill","white").on("click",p.boxOnClick()),p.renderTitle()&&(r.append("title"),q.select("title").text(p.title())),c.transition(q.select("rect"),p.transitionDuration(),p.transitionDelay()).attr("x",function(a,b){return d(p.keyAccessor()(a,b))}).attr("y",function(a,c){return b(p.valueAccessor()(a,c))}).attr("rx",n).attr("ry",o).attr("fill",p.getColor).attr("width",h).attr("height",i),q.exit().remove();var s=f.select("g.cols");s.empty()&&(s=f.append("g").attr("class","cols axis"));var t=s.selectAll("text").data(d.domain());t.enter().append("text").attr("x",function(a){return d(a)+h/2}).style("text-anchor","middle").attr("y",p.effectiveHeight()).attr("dy",12).on("click",p.xAxisOnClick()).text(p.colsLabel()),c.transition(t,p.transitionDuration(),p.transitionDelay()).text(p.colsLabel()).attr("x",function(a){return d(a)+h/2}).attr("y",p.effectiveHeight()),t.exit().remove();var u=f.select("g.rows");u.empty()&&(u=f.append("g").attr("class","rows axis"));var v=u.selectAll("text").data(b.domain());return v.enter().append("text").attr("dy",6).style("text-anchor","end").attr("x",0).attr("dx",-2).on("click",p.yAxisOnClick()).text(p.rowsLabel()),c.transition(v,p.transitionDuration(),p.transitionDelay()).text(p.rowsLabel()).attr("y",function(a){return b(a)+i/2}),v.exit().remove(),p.hasFilter()?p.selectAll("g.box-group").each(function(a){p.isSelectedNode(a)?p.highlightSelected(this):p.fadeDeselected(this)}):p.selectAll("g.box-group").each(function(){p.resetHighlight(this)}),p},p.boxOnClick=function(a){return arguments.length?(u=a,p):u},p.xAxisOnClick=function(a){return arguments.length?(s=a,p):s},p.yAxisOnClick=function(a){return arguments.length?(t=a,p):t},p.xBorderRadius=function(a){return arguments.length?(n=a,p):n},p.yBorderRadius=function(a){return arguments.length?(o=a,p):o},p.isSelectedNode=function(a){return p.hasFilter(a.key)},p.anchor(b,d)},function(){function b(a){return[0,a.length-1]}function c(b){return[a.quantile(b,.25),a.quantile(b,.5),a.quantile(b,.75)]}a.box=function(){function d(b){b.each(function(b,c){b=b.map(j).sort(a.ascending);var d=a.select(this),n=b.length,o=b[0],p=b[n-1],q=b.quartiles=l(b),r=k&&k.call(this,b,c),s=r&&r.map(function(a){return b[a]}),t=r?a.range(0,r[0]).concat(a.range(r[1]+1,n)):a.range(n),u=a.scale.linear().domain(i&&i.call(this,b,c)||[o,p]).range([f,0]),v=this.__chart__||a.scale.linear().domain([0,1/0]).range(u.range());this.__chart__=u;var w=d.selectAll("line.center").data(s?[s]:[]);w.enter().insert("line","rect").attr("class","center").attr("x1",e/2).attr("y1",function(a){return v(a[0])}).attr("x2",e/2).attr("y2",function(a){return v(a[1])}).style("opacity",1e-6).transition().duration(g).delay(h).style("opacity",1).attr("y1",function(a){return u(a[0])}).attr("y2",function(a){return u(a[1])}),w.transition().duration(g).delay(h).style("opacity",1).attr("x1",e/2).attr("x2",e/2).attr("y1",function(a){return u(a[0])}).attr("y2",function(a){return u(a[1])}),w.exit().transition().duration(g).delay(h).style("opacity",1e-6).attr("y1",function(a){return u(a[0])}).attr("y2",function(a){return u(a[1])}).remove();var x=d.selectAll("rect.box").data([q]);x.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(a){return v(a[2])}).attr("width",e).attr("height",function(a){return v(a[0])-v(a[2])}).transition().duration(g).delay(h).attr("y",function(a){return u(a[2])}).attr("height",function(a){return u(a[0])-u(a[2])}),x.transition().duration(g).delay(h).attr("width",e).attr("y",function(a){return u(a[2])}).attr("height",function(a){return u(a[0])-u(a[2])});var y=d.selectAll("line.median").data([q[1]]);y.enter().append("line").attr("class","median").attr("x1",0).attr("y1",v).attr("x2",e).attr("y2",v).transition().duration(g).delay(h).attr("y1",u).attr("y2",u),y.transition().duration(g).delay(h).attr("x1",0).attr("x2",e).attr("y1",u).attr("y2",u);var z=d.selectAll("line.whisker").data(s||[]);z.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",v).attr("x2",e).attr("y2",v).style("opacity",1e-6).transition().duration(g).delay(h).attr("y1",u).attr("y2",u).style("opacity",1),z.transition().duration(g).delay(h).attr("x1",0).attr("x2",e).attr("y1",u).attr("y2",u).style("opacity",1),z.exit().transition().duration(g).delay(h).attr("y1",u).attr("y2",u).style("opacity",1e-6).remove();var A=d.selectAll("circle.outlier").data(t,Number);A.enter().insert("circle","text").attr("class","outlier").attr("r",5).attr("cx",e/2).attr("cy",function(a){return v(b[a])}).style("opacity",1e-6).transition().duration(g).delay(h).attr("cy",function(a){return u(b[a])}).style("opacity",1),A.transition().duration(g).delay(h).attr("cx",e/2).attr("cy",function(a){return u(b[a])}).style("opacity",1),A.exit().transition().duration(g).delay(h).attr("cy",function(a){return u(b[a])}).style("opacity",1e-6).remove();var B=m||u.tickFormat(8),C=d.selectAll("text.box").data(q);C.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(a,b){return 1&b?6:-6}).attr("x",function(a,b){return 1&b?e:0}).attr("y",v).attr("text-anchor",function(a,b){return 1&b?"start":"end"}).text(B).transition().duration(g).delay(h).attr("y",u),C.transition().duration(g).delay(h).text(B).attr("x",function(a,b){return 1&b?e:0}).attr("y",u);var D=d.selectAll("text.whisker").data(s||[]);D.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",e).attr("y",v).text(B).style("opacity",1e-6).transition().duration(g).delay(h).attr("y",u).style("opacity",1),D.transition().duration(g).delay(h).text(B).attr("x",e).attr("y",u).style("opacity",1),D.exit().transition().duration(g).delay(h).attr("y",u).style("opacity",1e-6).remove()}),a.timer.flush()}var e=1,f=1,g=0,h=0,i=null,j=Number,k=b,l=c,m=null;return d.width=function(a){return arguments.length?(e=a,d):e},d.height=function(a){return arguments.length?(f=a,d):f},d.tickFormat=function(a){return arguments.length?(m=a,d):m},d.duration=function(a){return arguments.length?(g=a,d):g},d.domain=function(b){return arguments.length?(i=null===b?b:a.functor(b),d):i},d.value=function(a){return arguments.length?(j=a,d):j},d.whiskers=function(a){return arguments.length?(k=a,d):k},d.quartiles=function(a){return arguments.length?(l=a,d):l},d}}(),c.boxPlot=function(b,d){function e(a){return function(b){var c=b.quartiles[0],d=b.quartiles[2],e=(d-c)*a,f=-1,g=b.length;do++f;while(b[f]<c-e);do--g;while(b[g]>d+e);return[f,g]}}function f(a){var b=a.enter().append("g");b.attr("class","box").attr("transform",p).call(m).on("click",function(a){i.filter(i.keyAccessor()(a)),i.redrawGroup()})}function g(b){c.transition(b,i.transitionDuration(),i.transitionDelay()).attr("transform",p).call(m).each(function(){a.select(this).select("rect.box").attr("fill",i.getColor)})}function h(a){a.exit().remove().call(m)}var i=c.coordinateGridMixin({}),j=1.5,k=e,l=k(j),m=a.box(),n=null,o=function(a,b){return i.isOrdinal()?i.x().rangeBand():a/(1+i.boxPadding())/b};i.yAxisPadding(12),i.x(a.scale.ordinal()),i.xUnits(c.units.ordinal),i.data(function(a){return a.all().map(function(a){return a.map=function(b){return b.call(a,a)},a}).filter(function(a){var b=i.valueAccessor()(a);return 0!==b.length})}),i.boxPadding=i._rangeBandPadding,i.boxPadding(.8),i.outerPadding=i._outerRangeBandPadding,i.outerPadding(.5),i.boxWidth=function(b){return arguments.length?(o=a.functor(b),i):o};var p=function(a,b){var c=i.x()(i.keyAccessor()(a,b));return"translate("+c+", 0)"};return i._preprocessData=function(){i.elasticX()&&i.x().domain([])},i.plotData=function(){var a=o(i.effectiveWidth(),i.xUnitCount());m.whiskers(l).width(a).height(i.effectiveHeight()).value(i.valueAccessor()).domain(i.y().domain()).duration(i.transitionDuration()).tickFormat(n);var b=i.chartBodyG().selectAll("g.box").data(i.data(),i.keyAccessor());f(b),g(b),h(b),i.fadeDeselectedArea()},i.fadeDeselectedArea=function(){if(i.hasFilter())if(i.isOrdinal())i.g().selectAll("g.box").each(function(a){i.isSelectedNode(a)?i.highlightSelected(this):i.fadeDeselected(this)});else{var a=i.brush().extent(),b=a[0],c=a[1],d=i.keyAccessor();i.g().selectAll("g.box").each(function(a){var e=d(a);e<b||e>=c?i.fadeDeselected(this):i.highlightSelected(this)})}else i.g().selectAll("g.box").each(function(){i.resetHighlight(this)})},i.isSelectedNode=function(a){return i.hasFilter(i.keyAccessor()(a))},i.yAxisMin=function(){var b=a.min(i.data(),function(b){return a.min(i.valueAccessor()(b))});return c.utils.subtract(b,i.yAxisPadding())},i.yAxisMax=function(){var b=a.max(i.data(),function(b){return a.max(i.valueAccessor()(b))});return c.utils.add(b,i.yAxisPadding())},i.tickFormat=function(a){return arguments.length?(n=a,i):n},i.anchor(b,d)},c.selectMenu=function(b,d){function e(){var a=h.selectAll("option."+j).data(k.data(),function(a){return k.keyAccessor()(a)});return a.enter().append("option").classed(j,!0).attr("value",function(a){return k.keyAccessor()(a)}),a.text(k.title()),a.exit().remove(),h.selectAll("option."+j).sort(p),h.on("change",f),a}function f(b,c){var d,e=a.event.target;if(e.selectedOptions){var f=Array.prototype.slice.call(e.selectedOptions);d=f.map(function(a){return a.value})}else{var g=[].slice.call(a.event.target.options);d=g.filter(function(a){return a.selected}).map(function(a){return a.value})}1===d.length&&""===d[0]?d=n||null:m||1!==d.length||(d=d[0]),k.onChange(d)}function g(){m?h.attr("multiple",!0):h.attr("multiple",null),null!==o?h.attr("size",o):h.attr("size",null)}var h,i="dc-select-menu",j="dc-select-option",k=c.baseMixin({}),l="Select all",m=!1,n=null,o=null,p=function(a,b){return k.keyAccessor()(a)>k.keyAccessor()(b)?1:k.keyAccessor()(b)>k.keyAccessor()(a)?-1:0},q=function(a){return k.valueAccessor()(a)>0};k.data(function(a){return a.all().filter(q)}),k._doRender=function(){return k.select("select").remove(),h=k.root().append("select").classed(i,!0),h.append("option").text(l).attr("value",""),k._doRedraw(),k};var r=window.navigator.userAgent;return r.indexOf("Trident/")>0&&r.indexOf("MSIE")===-1&&(k.redraw=k.render),k._doRedraw=function(){return g(),e(),k.hasFilter()&&m?h.selectAll("option").property("selected",function(a){return"undefined"!=typeof a&&k.filters().indexOf(String(k.keyAccessor()(a)))>=0}):k.hasFilter()?h.property("value",k.filter()):h.property("value",""),k},k.onChange=function(a){a&&m?k.replaceFilter([a]):a?k.replaceFilter(a):k.filterAll(),c.events.trigger(function(){k.redrawGroup()})},k.order=function(a){return arguments.length?(p=a,k):p},k.promptText=function(a){return arguments.length?(l=a,k):l},k.filterDisplayed=function(a){return arguments.length?(q=a,k):q},k.multiple=function(a){return arguments.length?(m=a,k):m},k.promptValue=function(a){return arguments.length?(n=a,k):n},k.numberVisible=function(a){return arguments.length?(o=a,k):o},k.size=c.logger.deprecate(k.numberVisible,"selectMenu.size is ambiguous - use numberVisible instead"),k.anchor(b,d)},c.abstractBubbleChart=c.bubbleMixin,c.baseChart=c.baseMixin,c.capped=c.capMixin,c.colorChart=c.colorMixin,c.coordinateGridChart=c.coordinateGridMixin,c.marginable=c.marginMixin,c.stackableChart=c.stackMixin,c.d3=a,c.crossfilter=b,c}if("function"==typeof define&&define.amd)define(["d3","crossfilter2"],a);else if("object"==typeof module&&module.exports){var b=require("d3"),c=require("crossfilter2");"function"!=typeof c&&(c=c.crossfilter),module.exports=a(b,c)}else this.dc=a(d3,crossfilter)}();
|
|
//# sourceMappingURL=dc.min.js.map
|