diff --git a/bower.json b/bower.json index ddf28f806a..819de7b730 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "plottable", "description": "A library for creating charts out of D3", - "version": "0.15.2", + "version": "0.15.3", "main": ["plottable.js", "plottable.css"], "license": "MIT", "ignore": [ diff --git a/package.json b/package.json index f0a3857bfe..499c71787c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plottable.js", - "version": "0.15.2", + "version": "0.15.3", "description": "Build flexible, performant, interactive charts using D3", "repository": { "type": "git", diff --git a/plottable.js b/plottable.js index 4ec0ce77b8..453e95fb49 100644 --- a/plottable.js +++ b/plottable.js @@ -1,5 +1,5 @@ /*! -Plottable 0.15.2 (https://github.com/palantir/plottable) +Plottable 0.15.3 (https://github.com/palantir/plottable) Copyright 2014 Palantir Technologies Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE) */ diff --git a/plottable.min.js b/plottable.min.js index 821c31bcdb..1a9fe49e0e 100644 --- a/plottable.min.js +++ b/plottable.min.js @@ -1,3 +1,3 @@ -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}a.inRange=b,a.addArrays=c,a.intersection=d,a.accessorize=e,a.applyAccessor=f,a.uniq=g,a.createFilledArray=h}(a.Methods||(a.Methods={}));a.Methods}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(a,b,c){for(var d=0,e=b.length;e>d;){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){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 h(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.Util.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.Util.DOM.translate(j,q,r),[n,m]}function i(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 i="right"===g,j={left:"bottom",right:"top",center:"center",top:"left",bottom:"right"},k={left:"top",right:"bottom",center:"center",top:"right",bottom:"left"},l=i?j:k,m=b.append("g"),n=h(a,m,d,c,l[f],l[e]),o=d3.transform("");return o.rotate="right"===g?90:-90,o.translate=[i?c:0,i?0:d],m.attr("transform",o.toString()),[n[1],n[0]]}function j(b,c,d,f,g,i){"undefined"==typeof g&&(g="left"),"undefined"==typeof i&&(i="top");var j=e(c),k=0,l=c.append("g");b.forEach(function(b,c){var e=l.append("g");a.Util.DOM.translate(e,0,c*j);var f=h(b,e,d,j,g,i);f[0]>k&&(k=f[0])});var m=j*b.length,n=f-m,o={center:.5,top:0,bottom:1};return a.Util.DOM.translate(l,0,n*o[i]),[k,m]}function k(b,c,d,f,g,h,j){"undefined"==typeof g&&(g="left"),"undefined"==typeof h&&(h="top"),"undefined"==typeof j&&(j="left");var k=e(c),l=0,m=c.append("g");b.forEach(function(b,c){var d=m.append("g");a.Util.DOM.translate(d,c*k,0);var e=i(b,d,k,f,g,h,j);e[1]>l&&(l=e[1])});var n=k*b.length,o=d-n,p={center:.5,left:0,right:1};return a.Util.DOM.translate(m,o*p[g],0),[n,l]}function l(b,d,e,f,g,h,i){var l=null!=i?i:1.1*e>f,m=d.append("g").classed("writeText-inner-g",!0),n=l?e:f,o=l?f:e,p=c(m),q=a.Util.WordWrap.breakTextToFitRect(b,n,o,p),r=l?j:k,s=r(q.lines,m,e,f,g,h);return{textFits:q.textFits,usedWidth:s[0],usedHeight:s[1]}}b.getTextMeasure=c,b.getTruncatedText=d,b.getTextHeight=e,b.getTextWidth=f,b.addEllipsesToLine=g,b.writeLineHorizontally=h,b.writeLineVertically=i,b.writeTextHorizontally=j,b.writeTextVertically=k,b.writeText=l}(b.Text||(b.Text={}));b.Text}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(b){!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.Util.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}(b.WordWrap||(b.WordWrap={}));b.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(a,b){var c=a.getPropertyValue(b);return null==c?0:parseFloat(c)}function d(a){for(var b=a.node(),c=b.parentNode;null!==c&&"#document"!==c.nodeName;)c=c.parentNode;return null==c}function e(a){var b=window.getComputedStyle(a);return c(b,"width")+c(b,"padding-left")+c(b,"padding-right")+c(b,"border-left-width")+c(b,"border-right-width")}function f(a){var b=window.getComputedStyle(a);return c(b,"height")+c(b,"padding-top")+c(b,"padding-bottom")+c(b,"border-top-width")+c(b,"border-bottom-width")}function g(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 h(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.isSelectionRemoved=d,a.getElementWidth=e,a.getElementHeight=f,a.getSVGPixelWidth=g,a.translate=h}(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(){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(){b.apply(this,arguments),this.listener2Callback=new a.Util.StrictEqualityAssociativeArray}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.Abstract.Component);b.ComponentContainer=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){"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;if(j=null!=a?a._requestedSpace(b[i],c[h]):{width:0,height:0,wantsWidth:!1,wantsHeight:!1},j.width>b[i]||j.height>c[h])throw new Error("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._autoDomain=!0,this.rendererID2Perspective={},this.dataSourceReferenceCounter=new a.Util.IDCounter,this._autoNice=!1,this._autoPad=!1,this._d3Scale=c}return __extends(c,b),c.prototype._getAllExtents=function(){var a=d3.values(this.rendererID2Perspective),b=a.map(function(a){var b=a.dataSource,c=a.accessor;return b._getExtent(c)}).filter(function(a){return null!=a});return b},c.prototype._getExtent=function(){return[]},c.prototype.autoDomain=function(){return this._setDomain(this._getExtent()),this},c.prototype._addPerspective=function(a,b,c){var d=this;null!=this.rendererID2Perspective[a]&&this._removePerspective(a),this.rendererID2Perspective[a]={dataSource:b,accessor:c};var e=b._plottableID;return 1===this.dataSourceReferenceCounter.increment(e)&&b.registerListener(this,function(){d._autoDomain&&d.autoDomain()}),this._autoDomain&&this.autoDomain(),this},c.prototype._removePerspective=function(a){var b=this.rendererID2Perspective[a].dataSource,c=b._plottableID;return 0===this.dataSourceReferenceCounter.decrement(c)&&b.deregisterListener(this),delete this.rendererID2Perspective[a],this._autoDomain&&this.autoDomain(),this},c.prototype.scale=function(a){return this._d3Scale(a)},c.prototype.domain=function(a){return null==a?this._d3Scale.domain():(this._autoDomain=!1,this._setDomain(a),this)},c.prototype._setDomain=function(a){this._d3Scale.domain(a),this._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}(a.Abstract.Broadcaster);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._ANIMATION_DURATION=250,this._projectors={},this._rerenderUpdateSelection=!1,this._requireRerender=!1,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._dataChanged=!0,this},c.prototype.dataSource=function(a){var b=this;if(null==a)return this._dataSource;var c=this._dataSource;return null!=c&&(this._deregisterFromBroadcaster(this._dataSource),this._requireRerender=!0,this._rerenderUpdateSelection=!0,d3.keys(this._projectors).forEach(function(c){var d=b._projectors[c];if(null!=d.scale){var e=b._plottableID+c;d.scale._removePerspective(e),d.scale._addPerspective(e,a,d.accessor)}})),this._dataSource=a,this._registerToBroadcaster(this._dataSource,function(){b._dataChanged=!0,b._render()}),this._dataChanged=!0,this._render(),this},c.prototype.project=function(a,b,c){var d=this;a=a.toLowerCase();var e=this._plottableID+a,f=this._projectors[a],g=null!=f?f.scale:null;return null==c&&(c=g),null!=g&&(g._removePerspective(e),this._deregisterFromBroadcaster(g)),null!=c&&(c._addPerspective(e,this.dataSource(),b),this._registerToBroadcaster(c,function(){return d._render()})),this._projectors[a]={accessor:b,scale:c},this._requireRerender=!0,this._rerenderUpdateSelection=!0,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._requireRerender=!1,this._rerenderUpdateSelection=!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}(a.Abstract.Component);b.Plot=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){}return a.registerToRender=function(b){return a.enabled?(a.componentsNeedingRender[b._plottableID]=b,void a.requestFrame()):void b._doRender()},a.registerToComputeLayout=function(b){return a.enabled?(a.componentsNeedingComputeLayout[b._plottableID]=b,a.componentsNeedingRender[b._plottableID]=b,void a.requestFrame()):void b._computeLayout()._render()},a.requestFrame=function(){a.animationRequested||(null!=window.requestAnimationFrame?requestAnimationFrame(a.flush):setTimeout(a.flush,a.IE_TIMEOUT),a.animationRequested=!0)},a.flush=function(){if(a.animationRequested){var b=d3.values(a.componentsNeedingComputeLayout);b.forEach(function(a){return a._computeLayout()});var c=d3.values(a.componentsNeedingRender);c.forEach(function(a){return a._render()}),c=d3.values(a.componentsNeedingRender),c.forEach(function(a){return a._doRender()}),a.componentsNeedingComputeLayout={},a.componentsNeedingRender={},a.animationRequested=!1}},a.IE_TIMEOUT=1e3/60,a.componentsNeedingRender={},a.componentsNeedingComputeLayout={},a.animationRequested=!1,a.enabled=null==window.PlottableTestCode,a}();a.RenderController=b}(a.Singleton||(a.Singleton={}));a.Singleton}(Plottable||(Plottable={}));var Plottable;!function(){}(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),this.lastRequestedTickCount=10,this._PADDING_FOR_IDENTICAL_DOMAIN=1}return __extends(b,a),b.prototype._getExtent=function(){var a=this._getAllExtents(),b=a.map(function(a){return a[0]}),c=a.map(function(a){return a[1]});return b.length>0?[d3.min(b),d3.max(c)]:[0,1]},b.prototype.autoDomain=function(){return a.prototype.autoDomain.call(this),this._autoPad&&this.padDomain(),this._autoNice&&this.nice(),this},b.prototype.invert=function(a){return this._d3Scale.invert(a)},b.prototype.copy=function(){return new b(this._d3Scale.copy()) -},b.prototype.domain=function(b){return a.prototype.domain.call(this,b)},b.prototype.interpolate=function(a){return null==a?this._d3Scale.interpolate():(this._d3Scale.interpolate(a),this)},b.prototype.rangeRound=function(a){return this._d3Scale.rangeRound(a),this},b.prototype.clamp=function(a){return null==a?this._d3Scale.clamp():(this._d3Scale.clamp(a),this)},b.prototype.nice=function(a){return this._d3Scale.nice(a),this._setDomain(this._d3Scale.domain()),this},b.prototype.ticks=function(a){return null!=a&&(this.lastRequestedTickCount=a),this._d3Scale.ticks(this.lastRequestedTickCount)},b.prototype.tickFormat=function(a,b){return this._d3Scale.tickFormat(a,b)},b.prototype.padDomain=function(a){"undefined"==typeof a&&(a=.05);var b=this.domain();if(b[0]===b[1]){var c=b[0].valueOf();return this._setDomain([c-this._PADDING_FOR_IDENTICAL_DOMAIN,c+this._PADDING_FOR_IDENTICAL_DOMAIN]),this}var d=b[1]-b[0],e=[b[0]-a/2*d,b[1].valueOf()+a/2*d];return 0===b[0]&&(e[0]=0),0===b[1]&&(e[1]=0),this._setDomain(e),this},b}(a.Abstract.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(),c=[];return b.forEach(function(a){c=c.concat(a)}),a.Util.Methods.uniq(c)},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._broadcast(),this},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(){a.call(this,d3.time.scale()),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._autoDomain&&this.autoDomain(),this._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.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(a){function b(b,c,d){var e=this;if(a.call(this),this._showEndTickLabels=!1,this.tickPositioning="center",this.orientToAlign={left:"right",right:"left",top:"bottom",bottom:"top"},this._axisScale=b,c=c.toLowerCase(),this.d3Axis=d3.svg.axis().scale(b._d3Scale).orient(c),this.classed("axis",!0),null==d){var f=d3.format(".3s");d=function(a){return"number"==typeof a?Math.abs(a)<1?String(Math.round(1e3*a)/1e3):f(a):a}}this.tickFormat(d),this._registerToBroadcaster(this._axisScale,function(){return e._render()})}return __extends(b,a),b.prototype._setup=function(){return a.prototype._setup.call(this),this.axisElement=this.content.append("g").classed("axis",!0),this},b.prototype._doRender=function(){var a,b=this.d3Axis.scale().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"))})},b.prototype.scale=function(a){return null==a?this._axisScale:(this._axisScale=a,this.d3Axis.scale(a._d3Scale),this)},b.prototype.tickLabelPosition=function(a){return null==a?this.tickPositioning:(this.tickPositioning=a,this)},b.prototype.orient=function(a){return null==a?this.d3Axis.orient():(this.d3Axis.orient(a),this)},b.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,b));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,b));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(a){function b(b,c,d){var e=this;a.call(this),this._tickLength=5,this._tickLabelPadding=3,this._maxWidth=0,this._maxHeight=0,this._scale=b,this.orient(c),this.classed("axis",!0),this._isHorizontal()?this.classed("x-axis",!0):this.classed("y-axis",!0),this._formatter=null!=d?d:function(a){return String(a)},this._registerToBroadcaster(this._scale,function(){return e.rescale()})}return __extends(b,a),b.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},b.prototype._setup=function(){return a.prototype._setup.call(this),this._ticksContainer=this.content.append("g").classed("ticks-container",!0),this._baseline=this.content.append("line").classed("baseline",!0),this},b.prototype._getTickValues=function(){return[]},b.prototype._doRender=function(){var a=this,b=this._getTickValues();this._ticks=this._ticksContainer.selectAll(".tick").data(b);var c=this._ticks.enter().append("g").classed("tick",!0);c.append("line").classed("tick-mark",!0),this._ticks.exit().remove();var d=this._isHorizontal()?function(b){return a._scale.scale(b)}:function(){return 0},e=this._isHorizontal()?function(){return 0}:function(b){return a._scale.scale(b)},f=function(a){return"translate("+d(a)+", "+e(a)+")"};return this._baseline.attr(this._generateBaselineAttrHash()),this._ticks.select("line").attr(this._generateTickMarkAttrHash()),this._ticks.attr("transform",f),this},b.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},b.prototype._generateTickMarkAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.y2=this._tickLength;break;case"top":a.y1=this.availableHeight,a.y2=this.availableHeight-this._tickLength;break;case"left":a.x1=this.availableWidth,a.x2=this.availableWidth-this._tickLength;break;case"right":a.x2=this._tickLength}return a},b.prototype.rescale=function(){return null!=this.element?this._render():null},b.prototype.formatter=function(a){return this._formatter=a,this._render(),this},b.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},b.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},b.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._render(),this},b}(a.Abstract.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){"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._registerToBroadcaster(this._scale,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},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:c,height:d,wantsWidth:!this._isHorizontal(),wantsHeight:this._isHorizontal()};this._scale.range(this._isHorizontal()?[0,a]:[b,0]);var e=this._tickLabelsG.append("g"),f=e.selectAll(".tick").data(this._scale.domain());f.enter().append("g").classed("tick",!0);var g=this.writeTextToTicks(a,b,f);return e.remove(),{width:g.usedWidth+c,height:g.usedHeight+d,wantsWidth:!g.textFits,wantsHeight:!g.textFits}},c.prototype._getTickValues=function(){return this._scale.domain()},c.prototype.writeTextToTicks=function(b,c,d){var e=this,f=[];d.each(function(d){var g=d3.select(this),h=e._scale.fullBandStartAndWidth(d)[1],i=e._isHorizontal()?h:b-e.tickLength()-e.tickLabelPadding(),j=e._isHorizontal()?c-e.tickLength()-e.tickLabelPadding():h,k={left:"right",right:"left",top:"center",bottom:"center"},l={left:"center",right:"center",top:"bottom",bottom:"top"},m=a.Util.Text.writeText(d,g,i,j,k[e._orientation],l[e._orientation],!0);f.push(m)});var g=this._isHorizontal()?d3.sum:d3.max,h=this._isHorizontal()?d3.max:d3.sum;return{textFits:f.every(function(a){return a.textFits}),usedWidth:g(f,function(a){return a.usedWidth}),usedHeight:h(f,function(a){return a.usedHeight})}},c.prototype._doRender=function(){var c=this;b.prototype._doRender.call(this),this._tickLabelsG.selectAll(".tick-label").remove();var d=this._tickLabelsG.selectAll(".tick-label").data(this._scale.domain()),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),this.writeTextToTicks(this.availableWidth,this.availableHeight,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._ticksContainer,f[0],f[1]),this},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(),"horizontal"!==c&&"vertical-left"!==c&&"vertical-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._requestedSpace=function(a,b){var c,d;return"horizontal"===this.orientation?(c=this.textLength,d=this.textHeight):(c=this.textHeight,d=this.textLength),{width:Math.min(c,a),height:Math.min(d,b),wantsWidth:c>a,wantsHeight:d>b}},c.prototype._setup=function(){return b.prototype._setup.call(this),this.textElement=this.content.append("text"),this.setText(this.text),this},c.prototype.setText=function(a){return this.text=a,null!=this.element&&(this.textElement.text(a),this.measureAndSetTextSize()),this._invalidateLayout(),this},c.prototype.measureAndSetTextSize=function(){var b=a.Util.DOM.getBBox(this.textElement);this.textHeight=b.height,this.textLength=""===this.text?0:b.width},c.prototype.truncateTextAndRemeasure=function(b){var c=a.Util.Text.getTruncatedText(this.text,b,this.textElement);this.textElement.text(c),this.measureAndSetTextSize()},c.prototype._computeLayout=function(c,d,e,f){b.prototype._computeLayout.call(this,c,d,e,f),this.textElement.attr("dy",0);var g=a.Util.DOM.getBBox(this.textElement);this.textElement.attr("dy",-g.y);var h=0,i=0;return"horizontal"===this.orientation?(this.truncateTextAndRemeasure(this.availableWidth),h=(this.availableWidth-this.textLength)*this._xAlignProportion):(this.truncateTextAndRemeasure(this.availableHeight),h=(this.availableHeight-this.textLength)*this._yAlignProportion,"vertical-right"===this.orientation?(this.textElement.attr("transform","rotate(90)"),i=-this.textHeight):(this.textElement.attr("transform","rotate(-90)"),h=-h-this.textLength)),this.textElement.attr("x",h),this.textElement.attr("y",i),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.scale=function(a){var b=this;return null!=a?(null!=this.colorScale&&this._deregisterFromBroadcaster(this.colorScale),this.colorScale=a,this._registerToBroadcaster(this.colorScale,function(){return b._invalidateLayout()}),this._invalidateLayout(),this):this.colorScale},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){return a.Util.Text.getTruncatedText(b,f,d3.select(this))}),this},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(b){function c(a,c){this.callback(c),this.isOff=d3.set(),b.call(this,a)}return __extends(c,b),c.prototype.callback=function(a){return void 0!==a?(this._callback=a,this):this},c.prototype.scale=function(c){var d=this;return null!=c?(b.prototype.scale.call(this,c),this._registerToBroadcaster(c,function(){d.isOff=a.Util.Methods.intersection(d.isOff,d3.set(d.scale().domain())),d._invalidateLayout()}),this.isOff=a.Util.Methods.intersection(this.isOff,d3.set(this.scale().domain())),this.updateClasses(),this):b.prototype.scale.call(this)},c.prototype._doRender=function(){var c=this;return b.prototype._doRender.call(this),this.updateClasses(),this.content.selectAll("."+a.Component.Legend._SUBELEMENT_CLASS).on("click",function(a){var b=c.isOff.has(a);b?c.isOff.remove(a):c.isOff.add(a),null!=c._callback&&c._callback(a,b),c.updateClasses()}),this},c.prototype.updateClasses=function(){var b=this;if(this._isSetup){var c=this.content.selectAll("."+a.Component.Legend._SUBELEMENT_CLASS);c.classed("toggled-on",function(a){return!b.isOff.has(a)}),c.classed("toggled-off",function(a){return b.isOff.has(a)})}},c}(a.Component.Legend);b.ToggleLegend=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._registerToBroadcaster(this.xScale,function(){return d._render()}),null!=this.yScale&&this._registerToBroadcaster(this.yScale,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(b){var c=function(a){function b(b,c,d){a.call(this,b),this.classed("xy-renderer",!0),this.project("x","x",c),this.project("y","y",d)}return __extends(b,a),b.prototype.project=function(b,c,d){return"x"===b&&(this.xScale=null!=d?d:this.xScale,this._xAccessor=c,this.xScale._autoNice=!0,this.xScale._autoPad=!0),"y"===b&&(this.yScale=null!=d?d:this.yScale,this._yAccessor=c,this.yScale._autoNice=!0,this.yScale._autoPad=!0),a.prototype.project.call(this,b,c,d),this},b.prototype._computeLayout=function(b,c,d,e){return a.prototype._computeLayout.call(this,b,c,d,e),this.xScale.range([0,this.availableWidth]),this.yScale.range([this.availableHeight,0]),this +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}a.inRange=b,a.addArrays=c,a.intersection=d,a.accessorize=e,a.applyAccessor=f,a.uniq=g,a.createFilledArray=h}(a.Methods||(a.Methods={}));a.Methods}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){!function(a){function b(a,b,c){for(var d=0,e=b.length;e>d;){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){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 h(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.Util.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.Util.DOM.translate(j,q,r),[n,m]}function i(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 i="right"===g,j={left:"bottom",right:"top",center:"center",top:"left",bottom:"right"},k={left:"top",right:"bottom",center:"center",top:"right",bottom:"left"},l=i?j:k,m=b.append("g"),n=h(a,m,d,c,l[f],l[e]),o=d3.transform("");return o.rotate="right"===g?90:-90,o.translate=[i?c:0,i?0:d],m.attr("transform",o.toString()),[n[1],n[0]]}function j(b,c,d,f,g,i){"undefined"==typeof g&&(g="left"),"undefined"==typeof i&&(i="top");var j=e(c),k=0,l=c.append("g");b.forEach(function(b,c){var e=l.append("g");a.Util.DOM.translate(e,0,c*j);var f=h(b,e,d,j,g,i);f[0]>k&&(k=f[0])});var m=j*b.length,n=f-m,o={center:.5,top:0,bottom:1};return a.Util.DOM.translate(l,0,n*o[i]),[k,m]}function k(b,c,d,f,g,h,j){"undefined"==typeof g&&(g="left"),"undefined"==typeof h&&(h="top"),"undefined"==typeof j&&(j="left");var k=e(c),l=0,m=c.append("g");b.forEach(function(b,c){var d=m.append("g");a.Util.DOM.translate(d,c*k,0);var e=i(b,d,k,f,g,h,j);e[1]>l&&(l=e[1])});var n=k*b.length,o=d-n,p={center:.5,left:0,right:1};return a.Util.DOM.translate(m,o*p[g],0),[n,l]}function l(b,d,e,f,g,h,i){var l=null!=i?i:1.1*e>f,m=d.append("g").classed("writeText-inner-g",!0),n=l?e:f,o=l?f:e,p=c(m),q=a.Util.WordWrap.breakTextToFitRect(b,n,o,p),r=l?j:k,s=r(q.lines,m,e,f,g,h);return{textFits:q.textFits,usedWidth:s[0],usedHeight:s[1]}}b.getTextMeasure=c,b.getTruncatedText=d,b.getTextHeight=e,b.getTextWidth=f,b.addEllipsesToLine=g,b.writeLineHorizontally=h,b.writeLineVertically=i,b.writeTextHorizontally=j,b.writeTextVertically=k,b.writeText=l}(b.Text||(b.Text={}));b.Text}(a.Util||(a.Util={}));a.Util}(Plottable||(Plottable={}));var Plottable;!function(a){!function(b){!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.Util.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}(b.WordWrap||(b.WordWrap={}));b.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(a,b){var c=a.getPropertyValue(b);return null==c?0:parseFloat(c)}function d(a){for(var b=a.node(),c=b.parentNode;null!==c&&"#document"!==c.nodeName;)c=c.parentNode;return null==c}function e(a){var b=window.getComputedStyle(a);return c(b,"width")+c(b,"padding-left")+c(b,"padding-right")+c(b,"border-left-width")+c(b,"border-right-width")}function f(a){var b=window.getComputedStyle(a);return c(b,"height")+c(b,"padding-top")+c(b,"padding-bottom")+c(b,"border-top-width")+c(b,"border-bottom-width")}function g(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 h(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.isSelectionRemoved=d,a.getElementWidth=e,a.getElementHeight=f,a.getSVGPixelWidth=g,a.translate=h}(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(){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(){b.apply(this,arguments),this.listener2Callback=new a.Util.StrictEqualityAssociativeArray}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.Abstract.Component);b.ComponentContainer=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){"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;if(j=null!=a?a._requestedSpace(b[i],c[h]):{width:0,height:0,wantsWidth:!1,wantsHeight:!1},j.width>b[i]||j.height>c[h])throw new Error("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.rendererID2Perspective={},this.dataSourceReferenceCounter=new a.Util.IDCounter,this._autoNice=!1,this._autoPad=!1,this._d3Scale=c}return __extends(c,b),c.prototype._getAllExtents=function(){var a=d3.values(this.rendererID2Perspective),b=a.map(function(a){var b=a.dataSource,c=a.accessor;return b._getExtent(c)}).filter(function(a){return null!=a});return b},c.prototype._getExtent=function(){return[]},c.prototype.autoDomain=function(){return this._setDomain(this._getExtent()),this},c.prototype._addPerspective=function(a,b,c){var d=this;null!=this.rendererID2Perspective[a]&&this._removePerspective(a),this.rendererID2Perspective[a]={dataSource:b,accessor:c};var e=b._plottableID;return 1===this.dataSourceReferenceCounter.increment(e)&&b.registerListener(this,function(){d._autoDomainAutomatically&&d.autoDomain()}),this._autoDomainAutomatically&&this.autoDomain(),this},c.prototype._removePerspective=function(a){var b=this.rendererID2Perspective[a].dataSource,c=b._plottableID;return 0===this.dataSourceReferenceCounter.decrement(c)&&b.deregisterListener(this),delete this.rendererID2Perspective[a],this._autoDomainAutomatically&&this.autoDomain(),this},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){this._d3Scale.domain(a),this._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}(a.Abstract.Broadcaster);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._ANIMATION_DURATION=250,this._projectors={},this._rerenderUpdateSelection=!1,this._requireRerender=!1,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._dataChanged=!0,this},c.prototype.dataSource=function(a){var b=this;if(null==a)return this._dataSource;var c=this._dataSource;return null!=c&&(this._deregisterFromBroadcaster(this._dataSource),this._requireRerender=!0,this._rerenderUpdateSelection=!0,d3.keys(this._projectors).forEach(function(c){var d=b._projectors[c];if(null!=d.scale){var e=b._plottableID+c;d.scale._removePerspective(e),d.scale._addPerspective(e,a,d.accessor)}})),this._dataSource=a,this._registerToBroadcaster(this._dataSource,function(){b._dataChanged=!0,b._render()}),this._dataChanged=!0,this._render(),this},c.prototype.project=function(a,b,c){var d=this;a=a.toLowerCase();var e=this._plottableID+a,f=this._projectors[a],g=null!=f?f.scale:null;return null==c&&(c=g),null!=g&&(g._removePerspective(e),this._deregisterFromBroadcaster(g)),null!=c&&(c._addPerspective(e,this.dataSource(),b),this._registerToBroadcaster(c,function(){return d._render()})),this._projectors[a]={accessor:b,scale:c},this._requireRerender=!0,this._rerenderUpdateSelection=!0,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._requireRerender=!1,this._rerenderUpdateSelection=!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}(a.Abstract.Component);b.Plot=c}(a.Abstract||(a.Abstract={}));a.Abstract}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){}return a.registerToRender=function(b){return a.enabled?(a.componentsNeedingRender[b._plottableID]=b,void a.requestFrame()):void b._doRender()},a.registerToComputeLayout=function(b){return a.enabled?(a.componentsNeedingComputeLayout[b._plottableID]=b,a.componentsNeedingRender[b._plottableID]=b,void a.requestFrame()):void b._computeLayout()._render()},a.requestFrame=function(){a.animationRequested||(null!=window.requestAnimationFrame?requestAnimationFrame(a.flush):setTimeout(a.flush,a.IE_TIMEOUT),a.animationRequested=!0)},a.flush=function(){if(a.animationRequested){var b=d3.values(a.componentsNeedingComputeLayout);b.forEach(function(a){return a._computeLayout()});var c=d3.values(a.componentsNeedingRender);c.forEach(function(a){return a._render()}),c=d3.values(a.componentsNeedingRender),c.forEach(function(a){return a._doRender()}),a.componentsNeedingComputeLayout={},a.componentsNeedingRender={},a.animationRequested=!1}},a.IE_TIMEOUT=1e3/60,a.componentsNeedingRender={},a.componentsNeedingComputeLayout={},a.animationRequested=!1,a.enabled=null==window.PlottableTestCode,a}();a.RenderController=b}(a.Singleton||(a.Singleton={}));a.Singleton}(Plottable||(Plottable={}));var Plottable;!function(){}(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),this.lastRequestedTickCount=10,this._PADDING_FOR_IDENTICAL_DOMAIN=1}return __extends(b,a),b.prototype._getExtent=function(){var a=this._getAllExtents(),b=a.map(function(a){return a[0]}),c=a.map(function(a){return a[1]});return b.length>0?[d3.min(b),d3.max(c)]:[0,1]},b.prototype.autoDomain=function(){return a.prototype.autoDomain.call(this),this._autoPad&&this.padDomain(),this._autoNice&&this.nice(),this +},b.prototype.invert=function(a){return this._d3Scale.invert(a)},b.prototype.copy=function(){return new b(this._d3Scale.copy())},b.prototype.domain=function(b){return a.prototype.domain.call(this,b)},b.prototype.interpolate=function(a){return null==a?this._d3Scale.interpolate():(this._d3Scale.interpolate(a),this)},b.prototype.rangeRound=function(a){return this._d3Scale.rangeRound(a),this},b.prototype.clamp=function(a){return null==a?this._d3Scale.clamp():(this._d3Scale.clamp(a),this)},b.prototype.nice=function(a){return this._d3Scale.nice(a),this._setDomain(this._d3Scale.domain()),this},b.prototype.ticks=function(a){return null!=a&&(this.lastRequestedTickCount=a),this._d3Scale.ticks(this.lastRequestedTickCount)},b.prototype.tickFormat=function(a,b){return this._d3Scale.tickFormat(a,b)},b.prototype.padDomain=function(a){"undefined"==typeof a&&(a=.05);var b=this.domain();if(b[0]===b[1]){var c=b[0].valueOf();return this._setDomain([c-this._PADDING_FOR_IDENTICAL_DOMAIN,c+this._PADDING_FOR_IDENTICAL_DOMAIN]),this}var d=b[1]-b[0],e=[b[0]-a/2*d,b[1].valueOf()+a/2*d];return 0===b[0]&&(e[0]=0),0===b[1]&&(e[1]=0),this._setDomain(e),this},b}(a.Abstract.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(),c=[];return b.forEach(function(a){c=c.concat(a)}),a.Util.Methods.uniq(c)},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._broadcast(),this},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(){a.call(this,d3.time.scale()),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._autoDomainAutomatically&&this.autoDomain(),this._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.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(a){function b(b,c,d){var e=this;if(a.call(this),this._showEndTickLabels=!1,this.tickPositioning="center",this.orientToAlign={left:"right",right:"left",top:"bottom",bottom:"top"},this._axisScale=b,c=c.toLowerCase(),this.d3Axis=d3.svg.axis().scale(b._d3Scale).orient(c),this.classed("axis",!0),null==d){var f=d3.format(".3s");d=function(a){return"number"==typeof a?Math.abs(a)<1?String(Math.round(1e3*a)/1e3):f(a):a}}this.tickFormat(d),this._registerToBroadcaster(this._axisScale,function(){return e._render()})}return __extends(b,a),b.prototype._setup=function(){return a.prototype._setup.call(this),this.axisElement=this.content.append("g").classed("axis",!0),this},b.prototype._doRender=function(){var a,b=this.d3Axis.scale().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"))})},b.prototype.scale=function(a){return null==a?this._axisScale:(this._axisScale=a,this.d3Axis.scale(a._d3Scale),this)},b.prototype.tickLabelPosition=function(a){return null==a?this.tickPositioning:(this.tickPositioning=a,this)},b.prototype.orient=function(a){return null==a?this.d3Axis.orient():(this.d3Axis.orient(a),this)},b.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,b));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,b));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(a){function b(b,c,d){var e=this;a.call(this),this._tickLength=5,this._tickLabelPadding=3,this._maxWidth=0,this._maxHeight=0,this._scale=b,this.orient(c),this.classed("axis",!0),this._isHorizontal()?this.classed("x-axis",!0):this.classed("y-axis",!0),this._formatter=null!=d?d:function(a){return String(a)},this._registerToBroadcaster(this._scale,function(){return e.rescale()})}return __extends(b,a),b.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},b.prototype._setup=function(){return a.prototype._setup.call(this),this._ticksContainer=this.content.append("g").classed("ticks-container",!0),this._baseline=this.content.append("line").classed("baseline",!0),this},b.prototype._getTickValues=function(){return[]},b.prototype._doRender=function(){var a=this,b=this._getTickValues();this._ticks=this._ticksContainer.selectAll(".tick").data(b);var c=this._ticks.enter().append("g").classed("tick",!0);c.append("line").classed("tick-mark",!0),this._ticks.exit().remove();var d=this._isHorizontal()?function(b){return a._scale.scale(b)}:function(){return 0},e=this._isHorizontal()?function(){return 0}:function(b){return a._scale.scale(b)},f=function(a){return"translate("+d(a)+", "+e(a)+")"};return this._baseline.attr(this._generateBaselineAttrHash()),this._ticks.select("line").attr(this._generateTickMarkAttrHash()),this._ticks.attr("transform",f),this},b.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},b.prototype._generateTickMarkAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.y2=this._tickLength;break;case"top":a.y1=this.availableHeight,a.y2=this.availableHeight-this._tickLength;break;case"left":a.x1=this.availableWidth,a.x2=this.availableWidth-this._tickLength;break;case"right":a.x2=this._tickLength}return a},b.prototype.rescale=function(){return null!=this.element?this._render():null},b.prototype.formatter=function(a){return this._formatter=a,this._render(),this},b.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},b.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},b.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._render(),this},b}(a.Abstract.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){"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._registerToBroadcaster(this._scale,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},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:c,height:d,wantsWidth:!this._isHorizontal(),wantsHeight:this._isHorizontal()};this._scale.range(this._isHorizontal()?[0,a]:[b,0]);var e=this._tickLabelsG.append("g"),f=e.selectAll(".tick").data(this._scale.domain());f.enter().append("g").classed("tick",!0);var g=this.writeTextToTicks(a,b,f);return e.remove(),{width:g.usedWidth+c,height:g.usedHeight+d,wantsWidth:!g.textFits,wantsHeight:!g.textFits}},c.prototype._getTickValues=function(){return this._scale.domain()},c.prototype.writeTextToTicks=function(b,c,d){var e=this,f=[];d.each(function(d){var g=d3.select(this),h=e._scale.fullBandStartAndWidth(d)[1],i=e._isHorizontal()?h:b-e.tickLength()-e.tickLabelPadding(),j=e._isHorizontal()?c-e.tickLength()-e.tickLabelPadding():h,k={left:"right",right:"left",top:"center",bottom:"center"},l={left:"center",right:"center",top:"bottom",bottom:"top"},m=a.Util.Text.writeText(d,g,i,j,k[e._orientation],l[e._orientation],!0);f.push(m)});var g=this._isHorizontal()?d3.sum:d3.max,h=this._isHorizontal()?d3.max:d3.sum;return{textFits:f.every(function(a){return a.textFits}),usedWidth:g(f,function(a){return a.usedWidth}),usedHeight:h(f,function(a){return a.usedHeight})}},c.prototype._doRender=function(){var c=this;b.prototype._doRender.call(this),this._tickLabelsG.selectAll(".tick-label").remove();var d=this._tickLabelsG.selectAll(".tick-label").data(this._scale.domain()),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),this.writeTextToTicks(this.availableWidth,this.availableHeight,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._ticksContainer,f[0],f[1]),this},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(),"horizontal"!==c&&"vertical-left"!==c&&"vertical-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._requestedSpace=function(a,b){var c,d;return"horizontal"===this.orientation?(c=this.textLength,d=this.textHeight):(c=this.textHeight,d=this.textLength),{width:Math.min(c,a),height:Math.min(d,b),wantsWidth:c>a,wantsHeight:d>b}},c.prototype._setup=function(){return b.prototype._setup.call(this),this.textElement=this.content.append("text"),this.setText(this.text),this},c.prototype.setText=function(a){return this.text=a,null!=this.element&&(this.textElement.text(a),this.measureAndSetTextSize()),this._invalidateLayout(),this},c.prototype.measureAndSetTextSize=function(){var b=a.Util.DOM.getBBox(this.textElement);this.textHeight=b.height,this.textLength=""===this.text?0:b.width},c.prototype.truncateTextAndRemeasure=function(b){var c=a.Util.Text.getTruncatedText(this.text,b,this.textElement);this.textElement.text(c),this.measureAndSetTextSize()},c.prototype._computeLayout=function(c,d,e,f){b.prototype._computeLayout.call(this,c,d,e,f),this.textElement.attr("dy",0);var g=a.Util.DOM.getBBox(this.textElement);this.textElement.attr("dy",-g.y);var h=0,i=0;return"horizontal"===this.orientation?(this.truncateTextAndRemeasure(this.availableWidth),h=(this.availableWidth-this.textLength)*this._xAlignProportion):(this.truncateTextAndRemeasure(this.availableHeight),h=(this.availableHeight-this.textLength)*this._yAlignProportion,"vertical-right"===this.orientation?(this.textElement.attr("transform","rotate(90)"),i=-this.textHeight):(this.textElement.attr("transform","rotate(-90)"),h=-h-this.textLength)),this.textElement.attr("x",h),this.textElement.attr("y",i),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.scale=function(a){var b=this;return null!=a?(null!=this.colorScale&&this._deregisterFromBroadcaster(this.colorScale),this.colorScale=a,this._registerToBroadcaster(this.colorScale,function(){return b._invalidateLayout()}),this._invalidateLayout(),this):this.colorScale},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){return a.Util.Text.getTruncatedText(b,f,d3.select(this))}),this},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(b){function c(a,c){this.callback(c),this.isOff=d3.set(),b.call(this,a)}return __extends(c,b),c.prototype.callback=function(a){return void 0!==a?(this._callback=a,this):this},c.prototype.scale=function(c){var d=this;return null!=c?(b.prototype.scale.call(this,c),this._registerToBroadcaster(c,function(){d.isOff=a.Util.Methods.intersection(d.isOff,d3.set(d.scale().domain())),d._invalidateLayout()}),this.isOff=a.Util.Methods.intersection(this.isOff,d3.set(this.scale().domain())),this.updateClasses(),this):b.prototype.scale.call(this)},c.prototype._doRender=function(){var c=this;return b.prototype._doRender.call(this),this.updateClasses(),this.content.selectAll("."+a.Component.Legend._SUBELEMENT_CLASS).on("click",function(a){var b=c.isOff.has(a);b?c.isOff.remove(a):c.isOff.add(a),null!=c._callback&&c._callback(a,b),c.updateClasses()}),this},c.prototype.updateClasses=function(){var b=this;if(this._isSetup){var c=this.content.selectAll("."+a.Component.Legend._SUBELEMENT_CLASS);c.classed("toggled-on",function(a){return!b.isOff.has(a)}),c.classed("toggled-off",function(a){return b.isOff.has(a)})}},c}(a.Component.Legend);b.ToggleLegend=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._registerToBroadcaster(this.xScale,function(){return d._render()}),null!=this.yScale&&this._registerToBroadcaster(this.yScale,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(b){var c=function(a){function b(b,c,d){a.call(this,b),this.classed("xy-renderer",!0),this.project("x","x",c),this.project("y","y",d)}return __extends(b,a),b.prototype.project=function(b,c,d){return"x"===b&&(this.xScale=null!=d?d:this.xScale,this._xAccessor=c,this.xScale._autoNice=!0,this.xScale._autoPad=!0),"y"===b&&(this.yScale=null!=d?d:this.yScale,this._yAccessor=c,this.yScale._autoNice=!0,this.yScale._autoPad=!0),a.prototype.project.call(this,b,c,d),this},b.prototype._computeLayout=function(b,c,d,e){return a.prototype._computeLayout.call(this,b,c,d,e),this.xScale.range([0,this.availableWidth]),this.yScale.range([this.availableHeight,0]),this },b.prototype.rescale=function(){null!=this.element&&this._render()},b}(a.Abstract.Plot);b.XYPlot=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._ANIMATION_DURATION=250,this._ANIMATION_DELAY=5,this.classed("circle-renderer",!0),this.project("r",3),this.project("fill",function(){return"steelblue"})}return __extends(b,a),b.prototype.project=function(b,c,d){return b="cx"===b?"x":b,b="cy"===b?"y":b,a.prototype.project.call(this,b,c,d),this},b.prototype._paint=function(){var b=this;a.prototype._paint.call(this);var c=this._generateAttrToProjector();c.cx=c.x,c.cy=c.y,delete c.x,delete c.y;var d=c.r;c.r=function(){return 0};var e=this.renderArea.selectAll("circle").data(this._dataSource.data());e.enter().append("circle"),e.attr(c);var f=e;if(this._animate&&this._dataChanged){{this.dataSource().data().length}f=f.transition().ease("exp-out").duration(this._ANIMATION_DURATION).delay(function(a,c){return c*b._ANIMATION_DELAY})}f.attr("r",d),e.exit().remove()},b}(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(a){function b(b,c,d,e){a.call(this,b,c,d),this.classed("grid-renderer",!0),this.xScale.rangeType("bands",0,0),this.yScale.rangeType("bands",0,0),this.colorScale=e,this.project("fill","value",e)}return __extends(b,a),b.prototype.project=function(b,c,d){return a.prototype.project.call(this,b,c,d),"fill"===b&&(this.colorScale=this._projectors.fill.scale),this},b.prototype._paint=function(){a.prototype._paint.call(this);var b=this.renderArea.selectAll("rect").data(this._dataSource.data());b.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},b.attr(e),b.exit().remove()},b}(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(a){function b(b,c,d){a.call(this,b,c,d),this._baselineValue=0,this.classed("bar-renderer",!0),this.project("width",10),this.project("fill",function(){return"steelblue"})}return __extends(b,a),b.prototype._setup=function(){return a.prototype._setup.call(this),this._baseline=this.renderArea.append("line").classed("baseline",!0),this},b.prototype.baseline=function(a){return this._baselineValue=a,null!=this.element&&this._render(),this},b.prototype.barAlignment=function(){return this},b.prototype.selectBar=function(a,b,c){"undefined"==typeof c&&(c=!0);var d=null;return this._bars.each(function(){var c=this.getBBox();c.x<=a&&a<=c.x+c.width&&c.y<=b&&b<=c.y+c.height&&(d=d3.select(this))}),null!=d&&d.classed("selected",c),d},b.prototype.deselectAll=function(){return this._bars.classed("selected",!1),this},b}(a.Abstract.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._barAlignment="left",this._ANIMATION_DURATION=300,this._ANIMATION_DELAY=15}return __extends(b,a),b.prototype._paint=function(){var b=this;a.prototype._paint.call(this);var c=this.yScale.scale(this._baselineValue);this._bars=this.renderArea.selectAll("rect").data(this._dataSource.data()),this._bars.enter().append("rect");var d=this._generateAttrToProjector(),e=d.x,f=d.width,g=this.xScale,h=null==g.rangeType?"points":g.rangeType();"points"===h?"center"===this._barAlignment?d.x=function(a,b){return e(a,b)-f(a,b)/2}:"right"===this._barAlignment&&(d.x=function(a,b){return e(a,b)-f(a,b)}):d.width=function(){return g.rangeBand()};var i=d.y;this._animate&&this._dataChanged&&(d.y=function(){return c},d.height=function(){return 0},this._bars.attr(d)),d.y=function(a,b){var d=i(a,b);return d>c?c:d};var j=function(a,b){return Math.abs(c-i(a,b))};d.height=j,null!=d.fill&&this._bars.attr("fill",d.fill);var k=this._bars;if(this._animate){{this.dataSource().data().length}k=k.transition().ease("exp-out").duration(this._ANIMATION_DURATION).delay(function(a,c){return c*b._ANIMATION_DELAY})}k.attr(d),this._bars.exit().remove(),this._baseline.attr({x1:0,y1:c,x2:this.availableWidth,y2:c})},b.prototype.barAlignment=function(a){var b=a.toLowerCase();if("left"!==b&&"center"!==b&&"right"!==b)throw new Error("unsupported bar alignment");return this._barAlignment=b,null!=this.element&&this._render(),this},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._barAlignment="top",this._ANIMATION_DURATION=300,this._ANIMATION_DELAY=15}return __extends(b,a),b.prototype._paint=function(){var b=this;a.prototype._paint.call(this),this._bars=this.renderArea.selectAll("rect").data(this._dataSource.data()),this._bars.enter().append("rect");var c=this._generateAttrToProjector(),d=c.y;c.height=c.width;var e=c.height,f=this.yScale,g=null==f.rangeType?"points":f.rangeType();"points"===g?"middle"===this._barAlignment?c.y=function(a,b){return d(a,b)-e(a,b)/2}:"bottom"===this._barAlignment&&(c.y=function(a,b){return d(a,b)-e(a,b)}):c.height=function(){return f.rangeBand()};var h=this.xScale.scale(this._baselineValue),i=c.x;this._animate&&this._dataChanged&&(c.x=function(){return h},c.width=function(){return 0},this._bars.attr(c)),c.x=function(a,b){var c=i(a,b);return c>h?h:c};var j=function(a,b){return Math.abs(h-i(a,b))};c.width=j,null!=c.fill&&this._bars.attr("fill",c.fill);var k=this._bars;if(this._animate){{this.dataSource().data().length}k=k.transition().ease("exp-out").duration(this._ANIMATION_DURATION).delay(function(a,c){return c*b._ANIMATION_DELAY})}k.attr(c),this._bars.exit().remove(),this._baseline.attr({x1:h,y1:0,x2:h,y2:this.availableHeight})},b.prototype.barAlignment=function(a){var b=a.toLowerCase();if("top"!==b&&"middle"!==b&&"bottom"!==b)throw new Error("unsupported bar alignment");return this._barAlignment=b,null!=this.element&&this._render(),this},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(a){function b(b,c,d){a.call(this,b,c,d),this._ANIMATION_DURATION=600,this.classed("area-renderer",!0),this.project("y0",0,d),this.project("fill",function(){return"steelblue"}),this.project("stroke",function(){return"none"})}return __extends(b,a),b.prototype._setup=function(){return a.prototype._setup.call(this),this.areaPath=this.renderArea.append("path").classed("area",!0),this.linePath=this.renderArea.append("path").classed("line",!0),this},b.prototype._paint=function(){a.prototype._paint.call(this);var b=this._generateAttrToProjector(),c=b.x,d=b.y0,e=b.y;if(delete b.x,delete b.y0,delete b.y,this.areaPath.datum(this._dataSource.data()),this.linePath.datum(this._dataSource.data()),this._animate&&this._dataChanged){var f=d3.svg.area().x(c).y0(d).y1(d);this.areaPath.attr("d",f).attr(b);var g=d3.svg.line().x(c).y(d);this.linePath.attr("d",g).attr(b)}var h=d3.svg.area().x(c).y0(d).y1(e),i=this.areaPath,j=this.linePath;this._animate&&(i=this.areaPath.transition().duration(this._ANIMATION_DURATION).ease("exp-in-out"),j=this.linePath.transition().duration(this._ANIMATION_DURATION).ease("exp-in-out"));var k=d3.svg.line().x(c).y(e);i.attr("d",h).attr(b),j.attr("d",k).attr(b)},b}(a.Abstract.XYPlot);b.Area=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._ANIMATION_DURATION=600,this.classed("line-renderer",!0),this.project("stroke",function(){return"steelblue"}),this.project("fill",function(){return"none"})}return __extends(b,a),b}(a.Plot.Area);b.Line=c}(a.Plot||(a.Plot={}));a.Plot}(Plottable||(Plottable={}));var Plottable;!function(a){!function(a){var b=function(){function a(){}return a.initialize=function(){a.initialized||(d3.select(document).on("keydown",a.processEvent),a.initialized=!0)},a.addCallback=function(b,c){a.initialized||a.initialize(),null==a.callbacks[b]&&(a.callbacks[b]=[]),a.callbacks[b].push(c)},a.processEvent=function(){null!=a.callbacks[d3.event.keyCode]&&a.callbacks[d3.event.keyCode].forEach(function(a){a(d3.event)})},a.initialized=!1,a.callbacks=[],a}();a.KeyEventListener=b}(a.Singleton||(a.Singleton={}));a.Singleton}(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("click",function(){var a=d3.mouse(b.node()),d=a[0],e=a[1];c._callback(d,e)})},b.prototype.callback=function(a){return this._callback=a,this},b}(a.Abstract.Interaction);b.Click=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){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.Singleton.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(b){var c=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 this.dragBox.attr("height",0).attr("width",0),this.boxIsDrawn=!1,this},b.prototype.setBox=function(a,b,c,d){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.Interaction.Drag);b.DragBox=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(){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.Interaction.DragBox);b.XDragBox=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(){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.Interaction.DragBox);b.XYDragBox=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(){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.Interaction.DragBox);b.YDragBox=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(){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 diff --git a/plottable.zip b/plottable.zip index c3eb9d1e5a..441feae814 100644 Binary files a/plottable.zip and b/plottable.zip differ