diff --git a/bower.json b/bower.json index 6e2bcc3a7e..7cb095b064 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "plottable", "description": "A library for creating charts out of D3", - "version": "0.19.3", + "version": "0.20.0", "main": ["plottable.js", "plottable.css"], "license": "MIT", "ignore": [ diff --git a/package.json b/package.json index f421661612..e2faa18da1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plottable.js", - "version": "0.19.3", + "version": "0.20.0", "description": "Build flexible, performant, interactive charts using D3", "repository": { "type": "git", diff --git a/plottable.d.ts b/plottable.d.ts index 7ed29322f7..97ce1ddabc 100644 --- a/plottable.d.ts +++ b/plottable.d.ts @@ -1747,25 +1747,25 @@ declare module Plottable { * Creates a Label. * * @constructor - * @param {string} [text] The text of the Label. + * @param {string} [displayText] The text of the Label. * @param {string} [orientation] The orientation of the Label (horizontal/vertical-left/vertical-right). */ - constructor(inputText?: string, orientation?: string); + constructor(displayText?: string, orientation?: string); public xAlign(alignment: string): Label; public yAlign(alignment: string): Label; /** - * Sets the text on the Label. - * - * @param {string} text The new text for the Label. - * @returns {Label} The calling Label. - */ - public text(inputText: string): Label; - /** * Retrieve the current text on the Label. * * @returns {string} The text on the label. */ public text(): string; + /** + * Sets the text on the Label. + * + * @param {string} displayText The new text for the Label. + * @returns {Label} The calling Label. + */ + public text(displayText: string): Label; } class TitleLabel extends Label { constructor(text?: string, orientation?: string); diff --git a/plottable.js b/plottable.js index 64aa133c5a..e12b645b95 100644 --- a/plottable.js +++ b/plottable.js @@ -1,5 +1,5 @@ /*! -Plottable 0.19.3 (https://github.com/palantir/plottable) +Plottable 0.20.0 (https://github.com/palantir/plottable) Copyright 2014 Palantir Technologies Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE) */ @@ -1465,7 +1465,7 @@ var Plottable; /// var Plottable; (function (Plottable) { - Plottable.version = "0.19.3"; + Plottable.version = "0.20.0"; })(Plottable || (Plottable = {})); /// @@ -4894,15 +4894,15 @@ var Plottable; * Creates a Label. * * @constructor - * @param {string} [text] The text of the Label. + * @param {string} [displayText] The text of the Label. * @param {string} [orientation] The orientation of the Label (horizontal/vertical-left/vertical-right). */ - function Label(inputText, orientation) { - if (typeof inputText === "undefined") { inputText = ""; } + function Label(displayText, orientation) { + if (typeof displayText === "undefined") { displayText = ""; } if (typeof orientation === "undefined") { orientation = "horizontal"; } _super.call(this); this.classed("label", true); - this.text(inputText); + this.text(displayText); orientation = orientation.toLowerCase(); if (orientation === "vertical-left") { orientation = "left"; @@ -4951,11 +4951,11 @@ var Plottable; return this; }; - Label.prototype.text = function (inputText) { - if (inputText === undefined) { + Label.prototype.text = function (displayText) { + if (displayText === undefined) { return this._text; } else { - this._text = inputText; + this._text = displayText; this._invalidateLayout(); return this; } diff --git a/plottable.min.js b/plottable.min.js index e117268297..340d6f2d7f 100644 --- a/plottable.min.js +++ b/plottable.min.js @@ -1,4 +1,4 @@ -var Plottable;!function(a){!function(a){!function(a){function b(a,b,c){return Math.min(b,c)<=a&&a<=Math.max(b,c)}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(a,b){var c=d3.set();return a.forEach(function(a){b.has(a)&&c.add(a)}),c}function e(a){return"function"==typeof a?a:"string"==typeof a&&"#"!==a[0]?function(b){return b[a]}:function(){return a}}function f(a,b){var c=e(a);return function(a,d){return c(a,d,b.metadata())}}function g(a){var b={};return a.forEach(function(a){return b[a]=!0}),d3.keys(b)}function h(a,b){for(var c=[],d=0;b>d;d++)c[d]="function"==typeof a?a(d):a;return c}function i(a){return Array.prototype.concat.apply([],a)}function j(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;cd;){var f=d+e>>>1,g=null==c?b[f]:c(b[f]);a>g?d=f+1:e=f}return d}a.sortedIndex=b}(a.OpenSource||(a.OpenSource={}));a.OpenSource}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this.counter={}}return a.prototype.setDefault=function(a){null==this.counter[a]&&(this.counter[a]=0)},a.prototype.increment=function(a){return this.setDefault(a),++this.counter[a]},a.prototype.decrement=function(a){return this.setDefault(a),--this.counter[a]},a.prototype.get=function(a){return this.setDefault(a),this.counter[a]},a}();a.IDCounter=b}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this.keyValuePairs=[]}return a.prototype.set=function(a,b){if(a!==a)throw new Error("NaN may not be used as a key to the StrictEqualityAssociativeArray");for(var c=0;cb){var h=e("."),i=Math.floor(b/h);return"...".substr(0,i)}for(;f+g>b;)d=d.substr(0,d.length-1).trim(),f=e(d);if(e(d+"...")>b)throw new Error("addEllipsesToLine failed :(");return d+"..."}function k(b,c,d,e,f,g){"undefined"==typeof f&&(f="left"),"undefined"==typeof g&&(g="top");var h={left:0,center:.5,right:1},i={top:0,center:.5,bottom:1};if(void 0===h[f]||void 0===i[g])throw new Error("unrecognized alignment x:"+f+", y:"+g);var j=c.append("g"),k=j.append("text");k.text(b);var l=a.DOM.getBBox(k),m=l.height,n=l.width;if(n>d||m>e)return console.log("Insufficient space to fit text"),[0,0];var o={left:"start",center:"middle",right:"end"},p=o[f],q=d*h[f],r=e*i[g]+m*(1-i[g]),s=-.4*(1-i[g]);return k.attr("text-anchor",p).attr("y",s+"em"),a.DOM.translate(j,q,r),[n,m]}function l(a,b,c,d,e,f,g){if("undefined"==typeof e&&(e="left"),"undefined"==typeof f&&(f="top"),"undefined"==typeof g&&(g="right"),"right"!==g&&"left"!==g)throw new Error("unrecognized rotation: "+g);var h="right"===g,i={left:"bottom",right:"top",center:"center",top:"left",bottom:"right"},j={left:"top",right:"bottom",center:"center",top:"right",bottom:"left"},l=h?i:j,m=b.append("g"),n=k(a,m,d,c,l[f],l[e]),o=d3.transform("");return o.rotate="right"===g?90:-90,o.translate=[h?c:0,h?0:d],m.attr("transform",o.toString()),[n[1],n[0]]}function m(b,c,d,e,f,g){"undefined"==typeof f&&(f="left"),"undefined"==typeof g&&(g="top");var i=h(c),j=0,l=c.append("g");b.forEach(function(b,c){var e=l.append("g");a.DOM.translate(e,0,c*i);var h=k(b,e,d,i,f,g);h[0]>j&&(j=h[0])});var m=i*b.length,n=e-m,o={center:.5,top:0,bottom:1};return a.DOM.translate(l,0,n*o[g]),[j,m]}function n(b,c,d,e,f,g,i){"undefined"==typeof f&&(f="left"),"undefined"==typeof g&&(g="top"),"undefined"==typeof i&&(i="left");var j=h(c),k=0,m=c.append("g");b.forEach(function(b,c){var d=m.append("g");a.DOM.translate(d,c*j,0);var h=l(b,d,j,e,f,g,i);h[1]>k&&(k=h[1])});var n=j*b.length,o=d-n,p={center:.5,left:0,right:1};return a.DOM.translate(m,o*p[f],0),[n,k]}function o(b,c,d,e,f,g){var h,i,j=null!=f?f:1.1*c>d,k=j?c:d,l=j?d:c,o=a.WordWrap.breakTextToFitRect(b,k,l,e);if(null==g){var p=j?d3.max:d3.sum,q=j?d3.sum:d3.max;h=p(o.lines,function(a){return e(a)[0]}),i=q(o.lines,function(a){return e(a)[1]})}else{var r=g.g.append("g").classed("writeText-inner-g",!0),s=j?m:n,t=s(o.lines,r,c,d,g.xAlign,g.yAlign);h=t[0],i=t[1]}return{textFits:o.textFits,usedWidth:h,usedHeight:i}}b.getTextMeasure=c;var p="a",q=function(){function b(b){var g=this;this.cache=new a.Cache(c(b),p,a.Methods.arrayEq),this.measure=d(e(f(function(a){return g.cache.get(a)})))}return b.prototype.clear=function(){return this.cache.clear(),this},b}();b.CachingCharacterMeasurer=q,b.getTruncatedText=g,b.getTextHeight=h,b.getTextWidth=i,b.addEllipsesToLine=j,b.writeLineHorizontally=k,b.writeLineVertically=l,b.writeTextHorizontally=m,b.writeTextVertically=n,b.writeText=o}(a.Text||(a.Text={}));a.Text}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(b){function c(b,c,e,f){var g=function(a){return f(a)[0]},h=d(b,c,g),i=f("hello world")[1],j=Math.floor(e/i),k=j>=h.length;return k||(h=h.splice(0,j),j>0&&(h[j-1]=a.Text.addEllipsesToLine(h[j-1],c,f))),{originalText:b,lines:h,textFits:k}}function d(a,b,c){for(var d=[],e=a.split("\n"),g=0,h=e.length;h>g;g++){var i=e[g];null!==i?d=d.concat(f(i,b,c)):d.push("")}return d}function e(a,b,c){var d=h(a),e=d.map(c),f=d3.max(e);return b>=f}function f(a,b,c){for(var d,e=[],f=h(a),i="",j=0;d||je;e++){var g=a[e];""===c||j(c[0],g,d)?c+=g:(b.push(c),c=g),d=g}return c&&b.push(c),b}function i(a){return null==a?!0:""===a.trim()}function j(a,b,c){return m.test(a)&&m.test(b)?!0:m.test(a)||m.test(b)?!1:l.test(c)||k.test(b)?!1:!0}var k=/[{\[]/,l=/[!"%),-.:;?\]}]/,m=/^\s+$/;b.breakTextToFitRect=c,b.breakTextToFitWidth=d,b.canWrapWithoutBreakingWords=e}(a.WordWrap||(a.WordWrap={}));a.WordWrap}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(a){return a.node().getBBox()}function c(b){null!=window.requestAnimationFrame?window.requestAnimationFrame(b):setTimeout(b,a.POLYFILL_TIMEOUT_MSEC)}function d(a,b){var c=a.getPropertyValue(b);return null==c?0:parseFloat(c)}function e(a){for(var b=a.node();null!==b&&"svg"!==b.nodeName;)b=b.parentNode;return null==b}function f(a){var b=window.getComputedStyle(a);return d(b,"width")+d(b,"padding-left")+d(b,"padding-right")+d(b,"border-left-width")+d(b,"border-right-width")}function g(a){var b=window.getComputedStyle(a);return d(b,"height")+d(b,"padding-top")+d(b,"padding-bottom")+d(b,"border-top-width")+d(b,"border-bottom-width")}function h(a){var b=a.node().clientWidth;if(0===b){var c=a.attr("width");if(-1!==c.indexOf("%")){for(var d=a.node().parentNode;null!=d&&0===d.clientWidth;)d=d.parentNode;if(null==d)throw new Error("Could not compute width of element");b=d.clientWidth*parseFloat(c)/100}else b=parseFloat(c)}return b}function i(a,b,c){var d=d3.transform(a.attr("transform"));return null==b?d.translate:(c=null==c?0:c,d.translate[0]=b,d.translate[1]=c,a.attr("transform",d.toString()),a)}a.getBBox=b,a.POLYFILL_TIMEOUT_MSEC=1e3/60,a.requestAnimationFramePolyfill=c,a.isSelectionRemovedFromSVG=e,a.getElementWidth=f,a.getElementHeight=g,a.getSVGPixelWidth=h,a.translate=i}(a.DOM||(a.DOM={}));a.DOM}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(a){this._onlyShowUnchanged=!0,this.precision(a)}return a.prototype.format=function(a){var b=this._formatFunction(a);return this._onlyShowUnchanged&&this._valueChanged(a,b)?"":b},a.prototype._valueChanged=function(a,b){return a!==parseFloat(b)},a.prototype.precision=function(a){if(void 0===a)return this._precision;if(0>a||a>20)throw new RangeError("Formatter precision must be between 0 and 20");return this._precision=a,this},a.prototype.showOnlyUnchangedValues=function(a){return void 0===a?this._onlyShowUnchanged:(this._onlyShowUnchanged=a,this)},a}();a.Formatter=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(){a.call(this,null),this.showOnlyUnchangedValues(!1),this._formatFunction=function(a){return String(a)}}return __extends(b,a),b}(a.Abstract.Formatter);b.Identity=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=3),a.call(this,b),this._formatFunction=function(a){if("number"==typeof a){var b=Math.pow(10,this._precision);return String(Math.round(a*b)/b)}return String(a)}}return __extends(b,a),b.prototype._valueChanged=function(a,b){return"number"==typeof a?a!==parseFloat(b):!1},b}(a.Abstract.Formatter);b.General=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=3),a.call(this,b),this._formatFunction=function(a){return a.toFixed(this._precision)}}return __extends(b,a),b}(a.Abstract.Formatter);b.Fixed=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(b,c,d){"undefined"==typeof b&&(b=2),"undefined"==typeof c&&(c="$"),"undefined"==typeof d&&(d=!0),a.call(this,b),this.symbol=c,this.prefix=d}return __extends(b,a),b.prototype.format=function(b){var c=a.prototype.format.call(this,Math.abs(b));return""!==c&&(this.prefix?c=this.symbol+c:c+=this.symbol,0>b&&(c="-"+c)),c},b}(a.Fixed);a.Currency=b}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(b){"undefined"==typeof b&&(b=0),a.call(this,b)}return __extends(b,a),b.prototype.format=function(b){var c=a.prototype.format.call(this,100*b);return""!==c&&(c+="%"),c},b}(a.Fixed);a.Percentage=b}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=3),a.call(this,b),this.showOnlyUnchangedValues(!1)}return __extends(b,a),b.prototype.precision=function(b){var c=a.prototype.precision.call(this,b);return this._formatFunction=d3.format("."+this._precision+"s"),c},b}(a.Abstract.Formatter);b.SISuffix=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c){a.call(this,b),this._onlyShowUnchanged=!1,this._formatFunction=function(a){return c(a,this)}}return __extends(b,a),b}(a.Abstract.Formatter);b.Custom=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(){a.call(this,null);var b=8,c={};c[0]={format:".%L",filter:function(a){return 0!==a.getMilliseconds()}},c[1]={format:":%S",filter:function(a){return 0!==a.getSeconds()}},c[2]={format:"%I:%M",filter:function(a){return 0!==a.getMinutes()}},c[3]={format:"%I %p",filter:function(a){return 0!==a.getHours()}},c[4]={format:"%a %d",filter:function(a){return 0!==a.getDay()&&1!==a.getDate()}},c[5]={format:"%b %d",filter:function(a){return 1!==a.getDate()}},c[6]={format:"%b",filter:function(a){return 0!==a.getMonth()}},c[7]={format:"%Y",filter:function(){return!0}},this._formatFunction=function(a){for(var d=0;b>d;d++)if(c[d].filter(a))return d3.time.format(c[d].format)(a)},this.showOnlyUnchangedValues(!1)}return __extends(b,a),b}(a.Abstract.Formatter);b.Time=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this._plottableID=a.nextID++}return a.nextID=0,a}();a.PlottableObject=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this),this.listener2Callback=new a.Util.StrictEqualityAssociativeArray,this.listenable=c}return __extends(c,b),c.prototype.registerListener=function(a,b){return this.listener2Callback.set(a,b),this},c.prototype.broadcast=function(){for(var a=this,b=[],c=0;c=0&&(this._components.splice(b,1),this._invalidateLayout()),this},b.prototype._addComponent=function(a,b){return"undefined"==typeof b&&(b=!1),null==a||this._components.indexOf(a)>=0?!1:(b?this._components.unshift(a):this._components.push(a),a._parent=this,this._isAnchored&&a._anchor(this.content),this._invalidateLayout(),!0)},b.prototype.components=function(){return this._components.slice()},b.prototype.empty=function(){return 0===this._components.length},b.prototype.removeAll=function(){return this._components.slice().forEach(function(a){return a.remove()}),this},b}(a.Component);a.ComponentContainer=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=[]);var c=this;a.call(this),this.classed("component-group",!0),b.forEach(function(a){return c._addComponent(a)})}return __extends(b,a),b.prototype._requestedSpace=function(a,b){var c=this._components.map(function(c){return c._requestedSpace(a,b)}),d=this.empty(),e=d?0:d3.max(c,function(a){return a.width}),f=d?0:d3.max(c,function(a){return a.height});return{width:Math.min(e,a),height:Math.min(f,b),wantsWidth:d?!1:c.map(function(a){return a.wantsWidth}).some(function(a){return a}),wantsHeight:d?!1:c.map(function(a){return a.wantsHeight}).some(function(a){return a})}},b.prototype.merge=function(a){return this._addComponent(a),this},b.prototype._computeLayout=function(b,c,d,e){var f=this;return a.prototype._computeLayout.call(this,b,c,d,e),this._components.forEach(function(a){a._computeLayout(0,0,f.availableWidth,f.availableHeight)}),this},b.prototype._isFixedWidth=function(){return this._components.every(function(a){return a._isFixedWidth()})},b.prototype._isFixedHeight=function(){return this._components.every(function(a){return a._isFixedHeight()})},b}(a.Abstract.ComponentContainer);b.Group=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){"undefined"==typeof a&&(a=[]);var c=this;b.call(this),this.rowPadding=0,this.colPadding=0,this.rows=[],this.rowWeights=[],this.colWeights=[],this.nRows=0,this.nCols=0,this.classed("table",!0),a.forEach(function(a,b){a.forEach(function(a,d){c.addComponent(b,d,a)})})}return __extends(c,b),c.prototype.addComponent=function(a,b,c){if(this._addComponent(c)){this.nRows=Math.max(a+1,this.nRows),this.nCols=Math.max(b+1,this.nCols),this.padTableToSize(this.nRows,this.nCols);var d=this.rows[a][b];if(null!=d)throw new Error("Table.addComponent cannot be called on a cell where a component already exists (for the moment)");this.rows[a][b]=c}return this},c.prototype._removeComponent=function(a){b.prototype._removeComponent.call(this,a);var c,d;a:for(var e=0;e0&&v&&e!==x,C=f>0&&w&&f!==y;if(!B&&!C)break;if(r>5)break}return e=h-d3.sum(u.guaranteedWidths),f=i-d3.sum(u.guaranteedHeights),n=c.calcProportionalSpace(k,e),o=c.calcProportionalSpace(j,f),{colProportionalSpace:n,rowProportionalSpace:o,guaranteedWidths:u.guaranteedWidths,guaranteedHeights:u.guaranteedHeights,wantsWidth:v,wantsHeight:w}},c.prototype.determineGuarantees=function(b,c){var d=a.Util.Methods.createFilledArray(0,this.nCols),e=a.Util.Methods.createFilledArray(0,this.nRows),f=a.Util.Methods.createFilledArray(!1,this.nCols),g=a.Util.Methods.createFilledArray(!1,this.nRows);return this.rows.forEach(function(a,h){a.forEach(function(a,i){var j;j=null!=a?a._requestedSpace(b[i],c[h]):{width:0,height:0,wantsWidth:!1,wantsHeight:!1};var k=.001,l=function(a,b){return a-b-k>0};(l(j.width,b[i])||l(j.height,c[h]))&&console.log("Invariant Violation: Abstract.Component cannot request more space than is offered"),d[i]=Math.max(d[i],j.width),e[h]=Math.max(e[h],j.height),f[i]=f[i]||j.wantsWidth,g[h]=g[h]||j.wantsHeight})}),{guaranteedWidths:d,guaranteedHeights:e,wantsWidthArr:f,wantsHeightArr:g}},c.prototype._requestedSpace=function(a,b){var c=this.iterateLayout(a,b);return{width:d3.sum(c.guaranteedWidths),height:d3.sum(c.guaranteedHeights),wantsWidth:c.wantsWidth,wantsHeight:c.wantsHeight}},c.prototype._computeLayout=function(c,d,e,f){var g=this;b.prototype._computeLayout.call(this,c,d,e,f);var h=this.iterateLayout(this.availableWidth,this.availableHeight),i=a.Util.Methods.addArrays(h.rowProportionalSpace,h.guaranteedHeights),j=a.Util.Methods.addArrays(h.colProportionalSpace,h.guaranteedWidths),k=0;return this.rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a._computeLayout(c,k,j[d],i[b]),c+=j[d]+g.colPadding}),k+=i[b]+g.rowPadding}),this},c.prototype.padding=function(a,b){return this.rowPadding=a,this.colPadding=b,this._invalidateLayout(),this},c.prototype.rowWeight=function(a,b){return this.rowWeights[a]=b,this._invalidateLayout(),this},c.prototype.colWeight=function(a,b){return this.colWeights[a]=b,this._invalidateLayout(),this},c.prototype._isFixedWidth=function(){var a=d3.transpose(this.rows); -return c.fixedSpace(a,function(a){return null==a||a._isFixedWidth()})},c.prototype._isFixedHeight=function(){return c.fixedSpace(this.rows,function(a){return null==a||a._isFixedHeight()})},c.prototype.padTableToSize=function(a,b){for(var c=0;a>c;c++){void 0===this.rows[c]&&(this.rows[c]=[],this.rowWeights[c]=null);for(var d=0;b>d;d++)void 0===this.rows[c][d]&&(this.rows[c][d]=null)}for(d=0;b>d;d++)void 0===this.colWeights[d]&&(this.colWeights[d]=null)},c.calcComponentWeights=function(a,b,c){return a.map(function(a,d){if(null!=a)return a;var e=b[d].map(c),f=e.reduce(function(a,b){return a&&b},!0);return f?0:1})},c.calcProportionalSpace=function(b,c){var d=d3.sum(b);return 0===d?a.Util.Methods.createFilledArray(0,b.length):b.map(function(a){return c*a/d})},c.fixedSpace=function(a,b){var c=function(a){return a.reduce(function(a,b){return a&&b},!0)},d=function(a){return c(a.map(b))};return c(a.map(d))},c}(a.Abstract.ComponentContainer);b.Table=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this),this.autoDomainAutomatically=!0,this.broadcaster=new a.Core.Broadcaster(this),this._rendererAttrID2Extent={},this._d3Scale=c}return __extends(c,b),c.prototype._getAllExtents=function(){return d3.values(this._rendererAttrID2Extent)},c.prototype._getExtent=function(){return[]},c.prototype.autoDomain=function(){return this.autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},c.prototype._autoDomainIfAutomaticMode=function(){this.autoDomainAutomatically&&this.autoDomain()},c.prototype.scale=function(a){return this._d3Scale(a)},c.prototype.domain=function(a){return null==a?this._d3Scale.domain():(this.autoDomainAutomatically=!1,this._setDomain(a),this)},c.prototype._setDomain=function(a){if(1/0===a[0]||a[0]===-1/0||1/0===a[1]||a[1]===-1/0)throw new Error("data cannot contain Infinity or -Infinity");this._d3Scale.domain(a),this.broadcaster.broadcast()},c.prototype.range=function(a){return null==a?this._d3Scale.range():(this._d3Scale.range(a),this)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.updateExtent=function(a,b,c){return this._rendererAttrID2Extent[a+b]=c,this._autoDomainIfAutomaticMode(),this},c.prototype.removeExtent=function(a,b){return delete this._rendererAttrID2Extent[a+b],this._autoDomainIfAutomaticMode(),this},c}(b.PlottableObject);b.Scale=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this),this._dataChanged=!1,this._animate=!1,this._animators={},this._ANIMATION_DURATION=250,this._projectors={},this.animateOnNextRender=!0,this.clipPathEnabled=!0,this.classed("renderer",!0);var d;d=null!=c?"function"==typeof c.data?c:d=new a.DataSource(c):new a.DataSource,this.dataSource(d)}return __extends(c,b),c.prototype._anchor=function(a){return b.prototype._anchor.call(this,a),this.animateOnNextRender=!0,this._dataChanged=!0,this.updateAllProjectors(),this},c.prototype.dataSource=function(a){var b=this;if(null==a)return this._dataSource;var c=this._dataSource;return null!=c&&this._dataSource.broadcaster.deregisterListener(this),this._dataSource=a,this._dataSource.broadcaster.registerListener(this,function(){return b._onDataSourceUpdate()}),this._onDataSourceUpdate(),this},c.prototype._onDataSourceUpdate=function(){this.updateAllProjectors(),this.animateOnNextRender=!0,this._dataChanged=!0,this._render()},c.prototype.project=function(a,b,c){var d=this;a=a.toLowerCase();var e=this._projectors[a],f=null!=e?e.scale:null;return null!=f&&(f.removeExtent(this._plottableID,a),f.broadcaster.deregisterListener(this)),null!=c&&c.broadcaster.registerListener(this,function(){return d._render()}),this._projectors[a]={accessor:b,scale:c},this.updateProjector(a),this._render(),this},c.prototype._generateAttrToProjector=function(){var b=this,c={};return d3.keys(this._projectors).forEach(function(d){var e=b._projectors[d],f=a.Util.Methods.applyAccessor(e.accessor,b.dataSource()),g=e.scale,h=null==g?f:function(a,b){return g.scale(f(a,b))};c[d]=h}),c},c.prototype._doRender=function(){return null!=this.element&&(this._paint(),this._dataChanged=!1,this.animateOnNextRender=!1),this},c.prototype._paint=function(){},c.prototype._setup=function(){return b.prototype._setup.call(this),this.renderArea=this.content.append("g").classed("render-area",!0),this},c.prototype.animate=function(a){return this._animate=a,this},c.prototype.remove=function(){return b.prototype.remove.call(this),this.updateAllProjectors(),this},c.prototype.updateAllProjectors=function(){var a=this;return d3.keys(this._projectors).forEach(function(b){return a.updateProjector(b)}),this},c.prototype.updateProjector=function(a){var b=this._projectors[a];if(null!=b.scale){var c=this.dataSource()._getExtent(b.accessor);0!==c.length&&this._isAnchored?b.scale.updateExtent(this._plottableID,a,c):b.scale.removeExtent(this._plottableID,a)}return this},c.prototype._applyAnimatedAttributes=function(a,b,c){return this._animate&&this.animateOnNextRender&&null!=this._animators[b]?this._animators[b].animate(a,c,this):a.attr(c)},c.prototype.animator=function(a,b){return void 0===b?this._animators[a]:(this._animators[a]=b,this)},c}(b.Component);b.Plot=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var Plottable;!function(a){!function(b){!function(b){!function(c){var d=function(){function a(){}return a.prototype.render=function(){b.flush()},a}();c.Immediate=d;var e=function(){function c(){}return c.prototype.render=function(){a.Util.DOM.requestAnimationFramePolyfill(b.flush)},c}();c.AnimationFrame=e;var f=function(){function c(){this._timeoutMsec=a.Util.DOM.POLYFILL_TIMEOUT_MSEC}return c.prototype.render=function(){setTimeout(b.flush,this._timeoutMsec)},c}();c.Timeout=f}(b.RenderPolicy||(b.RenderPolicy={}));b.RenderPolicy}(b.RenderController||(b.RenderController={}));b.RenderController}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(b){function c(a){b._renderPolicy=a}function d(a){h[a._plottableID]=a,f()}function e(a){i[a._plottableID]=a,h[a._plottableID]=a,f()}function f(){j||(j=!0,b._renderPolicy.render())}function g(){if(j){var b=d3.values(i);b.forEach(function(a){return a._computeLayout()});var c=d3.values(h);c.forEach(function(a){return a._render()}),c=d3.values(h),c.forEach(function(a){return a._doRender()}),i={},h={},j=!1}a.ResizeBroadcaster.clearResizing()}var h={},i={},j=!1;b._renderPolicy=new b.RenderPolicy.AnimationFrame,b.setRenderPolicy=c,b.registerToRender=d,b.registerToComputeLayout=e,b.flush=g}(a.RenderController||(a.RenderController={}));a.RenderController}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(b){function c(){void 0===i&&(i=new a.Broadcaster(b),window.addEventListener("resize",d))}function d(){j=!0,i.broadcast()}function e(){return j}function f(){j=!1}function g(a){c(),i.registerListener(a._plottableID,function(){return a._invalidateLayout()})}function h(a){i&&i.deregisterListener(a._plottableID)}var i,j=!1;b.resizing=e,b.clearResizing=f,b.register=g,b.deregister=h}(a.ResizeBroadcaster||(a.ResizeBroadcaster={}));a.ResizeBroadcaster}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(){}(Plottable||(Plottable={}));var Plottable;!function(a){var b=function(){function a(b){"undefined"==typeof b&&(b=a.defaultCombineExtents),this.doNice=!1,this.padProportion=0,this.paddingExceptions=d3.set([]),this.includedValues=d3.map([]),this.combineExtents=b}return a.prototype.computeDomain=function(a,b){var c;return c=this.combineExtents(a),c=this.includeDomain(c),c=this.padDomain(c),c=this.niceDomain(b,c)},a.prototype.pad=function(a){return"undefined"==typeof a&&(a=.05),this.padProportion=a,this},a.prototype.paddingException=function(a,b){return"undefined"==typeof b&&(b=!0),b?this.paddingExceptions.add(a):this.paddingExceptions.remove(a),this},a.prototype.nice=function(a){return this.doNice=!0,this.niceCount=a,this},a.prototype.include=function(a,b){return"undefined"==typeof b&&(b=!0),b?this.includedValues.set(a,a):this.includedValues.remove(a),this},a.defaultCombineExtents=function(a){return 0===a.length?[0,1]:[d3.min(a,function(a){return a[0]}),d3.max(a,function(a){return a[1]})]},a.prototype.padDomain=function(b){if(b[0]===b[1]&&this.padProportion>0){var c=b[0].valueOf();return b[0]instanceof Date?[c-a.ONE_DAY,c+a.ONE_DAY]:[c-a.PADDING_FOR_IDENTICAL_DOMAIN,c+a.PADDING_FOR_IDENTICAL_DOMAIN]}var d=b[1]-b[0],e=[b[0].valueOf()-this.padProportion/2*d,b[1].valueOf()+this.padProportion/2*d];return this.paddingExceptions.has(b[0])&&(e[0]=b[0]),this.paddingExceptions.has(b[1])&&(e[1]=b[1]),e},a.prototype.niceDomain=function(a,b){return this.doNice?a._niceDomain(b,this.niceCount):b},a.prototype.includeDomain=function(a){return this.includedValues.values().reduce(function(a,b){return[Math.min(a[0],b),Math.max(a[1],b)]},a)},a.PADDING_FOR_IDENTICAL_DOMAIN=1,a.ONE_DAY=864e5,a}();a.Domainer=b}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this,c),this.lastRequestedTickCount=10,this._PADDING_FOR_IDENTICAL_DOMAIN=1,this._userSetDomainer=!1,this._domainer=new a.Domainer}return __extends(c,b),c.prototype.autoDomain=function(){return this._setDomain(this._domainer.computeDomain(this._getAllExtents(),this)),this},c.prototype.invert=function(a){return this._d3Scale.invert(a)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype.interpolate=function(a){return null==a?this._d3Scale.interpolate():(this._d3Scale.interpolate(a),this)},c.prototype.rangeRound=function(a){return this._d3Scale.rangeRound(a),this},c.prototype.clamp=function(a){return null==a?this._d3Scale.clamp():(this._d3Scale.clamp(a),this)},c.prototype.ticks=function(a){return null!=a&&(this.lastRequestedTickCount=a),this._d3Scale.ticks(this.lastRequestedTickCount)},c.prototype.tickFormat=function(a,b){return this._d3Scale.tickFormat(a,b)},c.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},c.prototype.domainer=function(a){return null==a?this._domainer:(this._domainer=a,this._userSetDomainer=!0,this._autoDomainIfAutomaticMode(),this)},c}(b.Scale);b.QuantitiveScale=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,null==b?d3.scale.linear():b)}return __extends(b,a),b.prototype.copy=function(){return new b(this._d3Scale.copy())},b}(a.Abstract.QuantitiveScale);b.Linear=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,null==b?d3.scale.log():b)}return __extends(b,a),b.prototype.copy=function(){return new b(this._d3Scale.copy())},b}(a.Abstract.QuantitiveScale);b.Log=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){if(b.call(this,null==a?d3.scale.ordinal():a),this._range=[0,1],this._rangeType="bands",this._innerPadding=.3,this._outerPadding=.5,this._innerPadding>this._outerPadding)throw new Error("outerPadding must be >= innerPadding so cat axis bands work out reasonably")}return __extends(c,b),c.prototype._getExtent=function(){var b=this._getAllExtents();return a.Util.Methods.uniq(a.Util.Methods.flatten(b))},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype._setDomain=function(a){b.prototype._setDomain.call(this,a),this.range(this.range())},c.prototype.range=function(a){return null==a?this._range:(this._range=a,"points"===this._rangeType?this._d3Scale.rangePoints(a,2*this._outerPadding):"bands"===this._rangeType&&this._d3Scale.rangeBands(a,this._innerPadding,this._outerPadding),this)},c.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},c.prototype.innerPadding=function(){var a=this.domain();if(a.length<2)return 0;var b=Math.abs(this.scale(a[1])-this.scale(a[0]));return b-this.rangeBand()},c.prototype.fullBandStartAndWidth=function(a){var b=this.scale(a)-this.innerPadding()/2,c=this.rangeBand()+this.innerPadding();return[b,c]},c.prototype.rangeType=function(a,b,c){if(null==a)return this._rangeType;if("points"!==a&&"bands"!==a)throw new Error("Unsupported range type: "+a);return this._rangeType=a,null!=b&&(this._outerPadding=b),null!=c&&(this._innerPadding=c),this.broadcaster.broadcast(),this},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c}(a.Abstract.Scale);b.Ordinal=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){var c;switch(a){case"Category10":case"category10":case"10":c=d3.scale.category10();break;case"Category20":case"category20":case"20":c=d3.scale.category20();break;case"Category20b":case"category20b":case"20b":c=d3.scale.category20b();break;case"Category20c":case"category20c":case"20c":c=d3.scale.category20c();break;case null:case void 0:c=d3.scale.ordinal();break;default:throw new Error("Unsupported ColorScale type")}b.call(this,c)}return __extends(c,b),c.prototype._getExtent=function(){var b=this._getAllExtents(),c=[];return b.forEach(function(a){c=c.concat(a)}),a.Util.Methods.uniq(c)},c}(a.Abstract.Scale);b.Color=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,null==b?d3.time.scale():b),this._PADDING_FOR_IDENTICAL_DOMAIN=864e5}return __extends(b,a),b.prototype._setDomain=function(b){a.prototype._setDomain.call(this,b.map(function(a){return new Date(a)}))},b}(a.Abstract.QuantitiveScale);b.Time=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(c,d){"undefined"==typeof c&&(c="reds"),"undefined"==typeof d&&(d="linear"),this._colorRange=this._resolveColorValues(c),this._scaleType=d,a.call(this,b.getD3InterpolatedScale(this._colorRange,this._scaleType))}return __extends(b,a),b.getD3InterpolatedScale=function(a,c){var d;switch(c){case"linear":d=d3.scale.linear();break;case"log":d=d3.scale.log();break;case"sqrt":d=d3.scale.sqrt();break;case"pow":d=d3.scale.pow()}if(null==d)throw new Error("unknown quantitive scale type "+c);return d.range([0,1]).interpolate(b.interpolateColors(a))},b.interpolateColors=function(a){if(a.length<2)throw new Error("Color scale arrays must have at least two elements.");return function(){return function(b){b=Math.max(0,Math.min(1,b));var c=b*(a.length-1),d=Math.floor(c),e=Math.ceil(c),f=c-d;return d3.interpolateLab(a[d],a[e])(f)}}},b.prototype.colorRange=function(a){return null==a?this._colorRange:(this._colorRange=this._resolveColorValues(a),void this._resetScale())},b.prototype.scaleType=function(a){return null==a?this._scaleType:(this._scaleType=a,void this._resetScale())},b.prototype._resetScale=function(){this._d3Scale=b.getD3InterpolatedScale(this._colorRange,this._scaleType),this._autoDomainIfAutomaticMode(),this.broadcaster.broadcast()},b.prototype._resolveColorValues=function(a){return a instanceof Array?a:null!=b.COLOR_SCALES[a]?b.COLOR_SCALES[a]:b.COLOR_SCALES.reds},b.COLOR_SCALES={reds:["#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],blues:["#FFFFFF","#CCFFFF","#A5FFFD","#85F7FB","#6ED3EF","#55A7E0","#417FD0","#2545D3","#0B02E1"],posneg:["#0B02E1","#2545D3","#417FD0","#55A7E0","#6ED3EF","#85F7FB","#A5FFFD","#CCFFFF","#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"]},b}(a.Abstract.QuantitiveScale);b.InterpolatedColor=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(a){var b=this;this.rescaleInProgress=!1,this.scales=a,this.scales.forEach(function(a){return a.broadcaster.registerListener(b,function(a){return b.rescale(a)})})}return a.prototype.rescale=function(a){if(!this.rescaleInProgress){this.rescaleInProgress=!0;var b=a.domain();this.scales.forEach(function(a){return a.domain(b)}),this.rescaleInProgress=!1}},a}();a.ScaleDomainCoordinator=b}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){var f=this;b.call(this),this._showEndTickLabels=!1,this.tickPositioning="center",this.orientToAlign={left:"right",right:"left",top:"bottom",bottom:"top"},this._axisScale=c,d=d.toLowerCase(),this.d3Axis=d3.svg.axis().scale(c._d3Scale).orient(d),this.classed("axis",!0);var g=e;null==e&&(e=new a.Formatter.General),e instanceof a.Abstract.Formatter&&(g=function(a){return e.format(a)}),this.tickFormat(g),this._axisScale.broadcaster.registerListener(this,function(){return f._render()})}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.axisElement=this.content.append("g").classed("axis",!0),this},c.prototype._doRender=function(){var a,b=this._axisScale.domain(),c=Math.abs(b[1]-b[0]),d=+d3.min(b),e=+d3.max(b),f=b[0]b.right?!1:a.bottomb.bottom?!1:!0}var b,c=this.axisElement.selectAll(".tick").select("text");c.each(function(){var c=this.getBoundingClientRect();null!=b&&a(c,b)?d3.select(this).style("visibility","hidden"):(b=c,d3.select(this).style("visibility","visible"))})},c.prototype.scale=function(a){return null==a?this._axisScale:(this._axisScale=a,this.d3Axis.scale(a._d3Scale),this)},c.prototype.tickLabelPosition=function(a){return null==a?this.tickPositioning:(this.tickPositioning=a,this)},c.prototype.orient=function(a){return null==a?this.d3Axis.orient():(this.d3Axis.orient(a),this)},c.prototype.ticks=function(){for(var a=[],b=0;b0)if("center"!==this.tickLabelPosition()&&(d.attr("y","0px"),"bottom"===this.orient()?d.attr("dy","1em"):d.attr("dy","-0.25em"),"right"===this.tickLabelPosition()?d.attr("dx","0.2em").style("text-anchor","start"):"left"===this.tickLabelPosition()&&d.attr("dx","-0.2em").style("text-anchor","end")),null!=this._axisScale.rangeType){var e=(this._axisScale.range(),this.availableWidth),f=Math.abs(parseFloat(d3.select(d[0][0]).attr("y"))),g=this.availableHeight-f;if(d[0].length>1){var h=d.data(),i=h.map(function(a){return c._axisScale.scale(a)});i.forEach(function(a,b){var c=Math.abs(i[b+1]-a);e=e>c?c:e})}e=.9*e,d.each(function(){var b=d3.select(this),c=b.text(),d=a.Util.Text.getTextMeasure(b),f=a.Util.WordWrap.breakTextToFitRect(c,e,g,d).lines;if(1===f.length)b.text(a.Util.Text.getTruncatedText(c,e,d));else{b.text("");var h=b.selectAll("tspan").data(f);h.enter().append("tspan"),h.text(function(a){return a}).attr("x","0").attr("dy",function(a,c){return 0===c?b.attr("dy"):"1em"}).style("text-anchor",b.style("text-anchor"))}})}else this._hideOverlappingTickLabels();return this.showEndTickLabels()||this._hideCutOffTickLabels(),this},c}(c);b.XAxis=d;var e=function(b){function c(a,c,d){if("undefined"==typeof c&&(c="left"),"undefined"==typeof d&&(d=null),b.call(this,a,c,d),this._width=50,c=c.toLowerCase(),"left"!==c&&"right"!==c)throw new Error(c+" is not a valid orientation for YAxis");this.tickLabelPosition("middle");var e=this.orientToAlign[c];this.xAlign(e)}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.axisElement.classed("y-axis",!0),this},c.prototype.width=function(a){return this._width=a,this._invalidateLayout(),this},c.prototype._requestedSpace=function(a){return{width:Math.min(a,this._width),height:0,wantsWidth:a0)if("middle"!==this.tickLabelPosition()&&(d.attr("x","0px"),"left"===this.orient()?d.attr("dx","-0.25em"):d.attr("dx","0.25em"),"top"===this.tickLabelPosition()?d.attr("dy","-0.3em"):"bottom"===this.tickLabelPosition()&&d.attr("dy","1em")),null!=this._axisScale.rangeType){var e=(this._axisScale.range(),Math.abs(parseFloat(d3.select(d[0][0]).attr("x")))),f=this.availableWidth-e,g=this.availableHeight;if(d[0].length>1){var h=d.data(),i=h.map(function(a){return c._axisScale.scale(a)});i.forEach(function(a,b){var c=Math.abs(i[b+1]-a);g=g>c?c:g})}var j=this.tickLabelPosition();d.each(function(){var b=d3.select(this),c=b.text(),d=a.Util.Text.getTextMeasure(b),e=a.Util.WordWrap.breakTextToFitRect(c,f,g,d).lines;if(1===e.length)b.text(a.Util.Text.getTruncatedText(c,f,d));else{var h=0;"top"===j?h=-(e.length-1):"middle"===j&&(h=-(e.length-1)/2),b.text("");var i=b.selectAll("tspan").data(e);i.enter().append("tspan"),i.text(function(a){return a}).attr({dy:b.attr("dy"),x:b.attr("x"),y:function(a,b){return h+b+"em"}}).style("text-anchor",b.style("text-anchor"))}})}else this._hideOverlappingTickLabels();return this.showEndTickLabels()||this._hideCutOffTickLabels(),this},c}(c);b.YAxis=e}(a.Axis||(a.Axis={}));a.Axis}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(c){function d(b,d,e){var f=this;c.call(this),this._width="auto",this._height="auto",this._tickLength=5,this._tickLabelPadding=3,this._showEndTickLabels=!1,this._scale=b,this.orient(d),this.classed("axis",!0),this._isHorizontal()?this.classed("x-axis",!0):this.classed("y-axis",!0),null==e&&(e=new a.Formatter.General,e.showOnlyUnchangedValues(!1)),this.formatter(e),this._scale.broadcaster.registerListener(this,function(){return f.rescale()})}return __extends(d,c),d.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},d.prototype._computeWidth=function(){return this._computedWidth=this._tickLength,this._computedWidth},d.prototype._computeHeight=function(){return this._computedHeight=this._tickLength,this._computedHeight},d.prototype._requestedSpace=function(a,b){var c=this._width,d=this._height;return this._isHorizontal()?("auto"===this._height&&(null==this._computedHeight&&this._computeHeight(),d=this._computedHeight),c=0):("auto"===this._width&&(null==this._computedWidth&&this._computeWidth(),c=this._computedWidth),d=0),{width:Math.min(a,c),height:Math.min(b,d),wantsWidth:!this._isHorizontal()&&c>a,wantsHeight:this._isHorizontal()&&d>b}},d.prototype._computeLayout=function(a,b,d,e){return c.prototype._computeLayout.call(this,a,b,d,e),this._scale.range(this._isHorizontal()?[0,this.availableWidth]:[this.availableHeight,0]),this},d.prototype._setup=function(){return c.prototype._setup.call(this),this._tickMarkContainer=this.content.append("g").classed(d.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this.content.append("g").classed(d.TICK_LABEL_CLASS+"-container",!0),this._baseline=this.content.append("line").classed("baseline",!0),this},d.prototype._getTickValues=function(){return[]},d.prototype._doRender=function(){var a=this._getTickValues(),b=this._tickMarkContainer.selectAll("."+d.TICK_MARK_CLASS).data(a);return b.enter().append("line").classed(d.TICK_MARK_CLASS,!0),b.attr(this._generateTickMarkAttrHash()),b.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash()),this},d.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.availableWidth;break;case"top":a.x2=this.availableWidth,a.y1=this.availableHeight,a.y2=this.availableHeight;break;case"left":a.x1=this.availableWidth,a.x2=this.availableWidth,a.y2=this.availableHeight;break;case"right":a.y2=this.availableHeight}return a},d.prototype._generateTickMarkAttrHash=function(){var a=this,b={x1:0,y1:0,x2:0,y2:0},c=function(b){return a._scale.scale(b)};switch(this._isHorizontal()?(b.x1=c,b.x2=c):(b.y1=c,b.y2=c),this._orientation){case"bottom":b.y2=this._tickLength;break;case"top":b.y1=this.availableHeight,b.y2=this.availableHeight-this._tickLength;break;case"left":b.x1=this.availableWidth,b.x2=this.availableWidth-this._tickLength;break;case"right":b.x2=this._tickLength}return b},d.prototype.rescale=function(){return null!=this.element?this._render():null},d.prototype._invalidateLayout=function(){c.prototype._invalidateLayout.call(this),this._computedWidth=null,this._computedHeight=null},d.prototype.width=function(a){if(null==a)return this.availableWidth;if(this._isHorizontal())throw new Error("width cannot be set on a horizontal Axis");if("auto"!==a&&0>a)throw new Error("invalid value for width");return this._width=a,this._invalidateLayout(),this},d.prototype.height=function(a){if(null==a)return this.availableHeight;if(!this._isHorizontal())throw new Error("height cannot be set on a vertical Axis");if("auto"!==a&&0>a)throw new Error("invalid value for height");return this._height=a,this._invalidateLayout(),this},d.prototype.formatter=function(a){return this._formatter=a,this._invalidateLayout(),this},d.prototype.tickLength=function(a){if(null==a)return this._tickLength;if(0>a)throw new Error("tick length must be positive");return this._tickLength=a,this._invalidateLayout(),this},d.prototype.tickLabelPadding=function(a){if(null==a)return this._tickLabelPadding;if(0>a)throw new Error("tick label padding must be positive");return this._tickLabelPadding=a,this._invalidateLayout(),this},d.prototype.orient=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._invalidateLayout(),this},d.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this._render(),this)},d.prototype._hideEndTickLabels=function(){var a=this,c=this.element.select(".bounding-box")[0][0].getBoundingClientRect(),d=function(b){return Math.floor(c.left)<=Math.ceil(b.left)&&Math.floor(c.top)<=Math.ceil(b.top)&&Math.floor(b.right)<=Math.ceil(c.left+a.availableWidth)&&Math.floor(b.bottom)<=Math.ceil(c.top+a.availableHeight)},e=this._tickLabelContainer.selectAll("."+b.Axis.TICK_LABEL_CLASS),f=e[0][0];d(f.getBoundingClientRect())||d3.select(f).style("visibility","hidden");var g=e[0][e[0].length-1];d(g.getBoundingClientRect())||d3.select(g).style("visibility","hidden")},d.prototype._hideOverlappingTickLabels=function(){function a(a,b){return a.rightb.right?!1:a.bottomb.bottom?!1:!0 -}var c,d=this._tickLabelContainer.selectAll("."+b.Axis.TICK_LABEL_CLASS).filter(function(){return"visible"===d3.select(this).style("visibility")});d.each(function(){var b=this.getBoundingClientRect(),d=d3.select(this);null!=c&&a(b,c)?d.style("visibility","hidden"):(c=b,d.style("visibility","visible"))})},d.TICK_MARK_CLASS="tick-mark",d.TICK_LABEL_CLASS="tick-label",d}(b.Component);b.Axis=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c,d){b.call(this,a,c,d),this.tickLabelPositioning="center",this.showFirstTickLabel=!1,this.showLastTickLabel=!1}return __extends(c,b),c.prototype._computeWidth=function(){var b=this._getTickValues(),c=function(a){var b=Math.floor(Math.log(Math.abs(a))/Math.LN10);return b>0?b:1},d=Math.max.apply(null,b.map(c)),e=this._formatter.precision(),f=-(Math.pow(10,d)+Math.pow(10,-e)),g=this._tickLabelContainer.append("text").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),h=this._formatter.format(f),i=g.text(h).node().getComputedTextLength();return g.remove(),this._computedWidth="center"===this.tickLabelPositioning?this.tickLength()+this.tickLabelPadding()+i:Math.max(this.tickLength(),this.tickLabelPadding()+i),this._computedWidth},c.prototype._computeHeight=function(){var b=this._tickLabelContainer.append("text").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),c=a.Util.DOM.getBBox(b.text("test")).height;return b.remove(),this._computedHeight="center"===this.tickLabelPositioning?this.tickLength()+this.tickLabelPadding()+c:Math.max(this.tickLength(),this.tickLabelPadding()+c),this._computedHeight},c.prototype._getTickValues=function(){return this._scale.ticks(10)},c.prototype._doRender=function(){var c=this;b.prototype._doRender.call(this);var d={x:0,y:0,dx:"0em",dy:"0.3em"},e=this.tickLength(),f=this.tickLabelPadding(),g="middle",h=0,i=0,j=0,k=0;if(this._isHorizontal())switch(this.tickLabelPositioning){case"left":g="end",h=-f,k=f;break;case"center":k=e+f;break;case"right":g="start",h=f,k=f}else switch(this.tickLabelPositioning){case"top":d.dy="-0.3em",j=f,i=-f;break;case"center":j=e+f;break;case"bottom":d.dy="1em",j=f,i=f}var l=this._generateTickMarkAttrHash();switch(this._orientation){case"bottom":d.x=l.x1,d.dy="0.95em",i=l.y1+k;break;case"top":d.x=l.x1,d.dy="-.25em",i=l.y1-k;break;case"left":g="end",h=l.x1-j,d.y=l.y1;break;case"right":g="start",h=l.x1+j,d.y=l.y1}var m=this._getTickValues(),n=this._tickLabelContainer.selectAll("."+a.Abstract.Axis.TICK_LABEL_CLASS).data(m);n.enter().append("text").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),n.exit().remove();var o=function(a){return c._formatter.format(a)};n.style("text-anchor",g).style("visibility","visible").attr(d).text(o);var p="translate("+h+", "+i+")";return this._tickLabelContainer.attr("transform",p),this.showEndTickLabels()||this._hideEndTickLabels(),this._hideOverlappingTickLabels(),this},c.prototype.tickLabelPosition=function(a){if(null==a)return this.tickLabelPositioning;var b=a.toLowerCase();if(this._isHorizontal()){if("left"!==b&&"center"!==b&&"right"!==b)throw new Error(b+" is not a valid tick label position for a horizontal NumericAxis")}else if("top"!==b&&"center"!==b&&"bottom"!==b)throw new Error(b+" is not a valid tick label position for a vertical NumericAxis");return this.tickLabelPositioning=b,this._invalidateLayout(),this},c.prototype.showEndTickLabel=function(a,b){if(this._isHorizontal()&&"left"===a||!this._isHorizontal()&&"bottom"===a)return void 0===b?this.showFirstTickLabel:(this.showFirstTickLabel=b,this._render());if(this._isHorizontal()&&"right"===a||!this._isHorizontal()&&"top"===a)return void 0===b?this.showLastTickLabel:(this.showLastTickLabel=b,this._render());throw new Error("Attempt to show "+a+" tick label on a "+(this._isHorizontal()?"horizontal":"vertical")+" axis")},c}(a.Abstract.Axis);b.Numeric=c}(a.Axis||(a.Axis={}));a.Axis}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c){"undefined"==typeof c&&(c="bottom");var d=this;if(b.call(this,a,c),this.classed("category-axis",!0),"bands"!==a.rangeType())throw new Error("Only rangeBands category axes are implemented");this._scale.broadcaster.registerListener(this,function(){return d._invalidateLayout()})}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this._tickLabelsG=this.content.append("g").classed("tick-labels",!0),this.measurer=new a.Util.Text.CachingCharacterMeasurer(this._tickLabelsG),this},c.prototype._requestedSpace=function(a,b){var c=this._isHorizontal()?0:this.tickLength()+this.tickLabelPadding(),d=this._isHorizontal()?this.tickLength()+this.tickLabelPadding():0;if(0>a||0>b)return{width:a,height:b,wantsWidth:!this._isHorizontal(),wantsHeight:this._isHorizontal()};if(0===this._scale.domain().length)return{width:0,height:0,wantsWidth:!1,wantsHeight:!1};var e=this._scale.copy();e.range(this._isHorizontal()?[0,a]:[b,0]);var f=this.measureTicks(a,b,e,this._scale.domain());return{width:f.usedWidth+c,height:f.usedHeight+d,wantsWidth:!f.textFits,wantsHeight:!f.textFits}},c.prototype._getTickValues=function(){return this._scale.domain()},c.prototype.measureTicks=function(b,c,d,e){var f="string"!=typeof e[0],g=this,h=[],i=function(a){return g.measurer.measure(a)},j=f?function(a){return e.each(a)}:function(a){return e.forEach(a)};j(function(e){var j,k=d.fullBandStartAndWidth(e)[1],l=g._isHorizontal()?k:b-g.tickLength()-g.tickLabelPadding(),m=g._isHorizontal()?c-g.tickLength()-g.tickLabelPadding():k;if(f){var n=d3.select(this),o={left:"right",right:"left",top:"center",bottom:"center"},p={left:"center",right:"center",top:"bottom",bottom:"top"};j=a.Util.Text.writeText(e,l,m,i,!0,{g:n,xAlign:o[g._orientation],yAlign:p[g._orientation]})}else j=a.Util.Text.writeText(e,l,m,i,!0);h.push(j)});var k=this._isHorizontal()?d3.sum:d3.max,l=this._isHorizontal()?d3.max:d3.sum;return{textFits:h.every(function(a){return a.textFits}),usedWidth:k(h,function(a){return a.usedWidth}),usedHeight:l(h,function(a){return a.usedHeight})}},c.prototype._doRender=function(){var c=this;b.prototype._doRender.call(this);{var d=this._tickLabelsG.selectAll(".tick-label").data(this._scale.domain(),function(a){return a}),e=function(a){var b=c._scale.fullBandStartAndWidth(a),d=b[0],e=c._isHorizontal()?d:0,f=c._isHorizontal()?0:d;return"translate("+e+","+f+")"};d.enter().append("g").classed("tick-label",!0)}d.exit().remove(),d.attr("transform",e),d.text(""),this.measureTicks(this.availableWidth,this.availableHeight,this._scale,d);var f=this._isHorizontal()?[this._scale.rangeBand()/2,0]:[0,this._scale.rangeBand()/2],g="right"===this._orientation?this.tickLength()+this.tickLabelPadding():0,h="bottom"===this._orientation?this.tickLength()+this.tickLabelPadding():0;return a.Util.DOM.translate(this._tickLabelsG,g,h),a.Util.DOM.translate(this._tickMarkContainer,f[0],f[1]),this},c.prototype._computeLayout=function(a,c,d,e){return this.measurer.clear(),b.prototype._computeLayout.call(this,a,c,d,e)},c}(a.Abstract.Axis);b.Category=c}(a.Axis||(a.Axis={}));a.Axis}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c){if("undefined"==typeof a&&(a=""),"undefined"==typeof c&&(c="horizontal"),b.call(this),this.classed("label",!0),this.setText(a),c=c.toLowerCase(),"vertical-left"===c&&(c="left"),"vertical-right"===c&&(c="right"),"horizontal"!==c&&"left"!==c&&"right"!==c)throw new Error(c+" is not a valid orientation for LabelComponent");this.orientation=c,this.xAlign("center").yAlign("center")}return __extends(c,b),c.prototype.xAlign=function(a){var c=a.toLowerCase();return b.prototype.xAlign.call(this,c),this.xAlignment=c,this},c.prototype.yAlign=function(a){var c=a.toLowerCase();return b.prototype.yAlign.call(this,c),this.yAlignment=c,this},c.prototype._requestedSpace=function(a,b){var c=this.measurer(this.text),d="horizontal"===this.orientation?c[0]:c[1],e="horizontal"===this.orientation?c[1]:c[0];return{width:Math.min(d,a),height:Math.min(e,b),wantsWidth:d>a,wantsHeight:e>b}},c.prototype._setup=function(){return b.prototype._setup.call(this),this.textContainer=this.content.append("g"),this.measurer=a.Util.Text.getTextMeasure(this.textContainer),this.setText(this.text),this},c.prototype.setText=function(a){return this.text=a,this._invalidateLayout(),this},c.prototype._doRender=function(){b.prototype._doRender.call(this),this.textContainer.selectAll("text").remove();var c="horizontal"===this.orientation?this.availableWidth:this.availableHeight,d=a.Util.Text.getTruncatedText(this.text,c,this.measurer);return"horizontal"===this.orientation?a.Util.Text.writeLineHorizontally(d,this.textContainer,this.availableWidth,this.availableHeight,this.xAlignment,this.yAlignment):a.Util.Text.writeLineVertically(d,this.textContainer,this.availableWidth,this.availableHeight,this.xAlignment,this.yAlignment,this.orientation),this},c.prototype._computeLayout=function(c,d,e,f){return b.prototype._computeLayout.call(this,c,d,e,f),this.measurer=a.Util.Text.getTextMeasure(this.textContainer),this},c}(a.Abstract.Component);b.Label=c;var d=function(a){function b(b,c){a.call(this,b,c),this.classed("title-label",!0)}return __extends(b,a),b}(c);b.TitleLabel=d;var e=function(a){function b(b,c){a.call(this,b,c),this.classed("axis-label",!0)}return __extends(b,a),b}(c);b.AxisLabel=e}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){b.call(this),this.classed("legend",!0),this.scale(a),this.xAlign("RIGHT").yAlign("TOP"),this.xOffset(5).yOffset(5)}return __extends(c,b),c.prototype.toggleCallback=function(a){return void 0!==a?(this._toggleCallback=a,this.isOff=d3.set(),this.updateListeners(),this.updateClasses(),this):this._toggleCallback},c.prototype.hoverCallback=function(a){return void 0!==a?(this._hoverCallback=a,this.datumCurrentlyFocusedOn=void 0,this.updateListeners(),this.updateClasses(),this):this._hoverCallback},c.prototype.scale=function(a){var b=this;return null!=a?(null!=this.colorScale&&this.colorScale.broadcaster.deregisterListener(this),this.colorScale=a,this.colorScale.broadcaster.registerListener(this,function(){return b.updateDomain()}),this.updateDomain(),this):this.colorScale},c.prototype.updateDomain=function(){null!=this._toggleCallback&&(this.isOff=a.Util.Methods.intersection(this.isOff,d3.set(this.scale().domain()))),null!=this._hoverCallback&&(this.datumCurrentlyFocusedOn=this.scale().domain().indexOf(this.datumCurrentlyFocusedOn)>=0?this.datumCurrentlyFocusedOn:void 0),this._invalidateLayout()},c.prototype._computeLayout=function(a,c,d,e){b.prototype._computeLayout.call(this,a,c,d,e);var f=this.measureTextHeight(),g=this.colorScale.domain().length;return this.nRowsDrawn=Math.min(g,Math.floor(this.availableHeight/f)),this},c.prototype._requestedSpace=function(b,d){var e=this.measureTextHeight(),f=this.colorScale.domain().length,g=Math.min(f,Math.floor(d/e)),h=this.content.append("g").classed(c.SUBELEMENT_CLASS,!0),i=h.append("text"),j=d3.max(this.colorScale.domain(),function(b){return a.Util.Text.getTextWidth(i,b)});h.remove(),j=void 0===j?0:j;var k=j+e+c.MARGIN;return{width:Math.min(k,b),height:g*e,wantsWidth:k>b,wantsHeight:f>g}},c.prototype.measureTextHeight=function(){var b=this.content.append("g").classed(c.SUBELEMENT_CLASS,!0),d=a.Util.Text.getTextHeight(b.append("text"));return b.remove(),d},c.prototype._doRender=function(){b.prototype._doRender.call(this);var d=this.colorScale.domain().slice(0,this.nRowsDrawn),e=this.measureTextHeight(),f=this.availableWidth-e-c.MARGIN,g=e-2*c.MARGIN-2,h=this.content.selectAll("."+c.SUBELEMENT_CLASS).data(d,function(a){return a}),i=h.enter().append("g").classed(c.SUBELEMENT_CLASS,!0);return i.append("circle").attr("cx",c.MARGIN+g/2).attr("cy",c.MARGIN+g/2).attr("r",g),i.append("text").attr("x",e).attr("y",c.MARGIN+e/2),h.exit().remove(),h.attr("transform",function(a){return"translate(0,"+d.indexOf(a)*e+")"}),h.selectAll("circle").attr("fill",this.colorScale._d3Scale),h.selectAll("text").text(function(b){var c=a.Util.Text.getTextMeasure(d3.select(this));return a.Util.Text.getTruncatedText(b,f,c)}),this.updateClasses(),this.updateListeners(),this},c.prototype.updateListeners=function(){var a=this;if(this._isSetup){var b=this.content.selectAll("."+c.SUBELEMENT_CLASS);if(null!=this._hoverCallback){var d=function(b){return function(c){a.datumCurrentlyFocusedOn=b?c:void 0,a._hoverCallback(a.datumCurrentlyFocusedOn),a.updateClasses()}};b.on("mouseover",d(!0)),b.on("mouseout",d(!1))}else b.on("mouseover",null),b.on("mouseout",null);null!=this._toggleCallback?b.on("click",function(b){var c=a.isOff.has(b);c?a.isOff.remove(b):a.isOff.add(b),a._toggleCallback(b,c),a.updateClasses()}):b.on("click",null)}},c.prototype.updateClasses=function(){var a=this;if(this._isSetup){var b=this.content.selectAll("."+c.SUBELEMENT_CLASS);null!=this._hoverCallback?(b.classed("focus",function(b){return a.datumCurrentlyFocusedOn===b}),b.classed("hover",void 0!==this.datumCurrentlyFocusedOn)):(b.classed("hover",!1),b.classed("focus",!1)),null!=this._toggleCallback?(b.classed("toggled-on",function(b){return!a.isOff.has(b)}),b.classed("toggled-off",function(b){return a.isOff.has(b)})):(b.classed("toggled-on",!1),b.classed("toggled-off",!1))}},c.SUBELEMENT_CLASS="legend-row",c.MARGIN=5,c}(a.Abstract.Component);b.Legend=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c){var d=this;a.call(this),this.classed("gridlines",!0),this.xScale=b,this.yScale=c,null!=this.xScale&&this.xScale.broadcaster.registerListener(this,function(){return d._render()}),null!=this.yScale&&this.yScale.broadcaster.registerListener(this,function(){return d._render()})}return __extends(b,a),b.prototype._setup=function(){return a.prototype._setup.call(this),this.xLinesContainer=this.content.append("g").classed("x-gridlines",!0),this.yLinesContainer=this.content.append("g").classed("y-gridlines",!0),this},b.prototype._doRender=function(){return a.prototype._doRender.call(this),this.redrawXLines(),this.redrawYLines(),this},b.prototype.redrawXLines=function(){var a=this;if(null!=this.xScale){var b=this.xScale.ticks(),c=function(b){return a.xScale.scale(b)},d=this.xLinesContainer.selectAll("line").data(b);d.enter().append("line"),d.attr("x1",c).attr("y1",0).attr("x2",c).attr("y2",this.availableHeight),d.exit().remove()}},b.prototype.redrawYLines=function(){var a=this;if(null!=this.yScale){var b=this.yScale.ticks(),c=function(b){return a.yScale.scale(b)},d=this.yLinesContainer.selectAll("line").data(b);d.enter().append("line"),d.attr("x1",0).attr("y1",c).attr("x2",this.availableWidth).attr("y2",c),d.exit().remove()}},b}(a.Abstract.Component);b.Gridlines=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(b,c,d){"undefined"==typeof c&&(c=a.ONE_DAY),"undefined"==typeof d&&(d="");var e=function(a){var e=Math.round((a.valueOf()-b)/c);return e.toString()+d};return e}a.ONE_DAY=864e5,a.generateRelativeDateFormatter=b}(a.Axis||(a.Axis={}));a.Axis}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(b){function c(a,c,d){b.call(this,a),this.classed("xy-renderer",!0),this.project("x","x",c),this.project("y","y",d)}return __extends(c,b),c.prototype.project=function(a,c,d){return"x"===a&&null!=d&&(this.xScale=d,this._updateXDomainer()),"y"===a&&null!=d&&(this.yScale=d,this._updateYDomainer()),b.prototype.project.call(this,a,c,d),this},c.prototype._computeLayout=function(a,c,d,e){return b.prototype._computeLayout.call(this,a,c,d,e),this.xScale.range([0,this.availableWidth]),this.yScale.range([this.availableHeight,0]),this},c.prototype._updateXDomainer=function(){if(this.xScale instanceof a.QuantitiveScale){var b=this.xScale;b._userSetDomainer||b.domainer().pad().nice()}return this},c.prototype._updateYDomainer=function(){if(this.yScale instanceof a.QuantitiveScale){var b=this.yScale;b._userSetDomainer||b.domainer().pad().nice()}return this},c}(a.Plot);a.XYPlot=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d,e),this._animators={"circles-reset":new a.Animator.Null,circles:(new a.Animator.IterativeDelay).duration(250).delay(5)},this.classed("circle-renderer",!0),this.project("r",3),this.project("fill",function(){return"steelblue"})}return __extends(c,b),c.prototype.project=function(a,c,d){return a="cx"===a?"x":a,a="cy"===a?"y":a,b.prototype.project.call(this,a,c,d),this},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this._generateAttrToProjector();a.cx=a.x,a.cy=a.y,delete a.x,delete a.y;var c=this.renderArea.selectAll("circle").data(this._dataSource.data());if(c.enter().append("circle"),this._dataChanged){var d=a.r;a.r=function(){return 0},this._applyAnimatedAttributes(c,"circles-reset",a),a.r=d}this._applyAnimatedAttributes(c,"circles",a),c.exit().remove()},c}(a.Abstract.XYPlot);b.Scatter=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e,f){b.call(this,c,d,e),this._animators={cells:new a.Animator.Null},this.classed("grid-renderer",!0),this.xScale.rangeType("bands",0,0),this.yScale.rangeType("bands",0,0),this.colorScale=f,this.project("fill","value",f)}return __extends(c,b),c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),"fill"===a&&(this.colorScale=this._projectors.fill.scale),this},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this.renderArea.selectAll("rect").data(this._dataSource.data());a.enter().append("rect");var c=this.xScale.rangeBand(),d=this.yScale.rangeBand(),e=this._generateAttrToProjector();e.width=function(){return c},e.height=function(){return d},this._applyAnimatedAttributes(a,"cells",e),a.exit().remove()},c}(a.Abstract.XYPlot);b.Grid=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(c){function d(b,d,e){c.call(this,b,d,e),this._baselineValue=0,this._barAlignmentFactor=0,this.previousBaselineValue=null,this._animators={"bars-reset":new a.Animator.Null,bars:new a.Animator.IterativeDelay,baseline:new a.Animator.Null},this.classed("bar-renderer",!0),this.project("fill",function(){return"steelblue"}),this.baseline(this._baselineValue)}return __extends(d,c),d.prototype._setup=function(){return c.prototype._setup.call(this),this._baseline=this.renderArea.append("line").classed("baseline",!0),this._bars=this.renderArea.selectAll("rect").data([]),this},d.prototype._paint=function(){c.prototype._paint.call(this),this._bars=this.renderArea.selectAll("rect").data(this._dataSource.data()),this._bars.enter().append("rect");var a=this._isVertical?this.yScale:this.xScale,b=a.scale(this._baselineValue),d=this._isVertical?"y":"x",e=this._isVertical?"height":"width";if(this._dataChanged&&this._animate){var f=this._generateAttrToProjector();f[d]=function(){return b},f[e]=function(){return 0},this._applyAnimatedAttributes(this._bars,"bars-reset",f)}var g=this._generateAttrToProjector();null!=g.fill&&this._bars.attr("fill",g.fill),this._applyAnimatedAttributes(this._bars,"bars",g),this._bars.exit().remove();var h={x1:this._isVertical?0:b,y1:this._isVertical?b:0,x2:this._isVertical?this.availableWidth:b,y2:this._isVertical?b:this.availableHeight};this._applyAnimatedAttributes(this._baseline,"baseline",h)},d.prototype.baseline=function(a){return this.previousBaselineValue=this._baselineValue,this._baselineValue=a,this._updateXDomainer(),this._updateYDomainer(),this._render(),this},d.prototype.barAlignment=function(a){var b=a.toLowerCase(),c=this.constructor._BarAlignmentToFactor;if(void 0===c[b])throw new Error("unsupported bar alignment");return this._barAlignmentFactor=c[b],this._render(),this},d.prototype.parseExtent=function(a){if("number"==typeof a)return{min:a,max:a};if(a instanceof Object&&"min"in a&&"max"in a)return a;throw new Error("input '"+a+"' can't be parsed as an IExtent")},d.prototype.selectBar=function(a,b,c){if("undefined"==typeof c&&(c=!0),!this._isSetup)return null;var d=[],e=this.parseExtent(a),f=this.parseExtent(b),g=.5;if(this._bars.each(function(){var a=this.getBBox();a.x+a.width>=e.min-g&&a.x<=e.max+g&&a.y+a.height>=f.min-g&&a.y<=f.max+g&&d.push(this)}),d.length>0){var h=d3.selectAll(d);return h.classed("selected",c),h}return null},d.prototype.deselectAll=function(){return this._isSetup&&this._bars.classed("selected",!1),this},d.prototype._updateDomainer=function(a){if(a instanceof b.QuantitiveScale){var c=a;c._userSetDomainer||null==this._baselineValue||(c.domainer().paddingException(this.previousBaselineValue,!1).include(this.previousBaselineValue,!1).paddingException(this._baselineValue).include(this._baselineValue),c._autoDomainIfAutomaticMode())}return this},d.prototype._generateAttrToProjector=function(){var b=this,e=c.prototype._generateAttrToProjector.call(this),f=this._isVertical?this.yScale:this.xScale,g=this._isVertical?this.xScale:this.yScale,h=this._isVertical?"y":"x",i=this._isVertical?"x":"y",j=g instanceof a.Scale.Ordinal&&"bands"===g.rangeType(),k=f.scale(this._baselineValue);if(null==e.width){var l=j?g.rangeBand():d.DEFAULT_WIDTH;e.width=function(){return l}}var m=e[i],n=e.width;if(j){var o=g.rangeBand();e[i]=function(a,b){return m(a,b)-n(a,b)/2+o/2}}else e[i]=function(a,c){return m(a,c)-n(a,c)*b._barAlignmentFactor};var p=e[h];return e[h]=function(a,b){var c=p(a,b);return c>k?k:c},e.height=function(a,b){return Math.abs(k-p(a,b))},e},d.DEFAULT_WIDTH=10,d._BarAlignmentToFactor={},d}(b.XYPlot);b.BarPlot=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c,d){a.call(this,b,c,d),this._isVertical=!0}return __extends(b,a),b.prototype._updateYDomainer=function(){return this._updateDomainer(this.yScale),this},b._BarAlignmentToFactor={left:0,center:.5,right:1},b}(a.Abstract.BarPlot);b.VerticalBar=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c,d){a.call(this,b,c,d),this.isVertical=!1}return __extends(b,a),b.prototype._updateXDomainer=function(){return this._updateDomainer(this.xScale),this},b.prototype._generateAttrToProjector=function(){var b=a.prototype._generateAttrToProjector.call(this),c=b.width;return b.width=b.height,b.height=c,b},b._BarAlignmentToFactor={top:0,center:.5,bottom:1},b}(a.Abstract.BarPlot);b.HorizontalBar=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d,e),this._animators={"line-reset":new a.Animator.Null,line:(new a.Animator.Default).duration(600).easing("exp-in-out")},this.classed("line-renderer",!0),this.project("stroke",function(){return"steelblue"}),this.project("stroke-width",function(){return"2px"})}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.linePath=this.renderArea.append("path").classed("line",!0),this},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this._generateAttrToProjector(),c=a.x,d=a.y;delete a.x,delete a.y,this.linePath.datum(this._dataSource.data()),this._dataChanged&&(a.d=d3.svg.line().x(c).y(function(){return 0}),this._applyAnimatedAttributes(this.linePath,"line-reset",a)),a.d=d3.svg.line().x(c).y(d),this._applyAnimatedAttributes(this.linePath,"line",a)},c}(a.Abstract.XYPlot);b.Line=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d,e),this.constantBaseline=null,this.previousBaseline=null,this.classed("area-renderer",!0),this.project("y0",0,e),this.project("fill",function(){return"steelblue"}),this.project("fill-opacity",function(){return.5}),this.project("stroke",function(){return"none"}),this._animators["area-reset"]=new a.Animator.Null,this._animators.area=(new a.Animator.Default).duration(600).easing("exp-in-out")}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.areaPath=this.renderArea.append("path").classed("area",!0),this},c.prototype._onDataSourceUpdate=function(){b.prototype._onDataSourceUpdate.call(this),null!=this.yScale&&this._updateYDomainer()},c.prototype._updateYDomainer=function(){b.prototype._updateYDomainer.call(this);var a=this.yScale,c=this._projectors.y0,d=null!=c?c.accessor:null,e=null!=d?this.dataSource()._getExtent(d):[];return this.constantBaseline=2===e.length&&e[0]===e[1]?e[0]:null,a._userSetDomainer||this.constantBaseline===this.previousBaseline||(null!=this.previousBaseline&&(a.domainer().paddingException(this.previousBaseline,!1),this.previousBaseline=null),null!=this.constantBaseline&&(a.domainer().paddingException(this.constantBaseline,!0),this.previousBaseline=this.constantBaseline),a._autoDomainIfAutomaticMode()),this},c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),"y0"===a&&this._updateYDomainer(),this},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this._generateAttrToProjector(),c=a.x,d=a.y0,e=a.y;delete a.x,delete a.y0,delete a.y,this.areaPath.datum(this._dataSource.data()),this._dataChanged&&(a.d=d3.svg.area().x(c).y0(d).y1(d),this._applyAnimatedAttributes(this.areaPath,"area-reset",a)),a.d=d3.svg.area().x(c).y0(d).y1(e),this._applyAnimatedAttributes(this.areaPath,"area",a)},c}(b.Line);b.Area=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){}return a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(a.Animator||(a.Animator={}));a.Animator}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this._durationMsec=300,this._delayMsec=0,this._easing="exp-out"}return a.prototype.animate=function(a,b){return a.transition().ease(this._easing).duration(this._durationMsec).delay(this._delayMsec).attr(b)},a.prototype.duration=function(a){return void 0===a?this._durationMsec:(this._durationMsec=a,this)},a.prototype.delay=function(a){return void 0===a?this._delayMsec:(this._delayMsec=a,this)},a.prototype.easing=function(a){return void 0===a?this._easing:(this._easing=a,this)},a}();a.Default=b}(a.Animator||(a.Animator={}));a.Animator}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this._delayMsec=15}return __extends(b,a),b.prototype.animate=function(a,b){var c=this;return a.transition().ease(this._easing).duration(this._durationMsec).delay(function(a,b){return b*c._delayMsec}).attr(b)},b}(a.Default);a.IterativeDelay=b}(a.Animator||(a.Animator={}));a.Animator}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(){e||(d3.select(document).on("keydown",d),e=!0)}function c(a,c){e||b(),null==f[a]&&(f[a]=[]),f[a].push(c)}function d(){null!=f[d3.event.keyCode]&&f[d3.event.keyCode].forEach(function(a){a(d3.event)})}var e=!1,f=[];a.initialize=b,a.addCallback=c}(a.KeyEventListener||(a.KeyEventListener={}));a.KeyEventListener}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(a){this.componentToListenTo=a}return a.prototype._anchor=function(a){this.hitBox=a},a.prototype.registerWithComponent=function(){return this.componentToListenTo.registerInteraction(this),this},a}();a.Interaction=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,b)}return __extends(b,a),b.prototype._anchor=function(b){var c=this;a.prototype._anchor.call(this,b),b.on(this._listenTo(),function(){var a=d3.mouse(b.node()),d=a[0],e=a[1];c._callback(d,e)})},b.prototype._listenTo=function(){return"click"},b.prototype.callback=function(a){return this._callback=a,this},b}(a.Abstract.Interaction);b.Click=c;var d=function(a){function b(b){a.call(this,b)}return __extends(b,a),b.prototype._listenTo=function(){return"dblclick"},b}(c);b.DoubleClick=d}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,b)}return __extends(b,a),b.prototype._anchor=function(b){var c=this;a.prototype._anchor.call(this,b),b.on("mousemove",function(){var a=d3.mouse(b.node()),d=a[0],e=a[1];c.mousemove(d,e)})},b.prototype.mousemove=function(){},b}(a.Abstract.Interaction);b.Mousemove=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c){b.call(this,a),this.activated=!1,this.keyCode=c}return __extends(c,b),c.prototype._anchor=function(c){var d=this;b.prototype._anchor.call(this,c),c.on("mouseover",function(){d.activated=!0}),c.on("mouseout",function(){d.activated=!1}),a.Core.KeyEventListener.addCallback(this.keyCode,function(){d.activated&&null!=d._callback&&d._callback() -})},c.prototype.callback=function(a){return this._callback=a,this},c}(a.Abstract.Interaction);b.Key=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c,d){var e=this;a.call(this,b),this.xScale=c,this.yScale=d,this.zoom=d3.behavior.zoom(),this.zoom.x(this.xScale._d3Scale),this.zoom.y(this.yScale._d3Scale),this.zoom.on("zoom",function(){return e.rerenderZoomed()})}return __extends(b,a),b.prototype.resetZoom=function(){var a=this;this.zoom=d3.behavior.zoom(),this.zoom.x(this.xScale._d3Scale),this.zoom.y(this.yScale._d3Scale),this.zoom.on("zoom",function(){return a.rerenderZoomed()}),this.zoom(this.hitBox)},b.prototype._anchor=function(b){a.prototype._anchor.call(this,b),this.zoom(b)},b.prototype.rerenderZoomed=function(){var a=this.xScale._d3Scale.domain(),b=this.yScale._d3Scale.domain();this.xScale.domain(a),this.yScale.domain(b)},b}(a.Abstract.Interaction);b.PanZoom=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){var c=this;a.call(this,b),this.dragInitialized=!1,this.origin=[0,0],this.location=[0,0],this.dragBehavior=d3.behavior.drag(),this.dragBehavior.on("dragstart",function(){return c._dragstart()}),this.dragBehavior.on("drag",function(){return c._drag()}),this.dragBehavior.on("dragend",function(){return c._dragend()})}return __extends(b,a),b.prototype.callback=function(a){return this.callbackToCall=a,this},b.prototype._dragstart=function(){var a=this.componentToListenTo.availableWidth,b=this.componentToListenTo.availableHeight,c=function(a,b){return function(c){return Math.min(Math.max(c,a),b)}};this.constrainX=c(0,a),this.constrainY=c(0,b)},b.prototype._drag=function(){this.dragInitialized||(this.origin=[d3.event.x,d3.event.y],this.dragInitialized=!0),this.location=[this.constrainX(d3.event.x),this.constrainY(d3.event.y)]},b.prototype._dragend=function(){this.dragInitialized&&(this.dragInitialized=!1,this._doDragend())},b.prototype._doDragend=function(){null!=this.callbackToCall&&this.callbackToCall([this.origin,this.location])},b.prototype._anchor=function(b){return a.prototype._anchor.call(this,b),b.call(this.dragBehavior),this},b.prototype.setupZoomCallback=function(a,b){function c(c){return null==c?(f&&(null!=a&&a.domain(d),null!=b&&b.domain(e)),void(f=!f)):(f=!1,null!=a&&a.domain([a.invert(c.xMin),a.invert(c.xMax)]),null!=b&&b.domain([b.invert(c.yMax),b.invert(c.yMin)]),void this.clearBox())}var d=null!=a?a.domain():null,e=null!=b?b.domain():null,f=!1;return this.callback(c),this},b}(a.Abstract.Interaction);b.Drag=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.boxIsDrawn=!1}return __extends(b,a),b.prototype._dragstart=function(){a.prototype._dragstart.call(this),null!=this.callbackToCall&&this.callbackToCall(null),this.clearBox()},b.prototype.clearBox=function(){return null!=this.dragBox?(this.dragBox.attr("height",0).attr("width",0),this.boxIsDrawn=!1,this):void 0},b.prototype.setBox=function(a,b,c,d){if(null!=this.dragBox){var e=Math.abs(a-b),f=Math.abs(c-d),g=Math.min(a,b),h=Math.min(c,d);return this.dragBox.attr({x:g,y:h,width:e,height:f}),this.boxIsDrawn=e>0&&f>0,this}},b.prototype._anchor=function(c){a.prototype._anchor.call(this,c);var d=b.CLASS_DRAG_BOX,e=this.componentToListenTo.foregroundContainer;return this.dragBox=e.append("rect").classed(d,!0).attr("x",0).attr("y",0),this},b.CLASS_DRAG_BOX="drag-box",b}(a.Drag);a.DragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._drag=function(){a.prototype._drag.call(this),this.setBox(this.origin[0],this.location[0])},b.prototype._doDragend=function(){if(null!=this.callbackToCall){var a=Math.min(this.origin[0],this.location[0]),b=Math.max(this.origin[0],this.location[0]),c={xMin:a,xMax:b};this.callbackToCall(c)}},b.prototype.setBox=function(b,c){return a.prototype.setBox.call(this,b,c,0,this.componentToListenTo.availableHeight),this},b}(a.DragBox);a.XDragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._drag=function(){a.prototype._drag.call(this),this.setBox(this.origin[0],this.location[0],this.origin[1],this.location[1])},b.prototype._doDragend=function(){if(null!=this.callbackToCall){var a=Math.min(this.origin[0],this.location[0]),b=Math.max(this.origin[0],this.location[0]),c=Math.min(this.origin[1],this.location[1]),d=Math.max(this.origin[1],this.location[1]),e={xMin:a,xMax:b,yMin:c,yMax:d};this.callbackToCall(e)}},b}(a.DragBox);a.XYDragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._drag=function(){a.prototype._drag.call(this),this.setBox(this.origin[1],this.location[1])},b.prototype._doDragend=function(){if(null!=this.callbackToCall){var a=Math.min(this.origin[1],this.location[1]),b=Math.max(this.origin[1],this.location[1]),c={yMin:a,yMax:b};this.callbackToCall(c)}},b.prototype.setBox=function(b,c){return a.prototype.setBox.call(this,0,this.componentToListenTo.availableWidth,b,c),this},b}(a.DragBox);a.YDragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(){b.call(this),this.xTable=new a.Component.Table,this.yTable=new a.Component.Table,this.centerComponent=new a.Component.Group,this.xyTable=(new a.Component.Table).addComponent(0,0,this.yTable).addComponent(1,1,this.xTable).addComponent(0,1,this.centerComponent),this.addComponent(1,0,this.xyTable)}return __extends(c,b),c.prototype.yAxis=function(a){if(null!=a){if(null!=this._yAxis)throw new Error("yAxis already assigned!");return this._yAxis=a,this.yTable.addComponent(0,1,this._yAxis),this}return this._yAxis},c.prototype.xAxis=function(a){if(null!=a){if(null!=this._xAxis)throw new Error("xAxis already assigned!");return this._xAxis=a,this.xTable.addComponent(0,0,this._xAxis),this}return this._xAxis},c.prototype.yLabel=function(b){if(null!=b){if(null!=this._yLabel){if("string"==typeof b)return this._yLabel.setText(b),this;throw new Error("yLabel already assigned!")}return"string"==typeof b&&(b=new a.Component.AxisLabel(b,"vertical-left")),this._yLabel=b,this.yTable.addComponent(0,0,this._yLabel),this}return this._yLabel},c.prototype.xLabel=function(b){if(null!=b){if(null!=this._xLabel){if("string"==typeof b)return this._xLabel.setText(b),this;throw new Error("xLabel already assigned!")}return"string"==typeof b&&(b=new a.Component.AxisLabel(b,"horizontal")),this._xLabel=b,this.xTable.addComponent(1,0,this._xLabel),this}return this._xLabel},c.prototype.titleLabel=function(b){if(null!=b){if(null!=this._titleLabel){if("string"==typeof b)return this._titleLabel.setText(b),this;throw new Error("titleLabel already assigned!")}return"string"==typeof b&&(b=new a.Component.TitleLabel(b,"horizontal")),this._titleLabel=b,this.addComponent(0,0,this._titleLabel),this}return this._titleLabel},c.prototype.center=function(a){return this.centerComponent.merge(a),this},c}(a.Component.Table);b.StandardChart=c}(a.Template||(a.Template={}));a.Template}(Plottable||(Plottable={})); \ No newline at end of file +var Plottable;!function(a){!function(a){!function(a){function b(a,b,c){return Math.min(b,c)<=a&&a<=Math.max(b,c)}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(a,b){var c=d3.set();return a.forEach(function(a){b.has(a)&&c.add(a)}),c}function e(a){return"function"==typeof a?a:"string"==typeof a&&"#"!==a[0]?function(b){return b[a]}:function(){return a}}function f(a,b){var c=e(a);return function(a,d){return c(a,d,b.metadata())}}function g(a){var b={};return a.forEach(function(a){return b[a]=!0}),d3.keys(b)}function h(a,b){for(var c=[],d=0;b>d;d++)c[d]="function"==typeof a?a(d):a;return c}function i(a){return Array.prototype.concat.apply([],a)}function j(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;cd;){var f=d+e>>>1,g=null==c?b[f]:c(b[f]);a>g?d=f+1:e=f}return d}a.sortedIndex=b}(a.OpenSource||(a.OpenSource={}));a.OpenSource}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this.counter={}}return a.prototype.setDefault=function(a){null==this.counter[a]&&(this.counter[a]=0)},a.prototype.increment=function(a){return this.setDefault(a),++this.counter[a]},a.prototype.decrement=function(a){return this.setDefault(a),--this.counter[a]},a.prototype.get=function(a){return this.setDefault(a),this.counter[a]},a}();a.IDCounter=b}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this.keyValuePairs=[]}return a.prototype.set=function(a,b){if(a!==a)throw new Error("NaN may not be used as a key to the StrictEqualityAssociativeArray");for(var c=0;cb){var h=e("."),i=Math.floor(b/h);return"...".substr(0,i)}for(;f+g>b;)d=d.substr(0,d.length-1).trim(),f=e(d);if(e(d+"...")>b)throw new Error("_addEllipsesToLine failed :(");return d+"..."}function k(b,c,d,e,f,g){"undefined"==typeof f&&(f="left"),"undefined"==typeof g&&(g="top");var h={left:0,center:.5,right:1},i={top:0,center:.5,bottom:1};if(void 0===h[f]||void 0===i[g])throw new Error("unrecognized alignment x:"+f+", y:"+g);var j=c.append("g"),k=j.append("text");k.text(b);var l=a.DOM.getBBox(k),m=l.height,n=l.width;if(n>d||m>e)return console.log("Insufficient space to fit text"),{width:0,height:0};var o={left:"start",center:"middle",right:"end"},p=o[f],q=d*h[f],r=e*i[g]+m*(1-i[g]),s=-.4*(1-i[g]);return k.attr("text-anchor",p).attr("y",s+"em"),a.DOM.translate(j,q,r),{width:n,height:m}}function l(a,b,c,d,e,f,g){if("undefined"==typeof e&&(e="left"),"undefined"==typeof f&&(f="top"),"undefined"==typeof g&&(g="right"),"right"!==g&&"left"!==g)throw new Error("unrecognized rotation: "+g);var h="right"===g,i={left:"bottom",right:"top",center:"center",top:"left",bottom:"right"},j={left:"top",right:"bottom",center:"center",top:"right",bottom:"left"},l=h?i:j,m=b.append("g"),n=k(a,m,d,c,l[f],l[e]),o=d3.transform("");return o.rotate="right"===g?90:-90,o.translate=[h?c:0,h?0:d],m.attr("transform",o.toString()),n}function m(b,c,d,e,f,g){"undefined"==typeof f&&(f="left"),"undefined"==typeof g&&(g="top");var i=h(c),j=0,l=c.append("g");b.forEach(function(b,c){var e=l.append("g");a.DOM.translate(e,0,c*i);var h=k(b,e,d,i,f,g);h.width>j&&(j=h.width)});var m=i*b.length,n=e-m,o={center:.5,top:0,bottom:1};return a.DOM.translate(l,0,n*o[g]),{width:j,height:m}}function n(b,c,d,e,f,g,i){"undefined"==typeof f&&(f="left"),"undefined"==typeof g&&(g="top"),"undefined"==typeof i&&(i="left");var j=h(c),k=0,m=c.append("g");b.forEach(function(b,c){var d=m.append("g");a.DOM.translate(d,c*j,0);var h=l(b,d,j,e,f,g,i);h.height>k&&(k=h.height)});var n=j*b.length,o=d-n,p={center:.5,left:0,right:1};return a.DOM.translate(m,o*p[f],0),{width:n,height:k}}function o(b,c,d,e,f,g){var h=null!=f?f:1.1*c>d,i=h?c:d,j=h?d:c,k=a.WordWrap.breakTextToFitRect(b,i,j,e);if(0===k.lines.length)return{textFits:k.textFits,usedWidth:0,usedHeight:0};var l,o;if(null==g){var p=h?d3.max:d3.sum,q=h?d3.sum:d3.max;l=p(k.lines,function(a){return e(a).width}),o=q(k.lines,function(a){return e(a).height})}else{var r=g.g.append("g").classed("writeText-inner-g",!0),s=h?m:n,t=s(k.lines,r,c,d,g.xAlign,g.yAlign);l=t.width,o=t.height}return{textFits:k.textFits,usedWidth:l,usedHeight:o}}b.getTextMeasure=c;var p="a",q=function(){function b(b){var g=this;this.cache=new a.Cache(c(b),p,a.Methods.objEq),this.measure=d(e(f(function(a){return g.cache.get(a)})))}return b.prototype.clear=function(){return this.cache.clear(),this},b}();b.CachingCharacterMeasurer=q,b.getTruncatedText=g,b.getTextHeight=h,b.getTextWidth=i,b._addEllipsesToLine=j,b.writeLineHorizontally=k,b.writeLineVertically=l,b.writeTextHorizontally=m,b.writeTextVertically=n,b.writeText=o}(a.Text||(a.Text={}));a.Text}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(b){function c(b,c,e,f){var g=function(a){return f(a).width},h=d(b,c,g),i=f("hello world").height,j=Math.floor(e/i),k=j>=h.length;return k||(h=h.splice(0,j),j>0&&(h[j-1]=a.Text._addEllipsesToLine(h[j-1],c,f))),{originalText:b,lines:h,textFits:k}}function d(a,b,c){for(var d=[],e=a.split("\n"),g=0,h=e.length;h>g;g++){var i=e[g];null!==i?d=d.concat(f(i,b,c)):d.push("")}return d}function e(a,b,c){var d=h(a),e=d.map(c),f=d3.max(e);return b>=f}function f(a,b,c){for(var d,e=[],f=h(a),i="",j=0;d||je;e++){var g=a[e];""===c||j(c[0],g,d)?c+=g:(b.push(c),c=g),d=g}return c&&b.push(c),b}function i(a){return null==a?!0:""===a.trim()}function j(a,b,c){return m.test(a)&&m.test(b)?!0:m.test(a)||m.test(b)?!1:l.test(c)||k.test(b)?!1:!0}var k=/[{\[]/,l=/[!"%),-.:;?\]}]/,m=/^\s+$/;b.breakTextToFitRect=c,b.canWrapWithoutBreakingWords=e}(a.WordWrap||(a.WordWrap={}));a.WordWrap}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(a){return a.node().getBBox()}function c(b){null!=window.requestAnimationFrame?window.requestAnimationFrame(b):setTimeout(b,a.POLYFILL_TIMEOUT_MSEC)}function d(a,b){var c=a.getPropertyValue(b);return null==c?0:parseFloat(c)}function e(a){for(var b=a.node();null!==b&&"svg"!==b.nodeName;)b=b.parentNode;return null==b}function f(a){var b=window.getComputedStyle(a);return d(b,"width")+d(b,"padding-left")+d(b,"padding-right")+d(b,"border-left-width")+d(b,"border-right-width")}function g(a){var b=window.getComputedStyle(a);return d(b,"height")+d(b,"padding-top")+d(b,"padding-bottom")+d(b,"border-top-width")+d(b,"border-bottom-width")}function h(a){var b=a.node().clientWidth;if(0===b){var c=a.attr("width");if(-1!==c.indexOf("%")){for(var d=a.node().parentNode;null!=d&&0===d.clientWidth;)d=d.parentNode;if(null==d)throw new Error("Could not compute width of element");b=d.clientWidth*parseFloat(c)/100}else b=parseFloat(c)}return b}function i(a,b,c){var d=d3.transform(a.attr("transform"));return null==b?d.translate:(c=null==c?0:c,d.translate[0]=b,d.translate[1]=c,a.attr("transform",d.toString()),a)}a.getBBox=b,a.POLYFILL_TIMEOUT_MSEC=1e3/60,a.requestAnimationFramePolyfill=c,a.isSelectionRemovedFromSVG=e,a.getElementWidth=f,a.getElementHeight=g,a.getSVGPixelWidth=h,a.translate=i}(a.DOM||(a.DOM={}));a.DOM}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(a){this._onlyShowUnchanged=!0,this.precision(a)}return a.prototype.format=function(a){var b=this._formatFunction(a);return this._onlyShowUnchanged&&this._valueChanged(a,b)?"":b},a.prototype._valueChanged=function(a,b){return a!==parseFloat(b)},a.prototype.precision=function(a){if(void 0===a)return this._precision;if(0>a||a>20)throw new RangeError("Formatter precision must be between 0 and 20");return this._precision=a,this},a.prototype.showOnlyUnchangedValues=function(a){return void 0===a?this._onlyShowUnchanged:(this._onlyShowUnchanged=a,this)},a}();a.Formatter=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(){a.call(this,null),this.showOnlyUnchangedValues(!1),this._formatFunction=function(a){return String(a)}}return __extends(b,a),b}(a.Abstract.Formatter);b.Identity=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=3),a.call(this,b),this._formatFunction=function(a){if("number"==typeof a){var b=Math.pow(10,this._precision);return String(Math.round(a*b)/b)}return String(a)}}return __extends(b,a),b.prototype._valueChanged=function(a,b){return"number"==typeof a?a!==parseFloat(b):!1},b}(a.Abstract.Formatter);b.General=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=3),a.call(this,b),this._formatFunction=function(a){return a.toFixed(this._precision)}}return __extends(b,a),b}(a.Abstract.Formatter);b.Fixed=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(b,c,d){"undefined"==typeof b&&(b=2),"undefined"==typeof c&&(c="$"),"undefined"==typeof d&&(d=!0),a.call(this,b),this.symbol=c,this.prefix=d}return __extends(b,a),b.prototype.format=function(b){var c=a.prototype.format.call(this,Math.abs(b));return""!==c&&(this.prefix?c=this.symbol+c:c+=this.symbol,0>b&&(c="-"+c)),c},b}(a.Fixed);a.Currency=b}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(b){"undefined"==typeof b&&(b=0),a.call(this,b)}return __extends(b,a),b.prototype.format=function(b){var c=a.prototype.format.call(this,100*b);return""!==c&&(c+="%"),c},b}(a.Fixed);a.Percentage=b}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=3),a.call(this,b),this.showOnlyUnchangedValues(!1)}return __extends(b,a),b.prototype.precision=function(b){var c=a.prototype.precision.call(this,b);return this._formatFunction=d3.format("."+this._precision+"s"),c},b}(a.Abstract.Formatter);b.SISuffix=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c){if("undefined"==typeof c&&(c=0),a.call(this,c),null==b)throw new Error("Custom Formatters require a formatting function");this._onlyShowUnchanged=!1,this._formatFunction=function(a){return b(a,this)}}return __extends(b,a),b}(a.Abstract.Formatter);b.Custom=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(){a.call(this,null);var b=8,c={};c[0]={format:".%L",filter:function(a){return 0!==a.getMilliseconds()}},c[1]={format:":%S",filter:function(a){return 0!==a.getSeconds()}},c[2]={format:"%I:%M",filter:function(a){return 0!==a.getMinutes()}},c[3]={format:"%I %p",filter:function(a){return 0!==a.getHours()}},c[4]={format:"%a %d",filter:function(a){return 0!==a.getDay()&&1!==a.getDate()}},c[5]={format:"%b %d",filter:function(a){return 1!==a.getDate()}},c[6]={format:"%b",filter:function(a){return 0!==a.getMonth()}},c[7]={format:"%Y",filter:function(){return!0}},this._formatFunction=function(a){for(var d=0;b>d;d++)if(c[d].filter(a))return d3.time.format(c[d].format)(a)},this.showOnlyUnchangedValues(!1)}return __extends(b,a),b}(a.Abstract.Formatter);b.Time=c}(a.Formatter||(a.Formatter={}));a.Formatter}(Plottable||(Plottable={}));var Plottable;!function(a){a.version="0.20.0"}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this._plottableID=a.nextID++}return a.nextID=0,a}();a.PlottableObject=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this),this.listener2Callback=new a.Util.StrictEqualityAssociativeArray,this.listenable=c}return __extends(c,b),c.prototype.registerListener=function(a,b){return this.listener2Callback.set(a,b),this},c.prototype.broadcast=function(){for(var a=this,b=[],c=0;c=0&&(this._components.splice(b,1),this._invalidateLayout()),this},b.prototype._addComponent=function(a,b){return"undefined"==typeof b&&(b=!1),null==a||this._components.indexOf(a)>=0?!1:(b?this._components.unshift(a):this._components.push(a),a._parent=this,this._isAnchored&&a._anchor(this.content),this._invalidateLayout(),!0)},b.prototype.components=function(){return this._components.slice()},b.prototype.empty=function(){return 0===this._components.length},b.prototype.detachAll=function(){return this._components.slice().forEach(function(a){return a.detach()}),this},b.prototype.remove=function(){a.prototype.remove.call(this),this._components.slice().forEach(function(a){return a.remove()})},b}(a.Component);a.ComponentContainer=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){"undefined"==typeof b&&(b=[]);var c=this;a.call(this),this.classed("component-group",!0),b.forEach(function(a){return c._addComponent(a)})}return __extends(b,a),b.prototype._requestedSpace=function(a,b){var c=this._components.map(function(c){return c._requestedSpace(a,b)}),d=this.empty(),e=d?0:d3.max(c,function(a){return a.width}),f=d?0:d3.max(c,function(a){return a.height});return{width:Math.min(e,a),height:Math.min(f,b),wantsWidth:d?!1:c.map(function(a){return a.wantsWidth}).some(function(a){return a}),wantsHeight:d?!1:c.map(function(a){return a.wantsHeight}).some(function(a){return a})}},b.prototype.merge=function(a){return this._addComponent(a),this},b.prototype._computeLayout=function(b,c,d,e){var f=this;return a.prototype._computeLayout.call(this,b,c,d,e),this._components.forEach(function(a){a._computeLayout(0,0,f.availableWidth,f.availableHeight)}),this},b.prototype._isFixedWidth=function(){return this._components.every(function(a){return a._isFixedWidth()})},b.prototype._isFixedHeight=function(){return this._components.every(function(a){return a._isFixedHeight()})},b}(a.Abstract.ComponentContainer);b.Group=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){"undefined"==typeof a&&(a=[]);var c=this;b.call(this),this.rowPadding=0,this.colPadding=0,this.rows=[],this.rowWeights=[],this.colWeights=[],this.nRows=0,this.nCols=0,this.classed("table",!0),a.forEach(function(a,b){a.forEach(function(a,d){c.addComponent(b,d,a)})})}return __extends(c,b),c.prototype.addComponent=function(a,b,c){if(this._addComponent(c)){this.nRows=Math.max(a+1,this.nRows),this.nCols=Math.max(b+1,this.nCols),this.padTableToSize(this.nRows,this.nCols);var d=this.rows[a][b];if(null!=d)throw new Error("Table.addComponent cannot be called on a cell where a component already exists (for the moment)");this.rows[a][b]=c}return this},c.prototype._removeComponent=function(a){b.prototype._removeComponent.call(this,a);var c,d;a:for(var e=0;e0&&v&&e!==x,C=f>0&&w&&f!==y;if(!B&&!C)break;if(r>5)break}return e=h-d3.sum(u.guaranteedWidths),f=i-d3.sum(u.guaranteedHeights),n=c.calcProportionalSpace(k,e),o=c.calcProportionalSpace(j,f),{colProportionalSpace:n,rowProportionalSpace:o,guaranteedWidths:u.guaranteedWidths,guaranteedHeights:u.guaranteedHeights,wantsWidth:v,wantsHeight:w}},c.prototype.determineGuarantees=function(b,c){var d=a.Util.Methods.createFilledArray(0,this.nCols),e=a.Util.Methods.createFilledArray(0,this.nRows),f=a.Util.Methods.createFilledArray(!1,this.nCols),g=a.Util.Methods.createFilledArray(!1,this.nRows);return this.rows.forEach(function(a,h){a.forEach(function(a,i){var j;j=null!=a?a._requestedSpace(b[i],c[h]):{width:0,height:0,wantsWidth:!1,wantsHeight:!1};var k=.001,l=function(a,b){return a-b-k>0};(l(j.width,b[i])||l(j.height,c[h]))&&console.log("Invariant Violation: Abstract.Component cannot request more space than is offered"),d[i]=Math.max(d[i],j.width),e[h]=Math.max(e[h],j.height),f[i]=f[i]||j.wantsWidth,g[h]=g[h]||j.wantsHeight})}),{guaranteedWidths:d,guaranteedHeights:e,wantsWidthArr:f,wantsHeightArr:g}},c.prototype._requestedSpace=function(a,b){var c=this.iterateLayout(a,b);return{width:d3.sum(c.guaranteedWidths),height:d3.sum(c.guaranteedHeights),wantsWidth:c.wantsWidth,wantsHeight:c.wantsHeight} +},c.prototype._computeLayout=function(c,d,e,f){var g=this;b.prototype._computeLayout.call(this,c,d,e,f);var h=this.iterateLayout(this.availableWidth,this.availableHeight),i=a.Util.Methods.addArrays(h.rowProportionalSpace,h.guaranteedHeights),j=a.Util.Methods.addArrays(h.colProportionalSpace,h.guaranteedWidths),k=0;return this.rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a._computeLayout(c,k,j[d],i[b]),c+=j[d]+g.colPadding}),k+=i[b]+g.rowPadding}),this},c.prototype.padding=function(a,b){return this.rowPadding=a,this.colPadding=b,this._invalidateLayout(),this},c.prototype.rowWeight=function(a,b){return this.rowWeights[a]=b,this._invalidateLayout(),this},c.prototype.colWeight=function(a,b){return this.colWeights[a]=b,this._invalidateLayout(),this},c.prototype._isFixedWidth=function(){var a=d3.transpose(this.rows);return c.fixedSpace(a,function(a){return null==a||a._isFixedWidth()})},c.prototype._isFixedHeight=function(){return c.fixedSpace(this.rows,function(a){return null==a||a._isFixedHeight()})},c.prototype.padTableToSize=function(a,b){for(var c=0;a>c;c++){void 0===this.rows[c]&&(this.rows[c]=[],this.rowWeights[c]=null);for(var d=0;b>d;d++)void 0===this.rows[c][d]&&(this.rows[c][d]=null)}for(d=0;b>d;d++)void 0===this.colWeights[d]&&(this.colWeights[d]=null)},c.calcComponentWeights=function(a,b,c){return a.map(function(a,d){if(null!=a)return a;var e=b[d].map(c),f=e.reduce(function(a,b){return a&&b},!0);return f?0:1})},c.calcProportionalSpace=function(b,c){var d=d3.sum(b);return 0===d?a.Util.Methods.createFilledArray(0,b.length):b.map(function(a){return c*a/d})},c.fixedSpace=function(a,b){var c=function(a){return a.reduce(function(a,b){return a&&b},!0)},d=function(a){return c(a.map(b))};return c(a.map(d))},c}(a.Abstract.ComponentContainer);b.Table=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this),this.autoDomainAutomatically=!0,this.broadcaster=new a.Core.Broadcaster(this),this._rendererAttrID2Extent={},this._d3Scale=c}return __extends(c,b),c.prototype._getAllExtents=function(){return d3.values(this._rendererAttrID2Extent)},c.prototype._getExtent=function(){return[]},c.prototype.autoDomain=function(){return this.autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},c.prototype._autoDomainIfAutomaticMode=function(){this.autoDomainAutomatically&&this.autoDomain()},c.prototype.scale=function(a){return this._d3Scale(a)},c.prototype.domain=function(a){return null==a?this._d3Scale.domain():(this.autoDomainAutomatically=!1,this._setDomain(a),this)},c.prototype._setDomain=function(a){if(1/0===a[0]||a[0]===-1/0||1/0===a[1]||a[1]===-1/0)throw new Error("data cannot contain Infinity or -Infinity");this._d3Scale.domain(a),this.broadcaster.broadcast()},c.prototype.range=function(a){return null==a?this._d3Scale.range():(this._d3Scale.range(a),this)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.updateExtent=function(a,b,c){return this._rendererAttrID2Extent[a+b]=c,this._autoDomainIfAutomaticMode(),this},c.prototype.removeExtent=function(a,b){return delete this._rendererAttrID2Extent[a+b],this._autoDomainIfAutomaticMode(),this},c}(b.PlottableObject);b.Scale=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this),this._dataChanged=!1,this._animate=!1,this._animators={},this._ANIMATION_DURATION=250,this._projectors={},this.animateOnNextRender=!0,this.clipPathEnabled=!0,this.classed("renderer",!0);var d;d=null!=c?"function"==typeof c.data?c:d=new a.DataSource(c):new a.DataSource,this.dataSource(d)}return __extends(c,b),c.prototype._anchor=function(a){return b.prototype._anchor.call(this,a),this.animateOnNextRender=!0,this._dataChanged=!0,this.updateAllProjectors(),this},c.prototype.remove=function(){var a=this;b.prototype.remove.call(this),this._dataSource.broadcaster.deregisterListener(this);var c=Object.keys(this._projectors);c.forEach(function(b){var c=a._projectors[b];null!=c.scale&&c.scale.broadcaster.deregisterListener(a)})},c.prototype.dataSource=function(a){var b=this;if(null==a)return this._dataSource;var c=this._dataSource;return null!=c&&this._dataSource.broadcaster.deregisterListener(this),this._dataSource=a,this._dataSource.broadcaster.registerListener(this,function(){return b._onDataSourceUpdate()}),this._onDataSourceUpdate(),this},c.prototype._onDataSourceUpdate=function(){this.updateAllProjectors(),this.animateOnNextRender=!0,this._dataChanged=!0,this._render()},c.prototype.project=function(a,b,c){var d=this;a=a.toLowerCase();var e=this._projectors[a],f=null!=e?e.scale:null;return null!=f&&(f.removeExtent(this._plottableID,a),f.broadcaster.deregisterListener(this)),null!=c&&c.broadcaster.registerListener(this,function(){return d._render()}),this._projectors[a]={accessor:b,scale:c},this.updateProjector(a),this._render(),this},c.prototype._generateAttrToProjector=function(){var b=this,c={};return d3.keys(this._projectors).forEach(function(d){var e=b._projectors[d],f=a.Util.Methods.applyAccessor(e.accessor,b.dataSource()),g=e.scale,h=null==g?f:function(a,b){return g.scale(f(a,b))};c[d]=h}),c},c.prototype._doRender=function(){return null!=this.element&&(this._paint(),this._dataChanged=!1,this.animateOnNextRender=!1),this},c.prototype._paint=function(){},c.prototype._setup=function(){return b.prototype._setup.call(this),this.renderArea=this.content.append("g").classed("render-area",!0),this},c.prototype.animate=function(a){return this._animate=a,this},c.prototype.detach=function(){return b.prototype.detach.call(this),this.updateAllProjectors(),this},c.prototype.updateAllProjectors=function(){var a=this;return d3.keys(this._projectors).forEach(function(b){return a.updateProjector(b)}),this},c.prototype.updateProjector=function(a){var b=this._projectors[a];if(null!=b.scale){var c=this.dataSource()._getExtent(b.accessor);0!==c.length&&this._isAnchored?b.scale.updateExtent(this._plottableID,a,c):b.scale.removeExtent(this._plottableID,a)}return this},c.prototype._applyAnimatedAttributes=function(a,b,c){return this._animate&&this.animateOnNextRender&&null!=this._animators[b]?this._animators[b].animate(a,c,this):a.attr(c)},c.prototype.animator=function(a,b){return void 0===b?this._animators[a]:(this._animators[a]=b,this)},c}(b.Component);b.Plot=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var Plottable;!function(a){!function(b){!function(b){!function(c){var d=function(){function a(){}return a.prototype.render=function(){b.flush()},a}();c.Immediate=d;var e=function(){function c(){}return c.prototype.render=function(){a.Util.DOM.requestAnimationFramePolyfill(b.flush)},c}();c.AnimationFrame=e;var f=function(){function c(){this._timeoutMsec=a.Util.DOM.POLYFILL_TIMEOUT_MSEC}return c.prototype.render=function(){setTimeout(b.flush,this._timeoutMsec)},c}();c.Timeout=f}(b.RenderPolicy||(b.RenderPolicy={}));b.RenderPolicy}(b.RenderController||(b.RenderController={}));b.RenderController}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(b){function c(a){b._renderPolicy=a}function d(a){h[a._plottableID]=a,f()}function e(a){i[a._plottableID]=a,h[a._plottableID]=a,f()}function f(){j||(j=!0,b._renderPolicy.render())}function g(){if(j){var b=d3.values(i);b.forEach(function(a){return a._computeLayout()});var c=d3.values(h);c.forEach(function(a){return a._render()}),c=d3.values(h),c.forEach(function(a){return a._doRender()}),i={},h={},j=!1}a.ResizeBroadcaster.clearResizing()}var h={},i={},j=!1;b._renderPolicy=new b.RenderPolicy.AnimationFrame,b.setRenderPolicy=c,b.registerToRender=d,b.registerToComputeLayout=e,b.flush=g}(a.RenderController||(a.RenderController={}));a.RenderController}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(b){function c(){void 0===i&&(i=new a.Broadcaster(b),window.addEventListener("resize",d))}function d(){j=!0,i.broadcast()}function e(){return j}function f(){j=!1}function g(a){c(),i.registerListener(a._plottableID,function(){return a._invalidateLayout()})}function h(a){i&&i.deregisterListener(a._plottableID)}var i,j=!1;b.resizing=e,b.clearResizing=f,b.register=g,b.deregister=h}(a.ResizeBroadcaster||(a.ResizeBroadcaster={}));a.ResizeBroadcaster}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(){}(Plottable||(Plottable={}));var Plottable;!function(a){var b=function(){function a(b){"undefined"==typeof b&&(b=a.defaultCombineExtents),this.doNice=!1,this.padProportion=0,this.paddingExceptions=d3.map(),this.unregisteredPaddingExceptions=d3.set(),this.includedValues=d3.map(),this.unregisteredIncludedValues=d3.map(),this.combineExtents=b}return a.prototype.computeDomain=function(a,b){var c;return c=this.combineExtents(a),c=this.includeDomain(c),c=this.padDomain(c),c=this.niceDomain(b,c)},a.prototype.pad=function(a){return"undefined"==typeof a&&(a=.05),this.padProportion=a,this},a.prototype.addPaddingException=function(a,b){return null!=b?this.paddingExceptions.set(b,a):this.unregisteredPaddingExceptions.add(a),this},a.prototype.removePaddingException=function(a){return"string"==typeof a?this.paddingExceptions.remove(a):this.unregisteredPaddingExceptions.remove(a),this},a.prototype.addIncludedValue=function(a,b){return null!=b?this.includedValues.set(b,a):this.unregisteredIncludedValues.set(a,a),this},a.prototype.removeIncludedValue=function(a){return"string"==typeof a?this.includedValues.remove(a):this.unregisteredIncludedValues.remove(a),this},a.prototype.nice=function(a){return this.doNice=!0,this.niceCount=a,this},a.defaultCombineExtents=function(a){return 0===a.length?[0,1]:[d3.min(a,function(a){return a[0]}),d3.max(a,function(a){return a[1]})]},a.prototype.padDomain=function(b){if(b[0]===b[1]&&this.padProportion>0){var c=b[0].valueOf();return b[0]instanceof Date?[c-a.ONE_DAY,c+a.ONE_DAY]:[c-a.PADDING_FOR_IDENTICAL_DOMAIN,c+a.PADDING_FOR_IDENTICAL_DOMAIN]}var d=b[1]-b[0],e=[b[0].valueOf()-this.padProportion/2*d,b[1].valueOf()+this.padProportion/2*d],f=this.paddingExceptions.values().concat(this.unregisteredPaddingExceptions.values()),g=d3.set(f);return g.has(b[0])&&(e[0]=b[0]),g.has(b[1])&&(e[1]=b[1]),e},a.prototype.niceDomain=function(a,b){return this.doNice?a._niceDomain(b,this.niceCount):b},a.prototype.includeDomain=function(a){var b=this.includedValues.values().concat(this.unregisteredIncludedValues.values());return b.reduce(function(a,b){return[Math.min(a[0],b),Math.max(a[1],b)]},a)},a.PADDING_FOR_IDENTICAL_DOMAIN=1,a.ONE_DAY=864e5,a}();a.Domainer=b}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c){b.call(this,c),this.lastRequestedTickCount=10,this._PADDING_FOR_IDENTICAL_DOMAIN=1,this._userSetDomainer=!1,this._domainer=new a.Domainer}return __extends(c,b),c.prototype.autoDomain=function(){return this._setDomain(this._domainer.computeDomain(this._getAllExtents(),this)),this},c.prototype.invert=function(a){return this._d3Scale.invert(a)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype.interpolate=function(a){return null==a?this._d3Scale.interpolate():(this._d3Scale.interpolate(a),this)},c.prototype.rangeRound=function(a){return this._d3Scale.rangeRound(a),this},c.prototype.clamp=function(a){return null==a?this._d3Scale.clamp():(this._d3Scale.clamp(a),this)},c.prototype.ticks=function(a){return null!=a&&(this.lastRequestedTickCount=a),this._d3Scale.ticks(this.lastRequestedTickCount)},c.prototype.tickFormat=function(a,b){return this._d3Scale.tickFormat(a,b)},c.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},c.prototype.domainer=function(a){return null==a?this._domainer:(this._domainer=a,this._userSetDomainer=!0,this._autoDomainIfAutomaticMode(),this)},c}(b.Scale);b.QuantitiveScale=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,null==b?d3.scale.linear():b)}return __extends(b,a),b.prototype.copy=function(){return new b(this._d3Scale.copy())},b}(a.Abstract.QuantitiveScale);b.Linear=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,null==b?d3.scale.log():b)}return __extends(b,a),b.prototype.copy=function(){return new b(this._d3Scale.copy())},b}(a.Abstract.QuantitiveScale);b.Log=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){if(b.call(this,null==a?d3.scale.ordinal():a),this._range=[0,1],this._rangeType="bands",this._innerPadding=.3,this._outerPadding=.5,this._innerPadding>this._outerPadding)throw new Error("outerPadding must be >= innerPadding so cat axis bands work out reasonably")}return __extends(c,b),c.prototype._getExtent=function(){var b=this._getAllExtents();return a.Util.Methods.uniq(a.Util.Methods.flatten(b))},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype._setDomain=function(a){b.prototype._setDomain.call(this,a),this.range(this.range())},c.prototype.range=function(a){return null==a?this._range:(this._range=a,"points"===this._rangeType?this._d3Scale.rangePoints(a,2*this._outerPadding):"bands"===this._rangeType&&this._d3Scale.rangeBands(a,this._innerPadding,this._outerPadding),this)},c.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},c.prototype.innerPadding=function(){var a=this.domain();if(a.length<2)return 0;var b=Math.abs(this.scale(a[1])-this.scale(a[0]));return b-this.rangeBand()},c.prototype.fullBandStartAndWidth=function(a){var b=this.scale(a)-this.innerPadding()/2,c=this.rangeBand()+this.innerPadding();return[b,c]},c.prototype.rangeType=function(a,b,c){if(null==a)return this._rangeType;if("points"!==a&&"bands"!==a)throw new Error("Unsupported range type: "+a);return this._rangeType=a,null!=b&&(this._outerPadding=b),null!=c&&(this._innerPadding=c),this.broadcaster.broadcast(),this},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c}(a.Abstract.Scale);b.Ordinal=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){var c;switch(a){case"Category10":case"category10":case"10":c=d3.scale.category10();break;case"Category20":case"category20":case"20":c=d3.scale.category20();break;case"Category20b":case"category20b":case"20b":c=d3.scale.category20b();break;case"Category20c":case"category20c":case"20c":c=d3.scale.category20c();break;case null:case void 0:c=d3.scale.ordinal();break;default:throw new Error("Unsupported ColorScale type")}b.call(this,c)}return __extends(c,b),c.prototype._getExtent=function(){var b=this._getAllExtents(),c=[];return b.forEach(function(a){c=c.concat(a)}),a.Util.Methods.uniq(c)},c}(a.Abstract.Scale);b.Color=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,null==b?d3.time.scale():b),this._PADDING_FOR_IDENTICAL_DOMAIN=864e5}return __extends(b,a),b.prototype._setDomain=function(b){a.prototype._setDomain.call(this,b.map(function(a){return new Date(a)}))},b}(a.Abstract.QuantitiveScale);b.Time=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(c,d){"undefined"==typeof c&&(c="reds"),"undefined"==typeof d&&(d="linear"),this._colorRange=this._resolveColorValues(c),this._scaleType=d,a.call(this,b.getD3InterpolatedScale(this._colorRange,this._scaleType))}return __extends(b,a),b.getD3InterpolatedScale=function(a,c){var d;switch(c){case"linear":d=d3.scale.linear();break;case"log":d=d3.scale.log();break;case"sqrt":d=d3.scale.sqrt();break;case"pow":d=d3.scale.pow()}if(null==d)throw new Error("unknown quantitive scale type "+c);return d.range([0,1]).interpolate(b.interpolateColors(a))},b.interpolateColors=function(a){if(a.length<2)throw new Error("Color scale arrays must have at least two elements.");return function(){return function(b){b=Math.max(0,Math.min(1,b));var c=b*(a.length-1),d=Math.floor(c),e=Math.ceil(c),f=c-d;return d3.interpolateLab(a[d],a[e])(f)}}},b.prototype.colorRange=function(a){return null==a?this._colorRange:(this._colorRange=this._resolveColorValues(a),void this._resetScale())},b.prototype.scaleType=function(a){return null==a?this._scaleType:(this._scaleType=a,void this._resetScale())},b.prototype._resetScale=function(){this._d3Scale=b.getD3InterpolatedScale(this._colorRange,this._scaleType),this._autoDomainIfAutomaticMode(),this.broadcaster.broadcast()},b.prototype._resolveColorValues=function(a){return a instanceof Array?a:null!=b.COLOR_SCALES[a]?b.COLOR_SCALES[a]:b.COLOR_SCALES.reds},b.COLOR_SCALES={reds:["#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"],blues:["#FFFFFF","#CCFFFF","#A5FFFD","#85F7FB","#6ED3EF","#55A7E0","#417FD0","#2545D3","#0B02E1"],posneg:["#0B02E1","#2545D3","#417FD0","#55A7E0","#6ED3EF","#85F7FB","#A5FFFD","#CCFFFF","#FFFFFF","#FFF6E1","#FEF4C0","#FED976","#FEB24C","#FD8D3C","#FC4E2A","#E31A1C","#B10026"]},b}(a.Abstract.QuantitiveScale);b.InterpolatedColor=c}(a.Scale||(a.Scale={}));a.Scale}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(a){var b=this;if(this.rescaleInProgress=!1,null==a)throw new Error("ScaleDomainCoordinator requires scales to coordinate");this.scales=a,this.scales.forEach(function(a){return a.broadcaster.registerListener(b,function(a){return b.rescale(a)})})}return a.prototype.rescale=function(a){if(!this.rescaleInProgress){this.rescaleInProgress=!0;var b=a.domain();this.scales.forEach(function(a){return a.domain(b)}),this.rescaleInProgress=!1}},a}();a.ScaleDomainCoordinator=b}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(c){function d(b,d,e){var f=this;if(c.call(this),this._width="auto",this._height="auto",this._tickLength=5,this._tickLabelPadding=3,this._showEndTickLabels=!1,null==b||null==d)throw new Error("Axis requires a scale and orientation");this._scale=b,this.orient(d),this.classed("axis",!0),this._isHorizontal()?this.classed("x-axis",!0):this.classed("y-axis",!0),null==e&&(e=new a.Formatter.General,e.showOnlyUnchangedValues(!1)),this.formatter(e),this._scale.broadcaster.registerListener(this,function(){return f.rescale()})}return __extends(d,c),d.prototype.remove=function(){c.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},d.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},d.prototype._computeWidth=function(){return this._computedWidth=this._tickLength,this._computedWidth},d.prototype._computeHeight=function(){return this._computedHeight=this._tickLength,this._computedHeight},d.prototype._requestedSpace=function(a,b){var c=this._width,d=this._height;return this._isHorizontal()?("auto"===this._height&&(null==this._computedHeight&&this._computeHeight(),d=this._computedHeight),c=0):("auto"===this._width&&(null==this._computedWidth&&this._computeWidth(),c=this._computedWidth),d=0),{width:Math.min(a,c),height:Math.min(b,d),wantsWidth:!this._isHorizontal()&&c>a,wantsHeight:this._isHorizontal()&&d>b}},d.prototype._computeLayout=function(a,b,d,e){return c.prototype._computeLayout.call(this,a,b,d,e),this._scale.range(this._isHorizontal()?[0,this.availableWidth]:[this.availableHeight,0]),this},d.prototype._setup=function(){return c.prototype._setup.call(this),this._tickMarkContainer=this.content.append("g").classed(d.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this.content.append("g").classed(d.TICK_LABEL_CLASS+"-container",!0),this._baseline=this.content.append("line").classed("baseline",!0),this},d.prototype._getTickValues=function(){return[]},d.prototype._doRender=function(){var a=this._getTickValues(),b=this._tickMarkContainer.selectAll("."+d.TICK_MARK_CLASS).data(a);return b.enter().append("line").classed(d.TICK_MARK_CLASS,!0),b.attr(this._generateTickMarkAttrHash()),b.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash()),this},d.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.availableWidth;break;case"top":a.x2=this.availableWidth,a.y1=this.availableHeight,a.y2=this.availableHeight;break;case"left":a.x1=this.availableWidth,a.x2=this.availableWidth,a.y2=this.availableHeight;break;case"right":a.y2=this.availableHeight}return a},d.prototype._generateTickMarkAttrHash=function(){var a=this,b={x1:0,y1:0,x2:0,y2:0},c=function(b){return a._scale.scale(b)};switch(this._isHorizontal()?(b.x1=c,b.x2=c):(b.y1=c,b.y2=c),this._orientation){case"bottom":b.y2=this._tickLength;break;case"top":b.y1=this.availableHeight,b.y2=this.availableHeight-this._tickLength;break;case"left":b.x1=this.availableWidth,b.x2=this.availableWidth-this._tickLength;break;case"right":b.x2=this._tickLength}return b},d.prototype.rescale=function(){return null!=this.element?this._render():null},d.prototype._invalidateLayout=function(){c.prototype._invalidateLayout.call(this),this._computedWidth=null,this._computedHeight=null},d.prototype.width=function(a){if(null==a)return this.availableWidth;if(this._isHorizontal())throw new Error("width cannot be set on a horizontal Axis");if("auto"!==a&&0>a)throw new Error("invalid value for width");return this._width=a,this._invalidateLayout(),this},d.prototype.height=function(a){if(null==a)return this.availableHeight;if(!this._isHorizontal())throw new Error("height cannot be set on a vertical Axis");if("auto"!==a&&0>a)throw new Error("invalid value for height");return this._height=a,this._invalidateLayout(),this},d.prototype.formatter=function(a){return this._formatter=a,this._invalidateLayout(),this},d.prototype.tickLength=function(a){if(null==a)return this._tickLength;if(0>a)throw new Error("tick length must be positive");return this._tickLength=a,this._invalidateLayout(),this},d.prototype.tickLabelPadding=function(a){if(null==a)return this._tickLabelPadding;if(0>a)throw new Error("tick label padding must be positive");return this._tickLabelPadding=a,this._invalidateLayout(),this},d.prototype.orient=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._invalidateLayout(),this},d.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this._render(),this)},d.prototype._hideEndTickLabels=function(){var a=this,c=this.element.select(".bounding-box")[0][0].getBoundingClientRect(),d=function(b){return Math.floor(c.left)<=Math.ceil(b.left)&&Math.floor(c.top)<=Math.ceil(b.top)&&Math.floor(b.right)<=Math.ceil(c.left+a.availableWidth)&&Math.floor(b.bottom)<=Math.ceil(c.top+a.availableHeight)},e=this._tickLabelContainer.selectAll("."+b.Axis.TICK_LABEL_CLASS),f=e[0][0];d(f.getBoundingClientRect())||d3.select(f).style("visibility","hidden");var g=e[0][e[0].length-1];d(g.getBoundingClientRect())||d3.select(g).style("visibility","hidden")},d.prototype._hideOverlappingTickLabels=function(){function a(a,b){return a.rightb.right?!1:a.bottomb.bottom?!1:!0}var c,d=this._tickLabelContainer.selectAll("."+b.Axis.TICK_LABEL_CLASS).filter(function(){return"visible"===d3.select(this).style("visibility")});d.each(function(){var b=this.getBoundingClientRect(),d=d3.select(this);null!=c&&a(b,c)?d.style("visibility","hidden"):(c=b,d.style("visibility","visible"))})},d.TICK_MARK_CLASS="tick-mark",d.TICK_LABEL_CLASS="tick-label",d}(b.Component);b.Axis=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c,d){b.call(this,a,c,d),this.tickLabelPositioning="center",this.showFirstTickLabel=!1,this.showLastTickLabel=!1}return __extends(c,b),c.prototype._computeWidth=function(){var b=this._getTickValues(),c=function(a){var b=Math.floor(Math.log(Math.abs(a))/Math.LN10);return b>0?b:1},d=Math.max.apply(null,b.map(c)),e=this._formatter.precision(),f=-(Math.pow(10,d)+Math.pow(10,-e)),g=this._tickLabelContainer.append("text").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),h=this._formatter.format(f),i=g.text(h).node().getComputedTextLength();return g.remove(),this._computedWidth="center"===this.tickLabelPositioning?this.tickLength()+this.tickLabelPadding()+i:Math.max(this.tickLength(),this.tickLabelPadding()+i),this._computedWidth},c.prototype._computeHeight=function(){var b=this._tickLabelContainer.append("text").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),c=a.Util.DOM.getBBox(b.text("test")).height;return b.remove(),this._computedHeight="center"===this.tickLabelPositioning?this.tickLength()+this.tickLabelPadding()+c:Math.max(this.tickLength(),this.tickLabelPadding()+c),this._computedHeight},c.prototype._getTickValues=function(){return this._scale.ticks()},c.prototype._doRender=function(){var c=this;b.prototype._doRender.call(this);var d={x:0,y:0,dx:"0em",dy:"0.3em"},e=this.tickLength(),f=this.tickLabelPadding(),g="middle",h=0,i=0,j=0,k=0;if(this._isHorizontal())switch(this.tickLabelPositioning){case"left":g="end",h=-f,k=f;break;case"center":k=e+f;break;case"right":g="start",h=f,k=f}else switch(this.tickLabelPositioning){case"top":d.dy="-0.3em",j=f,i=-f;break;case"center":j=e+f;break;case"bottom":d.dy="1em",j=f,i=f}var l=this._generateTickMarkAttrHash();switch(this._orientation){case"bottom":d.x=l.x1,d.dy="0.95em",i=l.y1+k;break;case"top":d.x=l.x1,d.dy="-.25em",i=l.y1-k;break;case"left":g="end",h=l.x1-j,d.y=l.y1;break;case"right":g="start",h=l.x1+j,d.y=l.y1}var m=this._getTickValues(),n=this._tickLabelContainer.selectAll("."+a.Abstract.Axis.TICK_LABEL_CLASS).data(m);n.enter().append("text").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),n.exit().remove();var o=function(a){return c._formatter.format(a)};n.style("text-anchor",g).style("visibility","visible").attr(d).text(o);var p="translate("+h+", "+i+")";return this._tickLabelContainer.attr("transform",p),this.showEndTickLabels()||this._hideEndTickLabels(),this._hideOverlappingTickLabels(),this},c.prototype.tickLabelPosition=function(a){if(null==a)return this.tickLabelPositioning;var b=a.toLowerCase();if(this._isHorizontal()){if("left"!==b&&"center"!==b&&"right"!==b)throw new Error(b+" is not a valid tick label position for a horizontal NumericAxis")}else if("top"!==b&&"center"!==b&&"bottom"!==b)throw new Error(b+" is not a valid tick label position for a vertical NumericAxis");return this.tickLabelPositioning=b,this._invalidateLayout(),this},c.prototype.showEndTickLabel=function(a,b){if(this._isHorizontal()&&"left"===a||!this._isHorizontal()&&"bottom"===a)return void 0===b?this.showFirstTickLabel:(this.showFirstTickLabel=b,this._render());if(this._isHorizontal()&&"right"===a||!this._isHorizontal()&&"top"===a)return void 0===b?this.showLastTickLabel:(this.showLastTickLabel=b,this._render());throw new Error("Attempt to show "+a+" tick label on a "+(this._isHorizontal()?"horizontal":"vertical")+" axis")},c}(a.Abstract.Axis);b.Numeric=c}(a.Axis||(a.Axis={}));a.Axis}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){"undefined"==typeof d&&(d="bottom"),"undefined"==typeof e&&(e=new a.Formatter.Identity);var f=this;if(b.call(this,c,d,e),this.classed("category-axis",!0),"bands"!==c.rangeType())throw new Error("Only rangeBands category axes are implemented");this._scale.broadcaster.registerListener(this,function(){return f._invalidateLayout()})}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.measurer=new a.Util.Text.CachingCharacterMeasurer(this._tickLabelContainer),this},c.prototype._requestedSpace=function(a,b){var c=this._isHorizontal()?0:this.tickLength()+this.tickLabelPadding(),d=this._isHorizontal()?this.tickLength()+this.tickLabelPadding():0;if(0>a||0>b)return{width:a,height:b,wantsWidth:!this._isHorizontal(),wantsHeight:this._isHorizontal()};if(0===this._scale.domain().length)return{width:0,height:0,wantsWidth:!1,wantsHeight:!1};var e=this._scale.copy();e.range(this._isHorizontal()?[0,a]:[b,0]);var f=this.measureTicks(a,b,e,this._scale.domain());return{width:f.usedWidth+c,height:f.usedHeight+d,wantsWidth:!f.textFits,wantsHeight:!f.textFits}},c.prototype._getTickValues=function(){return this._scale.domain()},c.prototype.measureTicks=function(b,c,d,e){var f="string"!=typeof e[0],g=this,h=[],i=function(a){return g.measurer.measure(a)},j=f?function(a){return e.each(a)}:function(a){return e.forEach(a)};j(function(e){var j,k=d.fullBandStartAndWidth(e)[1],l=g._isHorizontal()?k:b-g.tickLength()-g.tickLabelPadding(),m=g._isHorizontal()?c-g.tickLength()-g.tickLabelPadding():k,n=g._formatter;if(f){var o=d3.select(this),p={left:"right",right:"left",top:"center",bottom:"center"},q={left:"center",right:"center",top:"bottom",bottom:"top"};j=a.Util.Text.writeText(n.format(e),l,m,i,!0,{g:o,xAlign:p[g._orientation],yAlign:q[g._orientation]})}else j=a.Util.Text.writeText(n.format(e),l,m,i,!0);h.push(j)});var k=this._isHorizontal()?d3.sum:d3.max,l=this._isHorizontal()?d3.max:d3.sum;return{textFits:h.every(function(a){return a.textFits}),usedWidth:k(h,function(a){return a.usedWidth}),usedHeight:l(h,function(a){return a.usedHeight})}},c.prototype._doRender=function(){var c=this;b.prototype._doRender.call(this);var d=this._tickLabelContainer.selectAll("."+a.Abstract.Axis.TICK_LABEL_CLASS).data(this._scale.domain(),function(a){return a}),e=function(a){var b=c._scale.fullBandStartAndWidth(a),d=b[0],e=c._isHorizontal()?d:0,f=c._isHorizontal()?0:d;return"translate("+e+","+f+")"};d.enter().append("g").classed(a.Abstract.Axis.TICK_LABEL_CLASS,!0),d.exit().remove(),d.attr("transform",e),d.text(""),this.measureTicks(this.availableWidth,this.availableHeight,this._scale,d); +var f=this._isHorizontal()?[this._scale.rangeBand()/2,0]:[0,this._scale.rangeBand()/2],g="right"===this._orientation?this.tickLength()+this.tickLabelPadding():0,h="bottom"===this._orientation?this.tickLength()+this.tickLabelPadding():0;return a.Util.DOM.translate(this._tickLabelContainer,g,h),a.Util.DOM.translate(this._tickMarkContainer,f[0],f[1]),this},c.prototype._computeLayout=function(a,c,d,e){return this.measurer.clear(),b.prototype._computeLayout.call(this,a,c,d,e)},c}(a.Abstract.Axis);b.Category=c}(a.Axis||(a.Axis={}));a.Axis}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c){if("undefined"==typeof a&&(a=""),"undefined"==typeof c&&(c="horizontal"),b.call(this),this.classed("label",!0),this.text(a),c=c.toLowerCase(),"vertical-left"===c&&(c="left"),"vertical-right"===c&&(c="right"),"horizontal"!==c&&"left"!==c&&"right"!==c)throw new Error(c+" is not a valid orientation for LabelComponent");this.orientation=c,this.xAlign("center").yAlign("center")}return __extends(c,b),c.prototype.xAlign=function(a){var c=a.toLowerCase();return b.prototype.xAlign.call(this,c),this.xAlignment=c,this},c.prototype.yAlign=function(a){var c=a.toLowerCase();return b.prototype.yAlign.call(this,c),this.yAlignment=c,this},c.prototype._requestedSpace=function(a,b){var c=this.measurer(this._text),d="horizontal"===this.orientation?c.width:c.height,e="horizontal"===this.orientation?c.height:c.width;return{width:Math.min(d,a),height:Math.min(e,b),wantsWidth:d>a,wantsHeight:e>b}},c.prototype._setup=function(){return b.prototype._setup.call(this),this.textContainer=this.content.append("g"),this.measurer=a.Util.Text.getTextMeasure(this.textContainer),this.text(this._text),this},c.prototype.text=function(a){return void 0===a?this._text:(this._text=a,this._invalidateLayout(),this)},c.prototype._doRender=function(){b.prototype._doRender.call(this),this.textContainer.selectAll("text").remove();var c="horizontal"===this.orientation?this.availableWidth:this.availableHeight,d=a.Util.Text.getTruncatedText(this._text,c,this.measurer);return"horizontal"===this.orientation?a.Util.Text.writeLineHorizontally(d,this.textContainer,this.availableWidth,this.availableHeight,this.xAlignment,this.yAlignment):a.Util.Text.writeLineVertically(d,this.textContainer,this.availableWidth,this.availableHeight,this.xAlignment,this.yAlignment,this.orientation),this},c.prototype._computeLayout=function(c,d,e,f){return b.prototype._computeLayout.call(this,c,d,e,f),this.measurer=a.Util.Text.getTextMeasure(this.textContainer),this},c}(a.Abstract.Component);b.Label=c;var d=function(a){function b(b,c){a.call(this,b,c),this.classed("title-label",!0)}return __extends(b,a),b}(c);b.TitleLabel=d;var e=function(a){function b(b,c){a.call(this,b,c),this.classed("axis-label",!0)}return __extends(b,a),b}(c);b.AxisLabel=e}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a){b.call(this),this.classed("legend",!0),this.scale(a),this.xAlign("RIGHT").yAlign("TOP"),this.xOffset(5).yOffset(5)}return __extends(c,b),c.prototype.remove=function(){b.prototype.remove.call(this),null!=this.colorScale&&this.colorScale.broadcaster.deregisterListener(this)},c.prototype.toggleCallback=function(a){return void 0!==a?(this._toggleCallback=a,this.isOff=d3.set(),this.updateListeners(),this.updateClasses(),this):this._toggleCallback},c.prototype.hoverCallback=function(a){return void 0!==a?(this._hoverCallback=a,this.datumCurrentlyFocusedOn=void 0,this.updateListeners(),this.updateClasses(),this):this._hoverCallback},c.prototype.scale=function(a){var b=this;return null!=a?(null!=this.colorScale&&this.colorScale.broadcaster.deregisterListener(this),this.colorScale=a,this.colorScale.broadcaster.registerListener(this,function(){return b.updateDomain()}),this.updateDomain(),this):this.colorScale},c.prototype.updateDomain=function(){null!=this._toggleCallback&&(this.isOff=a.Util.Methods.intersection(this.isOff,d3.set(this.scale().domain()))),null!=this._hoverCallback&&(this.datumCurrentlyFocusedOn=this.scale().domain().indexOf(this.datumCurrentlyFocusedOn)>=0?this.datumCurrentlyFocusedOn:void 0),this._invalidateLayout()},c.prototype._computeLayout=function(a,c,d,e){b.prototype._computeLayout.call(this,a,c,d,e);var f=this.measureTextHeight(),g=this.colorScale.domain().length;return this.nRowsDrawn=Math.min(g,Math.floor(this.availableHeight/f)),this},c.prototype._requestedSpace=function(b,d){var e=this.measureTextHeight(),f=this.colorScale.domain().length,g=Math.min(f,Math.floor(d/e)),h=this.content.append("g").classed(c.SUBELEMENT_CLASS,!0),i=h.append("text"),j=d3.max(this.colorScale.domain(),function(b){return a.Util.Text.getTextWidth(i,b)});h.remove(),j=void 0===j?0:j;var k=j+e+c.MARGIN;return{width:Math.min(k,b),height:g*e,wantsWidth:k>b,wantsHeight:f>g}},c.prototype.measureTextHeight=function(){var b=this.content.append("g").classed(c.SUBELEMENT_CLASS,!0),d=a.Util.Text.getTextHeight(b.append("text"));return b.remove(),d},c.prototype._doRender=function(){b.prototype._doRender.call(this);var d=this.colorScale.domain().slice(0,this.nRowsDrawn),e=this.measureTextHeight(),f=this.availableWidth-e-c.MARGIN,g=e-2*c.MARGIN-2,h=this.content.selectAll("."+c.SUBELEMENT_CLASS).data(d,function(a){return a}),i=h.enter().append("g").classed(c.SUBELEMENT_CLASS,!0);return i.append("circle").attr("cx",c.MARGIN+g/2).attr("cy",c.MARGIN+g/2).attr("r",g),i.append("text").attr("x",e).attr("y",c.MARGIN+e/2),h.exit().remove(),h.attr("transform",function(a){return"translate(0,"+d.indexOf(a)*e+")"}),h.selectAll("circle").attr("fill",this.colorScale._d3Scale),h.selectAll("text").text(function(b){var c=a.Util.Text.getTextMeasure(d3.select(this));return a.Util.Text.getTruncatedText(b,f,c)}),this.updateClasses(),this.updateListeners(),this},c.prototype.updateListeners=function(){var a=this;if(this._isSetup){var b=this.content.selectAll("."+c.SUBELEMENT_CLASS);if(null!=this._hoverCallback){var d=function(b){return function(c){a.datumCurrentlyFocusedOn=b?c:void 0,a._hoverCallback(a.datumCurrentlyFocusedOn),a.updateClasses()}};b.on("mouseover",d(!0)),b.on("mouseout",d(!1))}else b.on("mouseover",null),b.on("mouseout",null);null!=this._toggleCallback?b.on("click",function(b){var c=a.isOff.has(b);c?a.isOff.remove(b):a.isOff.add(b),a._toggleCallback(b,c),a.updateClasses()}):b.on("click",null)}},c.prototype.updateClasses=function(){var a=this;if(this._isSetup){var b=this.content.selectAll("."+c.SUBELEMENT_CLASS);null!=this._hoverCallback?(b.classed("focus",function(b){return a.datumCurrentlyFocusedOn===b}),b.classed("hover",void 0!==this.datumCurrentlyFocusedOn)):(b.classed("hover",!1),b.classed("focus",!1)),null!=this._toggleCallback?(b.classed("toggled-on",function(b){return!a.isOff.has(b)}),b.classed("toggled-off",function(b){return a.isOff.has(b)})):(b.classed("toggled-on",!1),b.classed("toggled-off",!1))}},c.SUBELEMENT_CLASS="legend-row",c.MARGIN=5,c}(a.Abstract.Component);b.Legend=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c){var d=this;if(a.call(this),null==b&&null==c)throw new Error("Gridlines must have at least one scale");this.classed("gridlines",!0),this.xScale=b,this.yScale=c,null!=this.xScale&&this.xScale.broadcaster.registerListener(this,function(){return d._render()}),null!=this.yScale&&this.yScale.broadcaster.registerListener(this,function(){return d._render()})}return __extends(b,a),b.prototype.remove=function(){return a.prototype.remove.call(this),null!=this.xScale&&this.xScale.broadcaster.deregisterListener(this),null!=this.yScale&&this.yScale.broadcaster.deregisterListener(this),this},b.prototype._setup=function(){return a.prototype._setup.call(this),this.xLinesContainer=this.content.append("g").classed("x-gridlines",!0),this.yLinesContainer=this.content.append("g").classed("y-gridlines",!0),this},b.prototype._doRender=function(){return a.prototype._doRender.call(this),this.redrawXLines(),this.redrawYLines(),this},b.prototype.redrawXLines=function(){var a=this;if(null!=this.xScale){var b=this.xScale.ticks(),c=function(b){return a.xScale.scale(b)},d=this.xLinesContainer.selectAll("line").data(b);d.enter().append("line"),d.attr("x1",c).attr("y1",0).attr("x2",c).attr("y2",this.availableHeight),d.exit().remove()}},b.prototype.redrawYLines=function(){var a=this;if(null!=this.yScale){var b=this.yScale.ticks(),c=function(b){return a.yScale.scale(b)},d=this.yLinesContainer.selectAll("line").data(b);d.enter().append("line"),d.attr("x1",0).attr("y1",c).attr("x2",this.availableWidth).attr("y2",c),d.exit().remove()}},b}(a.Abstract.Component);b.Gridlines=c}(a.Component||(a.Component={}));a.Component}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(b,c,d){"undefined"==typeof c&&(c=a.ONE_DAY),"undefined"==typeof d&&(d="");var e=function(a){var e=Math.round((a.valueOf()-b)/c);return e.toString()+d};return e}a.ONE_DAY=864e5,a.generateRelativeDateFormatter=b}(a.Axis||(a.Axis={}));a.Axis}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(b){function c(a,c,d){if(b.call(this,a),null==c||null==d)throw new Error("XYPlots require an xScale and yScale");this.classed("xy-renderer",!0),this.project("x","x",c),this.project("y","y",d)}return __extends(c,b),c.prototype.project=function(a,c,d){return"x"===a&&null!=d&&(this.xScale=d,this._updateXDomainer()),"y"===a&&null!=d&&(this.yScale=d,this._updateYDomainer()),b.prototype.project.call(this,a,c,d),this},c.prototype._computeLayout=function(a,c,d,e){return b.prototype._computeLayout.call(this,a,c,d,e),this.xScale.range([0,this.availableWidth]),this.yScale.range([this.availableHeight,0]),this},c.prototype._updateXDomainer=function(){if(this.xScale instanceof a.QuantitiveScale){var b=this.xScale;b._userSetDomainer||b.domainer().pad().nice()}return this},c.prototype._updateYDomainer=function(){if(this.yScale instanceof a.QuantitiveScale){var b=this.yScale;b._userSetDomainer||b.domainer().pad().nice()}return this},c}(a.Plot);a.XYPlot=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d,e),this._animators={"circles-reset":new a.Animator.Null,circles:(new a.Animator.IterativeDelay).duration(250).delay(5)},this.classed("circle-renderer",!0),this.project("r",3),this.project("fill",function(){return"steelblue"})}return __extends(c,b),c.prototype.project=function(a,c,d){return a="cx"===a?"x":a,a="cy"===a?"y":a,b.prototype.project.call(this,a,c,d),this},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this._generateAttrToProjector();a.cx=a.x,a.cy=a.y,delete a.x,delete a.y;var c=this.renderArea.selectAll("circle").data(this._dataSource.data());if(c.enter().append("circle"),this._dataChanged){var d=a.r;a.r=function(){return 0},this._applyAnimatedAttributes(c,"circles-reset",a),a.r=d}this._applyAnimatedAttributes(c,"circles",a),c.exit().remove()},c}(a.Abstract.XYPlot);b.Scatter=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e,f){b.call(this,c,d,e),this._animators={cells:new a.Animator.Null},this.classed("grid-renderer",!0),this.xScale.rangeType("bands",0,0),this.yScale.rangeType("bands",0,0),this.colorScale=f,this.project("fill","value",f)}return __extends(c,b),c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),"fill"===a&&(this.colorScale=this._projectors.fill.scale),this},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this.renderArea.selectAll("rect").data(this._dataSource.data());a.enter().append("rect");var c=this.xScale.rangeBand(),d=this.yScale.rangeBand(),e=this._generateAttrToProjector();e.width=function(){return c},e.height=function(){return d},this._applyAnimatedAttributes(a,"cells",e),a.exit().remove()},c}(a.Abstract.XYPlot);b.Grid=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(c){function d(b,d,e){c.call(this,b,d,e),this._baselineValue=0,this._barAlignmentFactor=0,this._animators={"bars-reset":new a.Animator.Null,bars:new a.Animator.IterativeDelay,baseline:new a.Animator.Null},this.classed("bar-renderer",!0),this.project("fill",function(){return"steelblue"}),this.baseline(this._baselineValue)}return __extends(d,c),d.prototype._setup=function(){return c.prototype._setup.call(this),this._baseline=this.renderArea.append("line").classed("baseline",!0),this._bars=this.renderArea.selectAll("rect").data([]),this},d.prototype._paint=function(){c.prototype._paint.call(this),this._bars=this.renderArea.selectAll("rect").data(this._dataSource.data()),this._bars.enter().append("rect");var a=this._isVertical?this.yScale:this.xScale,b=a.scale(this._baselineValue),d=this._isVertical?"y":"x",e=this._isVertical?"height":"width";if(this._dataChanged&&this._animate){var f=this._generateAttrToProjector();f[d]=function(){return b},f[e]=function(){return 0},this._applyAnimatedAttributes(this._bars,"bars-reset",f)}var g=this._generateAttrToProjector();null!=g.fill&&this._bars.attr("fill",g.fill),this._applyAnimatedAttributes(this._bars,"bars",g),this._bars.exit().remove();var h={x1:this._isVertical?0:b,y1:this._isVertical?b:0,x2:this._isVertical?this.availableWidth:b,y2:this._isVertical?b:this.availableHeight};this._applyAnimatedAttributes(this._baseline,"baseline",h)},d.prototype.baseline=function(a){return this._baselineValue=a,this._updateXDomainer(),this._updateYDomainer(),this._render(),this},d.prototype.barAlignment=function(a){var b=a.toLowerCase(),c=this.constructor._BarAlignmentToFactor;if(void 0===c[b])throw new Error("unsupported bar alignment");return this._barAlignmentFactor=c[b],this._render(),this},d.prototype.parseExtent=function(a){if("number"==typeof a)return{min:a,max:a};if(a instanceof Object&&"min"in a&&"max"in a)return a;throw new Error("input '"+a+"' can't be parsed as an IExtent")},d.prototype.selectBar=function(a,b,c){if("undefined"==typeof c&&(c=!0),!this._isSetup)return null;var d=[],e=this.parseExtent(a),f=this.parseExtent(b),g=.5;if(this._bars.each(function(){var a=this.getBBox();a.x+a.width>=e.min-g&&a.x<=e.max+g&&a.y+a.height>=f.min-g&&a.y<=f.max+g&&d.push(this)}),d.length>0){var h=d3.selectAll(d);return h.classed("selected",c),h}return null},d.prototype.deselectAll=function(){return this._isSetup&&this._bars.classed("selected",!1),this},d.prototype._updateDomainer=function(a){if(a instanceof b.QuantitiveScale){var c=a;c._userSetDomainer||(null!=this._baselineValue?c.domainer().addPaddingException(this._baselineValue,"BAR_PLOT+"+this._plottableID).addIncludedValue(this._baselineValue,"BAR_PLOT+"+this._plottableID):c.domainer().removePaddingException("BAR_PLOT+"+this._plottableID).removeIncludedValue("BAR_PLOT+"+this._plottableID)),c._autoDomainIfAutomaticMode()}return this},d.prototype._generateAttrToProjector=function(){var b=this,e=c.prototype._generateAttrToProjector.call(this),f=this._isVertical?this.yScale:this.xScale,g=this._isVertical?this.xScale:this.yScale,h=this._isVertical?"y":"x",i=this._isVertical?"x":"y",j=g instanceof a.Scale.Ordinal&&"bands"===g.rangeType(),k=f.scale(this._baselineValue);if(null==e.width){var l=j?g.rangeBand():d.DEFAULT_WIDTH;e.width=function(){return l}}var m=e[i],n=e.width;if(j){var o=g.rangeBand();e[i]=function(a,b){return m(a,b)-n(a,b)/2+o/2}}else e[i]=function(a,c){return m(a,c)-n(a,c)*b._barAlignmentFactor};var p=e[h];return e[h]=function(a,b){var c=p(a,b);return c>k?k:c},e.height=function(a,b){return Math.abs(k-p(a,b))},e},d.DEFAULT_WIDTH=10,d._BarAlignmentToFactor={},d}(b.XYPlot);b.BarPlot=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c,d){a.call(this,b,c,d),this._isVertical=!0}return __extends(b,a),b.prototype._updateYDomainer=function(){return this._updateDomainer(this.yScale),this},b._BarAlignmentToFactor={left:0,center:.5,right:1},b}(a.Abstract.BarPlot);b.VerticalBar=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c,d){a.call(this,b,c,d),this.isVertical=!1}return __extends(b,a),b.prototype._updateXDomainer=function(){return this._updateDomainer(this.xScale),this},b.prototype._generateAttrToProjector=function(){var b=a.prototype._generateAttrToProjector.call(this),c=b.width;return b.width=b.height,b.height=c,b},b._BarAlignmentToFactor={top:0,center:.5,bottom:1},b}(a.Abstract.BarPlot);b.HorizontalBar=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d,e),this._animators={"line-reset":new a.Animator.Null,line:(new a.Animator.Default).duration(600).easing("exp-in-out")},this.classed("line-renderer",!0),this.project("stroke",function(){return"steelblue"}),this.project("stroke-width",function(){return"2px"})}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.linePath=this.renderArea.append("path").classed("line",!0),this},c.prototype._getResetYFunction=function(){var a=this.yScale.domain(),b=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]),d=0;0>b?d=b:c>0&&(d=c);var e=this.yScale.scale(d);return function(){return e}},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this._generateAttrToProjector(),c=a.x,d=a.y;delete a.x,delete a.y,this.linePath.datum(this._dataSource.data()),this._dataChanged&&(a.d=d3.svg.line().x(c).y(this._getResetYFunction()),this._applyAnimatedAttributes(this.linePath,"line-reset",a)),a.d=d3.svg.line().x(c).y(d),this._applyAnimatedAttributes(this.linePath,"line",a)},c}(a.Abstract.XYPlot);b.Line=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d,e),this.classed("area-renderer",!0),this.project("y0",0,e),this.project("fill",function(){return"steelblue"}),this.project("fill-opacity",function(){return.5}),this.project("stroke",function(){return"none"}),this._animators["area-reset"]=new a.Animator.Null,this._animators.area=(new a.Animator.Default).duration(600).easing("exp-in-out")}return __extends(c,b),c.prototype._setup=function(){return b.prototype._setup.call(this),this.areaPath=this.renderArea.append("path").classed("area",!0),this},c.prototype._onDataSourceUpdate=function(){b.prototype._onDataSourceUpdate.call(this),null!=this.yScale&&this._updateYDomainer()},c.prototype._updateYDomainer=function(){b.prototype._updateYDomainer.call(this);var a=this.yScale,c=this._projectors.y0,d=null!=c?c.accessor:null,e=null!=d?this.dataSource()._getExtent(d):[],f=2===e.length&&e[0]===e[1]?e[0]:null;return a._userSetDomainer||(null!=f?a.domainer().addPaddingException(f,"AREA_PLOT+"+this._plottableID):a.domainer().removePaddingException("AREA_PLOT+"+this._plottableID),a._autoDomainIfAutomaticMode()),this},c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),"y0"===a&&this._updateYDomainer(),this},c.prototype._getResetYFunction=function(){return this._generateAttrToProjector().y0},c.prototype._paint=function(){b.prototype._paint.call(this);var a=this._generateAttrToProjector(),c=a.x,d=a.y0,e=a.y;delete a.x,delete a.y0,delete a.y,this.areaPath.datum(this._dataSource.data()),this._dataChanged&&(a.d=d3.svg.area().x(c).y0(d).y1(this._getResetYFunction()),this._applyAnimatedAttributes(this.areaPath,"area-reset",a)),a.d=d3.svg.area().x(c).y0(d).y1(e),this._applyAnimatedAttributes(this.areaPath,"area",a)},c}(b.Line);b.Area=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){}return a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(a.Animator||(a.Animator={}));a.Animator}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){this._durationMsec=300,this._delayMsec=0,this._easing="exp-out"}return a.prototype.animate=function(a,b){return a.transition().ease(this._easing).duration(this._durationMsec).delay(this._delayMsec).attr(b)},a.prototype.duration=function(a){return void 0===a?this._durationMsec:(this._durationMsec=a,this)},a.prototype.delay=function(a){return void 0===a?this._delayMsec:(this._delayMsec=a,this)},a.prototype.easing=function(a){return void 0===a?this._easing:(this._easing=a,this)},a}();a.Default=b}(a.Animator||(a.Animator={}));a.Animator}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this._delayMsec=15}return __extends(b,a),b.prototype.animate=function(a,b){var c=this;return a.transition().ease(this._easing).duration(this._durationMsec).delay(function(a,b){return b*c._delayMsec}).attr(b)},b}(a.Default);a.IterativeDelay=b}(a.Animator||(a.Animator={}));a.Animator}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(){e||(d3.select(document).on("keydown",d),e=!0)}function c(a,c){e||b(),null==f[a]&&(f[a]=[]),f[a].push(c)}function d(){null!=f[d3.event.keyCode]&&f[d3.event.keyCode].forEach(function(a){a(d3.event)})}var e=!1,f=[];a.initialize=b,a.addCallback=c}(a.KeyEventListener||(a.KeyEventListener={}));a.KeyEventListener}(a.Core||(a.Core={}));a.Core}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(a){if(null==a)throw new Error("Interactions require a component to listen to");this.componentToListenTo=a}return a.prototype._anchor=function(a){this.hitBox=a},a.prototype.registerWithComponent=function(){return this.componentToListenTo.registerInteraction(this),this},a}();a.Interaction=b}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,b)}return __extends(b,a),b.prototype._anchor=function(b){var c=this;a.prototype._anchor.call(this,b),b.on(this._listenTo(),function(){var a=d3.mouse(b.node()),d=a[0],e=a[1];c._callback(d,e)})},b.prototype._listenTo=function(){return"click"},b.prototype.callback=function(a){return this._callback=a,this},b}(a.Abstract.Interaction);b.Click=c;var d=function(a){function b(b){a.call(this,b)}return __extends(b,a),b.prototype._listenTo=function(){return"dblclick"},b}(c);b.DoubleClick=d}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){a.call(this,b)}return __extends(b,a),b.prototype._anchor=function(b){var c=this;a.prototype._anchor.call(this,b),b.on("mousemove",function(){var a=d3.mouse(b.node()),d=a[0],e=a[1];c.mousemove(d,e)})},b.prototype.mousemove=function(){},b}(a.Abstract.Interaction);b.Mousemove=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(a,c){b.call(this,a),this.activated=!1,this.keyCode=c}return __extends(c,b),c.prototype._anchor=function(c){var d=this;b.prototype._anchor.call(this,c),c.on("mouseover",function(){d.activated=!0}),c.on("mouseout",function(){d.activated=!1}),a.Core.KeyEventListener.addCallback(this.keyCode,function(){d.activated&&null!=d._callback&&d._callback()})},c.prototype.callback=function(a){return this._callback=a,this},c}(a.Abstract.Interaction);b.Key=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b,c,d){var e=this;if(a.call(this,b),null==c||null==d)throw new Error("panZoomInteractions require an xScale and yScale");this.xScale=c,this.yScale=d,this.zoom=d3.behavior.zoom(),this.zoom.x(this.xScale._d3Scale),this.zoom.y(this.yScale._d3Scale),this.zoom.on("zoom",function(){return e.rerenderZoomed()})}return __extends(b,a),b.prototype.resetZoom=function(){var a=this;this.zoom=d3.behavior.zoom(),this.zoom.x(this.xScale._d3Scale),this.zoom.y(this.yScale._d3Scale),this.zoom.on("zoom",function(){return a.rerenderZoomed()}),this.zoom(this.hitBox)},b.prototype._anchor=function(b){a.prototype._anchor.call(this,b),this.zoom(b)},b.prototype.rerenderZoomed=function(){var a=this.xScale._d3Scale.domain(),b=this.yScale._d3Scale.domain();this.xScale.domain(a),this.yScale.domain(b)},b}(a.Abstract.Interaction);b.PanZoom=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(a){function b(b){var c=this;a.call(this,b),this.dragInitialized=!1,this.origin=[0,0],this.location=[0,0],this.dragBehavior=d3.behavior.drag(),this.dragBehavior.on("dragstart",function(){return c._dragstart()}),this.dragBehavior.on("drag",function(){return c._drag()}),this.dragBehavior.on("dragend",function(){return c._dragend()})}return __extends(b,a),b.prototype.callback=function(a){return this.callbackToCall=a,this},b.prototype._dragstart=function(){var a=this.componentToListenTo.availableWidth,b=this.componentToListenTo.availableHeight,c=function(a,b){return function(c){return Math.min(Math.max(c,a),b)}};this.constrainX=c(0,a),this.constrainY=c(0,b)},b.prototype._drag=function(){this.dragInitialized||(this.origin=[d3.event.x,d3.event.y],this.dragInitialized=!0),this.location=[this.constrainX(d3.event.x),this.constrainY(d3.event.y)]},b.prototype._dragend=function(){this.dragInitialized&&(this.dragInitialized=!1,this._doDragend())},b.prototype._doDragend=function(){null!=this.callbackToCall&&this.callbackToCall([this.origin,this.location])},b.prototype._anchor=function(b){return a.prototype._anchor.call(this,b),b.call(this.dragBehavior),this},b.prototype.setupZoomCallback=function(a,b){function c(c){return null==c?(f&&(null!=a&&a.domain(d),null!=b&&b.domain(e)),void(f=!f)):(f=!1,null!=a&&a.domain([a.invert(c.xMin),a.invert(c.xMax)]),null!=b&&b.domain([b.invert(c.yMax),b.invert(c.yMin)]),void this.clearBox())}var d=null!=a?a.domain():null,e=null!=b?b.domain():null,f=!1;return this.callback(c),this},b}(a.Abstract.Interaction);b.Drag=c}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.boxIsDrawn=!1}return __extends(b,a),b.prototype._dragstart=function(){a.prototype._dragstart.call(this),null!=this.callbackToCall&&this.callbackToCall(null),this.clearBox()},b.prototype.clearBox=function(){return null!=this.dragBox?(this.dragBox.attr("height",0).attr("width",0),this.boxIsDrawn=!1,this):void 0},b.prototype.setBox=function(a,b,c,d){if(null!=this.dragBox){var e=Math.abs(a-b),f=Math.abs(c-d),g=Math.min(a,b),h=Math.min(c,d);return this.dragBox.attr({x:g,y:h,width:e,height:f}),this.boxIsDrawn=e>0&&f>0,this}},b.prototype._anchor=function(c){a.prototype._anchor.call(this,c);var d=b.CLASS_DRAG_BOX,e=this.componentToListenTo.foregroundContainer;return this.dragBox=e.append("rect").classed(d,!0).attr("x",0).attr("y",0),this},b.CLASS_DRAG_BOX="drag-box",b}(a.Drag);a.DragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._drag=function(){a.prototype._drag.call(this),this.setBox(this.origin[0],this.location[0])},b.prototype._doDragend=function(){if(null!=this.callbackToCall){var a=Math.min(this.origin[0],this.location[0]),b=Math.max(this.origin[0],this.location[0]),c={xMin:a,xMax:b};this.callbackToCall(c)}},b.prototype.setBox=function(b,c){return a.prototype.setBox.call(this,b,c,0,this.componentToListenTo.availableHeight),this},b}(a.DragBox);a.XDragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._drag=function(){a.prototype._drag.call(this),this.setBox(this.origin[0],this.location[0],this.origin[1],this.location[1])},b.prototype._doDragend=function(){if(null!=this.callbackToCall){var a=Math.min(this.origin[0],this.location[0]),b=Math.max(this.origin[0],this.location[0]),c=Math.min(this.origin[1],this.location[1]),d=Math.max(this.origin[1],this.location[1]),e={xMin:a,xMax:b,yMin:c,yMax:d};this.callbackToCall(e)}},b}(a.DragBox);a.XYDragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments) +}return __extends(b,a),b.prototype._drag=function(){a.prototype._drag.call(this),this.setBox(this.origin[1],this.location[1])},b.prototype._doDragend=function(){if(null!=this.callbackToCall){var a=Math.min(this.origin[1],this.location[1]),b=Math.max(this.origin[1],this.location[1]),c={yMin:a,yMax:b};this.callbackToCall(c)}},b.prototype.setBox=function(b,c){return a.prototype.setBox.call(this,0,this.componentToListenTo.availableWidth,b,c),this},b}(a.DragBox);a.YDragBox=b}(a.Interaction||(a.Interaction={}));a.Interaction}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){!function(b){var c=function(b){function c(){b.call(this),this.xTable=new a.Component.Table,this.yTable=new a.Component.Table,this.centerComponent=new a.Component.Group,this.xyTable=(new a.Component.Table).addComponent(0,0,this.yTable).addComponent(1,1,this.xTable).addComponent(0,1,this.centerComponent),this.addComponent(1,0,this.xyTable)}return __extends(c,b),c.prototype.yAxis=function(a){if(null!=a){if(null!=this._yAxis)throw new Error("yAxis already assigned!");return this._yAxis=a,this.yTable.addComponent(0,1,this._yAxis),this}return this._yAxis},c.prototype.xAxis=function(a){if(null!=a){if(null!=this._xAxis)throw new Error("xAxis already assigned!");return this._xAxis=a,this.xTable.addComponent(0,0,this._xAxis),this}return this._xAxis},c.prototype.yLabel=function(b){if(null!=b){if(null!=this._yLabel){if("string"==typeof b)return this._yLabel.text(b),this;throw new Error("yLabel already assigned!")}return"string"==typeof b&&(b=new a.Component.AxisLabel(b,"vertical-left")),this._yLabel=b,this.yTable.addComponent(0,0,this._yLabel),this}return this._yLabel},c.prototype.xLabel=function(b){if(null!=b){if(null!=this._xLabel){if("string"==typeof b)return this._xLabel.text(b),this;throw new Error("xLabel already assigned!")}return"string"==typeof b&&(b=new a.Component.AxisLabel(b,"horizontal")),this._xLabel=b,this.xTable.addComponent(1,0,this._xLabel),this}return this._xLabel},c.prototype.titleLabel=function(b){if(null!=b){if(null!=this._titleLabel){if("string"==typeof b)return this._titleLabel.text(b),this;throw new Error("titleLabel already assigned!")}return"string"==typeof b&&(b=new a.Component.TitleLabel(b,"horizontal")),this._titleLabel=b,this.addComponent(0,0,this._titleLabel),this}return this._titleLabel},c.prototype.center=function(a){return this.centerComponent.merge(a),this},c}(a.Component.Table);b.StandardChart=c}(a.Template||(a.Template={}));a.Template}(Plottable||(Plottable={})); \ No newline at end of file diff --git a/plottable.zip b/plottable.zip index 4dbc42f3c2..1bc22380b5 100644 Binary files a/plottable.zip and b/plottable.zip differ