diff --git a/bower.json b/bower.json index 6e90de1151..764507f338 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "plottable", "description": "A modular charting library built on D3", - "version": "2.3.0", + "version": "2.3.1", "main": [ "plottable.js", "plottable.css" diff --git a/package.json b/package.json index 9702eac163..7f060959cb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "plottable", "description": "A modular charting library built on D3", - "version": "2.3.0", + "version": "2.3.1", "license": "MIT", "repository": { "type": "git", diff --git a/plottable.js b/plottable.js index b59a69687d..f7650cd1b3 100644 --- a/plottable.js +++ b/plottable.js @@ -1,5 +1,5 @@ /*! -Plottable 2.3.0 (https://github.com/palantir/plottable) +Plottable 2.3.1 (https://github.com/palantir/plottable) Copyright 2014-2015 Palantir Technologies Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE) */ @@ -887,7 +887,7 @@ var Plottable; })(Plottable || (Plottable = {})); var Plottable; (function (Plottable) { - Plottable.version = "2.3.0"; + Plottable.version = "2.3.1"; })(Plottable || (Plottable = {})); var Plottable; (function (Plottable) { diff --git a/plottable.min.js b/plottable.min.js index ea92e55c18..f0f223d6af 100644 --- a/plottable.min.js +++ b/plottable.min.js @@ -1,8 +1,7 @@ -!function(a,b){"function"==typeof define&&define.amd?define(["d3"],function(c){return a.Plottable=b(c)}):"object"==typeof exports?module.exports=b(require("d3")):a.Plottable=b(a.d3)}(this,function(a){var b,c=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(b){var c;!function(c){var d;!function(c){function d(a,b,c){return m.min(b,c)<=a&&a<=m.max(b,c)}function e(a,b,c){return m.min(m.max(b,a),c)}function f(b,c,d){var e="function"==typeof c?c:null,f=null==e?c:d,g=null==e?a.max(b):a.max(b,e);return void 0!==g?g:f}function g(b,c,d){var e="function"==typeof c?c:null,f=null==e?c:d,g=null==e?a.min(b):a.min(b,e);return void 0!==g?g:f}function h(a){return a!==a}function i(a){return"number"==typeof a&&!b.Utils.Math.isNaN(a)&&isFinite(a)}function j(a,b,c){if(void 0===c&&(c=1),0===c)throw new Error("step cannot be 0");for(var d=m.max(m.ceil((b-a)/c),0),e=[],f=0;f=o.floor(b.right))&&(!(o.floor(a.bottom)<=o.ceil(b.top))&&!(o.ceil(a.top)>=o.floor(b.bottom))))}function i(a,b){return o.floor(b.left)<=o.ceil(a.left)&&o.floor(b.top)<=o.ceil(a.top)&&o.floor(a.right)<=o.ceil(b.right)&&o.floor(a.bottom)<=o.ceil(b.bottom)}function j(a){var b=a.ownerSVGElement;return null!=b?b:"svg"===a.nodeName.toLowerCase()?a:null}function k(){return"plottableClipPath"+ ++p}function l(a,b,c,d){void 0===d&&(d=.5);var e=m(a),f=m(b);return c.x+c.width>=e.min-d&&c.x<=e.max+d&&c.y+c.height>=f.min-d&&c.y<=f.max+d}function m(a){if("number"==typeof a){var b=a;return{min:b,max:b}}var c=a;if(c instanceof Object&&"min"in c&&"max"in c)return c;throw new Error("input '"+a+"' can't be parsed as an Range")}function n(a,b){var c=a.getPropertyValue(b),d=parseFloat(c);return d||0}var o=window.Math;b.elementBBox=c,b.SCREEN_REFRESH_RATE_MILLISECONDS=1e3/60,b.requestAnimationFramePolyfill=d,b.elementWidth=e,b.elementHeight=f,b.translate=g,b.clientRectsOverlap=h,b.clientRectInside=i,b.boundingSVG=j;var p=0;b.generateUniqueClipPathId=k,b.intersectsBBox=l}(c=b.DOM||(b.DOM={}))}(c=b.Utils||(b.Utils={}))}(b||(b={}));var b;!function(b){var c;!function(b){var c;!function(b){function c(a,b){var c=f(a)+.05,d=f(b)+.05;return c>d?c/d:d/c}function d(b,c){var d=a.hsl(b).brighter(c);return d.rgb().toString()}function e(a,b){a.classed(b,!0);var c=a.style("background-color");if("transparent"===c)return null;var d=/\((.+)\)/.exec(c)[1].split(",").map(function(a){var b=+a,c=b.toString(16);return b<16?"0"+c:c});if(4===d.length&&"00"===d[3])return null;var e="#"+d.join("");return a.classed(b,!1),e}function f(b){var c=a.rgb(b),d=function(a){return a/=255,a<=.03928?a/12.92:g.pow((a+.055)/1.055,2.4)},e=d(c.r),f=d(c.g),h=d(c.b);return.2126*e+.7152*f+.0722*h}var g=window.Math;b.contrast=c,b.lightenColor=d,b.colorTest=e}(c=b.Color||(b.Color={}))}(c=b.Utils||(b.Utils={}))}(b||(b={}));var b;!function(b){var c;!function(b){var c;!function(b){function c(a,b){if(a.length!==b.length)throw new Error("attempted to add arrays of unequal length");return a.map(function(c,d){return a[d]+b[d]})}function d(b){var c=a.set(),d=[];return b.forEach(function(a){c.has(String(a))||(c.add(String(a)),d.push(a))}),d}function e(a){return g.prototype.concat.apply([],a)}function f(a,b){for(var c=[],d=0;d=0?g:h;m.has(k)?(j=m.get(k),m.set(k,j+l)):(j=0,m.set(k,l)),c.set(k,{value:l,offset:j})}),i.set(a,c)}),i}function e(a,c,d){var e=[];a.forEach(function(a,b){b.data().forEach(function(g,h){if(null==d||d(g,h,b)){var i=a.get(f(c(g,h,b)));e.push(i.value+i.offset)}})});var h=b.Math.max(e,0),i=b.Math.min(e,0);return[g.min(i,0),g.max(0,h)]}function f(a){return String(a)}var g=window.Math;c.stack=d,c.stackedExtent=e,c.normalizeKey=f}(c=b.Stacking||(b.Stacking={}))}(c=b.Utils||(b.Utils={}))}(b||(b={}));var b;!function(a){var b;!function(b){var c;!function(c){function d(b){a.Configs.SHOW_WARNINGS&&null!=window.console&&(null!=window.console.warn?console.warn(b):null!=window.console.log&&console.log(b))}function e(a,b){for(var c=[],d=2;d=f)&&0!==b)return d(a);for(var h=-1;b>=Math.pow(1e3,h+2)&&h0&&"1000"===i.substr(0,4)||a<0&&"-1000"===i.substr(0,5))&&(h20)throw new RangeError("Formatter precision must be between 0 and 20");if(a!==Math.floor(a))throw new RangeError("Formatter precision must be an integer")}b.currency=c,b.fixed=d,b.general=e,b.identity=f,b.percentage=g,b.siSuffix=h,b.shortScale=i,b.multiTime=j,b.time=k}(c=b.Formatters||(b.Formatters={}))}(b||(b={}));var b;!function(b){var c;!function(b){function c(){return function(b){return a.svg.symbol().type("circle").size(Math.PI*Math.pow(b/2,2))(null)}}function d(){return function(b){return a.svg.symbol().type("square").size(Math.pow(b,2))(null)}}function e(){return function(b){return a.svg.symbol().type("cross").size(5/9*Math.pow(b,2))(null)}}function f(){return function(b){return a.svg.symbol().type("diamond").size(Math.tan(Math.PI/6)*Math.pow(b,2)/2)(null)}}function g(){return function(b){return a.svg.symbol().type("triangle-up").size(Math.sqrt(3)*Math.pow(b/2,2))(null)}}function h(){return function(b){return a.svg.symbol().type("triangle-down").size(Math.sqrt(3)*Math.pow(b/2,2))(null)}}b.circle=c,b.square=d,b.cross=e,b.diamond=f,b.triangleUp=g,b.triangleDown=h}(c=b.SymbolFactories||(b.SymbolFactories={}))}(b||(b={}));var b;!function(a){var b=function(){function b(){this._autoDomainAutomatically=!0,this._domainModificationInProgress=!1,this._callbacks=new a.Utils.CallbackSet,this._includedValuesProviders=new a.Utils.Set}return b.prototype.extentOfValues=function(a){return[]},b.prototype._getAllIncludedValues=function(){var a=this,b=[];return this._includedValuesProviders.forEach(function(c){var d=c(a);b=b.concat(d)}),b},b.prototype._getExtent=function(){return[]},b.prototype.onUpdate=function(a){return this._callbacks.add(a),this},b.prototype.offUpdate=function(a){return this._callbacks["delete"](a),this},b.prototype._dispatchUpdate=function(){this._callbacks.callCallbacks(this)},b.prototype.autoDomain=function(){return this._autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},b.prototype._autoDomainIfAutomaticMode=function(){this._autoDomainAutomatically&&this.autoDomain()},b.prototype.scale=function(a){throw new Error("Subclasses should override scale")},b.prototype.domain=function(a){return null==a?this._getDomain():(this._autoDomainAutomatically=!1,this._setDomain(a),this)},b.prototype._getDomain=function(){throw new Error("Subclasses should override _getDomain")},b.prototype._setDomain=function(a){this._domainModificationInProgress||(this._domainModificationInProgress=!0,this._backingScaleDomain(a),this._dispatchUpdate(),this._domainModificationInProgress=!1)},b.prototype._backingScaleDomain=function(a){throw new Error("Subclasses should override _backingDomain")},b.prototype.range=function(a){return null==a?this._getRange():(this._setRange(a),this)},b.prototype._getRange=function(){throw new Error("Subclasses should override _getRange")},b.prototype._setRange=function(a){throw new Error("Subclasses should override _setRange")},b.prototype.addIncludedValuesProvider=function(a){return this._includedValuesProviders.add(a),this._autoDomainIfAutomaticMode(),this},b.prototype.removeIncludedValuesProvider=function(a){return this._includedValuesProviders["delete"](a),this._autoDomainIfAutomaticMode(),this},b}();a.Scale=b}(b||(b={}));var b;!function(b){var d=function(d){function e(){d.call(this),this._tickGenerator=function(a){return a.defaultTicks()},this._padProportion=.05,this._snappingDomainEnabled=!0,this._paddingExceptionsProviders=new b.Utils.Set}return c(e,d),e.prototype.autoDomain=function(){return this._domainMin=null,this._domainMax=null,d.prototype.autoDomain.call(this),this},e.prototype._autoDomainIfAutomaticMode=function(){if(null!=this._domainMin&&null!=this._domainMax)return void this._setDomain([this._domainMin,this._domainMax]);var a=this._getExtent();if(null!=this._domainMin){var b=a[1];return this._domainMin>=b&&(b=this._expandSingleValueDomain([this._domainMin,this._domainMin])[1]),void this._setDomain([this._domainMin,b])}if(null!=this._domainMax){var c=a[0];return this._domainMax<=c&&(c=this._expandSingleValueDomain([this._domainMax,this._domainMax])[0]),void this._setDomain([c,this._domainMax])}d.prototype._autoDomainIfAutomaticMode.call(this)},e.prototype._getExtent=function(){var a=this._getAllIncludedValues(),c=this._defaultExtent();if(0!==a.length){var d=[b.Utils.Math.min(a,c[0]),b.Utils.Math.max(a,c[1])];c=this._padDomain(d)}return null!=this._domainMin&&(c[0]=this._domainMin),null!=this._domainMax&&(c[1]=this._domainMax),c},e.prototype.addPaddingExceptionsProvider=function(a){return this._paddingExceptionsProviders.add(a),this._autoDomainIfAutomaticMode(),this},e.prototype.removePaddingExceptionsProvider=function(a){return this._paddingExceptionsProviders["delete"](a),this._autoDomainIfAutomaticMode(),this},e.prototype.padProportion=function(a){if(null==a)return this._padProportion;if(a<0)throw new Error("padProportion must be non-negative");return this._padProportion=a,this._autoDomainIfAutomaticMode(),this},e.prototype._padDomain=function(a){var b=this;if(a[0].valueOf()===a[1].valueOf())return this._expandSingleValueDomain(a);if(0===this._padProportion)return a;var c=this._padProportion/2,d=a[0],e=a[1],f=!1,g=!1;this._paddingExceptionsProviders.forEach(function(a){var c=a(b);c.forEach(function(a){a.valueOf()===d.valueOf()&&(f=!0),a.valueOf()===e.valueOf()&&(g=!0)})});var h=this._backingScaleDomain();this._backingScaleDomain(a);var i=f?d:this.invert(this.scale(d)-(this.scale(e)-this.scale(d))*c),j=g?e:this.invert(this.scale(e)+(this.scale(e)-this.scale(d))*c);return this._backingScaleDomain(h),this._snappingDomainEnabled?this._niceDomain([i,j]):[i,j]},e.prototype.snappingDomainEnabled=function(a){return null==a?this._snappingDomainEnabled:(this._snappingDomainEnabled=a,this._autoDomainIfAutomaticMode(),this)},e.prototype._expandSingleValueDomain=function(a){return a},e.prototype.invert=function(a){throw new Error("Subclasses should override invert")},e.prototype.domain=function(a){return null!=a&&(this._domainMin=a[0],this._domainMax=a[1]),d.prototype.domain.call(this,a)},e.prototype.domainMin=function(a){return null==a?this.domain()[0]:(this._domainMin=a,this._autoDomainIfAutomaticMode(),this)},e.prototype.domainMax=function(a){return null==a?this.domain()[1]:(this._domainMax=a,this._autoDomainIfAutomaticMode(),this)},e.prototype.extentOfValues=function(c){var d=a.extent(c.filter(function(a){return b.Utils.Math.isValidNumber(+a)}));return null==d[0]||null==d[1]?[]:d},e.prototype._setDomain=function(a){var c=function(a){return b.Utils.Math.isNaN(a)||a===1/0||a===-(1/0)};return c(a[0])||c(a[1])?void b.Utils.Window.warn("Warning: QuantitativeScales cannot take NaN or Infinity as a domain value. Ignoring."):void d.prototype._setDomain.call(this,a)},e.prototype.defaultTicks=function(){throw new Error("Subclasses should override _getDefaultTicks")},e.prototype.ticks=function(){return this._tickGenerator(this)},e.prototype._niceDomain=function(a,b){throw new Error("Subclasses should override _niceDomain")},e.prototype._defaultExtent=function(){throw new Error("Subclasses should override _defaultExtent")},e.prototype.tickGenerator=function(a){return null==a?this._tickGenerator:(this._tickGenerator=a,this)},e._DEFAULT_NUM_TICKS=10,e}(b.Scale);b.QuantitativeScale=d}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(b){function e(){b.call(this),this._d3Scale=a.scale.linear()}return c(e,b),e.prototype._defaultExtent=function(){return[0,1]},e.prototype._expandSingleValueDomain=function(a){return a[0]===a[1]?[a[0]-1,a[1]+1]:a},e.prototype.scale=function(a){return this._d3Scale(a)},e.prototype._getDomain=function(){return this._backingScaleDomain()},e.prototype._backingScaleDomain=function(a){return null==a?this._d3Scale.domain():(this._d3Scale.domain(a),this)},e.prototype._getRange=function(){return this._d3Scale.range()},e.prototype._setRange=function(a){this._d3Scale.range(a)},e.prototype.invert=function(a){return this._d3Scale.invert(a)},e.prototype.defaultTicks=function(){return this._d3Scale.ticks(d.Linear._DEFAULT_NUM_TICKS)},e.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},e}(b.QuantitativeScale);d.Linear=e}(d=b.Scales||(b.Scales={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(e){function f(b){if(void 0===b&&(b=10),e.call(this),this._d3Scale=a.scale.linear(),this._base=b,this._pivot=this._base,this._setDomain(this._defaultExtent()),b<=1)throw new Error("ModifiedLogScale: The base must be > 1")}return c(f,e),f.prototype._adjustedLog=function(a){var b=a<0?-1:1;return a*=b,a0?[b/this._base,b*this._base]:0===b?[-this._base,this._base]:[b*this._base,b/this._base]}return a},f.prototype._getRange=function(){return this._d3Scale.range()},f.prototype._setRange=function(a){this._d3Scale.range(a)},f.prototype.defaultTicks=function(){return this._d3Scale.ticks(d.ModifiedLog._DEFAULT_NUM_TICKS)},f}(b.QuantitativeScale);d.ModifiedLog=e}(d=b.Scales||(b.Scales={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(d){function e(){d.call(this),this._range=[0,1],this._d3Scale=a.scale.ordinal();var b=.3;this._innerPadding=e._convertToPlottableInnerPadding(b),this._outerPadding=e._convertToPlottableOuterPadding(.5,b)}return c(e,d),e.prototype.extentOfValues=function(a){return b.Utils.Array.uniq(a)},e.prototype._getExtent=function(){return b.Utils.Array.uniq(this._getAllIncludedValues())},e.prototype.domain=function(a){return d.prototype.domain.call(this,a)},e.prototype.range=function(a){return d.prototype.range.call(this,a)},e._convertToPlottableInnerPadding=function(a){return 1/(1-a)-1},e._convertToPlottableOuterPadding=function(a,b){return a/(1-b)},e.prototype._setBands=function(){var a=1-1/(1+this.innerPadding()),b=this.outerPadding()/(1+this.innerPadding());this._d3Scale.rangeBands(this._range,a,b)},e.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},e.prototype.stepWidth=function(){return this.rangeBand()*(1+this.innerPadding())},e.prototype.innerPadding=function(a){return null==a?this._innerPadding:(this._innerPadding=a,this.range(this.range()),this._dispatchUpdate(),this)},e.prototype.outerPadding=function(a){return null==a?this._outerPadding:(this._outerPadding=a,this.range(this.range()),this._dispatchUpdate(),this)},e.prototype.scale=function(a){return this._d3Scale(a)+this.rangeBand()/2},e.prototype._getDomain=function(){return this._backingScaleDomain()},e.prototype._backingScaleDomain=function(a){return null==a?this._d3Scale.domain():(this._d3Scale.domain(a),this._setBands(),this)},e.prototype._getRange=function(){return this._range},e.prototype._setRange=function(a){this._range=a,this._setBands()},e}(b.Scale);d.Category=e}(d=b.Scales||(b.Scales={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(d){function e(b){d.call(this);var c;switch(b){case null:case void 0:null==e._plottableColorCache&&(e._plottableColorCache=e._getPlottableColors()),c=a.scale.ordinal().range(e._plottableColorCache);break;case"Category10":case"category10":case"10":c=a.scale.category10();break;case"Category20":case"category20":case"20":c=a.scale.category20();break;case"Category20b":case"category20b":case"20b":c=a.scale.category20b();break;case"Category20c":case"category20c":case"20c":c=a.scale.category20c();break;default:throw new Error("Unsupported ColorScale type")}this._d3Scale=c}return c(e,d),e.prototype.extentOfValues=function(a){return b.Utils.Array.uniq(a)},e.prototype._getExtent=function(){return b.Utils.Array.uniq(this._getAllIncludedValues())},e.invalidateColorCache=function(){e._plottableColorCache=null},e._getPlottableColors=function(){for(var c=[],d=a.select("body").append("plottable-color-tester"),e=b.Utils.Color.colorTest(d,""),f=0,g=b.Utils.Color.colorTest(d,"plottable-colors-0");null!=g&&f0&&this._setDomain([b.Utils.Math.min(a,0),b.Utils.Math.max(a,0)]),this},e.prototype.scale=function(a){return this._d3Scale(a)},e.prototype._getDomain=function(){return this._backingScaleDomain()},e.prototype._backingScaleDomain=function(a){return null==a?this._d3Scale.domain():(this._d3Scale.domain(a),this)},e.prototype._getRange=function(){return this._colorRange},e.prototype._setRange=function(a){this._colorRange=a,this._resetScale()},e.REDS=["#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],e.BLUES=["#FFFFFF","#CCFFFF","#A5FFFD","#85F7FB","#6ED3EF","#55A7E0","#417FD0","#2545D3","#0B02E1"],e.POSNEG=["#0B02E1","#2545D3","#417FD0","#55A7E0","#6ED3EF","#85F7FB","#A5FFFD","#CCFFFF","#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],e}(b.Scale);d.InterpolatedColor=e}(d=b.Scales||(b.Scales={}))}(b||(b={}));var b;!function(a){var b;!function(b){var c;!function(b){function c(b){if(b<=0)throw new Error("interval must be positive number");return function(c){var d=c.domain(),e=Math.min(d[0],d[1]),f=Math.max(d[0],d[1]),g=Math.ceil(e/b)*b,h=Math.floor((f-g)/b)+1,i=e%b===0?[]:[e],j=a.Utils.Math.range(0,h).map(function(a){return g+a*b}),k=f%b===0?[]:[f];return i.concat(j).concat(k)}}function d(){return function(a){var b=a.defaultTicks();return b.filter(function(a,c){return a%1===0||0===c||c===b.length-1})}}b.intervalTickGenerator=c,b.integerTickGenerator=d}(c=b.TickGenerators||(b.TickGenerators={}))}(b=a.Scales||(a.Scales={}))}(b||(b={}));var b;!function(b){var c=function(){function c(a){this._cachedSelectionValid=!1,this._dataset=a}return c.prototype.renderArea=function(a){return null==a?this._renderArea:(this._renderArea=a,this._cachedSelectionValid=!1,this)},c.prototype.remove=function(){null!=this.renderArea()&&this.renderArea().remove()},c.prototype._bindSelectionData=function(a){var b=this.selection().data(a);b.enter().append(this._svgElementName),b.exit().remove(),this._applyDefaultAttributes(b)},c.prototype._applyDefaultAttributes=function(a){null!=this._className&&a.classed(this._className,!0)},c.prototype._drawStep=function(a){var b=this.selection(),c=["fill","stroke"];c.forEach(function(c){null!=a.attrToAppliedProjector[c]&&b.attr(c,a.attrToAppliedProjector[c])}),a.animator.animate(b,a.attrToAppliedProjector),null!=this._className&&this.selection().classed(this._className,!0)},c.prototype._appliedProjectors=function(a){var b=this,c={};return Object.keys(a).forEach(function(d){c[d]=function(c,e){return a[d](c,e,b._dataset)}}),c},c.prototype.totalDrawTime=function(a,b){var c=0;return b.forEach(function(b,d){c+=b.animator.totalTime(a.length)}),c},c.prototype.draw=function(a,c){var d=this,e=c.map(function(a){var b=d._appliedProjectors(a.attrToProjector);return{attrToAppliedProjector:b,animator:a.animator}});this._bindSelectionData(a),this._cachedSelectionValid=!1;var f=0;return e.forEach(function(c,e){b.Utils.Window.setTimeout(function(){return d._drawStep(c)},f),f+=c.animator.totalTime(a.length)}),this},c.prototype.selection=function(){return this._cachedSelectionValid||(this._cachedSelection=this.renderArea().selectAll(this.selector()),this._cachedSelectionValid=!0),this._cachedSelection},c.prototype.selector=function(){return this._svgElementName},c.prototype.selectionForIndex=function(b){return a.select(this.selection()[0][b])},c}();b.Drawer=c}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(b){function d(a){b.call(this,a),this._className="line",this._svgElementName="path"}return c(d,b),d.prototype._applyDefaultAttributes=function(a){b.prototype._applyDefaultAttributes.call(this,a),a.style("fill","none")},d.prototype.selectionForIndex=function(b){return a.select(this.selection()[0][0])},d}(b.Drawer);d.Line=e}(d=b.Drawers||(b.Drawers={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(b){function d(a){b.call(this,a),this._className="area",this._svgElementName="path"}return c(d,b),d.prototype._applyDefaultAttributes=function(a){b.prototype._applyDefaultAttributes.call(this,a),a.style("stroke","none")},d.prototype.selectionForIndex=function(b){return a.select(this.selection()[0][0])},d}(b.Drawer);d.Area=e}(d=b.Drawers||(b.Drawers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(b){a.call(this,b),this._svgElementName="rect"}return c(b,a),b}(a.Drawer);b.Rectangle=d}(b=a.Drawers||(a.Drawers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(b){a.call(this,b),this._className="arc fill",this._svgElementName="path"}return c(b,a),b.prototype._applyDefaultAttributes=function(b){a.prototype._applyDefaultAttributes.call(this,b),b.style("stroke","none")},b}(a.Drawer);b.Arc=d}(b=a.Drawers||(a.Drawers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(b){a.call(this,b),this._className="arc outline",this._svgElementName="path"}return c(b,a),b.prototype._applyDefaultAttributes=function(b){a.prototype._applyDefaultAttributes.call(this,b),b.style("fill","none")},b}(a.Drawer);b.ArcOutline=d}(b=a.Drawers||(a.Drawers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(b){a.call(this,b),this._svgElementName="path",this._className="symbol"}return c(b,a),b}(a.Drawer);b.Symbol=d}(b=a.Drawers||(a.Drawers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(b){a.call(this,b),this._svgElementName="line"}return c(b,a),b}(a.Drawer);b.Segment=d}(b=a.Drawers||(a.Drawers={}))}(b||(b={}));var b;!function(b){var c;!function(a){var b=function(){function a(){}return a.TOP="top",a.BOTTOM="bottom",a.LEFT="left",a.RIGHT="right",a.CENTER="center",a}();a.Alignment=b}(c=b.Components||(b.Components={}));var d=function(){function c(){this._clipPathEnabled=!1,this._origin={x:0,y:0},this._xAlignment="left",this._yAlignment="top",this._isSetup=!1,this._isAnchored=!1,this._boxes=[],this._isTopLevelComponent=!1,this._cssClasses=new b.Utils.Set,this._destroyed=!1,this._onAnchorCallbacks=new b.Utils.CallbackSet,this._onDetachCallbacks=new b.Utils.CallbackSet,this._cssClasses.add("component")}return c.prototype.anchor=function(a){if(this._destroyed)throw new Error("Can't reuse destroy()-ed Components!");if(this._isTopLevelComponent="svg"===a.node().nodeName.toLowerCase(),this._isTopLevelComponent){this._rootSVG=a,this._rootSVG.classed("plottable",!0),this._rootSVG.style("overflow","visible");var b=this._rootSVG.select("."+c._SAFARI_EVENT_BACKING_CLASS);b.empty()&&this._rootSVG.append("rect").classed(c._SAFARI_EVENT_BACKING_CLASS,!0).attr({x:0,y:0,width:"100%",height:"100%"}).style("opacity",0)}return null!=this._element?a.node().appendChild(this._element.node()):(this._element=a.append("g"),this._setup()),this._isAnchored=!0,this._onAnchorCallbacks.callCallbacks(this),this},c.prototype.onAnchor=function(a){return this._isAnchored&&a(this),this._onAnchorCallbacks.add(a),this},c.prototype.offAnchor=function(a){return this._onAnchorCallbacks["delete"](a),this},c.prototype._setup=function(){var a=this;this._isSetup||(this._cssClasses.forEach(function(b){a._element.classed(b,!0)}),this._cssClasses=new b.Utils.Set,this._backgroundContainer=this._element.append("g").classed("background-container",!0),this._addBox("background-fill",this._backgroundContainer),this._content=this._element.append("g").classed("content",!0),this._foregroundContainer=this._element.append("g").classed("foreground-container",!0),this._boxContainer=this._element.append("g").classed("box-container",!0),this._clipPathEnabled&&this._generateClipPath(),this._boundingBox=this._addBox("bounding-box"),this._isSetup=!0)},c.prototype.requestedSpace=function(a,b){return{minWidth:0,minHeight:0}},c.prototype.computeLayout=function(a,d,e){var f=this;if(null==a||null==d||null==e){if(null==this._element)throw new Error("anchor() must be called before computeLayout()");if(!this._isTopLevelComponent)throw new Error("null arguments cannot be passed to computeLayout() on a non-root node");a={x:0,y:0},null==this._rootSVG.attr("width")&&this._rootSVG.attr("width","100%"),null==this._rootSVG.attr("height")&&this._rootSVG.attr("height","100%");var g=this._rootSVG.node();d=b.Utils.DOM.elementWidth(g),e=b.Utils.DOM.elementHeight(g)}var h=this._sizeFromOffer(d,e);this._width=h.width,this._height=h.height;var i=c._xAlignToProportion[this._xAlignment],j=c._yAlignToProportion[this._yAlignment];return this._origin={x:a.x+(d-this.width())*i,y:a.y+(e-this.height())*j},this._element.attr("transform","translate("+this._origin.x+","+this._origin.y+")"),this._boxes.forEach(function(a){return a.attr("width",f.width()).attr("height",f.height())}),this},c.prototype._sizeFromOffer=function(a,b){var c=this.requestedSpace(a,b);return{width:this.fixedWidth()?Math.min(a,c.minWidth):a,height:this.fixedHeight()?Math.min(b,c.minHeight):b}},c.prototype.render=function(){return this._isAnchored&&this._isSetup&&this.width()>=0&&this.height()>=0&&b.RenderController.registerToRender(this),this},c.prototype._scheduleComputeLayout=function(){this._isAnchored&&this._isSetup&&b.RenderController.registerToComputeLayout(this)},c.prototype.renderImmediately=function(){return this._clipPathEnabled&&this._updateClipPath(),this},c.prototype.redraw=function(){return this._isAnchored&&this._isSetup&&(this._isTopLevelComponent?this._scheduleComputeLayout():this.parent().redraw()),this},c.prototype.renderTo=function(c){if(this.detach(),null!=c){var d=void 0;if(d="string"==typeof c?a.select(c):c instanceof Element?a.select(c):c,!d.node()||"svg"!==d.node().nodeName.toLowerCase())throw new Error("Plottable requires a valid SVG to renderTo");this.anchor(d)}if(null==this._element)throw new Error("If a Component has never been rendered before, then renderTo must be given a node to render to, or a d3.Selection, or a selector string");return this.computeLayout(),this.render(),b.RenderController.flush(),this},c.prototype.xAlignment=function(a){if(null==a)return this._xAlignment;if(a=a.toLowerCase(),null==c._xAlignToProportion[a])throw new Error("Unsupported alignment: "+a);return this._xAlignment=a,this.redraw(),this},c.prototype.yAlignment=function(a){if(null==a)return this._yAlignment;if(a=a.toLowerCase(),null==c._yAlignToProportion[a])throw new Error("Unsupported alignment: "+a);return this._yAlignment=a,this.redraw(),this},c.prototype._addBox=function(a,b){if(null==this._element)throw new Error("Adding boxes before anchoring is currently disallowed");b=null==b?this._boxContainer:b;var c=b.append("rect");return null!=a&&c.classed(a,!0),this._boxes.push(c),null!=this.width()&&null!=this.height()&&c.attr("width",this.width()).attr("height",this.height()),c},c.prototype._generateClipPath=function(){this._clipPathID=b.Utils.DOM.generateUniqueClipPathId();var a=this._boxContainer.append("clipPath").attr("id",this._clipPathID);this._addBox("clip-rect",a),this._updateClipPath()},c.prototype._updateClipPath=function(){var a=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;a=a.split("#")[0],this._element.attr("clip-path",'url("'+a+"#"+this._clipPathID+'")')},c.prototype.hasClass=function(a){return null!=a&&(null==this._element?this._cssClasses.has(a):this._element.classed(a))},c.prototype.addClass=function(a){return null==a?this:(null==this._element?this._cssClasses.add(a):this._element.classed(a,!0),this)},c.prototype.removeClass=function(a){return null==a?this:(null==this._element?this._cssClasses["delete"](a):this._element.classed(a,!1),this)},c.prototype.fixedWidth=function(){return!1},c.prototype.fixedHeight=function(){return!1},c.prototype.detach=function(){return this.parent(null),this._isAnchored&&(this._element.remove(),this._isTopLevelComponent&&this._rootSVG.select("."+c._SAFARI_EVENT_BACKING_CLASS).remove()),this._isAnchored=!1,this._onDetachCallbacks.callCallbacks(this),this},c.prototype.onDetach=function(a){return this._onDetachCallbacks.add(a),this},c.prototype.offDetach=function(a){return this._onDetachCallbacks["delete"](a),this},c.prototype.parent=function(a){if(void 0===a)return this._parent;if(null!==a&&!a.has(this))throw new Error("Passed invalid parent");return this._parent=a,this},c.prototype.destroy=function(){this._destroyed=!0,this.detach()},c.prototype.width=function(){return this._width},c.prototype.height=function(){return this._height},c.prototype.origin=function(){return{x:this._origin.x,y:this._origin.y}},c.prototype.originToSVG=function(){for(var a=this.origin(),b=this.parent();null!=b;){var c=b.origin();a.x+=c.x,a.y+=c.y,b=b.parent()}return a},c.prototype.foreground=function(){return this._foregroundContainer},c.prototype.content=function(){return this._content},c.prototype.background=function(){return this._backgroundContainer},c._xAlignToProportion={left:0,center:.5,right:1},c._yAlignToProportion={top:0,center:.5,bottom:1},c._SAFARI_EVENT_BACKING_CLASS="safari-event-backing",c}();b.Component=d}(b||(b={}));var b;!function(a){var b=function(a){function b(){var b=this;a.call(this),this._detachCallback=function(a){return b.remove(a)}}return c(b,a),b.prototype.anchor=function(b){var c=this;return a.prototype.anchor.call(this,b),this._forEach(function(a){return a.anchor(c.content())}),this},b.prototype.render=function(){return this._forEach(function(a){return a.render()}),this},b.prototype.has=function(a){throw new Error("has() is not implemented on ComponentContainer")},b.prototype._adoptAndAnchor=function(a){a.parent(this),a.onDetach(this._detachCallback),this._isAnchored&&a.anchor(this.content())},b.prototype.remove=function(a){return this.has(a)&&(a.offDetach(this._detachCallback),this._remove(a),a.detach(),this.redraw()),this},b.prototype._remove=function(a){return!1},b.prototype._forEach=function(a){throw new Error("_forEach() is not implemented on ComponentContainer")},b.prototype.destroy=function(){a.prototype.destroy.call(this),this._forEach(function(a){return a.destroy()})},b}(a.Component);a.ComponentContainer=b}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(a){var c=this;void 0===a&&(a=[]),b.call(this),this._components=[],this.addClass("component-group"),a.forEach(function(a){return c.append(a)})}return c(d,b),d.prototype._forEach=function(a){this.components().forEach(a)},d.prototype.has=function(a){return this._components.indexOf(a)>=0},d.prototype.requestedSpace=function(b,c){var d=this._components.map(function(a){return a.requestedSpace(b,c)});return{minWidth:a.Utils.Math.max(d,function(a){return a.minWidth},0),minHeight:a.Utils.Math.max(d,function(a){return a.minHeight},0)}},d.prototype.computeLayout=function(a,c,d){var e=this;return b.prototype.computeLayout.call(this,a,c,d),this._forEach(function(a){a.computeLayout({x:0,y:0},e.width(),e.height())}),this},d.prototype._sizeFromOffer=function(a,b){return{width:a,height:b}},d.prototype.fixedWidth=function(){return this._components.every(function(a){return a.fixedWidth()})},d.prototype.fixedHeight=function(){return this._components.every(function(a){return a.fixedHeight()})},d.prototype.components=function(){return this._components.slice()},d.prototype.append=function(a){return null==a||this.has(a)||(a.detach(),this._components.push(a),this._adoptAndAnchor(a),this.redraw()),this},d.prototype._remove=function(a){var b=this._components.indexOf(a);return b>=0&&(this._components.splice(b,1),!0)},d}(a.ComponentContainer);b.Group=d}(b=a.Components||(a.Components={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(){b.apply(this,arguments)}return c(d,b),d.prototype.entityNearest=function(b){var c,d=1/0;return this.components().forEach(function(e){var f=e.entityNearest(b);if(null!=f){var g=a.Utils.Math.distanceSquared(f.position,b);g<=d&&(d=g,c=f)}}),c},d.prototype.append=function(c){if(null!=c&&!(c instanceof a.Plot))throw new Error("Plot Group only accepts plots");return b.prototype.append.call(this,c),this},d}(b.Group);b.PlotGroup=d}(b=a.Components||(a.Components={}))}(b||(b={}));var b;!function(b){var d=function(d){function e(a,c){var e=this;if(d.call(this),this._endTickLength=5,this._innerTickLength=5,this._tickLabelPadding=10,this._margin=15,this._showEndTickLabels=!1,this._annotationsEnabled=!1,this._annotationTierCount=1,null==a||null==c)throw new Error("Axis requires a scale and orientation");this._scale=a,this.orientation(c),this._setDefaultAlignment(),this.addClass("axis"),this._isHorizontal()?this.addClass("x-axis"):this.addClass("y-axis"),this.formatter(b.Formatters.identity()),this._rescaleCallback=function(a){return e._rescale()},this._scale.onUpdate(this._rescaleCallback),this._annotatedTicks=[],this._annotationFormatter=b.Formatters.identity()}return c(e,d),e.prototype.destroy=function(){d.prototype.destroy.call(this),this._scale.offUpdate(this._rescaleCallback)},e.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},e.prototype._computeWidth=function(){return this._maxLabelTickLength()},e.prototype._computeHeight=function(){return this._maxLabelTickLength()},e.prototype.requestedSpace=function(a,b){var c=0,d=0;if(this._isHorizontal()){if(d=this._computeHeight()+this._margin,this.annotationsEnabled()){var f=this._annotationMeasurer.measure().height+2*e._ANNOTATION_LABEL_PADDING;d+=f*this.annotationTierCount()}}else if(c=this._computeWidth()+this._margin,this.annotationsEnabled()){var f=this._annotationMeasurer.measure().height+2*e._ANNOTATION_LABEL_PADDING;c+=f*this.annotationTierCount()}return{minWidth:c,minHeight:d}},e.prototype.fixedHeight=function(){return this._isHorizontal()},e.prototype.fixedWidth=function(){return!this._isHorizontal()},e.prototype._rescale=function(){this.render()},e.prototype.computeLayout=function(a,b,c){return d.prototype.computeLayout.call(this,a,b,c),this._isHorizontal()?this._scale.range([0,this.width()]):this._scale.range([this.height(),0]),this},e.prototype._setup=function(){d.prototype._setup.call(this),this._tickMarkContainer=this.content().append("g").classed(e.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this.content().append("g").classed(e.TICK_LABEL_CLASS+"-container",!0),this._baseline=this.content().append("line").classed("baseline",!0),this._annotationContainer=this.content().append("g").classed("annotation-container",!0),this._annotationContainer.append("g").classed("annotation-line-container",!0),this._annotationContainer.append("g").classed("annotation-circle-container",!0),this._annotationContainer.append("g").classed("annotation-rect-container",!0);var a=this._annotationContainer.append("g").classed("annotation-label-container",!0);this._annotationMeasurer=new SVGTypewriter.Measurers.Measurer(a),this._annotationWriter=new SVGTypewriter.Writers.Writer(this._annotationMeasurer)},e.prototype._getTickValues=function(){return[]},e.prototype.renderImmediately=function(){var b=this._getTickValues(),c=this._tickMarkContainer.selectAll("."+e.TICK_MARK_CLASS).data(b);return c.enter().append("line").classed(e.TICK_MARK_CLASS,!0),c.attr(this._generateTickMarkAttrHash()),a.select(c[0][0]).classed(e.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),a.select(c[0][b.length-1]).classed(e.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),c.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash()),this.annotationsEnabled()?this._drawAnnotations():this._removeAnnotations(),this},e.prototype.annotatedTicks=function(a){return null==a?this._annotatedTicks:(this._annotatedTicks=a,this.render(),this)},e.prototype.annotationFormatter=function(a){return null==a?this._annotationFormatter:(this._annotationFormatter=a,this.render(),this)},e.prototype.annotationsEnabled=function(a){return null==a?this._annotationsEnabled:(this._annotationsEnabled=a,this.redraw(),this)},e.prototype.annotationTierCount=function(a){if(null==a)return this._annotationTierCount;if(a<0)throw new Error("annotationTierCount cannot be negative");return this._annotationTierCount=a,this.redraw(),this},e.prototype._drawAnnotations=function(){var c=this,d=e._ANNOTATION_LABEL_PADDING,f=new b.Utils.Map,g=this._annotatedTicksToRender();g.forEach(function(a){var b=c._annotationMeasurer.measure(c.annotationFormatter()(a)),e={width:b.width+2*d,height:b.height+2*d};f.set(a,e)});var h=this._annotationMeasurer.measure().height+2*d,i=this._annotationToTier(f),j=new b.Utils.Set,k=this._isHorizontal()?this.height():this.width(),l=this._coreSize(),m=Math.min(this.annotationTierCount(),Math.floor((k-l)/h));i.forEach(function(a,b){(a===-1||a>=m)&&j.add(b)});var n,o=function(a,b,c){var d=a.selectAll("."+c).data(g);return d.enter().append(b).classed(c,!0),d.exit().remove(),d},p=function(a){switch(c.orientation()){case"bottom":case"right":return i.get(a)*h+l;case"top":case"left":return k-l-i.get(a)*h}},q=function(a){return c._scale.scale(a)},r=function(a){return j.has(a)?"hidden":"visible"};switch(this.orientation()){case"bottom":case"right":n=0;break;case"top":n=this.height();break;case"left":n=this.width()}var s=this._isHorizontal();o(this._annotationContainer.select(".annotation-line-container"),"line",e.ANNOTATION_LINE_CLASS).attr({x1:s?q:n,x2:s?q:p,y1:s?n:q,y2:s?p:q,visibility:r}),o(this._annotationContainer.select(".annotation-circle-container"),"circle",e.ANNOTATION_CIRCLE_CLASS).attr({cx:s?q:n,cy:s?n:q,r:3});var t=function(a){switch(c.orientation()){case"bottom":case"right":return p(a);case"top":case"left":return p(a)-f.get(a).height}};o(this._annotationContainer.select(".annotation-rect-container"),"rect",e.ANNOTATION_RECT_CLASS).attr({x:s?q:t,y:s?t:q,width:s?function(a){return f.get(a).width}:function(a){return f.get(a).height},height:s?function(a){return f.get(a).height}:function(a){return f.get(a).width},visibility:r});var u=this._annotationWriter,v=this.annotationFormatter(),w=o(this._annotationContainer.select(".annotation-label-container"),"g",e.ANNOTATION_LABEL_CLASS);w.selectAll(".text-container").remove(),w.attr({transform:function(a){var b=s?q(a):t(a),c=s?t(a):q(a);return"translate("+b+","+c+")"},visibility:r}).each(function(b){var c={selection:a.select(this),xAlign:"center",yAlign:"center",textRotation:s?0:90};u.write(v(b),s?f.get(b).width:f.get(b).height,s?f.get(b).height:f.get(b).width,c)})},e.prototype._annotatedTicksToRender=function(){var a=this,c=this._scale.range();return b.Utils.Array.uniq(this.annotatedTicks().filter(function(d){return null!=d&&b.Utils.Math.inRange(a._scale.scale(d),c[0],c[1])}))},e.prototype._coreSize=function(){var a=this._isHorizontal()?this.height():this.width(),b=this._isHorizontal()?this._computeHeight():this._computeWidth();return Math.min(b,a)},e.prototype._annotationTierHeight=function(){return this._annotationMeasurer.measure().height+2*e._ANNOTATION_LABEL_PADDING},e.prototype._annotationToTier=function(a){var c=this,d=[[]],e=new b.Utils.Map,f=this._isHorizontal()?this.width():this.height();return this._annotatedTicksToRender().forEach(function(b){var g=c._scale.scale(b),h=a.get(b).width;if(g<0||g+h>f)return void e.set(b,-1);for(var i=function(b){return d[b].some(function(b){var d=c._scale.scale(b),e=a.get(b).width;return g+h>=d&&g<=d+e})},j=0;i(j);)j++,d.length===j&&d.push([]);d[j].push(b),e.set(b,j)}),e},e.prototype._removeAnnotations=function(){this._annotationContainer.selectAll(".annotation-line").remove(),this._annotationContainer.selectAll(".annotation-circle").remove(),this._annotationContainer.selectAll(".annotation-rect").remove(),this._annotationContainer.selectAll(".annotation-label").remove()},e.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.width();break;case"top":a.x2=this.width(),a.y1=this.height(),a.y2=this.height();break;case"left":a.x1=this.width(),a.x2=this.width(),a.y2=this.height();break;case"right":a.y2=this.height()}return a},e.prototype._generateTickMarkAttrHash=function(a){var b=this;void 0===a&&(a=!1);var c={x1:0,y1:0,x2:0,y2:0},d=function(a){return b._scale.scale(a)};this._isHorizontal()?(c.x1=d,c.x2=d):(c.y1=d,c.y2=d);var e=a?this._endTickLength:this._innerTickLength;switch(this._orientation){case"bottom":c.y2=e;break;case"top":c.y1=this.height(),c.y2=this.height()-e;break;case"left":c.x1=this.width(),c.x2=this.width()-e;break;case"right":c.x2=e}return c},e.prototype._setDefaultAlignment=function(){switch(this._orientation){case"bottom":this.yAlignment("top");break;case"top":this.yAlignment("bottom");break;case"left":this.xAlignment("right");break;case"right":this.xAlignment("left")}},e.prototype.formatter=function(a){return null==a?this._formatter:(this._formatter=a,this.redraw(),this)},e.prototype.innerTickLength=function(a){if(null==a)return this._innerTickLength;if(a<0)throw new Error("inner tick length must be positive");return this._innerTickLength=a,this.redraw(),this},e.prototype.endTickLength=function(a){if(null==a)return this._endTickLength;if(a<0)throw new Error("end tick length must be positive");return this._endTickLength=a,this.redraw(),this},e.prototype._maxLabelTickLength=function(){return this.showEndTickLabels()?Math.max(this.innerTickLength(),this.endTickLength()):this.innerTickLength()},e.prototype.tickLabelPadding=function(a){if(null==a)return this._tickLabelPadding;if(a<0)throw new Error("tick label padding must be positive");return this._tickLabelPadding=a,this.redraw(),this},e.prototype.margin=function(a){if(null==a)return this._margin;if(a<0)throw new Error("margin size must be positive");return this._margin=a,this.redraw(),this},e.prototype.orientation=function(a){if(null==a)return this._orientation;var b=a.toLowerCase();if("top"!==b&&"bottom"!==b&&"left"!==b&&"right"!==b)throw new Error("unsupported orientation");return this._orientation=b,this.redraw(),this},e.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this.render(),this)},e.END_TICK_MARK_CLASS="end-tick-mark",e.TICK_MARK_CLASS="tick-mark",e.TICK_LABEL_CLASS="tick-label",e.ANNOTATION_LINE_CLASS="annotation-line",e.ANNOTATION_RECT_CLASS="annotation-rect",e.ANNOTATION_CIRCLE_CLASS="annotation-circle",e.ANNOTATION_LABEL_CLASS="annotation-label",e._ANNOTATION_LABEL_PADDING=4,e}(b.Component);b.Axis=d}(b||(b={}));var b;!function(a){var b;!function(a){a.second="second",a.minute="minute",a.hour="hour",a.day="day",a.week="week",a.month="month",a.year="year"}(b=a.TimeInterval||(a.TimeInterval={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(d){function e(a,c){d.call(this,a,c),this._tierLabelPositions=[],this.addClass("time-axis"),this.tickLabelPadding(5),this.axisConfigurations(e._DEFAULT_TIME_AXIS_CONFIGURATIONS),this.annotationFormatter(b.Formatters.time("%a %b %d, %Y"))}return c(e,d),e.prototype.tierLabelPositions=function(a){if(null==a)return this._tierLabelPositions;if(!a.every(function(a){return"between"===a.toLowerCase()||"center"===a.toLowerCase()}))throw new Error("Unsupported position for tier labels");return this._tierLabelPositions=a,this.redraw(),this},e.prototype.axisConfigurations=function(a){if(null==a)return this._possibleTimeAxisConfigurations;this._possibleTimeAxisConfigurations=a,this._numTiers=b.Utils.Math.max(this._possibleTimeAxisConfigurations.map(function(a){return a.length}),0),this._isAnchored&&this._setupDomElements();for(var c=this.tierLabelPositions(),d=[],e=0;ethis._scale.domain()[1])return this.width();var f=Math.abs(this._scale.scale(e)-this._scale.scale(c));return f},e.prototype._maxWidthForInterval=function(a){return this._measurer.measure(a.formatter(e._LONG_DATE)).width},e.prototype._checkTimeAxisTierConfigurationWidth=function(a){var b=this._maxWidthForInterval(a)+2*this.tickLabelPadding();return Math.min(this._getIntervalLength(a),this.width())>=b},e.prototype._sizeFromOffer=function(a,b){var c=d.prototype._sizeFromOffer.call(this,a,b),e=this._tierHeights.reduce(function(a,b,d,e){return a+b>c.height?a:a+b}),f=this.margin()+(this.annotationsEnabled()?this.annotationTierCount()*this._annotationTierHeight():0);return c.height=Math.min(c.height,e+f),c},e.prototype._setup=function(){d.prototype._setup.call(this),this._setupDomElements()},e.prototype._setupDomElements=function(){this.content().selectAll("."+e.TIME_AXIS_TIER_CLASS).remove(),this._tierLabelContainers=[],this._tierMarkContainers=[],this._tierBaselines=[],this._tickLabelContainer.remove(),this._baseline.remove();for(var a=0;a=g.length||h.push(new Date((g[b+1].valueOf()-g[b].valueOf())/2+g[b].valueOf()))}):h=g;var i=c.selectAll("."+b.Axis.TICK_LABEL_CLASS).data(h,function(a){return String(a.valueOf())}),j=i.enter().append("g").classed(b.Axis.TICK_LABEL_CLASS,!0);j.append("text");var k,l="center"===this._tierLabelPositions[e]||1===d.step?0:this.tickLabelPadding();k="bottom"===this.orientation()?a.sum(this._tierHeights.slice(0,e+1))-this.tickLabelPadding():"center"===this._tierLabelPositions[e]?this.height()-a.sum(this._tierHeights.slice(0,e))-this.tickLabelPadding()-this._maxLabelTickLength():this.height()-a.sum(this._tierHeights.slice(0,e))-this.tickLabelPadding();var m=i.selectAll("text");m.size()>0&&b.Utils.DOM.translate(m,l,k),i.exit().remove(),i.attr("transform",function(a){return"translate("+f._scale.scale(a)+",0)"; -});var n="center"===this._tierLabelPositions[e]||1===d.step?"middle":"start";i.selectAll("text").text(d.formatter).style("text-anchor",n)},e.prototype._renderTickMarks=function(c,d){var e=this._tierMarkContainers[d].selectAll("."+b.Axis.TICK_MARK_CLASS).data(c);e.enter().append("line").classed(b.Axis.TICK_MARK_CLASS,!0);var f=this._generateTickMarkAttrHash(),g=this._tierHeights.slice(0,d).reduce(function(a,b){return a+b},0);"bottom"===this.orientation()?(f.y1=g,f.y2=g+("center"===this._tierLabelPositions[d]?this.innerTickLength():this._tierHeights[d])):(f.y1=this.height()-g,f.y2=this.height()-(g+("center"===this._tierLabelPositions[d]?this.innerTickLength():this._tierHeights[d]))),e.attr(f),"bottom"===this.orientation()?(f.y1=g,f.y2=g+("center"===this._tierLabelPositions[d]?this.endTickLength():this._tierHeights[d])):(f.y1=this.height()-g,f.y2=this.height()-(g+("center"===this._tierLabelPositions[d]?this.endTickLength():this._tierHeights[d]))),a.select(e[0][0]).attr(f),a.select(e[0][e.size()-1]).attr(f),a.select(e[0][0]).classed(b.Axis.END_TICK_MARK_CLASS,!0),a.select(e[0][e.size()-1]).classed(b.Axis.END_TICK_MARK_CLASS,!0),e.exit().remove()},e.prototype._renderLabellessTickMarks=function(a){var c=this._tickMarkContainer.selectAll("."+b.Axis.TICK_MARK_CLASS).data(a);c.enter().append("line").classed(b.Axis.TICK_MARK_CLASS,!0);var d=this._generateTickMarkAttrHash();d.y2="bottom"===this.orientation()?this.tickLabelPadding():this.height()-this.tickLabelPadding(),c.attr(d),c.exit().remove()},e.prototype._generateLabellessTicks=function(){return this._mostPreciseConfigIndex<1?[]:this._getTickIntervalValues(this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex-1][0])},e.prototype.renderImmediately=function(){var a=this;this._mostPreciseConfigIndex=this._getMostPreciseConfigurationIndex();var b=this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex];this._cleanTiers(),b.forEach(function(b,c){return a._renderTierLabels(a._tierLabelContainers[c],b,c)});for(var c=b.map(function(b,c){return a._getTickValuesForConfiguration(b)}),d=0,e=0;e=i&&(g=this._generateLabellessTicks()),this._renderLabellessTickMarks(g),this._hideOverflowingTiers();for(var e=0;e=b[1]?b[0]:b[1];return c===b[0]?a.ticks().filter(function(a){return a>=c&&a<=d}):a.ticks().filter(function(a){return a>=c&&a<=d}).reverse()},e.prototype._rescale=function(){if(this._isSetup){if(!this._isHorizontal()){var a=this._computeWidth();if(a>this.width()||a=f.left)return!1}else if(e.top-c<=f.bottom)return!1}return!0},e}(b.Axis);d.Numeric=e}(d=b.Axes||(b.Axes={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(d){function e(a,b){d.call(this,a,b),this._tickLabelAngle=0,this.addClass("category-axis")}return c(e,d),e.prototype._setup=function(){d.prototype._setup.call(this),this._measurer=new SVGTypewriter.Measurers.CacheCharacterMeasurer(this._tickLabelContainer),this._wrapper=new SVGTypewriter.Wrappers.Wrapper,this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper)},e.prototype._rescale=function(){return this.redraw()},e.prototype.requestedSpace=function(a,b){var c=this._isHorizontal()?0:this._maxLabelTickLength()+this.tickLabelPadding()+this.margin(),d=this._isHorizontal()?this._maxLabelTickLength()+this.tickLabelPadding()+this.margin():0;if(0===this._scale.domain().length)return{minWidth:0,minHeight:0};if(this.annotationsEnabled()){var e=this._annotationTierHeight()*this.annotationTierCount();this._isHorizontal()?d+=e:c+=e}var f=this._scale,g=this._measureTicks(a,b,f,f.domain());return{minWidth:g.usedWidth+c,minHeight:g.usedHeight+d}},e.prototype._coreSize=function(){var a=this._isHorizontal()?this.height():this.width(),b=this._isHorizontal()?this.requestedSpace(this.width(),this.height()).minHeight:this.requestedSpace(this.width(),this.height()).minWidth,c=this.margin()+this._annotationTierHeight(),d=b-c;return Math.min(d,a)},e.prototype._getTickValues=function(){return this._scale.domain()},e.prototype.tickLabelAngle=function(a){if(null==a)return this._tickLabelAngle;if(0!==a&&90!==a&&a!==-90)throw new Error("Angle "+a+" not supported; only 0, 90, and -90 are valid values");return this._tickLabelAngle=a,this.redraw(),this},e.prototype._drawTicks=function(b,c,d,e){var f,g,h=this;switch(this.tickLabelAngle()){case 0:f={left:"right",right:"left",top:"center",bottom:"center"},g={left:"center",right:"center",top:"bottom",bottom:"top"};break;case 90:f={left:"center",right:"center",top:"right",bottom:"left"},g={left:"top",right:"bottom",top:"center",bottom:"center"};break;case-90:f={left:"center",right:"center",top:"left",bottom:"right"},g={left:"bottom",right:"top",top:"center",bottom:"center"}}e.each(function(e){var i=d.stepWidth(),j=h._isHorizontal()?i:b-h._maxLabelTickLength()-h.tickLabelPadding(),k=h._isHorizontal()?c-h._maxLabelTickLength()-h.tickLabelPadding():i,l={selection:a.select(this),xAlign:f[h.orientation()],yAlign:g[h.orientation()],textRotation:h.tickLabelAngle()};h._writer.write(h.formatter()(e),j,k,l)})},e.prototype._measureTicks=function(c,d,e,f){var g=this,h=this._isHorizontal()?c:d,i=2*e.outerPadding(),j=(f.length-1)*e.innerPadding(),k=h/(i+j+f.length),l=k*(1+e.innerPadding()),m=f.map(function(a){var b=c-g._maxLabelTickLength()-g.tickLabelPadding();g._isHorizontal()&&(b=l,0!==g._tickLabelAngle&&(b=d-g._maxLabelTickLength()-g.tickLabelPadding()),b=Math.max(b,0));var e=l;return g._isHorizontal()&&(e=d-g._maxLabelTickLength()-g.tickLabelPadding(),0!==g._tickLabelAngle&&(e=c-g._maxLabelTickLength()-g.tickLabelPadding()),e=Math.max(e,0)),g._wrapper.wrap(g.formatter()(a),g._measurer,b,e)}),n=this._isHorizontal()&&0===this._tickLabelAngle?a.sum:b.Utils.Math.max,o=this._isHorizontal()&&0===this._tickLabelAngle?b.Utils.Math.max:a.sum,p=m.every(function(a){return!SVGTypewriter.Utils.StringMethods.isNotEmptyString(a.truncatedText)&&1===a.noLines}),q=n(m,function(a){return g._measurer.measure(a.wrappedText).width},0),r=o(m,function(a){return g._measurer.measure(a.wrappedText).height},0);if(0!==this._tickLabelAngle){var s=r;r=q,q=s}return{textFits:p,usedWidth:q,usedHeight:r}},e.prototype.renderImmediately=function(){var a=this;d.prototype.renderImmediately.call(this);var c=this._scale,e=this._tickLabelContainer.selectAll("."+b.Axis.TICK_LABEL_CLASS).data(this._scale.domain(),function(a){return a}),f=function(b,d){var e=c.stepWidth()-c.rangeBand(),f=c.scale(b)-c.rangeBand()/2-e/2,g=a._isHorizontal()?f:0,h=a._isHorizontal()?0:f;return"translate("+g+","+h+")"};e.enter().append("g").classed(b.Axis.TICK_LABEL_CLASS,!0),e.exit().remove(),e.attr("transform",f),e.text(""),this._drawTicks(this.width(),this.height(),c,e);var g="right"===this.orientation()?this._maxLabelTickLength()+this.tickLabelPadding():0,h="bottom"===this.orientation()?this._maxLabelTickLength()+this.tickLabelPadding():0;return b.Utils.DOM.translate(this._tickLabelContainer,g,h),this},e.prototype.computeLayout=function(a,b,c){return this._measurer.reset(),d.prototype.computeLayout.call(this,a,b,c),this._isHorizontal()||this._scale.range([0,this.height()]),this},e}(b.Axis);d.Category=e}(d=b.Axes||(b.Axes={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(b,c){void 0===b&&(b=""),void 0===c&&(c=0),a.call(this),this.addClass("label"),this.text(b),this.angle(c),this.xAlignment("center").yAlignment("center"),this._padding=0}return c(b,a),b.prototype.requestedSpace=function(a,b){var c=this._measurer.measure(this._text),d=(0===this.angle()?c.width:c.height)+2*this.padding(),e=(0===this.angle()?c.height:c.width)+2*this.padding();return{minWidth:d,minHeight:e}},b.prototype._setup=function(){a.prototype._setup.call(this),this._textContainer=this.content().append("g"),this._measurer=new SVGTypewriter.Measurers.Measurer(this._textContainer),this._wrapper=new SVGTypewriter.Wrappers.Wrapper,this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper),this.text(this._text)},b.prototype.text=function(a){if(null==a)return this._text;if("string"!=typeof a)throw new Error("Label.text() only takes strings as input");return this._text=a,this.redraw(),this},b.prototype.angle=function(a){if(null==a)return this._angle;if(a%=360,a>180?a-=360:a<-180&&(a+=360),a!==-90&&0!==a&&90!==a)throw new Error(a+" is not a valid angle for Label");return this._angle=a,this.redraw(),this},b.prototype.padding=function(a){if(null==a)return this._padding;if(a=+a,a<0)throw new Error(a+" is not a valid padding value. Cannot be less than 0.");return this._padding=a,this.redraw(),this},b.prototype.fixedWidth=function(){return!0},b.prototype.fixedHeight=function(){return!0},b.prototype.renderImmediately=function(){a.prototype.renderImmediately.call(this),this._textContainer.selectAll("g").remove();var b=this._measurer.measure(this._text),c=Math.max(Math.min((this.height()-b.height)/2,this.padding()),0),d=Math.max(Math.min((this.width()-b.width)/2,this.padding()),0);this._textContainer.attr("transform","translate("+d+","+c+")");var e=this.width()-2*d,f=this.height()-2*c,g={selection:this._textContainer,xAlign:this.xAlignment(),yAlign:this.yAlignment(),textRotation:this.angle()};return this._writer.write(this._text,e,f,g),this},b}(a.Component);b.Label=d;var e=function(a){function b(c,d){a.call(this,c,d),this.addClass(b.TITLE_LABEL_CLASS)}return c(b,a),b.TITLE_LABEL_CLASS="title-label",b}(d);b.TitleLabel=e;var f=function(a){function b(c,d){a.call(this,c,d),this.addClass(b.AXIS_LABEL_CLASS)}return c(b,a),b.AXIS_LABEL_CLASS="axis-label",b}(d);b.AxisLabel=f}(b=a.Components||(a.Components={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(d){function e(a){var c=this;if(d.call(this),this._padding=5,this.addClass("legend"),this.maxEntriesPerRow(1),null==a)throw new Error("Legend requires a colorScale");this._colorScale=a,this._redrawCallback=function(a){return c.redraw()},this._colorScale.onUpdate(this._redrawCallback),this._formatter=b.Formatters.identity(),this.xAlignment("right").yAlignment("top"),this.comparator(function(a,b){var d=c._colorScale.domain().slice().map(function(a){return c._formatter(a)});return d.indexOf(a)-d.indexOf(b)}),this._symbolFactoryAccessor=function(){return b.SymbolFactories.circle()},this._symbolOpacityAccessor=function(){return 1}}return c(e,d),e.prototype._setup=function(){d.prototype._setup.call(this);var a=this.content().append("g").classed(e.LEGEND_ROW_CLASS,!0),c=a.append("g").classed(e.LEGEND_ENTRY_CLASS,!0);c.append("text"),this._measurer=new SVGTypewriter.Measurers.Measurer(a),this._wrapper=(new SVGTypewriter.Wrappers.Wrapper).maxLines(1),this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper).addTitleElement(b.Configs.ADD_TITLE_ELEMENTS)},e.prototype.formatter=function(a){return null==a?this._formatter:(this._formatter=a,this.redraw(),this)},e.prototype.maxEntriesPerRow=function(a){return null==a?this._maxEntriesPerRow:(this._maxEntriesPerRow=a,this.redraw(),this)},e.prototype.comparator=function(a){return null==a?this._comparator:(this._comparator=a,this.redraw(),this)},e.prototype.colorScale=function(a){return null!=a?(this._colorScale.offUpdate(this._redrawCallback),this._colorScale=a,this._colorScale.onUpdate(this._redrawCallback),this.redraw(),this):this._colorScale},e.prototype.destroy=function(){d.prototype.destroy.call(this),this._colorScale.offUpdate(this._redrawCallback)},e.prototype._calculateLayoutInfo=function(b,c){var d=this,e=this._measurer.measure().height,f=Math.max(0,b-this._padding),g=this._colorScale.domain().slice().sort(function(a,b){return d._comparator(d._formatter(a),d._formatter(b))}),h=a.map(),i=a.map();g.forEach(function(a){var b=e+d._measurer.measure(d._formatter(a)).width+d._padding,c=Math.min(b,f);h.set(a,c),i.set(a,b)});var j=this._packRows(f,g,h),k=Math.floor((c-2*this._padding)/e);return k!==k&&(k=0),{textHeight:e,entryLengths:h,untruncatedEntryLengths:i,rows:j,numRowsToDraw:Math.max(Math.min(k,j.length),0)}},e.prototype.requestedSpace=function(c,d){var e=this._calculateLayoutInfo(c,d),f=e.rows.map(function(b){return a.sum(b,function(a){return e.untruncatedEntryLengths.get(a)})}),g=b.Utils.Math.max(f,0);return{minWidth:this._padding+g,minHeight:e.rows.length*e.textHeight+2*this._padding}},e.prototype._packRows=function(a,b,c){var d=this,e=[],f=[],g=a;return b.forEach(function(b){var h=c.get(b);(h>g||f.length===d._maxEntriesPerRow)&&(e.push(f),f=[],g=a),f.push(b),g-=h}),0!==f.length&&e.push(f),e},e.prototype.entitiesAt=function(b){if(!this._isSetup)return[];var c=[],d=this._calculateLayoutInfo(this.width(),this.height()),f=this._padding,g=this;return this.content().selectAll("g."+e.LEGEND_ROW_CLASS).each(function(h,i){var j=i*d.textHeight+f,k=(i+1)*d.textHeight+f,l=(j+k)/2,m=f,n=f;a.select(this).selectAll("g."+e.LEGEND_ENTRY_CLASS).each(function(e){n+=d.entryLengths.get(e);var f=m+d.textHeight/2;if(n>=b.x&&m<=b.x&&k>=b.y&&j<=b.y){var h=a.select(this),i=h.datum();c.push({datum:i,position:{x:f,y:l},selection:h,component:g})}m+=d.entryLengths.get(e)})}),c},e.prototype.renderImmediately=function(){var b=this;d.prototype.renderImmediately.call(this);var c=this._calculateLayoutInfo(this.width(),this.height()),f=c.rows.slice(0,c.numRowsToDraw),g=this.content().selectAll("g."+e.LEGEND_ROW_CLASS).data(f);g.enter().append("g").classed(e.LEGEND_ROW_CLASS,!0),g.exit().remove(),g.attr("transform",function(a,d){return"translate(0, "+(d*c.textHeight+b._padding)+")"});var h=g.selectAll("g."+e.LEGEND_ENTRY_CLASS).data(function(a){return a}),i=h.enter().append("g").classed(e.LEGEND_ENTRY_CLASS,!0);i.append("path"),i.append("g").classed("text-container",!0),h.exit().remove();var j=this._padding;g.each(function(b){var d=j,f=a.select(this).selectAll("g."+e.LEGEND_ENTRY_CLASS);f.attr("transform",function(a,b){var e="translate("+d+", 0)";return d+=c.entryLengths.get(a),e})}),h.select("path").attr("d",function(a,d,e){return b.symbol()(a,e)(.6*c.textHeight)}).attr("transform","translate("+c.textHeight/2+","+c.textHeight/2+")").attr("fill",function(a){return b._colorScale.scale(a)}).attr("opacity",function(a,c,d){return b.symbolOpacity()(a,d)}).classed(e.LEGEND_SYMBOL_CLASS,!0);var k=this._padding,l=h.select("g.text-container");l.text("");var m=this;return l.attr("transform","translate("+c.textHeight+", 0)").each(function(b){var d=a.select(this),e=c.entryLengths.get(b)-c.textHeight-k,f={selection:d,xAlign:"left",yAlign:"top",textRotation:0};m._writer.write(m._formatter(b),e,m.height(),f)}),this},e.prototype.symbol=function(a){return null==a?this._symbolFactoryAccessor:(this._symbolFactoryAccessor=a,this.render(),this)},e.prototype.symbolOpacity=function(a){return null==a?this._symbolOpacityAccessor:("number"==typeof a?this._symbolOpacityAccessor=function(){return a}:this._symbolOpacityAccessor=a,this.render(),this)},e.prototype.fixedWidth=function(){return!0},e.prototype.fixedHeight=function(){return!0},e.LEGEND_ROW_CLASS="legend-row",e.LEGEND_ENTRY_CLASS="legend-entry",e.LEGEND_SYMBOL_CLASS="legend-symbol",e}(b.Component);d.Legend=e}(d=b.Components||(b.Components={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(c){var d=this;if(b.call(this),this._textPadding=5,null==c)throw new Error("InterpolatedColorLegend requires a interpolatedColorScale");this._scale=c,this._redrawCallback=function(a){return d.redraw()},this._scale.onUpdate(this._redrawCallback),this._formatter=a.Formatters.general(),this._orientation="horizontal",this._expands=!1,this.addClass("legend"),this.addClass("interpolated-color-legend")}return c(d,b),d.prototype.destroy=function(){b.prototype.destroy.call(this),this._scale.offUpdate(this._redrawCallback)},d.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this.redraw(),this)},d.prototype.expands=function(a){return null==a?this._expands:(this._expands=a,this.redraw(),this)},d._ensureOrientation=function(a){if(a=a.toLowerCase(),"horizontal"===a||"left"===a||"right"===a)return a;throw new Error('"'+a+'" is not a valid orientation for InterpolatedColorLegend')},d.prototype.orientation=function(a){return null==a?this._orientation:(this._orientation=d._ensureOrientation(a),this.redraw(),this)},d.prototype.fixedWidth=function(){return!this.expands()||this._isVertical()},d.prototype.fixedHeight=function(){return!this.expands()||!this._isVertical()},d.prototype._generateTicks=function(a){void 0===a&&(a=d._DEFAULT_NUM_SWATCHES);var b=this._scale.domain();if(1===a)return[b[0]];for(var c=(b[1]-b[0])/(a-1),e=[],f=0;f=this._nRows||b<0||b>=this._nCols?null:this._rows[a][b]},e.prototype.add=function(a,b,c){if(null==a)throw Error("Cannot add null to a table cell");if(!this.has(a)){var d=this._rows[b]&&this._rows[b][c];if(null!=d)throw new Error("cell is occupied");a.detach(),this._nRows=Math.max(b+1,this._nRows),this._nCols=Math.max(c+1,this._nCols),this._padTableToSize(this._nRows,this._nCols),this._rows[b][c]=a,this._adoptAndAnchor(a),this.redraw()}return this},e.prototype._remove=function(a){for(var b=0;b0&&g!==A,F=h>0&&h!==B;if(!E&&!F)break;if(x>5)break}return g=n-a.sum(i.guaranteedWidths),h=o-a.sum(i.guaranteedHeights),t=e._calcProportionalSpace(q,g),u=e._calcProportionalSpace(p,h),{colProportionalSpace:t,rowProportionalSpace:u,guaranteedWidths:i.guaranteedWidths,guaranteedHeights:i.guaranteedHeights,wantsWidth:j,wantsHeight:k}},e.prototype._determineGuarantees=function(a,c,d){void 0===d&&(d=!1);var e=b.Utils.Array.createFilledArray(0,this._nCols),f=b.Utils.Array.createFilledArray(0,this._nRows),g=b.Utils.Array.createFilledArray(!1,this._nCols),h=b.Utils.Array.createFilledArray(!1,this._nRows);return this._rows.forEach(function(b,i){b.forEach(function(b,j){var k;k=null!=b?b.requestedSpace(a[j],c[i]):{minWidth:0,minHeight:0};var l=d?Math.min(k.minWidth,a[j]):k.minWidth;e[j]=Math.max(e[j],l);var m=d?Math.min(k.minHeight,c[i]):k.minHeight;f[i]=Math.max(f[i],m);var n=k.minWidth>a[j];g[j]=g[j]||n;var o=k.minHeight>c[i];h[i]=h[i]||o})}),{guaranteedWidths:e,guaranteedHeights:f,wantsWidthArr:g,wantsHeightArr:h}},e.prototype.requestedSpace=function(b,c){return this._calculatedLayout=this._iterateLayout(b,c),{minWidth:a.sum(this._calculatedLayout.guaranteedWidths),minHeight:a.sum(this._calculatedLayout.guaranteedHeights)}},e.prototype.computeLayout=function(c,e,f){var g=this;d.prototype.computeLayout.call(this,c,e,f);var h=a.sum(this._calculatedLayout.guaranteedWidths),i=a.sum(this._calculatedLayout.guaranteedHeights),j=this._calculatedLayout;(h>this.width()||i>this.height())&&(j=this._iterateLayout(this.width(),this.height(),!0));var k=0,l=b.Utils.Array.add(j.rowProportionalSpace,j.guaranteedHeights),m=b.Utils.Array.add(j.colProportionalSpace,j.guaranteedWidths);return this._rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a.computeLayout({x:c,y:k},m[d],l[b]),c+=m[d]+g._columnPadding}),k+=l[b]+g._rowPadding}),this},e.prototype.rowPadding=function(a){if(null==a)return this._rowPadding;if(!b.Utils.Math.isValidNumber(a)||a<0)throw Error("rowPadding must be a non-negative finite value");return this._rowPadding=a,this.redraw(),this},e.prototype.columnPadding=function(a){if(null==a)return this._columnPadding;if(!b.Utils.Math.isValidNumber(a)||a<0)throw Error("columnPadding must be a non-negative finite value");return this._columnPadding=a,this.redraw(),this},e.prototype.rowWeight=function(a,c){if(null==c)return this._rowWeights[a];if(!b.Utils.Math.isValidNumber(c)||c<0)throw Error("rowWeight must be a non-negative finite value");return this._rowWeights[a]=c,this.redraw(),this},e.prototype.columnWeight=function(a,c){if(null==c)return this._columnWeights[a];if(!b.Utils.Math.isValidNumber(c)||c<0)throw Error("columnWeight must be a non-negative finite value");return this._columnWeights[a]=c,this.redraw(),this},e.prototype.fixedWidth=function(){var b=a.transpose(this._rows);return e._fixedSpace(b,function(a){return null==a||a.fixedWidth()})},e.prototype.fixedHeight=function(){return e._fixedSpace(this._rows,function(a){return null==a||a.fixedHeight()})},e.prototype._padTableToSize=function(a,b){for(var c=0;cthis.width()||a.y>this.height())},e.prototype._uninstallScaleForKey=function(a,b){a.offUpdate(this._renderCallback),a.removeIncludedValuesProvider(this._includedValuesProvider)},e.prototype._installScaleForKey=function(a,b){a.onUpdate(this._renderCallback),a.addIncludedValuesProvider(this._includedValuesProvider)},e.prototype._propertyProjectors=function(){return{}},e._scaledAccessor=function(a){return null==a.scale?a.accessor:function(b,c,d){return a.scale.scale(a.accessor(b,c,d))}},e.prototype._pixelPoint=function(a,b,c){return{x:0,y:0}},e.prototype._animateOnNextRender=function(){return this._animate&&this._dataChanged},e._ANIMATION_MAX_DURATION=600,e}(b.Component);b.Plot=d}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(d){function e(){var a=this;d.call(this),this._labelFormatter=b.Formatters.identity(),this._labelsEnabled=!1,this.innerRadius(0),this.outerRadius(function(){return Math.min(a.width(),a.height())/2}),this.addClass("pie-plot"),this.attr("fill",function(a,b){return String(b)},new b.Scales.Color),this._strokeDrawers=new b.Utils.Map}return c(e,d),e.prototype._setup=function(){var a=this;d.prototype._setup.call(this),this._strokeDrawers.forEach(function(b){return b.renderArea(a._renderArea.append("g"))})},e.prototype.computeLayout=function(a,b,c){d.prototype.computeLayout.call(this,a,b,c),this._renderArea.attr("transform","translate("+this.width()/2+","+this.height()/2+")");var e=Math.min(this.width(),this.height())/2;return null!=this.innerRadius().scale&&this.innerRadius().scale.range([0,e]),null!=this.outerRadius().scale&&this.outerRadius().scale.range([0,e]),this},e.prototype.addDataset=function(a){return d.prototype.addDataset.call(this,a),this},e.prototype._addDataset=function(a){if(1===this.datasets().length)return b.Utils.Window.warn("Only one dataset is supported in Pie plots"),this;this._updatePieAngles();var c=new b.Drawers.ArcOutline(a);return this._isSetup&&c.renderArea(this._renderArea.append("g")),this._strokeDrawers.set(a,c),d.prototype._addDataset.call(this,a),this},e.prototype.removeDataset=function(a){return d.prototype.removeDataset.call(this,a),this},e.prototype._removeDatasetNodes=function(a){d.prototype._removeDatasetNodes.call(this,a),this._strokeDrawers.get(a).remove()},e.prototype._removeDataset=function(a){return d.prototype._removeDataset.call(this,a),this._startAngles=[],this._endAngles=[],this},e.prototype.selections=function(b){var c=this;void 0===b&&(b=this.datasets());var e=d.prototype.selections.call(this,b)[0];return b.forEach(function(a){var b=c._strokeDrawers.get(a);null!=b&&b.renderArea().selectAll(b.selector()).each(function(){e.push(this)})}),a.selectAll(e)},e.prototype._onDatasetUpdate=function(){d.prototype._onDatasetUpdate.call(this),this._updatePieAngles(),this.render()},e.prototype._createDrawer=function(a){return new b.Drawers.Arc(a)},e.prototype.entities=function(a){var b=this;void 0===a&&(a=this.datasets());var c=d.prototype.entities.call(this,a);return c.forEach(function(a){a.position.x+=b.width()/2,a.position.y+=b.height()/2;var c=b._strokeDrawers.get(a.dataset).selectionForIndex(a.index);a.selection[0].push(c[0][0])}),c},e.prototype.sectorValue=function(a,b){return null==a?this._propertyBindings.get(e._SECTOR_VALUE_KEY):(this._bindProperty(e._SECTOR_VALUE_KEY,a,b),this._updatePieAngles(),this.render(),this)},e.prototype.innerRadius=function(a,b){return null==a?this._propertyBindings.get(e._INNER_RADIUS_KEY):(this._bindProperty(e._INNER_RADIUS_KEY,a,b),this.render(),this)},e.prototype.outerRadius=function(a,b){return null==a?this._propertyBindings.get(e._OUTER_RADIUS_KEY):(this._bindProperty(e._OUTER_RADIUS_KEY,a,b),this.render(),this)},e.prototype.labelsEnabled=function(a){return null==a?this._labelsEnabled:(this._labelsEnabled=a,this.render(),this)},e.prototype.labelFormatter=function(a){return null==a?this._labelFormatter:(this._labelFormatter=a,this.render(),this)},e.prototype.entitiesAt=function(a){var b={x:this.width()/2,y:this.height()/2},c={x:a.x-b.x,y:a.y-b.y},d=this._sliceIndexForPoint(c);return null==d?[]:[this.entities()[d]]},e.prototype._propertyProjectors=function(){var c=this,e=d.prototype._propertyProjectors.call(this),f=b.Plot._scaledAccessor(this.innerRadius()),g=b.Plot._scaledAccessor(this.outerRadius());return e.d=function(b,d,e){return a.svg.arc().innerRadius(f(b,d,e)).outerRadius(g(b,d,e)).startAngle(c._startAngles[d]).endAngle(c._endAngles[d])(b,d)},e},e.prototype._updatePieAngles=function(){if(null!=this.sectorValue()&&0!==this.datasets().length){var c=b.Plot._scaledAccessor(this.sectorValue()),d=this.datasets()[0],e=this._getDataToDraw().get(d),f=a.layout.pie().sort(null).value(function(a,b){return c(a,b,d)})(e);this._startAngles=f.map(function(a){return a.startAngle}),this._endAngles=f.map(function(a){return a.endAngle})}},e.prototype._getDataToDraw=function(){var a=d.prototype._getDataToDraw.call(this);if(0===this.datasets().length)return a;var c=b.Plot._scaledAccessor(this.sectorValue()),f=this.datasets()[0],g=a.get(f),h=g.filter(function(a,b){return e._isValidData(c(a,b,f))});return a.set(f,h),a},e._isValidData=function(a){return b.Utils.Math.isValidNumber(a)&&a>=0},e.prototype._pixelPoint=function(c,d,f){var g=b.Plot._scaledAccessor(this.sectorValue());if(!e._isValidData(g(c,d,f)))return{x:NaN,y:NaN};var h=b.Plot._scaledAccessor(this.innerRadius())(c,d,f),i=b.Plot._scaledAccessor(this.outerRadius())(c,d,f),j=(h+i)/2,k=a.layout.pie().sort(null).value(function(a,b){var c=g(a,b,f);return e._isValidData(c)?c:0})(f.data()),l=k[d].startAngle,m=k[d].endAngle,n=(l+m)/2;return{x:j*Math.sin(n),y:-j*Math.cos(n)}},e.prototype._additionalPaint=function(a){var c=this;this._renderArea.select(".label-area").remove(),this._labelsEnabled&&b.Utils.Window.setTimeout(function(){return c._drawLabels()},a);var d=this._generateStrokeDrawSteps(),e=this._getDataToDraw();this.datasets().forEach(function(a){return c._strokeDrawers.get(a).draw(e.get(a),d)})},e.prototype._generateStrokeDrawSteps=function(){var a=this._generateAttrToProjector();return[{attrToProjector:a,animator:new b.Animators.Null}]},e.prototype._sliceIndexForPoint=function(a){var b=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2)),c=Math.acos(-a.y/b);a.x<0&&(c=2*Math.PI-c);for(var d,e=0;ec){d=e;break}if(void 0!==d){var f=this.datasets()[0],g=f.data()[d],h=this.innerRadius().accessor(g,d,f),i=this.outerRadius().accessor(g,d,f);if(b>h&&bm||y.mino)return;if(e._overlayLabel(x,y,k,d,a))return;var z=f.fill(j,k,c),A=1.6*b.Utils.Color.contrast("white",z)=p-i&&h<=q+i)l=0;else{var r=d._isVertical?m.y:m.x;l=Math.abs(h-r)}}(kd.height()?B=d.height()-A:A<0&&(B=A+r);var C=f._LABEL_VERTICAL_PADDING;k=t.height+2*C<=B,k?od.width()?E=d.width()-D:D<0&&(E=D+q);var C=f._LABEL_HORIZONTAL_PADDING;k=t.width+2*C<=E,k?od.width()||z.y+t.height>d.height();F.style("visibility",I?"hidden":"inherit");var J={selection:F,xAlign:u,yAlign:v,textRotation:0};j.write(s,x,y,J);var K=d._isVertical?qg?g:d},a},f.prototype._getBarPixelWidth=function(){if(!this._projectorsReady())return 0;var c,d=this._isVertical?this.x().scale:this.y().scale;if(d instanceof b.Scales.Category)c=d.rangeBand();else{var e=this._isVertical?this.x().accessor:this.y().accessor,g=a.set(b.Utils.Array.flatten(this.datasets().map(function(a){return a.data().map(function(b,c){return e(b,c,a)}).filter(function(a){return null!=a}).map(function(a){return a.valueOf()})}))).values().map(function(a){return+a});g.sort(function(a,b){return a-b});var h=g.map(function(a){return d.scale(a)}),i=a.pairs(h),j=this._isVertical?this.width():this.height();c=b.Utils.Math.min(i,function(a,b){return Math.abs(a[1]-a[0])},j*f._SINGLE_BAR_DIMENSION_RATIO),c*=f._BAR_WIDTH_RATIO}return c},f.prototype._updateBarPixelWidth=function(){this._barPixelWidth=this._getBarPixelWidth()},f.prototype.entities=function(a){if(void 0===a&&(a=this.datasets()),!this._projectorsReady())return[];var b=e.prototype.entities.call(this,a);return b},f.prototype._pixelPoint=function(a,c,d){var e,f,g=this._generateAttrToProjector(),h=g.x(a,c,d),i=g.y(a,c,d),j=g.width(a,c,d),k=g.height(a,c,d),l=(this._isVertical?b.Plot._scaledAccessor(this.y()):b.Plot._scaledAccessor(this.x()))(a,c,d),m=(this._isVertical?this.y().scale:this.x().scale).scale(this.baselineValue());return this._isVertical?(e=h+j/2,f=l<=m?i:i+k):(e=l>=m?h+j:h,f=i+k/2),{x:e,y:f}},f.prototype._uninstallScaleForKey=function(a,b){a.offUpdate(this._updateBarPixelWidthCallback),e.prototype._uninstallScaleForKey.call(this,a,b)},f.prototype._getDataToDraw=function(){var a=new b.Utils.Map,c=this._generateAttrToProjector();return this.datasets().forEach(function(d){var e=d.data().filter(function(a,e){return b.Utils.Math.isValidNumber(c.x(a,e,d))&&b.Utils.Math.isValidNumber(c.y(a,e,d))&&b.Utils.Math.isValidNumber(c.width(a,e,d))&&b.Utils.Math.isValidNumber(c.height(a,e,d))});a.set(d,e)}),a},f.ORIENTATION_VERTICAL="vertical",f.ORIENTATION_HORIZONTAL="horizontal",f._BAR_WIDTH_RATIO=.95,f._SINGLE_BAR_DIMENSION_RATIO=.4,f._BAR_AREA_CLASS="bar-area",f._LABEL_AREA_CLASS="bar-label-text-area",f._LABEL_VERTICAL_PADDING=5,f._LABEL_HORIZONTAL_PADDING=5,f}(b.XYPlot);d.Bar=e}(d=b.Plots||(b.Plots={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(e){function f(){e.call(this),this._interpolator="linear",this._autorangeSmooth=!1,this._croppedRenderingEnabled=!0,this._downsamplingEnabled=!1,this.addClass("line-plot");var a=new b.Animators.Easing;a.stepDuration(b.Plot._ANIMATION_MAX_DURATION),a.easingMode("exp-in-out"),a.maxTotalDuration(b.Plot._ANIMATION_MAX_DURATION),this.animator(d.Animator.MAIN,a),this.attr("stroke",(new b.Scales.Color).range()[0]),this.attr("stroke-width","2px")}return c(f,e),f.prototype.x=function(a,b){return null==a?e.prototype.x.call(this):(null==b?e.prototype.x.call(this,a):e.prototype.x.call(this,a,b),this._setScaleSnapping(),this)},f.prototype.y=function(a,b){return null==a?e.prototype.y.call(this):(e.prototype.y.call(this,a,b),this._setScaleSnapping(),this)},f.prototype.autorangeMode=function(a){return null==a?e.prototype.autorangeMode.call(this):(e.prototype.autorangeMode.call(this,a),this._setScaleSnapping(),this)},f.prototype.autorangeSmooth=function(a){return null==a?this._autorangeSmooth:(this._autorangeSmooth=a,this._setScaleSnapping(),this)},f.prototype._setScaleSnapping=function(){"x"===this.autorangeMode()&&this.x()&&this.x().scale&&this.x().scale instanceof b.QuantitativeScale&&this.x().scale.snappingDomainEnabled(!this.autorangeSmooth()),"y"===this.autorangeMode()&&this.y()&&this.y().scale&&this.y().scale instanceof b.QuantitativeScale&&this.y().scale.snappingDomainEnabled(!this.autorangeSmooth())},f.prototype.interpolator=function(a){return null==a?this._interpolator:(this._interpolator=a,this.render(),this)},f.prototype.downsamplingEnabled=function(a){return null==a?this._downsamplingEnabled:(this._downsamplingEnabled=a,this)},f.prototype.croppedRenderingEnabled=function(a){return null==a?this._croppedRenderingEnabled:(this._croppedRenderingEnabled=a,this.render(),this)},f.prototype._createDrawer=function(a){return new b.Drawers.Line(a)},f.prototype._extentsForProperty=function(b){var c=e.prototype._extentsForProperty.call(this,b);if(!this._autorangeSmooth)return c;if(this.autorangeMode()!==b)return c;if("x"!==this.autorangeMode()&&"y"!==this.autorangeMode())return c;var d,f=this._getEdgeIntersectionPoints();return d="y"===this.autorangeMode()?f.left.concat(f.right).map(function(a){return a.y}):f.top.concat(f.bottom).map(function(a){return a.x}),c.map(function(b){return a.extent(a.merge([b,d]))})},f.prototype._getEdgeIntersectionPoints=function(){var a=this;if(!(this.y().scale instanceof b.QuantitativeScale&&this.x().scale instanceof b.QuantitativeScale))return{left:[],right:[],top:[],bottom:[]};var c=this.y().scale,d=this.x().scale,e={left:[],right:[],top:[],bottom:[]},f=d.scale(d.domain()[0]),g=d.scale(d.domain()[1]),h=c.scale(c.domain()[0]),i=c.scale(c.domain()[1]);return this.datasets().forEach(function(b){for(var j,k,l,m,n,o,p,q,r=b.data(),s=1;s0&&c||0,e=this.y().scale.scale(d);return function(a,b,c){return e}},f.prototype._generateDrawSteps=function(){var a=[];if(this._animateOnNextRender()){var c=this._generateAttrToProjector();c.d=this._constructLineProjector(b.Plot._scaledAccessor(this.x()),this._getResetYFunction()),a.push({attrToProjector:c,animator:this._getAnimator(d.Animator.RESET)})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator(d.Animator.MAIN)}),a},f.prototype._generateAttrToProjector=function(){var a=e.prototype._generateAttrToProjector.call(this);return Object.keys(a).forEach(function(b){if("d"!==b){var c=a[b];a[b]=function(a,b,d){return a.length>0?c(a[0],b,d):null}}}),a},f.prototype.entitiesAt=function(a){var b=this.entityNearestByXThenY(a);return null!=b?[b]:[]},f.prototype.entityNearestByXThenY=function(a){var b,c=this,d=1/0,e=1/0;return this.entities().forEach(function(f){if(c._entityVisibleOnPlot(f.position,f.datum,f.index,f.dataset)){var g=Math.abs(a.x-f.position.x),h=Math.abs(a.y-f.position.y);(gs&&(s=u,r=c[i]),u0},d.prototype._lineIntersectsSegment=function(a,b,c,d){var e=function(a,b,c){return(b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x)};return e(a,b,c)*e(a,b,d)<0},d._X2_KEY="x2",d._Y2_KEY="y2",d}(a.XYPlot);b.Segment=d}(b=a.Plots||(a.Plots={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(){b.call(this),this._connectorsEnabled=!1,this.addClass("waterfall-plot")}return c(d,b),d.prototype.connectorsEnabled=function(a){return null==a?this._connectorsEnabled:(this._connectorsEnabled=a,this)},d.prototype.total=function(a){return null==a?this._propertyBindings.get(d._TOTAL_KEY):(this._bindProperty(d._TOTAL_KEY,a,null),this)},d.prototype._additionalPaint=function(b){var c=this;this._connectorArea.selectAll("line").remove(),this._connectorsEnabled&&a.Utils.Window.setTimeout(function(){return c._drawConnectors()},b)},d.prototype._createNodesForDataset=function(a){var c=b.prototype._createNodesForDataset.call(this,a);return this._connectorArea=this._renderArea.append("g").classed(d._CONNECTOR_AREA_CLASS,!0),c},d.prototype._extentsForProperty=function(a){var c="y";return a===c?[this._extent]:b.prototype._extentsForProperty.call(this,a)},d.prototype._generateAttrToProjector=function(){var c=this,e=b.prototype._generateAttrToProjector.call(this),f=this.y().scale,g=a.Plot._scaledAccessor(this.total()),h=this.attr("y");null==h&&(e.y=function(a,b,d){var e=c.y().accessor(a,b,d),h=g(a,b,d);if(h)return Math.min(f.scale(e),f.scale(0));var i=c._subtotals[b];if(0===b)return e<0?f.scale(i-e):f.scale(i);var j=c._subtotals[b-1];return i>j?f.scale(i):f.scale(j)});var i=this.attr("height");return null==i&&(e.height=function(a,b,d){var e=g(a,b,d),h=c.y().accessor(a,b,d);if(e)return Math.abs(f.scale(h)-f.scale(0));var i=c._subtotals[b];if(0===b)return Math.abs(f.scale(i)-f.scale(i-h));var j=c._subtotals[b-1];return Math.abs(f.scale(i)-f.scale(j))}),e["class"]=function(a,b,e){var f="";null!=c.attr("class")&&(f=c.attr("class").accessor(a,b,e)+" ");var h=g(a,b,e);if(h)return f+d._BAR_TOTAL_CLASS;var i=c.y().accessor(a,b,e);return f+(i>0?d._BAR_GROWTH_CLASS:d._BAR_DECLINE_CLASS)},e},d.prototype._onDatasetUpdate=function(){return this._updateSubtotals(),b.prototype._onDatasetUpdate.call(this),this},d.prototype._calculateSubtotalsAndExtent=function(a){var b=this,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=0,f=!1;a.data().forEach(function(g,h){var i=b.y().accessor(g,h,a),j=b.total().accessor(g,h,a);if(j&&0!==h||(e+=i),b._subtotals.push(e),ed&&(d=e),j&&(id&&(d=i)),!f&&j){for(var k=i-e,l=0;l0&&this._subtotals[c]>this._subtotals[e]||this._subtotals[c]<0&&this._subtotals[c]>=this._subtotals[e])&&(j=a.y(f,c,b)+a.height(f,c,b)),this._connectorArea.append("line").classed(d._CONNECTOR_CLASS,!0).attr("x1",h).attr("x2",i).attr("y1",j).attr("y2",j)}},d.prototype._updateSubtotals=function(){var a=this.datasets();if(a.length>0){var b=a[a.length-1];this._subtotals=new Array,this._calculateSubtotalsAndExtent(b)}},d._BAR_DECLINE_CLASS="waterfall-decline",d._BAR_GROWTH_CLASS="waterfall-growth",d._BAR_TOTAL_CLASS="waterfall-total",d._CONNECTOR_CLASS="connector",d._CONNECTOR_AREA_CLASS="connector-area",d._TOTAL_KEY="total",d}(b.Bar);b.Waterfall=d}(b=a.Plots||(a.Plots={}))}(b||(b={}));var b;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.totalTime=function(a){return 0},a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(b=a.Animators||(a.Animators={}))}(b||(b={}));var b;!function(a){var b;!function(a){var b=function(){function a(){this._startDelay=a._DEFAULT_START_DELAY_MILLISECONDS,this._stepDuration=a._DEFAULT_STEP_DURATION_MILLISECONDS,this._stepDelay=a._DEFAULT_ITERATIVE_DELAY_MILLISECONDS,this._maxTotalDuration=a._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS,this._easingMode=a._DEFAULT_EASING_MODE}return a.prototype.totalTime=function(a){var b=this._getAdjustedIterativeDelay(a);return this.startDelay()+b*Math.max(a-1,0)+this.stepDuration()},a.prototype.animate=function(a,b){var c=this,d=a[0].length,e=this._getAdjustedIterativeDelay(d);return a.transition().ease(this.easingMode()).duration(this.stepDuration()).delay(function(a,b){return c.startDelay()+e*b}).attr(b)},a.prototype.startDelay=function(a){return null==a?this._startDelay:(this._startDelay=a,this)},a.prototype.stepDuration=function(a){return null==a?Math.min(this._stepDuration,this._maxTotalDuration):(this._stepDuration=a,this)},a.prototype.stepDelay=function(a){return null==a?this._stepDelay:(this._stepDelay=a,this)},a.prototype.maxTotalDuration=function(a){return null==a?this._maxTotalDuration:(this._maxTotalDuration=a,this)},a.prototype.easingMode=function(a){return null==a?this._easingMode:(this._easingMode=a,this)},a.prototype._getAdjustedIterativeDelay=function(a){var b=this.maxTotalDuration()-this.stepDuration();b=Math.max(b,0);var c=b/Math.max(a-1,1);return Math.min(this.stepDelay(),c)},a._DEFAULT_START_DELAY_MILLISECONDS=0,a._DEFAULT_STEP_DURATION_MILLISECONDS=300,a._DEFAULT_ITERATIVE_DELAY_MILLISECONDS=15,a._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS=1/0,a._DEFAULT_EASING_MODE="exp-out",a}();a.Easing=b}(b=a.Animators||(a.Animators={}))}(b||(b={}));var b;!function(a){var b=function(){function b(){this._eventToProcessingFunction={},this._eventNameToCallbackSet={},this._connected=!1}return b.prototype._hasNoCallbacks=function(){for(var a=Object.keys(this._eventNameToCallbackSet),b=0;b0&&this._callCallbacksForEvent(b,f,e,a)}},d.prototype.eventInsideSVG=function(a){return this._translator.insideSVG(a)},d._DISPATCHER_KEY="__Plottable_Dispatcher_Touch",d._TOUCHSTART_EVENT_NAME="touchstart",d._TOUCHMOVE_EVENT_NAME="touchmove",d._TOUCHEND_EVENT_NAME="touchend",d._TOUCHCANCEL_EVENT_NAME="touchcancel",d}(a.Dispatcher);b.Touch=d}(b=a.Dispatchers||(a.Dispatchers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(a){function b(){var c=this;a.call(this),this._eventToProcessingFunction[b._KEYDOWN_EVENT_NAME]=function(a){return c._processKeydown(a)},this._eventToProcessingFunction[b._KEYUP_EVENT_NAME]=function(a){return c._processKeyup(a)}}return c(b,a),b.getDispatcher=function(){var a=document[b._DISPATCHER_KEY];return null==a&&(a=new b,document[b._DISPATCHER_KEY]=a),a},b.prototype._processKeydown=function(a){this._callCallbacksForEvent(b._KEYDOWN_EVENT_NAME,a.keyCode,a)},b.prototype._processKeyup=function(a){this._callCallbacksForEvent(b._KEYUP_EVENT_NAME,a.keyCode,a)},b.prototype.onKeyDown=function(a){return this._addCallbackForEvent(b._KEYDOWN_EVENT_NAME,a),this},b.prototype.offKeyDown=function(a){return this._removeCallbackForEvent(b._KEYDOWN_EVENT_NAME,a),this},b.prototype.onKeyUp=function(a){return this._addCallbackForEvent(b._KEYUP_EVENT_NAME,a),this},b.prototype.offKeyUp=function(a){return this._removeCallbackForEvent(b._KEYUP_EVENT_NAME,a),this},b._DISPATCHER_KEY="__Plottable_Dispatcher_Key",b._KEYDOWN_EVENT_NAME="keydown",b._KEYUP_EVENT_NAME="keyup",b}(a.Dispatcher);b.Key=d}(b=a.Dispatchers||(a.Dispatchers={}))}(b||(b={}));var b;!function(a){var b=function(){function a(){var a=this;this._anchorCallback=function(b){return a._anchor(b)},this._enabled=!0}return a.prototype._anchor=function(a){this._isAnchored=!0},a.prototype._unanchor=function(){this._isAnchored=!1},a.prototype.attachTo=function(a){return this._disconnect(),this._componentAttachedTo=a,this._connect(),this},a.prototype._connect=function(){this.enabled()&&null!=this._componentAttachedTo&&!this._isAnchored&&this._componentAttachedTo.onAnchor(this._anchorCallback)},a.prototype.detachFrom=function(a){return this._disconnect(),this._componentAttachedTo=null,this},a.prototype._disconnect=function(){this._isAnchored&&this._unanchor(),null!=this._componentAttachedTo&&this._componentAttachedTo.offAnchor(this._anchorCallback)},a.prototype.enabled=function(a){return null==a?this._enabled:(this._enabled=a,this._enabled?this._connect():this._disconnect(),this)},a.prototype._translateToComponentSpace=function(a){var b=this._componentAttachedTo.originToSVG();return{x:a.x-b.x,y:a.y-b.y}},a.prototype._isInsideComponent=function(a){return 0<=a.x&&0<=a.y&&a.x<=this._componentAttachedTo.width()&&a.y<=this._componentAttachedTo.height()},a}();a.Interaction=b}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(){var c=this;b.apply(this,arguments),this._clickedDown=!1,this._onClickCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a){return c._handleClickDown(a)},this._mouseUpCallback=function(a){return c._handleClickUp(a)},this._touchStartCallback=function(a,b){return c._handleClickDown(b[a[0]])},this._touchEndCallback=function(a,b){return c._handleClickUp(b[a[0]])},this._touchCancelCallback=function(a,b){return c._clickedDown=!1}}return c(d,b),d.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(c.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(c.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},d.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback),this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null},d.prototype._handleClickDown=function(a){var b=this._translateToComponentSpace(a);this._isInsideComponent(b)&&(this._clickedDown=!0)},d.prototype._handleClickUp=function(a){var b=this._translateToComponentSpace(a);this._clickedDown&&this._isInsideComponent(b)&&this._onClickCallbacks.callCallbacks(b),this._clickedDown=!1},d.prototype.onClick=function(a){return this._onClickCallbacks.add(a),this},d.prototype.offClick=function(a){return this._onClickCallbacks["delete"](a),this},d}(a.Interaction);b.Click=d}(b=a.Interactions||(a.Interactions={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d;!function(a){a[a.NotClicked=0]="NotClicked",a[a.SingleClicked=1]="SingleClicked",a[a.DoubleClicked=2]="DoubleClicked"}(d||(d={}));var e=function(b){function e(){var c=this;b.apply(this,arguments),this._clickState=d.NotClicked,this._clickedDown=!1,this._onDoubleClickCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a){return c._handleClickDown(a)},this._mouseUpCallback=function(a){return c._handleClickUp(a)},this._dblClickCallback=function(a){return c._handleDblClick()},this._touchStartCallback=function(a,b){return c._handleClickDown(b[a[0]])},this._touchEndCallback=function(a,b){return c._handleClickUp(b[a[0]])},this._touchCancelCallback=function(a,b){return c._handleClickCancel()}}return c(e,b),e.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(c.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._mouseDispatcher.onDblClick(this._dblClickCallback), -this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(c.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},e.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback),this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher.offDblClick(this._dblClickCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null},e.prototype._handleClickDown=function(a){var b=this._translateToComponentSpace(a);this._isInsideComponent(b)&&(this._clickState===d.SingleClicked&&e._pointsEqual(b,this._clickedPoint)||(this._clickState=d.NotClicked),this._clickedPoint=b,this._clickedDown=!0)},e.prototype._handleClickUp=function(a){var b=this._translateToComponentSpace(a);this._clickedDown&&e._pointsEqual(b,this._clickedPoint)?this._clickState=this._clickState===d.NotClicked?d.SingleClicked:d.DoubleClicked:this._clickState=d.NotClicked,this._clickedDown=!1},e.prototype._handleDblClick=function(){this._clickState===d.DoubleClicked&&(this._onDoubleClickCallbacks.callCallbacks(this._clickedPoint),this._clickState=d.NotClicked)},e.prototype._handleClickCancel=function(){this._clickState=d.NotClicked,this._clickedDown=!1},e._pointsEqual=function(a,b){return a.x===b.x&&a.y===b.y},e.prototype.onDoubleClick=function(a){return this._onDoubleClickCallbacks.add(a),this},e.prototype.offDoubleClick=function(a){return this._onDoubleClickCallbacks["delete"](a),this},e}(a.Interaction);b.DoubleClick=e}(b=a.Interactions||(a.Interactions={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(){var c=this;b.apply(this,arguments),this._keyPressCallbacks={},this._keyReleaseCallbacks={},this._mouseMoveCallback=function(a){return!1},this._downedKeys=new a.Utils.Set,this._keyDownCallback=function(a,b){return c._handleKeyDownEvent(a,b)},this._keyUpCallback=function(a){return c._handleKeyUpEvent(a)}}return c(d,b),d.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._positionDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo._element.node()),this._positionDispatcher.onMouseMove(this._mouseMoveCallback),this._keyDispatcher=a.Dispatchers.Key.getDispatcher(),this._keyDispatcher.onKeyDown(this._keyDownCallback),this._keyDispatcher.onKeyUp(this._keyUpCallback)},d.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._positionDispatcher.offMouseMove(this._mouseMoveCallback),this._positionDispatcher=null,this._keyDispatcher.offKeyDown(this._keyDownCallback),this._keyDispatcher.offKeyUp(this._keyUpCallback),this._keyDispatcher=null},d.prototype._handleKeyDownEvent=function(a,b){var c=this._translateToComponentSpace(this._positionDispatcher.lastMousePosition());this._isInsideComponent(c)&&!b.repeat&&(this._keyPressCallbacks[a]&&this._keyPressCallbacks[a].callCallbacks(a),this._downedKeys.add(a))},d.prototype._handleKeyUpEvent=function(a){this._downedKeys.has(a)&&this._keyReleaseCallbacks[a]&&this._keyReleaseCallbacks[a].callCallbacks(a),this._downedKeys["delete"](a)},d.prototype.onKeyPress=function(b,c){return this._keyPressCallbacks[b]||(this._keyPressCallbacks[b]=new a.Utils.CallbackSet),this._keyPressCallbacks[b].add(c),this},d.prototype.offKeyPress=function(a,b){return this._keyPressCallbacks[a]["delete"](b),0===this._keyPressCallbacks[a].size&&delete this._keyPressCallbacks[a],this},d.prototype.onKeyRelease=function(b,c){return this._keyReleaseCallbacks[b]||(this._keyReleaseCallbacks[b]=new a.Utils.CallbackSet),this._keyReleaseCallbacks[b].add(c),this},d.prototype.offKeyRelease=function(a,b){return this._keyReleaseCallbacks[a]["delete"](b),0===this._keyReleaseCallbacks[a].size&&delete this._keyReleaseCallbacks[a],this},d}(a.Interaction);b.Key=d}(b=a.Interactions||(a.Interactions={}))}(b||(b={}));var b;!function(a){var b;!function(b){var d=function(b){function d(){var c=this;b.apply(this,arguments),this._overComponent=!1,this._pointerEnterCallbacks=new a.Utils.CallbackSet,this._pointerMoveCallbacks=new a.Utils.CallbackSet,this._pointerExitCallbacks=new a.Utils.CallbackSet,this._mouseMoveCallback=function(a,b){return c._handleMouseEvent(a,b)},this._touchStartCallback=function(a,b,d){return c._handleTouchEvent(b[a[0]],d)}}return c(d,b),d.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onMouseMove(this._mouseMoveCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback)},d.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._mouseDispatcher.offMouseMove(this._mouseMoveCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher=null},d.prototype._handleMouseEvent=function(a,b){var c=this._mouseDispatcher.eventInsideSVG(b);this._handlePointerEvent(a,c)},d.prototype._handleTouchEvent=function(a,b){var c=this._touchDispatcher.eventInsideSVG(b);this._handlePointerEvent(a,c)},d.prototype._handlePointerEvent=function(a,b){var c=this._translateToComponentSpace(a),d=this._isInsideComponent(c);d&&b?(this._overComponent||this._pointerEnterCallbacks.callCallbacks(c),this._pointerMoveCallbacks.callCallbacks(c)):this._overComponent&&this._pointerExitCallbacks.callCallbacks(c),this._overComponent=d&&b},d.prototype.onPointerEnter=function(a){return this._pointerEnterCallbacks.add(a),this},d.prototype.offPointerEnter=function(a){return this._pointerEnterCallbacks["delete"](a),this},d.prototype.onPointerMove=function(a){return this._pointerMoveCallbacks.add(a),this},d.prototype.offPointerMove=function(a){return this._pointerMoveCallbacks["delete"](a),this},d.prototype.onPointerExit=function(a){return this._pointerExitCallbacks.add(a),this},d.prototype.offPointerExit=function(a){return this._pointerExitCallbacks["delete"](a),this},d}(a.Interaction);b.Pointer=d}(b=a.Interactions||(a.Interactions={}))}(b||(b={}));var b;!function(b){var d;!function(d){var e=function(e){function f(c,f){var g=this;e.call(this),this._wheelCallback=function(a,b){return g._handleWheelEvent(a,b)},this._touchStartCallback=function(a,b,c){return g._handleTouchStart(a,b,c)},this._touchMoveCallback=function(a,b,c){return g._handlePinch(a,b,c)},this._touchEndCallback=function(a,b,c){return g._handleTouchEnd(a,b,c)},this._touchCancelCallback=function(a,b,c){return g._handleTouchEnd(a,b,c)},this._panEndCallbacks=new b.Utils.CallbackSet,this._zoomEndCallbacks=new b.Utils.CallbackSet,this._xScales=new b.Utils.Set,this._yScales=new b.Utils.Set,this._dragInteraction=new d.Drag,this._setupDragInteraction(),this._touchIds=a.map(),this._minDomainExtents=new b.Utils.Map,this._maxDomainExtents=new b.Utils.Map,this._minDomainValues=new b.Utils.Map,this._maxDomainValues=new b.Utils.Map,null!=c&&this.addXScale(c),null!=f&&this.addYScale(f)}return c(f,e),f.prototype._anchor=function(a){e.prototype._anchor.call(this,a),this._dragInteraction.attachTo(a),this._mouseDispatcher=b.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onWheel(this._wheelCallback),this._touchDispatcher=b.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchMove(this._touchMoveCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},f.prototype._unanchor=function(){e.prototype._unanchor.call(this),this._mouseDispatcher.offWheel(this._wheelCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchMove(this._touchMoveCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null,this._dragInteraction.detachFrom(this._componentAttachedTo)},f.prototype._handleTouchStart=function(a,b,c){for(var d=0;d0&&this._zoomEndCallbacks.callCallbacks()},f.prototype._magnifyScale=function(a,b,c){var d=this,e=function(e){return a.invert(d._zoomAt(e,b,c))};a.domain(a.range().map(e))},f.prototype._translateScale=function(a,b){var c=function(c){return a.invert(c+b)};a.domain(a.range().map(c))},f.prototype._handleWheelEvent=function(a,b){var c=this,d=this._translateToComponentSpace(a);if(this._isInsideComponent(d)){b.preventDefault();var e=b.deltaY*(b.deltaMode?f._PIXELS_PER_LINE:1),g=Math.pow(2,.002*e),h=d.x,i=d.y;this.xScales().forEach(function(a){var b=c._constrainedZoom(a,g,h);h=b.centerPoint,g=b.zoomAmount}),this.yScales().forEach(function(a){var b=c._constrainedZoom(a,g,i);i=b.centerPoint,g=b.zoomAmount}),this.xScales().forEach(function(a){c._magnifyScale(a,g,h)}),this.yScales().forEach(function(a){c._magnifyScale(a,g,i)}),this._zoomEndCallbacks.callCallbacks()}},f.prototype._constrainedZoom=function(a,b,c){return b=this._constrainZoomExtents(a,b),this._constrainZoomValues(a,b,c)},f.prototype._constrainZoomExtents=function(a,b){var c=b>1,d=c?this.maxDomainExtent(a):this.minDomainExtent(a);if(null==d)return b;var e=a.domain(),f=Math.abs(e[1]-e[0]),g=c?Math.min:Math.max;return g(b,d/f)},f.prototype._constrainZoomValues=function(a,b,c){if(b<=1)return{centerPoint:c,zoomAmount:b};var d=this.minDomainValue(a),e=this.maxDomainValue(a);if(null==d&&null==e)return{centerPoint:c,zoomAmount:b};var f=a.domain(),g=f[0],h=f[1];if(null!=e){var i=a.scale(e),j=a.scale(h),k=this._zoomAt(j,b,c);k>i&&(c=this._getZoomCenterForTarget(j,b,i))}if(null!=d){var l=a.scale(d),m=a.scale(g),n=this._zoomAt(m,b,c);ni||n=2)){var e=(null==b?c.x:b.x)-d.x;a.xScales().forEach(function(b){a._translateScale(b,a._constrainedTranslation(b,e))});var f=(null==b?c.y:b.y)-d.y;a.yScales().forEach(function(b){a._translateScale(b,a._constrainedTranslation(b,f))}),b=d}}),this._dragInteraction.onDragEnd(function(){return a._panEndCallbacks.callCallbacks()})},f.prototype._constrainedTranslation=function(a,b){var c=a.domain(),d=c[0],e=c[1];if(b>0){var f=this.maxDomainValue(a);if(null!=f){var g=a.scale(e),h=a.scale(f);b=Math.min(g+b,h)-g}}else{var f=this.minDomainValue(a);if(null!=f){var i=a.scale(d),j=a.scale(f);b=Math.max(i+b,j)-i}}return b},f.prototype._nonLinearScaleWithExtents=function(a){return!(null==this.minDomainExtent(a)||null==this.maxDomainExtent(a)||a instanceof b.Scales.Linear||a instanceof b.Scales.Time)},f.prototype.xScales=function(a){var c=this;if(null==a){var d=[];return this._xScales.forEach(function(a){d.push(a)}),d}return this._xScales=new b.Utils.Set,a.forEach(function(a){c.addXScale(a)}),this},f.prototype.yScales=function(a){var c=this;if(null==a){var d=[];return this._yScales.forEach(function(a){d.push(a)}),d}return this._yScales=new b.Utils.Set,a.forEach(function(a){c.addYScale(a)}),this},f.prototype.addXScale=function(a){return this._xScales.add(a),this},f.prototype.removeXScale=function(a){return this._xScales["delete"](a),this._minDomainExtents["delete"](a),this._maxDomainExtents["delete"](a),this._minDomainValues["delete"](a),this._maxDomainValues["delete"](a),this},f.prototype.addYScale=function(a){return this._yScales.add(a),this},f.prototype.removeYScale=function(a){return this._yScales["delete"](a),this._minDomainExtents["delete"](a),this._maxDomainExtents["delete"](a),this._minDomainValues["delete"](a),this._maxDomainValues["delete"](a),this},f.prototype.minDomainExtent=function(a,c){if(null==c)return this._minDomainExtents.get(a);if(c.valueOf()<0)throw new Error("extent must be non-negative");var d=this.maxDomainExtent(a);if(null!=d&&d.valueOf()0&&"\n"===b[0]?"\n":"";if(c<=g){var i=g/3,j=Math.floor(c/i);return{wrappedToken:h+"...".substr(0,j),remainingToken:b}}for(;f+g>c;)e=a.Utils.StringMethods.trimEnd(e.substr(0,e.length-1)),f=d.measure(e).width;return{wrappedToken:h+e+"...",remainingToken:a.Utils.StringMethods.trimEnd(b.substring(e.length),"-").trim()}},b.prototype.wrapNextToken=function(b,c,d){if(!c.canFitText||c.availableLines===c.wrapping.noLines||!this.canFitToken(b,c.availableWidth,d))return this.finishWrapping(b,c,d);for(var e=b;e;){var f=this.breakTokenToFitInWidth(e,c.currentLine,c.availableWidth,d);if(c.currentLine=f.line,e=f.remainingToken,null!=e){if(c.wrapping.noBrokeWords+=+f.breakWord,++c.wrapping.noLines,c.availableLines===c.wrapping.noLines){var g=this.addEllipsis(c.currentLine,c.availableWidth,d);return c.wrapping.wrappedText+=g.wrappedToken,c.wrapping.truncatedText+=g.remainingToken+e,c.currentLine="\n",c}c.wrapping.wrappedText+=a.Utils.StringMethods.trimEnd(c.currentLine),c.currentLine="\n"}}return c},b.prototype.finishWrapping=function(a,b,c){if(b.canFitText&&b.availableLines!==b.wrapping.noLines&&this._allowBreakingWords&&"none"!==this._textTrimming){var d=this.addEllipsis(b.currentLine+a,b.availableWidth,c);b.wrapping.wrappedText+=d.wrappedToken,b.wrapping.truncatedText+=d.remainingToken,b.wrapping.noBrokeWords+=+(d.remainingToken.length0),b.currentLine=""}else b.wrapping.truncatedText+=a;return b.canFitText=!1,b},b.prototype.breakTokenToFitInWidth=function(a,b,c,d,e){if(void 0===e&&(e=this._breakingCharacter),d.measure(b+a).width<=c)return{remainingToken:null,line:b+a,breakWord:!1};if(""===a.trim())return{remainingToken:"",line:b,breakWord:!1};if(!this._allowBreakingWords)return{remainingToken:a,line:b,breakWord:!1};for(var f=0;f0&&(g=e),{remainingToken:a.substring(f),line:b+a.substring(0,f)+g,breakWord:f>0}},b}();b.Wrapper=c}(b=a.Wrappers||(a.Wrappers={}))}(b||(b={}));var b,c=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(a){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return c(b,a),b.prototype.wrap=function(c,d,e,f){var g=this;void 0===f&&(f=1/0);var h=c.split("\n");if(h.length>1)throw new Error("SingleLineWrapper is designed to work only on single line");var i=function(b){return a.prototype.wrap.call(g,c,d,b,f)},j=i(e);if(j.noLines<2)return j;for(var k=0,l=e,m=0;mk;++m){var n=(l+k)/2,o=i(n);this.areSameResults(j,o)?(l=n,j=o):k=n}return j},b.prototype.areSameResults=function(a,b){return a.noLines===b.noLines&&a.truncatedText===b.truncatedText},b.NO_WRAP_ITERATIONS=5,b}(a.Wrapper);a.SingleLineWrapper=b}(b=a.Wrappers||(a.Wrappers={}))}(b||(b={}));var b;!function(b){var c;!function(c){var d=function(){function c(a,b){this._writerID=c.nextID++,this._elementID=0,this.measurer(a),b&&this.wrapper(b),this.addTitleElement(!1)}return c.prototype.measurer=function(a){return this._measurer=a,this},c.prototype.wrapper=function(a){return this._wrapper=a,this},c.prototype.addTitleElement=function(a){return this._addTitleElement=a,this},c.prototype.writeLine=function(a,d,e,f,g){var h=d.append("text");h.text(a);var i=e*c.XOffsetFactor[f],j=c.AnchorConverter[f];h.attr("text-anchor",j).classed("text-line",!0),b.Utils.DOM.transform(h,i,g).attr("y","-0.25em")},c.prototype.writeText=function(a,b,d,e,f,g){var h=this,i=a.split("\n"),j=this._measurer.measure().height,k=c.YOffsetFactor[g]*(e-i.length*j);i.forEach(function(a,c){h.writeLine(a,b,d,f,(c+1)*j+k)})},c.prototype.write=function(b,d,e,f){if(c.SupportedRotation.indexOf(f.textRotation)===-1)throw new Error("unsupported rotation - "+f.textRotation);var g=Math.abs(Math.abs(f.textRotation)-90)>45,h=g?d:e,i=g?e:d,j=f.selection.append("g").classed("text-container",!0);this._addTitleElement&&j.append("title").text(b);var k=j.append("g").classed("text-area",!0),l=this._wrapper?this._wrapper.wrap(b,this._measurer,h,i).wrappedText:b;this.writeText(l,k,h,i,f.xAlign,f.yAlign);var m=a.transform(""),n=a.transform("");switch(m.rotate=f.textRotation,f.textRotation){case 90:m.translate=[d,0],n.rotate=-90,n.translate=[0,200];break;case-90:m.translate=[0,e],n.rotate=90,n.translate=[d,0];break;case 180:m.translate=[d,e],n.translate=[d,e],n.rotate=180}k.attr("transform",m.toString()),this.addClipPath(j,n),f.animator&&f.animator.animate(j)},c.prototype.addClipPath=function(a,c){var d=this._elementID++,e=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;e=e.split("#")[0];var f="clipPath"+this._writerID+"_"+d;a.select(".text-area").attr("clip-path",'url("'+e+"#"+f+'")');var g=a.append("clipPath").attr("id",f),h=b.Utils.DOM.getBBox(a.select(".text-area")),i=g.append("rect");i.classed("clip-rect",!0).attr({x:h.x,y:h.y,width:h.width,height:h.height})},c.nextID=0,c.SupportedRotation=[-90,0,180,90],c.AnchorConverter={left:"start",center:"middle",right:"end"},c.XOffsetFactor={left:0,center:.5,right:1},c.YOffsetFactor={top:0,center:.5,bottom:1},c}();c.Writer=d}(c=b.Writers||(b.Writers={}))}(b||(b={}));var b;!function(a){var b;!function(b){var c=function(){function b(a,b){this.textMeasurer=this.getTextMeasurer(a,b)}return b.prototype.checkSelectionIsText=function(a){return"text"===a[0][0].tagName||!a.select("text").empty()},b.prototype.getTextMeasurer=function(a,b){var c=this;if(this.checkSelectionIsText(a)){var d,e=a.node().parentNode;return d="text"===a[0][0].tagName?a:a.select("text"),a.remove(),function(b){e.appendChild(a.node());var f=c.measureBBox(d,b);return a.remove(),f}}var f=a.append("text");return b&&f.classed(b,!0),f.remove(),function(b){a.node().appendChild(f.node());var d=c.measureBBox(f,b);return f.remove(),d}},b.prototype.measureBBox=function(b,c){b.text(c);var d=a.Utils.DOM.getBBox(b);return{width:d.width,height:d.height}},b.prototype.measure=function(a){return void 0===a&&(a=b.HEIGHT_TEXT),this.textMeasurer(a)},b.HEIGHT_TEXT="bqpdl",b}();b.AbstractMeasurer=c}(b=a.Measurers||(a.Measurers={}))}(b||(b={}));var b,c=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(b){var d;!function(b){var d=function(d){function e(a,b,c){void 0===b&&(b=null),void 0===c&&(c=!1),d.call(this,a,b),this.useGuards=c}return c(e,d),e.prototype._addGuards=function(a){return b.AbstractMeasurer.HEIGHT_TEXT+a+b.AbstractMeasurer.HEIGHT_TEXT},e.prototype.getGuardWidth=function(){return null==this.guardWidth&&(this.guardWidth=d.prototype.measure.call(this).width),this.guardWidth},e.prototype._measureLine=function(a){var b=this.useGuards?this._addGuards(a):a,c=d.prototype.measure.call(this,b);return c.width-=this.useGuards?2*this.getGuardWidth():0,c},e.prototype.measure=function(c){var d=this;if(void 0===c&&(c=b.AbstractMeasurer.HEIGHT_TEXT),""===c.trim())return{width:0,height:0};var e=c.trim().split("\n").map(function(a){return d._measureLine(a)});return{width:a.max(e,function(a){return a.width}),height:a.sum(e,function(a){return a.height})}},e}(b.AbstractMeasurer);b.Measurer=d}(d=b.Measurers||(b.Measurers={}))}(b||(b={}));var b,c=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(b){var d;!function(b){var d=function(b){function d(){b.apply(this,arguments)}return c(d,b),d.prototype._measureCharacter=function(a){return b.prototype._measureLine.call(this,a)},d.prototype._measureLine=function(b){var c=this,d=b.split("").map(function(a){return c._measureCharacter(a)});return{width:a.sum(d,function(a){return a.width}),height:a.max(d,function(a){return a.height})}},d}(b.Measurer);b.CharacterMeasurer=d}(d=b.Measurers||(b.Measurers={}))}(b||(b={}));var b,c=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};return function(a){var b;!function(b){var d=function(b){function d(c,d){var e=this;b.call(this,c,d),this.cache=new a.Utils.Cache(function(a){return e._measureCharacterNotFromCache(a)},a.Utils.Methods.objEq)}return c(d,b),d.prototype._measureCharacterNotFromCache=function(a){return b.prototype._measureCharacter.call(this,a)},d.prototype._measureCharacter=function(a){return this.cache.get(a)},d.prototype.reset=function(){this.cache.clear()},d}(b.CharacterMeasurer);b.CacheCharacterMeasurer=d}(b=a.Measurers||(a.Measurers={}))}(b||(b={})),b}),b}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define(["d3","svg-typewriter"],function(c,d){return a.Plottable=b(c,d)}):"object"==typeof exports?module.exports=b(require("d3"),require("svg-typewriter")):a.Plottable=b(a.d3,a.SVGTypewriter)}(this,function(a,b){var c,d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(b){var c;!function(c){var d;!function(c){function d(a,b,c){return m.min(b,c)<=a&&a<=m.max(b,c)}function e(a,b,c){return m.min(m.max(b,a),c)}function f(b,c,d){var e="function"==typeof c?c:null,f=null==e?c:d,g=null==e?a.max(b):a.max(b,e);return void 0!==g?g:f}function g(b,c,d){var e="function"==typeof c?c:null,f=null==e?c:d,g=null==e?a.min(b):a.min(b,e);return void 0!==g?g:f}function h(a){return a!==a}function i(a){return"number"==typeof a&&!b.Utils.Math.isNaN(a)&&isFinite(a)}function j(a,b,c){if(void 0===c&&(c=1),0===c)throw new Error("step cannot be 0");for(var d=m.max(m.ceil((b-a)/c),0),e=[],f=0;f=o.floor(b.right))&&(!(o.floor(a.bottom)<=o.ceil(b.top))&&!(o.ceil(a.top)>=o.floor(b.bottom))))}function i(a,b){return o.floor(b.left)<=o.ceil(a.left)&&o.floor(b.top)<=o.ceil(a.top)&&o.floor(a.right)<=o.ceil(b.right)&&o.floor(a.bottom)<=o.ceil(b.bottom)}function j(a){var b=a.ownerSVGElement;return null!=b?b:"svg"===a.nodeName.toLowerCase()?a:null}function k(){return"plottableClipPath"+ ++p}function l(a,b,c,d){void 0===d&&(d=.5);var e=m(a),f=m(b);return c.x+c.width>=e.min-d&&c.x<=e.max+d&&c.y+c.height>=f.min-d&&c.y<=f.max+d}function m(a){if("number"==typeof a){var b=a;return{min:b,max:b}}var c=a;if(c instanceof Object&&"min"in c&&"max"in c)return c;throw new Error("input '"+a+"' can't be parsed as an Range")}function n(a,b){var c=a.getPropertyValue(b),d=parseFloat(c);return d||0}var o=window.Math;b.elementBBox=c,b.SCREEN_REFRESH_RATE_MILLISECONDS=1e3/60,b.requestAnimationFramePolyfill=d,b.elementWidth=e,b.elementHeight=f,b.translate=g,b.clientRectsOverlap=h,b.clientRectInside=i,b.boundingSVG=j;var p=0;b.generateUniqueClipPathId=k,b.intersectsBBox=l}(c=b.DOM||(b.DOM={}))}(c=b.Utils||(b.Utils={}))}(c||(c={}));var c;!function(b){var c;!function(b){var c;!function(b){function c(a,b){var c=f(a)+.05,d=f(b)+.05;return c>d?c/d:d/c}function d(b,c){var d=a.hsl(b).brighter(c);return d.rgb().toString()}function e(a,b){a.classed(b,!0);var c=a.style("background-color");if("transparent"===c)return null;var d=/\((.+)\)/.exec(c)[1].split(",").map(function(a){var b=+a,c=b.toString(16);return b<16?"0"+c:c});if(4===d.length&&"00"===d[3])return null;var e="#"+d.join("");return a.classed(b,!1),e}function f(b){var c=a.rgb(b),d=function(a){return a/=255,a<=.03928?a/12.92:g.pow((a+.055)/1.055,2.4)},e=d(c.r),f=d(c.g),h=d(c.b);return.2126*e+.7152*f+.0722*h}var g=window.Math;b.contrast=c,b.lightenColor=d,b.colorTest=e}(c=b.Color||(b.Color={}))}(c=b.Utils||(b.Utils={}))}(c||(c={}));var c;!function(b){var c;!function(b){var c;!function(b){function c(a,b){if(a.length!==b.length)throw new Error("attempted to add arrays of unequal length");return a.map(function(c,d){return a[d]+b[d]})}function d(b){var c=a.set(),d=[];return b.forEach(function(a){c.has(String(a))||(c.add(String(a)),d.push(a))}),d}function e(a){return g.prototype.concat.apply([],a)}function f(a,b){for(var c=[],d=0;d=0?g:h;m.has(k)?(j=m.get(k),m.set(k,j+l)):(j=0,m.set(k,l)),c.set(k,{value:l,offset:j})}),i.set(a,c)}),i}function e(a,c,d){var e=[];a.forEach(function(a,b){b.data().forEach(function(g,h){if(null==d||d(g,h,b)){var i=a.get(f(c(g,h,b)));e.push(i.value+i.offset)}})});var h=b.Math.max(e,0),i=b.Math.min(e,0);return[g.min(i,0),g.max(0,h)]}function f(a){return String(a)}var g=window.Math;c.stack=d,c.stackedExtent=e,c.normalizeKey=f}(c=b.Stacking||(b.Stacking={}))}(c=b.Utils||(b.Utils={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c;!function(c){function d(b){a.Configs.SHOW_WARNINGS&&null!=window.console&&(null!=window.console.warn?console.warn(b):null!=window.console.log&&console.log(b))}function e(a,b){for(var c=[],d=2;d=f)&&0!==b)return d(a);for(var h=-1;b>=Math.pow(1e3,h+2)&&h0&&"1000"===i.substr(0,4)||a<0&&"-1000"===i.substr(0,5))&&(h20)throw new RangeError("Formatter precision must be between 0 and 20");if(a!==Math.floor(a))throw new RangeError("Formatter precision must be an integer")}b.currency=c,b.fixed=d,b.general=e,b.identity=f,b.percentage=g,b.siSuffix=h,b.shortScale=i,b.multiTime=j,b.time=k}(c=b.Formatters||(b.Formatters={}))}(c||(c={}));var c;!function(b){var c;!function(b){function c(){return function(b){return a.svg.symbol().type("circle").size(Math.PI*Math.pow(b/2,2))(null)}}function d(){return function(b){return a.svg.symbol().type("square").size(Math.pow(b,2))(null)}}function e(){return function(b){return a.svg.symbol().type("cross").size(5/9*Math.pow(b,2))(null)}}function f(){return function(b){return a.svg.symbol().type("diamond").size(Math.tan(Math.PI/6)*Math.pow(b,2)/2)(null)}}function g(){return function(b){return a.svg.symbol().type("triangle-up").size(Math.sqrt(3)*Math.pow(b/2,2))(null)}}function h(){return function(b){return a.svg.symbol().type("triangle-down").size(Math.sqrt(3)*Math.pow(b/2,2))(null)}}b.circle=c,b.square=d,b.cross=e,b.diamond=f,b.triangleUp=g,b.triangleDown=h}(c=b.SymbolFactories||(b.SymbolFactories={}))}(c||(c={}));var c;!function(a){var b=function(){function b(){this._autoDomainAutomatically=!0,this._domainModificationInProgress=!1,this._callbacks=new a.Utils.CallbackSet,this._includedValuesProviders=new a.Utils.Set}return b.prototype.extentOfValues=function(a){return[]},b.prototype._getAllIncludedValues=function(){var a=this,b=[];return this._includedValuesProviders.forEach(function(c){var d=c(a);b=b.concat(d)}),b},b.prototype._getExtent=function(){return[]},b.prototype.onUpdate=function(a){return this._callbacks.add(a),this},b.prototype.offUpdate=function(a){return this._callbacks["delete"](a),this},b.prototype._dispatchUpdate=function(){this._callbacks.callCallbacks(this)},b.prototype.autoDomain=function(){return this._autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},b.prototype._autoDomainIfAutomaticMode=function(){this._autoDomainAutomatically&&this.autoDomain()},b.prototype.scale=function(a){throw new Error("Subclasses should override scale")},b.prototype.domain=function(a){return null==a?this._getDomain():(this._autoDomainAutomatically=!1,this._setDomain(a),this)},b.prototype._getDomain=function(){throw new Error("Subclasses should override _getDomain")},b.prototype._setDomain=function(a){this._domainModificationInProgress||(this._domainModificationInProgress=!0,this._backingScaleDomain(a),this._dispatchUpdate(),this._domainModificationInProgress=!1)},b.prototype._backingScaleDomain=function(a){throw new Error("Subclasses should override _backingDomain")},b.prototype.range=function(a){return null==a?this._getRange():(this._setRange(a),this)},b.prototype._getRange=function(){throw new Error("Subclasses should override _getRange")},b.prototype._setRange=function(a){throw new Error("Subclasses should override _setRange")},b.prototype.addIncludedValuesProvider=function(a){return this._includedValuesProviders.add(a),this._autoDomainIfAutomaticMode(),this},b.prototype.removeIncludedValuesProvider=function(a){return this._includedValuesProviders["delete"](a),this._autoDomainIfAutomaticMode(),this},b}();a.Scale=b}(c||(c={}));var c;!function(b){var c=function(c){function e(){c.call(this),this._tickGenerator=function(a){return a.defaultTicks()},this._padProportion=.05,this._snappingDomainEnabled=!0,this._paddingExceptionsProviders=new b.Utils.Set}return d(e,c),e.prototype.autoDomain=function(){return this._domainMin=null,this._domainMax=null,c.prototype.autoDomain.call(this),this},e.prototype._autoDomainIfAutomaticMode=function(){if(null!=this._domainMin&&null!=this._domainMax)return void this._setDomain([this._domainMin,this._domainMax]);var a=this._getExtent();if(null!=this._domainMin){var b=a[1];return this._domainMin>=b&&(b=this._expandSingleValueDomain([this._domainMin,this._domainMin])[1]),void this._setDomain([this._domainMin,b])}if(null!=this._domainMax){var d=a[0];return this._domainMax<=d&&(d=this._expandSingleValueDomain([this._domainMax,this._domainMax])[0]),void this._setDomain([d,this._domainMax])}c.prototype._autoDomainIfAutomaticMode.call(this)},e.prototype._getExtent=function(){var a=this._getAllIncludedValues(),c=this._defaultExtent();if(0!==a.length){var d=[b.Utils.Math.min(a,c[0]),b.Utils.Math.max(a,c[1])];c=this._padDomain(d)}return null!=this._domainMin&&(c[0]=this._domainMin),null!=this._domainMax&&(c[1]=this._domainMax),c},e.prototype.addPaddingExceptionsProvider=function(a){return this._paddingExceptionsProviders.add(a),this._autoDomainIfAutomaticMode(),this},e.prototype.removePaddingExceptionsProvider=function(a){return this._paddingExceptionsProviders["delete"](a),this._autoDomainIfAutomaticMode(),this},e.prototype.padProportion=function(a){if(null==a)return this._padProportion;if(a<0)throw new Error("padProportion must be non-negative");return this._padProportion=a,this._autoDomainIfAutomaticMode(),this},e.prototype._padDomain=function(a){var b=this;if(a[0].valueOf()===a[1].valueOf())return this._expandSingleValueDomain(a);if(0===this._padProportion)return a;var c=this._padProportion/2,d=a[0],e=a[1],f=!1,g=!1;this._paddingExceptionsProviders.forEach(function(a){var c=a(b);c.forEach(function(a){a.valueOf()===d.valueOf()&&(f=!0),a.valueOf()===e.valueOf()&&(g=!0)})});var h=this._backingScaleDomain();this._backingScaleDomain(a);var i=f?d:this.invert(this.scale(d)-(this.scale(e)-this.scale(d))*c),j=g?e:this.invert(this.scale(e)+(this.scale(e)-this.scale(d))*c);return this._backingScaleDomain(h),this._snappingDomainEnabled?this._niceDomain([i,j]):[i,j]},e.prototype.snappingDomainEnabled=function(a){return null==a?this._snappingDomainEnabled:(this._snappingDomainEnabled=a,this._autoDomainIfAutomaticMode(),this)},e.prototype._expandSingleValueDomain=function(a){return a},e.prototype.invert=function(a){throw new Error("Subclasses should override invert")},e.prototype.domain=function(a){return null!=a&&(this._domainMin=a[0],this._domainMax=a[1]),c.prototype.domain.call(this,a)},e.prototype.domainMin=function(a){return null==a?this.domain()[0]:(this._domainMin=a,this._autoDomainIfAutomaticMode(),this)},e.prototype.domainMax=function(a){return null==a?this.domain()[1]:(this._domainMax=a,this._autoDomainIfAutomaticMode(),this)},e.prototype.extentOfValues=function(c){var d=a.extent(c.filter(function(a){return b.Utils.Math.isValidNumber(+a)}));return null==d[0]||null==d[1]?[]:d},e.prototype._setDomain=function(a){var d=function(a){return b.Utils.Math.isNaN(a)||a===1/0||a===-(1/0)};return d(a[0])||d(a[1])?void b.Utils.Window.warn("Warning: QuantitativeScales cannot take NaN or Infinity as a domain value. Ignoring."):void c.prototype._setDomain.call(this,a)},e.prototype.defaultTicks=function(){throw new Error("Subclasses should override _getDefaultTicks")},e.prototype.ticks=function(){return this._tickGenerator(this)},e.prototype._niceDomain=function(a,b){throw new Error("Subclasses should override _niceDomain")},e.prototype._defaultExtent=function(){throw new Error("Subclasses should override _defaultExtent")},e.prototype.tickGenerator=function(a){return null==a?this._tickGenerator:(this._tickGenerator=a,this)},e._DEFAULT_NUM_TICKS=10,e}(b.Scale);b.QuantitativeScale=c}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(b){function e(){b.call(this),this._d3Scale=a.scale.linear()}return d(e,b),e.prototype._defaultExtent=function(){return[0,1]},e.prototype._expandSingleValueDomain=function(a){return a[0]===a[1]?[a[0]-1,a[1]+1]:a},e.prototype.scale=function(a){return this._d3Scale(a)},e.prototype._getDomain=function(){return this._backingScaleDomain()},e.prototype._backingScaleDomain=function(a){return null==a?this._d3Scale.domain():(this._d3Scale.domain(a),this)},e.prototype._getRange=function(){return this._d3Scale.range()},e.prototype._setRange=function(a){this._d3Scale.range(a)},e.prototype.invert=function(a){return this._d3Scale.invert(a)},e.prototype.defaultTicks=function(){return this._d3Scale.ticks(c.Linear._DEFAULT_NUM_TICKS)},e.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},e}(b.QuantitativeScale);c.Linear=e}(c=b.Scales||(b.Scales={}))}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(e){function f(b){if(void 0===b&&(b=10),e.call(this),this._d3Scale=a.scale.linear(),this._base=b,this._pivot=this._base,this._setDomain(this._defaultExtent()),b<=1)throw new Error("ModifiedLogScale: The base must be > 1")}return d(f,e),f.prototype._adjustedLog=function(a){var b=a<0?-1:1;return a*=b,a0?[b/this._base,b*this._base]:0===b?[-this._base,this._base]:[b*this._base,b/this._base]}return a},f.prototype._getRange=function(){return this._d3Scale.range()},f.prototype._setRange=function(a){this._d3Scale.range(a)},f.prototype.defaultTicks=function(){return this._d3Scale.ticks(c.ModifiedLog._DEFAULT_NUM_TICKS)},f}(b.QuantitativeScale);c.ModifiedLog=e}(c=b.Scales||(b.Scales={}))}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(c){function e(){c.call(this),this._range=[0,1],this._d3Scale=a.scale.ordinal();var b=.3;this._innerPadding=e._convertToPlottableInnerPadding(b),this._outerPadding=e._convertToPlottableOuterPadding(.5,b)}return d(e,c),e.prototype.extentOfValues=function(a){return b.Utils.Array.uniq(a)},e.prototype._getExtent=function(){return b.Utils.Array.uniq(this._getAllIncludedValues())},e.prototype.domain=function(a){return c.prototype.domain.call(this,a)},e.prototype.range=function(a){return c.prototype.range.call(this,a)},e._convertToPlottableInnerPadding=function(a){return 1/(1-a)-1},e._convertToPlottableOuterPadding=function(a,b){return a/(1-b)},e.prototype._setBands=function(){var a=1-1/(1+this.innerPadding()),b=this.outerPadding()/(1+this.innerPadding());this._d3Scale.rangeBands(this._range,a,b)},e.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},e.prototype.stepWidth=function(){return this.rangeBand()*(1+this.innerPadding())},e.prototype.innerPadding=function(a){return null==a?this._innerPadding:(this._innerPadding=a,this.range(this.range()),this._dispatchUpdate(),this)},e.prototype.outerPadding=function(a){return null==a?this._outerPadding:(this._outerPadding=a,this.range(this.range()),this._dispatchUpdate(),this)},e.prototype.scale=function(a){return this._d3Scale(a)+this.rangeBand()/2},e.prototype._getDomain=function(){return this._backingScaleDomain()},e.prototype._backingScaleDomain=function(a){return null==a?this._d3Scale.domain():(this._d3Scale.domain(a),this._setBands(),this)},e.prototype._getRange=function(){return this._range},e.prototype._setRange=function(a){this._range=a,this._setBands()},e}(b.Scale);c.Category=e}(c=b.Scales||(b.Scales={}))}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(c){function e(b){c.call(this);var d;switch(b){case null:case void 0:null==e._plottableColorCache&&(e._plottableColorCache=e._getPlottableColors()),d=a.scale.ordinal().range(e._plottableColorCache);break;case"Category10":case"category10":case"10":d=a.scale.category10();break;case"Category20":case"category20":case"20":d=a.scale.category20();break;case"Category20b":case"category20b":case"20b":d=a.scale.category20b();break;case"Category20c":case"category20c":case"20c":d=a.scale.category20c();break;default:throw new Error("Unsupported ColorScale type")}this._d3Scale=d}return d(e,c),e.prototype.extentOfValues=function(a){return b.Utils.Array.uniq(a)},e.prototype._getExtent=function(){return b.Utils.Array.uniq(this._getAllIncludedValues())},e.invalidateColorCache=function(){e._plottableColorCache=null},e._getPlottableColors=function(){for(var c=[],d=a.select("body").append("plottable-color-tester"),e=b.Utils.Color.colorTest(d,""),f=0,g=b.Utils.Color.colorTest(d,"plottable-colors-0");null!=g&&f0&&this._setDomain([b.Utils.Math.min(a,0),b.Utils.Math.max(a,0)]),this},e.prototype.scale=function(a){return this._d3Scale(a)},e.prototype._getDomain=function(){return this._backingScaleDomain()},e.prototype._backingScaleDomain=function(a){return null==a?this._d3Scale.domain():(this._d3Scale.domain(a),this)},e.prototype._getRange=function(){return this._colorRange},e.prototype._setRange=function(a){this._colorRange=a,this._resetScale()},e.REDS=["#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],e.BLUES=["#FFFFFF","#CCFFFF","#A5FFFD","#85F7FB","#6ED3EF","#55A7E0","#417FD0","#2545D3","#0B02E1"],e.POSNEG=["#0B02E1","#2545D3","#417FD0","#55A7E0","#6ED3EF","#85F7FB","#A5FFFD","#CCFFFF","#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],e}(b.Scale);c.InterpolatedColor=e}(c=b.Scales||(b.Scales={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c;!function(b){function c(b){if(b<=0)throw new Error("interval must be positive number");return function(c){var d=c.domain(),e=Math.min(d[0],d[1]),f=Math.max(d[0],d[1]),g=Math.ceil(e/b)*b,h=Math.floor((f-g)/b)+1,i=e%b===0?[]:[e],j=a.Utils.Math.range(0,h).map(function(a){return g+a*b}),k=f%b===0?[]:[f];return i.concat(j).concat(k)}}function d(){return function(a){var b=a.defaultTicks();return b.filter(function(a,c){return a%1===0||0===c||c===b.length-1})}}b.intervalTickGenerator=c,b.integerTickGenerator=d}(c=b.TickGenerators||(b.TickGenerators={}))}(b=a.Scales||(a.Scales={}))}(c||(c={}));var c;!function(b){var c=function(){function c(a){this._cachedSelectionValid=!1,this._dataset=a}return c.prototype.renderArea=function(a){return null==a?this._renderArea:(this._renderArea=a,this._cachedSelectionValid=!1,this)},c.prototype.remove=function(){null!=this.renderArea()&&this.renderArea().remove()},c.prototype._bindSelectionData=function(a){var b=this.selection().data(a);b.enter().append(this._svgElementName),b.exit().remove(),this._applyDefaultAttributes(b)},c.prototype._applyDefaultAttributes=function(a){null!=this._className&&a.classed(this._className,!0)},c.prototype._drawStep=function(a){var b=this.selection(),c=["fill","stroke"];c.forEach(function(c){null!=a.attrToAppliedProjector[c]&&b.attr(c,a.attrToAppliedProjector[c])}),a.animator.animate(b,a.attrToAppliedProjector),null!=this._className&&this.selection().classed(this._className,!0)},c.prototype._appliedProjectors=function(a){var b=this,c={};return Object.keys(a).forEach(function(d){c[d]=function(c,e){return a[d](c,e,b._dataset)}}),c},c.prototype.totalDrawTime=function(a,b){var c=0;return b.forEach(function(b,d){c+=b.animator.totalTime(a.length)}),c},c.prototype.draw=function(a,c){var d=this,e=c.map(function(a){var b=d._appliedProjectors(a.attrToProjector);return{attrToAppliedProjector:b,animator:a.animator}});this._bindSelectionData(a),this._cachedSelectionValid=!1;var f=0;return e.forEach(function(c,e){b.Utils.Window.setTimeout(function(){return d._drawStep(c)},f),f+=c.animator.totalTime(a.length)}),this},c.prototype.selection=function(){return this._cachedSelectionValid||(this._cachedSelection=this.renderArea().selectAll(this.selector()),this._cachedSelectionValid=!0),this._cachedSelection},c.prototype.selector=function(){return this._svgElementName},c.prototype.selectionForIndex=function(b){return a.select(this.selection()[0][b])},c}();b.Drawer=c}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(b){function c(a){b.call(this,a),this._className="line",this._svgElementName="path"}return d(c,b),c.prototype._applyDefaultAttributes=function(a){b.prototype._applyDefaultAttributes.call(this,a),a.style("fill","none")},c.prototype.selectionForIndex=function(b){return a.select(this.selection()[0][0])},c}(b.Drawer);c.Line=e}(c=b.Drawers||(b.Drawers={}))}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(b){function c(a){b.call(this,a),this._className="area",this._svgElementName="path"}return d(c,b),c.prototype._applyDefaultAttributes=function(a){b.prototype._applyDefaultAttributes.call(this,a),a.style("stroke","none")},c.prototype.selectionForIndex=function(b){return a.select(this.selection()[0][0])},c}(b.Drawer);c.Area=e}(c=b.Drawers||(b.Drawers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(a){function b(b){a.call(this,b),this._svgElementName="rect"}return d(b,a),b}(a.Drawer);b.Rectangle=c}(b=a.Drawers||(a.Drawers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(a){function b(b){a.call(this,b),this._className="arc fill",this._svgElementName="path"}return d(b,a),b.prototype._applyDefaultAttributes=function(b){a.prototype._applyDefaultAttributes.call(this,b),b.style("stroke","none")},b}(a.Drawer);b.Arc=c}(b=a.Drawers||(a.Drawers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(a){function b(b){a.call(this,b),this._className="arc outline",this._svgElementName="path"}return d(b,a),b.prototype._applyDefaultAttributes=function(b){a.prototype._applyDefaultAttributes.call(this,b),b.style("fill","none")},b}(a.Drawer);b.ArcOutline=c}(b=a.Drawers||(a.Drawers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(a){function b(b){a.call(this,b),this._svgElementName="path",this._className="symbol"}return d(b,a),b}(a.Drawer);b.Symbol=c}(b=a.Drawers||(a.Drawers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(a){function b(b){a.call(this,b),this._svgElementName="line"}return d(b,a),b}(a.Drawer);b.Segment=c}(b=a.Drawers||(a.Drawers={}))}(c||(c={}));var c;!function(b){var c;!function(a){var b=function(){function a(){}return a.TOP="top",a.BOTTOM="bottom",a.LEFT="left",a.RIGHT="right",a.CENTER="center",a}();a.Alignment=b}(c=b.Components||(b.Components={}));var d=function(){function c(){this._clipPathEnabled=!1,this._origin={x:0,y:0},this._xAlignment="left",this._yAlignment="top",this._isSetup=!1,this._isAnchored=!1,this._boxes=[],this._isTopLevelComponent=!1,this._cssClasses=new b.Utils.Set,this._destroyed=!1,this._onAnchorCallbacks=new b.Utils.CallbackSet,this._onDetachCallbacks=new b.Utils.CallbackSet,this._cssClasses.add("component")}return c.prototype.anchor=function(a){if(this._destroyed)throw new Error("Can't reuse destroy()-ed Components!");if(this._isTopLevelComponent="svg"===a.node().nodeName.toLowerCase(),this._isTopLevelComponent){this._rootSVG=a,this._rootSVG.classed("plottable",!0),this._rootSVG.style("overflow","visible");var b=this._rootSVG.select("."+c._SAFARI_EVENT_BACKING_CLASS);b.empty()&&this._rootSVG.append("rect").classed(c._SAFARI_EVENT_BACKING_CLASS,!0).attr({x:0,y:0,width:"100%",height:"100%"}).style("opacity",0)}return null!=this._element?a.node().appendChild(this._element.node()):(this._element=a.append("g"),this._setup()),this._isAnchored=!0,this._onAnchorCallbacks.callCallbacks(this),this},c.prototype.onAnchor=function(a){return this._isAnchored&&a(this),this._onAnchorCallbacks.add(a),this},c.prototype.offAnchor=function(a){return this._onAnchorCallbacks["delete"](a),this},c.prototype._setup=function(){var a=this;this._isSetup||(this._cssClasses.forEach(function(b){a._element.classed(b,!0)}),this._cssClasses=new b.Utils.Set,this._backgroundContainer=this._element.append("g").classed("background-container",!0),this._addBox("background-fill",this._backgroundContainer),this._content=this._element.append("g").classed("content",!0),this._foregroundContainer=this._element.append("g").classed("foreground-container",!0),this._boxContainer=this._element.append("g").classed("box-container",!0),this._clipPathEnabled&&this._generateClipPath(),this._boundingBox=this._addBox("bounding-box"),this._isSetup=!0)},c.prototype.requestedSpace=function(a,b){return{minWidth:0,minHeight:0}},c.prototype.computeLayout=function(a,d,e){var f=this;if(null==a||null==d||null==e){if(null==this._element)throw new Error("anchor() must be called before computeLayout()");if(!this._isTopLevelComponent)throw new Error("null arguments cannot be passed to computeLayout() on a non-root node");a={x:0,y:0},null==this._rootSVG.attr("width")&&this._rootSVG.attr("width","100%"),null==this._rootSVG.attr("height")&&this._rootSVG.attr("height","100%");var g=this._rootSVG.node();d=b.Utils.DOM.elementWidth(g),e=b.Utils.DOM.elementHeight(g)}var h=this._sizeFromOffer(d,e);this._width=h.width,this._height=h.height;var i=c._xAlignToProportion[this._xAlignment],j=c._yAlignToProportion[this._yAlignment];return this._origin={x:a.x+(d-this.width())*i,y:a.y+(e-this.height())*j},this._element.attr("transform","translate("+this._origin.x+","+this._origin.y+")"),this._boxes.forEach(function(a){return a.attr("width",f.width()).attr("height",f.height())}),this},c.prototype._sizeFromOffer=function(a,b){var c=this.requestedSpace(a,b);return{width:this.fixedWidth()?Math.min(a,c.minWidth):a,height:this.fixedHeight()?Math.min(b,c.minHeight):b}},c.prototype.render=function(){return this._isAnchored&&this._isSetup&&this.width()>=0&&this.height()>=0&&b.RenderController.registerToRender(this),this},c.prototype._scheduleComputeLayout=function(){this._isAnchored&&this._isSetup&&b.RenderController.registerToComputeLayout(this)},c.prototype.renderImmediately=function(){return this._clipPathEnabled&&this._updateClipPath(),this},c.prototype.redraw=function(){return this._isAnchored&&this._isSetup&&(this._isTopLevelComponent?this._scheduleComputeLayout():this.parent().redraw()),this},c.prototype.renderTo=function(c){if(this.detach(),null!=c){var d=void 0;if(d="string"==typeof c?a.select(c):c instanceof Element?a.select(c):c,!d.node()||"svg"!==d.node().nodeName.toLowerCase())throw new Error("Plottable requires a valid SVG to renderTo");this.anchor(d)}if(null==this._element)throw new Error("If a Component has never been rendered before, then renderTo must be given a node to render to, or a d3.Selection, or a selector string");return this.computeLayout(),this.render(),b.RenderController.flush(),this},c.prototype.xAlignment=function(a){if(null==a)return this._xAlignment;if(a=a.toLowerCase(),null==c._xAlignToProportion[a])throw new Error("Unsupported alignment: "+a);return this._xAlignment=a,this.redraw(),this},c.prototype.yAlignment=function(a){if(null==a)return this._yAlignment;if(a=a.toLowerCase(),null==c._yAlignToProportion[a])throw new Error("Unsupported alignment: "+a);return this._yAlignment=a,this.redraw(),this},c.prototype._addBox=function(a,b){if(null==this._element)throw new Error("Adding boxes before anchoring is currently disallowed");b=null==b?this._boxContainer:b;var c=b.append("rect");return null!=a&&c.classed(a,!0),this._boxes.push(c),null!=this.width()&&null!=this.height()&&c.attr("width",this.width()).attr("height",this.height()),c},c.prototype._generateClipPath=function(){this._clipPathID=b.Utils.DOM.generateUniqueClipPathId();var a=this._boxContainer.append("clipPath").attr("id",this._clipPathID);this._addBox("clip-rect",a),this._updateClipPath()},c.prototype._updateClipPath=function(){var a=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;a=a.split("#")[0],this._element.attr("clip-path",'url("'+a+"#"+this._clipPathID+'")')},c.prototype.hasClass=function(a){return null!=a&&(null==this._element?this._cssClasses.has(a):this._element.classed(a))},c.prototype.addClass=function(a){return null==a?this:(null==this._element?this._cssClasses.add(a):this._element.classed(a,!0),this)},c.prototype.removeClass=function(a){return null==a?this:(null==this._element?this._cssClasses["delete"](a):this._element.classed(a,!1),this)},c.prototype.fixedWidth=function(){return!1},c.prototype.fixedHeight=function(){return!1},c.prototype.detach=function(){return this.parent(null),this._isAnchored&&(this._element.remove(),this._isTopLevelComponent&&this._rootSVG.select("."+c._SAFARI_EVENT_BACKING_CLASS).remove()),this._isAnchored=!1,this._onDetachCallbacks.callCallbacks(this),this},c.prototype.onDetach=function(a){return this._onDetachCallbacks.add(a),this},c.prototype.offDetach=function(a){return this._onDetachCallbacks["delete"](a),this},c.prototype.parent=function(a){if(void 0===a)return this._parent;if(null!==a&&!a.has(this))throw new Error("Passed invalid parent");return this._parent=a,this},c.prototype.destroy=function(){this._destroyed=!0,this.detach()},c.prototype.width=function(){return this._width},c.prototype.height=function(){return this._height},c.prototype.origin=function(){return{x:this._origin.x,y:this._origin.y}},c.prototype.originToSVG=function(){for(var a=this.origin(),b=this.parent();null!=b;){var c=b.origin();a.x+=c.x,a.y+=c.y,b=b.parent()}return a},c.prototype.foreground=function(){return this._foregroundContainer},c.prototype.content=function(){return this._content},c.prototype.background=function(){return this._backgroundContainer},c._xAlignToProportion={left:0,center:.5,right:1},c._yAlignToProportion={top:0,center:.5,bottom:1},c._SAFARI_EVENT_BACKING_CLASS="safari-event-backing",c}();b.Component=d}(c||(c={}));var c;!function(a){var b=function(a){function b(){var b=this;a.call(this),this._detachCallback=function(a){return b.remove(a)}}return d(b,a),b.prototype.anchor=function(b){var c=this;return a.prototype.anchor.call(this,b),this._forEach(function(a){return a.anchor(c.content())}),this},b.prototype.render=function(){return this._forEach(function(a){return a.render()}),this},b.prototype.has=function(a){throw new Error("has() is not implemented on ComponentContainer")},b.prototype._adoptAndAnchor=function(a){a.parent(this),a.onDetach(this._detachCallback),this._isAnchored&&a.anchor(this.content())},b.prototype.remove=function(a){return this.has(a)&&(a.offDetach(this._detachCallback),this._remove(a),a.detach(),this.redraw()),this},b.prototype._remove=function(a){return!1},b.prototype._forEach=function(a){throw new Error("_forEach() is not implemented on ComponentContainer")},b.prototype.destroy=function(){a.prototype.destroy.call(this),this._forEach(function(a){return a.destroy()})},b}(a.Component);a.ComponentContainer=b}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(b){function c(a){var c=this;void 0===a&&(a=[]),b.call(this),this._components=[],this.addClass("component-group"),a.forEach(function(a){return c.append(a)})}return d(c,b),c.prototype._forEach=function(a){this.components().forEach(a)},c.prototype.has=function(a){return this._components.indexOf(a)>=0},c.prototype.requestedSpace=function(b,c){var d=this._components.map(function(a){return a.requestedSpace(b,c)});return{minWidth:a.Utils.Math.max(d,function(a){return a.minWidth},0),minHeight:a.Utils.Math.max(d,function(a){return a.minHeight},0)}},c.prototype.computeLayout=function(a,c,d){var e=this;return b.prototype.computeLayout.call(this,a,c,d),this._forEach(function(a){a.computeLayout({x:0,y:0},e.width(),e.height())}),this},c.prototype._sizeFromOffer=function(a,b){return{width:a,height:b}},c.prototype.fixedWidth=function(){return this._components.every(function(a){return a.fixedWidth()})},c.prototype.fixedHeight=function(){return this._components.every(function(a){return a.fixedHeight()})},c.prototype.components=function(){return this._components.slice()},c.prototype.append=function(a){return null==a||this.has(a)||(a.detach(),this._components.push(a),this._adoptAndAnchor(a),this.redraw()),this},c.prototype._remove=function(a){var b=this._components.indexOf(a);return b>=0&&(this._components.splice(b,1),!0)},c}(a.ComponentContainer);b.Group=c}(b=a.Components||(a.Components={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments)}return d(c,b),c.prototype.entityNearest=function(b){var c,d=1/0;return this.components().forEach(function(e){var f=e.entityNearest(b);if(null!=f){var g=a.Utils.Math.distanceSquared(f.position,b);g<=d&&(d=g,c=f)}}),c},c.prototype.append=function(c){if(null!=c&&!(c instanceof a.Plot))throw new Error("Plot Group only accepts plots");return b.prototype.append.call(this,c),this},c}(b.Group);b.PlotGroup=c}(b=a.Components||(a.Components={}))}(c||(c={}));var c;!function(c){var e=function(e){function f(a,b){var d=this;if(e.call(this),this._endTickLength=5,this._innerTickLength=5,this._tickLabelPadding=10,this._margin=15,this._showEndTickLabels=!1,this._annotationsEnabled=!1,this._annotationTierCount=1,null==a||null==b)throw new Error("Axis requires a scale and orientation");this._scale=a,this.orientation(b),this._setDefaultAlignment(),this.addClass("axis"),this._isHorizontal()?this.addClass("x-axis"):this.addClass("y-axis"),this.formatter(c.Formatters.identity()),this._rescaleCallback=function(a){return d._rescale()},this._scale.onUpdate(this._rescaleCallback),this._annotatedTicks=[],this._annotationFormatter=c.Formatters.identity()}return d(f,e),f.prototype.destroy=function(){e.prototype.destroy.call(this),this._scale.offUpdate(this._rescaleCallback)},f.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},f.prototype._computeWidth=function(){return this._maxLabelTickLength()},f.prototype._computeHeight=function(){return this._maxLabelTickLength()},f.prototype.requestedSpace=function(a,b){var c=0,d=0;if(this._isHorizontal()){if(d=this._computeHeight()+this._margin,this.annotationsEnabled()){var e=this._annotationMeasurer.measure().height+2*f._ANNOTATION_LABEL_PADDING;d+=e*this.annotationTierCount()}}else if(c=this._computeWidth()+this._margin,this.annotationsEnabled()){var e=this._annotationMeasurer.measure().height+2*f._ANNOTATION_LABEL_PADDING;c+=e*this.annotationTierCount()}return{minWidth:c,minHeight:d}},f.prototype.fixedHeight=function(){return this._isHorizontal()},f.prototype.fixedWidth=function(){return!this._isHorizontal()},f.prototype._rescale=function(){this.render()},f.prototype.computeLayout=function(a,b,c){return e.prototype.computeLayout.call(this,a,b,c),this._isHorizontal()?this._scale.range([0,this.width()]):this._scale.range([this.height(),0]),this},f.prototype._setup=function(){e.prototype._setup.call(this),this._tickMarkContainer=this.content().append("g").classed(f.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this.content().append("g").classed(f.TICK_LABEL_CLASS+"-container",!0),this._baseline=this.content().append("line").classed("baseline",!0),this._annotationContainer=this.content().append("g").classed("annotation-container",!0),this._annotationContainer.append("g").classed("annotation-line-container",!0),this._annotationContainer.append("g").classed("annotation-circle-container",!0),this._annotationContainer.append("g").classed("annotation-rect-container",!0);var a=this._annotationContainer.append("g").classed("annotation-label-container",!0);this._annotationMeasurer=new b.Measurers.Measurer(a),this._annotationWriter=new b.Writers.Writer(this._annotationMeasurer)},f.prototype._getTickValues=function(){return[]},f.prototype.renderImmediately=function(){var b=this._getTickValues(),c=this._tickMarkContainer.selectAll("."+f.TICK_MARK_CLASS).data(b);return c.enter().append("line").classed(f.TICK_MARK_CLASS,!0),c.attr(this._generateTickMarkAttrHash()),a.select(c[0][0]).classed(f.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),a.select(c[0][b.length-1]).classed(f.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),c.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash()),this.annotationsEnabled()?this._drawAnnotations():this._removeAnnotations(),this},f.prototype.annotatedTicks=function(a){return null==a?this._annotatedTicks:(this._annotatedTicks=a,this.render(),this)},f.prototype.annotationFormatter=function(a){return null==a?this._annotationFormatter:(this._annotationFormatter=a,this.render(),this)},f.prototype.annotationsEnabled=function(a){return null==a?this._annotationsEnabled:(this._annotationsEnabled=a,this.redraw(),this)},f.prototype.annotationTierCount=function(a){if(null==a)return this._annotationTierCount;if(a<0)throw new Error("annotationTierCount cannot be negative");return this._annotationTierCount=a,this.redraw(),this},f.prototype._drawAnnotations=function(){var b=this,d=f._ANNOTATION_LABEL_PADDING,e=new c.Utils.Map,g=this._annotatedTicksToRender();g.forEach(function(a){var c=b._annotationMeasurer.measure(b.annotationFormatter()(a)),f={width:c.width+2*d,height:c.height+2*d};e.set(a,f)});var h=this._annotationMeasurer.measure().height+2*d,i=this._annotationToTier(e),j=new c.Utils.Set,k=this._isHorizontal()?this.height():this.width(),l=this._coreSize(),m=Math.min(this.annotationTierCount(),Math.floor((k-l)/h));i.forEach(function(a,b){(a===-1||a>=m)&&j.add(b)});var n,o=function(a,b,c){var d=a.selectAll("."+c).data(g);return d.enter().append(b).classed(c,!0),d.exit().remove(),d},p=function(a){switch(b.orientation()){case"bottom":case"right":return i.get(a)*h+l;case"top":case"left":return k-l-i.get(a)*h}},q=function(a){return b._scale.scale(a)},r=function(a){return j.has(a)?"hidden":"visible"};switch(this.orientation()){case"bottom":case"right":n=0;break;case"top":n=this.height();break;case"left":n=this.width()}var s=this._isHorizontal();o(this._annotationContainer.select(".annotation-line-container"),"line",f.ANNOTATION_LINE_CLASS).attr({x1:s?q:n,x2:s?q:p,y1:s?n:q,y2:s?p:q,visibility:r}),o(this._annotationContainer.select(".annotation-circle-container"),"circle",f.ANNOTATION_CIRCLE_CLASS).attr({cx:s?q:n,cy:s?n:q,r:3});var t=function(a){switch(b.orientation()){case"bottom":case"right":return p(a);case"top":case"left":return p(a)-e.get(a).height}};o(this._annotationContainer.select(".annotation-rect-container"),"rect",f.ANNOTATION_RECT_CLASS).attr({x:s?q:t,y:s?t:q,width:s?function(a){return e.get(a).width}:function(a){return e.get(a).height},height:s?function(a){return e.get(a).height}:function(a){return e.get(a).width},visibility:r});var u=this._annotationWriter,v=this.annotationFormatter(),w=o(this._annotationContainer.select(".annotation-label-container"),"g",f.ANNOTATION_LABEL_CLASS);w.selectAll(".text-container").remove(),w.attr({transform:function(a){var b=s?q(a):t(a),c=s?t(a):q(a);return"translate("+b+","+c+")"},visibility:r}).each(function(b){var c={selection:a.select(this),xAlign:"center",yAlign:"center",textRotation:s?0:90};u.write(v(b),s?e.get(b).width:e.get(b).height,s?e.get(b).height:e.get(b).width,c)})},f.prototype._annotatedTicksToRender=function(){var a=this,b=this._scale.range();return c.Utils.Array.uniq(this.annotatedTicks().filter(function(d){return null!=d&&c.Utils.Math.inRange(a._scale.scale(d),b[0],b[1])}))},f.prototype._coreSize=function(){var a=this._isHorizontal()?this.height():this.width(),b=this._isHorizontal()?this._computeHeight():this._computeWidth();return Math.min(b,a)},f.prototype._annotationTierHeight=function(){return this._annotationMeasurer.measure().height+2*f._ANNOTATION_LABEL_PADDING},f.prototype._annotationToTier=function(a){var b=this,d=[[]],e=new c.Utils.Map,f=this._isHorizontal()?this.width():this.height();return this._annotatedTicksToRender().forEach(function(c){var g=b._scale.scale(c),h=a.get(c).width;if(g<0||g+h>f)return void e.set(c,-1);for(var i=function(c){return d[c].some(function(c){var d=b._scale.scale(c),e=a.get(c).width;return g+h>=d&&g<=d+e})},j=0;i(j);)j++,d.length===j&&d.push([]);d[j].push(c),e.set(c,j)}),e},f.prototype._removeAnnotations=function(){this._annotationContainer.selectAll(".annotation-line").remove(),this._annotationContainer.selectAll(".annotation-circle").remove(),this._annotationContainer.selectAll(".annotation-rect").remove(),this._annotationContainer.selectAll(".annotation-label").remove()},f.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.width();break;case"top":a.x2=this.width(),a.y1=this.height(),a.y2=this.height();break;case"left":a.x1=this.width(),a.x2=this.width(),a.y2=this.height();break;case"right":a.y2=this.height()}return a},f.prototype._generateTickMarkAttrHash=function(a){var b=this;void 0===a&&(a=!1);var c={x1:0,y1:0,x2:0,y2:0},d=function(a){return b._scale.scale(a)};this._isHorizontal()?(c.x1=d,c.x2=d):(c.y1=d,c.y2=d);var e=a?this._endTickLength:this._innerTickLength;switch(this._orientation){case"bottom":c.y2=e;break;case"top":c.y1=this.height(),c.y2=this.height()-e;break;case"left":c.x1=this.width(),c.x2=this.width()-e;break;case"right":c.x2=e}return c},f.prototype._setDefaultAlignment=function(){switch(this._orientation){case"bottom":this.yAlignment("top");break;case"top":this.yAlignment("bottom");break;case"left":this.xAlignment("right");break;case"right":this.xAlignment("left")}},f.prototype.formatter=function(a){return null==a?this._formatter:(this._formatter=a,this.redraw(),this)},f.prototype.innerTickLength=function(a){if(null==a)return this._innerTickLength;if(a<0)throw new Error("inner tick length must be positive");return this._innerTickLength=a,this.redraw(),this},f.prototype.endTickLength=function(a){if(null==a)return this._endTickLength;if(a<0)throw new Error("end tick length must be positive");return this._endTickLength=a,this.redraw(),this},f.prototype._maxLabelTickLength=function(){return this.showEndTickLabels()?Math.max(this.innerTickLength(),this.endTickLength()):this.innerTickLength()},f.prototype.tickLabelPadding=function(a){if(null==a)return this._tickLabelPadding;if(a<0)throw new Error("tick label padding must be positive");return this._tickLabelPadding=a,this.redraw(),this},f.prototype.margin=function(a){if(null==a)return this._margin;if(a<0)throw new Error("margin size must be positive");return this._margin=a,this.redraw(),this},f.prototype.orientation=function(a){if(null==a)return this._orientation;var b=a.toLowerCase();if("top"!==b&&"bottom"!==b&&"left"!==b&&"right"!==b)throw new Error("unsupported orientation");return this._orientation=b,this.redraw(),this},f.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this.render(),this)},f.END_TICK_MARK_CLASS="end-tick-mark",f.TICK_MARK_CLASS="tick-mark",f.TICK_LABEL_CLASS="tick-label",f.ANNOTATION_LINE_CLASS="annotation-line",f.ANNOTATION_RECT_CLASS="annotation-rect",f.ANNOTATION_CIRCLE_CLASS="annotation-circle",f.ANNOTATION_LABEL_CLASS="annotation-label",f._ANNOTATION_LABEL_PADDING=4,f}(c.Component);c.Axis=e}(c||(c={}));var c;!function(a){var b;!function(a){a.second="second",a.minute="minute",a.hour="hour",a.day="day",a.week="week",a.month="month",a.year="year"}(b=a.TimeInterval||(a.TimeInterval={}))}(c||(c={}));var c;!function(c){var e;!function(e){var f=function(e){function f(a,b){e.call(this,a,b),this._tierLabelPositions=[],this.addClass("time-axis"),this.tickLabelPadding(5),this.axisConfigurations(f._DEFAULT_TIME_AXIS_CONFIGURATIONS),this.annotationFormatter(c.Formatters.time("%a %b %d, %Y"))}return d(f,e),f.prototype.tierLabelPositions=function(a){if(null==a)return this._tierLabelPositions;if(!a.every(function(a){return"between"===a.toLowerCase()||"center"===a.toLowerCase()}))throw new Error("Unsupported position for tier labels");return this._tierLabelPositions=a,this.redraw(),this},f.prototype.axisConfigurations=function(a){if(null==a)return this._possibleTimeAxisConfigurations;this._possibleTimeAxisConfigurations=a,this._numTiers=c.Utils.Math.max(this._possibleTimeAxisConfigurations.map(function(a){return a.length}),0),this._isAnchored&&this._setupDomElements();for(var b=this.tierLabelPositions(),d=[],e=0;ethis._scale.domain()[1])return this.width();var f=Math.abs(this._scale.scale(e)-this._scale.scale(b));return f},f.prototype._maxWidthForInterval=function(a){return this._measurer.measure(a.formatter(f._LONG_DATE)).width},f.prototype._checkTimeAxisTierConfigurationWidth=function(a){var b=this._maxWidthForInterval(a)+2*this.tickLabelPadding();return Math.min(this._getIntervalLength(a),this.width())>=b},f.prototype._sizeFromOffer=function(a,b){var c=e.prototype._sizeFromOffer.call(this,a,b),d=this._tierHeights.reduce(function(a,b,d,e){return a+b>c.height?a:a+b}),f=this.margin()+(this.annotationsEnabled()?this.annotationTierCount()*this._annotationTierHeight():0);return c.height=Math.min(c.height,d+f),c},f.prototype._setup=function(){e.prototype._setup.call(this),this._setupDomElements()},f.prototype._setupDomElements=function(){this.content().selectAll("."+f.TIME_AXIS_TIER_CLASS).remove(),this._tierLabelContainers=[],this._tierMarkContainers=[],this._tierBaselines=[],this._tickLabelContainer.remove(),this._baseline.remove();for(var a=0;a=g.length||h.push(new Date((g[b+1].valueOf()-g[b].valueOf())/2+g[b].valueOf()))}):h=g;var i=b.selectAll("."+c.Axis.TICK_LABEL_CLASS).data(h,function(a){return String(a.valueOf())}),j=i.enter().append("g").classed(c.Axis.TICK_LABEL_CLASS,!0);j.append("text");var k,l="center"===this._tierLabelPositions[e]||1===d.step?0:this.tickLabelPadding();k="bottom"===this.orientation()?a.sum(this._tierHeights.slice(0,e+1))-this.tickLabelPadding():"center"===this._tierLabelPositions[e]?this.height()-a.sum(this._tierHeights.slice(0,e))-this.tickLabelPadding()-this._maxLabelTickLength():this.height()-a.sum(this._tierHeights.slice(0,e))-this.tickLabelPadding();var m=i.selectAll("text");m.size()>0&&c.Utils.DOM.translate(m,l,k),i.exit().remove(),i.attr("transform",function(a){return"translate("+f._scale.scale(a)+",0)"; +});var n="center"===this._tierLabelPositions[e]||1===d.step?"middle":"start";i.selectAll("text").text(d.formatter).style("text-anchor",n)},f.prototype._renderTickMarks=function(b,d){var e=this._tierMarkContainers[d].selectAll("."+c.Axis.TICK_MARK_CLASS).data(b);e.enter().append("line").classed(c.Axis.TICK_MARK_CLASS,!0);var f=this._generateTickMarkAttrHash(),g=this._tierHeights.slice(0,d).reduce(function(a,b){return a+b},0);"bottom"===this.orientation()?(f.y1=g,f.y2=g+("center"===this._tierLabelPositions[d]?this.innerTickLength():this._tierHeights[d])):(f.y1=this.height()-g,f.y2=this.height()-(g+("center"===this._tierLabelPositions[d]?this.innerTickLength():this._tierHeights[d]))),e.attr(f),"bottom"===this.orientation()?(f.y1=g,f.y2=g+("center"===this._tierLabelPositions[d]?this.endTickLength():this._tierHeights[d])):(f.y1=this.height()-g,f.y2=this.height()-(g+("center"===this._tierLabelPositions[d]?this.endTickLength():this._tierHeights[d]))),a.select(e[0][0]).attr(f),a.select(e[0][e.size()-1]).attr(f),a.select(e[0][0]).classed(c.Axis.END_TICK_MARK_CLASS,!0),a.select(e[0][e.size()-1]).classed(c.Axis.END_TICK_MARK_CLASS,!0),e.exit().remove()},f.prototype._renderLabellessTickMarks=function(a){var b=this._tickMarkContainer.selectAll("."+c.Axis.TICK_MARK_CLASS).data(a);b.enter().append("line").classed(c.Axis.TICK_MARK_CLASS,!0);var d=this._generateTickMarkAttrHash();d.y2="bottom"===this.orientation()?this.tickLabelPadding():this.height()-this.tickLabelPadding(),b.attr(d),b.exit().remove()},f.prototype._generateLabellessTicks=function(){return this._mostPreciseConfigIndex<1?[]:this._getTickIntervalValues(this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex-1][0])},f.prototype.renderImmediately=function(){var a=this;this._mostPreciseConfigIndex=this._getMostPreciseConfigurationIndex();var b=this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex];this._cleanTiers(),b.forEach(function(b,c){return a._renderTierLabels(a._tierLabelContainers[c],b,c)});for(var c=b.map(function(b,c){return a._getTickValuesForConfiguration(b)}),d=0,e=0;e=i&&(g=this._generateLabellessTicks()),this._renderLabellessTickMarks(g),this._hideOverflowingTiers();for(var e=0;e=b[1]?b[0]:b[1];return c===b[0]?a.ticks().filter(function(a){return a>=c&&a<=d}):a.ticks().filter(function(a){return a>=c&&a<=d}).reverse()},f.prototype._rescale=function(){if(this._isSetup){if(!this._isHorizontal()){var a=this._computeWidth();if(a>this.width()||a=f.left)return!1}else if(e.top-c<=f.bottom)return!1}return!0},f}(c.Axis);e.Numeric=f}(e=c.Axes||(c.Axes={}))}(c||(c={}));var c;!function(c){var e;!function(e){var f=function(e){function f(a,b){e.call(this,a,b),this._tickLabelAngle=0,this.addClass("category-axis")}return d(f,e),f.prototype._setup=function(){e.prototype._setup.call(this),this._measurer=new b.Measurers.CacheCharacterMeasurer(this._tickLabelContainer),this._wrapper=new b.Wrappers.Wrapper,this._writer=new b.Writers.Writer(this._measurer,this._wrapper)},f.prototype._rescale=function(){return this.redraw()},f.prototype.requestedSpace=function(a,b){var c=this._isHorizontal()?0:this._maxLabelTickLength()+this.tickLabelPadding()+this.margin(),d=this._isHorizontal()?this._maxLabelTickLength()+this.tickLabelPadding()+this.margin():0;if(0===this._scale.domain().length)return{minWidth:0,minHeight:0};if(this.annotationsEnabled()){var e=this._annotationTierHeight()*this.annotationTierCount();this._isHorizontal()?d+=e:c+=e}var f=this._scale,g=this._measureTicks(a,b,f,f.domain());return{minWidth:g.usedWidth+c,minHeight:g.usedHeight+d}},f.prototype._coreSize=function(){var a=this._isHorizontal()?this.height():this.width(),b=this._isHorizontal()?this.requestedSpace(this.width(),this.height()).minHeight:this.requestedSpace(this.width(),this.height()).minWidth,c=this.margin()+this._annotationTierHeight(),d=b-c;return Math.min(d,a)},f.prototype._getTickValues=function(){return this._scale.domain()},f.prototype.tickLabelAngle=function(a){if(null==a)return this._tickLabelAngle;if(0!==a&&90!==a&&a!==-90)throw new Error("Angle "+a+" not supported; only 0, 90, and -90 are valid values");return this._tickLabelAngle=a,this.redraw(),this},f.prototype._drawTicks=function(b,c,d,e){var f,g,h=this;switch(this.tickLabelAngle()){case 0:f={left:"right",right:"left",top:"center",bottom:"center"},g={left:"center",right:"center",top:"bottom",bottom:"top"};break;case 90:f={left:"center",right:"center",top:"right",bottom:"left"},g={left:"top",right:"bottom",top:"center",bottom:"center"};break;case-90:f={left:"center",right:"center",top:"left",bottom:"right"},g={left:"bottom",right:"top",top:"center",bottom:"center"}}e.each(function(e){var i=d.stepWidth(),j=h._isHorizontal()?i:b-h._maxLabelTickLength()-h.tickLabelPadding(),k=h._isHorizontal()?c-h._maxLabelTickLength()-h.tickLabelPadding():i,l={selection:a.select(this),xAlign:f[h.orientation()],yAlign:g[h.orientation()],textRotation:h.tickLabelAngle()};h._writer.write(h.formatter()(e),j,k,l)})},f.prototype._measureTicks=function(d,e,f,g){var h=this,i=this._isHorizontal()?d:e,j=2*f.outerPadding(),k=(g.length-1)*f.innerPadding(),l=i/(j+k+g.length),m=l*(1+f.innerPadding()),n=g.map(function(a){var b=d-h._maxLabelTickLength()-h.tickLabelPadding();h._isHorizontal()&&(b=m,0!==h._tickLabelAngle&&(b=e-h._maxLabelTickLength()-h.tickLabelPadding()),b=Math.max(b,0));var c=m;return h._isHorizontal()&&(c=e-h._maxLabelTickLength()-h.tickLabelPadding(),0!==h._tickLabelAngle&&(c=d-h._maxLabelTickLength()-h.tickLabelPadding()),c=Math.max(c,0)),h._wrapper.wrap(h.formatter()(a),h._measurer,b,c)}),o=this._isHorizontal()&&0===this._tickLabelAngle?a.sum:c.Utils.Math.max,p=this._isHorizontal()&&0===this._tickLabelAngle?c.Utils.Math.max:a.sum,q=n.every(function(a){return!b.Utils.StringMethods.isNotEmptyString(a.truncatedText)&&1===a.noLines}),r=o(n,function(a){return h._measurer.measure(a.wrappedText).width},0),s=p(n,function(a){return h._measurer.measure(a.wrappedText).height},0);if(0!==this._tickLabelAngle){var t=s;s=r,r=t}return{textFits:q,usedWidth:r,usedHeight:s}},f.prototype.renderImmediately=function(){var a=this;e.prototype.renderImmediately.call(this);var b=this._scale,d=this._tickLabelContainer.selectAll("."+c.Axis.TICK_LABEL_CLASS).data(this._scale.domain(),function(a){return a}),f=function(c,d){var e=b.stepWidth()-b.rangeBand(),f=b.scale(c)-b.rangeBand()/2-e/2,g=a._isHorizontal()?f:0,h=a._isHorizontal()?0:f;return"translate("+g+","+h+")"};d.enter().append("g").classed(c.Axis.TICK_LABEL_CLASS,!0),d.exit().remove(),d.attr("transform",f),d.text(""),this._drawTicks(this.width(),this.height(),b,d);var g="right"===this.orientation()?this._maxLabelTickLength()+this.tickLabelPadding():0,h="bottom"===this.orientation()?this._maxLabelTickLength()+this.tickLabelPadding():0;return c.Utils.DOM.translate(this._tickLabelContainer,g,h),this},f.prototype.computeLayout=function(a,b,c){return this._measurer.reset(),e.prototype.computeLayout.call(this,a,b,c),this._isHorizontal()||this._scale.range([0,this.height()]),this},f}(c.Axis);e.Category=f}(e=c.Axes||(c.Axes={}))}(c||(c={}));var c;!function(a){var c;!function(c){var e=function(a){function c(b,c){void 0===b&&(b=""),void 0===c&&(c=0),a.call(this),this.addClass("label"),this.text(b),this.angle(c),this.xAlignment("center").yAlignment("center"),this._padding=0}return d(c,a),c.prototype.requestedSpace=function(a,b){var c=this._measurer.measure(this._text),d=(0===this.angle()?c.width:c.height)+2*this.padding(),e=(0===this.angle()?c.height:c.width)+2*this.padding();return{minWidth:d,minHeight:e}},c.prototype._setup=function(){a.prototype._setup.call(this),this._textContainer=this.content().append("g"),this._measurer=new b.Measurers.Measurer(this._textContainer),this._wrapper=new b.Wrappers.Wrapper,this._writer=new b.Writers.Writer(this._measurer,this._wrapper),this.text(this._text)},c.prototype.text=function(a){if(null==a)return this._text;if("string"!=typeof a)throw new Error("Label.text() only takes strings as input");return this._text=a,this.redraw(),this},c.prototype.angle=function(a){if(null==a)return this._angle;if(a%=360,a>180?a-=360:a<-180&&(a+=360),a!==-90&&0!==a&&90!==a)throw new Error(a+" is not a valid angle for Label");return this._angle=a,this.redraw(),this},c.prototype.padding=function(a){if(null==a)return this._padding;if(a=+a,a<0)throw new Error(a+" is not a valid padding value. Cannot be less than 0.");return this._padding=a,this.redraw(),this},c.prototype.fixedWidth=function(){return!0},c.prototype.fixedHeight=function(){return!0},c.prototype.renderImmediately=function(){a.prototype.renderImmediately.call(this),this._textContainer.selectAll("g").remove();var b=this._measurer.measure(this._text),c=Math.max(Math.min((this.height()-b.height)/2,this.padding()),0),d=Math.max(Math.min((this.width()-b.width)/2,this.padding()),0);this._textContainer.attr("transform","translate("+d+","+c+")");var e=this.width()-2*d,f=this.height()-2*c,g={selection:this._textContainer,xAlign:this.xAlignment(),yAlign:this.yAlignment(),textRotation:this.angle()};return this._writer.write(this._text,e,f,g),this},c}(a.Component);c.Label=e;var f=function(a){function b(c,d){a.call(this,c,d),this.addClass(b.TITLE_LABEL_CLASS)}return d(b,a),b.TITLE_LABEL_CLASS="title-label",b}(e);c.TitleLabel=f;var g=function(a){function b(c,d){a.call(this,c,d),this.addClass(b.AXIS_LABEL_CLASS)}return d(b,a),b.AXIS_LABEL_CLASS="axis-label",b}(e);c.AxisLabel=g}(c=a.Components||(a.Components={}))}(c||(c={}));var c;!function(c){var e;!function(e){var f=function(e){function f(a){var b=this;if(e.call(this),this._padding=5,this.addClass("legend"),this.maxEntriesPerRow(1),null==a)throw new Error("Legend requires a colorScale");this._colorScale=a,this._redrawCallback=function(a){return b.redraw()},this._colorScale.onUpdate(this._redrawCallback),this._formatter=c.Formatters.identity(),this.xAlignment("right").yAlignment("top"),this.comparator(function(a,c){var d=b._colorScale.domain().slice().map(function(a){return b._formatter(a)});return d.indexOf(a)-d.indexOf(c)}),this._symbolFactoryAccessor=function(){return c.SymbolFactories.circle()},this._symbolOpacityAccessor=function(){return 1}}return d(f,e),f.prototype._setup=function(){e.prototype._setup.call(this);var a=this.content().append("g").classed(f.LEGEND_ROW_CLASS,!0),d=a.append("g").classed(f.LEGEND_ENTRY_CLASS,!0);d.append("text"),this._measurer=new b.Measurers.Measurer(a),this._wrapper=(new b.Wrappers.Wrapper).maxLines(1),this._writer=new b.Writers.Writer(this._measurer,this._wrapper).addTitleElement(c.Configs.ADD_TITLE_ELEMENTS)},f.prototype.formatter=function(a){return null==a?this._formatter:(this._formatter=a,this.redraw(),this)},f.prototype.maxEntriesPerRow=function(a){return null==a?this._maxEntriesPerRow:(this._maxEntriesPerRow=a,this.redraw(),this)},f.prototype.comparator=function(a){return null==a?this._comparator:(this._comparator=a,this.redraw(),this)},f.prototype.colorScale=function(a){return null!=a?(this._colorScale.offUpdate(this._redrawCallback),this._colorScale=a,this._colorScale.onUpdate(this._redrawCallback),this.redraw(),this):this._colorScale},f.prototype.destroy=function(){e.prototype.destroy.call(this),this._colorScale.offUpdate(this._redrawCallback)},f.prototype._calculateLayoutInfo=function(b,c){var d=this,e=this._measurer.measure().height,f=Math.max(0,b-this._padding),g=this._colorScale.domain().slice().sort(function(a,b){return d._comparator(d._formatter(a),d._formatter(b))}),h=a.map(),i=a.map();g.forEach(function(a){var b=e+d._measurer.measure(d._formatter(a)).width+d._padding,c=Math.min(b,f);h.set(a,c),i.set(a,b)});var j=this._packRows(f,g,h),k=Math.floor((c-2*this._padding)/e);return k!==k&&(k=0),{textHeight:e,entryLengths:h,untruncatedEntryLengths:i,rows:j,numRowsToDraw:Math.max(Math.min(k,j.length),0)}},f.prototype.requestedSpace=function(b,d){var e=this._calculateLayoutInfo(b,d),f=e.rows.map(function(b){return a.sum(b,function(a){return e.untruncatedEntryLengths.get(a)})}),g=c.Utils.Math.max(f,0);return{minWidth:this._padding+g,minHeight:e.rows.length*e.textHeight+2*this._padding}},f.prototype._packRows=function(a,b,c){var d=this,e=[],f=[],g=a;return b.forEach(function(b){var h=c.get(b);(h>g||f.length===d._maxEntriesPerRow)&&(e.push(f),f=[],g=a),f.push(b),g-=h}),0!==f.length&&e.push(f),e},f.prototype.entitiesAt=function(b){if(!this._isSetup)return[];var c=[],d=this._calculateLayoutInfo(this.width(),this.height()),e=this._padding,g=this;return this.content().selectAll("g."+f.LEGEND_ROW_CLASS).each(function(h,i){var j=i*d.textHeight+e,k=(i+1)*d.textHeight+e,l=(j+k)/2,m=e,n=e;a.select(this).selectAll("g."+f.LEGEND_ENTRY_CLASS).each(function(e){n+=d.entryLengths.get(e);var f=m+d.textHeight/2;if(n>=b.x&&m<=b.x&&k>=b.y&&j<=b.y){var h=a.select(this),i=h.datum();c.push({datum:i,position:{x:f,y:l},selection:h,component:g})}m+=d.entryLengths.get(e)})}),c},f.prototype.renderImmediately=function(){var b=this;e.prototype.renderImmediately.call(this);var c=this._calculateLayoutInfo(this.width(),this.height()),d=c.rows.slice(0,c.numRowsToDraw),g=this.content().selectAll("g."+f.LEGEND_ROW_CLASS).data(d);g.enter().append("g").classed(f.LEGEND_ROW_CLASS,!0),g.exit().remove(),g.attr("transform",function(a,d){return"translate(0, "+(d*c.textHeight+b._padding)+")"});var h=g.selectAll("g."+f.LEGEND_ENTRY_CLASS).data(function(a){return a}),i=h.enter().append("g").classed(f.LEGEND_ENTRY_CLASS,!0);i.append("path"),i.append("g").classed("text-container",!0),h.exit().remove();var j=this._padding;g.each(function(b){var d=j,e=a.select(this).selectAll("g."+f.LEGEND_ENTRY_CLASS);e.attr("transform",function(a,b){var e="translate("+d+", 0)";return d+=c.entryLengths.get(a),e})}),h.select("path").attr("d",function(a,d,e){return b.symbol()(a,e)(.6*c.textHeight)}).attr("transform","translate("+c.textHeight/2+","+c.textHeight/2+")").attr("fill",function(a){return b._colorScale.scale(a)}).attr("opacity",function(a,c,d){return b.symbolOpacity()(a,d)}).classed(f.LEGEND_SYMBOL_CLASS,!0);var k=this._padding,l=h.select("g.text-container");l.text("");var m=this;return l.attr("transform","translate("+c.textHeight+", 0)").each(function(b){var d=a.select(this),e=c.entryLengths.get(b)-c.textHeight-k,f={selection:d,xAlign:"left",yAlign:"top",textRotation:0};m._writer.write(m._formatter(b),e,m.height(),f)}),this},f.prototype.symbol=function(a){return null==a?this._symbolFactoryAccessor:(this._symbolFactoryAccessor=a,this.render(),this)},f.prototype.symbolOpacity=function(a){return null==a?this._symbolOpacityAccessor:("number"==typeof a?this._symbolOpacityAccessor=function(){return a}:this._symbolOpacityAccessor=a,this.render(),this)},f.prototype.fixedWidth=function(){return!0},f.prototype.fixedHeight=function(){return!0},f.LEGEND_ROW_CLASS="legend-row",f.LEGEND_ENTRY_CLASS="legend-entry",f.LEGEND_SYMBOL_CLASS="legend-symbol",f}(c.Component);e.Legend=f}(e=c.Components||(c.Components={}))}(c||(c={}));var c;!function(a){var c;!function(c){var e=function(c){function e(b){var d=this;if(c.call(this),this._textPadding=5,null==b)throw new Error("InterpolatedColorLegend requires a interpolatedColorScale");this._scale=b,this._redrawCallback=function(a){return d.redraw()},this._scale.onUpdate(this._redrawCallback),this._formatter=a.Formatters.general(),this._orientation="horizontal",this._expands=!1,this.addClass("legend"),this.addClass("interpolated-color-legend")}return d(e,c),e.prototype.destroy=function(){c.prototype.destroy.call(this),this._scale.offUpdate(this._redrawCallback)},e.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this.redraw(),this)},e.prototype.expands=function(a){return null==a?this._expands:(this._expands=a,this.redraw(),this)},e._ensureOrientation=function(a){if(a=a.toLowerCase(),"horizontal"===a||"left"===a||"right"===a)return a;throw new Error('"'+a+'" is not a valid orientation for InterpolatedColorLegend')},e.prototype.orientation=function(a){return null==a?this._orientation:(this._orientation=e._ensureOrientation(a),this.redraw(),this)},e.prototype.fixedWidth=function(){return!this.expands()||this._isVertical()},e.prototype.fixedHeight=function(){return!this.expands()||!this._isVertical()},e.prototype._generateTicks=function(a){void 0===a&&(a=e._DEFAULT_NUM_SWATCHES);var b=this._scale.domain();if(1===a)return[b[0]];for(var c=(b[1]-b[0])/(a-1),d=[],f=0;f=this._nRows||b<0||b>=this._nCols?null:this._rows[a][b]},e.prototype.add=function(a,b,c){if(null==a)throw Error("Cannot add null to a table cell");if(!this.has(a)){var d=this._rows[b]&&this._rows[b][c];if(null!=d)throw new Error("cell is occupied");a.detach(),this._nRows=Math.max(b+1,this._nRows),this._nCols=Math.max(c+1,this._nCols),this._padTableToSize(this._nRows,this._nCols),this._rows[b][c]=a,this._adoptAndAnchor(a),this.redraw()}return this},e.prototype._remove=function(a){for(var b=0;b0&&g!==A,F=h>0&&h!==B;if(!E&&!F)break;if(x>5)break}return g=n-a.sum(i.guaranteedWidths),h=o-a.sum(i.guaranteedHeights),t=e._calcProportionalSpace(q,g),u=e._calcProportionalSpace(p,h),{colProportionalSpace:t,rowProportionalSpace:u,guaranteedWidths:i.guaranteedWidths,guaranteedHeights:i.guaranteedHeights,wantsWidth:j,wantsHeight:k}},e.prototype._determineGuarantees=function(a,c,d){void 0===d&&(d=!1);var e=b.Utils.Array.createFilledArray(0,this._nCols),f=b.Utils.Array.createFilledArray(0,this._nRows),g=b.Utils.Array.createFilledArray(!1,this._nCols),h=b.Utils.Array.createFilledArray(!1,this._nRows);return this._rows.forEach(function(b,i){b.forEach(function(b,j){var k;k=null!=b?b.requestedSpace(a[j],c[i]):{minWidth:0,minHeight:0};var l=d?Math.min(k.minWidth,a[j]):k.minWidth;e[j]=Math.max(e[j],l);var m=d?Math.min(k.minHeight,c[i]):k.minHeight;f[i]=Math.max(f[i],m);var n=k.minWidth>a[j];g[j]=g[j]||n;var o=k.minHeight>c[i];h[i]=h[i]||o})}),{guaranteedWidths:e,guaranteedHeights:f,wantsWidthArr:g,wantsHeightArr:h}},e.prototype.requestedSpace=function(b,c){return this._calculatedLayout=this._iterateLayout(b,c),{minWidth:a.sum(this._calculatedLayout.guaranteedWidths),minHeight:a.sum(this._calculatedLayout.guaranteedHeights)}},e.prototype.computeLayout=function(d,e,f){var g=this;c.prototype.computeLayout.call(this,d,e,f);var h=a.sum(this._calculatedLayout.guaranteedWidths),i=a.sum(this._calculatedLayout.guaranteedHeights),j=this._calculatedLayout;(h>this.width()||i>this.height())&&(j=this._iterateLayout(this.width(),this.height(),!0));var k=0,l=b.Utils.Array.add(j.rowProportionalSpace,j.guaranteedHeights),m=b.Utils.Array.add(j.colProportionalSpace,j.guaranteedWidths);return this._rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a.computeLayout({x:c,y:k},m[d],l[b]),c+=m[d]+g._columnPadding}),k+=l[b]+g._rowPadding}),this},e.prototype.rowPadding=function(a){if(null==a)return this._rowPadding;if(!b.Utils.Math.isValidNumber(a)||a<0)throw Error("rowPadding must be a non-negative finite value");return this._rowPadding=a,this.redraw(),this},e.prototype.columnPadding=function(a){if(null==a)return this._columnPadding;if(!b.Utils.Math.isValidNumber(a)||a<0)throw Error("columnPadding must be a non-negative finite value");return this._columnPadding=a,this.redraw(),this},e.prototype.rowWeight=function(a,c){if(null==c)return this._rowWeights[a];if(!b.Utils.Math.isValidNumber(c)||c<0)throw Error("rowWeight must be a non-negative finite value");return this._rowWeights[a]=c,this.redraw(),this},e.prototype.columnWeight=function(a,c){if(null==c)return this._columnWeights[a];if(!b.Utils.Math.isValidNumber(c)||c<0)throw Error("columnWeight must be a non-negative finite value");return this._columnWeights[a]=c,this.redraw(),this},e.prototype.fixedWidth=function(){var b=a.transpose(this._rows);return e._fixedSpace(b,function(a){return null==a||a.fixedWidth()})},e.prototype.fixedHeight=function(){return e._fixedSpace(this._rows,function(a){return null==a||a.fixedHeight()})},e.prototype._padTableToSize=function(a,b){for(var c=0;cthis.width()||a.y>this.height())},e.prototype._uninstallScaleForKey=function(a,b){a.offUpdate(this._renderCallback),a.removeIncludedValuesProvider(this._includedValuesProvider)},e.prototype._installScaleForKey=function(a,b){a.onUpdate(this._renderCallback),a.addIncludedValuesProvider(this._includedValuesProvider)},e.prototype._propertyProjectors=function(){return{}},e._scaledAccessor=function(a){return null==a.scale?a.accessor:function(b,c,d){return a.scale.scale(a.accessor(b,c,d))}},e.prototype._pixelPoint=function(a,b,c){return{x:0,y:0}},e.prototype._animateOnNextRender=function(){return this._animate&&this._dataChanged},e._ANIMATION_MAX_DURATION=600,e}(b.Component);b.Plot=c}(c||(c={}));var c;!function(c){var e;!function(e){var f=function(e){function f(){var a=this;e.call(this),this._labelFormatter=c.Formatters.identity(),this._labelsEnabled=!1,this.innerRadius(0),this.outerRadius(function(){return Math.min(a.width(),a.height())/2}),this.addClass("pie-plot"),this.attr("fill",function(a,b){return String(b)},new c.Scales.Color),this._strokeDrawers=new c.Utils.Map}return d(f,e),f.prototype._setup=function(){var a=this;e.prototype._setup.call(this),this._strokeDrawers.forEach(function(b){return b.renderArea(a._renderArea.append("g"))})},f.prototype.computeLayout=function(a,b,c){e.prototype.computeLayout.call(this,a,b,c),this._renderArea.attr("transform","translate("+this.width()/2+","+this.height()/2+")");var d=Math.min(this.width(),this.height())/2;return null!=this.innerRadius().scale&&this.innerRadius().scale.range([0,d]),null!=this.outerRadius().scale&&this.outerRadius().scale.range([0,d]),this},f.prototype.addDataset=function(a){return e.prototype.addDataset.call(this,a),this},f.prototype._addDataset=function(a){if(1===this.datasets().length)return c.Utils.Window.warn("Only one dataset is supported in Pie plots"),this;this._updatePieAngles();var b=new c.Drawers.ArcOutline(a);return this._isSetup&&b.renderArea(this._renderArea.append("g")),this._strokeDrawers.set(a,b),e.prototype._addDataset.call(this,a),this},f.prototype.removeDataset=function(a){return e.prototype.removeDataset.call(this,a),this},f.prototype._removeDatasetNodes=function(a){e.prototype._removeDatasetNodes.call(this,a),this._strokeDrawers.get(a).remove()},f.prototype._removeDataset=function(a){return e.prototype._removeDataset.call(this,a),this._startAngles=[],this._endAngles=[],this},f.prototype.selections=function(b){var c=this;void 0===b&&(b=this.datasets());var d=e.prototype.selections.call(this,b)[0];return b.forEach(function(a){var b=c._strokeDrawers.get(a);null!=b&&b.renderArea().selectAll(b.selector()).each(function(){d.push(this)})}),a.selectAll(d)},f.prototype._onDatasetUpdate=function(){e.prototype._onDatasetUpdate.call(this),this._updatePieAngles(),this.render()},f.prototype._createDrawer=function(a){return new c.Drawers.Arc(a)},f.prototype.entities=function(a){var b=this;void 0===a&&(a=this.datasets());var c=e.prototype.entities.call(this,a);return c.forEach(function(a){a.position.x+=b.width()/2,a.position.y+=b.height()/2;var c=b._strokeDrawers.get(a.dataset).selectionForIndex(a.index);a.selection[0].push(c[0][0])}),c},f.prototype.sectorValue=function(a,b){return null==a?this._propertyBindings.get(f._SECTOR_VALUE_KEY):(this._bindProperty(f._SECTOR_VALUE_KEY,a,b),this._updatePieAngles(),this.render(),this)},f.prototype.innerRadius=function(a,b){return null==a?this._propertyBindings.get(f._INNER_RADIUS_KEY):(this._bindProperty(f._INNER_RADIUS_KEY,a,b),this.render(),this)},f.prototype.outerRadius=function(a,b){return null==a?this._propertyBindings.get(f._OUTER_RADIUS_KEY):(this._bindProperty(f._OUTER_RADIUS_KEY,a,b),this.render(),this)},f.prototype.labelsEnabled=function(a){return null==a?this._labelsEnabled:(this._labelsEnabled=a,this.render(),this)},f.prototype.labelFormatter=function(a){return null==a?this._labelFormatter:(this._labelFormatter=a,this.render(),this)},f.prototype.entitiesAt=function(a){var b={x:this.width()/2,y:this.height()/2},c={x:a.x-b.x,y:a.y-b.y},d=this._sliceIndexForPoint(c);return null==d?[]:[this.entities()[d]]},f.prototype._propertyProjectors=function(){var b=this,d=e.prototype._propertyProjectors.call(this),f=c.Plot._scaledAccessor(this.innerRadius()),g=c.Plot._scaledAccessor(this.outerRadius());return d.d=function(c,d,e){return a.svg.arc().innerRadius(f(c,d,e)).outerRadius(g(c,d,e)).startAngle(b._startAngles[d]).endAngle(b._endAngles[d])(c,d)},d},f.prototype._updatePieAngles=function(){if(null!=this.sectorValue()&&0!==this.datasets().length){var b=c.Plot._scaledAccessor(this.sectorValue()),d=this.datasets()[0],e=this._getDataToDraw().get(d),f=a.layout.pie().sort(null).value(function(a,c){return b(a,c,d)})(e);this._startAngles=f.map(function(a){return a.startAngle}),this._endAngles=f.map(function(a){return a.endAngle})}},f.prototype._getDataToDraw=function(){var a=e.prototype._getDataToDraw.call(this);if(0===this.datasets().length)return a;var b=c.Plot._scaledAccessor(this.sectorValue()),d=this.datasets()[0],g=a.get(d),h=g.filter(function(a,c){return f._isValidData(b(a,c,d))});return a.set(d,h),a},f._isValidData=function(a){return c.Utils.Math.isValidNumber(a)&&a>=0},f.prototype._pixelPoint=function(b,d,e){var g=c.Plot._scaledAccessor(this.sectorValue());if(!f._isValidData(g(b,d,e)))return{x:NaN,y:NaN};var h=c.Plot._scaledAccessor(this.innerRadius())(b,d,e),i=c.Plot._scaledAccessor(this.outerRadius())(b,d,e),j=(h+i)/2,k=a.layout.pie().sort(null).value(function(a,b){var c=g(a,b,e);return f._isValidData(c)?c:0})(e.data()),l=k[d].startAngle,m=k[d].endAngle,n=(l+m)/2;return{x:j*Math.sin(n),y:-j*Math.cos(n)}},f.prototype._additionalPaint=function(a){var b=this;this._renderArea.select(".label-area").remove(),this._labelsEnabled&&c.Utils.Window.setTimeout(function(){return b._drawLabels()},a);var d=this._generateStrokeDrawSteps(),e=this._getDataToDraw();this.datasets().forEach(function(a){return b._strokeDrawers.get(a).draw(e.get(a),d)})},f.prototype._generateStrokeDrawSteps=function(){var a=this._generateAttrToProjector();return[{attrToProjector:a,animator:new c.Animators.Null}]},f.prototype._sliceIndexForPoint=function(a){var b=Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2)),c=Math.acos(-a.y/b);a.x<0&&(c=2*Math.PI-c);for(var d,e=0;ec){d=e;break}if(void 0!==d){var f=this.datasets()[0],g=f.data()[d],h=this.innerRadius().accessor(g,d,f),i=this.outerRadius().accessor(g,d,f);if(b>h&&bn||y.minp)return;if(f._overlayLabel(x,y,k,e,a))return;var z=g.fill(b,k,d),A=1.6*c.Utils.Color.contrast("white",z)=p-i&&h<=q+i)l=0;else{var r=d._isVertical?m.y:m.x;l=Math.abs(h-r)}}(kd.height()?B=d.height()-A:A<0&&(B=A+r);var C=g._LABEL_VERTICAL_PADDING;k=t.height+2*C<=B,k?od.width()?E=d.width()-D:D<0&&(E=D+q);var C=g._LABEL_HORIZONTAL_PADDING;k=t.width+2*C<=E,k?od.width()||z.y+t.height>d.height();F.style("visibility",I?"hidden":"inherit");var J={selection:F,xAlign:u,yAlign:v,textRotation:0};j.write(s,x,y,J);var K=d._isVertical?qg?g:d},a},g.prototype._getBarPixelWidth=function(){if(!this._projectorsReady())return 0;var b,d=this._isVertical?this.x().scale:this.y().scale;if(d instanceof c.Scales.Category)b=d.rangeBand();else{var e=this._isVertical?this.x().accessor:this.y().accessor,f=a.set(c.Utils.Array.flatten(this.datasets().map(function(a){return a.data().map(function(b,c){return e(b,c,a)}).filter(function(a){return null!=a}).map(function(a){return a.valueOf()})}))).values().map(function(a){return+a});f.sort(function(a,b){return a-b});var h=f.map(function(a){return d.scale(a)}),i=a.pairs(h),j=this._isVertical?this.width():this.height();b=c.Utils.Math.min(i,function(a,b){return Math.abs(a[1]-a[0])},j*g._SINGLE_BAR_DIMENSION_RATIO),b*=g._BAR_WIDTH_RATIO}return b},g.prototype._updateBarPixelWidth=function(){this._barPixelWidth=this._getBarPixelWidth()},g.prototype.entities=function(a){if(void 0===a&&(a=this.datasets()),!this._projectorsReady())return[];var b=f.prototype.entities.call(this,a);return b},g.prototype._pixelPoint=function(a,b,d){var e,f,g=this._generateAttrToProjector(),h=g.x(a,b,d),i=g.y(a,b,d),j=g.width(a,b,d),k=g.height(a,b,d),l=(this._isVertical?c.Plot._scaledAccessor(this.y()):c.Plot._scaledAccessor(this.x()))(a,b,d),m=(this._isVertical?this.y().scale:this.x().scale).scale(this.baselineValue());return this._isVertical?(e=h+j/2,f=l<=m?i:i+k):(e=l>=m?h+j:h,f=i+k/2),{x:e,y:f}},g.prototype._uninstallScaleForKey=function(a,b){a.offUpdate(this._updateBarPixelWidthCallback),f.prototype._uninstallScaleForKey.call(this,a,b)},g.prototype._getDataToDraw=function(){var a=new c.Utils.Map,b=this._generateAttrToProjector();return this.datasets().forEach(function(d){var e=d.data().filter(function(a,e){return c.Utils.Math.isValidNumber(b.x(a,e,d))&&c.Utils.Math.isValidNumber(b.y(a,e,d))&&c.Utils.Math.isValidNumber(b.width(a,e,d))&&c.Utils.Math.isValidNumber(b.height(a,e,d))});a.set(d,e)}),a},g.ORIENTATION_VERTICAL="vertical",g.ORIENTATION_HORIZONTAL="horizontal",g._BAR_WIDTH_RATIO=.95,g._SINGLE_BAR_DIMENSION_RATIO=.4,g._BAR_AREA_CLASS="bar-area",g._LABEL_AREA_CLASS="bar-label-text-area",g._LABEL_VERTICAL_PADDING=5,g._LABEL_HORIZONTAL_PADDING=5,g}(c.XYPlot);e.Bar=f}(e=c.Plots||(c.Plots={}))}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(e){function f(){e.call(this),this._interpolator="linear",this._autorangeSmooth=!1,this._croppedRenderingEnabled=!0,this._downsamplingEnabled=!1,this.addClass("line-plot");var a=new b.Animators.Easing;a.stepDuration(b.Plot._ANIMATION_MAX_DURATION),a.easingMode("exp-in-out"),a.maxTotalDuration(b.Plot._ANIMATION_MAX_DURATION),this.animator(c.Animator.MAIN,a),this.attr("stroke",(new b.Scales.Color).range()[0]),this.attr("stroke-width","2px")}return d(f,e),f.prototype.x=function(a,b){return null==a?e.prototype.x.call(this):(null==b?e.prototype.x.call(this,a):e.prototype.x.call(this,a,b),this._setScaleSnapping(),this)},f.prototype.y=function(a,b){return null==a?e.prototype.y.call(this):(e.prototype.y.call(this,a,b),this._setScaleSnapping(),this)},f.prototype.autorangeMode=function(a){return null==a?e.prototype.autorangeMode.call(this):(e.prototype.autorangeMode.call(this,a),this._setScaleSnapping(),this)},f.prototype.autorangeSmooth=function(a){return null==a?this._autorangeSmooth:(this._autorangeSmooth=a,this._setScaleSnapping(),this)},f.prototype._setScaleSnapping=function(){"x"===this.autorangeMode()&&this.x()&&this.x().scale&&this.x().scale instanceof b.QuantitativeScale&&this.x().scale.snappingDomainEnabled(!this.autorangeSmooth()),"y"===this.autorangeMode()&&this.y()&&this.y().scale&&this.y().scale instanceof b.QuantitativeScale&&this.y().scale.snappingDomainEnabled(!this.autorangeSmooth())},f.prototype.interpolator=function(a){return null==a?this._interpolator:(this._interpolator=a,this.render(),this)},f.prototype.downsamplingEnabled=function(a){return null==a?this._downsamplingEnabled:(this._downsamplingEnabled=a,this)},f.prototype.croppedRenderingEnabled=function(a){return null==a?this._croppedRenderingEnabled:(this._croppedRenderingEnabled=a,this.render(),this)},f.prototype._createDrawer=function(a){return new b.Drawers.Line(a)},f.prototype._extentsForProperty=function(b){var c=e.prototype._extentsForProperty.call(this,b);if(!this._autorangeSmooth)return c;if(this.autorangeMode()!==b)return c;if("x"!==this.autorangeMode()&&"y"!==this.autorangeMode())return c;var d,f=this._getEdgeIntersectionPoints();return d="y"===this.autorangeMode()?f.left.concat(f.right).map(function(a){return a.y}):f.top.concat(f.bottom).map(function(a){return a.x}),c.map(function(b){return a.extent(a.merge([b,d]))})},f.prototype._getEdgeIntersectionPoints=function(){var a=this;if(!(this.y().scale instanceof b.QuantitativeScale&&this.x().scale instanceof b.QuantitativeScale))return{left:[],right:[],top:[],bottom:[]};var c=this.y().scale,d=this.x().scale,e={left:[],right:[],top:[],bottom:[]},f=d.scale(d.domain()[0]),g=d.scale(d.domain()[1]),h=c.scale(c.domain()[0]),i=c.scale(c.domain()[1]);return this.datasets().forEach(function(b){for(var j,k,l,m,n,o,p,q,r=b.data(),s=1;s0&&c||0,e=this.y().scale.scale(d);return function(a,b,c){return e}},f.prototype._generateDrawSteps=function(){var a=[];if(this._animateOnNextRender()){var d=this._generateAttrToProjector();d.d=this._constructLineProjector(b.Plot._scaledAccessor(this.x()),this._getResetYFunction()),a.push({attrToProjector:d,animator:this._getAnimator(c.Animator.RESET)})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator(c.Animator.MAIN)}),a},f.prototype._generateAttrToProjector=function(){var a=e.prototype._generateAttrToProjector.call(this);return Object.keys(a).forEach(function(b){if("d"!==b){var c=a[b];a[b]=function(a,b,d){return a.length>0?c(a[0],b,d):null}}}),a},f.prototype.entitiesAt=function(a){var b=this.entityNearestByXThenY(a);return null!=b?[b]:[]},f.prototype.entityNearestByXThenY=function(a){var b,c=this,d=1/0,e=1/0;return this.entities().forEach(function(f){if(c._entityVisibleOnPlot(f.position,f.datum,f.index,f.dataset)){var g=Math.abs(a.x-f.position.x),h=Math.abs(a.y-f.position.y);(gs&&(s=u,r=c[i]),u0},c.prototype._lineIntersectsSegment=function(a,b,c,d){var e=function(a,b,c){return(b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x)};return e(a,b,c)*e(a,b,d)<0},c._X2_KEY="x2",c._Y2_KEY="y2",c}(a.XYPlot);b.Segment=c}(b=a.Plots||(a.Plots={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(b){function c(){b.call(this),this._connectorsEnabled=!1,this.addClass("waterfall-plot")}return d(c,b),c.prototype.connectorsEnabled=function(a){return null==a?this._connectorsEnabled:(this._connectorsEnabled=a,this)},c.prototype.total=function(a){return null==a?this._propertyBindings.get(c._TOTAL_KEY):(this._bindProperty(c._TOTAL_KEY,a,null),this)},c.prototype._additionalPaint=function(b){var c=this;this._connectorArea.selectAll("line").remove(),this._connectorsEnabled&&a.Utils.Window.setTimeout(function(){return c._drawConnectors()},b)},c.prototype._createNodesForDataset=function(a){var d=b.prototype._createNodesForDataset.call(this,a);return this._connectorArea=this._renderArea.append("g").classed(c._CONNECTOR_AREA_CLASS,!0),d},c.prototype._extentsForProperty=function(a){var c="y";return a===c?[this._extent]:b.prototype._extentsForProperty.call(this,a)},c.prototype._generateAttrToProjector=function(){var d=this,e=b.prototype._generateAttrToProjector.call(this),f=this.y().scale,g=a.Plot._scaledAccessor(this.total()),h=this.attr("y");null==h&&(e.y=function(a,b,c){var e=d.y().accessor(a,b,c),h=g(a,b,c);if(h)return Math.min(f.scale(e),f.scale(0));var i=d._subtotals[b];if(0===b)return e<0?f.scale(i-e):f.scale(i);var j=d._subtotals[b-1];return i>j?f.scale(i):f.scale(j)});var i=this.attr("height");return null==i&&(e.height=function(a,b,c){var e=g(a,b,c),h=d.y().accessor(a,b,c);if(e)return Math.abs(f.scale(h)-f.scale(0));var i=d._subtotals[b];if(0===b)return Math.abs(f.scale(i)-f.scale(i-h));var j=d._subtotals[b-1];return Math.abs(f.scale(i)-f.scale(j))}),e["class"]=function(a,b,e){var f="";null!=d.attr("class")&&(f=d.attr("class").accessor(a,b,e)+" ");var h=g(a,b,e);if(h)return f+c._BAR_TOTAL_CLASS;var i=d.y().accessor(a,b,e);return f+(i>0?c._BAR_GROWTH_CLASS:c._BAR_DECLINE_CLASS)},e},c.prototype._onDatasetUpdate=function(){return this._updateSubtotals(),b.prototype._onDatasetUpdate.call(this),this},c.prototype._calculateSubtotalsAndExtent=function(a){var b=this,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=0,f=!1;a.data().forEach(function(g,h){var i=b.y().accessor(g,h,a),j=b.total().accessor(g,h,a);if(j&&0!==h||(e+=i),b._subtotals.push(e),ed&&(d=e),j&&(id&&(d=i)),!f&&j){for(var k=i-e,l=0;l0&&this._subtotals[d]>this._subtotals[e]||this._subtotals[d]<0&&this._subtotals[d]>=this._subtotals[e])&&(j=a.y(f,d,b)+a.height(f,d,b)),this._connectorArea.append("line").classed(c._CONNECTOR_CLASS,!0).attr("x1",h).attr("x2",i).attr("y1",j).attr("y2",j)}},c.prototype._updateSubtotals=function(){var a=this.datasets();if(a.length>0){var b=a[a.length-1];this._subtotals=new Array,this._calculateSubtotalsAndExtent(b)}},c._BAR_DECLINE_CLASS="waterfall-decline",c._BAR_GROWTH_CLASS="waterfall-growth",c._BAR_TOTAL_CLASS="waterfall-total",c._CONNECTOR_CLASS="connector",c._CONNECTOR_AREA_CLASS="connector-area",c._TOTAL_KEY="total",c}(b.Bar);b.Waterfall=c}(b=a.Plots||(a.Plots={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.totalTime=function(a){return 0},a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(b=a.Animators||(a.Animators={}))}(c||(c={}));var c;!function(a){var b;!function(a){var b=function(){function a(){this._startDelay=a._DEFAULT_START_DELAY_MILLISECONDS,this._stepDuration=a._DEFAULT_STEP_DURATION_MILLISECONDS,this._stepDelay=a._DEFAULT_ITERATIVE_DELAY_MILLISECONDS,this._maxTotalDuration=a._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS,this._easingMode=a._DEFAULT_EASING_MODE}return a.prototype.totalTime=function(a){var b=this._getAdjustedIterativeDelay(a);return this.startDelay()+b*Math.max(a-1,0)+this.stepDuration()},a.prototype.animate=function(a,b){var c=this,d=a[0].length,e=this._getAdjustedIterativeDelay(d);return a.transition().ease(this.easingMode()).duration(this.stepDuration()).delay(function(a,b){return c.startDelay()+e*b}).attr(b)},a.prototype.startDelay=function(a){return null==a?this._startDelay:(this._startDelay=a,this)},a.prototype.stepDuration=function(a){return null==a?Math.min(this._stepDuration,this._maxTotalDuration):(this._stepDuration=a,this)},a.prototype.stepDelay=function(a){return null==a?this._stepDelay:(this._stepDelay=a,this)},a.prototype.maxTotalDuration=function(a){return null==a?this._maxTotalDuration:(this._maxTotalDuration=a,this)},a.prototype.easingMode=function(a){return null==a?this._easingMode:(this._easingMode=a,this)},a.prototype._getAdjustedIterativeDelay=function(a){var b=this.maxTotalDuration()-this.stepDuration();b=Math.max(b,0);var c=b/Math.max(a-1,1);return Math.min(this.stepDelay(),c)},a._DEFAULT_START_DELAY_MILLISECONDS=0,a._DEFAULT_STEP_DURATION_MILLISECONDS=300,a._DEFAULT_ITERATIVE_DELAY_MILLISECONDS=15,a._DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS=1/0,a._DEFAULT_EASING_MODE="exp-out",a}();a.Easing=b}(b=a.Animators||(a.Animators={}))}(c||(c={}));var c;!function(a){var b=function(){function b(){this._eventToProcessingFunction={},this._eventNameToCallbackSet={},this._connected=!1}return b.prototype._hasNoCallbacks=function(){for(var a=Object.keys(this._eventNameToCallbackSet),b=0;b0&&this._callCallbacksForEvent(b,f,e,a)}},c.prototype.eventInsideSVG=function(a){return this._translator.insideSVG(a)},c._DISPATCHER_KEY="__Plottable_Dispatcher_Touch",c._TOUCHSTART_EVENT_NAME="touchstart",c._TOUCHMOVE_EVENT_NAME="touchmove",c._TOUCHEND_EVENT_NAME="touchend",c._TOUCHCANCEL_EVENT_NAME="touchcancel",c}(a.Dispatcher);b.Touch=c}(b=a.Dispatchers||(a.Dispatchers={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(a){function b(){var c=this;a.call(this),this._eventToProcessingFunction[b._KEYDOWN_EVENT_NAME]=function(a){return c._processKeydown(a)},this._eventToProcessingFunction[b._KEYUP_EVENT_NAME]=function(a){return c._processKeyup(a)}}return d(b,a),b.getDispatcher=function(){var a=document[b._DISPATCHER_KEY];return null==a&&(a=new b,document[b._DISPATCHER_KEY]=a),a},b.prototype._processKeydown=function(a){this._callCallbacksForEvent(b._KEYDOWN_EVENT_NAME,a.keyCode,a)},b.prototype._processKeyup=function(a){this._callCallbacksForEvent(b._KEYUP_EVENT_NAME,a.keyCode,a)},b.prototype.onKeyDown=function(a){return this._addCallbackForEvent(b._KEYDOWN_EVENT_NAME,a),this},b.prototype.offKeyDown=function(a){return this._removeCallbackForEvent(b._KEYDOWN_EVENT_NAME,a),this},b.prototype.onKeyUp=function(a){return this._addCallbackForEvent(b._KEYUP_EVENT_NAME,a),this},b.prototype.offKeyUp=function(a){return this._removeCallbackForEvent(b._KEYUP_EVENT_NAME,a),this},b._DISPATCHER_KEY="__Plottable_Dispatcher_Key",b._KEYDOWN_EVENT_NAME="keydown",b._KEYUP_EVENT_NAME="keyup",b}(a.Dispatcher);b.Key=c}(b=a.Dispatchers||(a.Dispatchers={}))}(c||(c={}));var c;!function(a){var b=function(){function a(){var a=this;this._anchorCallback=function(b){return a._anchor(b)},this._enabled=!0}return a.prototype._anchor=function(a){this._isAnchored=!0},a.prototype._unanchor=function(){this._isAnchored=!1},a.prototype.attachTo=function(a){return this._disconnect(),this._componentAttachedTo=a,this._connect(),this},a.prototype._connect=function(){this.enabled()&&null!=this._componentAttachedTo&&!this._isAnchored&&this._componentAttachedTo.onAnchor(this._anchorCallback)},a.prototype.detachFrom=function(a){return this._disconnect(),this._componentAttachedTo=null,this},a.prototype._disconnect=function(){this._isAnchored&&this._unanchor(),null!=this._componentAttachedTo&&this._componentAttachedTo.offAnchor(this._anchorCallback)},a.prototype.enabled=function(a){return null==a?this._enabled:(this._enabled=a,this._enabled?this._connect():this._disconnect(),this)},a.prototype._translateToComponentSpace=function(a){var b=this._componentAttachedTo.originToSVG();return{x:a.x-b.x,y:a.y-b.y}},a.prototype._isInsideComponent=function(a){return 0<=a.x&&0<=a.y&&a.x<=this._componentAttachedTo.width()&&a.y<=this._componentAttachedTo.height()},a}();a.Interaction=b}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(b){function c(){var c=this;b.apply(this,arguments),this._clickedDown=!1,this._onClickCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a){return c._handleClickDown(a)},this._mouseUpCallback=function(a){return c._handleClickUp(a)},this._touchStartCallback=function(a,b){return c._handleClickDown(b[a[0]])},this._touchEndCallback=function(a,b){return c._handleClickUp(b[a[0]])},this._touchCancelCallback=function(a,b){return c._clickedDown=!1}}return d(c,b),c.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(c.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(c.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},c.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback),this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null},c.prototype._handleClickDown=function(a){var b=this._translateToComponentSpace(a);this._isInsideComponent(b)&&(this._clickedDown=!0)},c.prototype._handleClickUp=function(a){var b=this._translateToComponentSpace(a);this._clickedDown&&this._isInsideComponent(b)&&this._onClickCallbacks.callCallbacks(b),this._clickedDown=!1},c.prototype.onClick=function(a){return this._onClickCallbacks.add(a),this},c.prototype.offClick=function(a){return this._onClickCallbacks["delete"](a),this},c}(a.Interaction);b.Click=c}(b=a.Interactions||(a.Interactions={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c;!function(a){a[a.NotClicked=0]="NotClicked",a[a.SingleClicked=1]="SingleClicked",a[a.DoubleClicked=2]="DoubleClicked"}(c||(c={}));var e=function(b){function e(){var d=this;b.apply(this,arguments),this._clickState=c.NotClicked,this._clickedDown=!1,this._onDoubleClickCallbacks=new a.Utils.CallbackSet,this._mouseDownCallback=function(a){return d._handleClickDown(a)},this._mouseUpCallback=function(a){return d._handleClickUp(a)},this._dblClickCallback=function(a){return d._handleDblClick()},this._touchStartCallback=function(a,b){return d._handleClickDown(b[a[0]])},this._touchEndCallback=function(a,b){return d._handleClickUp(b[a[0]])},this._touchCancelCallback=function(a,b){return d._handleClickCancel()}}return d(e,b),e.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(c.content().node()),this._mouseDispatcher.onMouseDown(this._mouseDownCallback),this._mouseDispatcher.onMouseUp(this._mouseUpCallback),this._mouseDispatcher.onDblClick(this._dblClickCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(c.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},e.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._mouseDispatcher.offMouseDown(this._mouseDownCallback), +this._mouseDispatcher.offMouseUp(this._mouseUpCallback),this._mouseDispatcher.offDblClick(this._dblClickCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null},e.prototype._handleClickDown=function(a){var b=this._translateToComponentSpace(a);this._isInsideComponent(b)&&(this._clickState===c.SingleClicked&&e._pointsEqual(b,this._clickedPoint)||(this._clickState=c.NotClicked),this._clickedPoint=b,this._clickedDown=!0)},e.prototype._handleClickUp=function(a){var b=this._translateToComponentSpace(a);this._clickedDown&&e._pointsEqual(b,this._clickedPoint)?this._clickState=this._clickState===c.NotClicked?c.SingleClicked:c.DoubleClicked:this._clickState=c.NotClicked,this._clickedDown=!1},e.prototype._handleDblClick=function(){this._clickState===c.DoubleClicked&&(this._onDoubleClickCallbacks.callCallbacks(this._clickedPoint),this._clickState=c.NotClicked)},e.prototype._handleClickCancel=function(){this._clickState=c.NotClicked,this._clickedDown=!1},e._pointsEqual=function(a,b){return a.x===b.x&&a.y===b.y},e.prototype.onDoubleClick=function(a){return this._onDoubleClickCallbacks.add(a),this},e.prototype.offDoubleClick=function(a){return this._onDoubleClickCallbacks["delete"](a),this},e}(a.Interaction);b.DoubleClick=e}(b=a.Interactions||(a.Interactions={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(b){function c(){var c=this;b.apply(this,arguments),this._keyPressCallbacks={},this._keyReleaseCallbacks={},this._mouseMoveCallback=function(a){return!1},this._downedKeys=new a.Utils.Set,this._keyDownCallback=function(a,b){return c._handleKeyDownEvent(a,b)},this._keyUpCallback=function(a){return c._handleKeyUpEvent(a)}}return d(c,b),c.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._positionDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo._element.node()),this._positionDispatcher.onMouseMove(this._mouseMoveCallback),this._keyDispatcher=a.Dispatchers.Key.getDispatcher(),this._keyDispatcher.onKeyDown(this._keyDownCallback),this._keyDispatcher.onKeyUp(this._keyUpCallback)},c.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._positionDispatcher.offMouseMove(this._mouseMoveCallback),this._positionDispatcher=null,this._keyDispatcher.offKeyDown(this._keyDownCallback),this._keyDispatcher.offKeyUp(this._keyUpCallback),this._keyDispatcher=null},c.prototype._handleKeyDownEvent=function(a,b){var c=this._translateToComponentSpace(this._positionDispatcher.lastMousePosition());this._isInsideComponent(c)&&!b.repeat&&(this._keyPressCallbacks[a]&&this._keyPressCallbacks[a].callCallbacks(a),this._downedKeys.add(a))},c.prototype._handleKeyUpEvent=function(a){this._downedKeys.has(a)&&this._keyReleaseCallbacks[a]&&this._keyReleaseCallbacks[a].callCallbacks(a),this._downedKeys["delete"](a)},c.prototype.onKeyPress=function(b,c){return this._keyPressCallbacks[b]||(this._keyPressCallbacks[b]=new a.Utils.CallbackSet),this._keyPressCallbacks[b].add(c),this},c.prototype.offKeyPress=function(a,b){return this._keyPressCallbacks[a]["delete"](b),0===this._keyPressCallbacks[a].size&&delete this._keyPressCallbacks[a],this},c.prototype.onKeyRelease=function(b,c){return this._keyReleaseCallbacks[b]||(this._keyReleaseCallbacks[b]=new a.Utils.CallbackSet),this._keyReleaseCallbacks[b].add(c),this},c.prototype.offKeyRelease=function(a,b){return this._keyReleaseCallbacks[a]["delete"](b),0===this._keyReleaseCallbacks[a].size&&delete this._keyReleaseCallbacks[a],this},c}(a.Interaction);b.Key=c}(b=a.Interactions||(a.Interactions={}))}(c||(c={}));var c;!function(a){var b;!function(b){var c=function(b){function c(){var c=this;b.apply(this,arguments),this._overComponent=!1,this._pointerEnterCallbacks=new a.Utils.CallbackSet,this._pointerMoveCallbacks=new a.Utils.CallbackSet,this._pointerExitCallbacks=new a.Utils.CallbackSet,this._mouseMoveCallback=function(a,b){return c._handleMouseEvent(a,b)},this._touchStartCallback=function(a,b,d){return c._handleTouchEvent(b[a[0]],d)}}return d(c,b),c.prototype._anchor=function(c){b.prototype._anchor.call(this,c),this._mouseDispatcher=a.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onMouseMove(this._mouseMoveCallback),this._touchDispatcher=a.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback)},c.prototype._unanchor=function(){b.prototype._unanchor.call(this),this._mouseDispatcher.offMouseMove(this._mouseMoveCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher=null},c.prototype._handleMouseEvent=function(a,b){var c=this._mouseDispatcher.eventInsideSVG(b);this._handlePointerEvent(a,c)},c.prototype._handleTouchEvent=function(a,b){var c=this._touchDispatcher.eventInsideSVG(b);this._handlePointerEvent(a,c)},c.prototype._handlePointerEvent=function(a,b){var c=this._translateToComponentSpace(a),d=this._isInsideComponent(c);d&&b?(this._overComponent||this._pointerEnterCallbacks.callCallbacks(c),this._pointerMoveCallbacks.callCallbacks(c)):this._overComponent&&this._pointerExitCallbacks.callCallbacks(c),this._overComponent=d&&b},c.prototype.onPointerEnter=function(a){return this._pointerEnterCallbacks.add(a),this},c.prototype.offPointerEnter=function(a){return this._pointerEnterCallbacks["delete"](a),this},c.prototype.onPointerMove=function(a){return this._pointerMoveCallbacks.add(a),this},c.prototype.offPointerMove=function(a){return this._pointerMoveCallbacks["delete"](a),this},c.prototype.onPointerExit=function(a){return this._pointerExitCallbacks.add(a),this},c.prototype.offPointerExit=function(a){return this._pointerExitCallbacks["delete"](a),this},c}(a.Interaction);b.Pointer=c}(b=a.Interactions||(a.Interactions={}))}(c||(c={}));var c;!function(b){var c;!function(c){var e=function(e){function f(d,f){var g=this;e.call(this),this._wheelCallback=function(a,b){return g._handleWheelEvent(a,b)},this._touchStartCallback=function(a,b,c){return g._handleTouchStart(a,b,c)},this._touchMoveCallback=function(a,b,c){return g._handlePinch(a,b,c)},this._touchEndCallback=function(a,b,c){return g._handleTouchEnd(a,b,c)},this._touchCancelCallback=function(a,b,c){return g._handleTouchEnd(a,b,c)},this._panEndCallbacks=new b.Utils.CallbackSet,this._zoomEndCallbacks=new b.Utils.CallbackSet,this._xScales=new b.Utils.Set,this._yScales=new b.Utils.Set,this._dragInteraction=new c.Drag,this._setupDragInteraction(),this._touchIds=a.map(),this._minDomainExtents=new b.Utils.Map,this._maxDomainExtents=new b.Utils.Map,this._minDomainValues=new b.Utils.Map,this._maxDomainValues=new b.Utils.Map,null!=d&&this.addXScale(d),null!=f&&this.addYScale(f)}return d(f,e),f.prototype._anchor=function(a){e.prototype._anchor.call(this,a),this._dragInteraction.attachTo(a),this._mouseDispatcher=b.Dispatchers.Mouse.getDispatcher(this._componentAttachedTo.content().node()),this._mouseDispatcher.onWheel(this._wheelCallback),this._touchDispatcher=b.Dispatchers.Touch.getDispatcher(this._componentAttachedTo.content().node()),this._touchDispatcher.onTouchStart(this._touchStartCallback),this._touchDispatcher.onTouchMove(this._touchMoveCallback),this._touchDispatcher.onTouchEnd(this._touchEndCallback),this._touchDispatcher.onTouchCancel(this._touchCancelCallback)},f.prototype._unanchor=function(){e.prototype._unanchor.call(this),this._mouseDispatcher.offWheel(this._wheelCallback),this._mouseDispatcher=null,this._touchDispatcher.offTouchStart(this._touchStartCallback),this._touchDispatcher.offTouchMove(this._touchMoveCallback),this._touchDispatcher.offTouchEnd(this._touchEndCallback),this._touchDispatcher.offTouchCancel(this._touchCancelCallback),this._touchDispatcher=null,this._dragInteraction.detachFrom(this._componentAttachedTo)},f.prototype._handleTouchStart=function(a,b,c){for(var d=0;d0&&this._zoomEndCallbacks.callCallbacks()},f.prototype._magnifyScale=function(a,b,c){var d=this,e=function(e){return a.invert(d._zoomAt(e,b,c))};a.domain(a.range().map(e))},f.prototype._translateScale=function(a,b){var c=function(c){return a.invert(c+b)};a.domain(a.range().map(c))},f.prototype._handleWheelEvent=function(a,b){var c=this,d=this._translateToComponentSpace(a);if(this._isInsideComponent(d)){b.preventDefault();var e=b.deltaY*(b.deltaMode?f._PIXELS_PER_LINE:1),g=Math.pow(2,.002*e),h=d.x,i=d.y;this.xScales().forEach(function(a){var b=c._constrainedZoom(a,g,h);h=b.centerPoint,g=b.zoomAmount}),this.yScales().forEach(function(a){var b=c._constrainedZoom(a,g,i);i=b.centerPoint,g=b.zoomAmount}),this.xScales().forEach(function(a){c._magnifyScale(a,g,h)}),this.yScales().forEach(function(a){c._magnifyScale(a,g,i)}),this._zoomEndCallbacks.callCallbacks()}},f.prototype._constrainedZoom=function(a,b,c){return b=this._constrainZoomExtents(a,b),this._constrainZoomValues(a,b,c)},f.prototype._constrainZoomExtents=function(a,b){var c=b>1,d=c?this.maxDomainExtent(a):this.minDomainExtent(a);if(null==d)return b;var e=a.domain(),f=Math.abs(e[1]-e[0]),g=c?Math.min:Math.max;return g(b,d/f)},f.prototype._constrainZoomValues=function(a,b,c){if(b<=1)return{centerPoint:c,zoomAmount:b};var d=this.minDomainValue(a),e=this.maxDomainValue(a);if(null==d&&null==e)return{centerPoint:c,zoomAmount:b};var f=a.domain(),g=f[0],h=f[1];if(null!=e){var i=a.scale(e),j=a.scale(h),k=this._zoomAt(j,b,c);k>i&&(c=this._getZoomCenterForTarget(j,b,i))}if(null!=d){var l=a.scale(d),m=a.scale(g),n=this._zoomAt(m,b,c);ni||n=2)){var e=(null==b?c.x:b.x)-d.x;a.xScales().forEach(function(b){a._translateScale(b,a._constrainedTranslation(b,e))});var f=(null==b?c.y:b.y)-d.y;a.yScales().forEach(function(b){a._translateScale(b,a._constrainedTranslation(b,f))}),b=d}}),this._dragInteraction.onDragEnd(function(){return a._panEndCallbacks.callCallbacks()})},f.prototype._constrainedTranslation=function(a,b){var c=a.domain(),d=c[0],e=c[1];if(b>0){var f=this.maxDomainValue(a);if(null!=f){var g=a.scale(e),h=a.scale(f);b=Math.min(g+b,h)-g}}else{var f=this.minDomainValue(a);if(null!=f){var i=a.scale(d),j=a.scale(f);b=Math.max(i+b,j)-i}}return b},f.prototype._nonLinearScaleWithExtents=function(a){return!(null==this.minDomainExtent(a)||null==this.maxDomainExtent(a)||a instanceof b.Scales.Linear||a instanceof b.Scales.Time)},f.prototype.xScales=function(a){var c=this;if(null==a){var d=[];return this._xScales.forEach(function(a){d.push(a)}),d}return this._xScales=new b.Utils.Set,a.forEach(function(a){c.addXScale(a)}),this},f.prototype.yScales=function(a){var c=this;if(null==a){var d=[];return this._yScales.forEach(function(a){d.push(a)}),d}return this._yScales=new b.Utils.Set,a.forEach(function(a){c.addYScale(a)}),this},f.prototype.addXScale=function(a){return this._xScales.add(a),this},f.prototype.removeXScale=function(a){return this._xScales["delete"](a),this._minDomainExtents["delete"](a),this._maxDomainExtents["delete"](a),this._minDomainValues["delete"](a),this._maxDomainValues["delete"](a),this},f.prototype.addYScale=function(a){return this._yScales.add(a),this},f.prototype.removeYScale=function(a){return this._yScales["delete"](a),this._minDomainExtents["delete"](a),this._maxDomainExtents["delete"](a),this._minDomainValues["delete"](a),this._maxDomainValues["delete"](a),this},f.prototype.minDomainExtent=function(a,c){if(null==c)return this._minDomainExtents.get(a);if(c.valueOf()<0)throw new Error("extent must be non-negative");var d=this.maxDomainExtent(a);if(null!=d&&d.valueOf()