diff --git a/bower.json b/bower.json
index 6d3c6cf150..bfd2167174 100644
--- a/bower.json
+++ b/bower.json
@@ -1,7 +1,7 @@
{
"name": "plottable",
"description": "A library for creating charts out of D3",
- "version": "0.50.0",
+ "version": "0.51.0",
"main": ["plottable.js", "plottable.css"],
"license": "MIT",
"ignore": [
diff --git a/package.json b/package.json
index 4286667770..063c482688 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "plottable.js",
"description": "A library for creating charts out of D3",
- "version": "0.50.0",
+ "version": "0.51.0",
"repository": {
"type": "git",
"url": "https://github.com/palantir/plottable.git"
diff --git a/plottable.d.ts b/plottable.d.ts
index 6088a97f02..06f97c0ed6 100644
--- a/plottable.d.ts
+++ b/plottable.d.ts
@@ -412,30 +412,18 @@ declare module Plottable {
declare module Plottable {
/**
- * A SymbolGenerator is a function that takes in a datum and the index of the datum to
- * produce an svg path string analogous to the datum/index pair.
- *
- * Note that SymbolGenerators used in Plottable will be assumed to work within a 100x100 square
- * to be scaled appropriately for use within Plottable
+ * A SymbolFactory is a function that takes in a symbolSize which is the edge length of the render area
+ * and returns a string representing the 'd' attribute of the resultant 'path' element
*/
- type SymbolGenerator = (datum: any, index: number) => string;
- module SymbolGenerators {
- /**
- * The radius that symbol generators will be assumed to have for their symbols.
- */
- var SYMBOL_GENERATOR_RADIUS: number;
- type StringAccessor = ((datum: any, index: number) => string);
- /**
- * A wrapper for D3's symbol generator as documented here:
- * https://github.com/mbostock/d3/wiki/SVG-Shapes#symbol
- *
- * Note that since D3 symbols compute the path strings by knowing how much area it can take up instead of
- * knowing its dimensions, the total area expected may be off by some constant factor.
- *
- * @param {string | ((datum: any, index: number) => string)} symbolType Accessor for the d3 symbol type
- * @returns {SymbolGenerator} the symbol generator for a D3 symbol
- */
- function d3Symbol(symbolType: string | StringAccessor): D3.Svg.Symbol;
+ type SymbolFactory = (symbolSize: number) => string;
+ module SymbolFactories {
+ type StringAccessor = (datum: any, index: number) => string;
+ function circle(): SymbolFactory;
+ function square(): SymbolFactory;
+ function cross(): SymbolFactory;
+ function diamond(): SymbolFactory;
+ function triangleUp(): SymbolFactory;
+ function triangleDown(): SymbolFactory;
}
}
@@ -2420,18 +2408,19 @@ declare module Plottable {
getEntry(position: Point): D3.Selection;
_doRender(): void;
/**
- * Gets the SymbolGenerator of the legend, which dictates how
+ * Gets the symbolFactoryAccessor of the legend, which dictates how
* the symbol in each entry is drawn.
*
- * @returns {SymbolGenerator} The SymbolGenerator of the legend
+ * @returns {(datum: any, index: number) => symbolFactory} The symbolFactory accessor of the legend
*/
- symbolGenerator(): SymbolGenerator;
+ symbolFactoryAccessor(): (datum: any, index: number) => SymbolFactory;
/**
- * Sets the SymbolGenerator of the legend
+ * Sets the symbolFactoryAccessor of the legend
*
+ * @param {(datum: any, index: number) => symbolFactory} The symbolFactory accessor to set to
* @returns {Legend} The calling Legend
*/
- symbolGenerator(symbolGenerator: SymbolGenerator): Legend;
+ symbolFactoryAccessor(symbolFactoryAccessor: (datum: any, index: number) => SymbolFactory): Legend;
}
}
}
diff --git a/plottable.js b/plottable.js
index ecc7ba0d05..47a3c6c3ac 100644
--- a/plottable.js
+++ b/plottable.js
@@ -1,5 +1,5 @@
/*!
-Plottable 0.50.0 (https://github.com/palantir/plottable)
+Plottable 0.51.0 (https://github.com/palantir/plottable)
Copyright 2014 Palantir Technologies
Licensed under MIT (https://github.com/palantir/plottable/blob/master/LICENSE)
*/
@@ -987,61 +987,33 @@ var Plottable;
///
var Plottable;
(function (Plottable) {
- var SymbolGenerators;
- (function (SymbolGenerators) {
- /**
- * The radius that symbol generators will be assumed to have for their symbols.
- */
- SymbolGenerators.SYMBOL_GENERATOR_RADIUS = 50;
- /**
- * A wrapper for D3's symbol generator as documented here:
- * https://github.com/mbostock/d3/wiki/SVG-Shapes#symbol
- *
- * Note that since D3 symbols compute the path strings by knowing how much area it can take up instead of
- * knowing its dimensions, the total area expected may be off by some constant factor.
- *
- * @param {string | ((datum: any, index: number) => string)} symbolType Accessor for the d3 symbol type
- * @returns {SymbolGenerator} the symbol generator for a D3 symbol
- */
- function d3Symbol(symbolType) {
- // Since D3 symbols use a size concept, we have to convert our radius value to the corresponding area value
- // This is done by inspecting the symbol size calculation in d3.js and solving how sizes are calculated from a given radius
- var typeToSize = function (symbolTypeString) {
- var sizeFactor;
- switch (symbolTypeString) {
- case "circle":
- sizeFactor = Math.PI;
- break;
- case "square":
- sizeFactor = 4;
- break;
- case "cross":
- sizeFactor = 20 / 9;
- break;
- case "diamond":
- sizeFactor = 2 * Math.tan(Math.PI / 6);
- break;
- case "triangle-up":
- case "triangle-down":
- sizeFactor = Math.sqrt(3);
- break;
- default:
- sizeFactor = 1;
- break;
- }
- return sizeFactor * Math.pow(SymbolGenerators.SYMBOL_GENERATOR_RADIUS, 2);
- };
- function ensureSymbolType(symTypeString) {
- if (d3.svg.symbolTypes.indexOf(symTypeString) === -1) {
- throw new Error(symTypeString + " is an invalid D3 symbol type. d3.svg.symbolTypes can retrieve the valid symbol types.");
- }
- return symTypeString;
- }
- var symbolSize = typeof (symbolType) === "string" ? typeToSize(ensureSymbolType(symbolType)) : function (datum, index) { return typeToSize(ensureSymbolType(symbolType(datum, index))); };
- return d3.svg.symbol().type(symbolType).size(symbolSize);
+ var SymbolFactories;
+ (function (SymbolFactories) {
+ function circle() {
+ return function (symbolSize) { return d3.svg.symbol().type("circle").size(Math.PI * Math.pow(symbolSize / 2, 2))(); };
+ }
+ SymbolFactories.circle = circle;
+ function square() {
+ return function (symbolSize) { return d3.svg.symbol().type("square").size(Math.pow(symbolSize, 2))(); };
+ }
+ SymbolFactories.square = square;
+ function cross() {
+ return function (symbolSize) { return d3.svg.symbol().type("cross").size((5 / 9) * Math.pow(symbolSize, 2))(); };
+ }
+ SymbolFactories.cross = cross;
+ function diamond() {
+ return function (symbolSize) { return d3.svg.symbol().type("diamond").size(Math.tan(Math.PI / 6) * Math.pow(symbolSize, 2) / 2)(); };
+ }
+ SymbolFactories.diamond = diamond;
+ function triangleUp() {
+ return function (symbolSize) { return d3.svg.symbol().type("triangle-up").size(Math.sqrt(3) * Math.pow(symbolSize / 2, 2))(); };
}
- SymbolGenerators.d3Symbol = d3Symbol;
- })(SymbolGenerators = Plottable.SymbolGenerators || (Plottable.SymbolGenerators = {}));
+ SymbolFactories.triangleUp = triangleUp;
+ function triangleDown() {
+ return function (symbolSize) { return d3.svg.symbol().type("triangle-down").size(Math.sqrt(3) * Math.pow(symbolSize / 2, 2))(); };
+ }
+ SymbolFactories.triangleDown = triangleDown;
+ })(SymbolFactories = Plottable.SymbolFactories || (Plottable.SymbolFactories = {}));
})(Plottable || (Plottable = {}));
///
@@ -1122,7 +1094,7 @@ var Plottable;
///
var Plottable;
(function (Plottable) {
- Plottable.version = "0.50.0";
+ Plottable.version = "0.51.0";
})(Plottable || (Plottable = {}));
///
@@ -3370,12 +3342,12 @@ var Plottable;
var yProjector = attrToProjector["y"];
delete attrToProjector["x"];
delete attrToProjector["y"];
- var rProjector = attrToProjector["r"];
- delete attrToProjector["r"];
- attrToProjector["transform"] = function (datum, index) { return "translate(" + xProjector(datum, index) + "," + yProjector(datum, index) + ") " + "scale(" + rProjector(datum, index) / 50 + ")"; };
+ var rProjector = attrToProjector["size"];
+ delete attrToProjector["size"];
+ attrToProjector["transform"] = function (datum, index) { return "translate(" + xProjector(datum, index) + "," + yProjector(datum, index) + ")"; };
var symbolProjector = attrToProjector["symbol"];
delete attrToProjector["symbol"];
- attrToProjector["d"] = symbolProjector;
+ attrToProjector["d"] = attrToProjector["d"] || (function (datum, index) { return symbolProjector(datum, index)(rProjector(datum, index)); });
_super.prototype._drawStep.call(this, step);
};
Symbol.prototype._getPixelPoint = function (datum, index) {
@@ -5531,7 +5503,7 @@ var Plottable;
this._fixedWidthFlag = true;
this._fixedHeightFlag = true;
this._sortFn = function (a, b) { return _this._scale.domain().indexOf(a) - _this._scale.domain().indexOf(b); };
- this._symbolGenerator = Plottable.SymbolGenerators.d3Symbol("circle");
+ this._symbolFactoryAccessor = function () { return Plottable.SymbolFactories.circle(); };
}
Legend.prototype._setup = function () {
_super.prototype._setup.call(this);
@@ -5695,7 +5667,7 @@ var Plottable;
return translateString;
});
});
- entries.select("path").attr("d", this.symbolGenerator()).attr("transform", "translate(" + (layout.textHeight / 2) + "," + layout.textHeight / 2 + ") " + "scale(" + (layout.textHeight * 0.3 / Plottable.SymbolGenerators.SYMBOL_GENERATOR_RADIUS) + ")").attr("fill", function (value) { return _this._scale.scale(value); }).attr("vector-effect", "non-scaling-stroke").classed(Legend.LEGEND_SYMBOL_CLASS, true);
+ entries.select("path").attr("d", function (d, i) { return _this.symbolFactoryAccessor()(d, i)(layout.textHeight * 0.6); }).attr("transform", "translate(" + (layout.textHeight / 2) + "," + layout.textHeight / 2 + ")").attr("fill", function (value) { return _this._scale.scale(value); }).classed(Legend.LEGEND_SYMBOL_CLASS, true);
var padding = this._padding;
var textContainers = entries.select("g.text-container");
textContainers.text(""); // clear out previous results
@@ -5713,12 +5685,12 @@ var Plottable;
self._writer.write(value, maxTextLength, self.height(), writeOptions);
});
};
- Legend.prototype.symbolGenerator = function (symbolGenerator) {
- if (symbolGenerator == null) {
- return this._symbolGenerator;
+ Legend.prototype.symbolFactoryAccessor = function (symbolFactoryAccessor) {
+ if (symbolFactoryAccessor == null) {
+ return this._symbolFactoryAccessor;
}
else {
- this._symbolGenerator = symbolGenerator;
+ this._symbolFactoryAccessor = symbolFactoryAccessor;
this._render();
return this;
}
@@ -7257,32 +7229,17 @@ var Plottable;
};
Scatter.prototype._generateAttrToProjector = function () {
var attrToProjector = _super.prototype._generateAttrToProjector.call(this);
- attrToProjector["r"] = attrToProjector["r"] || d3.functor(3);
+ attrToProjector["size"] = attrToProjector["size"] || d3.functor(6);
attrToProjector["opacity"] = attrToProjector["opacity"] || d3.functor(0.6);
attrToProjector["fill"] = attrToProjector["fill"] || d3.functor(this._defaultFillColor);
- attrToProjector["symbol"] = attrToProjector["symbol"] || Plottable.SymbolGenerators.d3Symbol("circle");
- attrToProjector["vector-effect"] = attrToProjector["vector-effect"] || d3.functor("non-scaling-stroke");
- // HACKHACK vector-effect non-scaling-stroke has no effect in IE
- // https://connect.microsoft.com/IE/feedback/details/788819/svg-non-scaling-stroke
- if (Plottable._Util.Methods.isIE() && attrToProjector["stroke-width"] != null) {
- var strokeWidthProjector = attrToProjector["stroke-width"];
- attrToProjector["stroke-width"] = function (d, i, u, m) {
- var strokeWidth = strokeWidthProjector(d, i, u, m);
- if (attrToProjector["vector-effect"](d, i, u, m) === "non-scaling-stroke") {
- return strokeWidth * Plottable.SymbolGenerators.SYMBOL_GENERATOR_RADIUS / attrToProjector["r"](d, i, u, m);
- }
- else {
- return strokeWidth;
- }
- };
- }
+ attrToProjector["symbol"] = attrToProjector["symbol"] || (function () { return Plottable.SymbolFactories.circle(); });
return attrToProjector;
};
Scatter.prototype._generateDrawSteps = function () {
var drawSteps = [];
if (this._dataChanged && this._animate) {
var resetAttrToProjector = this._generateAttrToProjector();
- resetAttrToProjector["r"] = function () { return 0; };
+ resetAttrToProjector["size"] = function () { return 0; };
drawSteps.push({ attrToProjector: resetAttrToProjector, animator: this._getAnimator("symbols-reset") });
}
drawSteps.push({ attrToProjector: this._generateAttrToProjector(), animator: this._getAnimator("symbols") });
@@ -7310,7 +7267,7 @@ var Plottable;
var drawer = _this._key2PlotDatasetKey.get(key).drawer;
drawer._getRenderArea().selectAll("path").each(function (d, i) {
var distSq = getDistSq(d, i, dataset.metadata(), plotMetadata);
- var r = attrToProjector["r"](d, i, dataset.metadata(), plotMetadata);
+ var r = attrToProjector["size"](d, i, dataset.metadata(), plotMetadata) / 2;
if (distSq < r * r) {
if (!overAPoint || distSq < minDistSq) {
closestElement = this;
diff --git a/plottable.min.js b/plottable.min.js
index 8e6d55f687..100e051fd6 100644
--- a/plottable.min.js
+++ b/plottable.min.js
@@ -1,6 +1,6 @@
-var Plottable;!function(a){var b;!function(b){var c;!function(c){function d(a,b,c){return Math.min(b,c)<=a&&a<=Math.max(b,c)}function e(b){a.Config.SHOW_WARNINGS&&null!=window.console&&(null!=window.console.warn?console.warn(b):null!=window.console.log&&console.log(b))}function f(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 g(a,b){var c=d3.set();return a.forEach(function(a){b.has(a)&&c.add(a)}),c}function h(a){return"function"==typeof a?a:"string"==typeof a&&"#"!==a[0]?function(b){return b[a]}:function(){return a}}function i(a,b){var c=d3.set();return a.forEach(function(a){return c.add(a)}),b.forEach(function(a){return c.add(a)}),c}function j(a,b){var c=d3.map();return a.forEach(function(a,d){c.set(a,b(a,d))}),c}function k(a){var b=d3.set(),c=[];return a.forEach(function(a){b.has(a)||(b.add(a),c.push(a))}),c}function l(a,b){for(var c=[],d=0;b>d;d++)c[d]="function"==typeof a?a(d):a;return c}function m(a){return Array.prototype.concat.apply([],a)}function n(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;cf;++f)e[f]=a+c*f;return e}function t(a,b){for(var c=[],d=2;db?"0"+c:c});if(4===d.length&&"00"===d[3])return null;var e="#"+d.join("");return a.classed(b,!1),e}function v(a,b){var c=d3.hsl(a).brighter(b);return c.rgb().toString()}function w(a,c,d){var e=parseInt(a.substring(1,3),16),f=parseInt(a.substring(3,5),16),g=parseInt(a.substring(5,7),16),h=b.Color.rgbToHsl(e,f,g),i=Math.max(h[2]-d*c,0),j=b.Color.hslToRgb(h[0],h[1],i),k=j[0].toString(16),l=j[1].toString(16),m=j[2].toString(16);return k=k.length<2?"0"+k:k,l=l.length<2?"0"+l:l,m=m.length<2?"0"+m:m,"#"+k+l+m}function x(a,b){return Math.pow(b.y-a.y,2)+Math.pow(b.x-a.x,2)}function y(){var a=window.navigator.userAgent;return a.indexOf("MSIE ")>-1||a.indexOf("Trident/")>-1}c.inRange=d,c.warn=e,c.addArrays=f,c.intersection=g,c.accessorize=h,c.union=i,c.populateMap=j,c.uniq=k,c.createFilledArray=l,c.flatten=m,c.arrayEq=n,c.objEq=o,c.max=p,c.min=q,c.copyMap=r,c.range=s,c.setTimeout=t,c.colorTest=u,c.lightenColor=v,c.darkenColor=w,c.distanceSquared=x,c.isIE=y}(c=b.Methods||(b.Methods={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b;!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}(b=a.OpenSource||(a.OpenSource={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!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}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){this._keyValuePairs=[]}return a.prototype.set=function(a,b){if(a!==a)throw new Error("NaN may not be used as a key to the StrictEqualityAssociativeArray");for(var c=0;cb.right?!1:a.bottomb.bottom?!1:!0}function k(a,b){return Math.floor(b.left)<=Math.ceil(a.left)&&Math.floor(b.top)<=Math.ceil(a.top)&&Math.floor(a.right)<=Math.ceil(b.right)&&Math.floor(a.bottom)<=Math.ceil(b.bottom)}function l(a){var b=a.ownerSVGElement;return null!=b?b:"svg"===a.nodeName.toLowerCase()?a:null}a.getBBox=b,a.POLYFILL_TIMEOUT_MSEC=1e3/60,a.requestAnimationFramePolyfill=c,a.isSelectionRemovedFromSVG=e,a.getElementWidth=f,a.getElementHeight=g,a.getSVGPixelWidth=h,a.translate=i,a.boxesOverlap=j,a.boxIsInside=k,a.getBoundingSVG=l}(b=a.DOM||(a.DOM={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b;!function(a){function b(a){var b=d3.rgb(a),c=function(a){return a/=255,.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)},d=c(b.r),e=c(b.g),f=c(b.b);return.2126*d+.7152*e+.0722*f}function c(a,c){var d=b(a)+.05,e=b(c)+.05;return d>e?d/e:e/d}function d(a,b,c){a/=255,b/=255,c/=255;var d,e,f=Math.max(a,b,c),g=Math.min(a,b,c),h=(f+g)/2;if(f===g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return[d,e,h]}function e(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return[Math.round(255*e),Math.round(255*f),Math.round(255*g)]}a.contrast=c,a.rgbToHsl=d,a.hslToRgb=e}(b=a.Color||(a.Color={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){a.MILLISECONDS_IN_ONE_DAY=864e5;var b;!function(b){function c(a,c,d){void 0===a&&(a=2),void 0===c&&(c="$"),void 0===d&&(d=!0);var e=b.fixed(a);return function(a){var b=e(Math.abs(a));return""!==b&&(d?b=c+b:b+=c,0>a&&(b="-"+b)),b}}function d(a){return void 0===a&&(a=3),l(a),function(b){return b.toFixed(a)}}function e(a){return void 0===a&&(a=3),l(a),function(b){if("number"==typeof b){var c=Math.pow(10,a);return String(Math.round(b*c)/c)}return String(b)}}function f(){return function(a){return String(a)}}function g(a){void 0===a&&(a=0);var c=b.fixed(a);return function(a){var b=100*a,d=a.toString(),e=Math.pow(10,d.length-(d.indexOf(".")+1));return b=parseInt((b*e).toString(),10)/e,c(b)+"%"}}function h(a){return void 0===a&&(a=3),l(a),function(b){return d3.format("."+a+"s")(b)}}function i(){var a=8,b={};return b[0]={format:".%L",filter:function(a){return 0!==a.getMilliseconds()}},b[1]={format:":%S",filter:function(a){return 0!==a.getSeconds()}},b[2]={format:"%I:%M",filter:function(a){return 0!==a.getMinutes()}},b[3]={format:"%I %p",filter:function(a){return 0!==a.getHours()}},b[4]={format:"%a %d",filter:function(a){return 0!==a.getDay()&&1!==a.getDate()}},b[5]={format:"%b %d",filter:function(a){return 1!==a.getDate()}},b[6]={format:"%b",filter:function(a){return 0!==a.getMonth()}},b[7]={format:"%Y",filter:function(){return!0}},function(c){for(var d=0;a>d;d++)if(b[d].filter(c))return d3.time.format(b[d].format)(c)}}function j(a){return d3.time.format(a)}function k(b,c,d){return void 0===b&&(b=0),void 0===c&&(c=a.MILLISECONDS_IN_ONE_DAY),void 0===d&&(d=""),function(a){var e=Math.round((a.valueOf()-b)/c);return e.toString()+d}}function l(a){if(0>a||a>20)throw new RangeError("Formatter precision must be between 0 and 20")}b.currency=c,b.fixed=d,b.general=e,b.identity=f,b.percentage=g,b.siSuffix=h,b.multiTime=i,b.time=j,b.relativeDate=k}(b=a.Formatters||(a.Formatters={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){function b(b){function c(a){if(-1===d3.svg.symbolTypes.indexOf(a))throw new Error(a+" is an invalid D3 symbol type. d3.svg.symbolTypes can retrieve the valid symbol types.");return a}var d=function(b){var c;switch(b){case"circle":c=Math.PI;break;case"square":c=4;break;case"cross":c=20/9;break;case"diamond":c=2*Math.tan(Math.PI/6);break;case"triangle-up":case"triangle-down":c=Math.sqrt(3);break;default:c=1}return c*Math.pow(a.SYMBOL_GENERATOR_RADIUS,2)},e="string"==typeof b?d(c(b)):function(a,e){return d(c(b(a,e)))};return d3.svg.symbol().type(b).size(e)}a.SYMBOL_GENERATOR_RADIUS=50,a.d3Symbol=b}(b=a.SymbolGenerators||(a.SymbolGenerators={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function b(a){this._svg=a,this._measureRect=document.createElementNS(a.namespaceURI,"rect"),this._measureRect.setAttribute("class","measure-rect"),this._measureRect.setAttribute("style","opacity: 0; visibility: hidden;"),this._measureRect.setAttribute("width","1"),this._measureRect.setAttribute("height","1"),this._svg.appendChild(this._measureRect)}return b.getTranslator=function(c){var d=a.DOM.getBoundingSVG(c),e=d[b._TRANSLATOR_KEY];return null==e&&(e=new b(d),d[b._TRANSLATOR_KEY]=e),e},b.prototype.computePosition=function(a,b){this._measureRect.setAttribute("x","0"),this._measureRect.setAttribute("y","0");var c=this._measureRect.getBoundingClientRect(),d={x:c.left,y:c.top},e=100;this._measureRect.setAttribute("x",String(e)),this._measureRect.setAttribute("y",String(e)),c=this._measureRect.getBoundingClientRect();var f={x:c.left,y:c.top};if(d.x===f.x||d.y===f.y)return null;var g=(f.x-d.x)/e,h=(f.y-d.y)/e;this._measureRect.setAttribute("x",String((a-d.x)/g)),this._measureRect.setAttribute("y",String((b-d.y)/h)),c=this._measureRect.getBoundingClientRect();var i={x:c.left,y:c.top},j={x:(i.x-d.x)/g,y:(i.y-d.y)/h};return j},b._TRANSLATOR_KEY="__Plottable_ClientToSVGTranslator",b}();a.ClientToSVGTranslator=b}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){a.SHOW_WARNINGS=!0}(b=a.Config||(a.Config={}))}(Plottable||(Plottable={}));var Plottable;!function(a){a.version="0.50.0"}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){}return a.CORAL_RED="#fd373e",a.INDIGO="#5279c7",a.ROBINS_EGG_BLUE="#06cccc",a.FERN="#63c261",a.BURNING_ORANGE="#ff7939",a.ROYAL_HEATH="#962565",a.CONIFER="#99ce50",a.CERISE_RED="#db2e65",a.BRIGHT_SUN="#fad419",a.JACARTA="#2c2b6f",a.PLOTTABLE_COLORS=[a.INDIGO,a.CORAL_RED,a.FERN,a.BRIGHT_SUN,a.JACARTA,a.BURNING_ORANGE,a.CERISE_RED,a.CONIFER,a.ROYAL_HEATH,a.ROBINS_EGG_BLUE],a}();a.Colors=b}(b=a.Core||(a.Core={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){this._plottableID=a._nextID++}return a.prototype.getID=function(){return this._plottableID},a._nextID=0,a}();a.PlottableObject=b}(b=a.Core||(a.Core={}))}(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){var b;!function(b){var c=function(b){function c(c){b.call(this),this._key2callback=new a._Util.StrictEqualityAssociativeArray,this._listenable=c}return __extends(c,b),c.prototype.registerListener=function(a,b){return this._key2callback.set(a,b),this},c.prototype.broadcast=function(){for(var a=this,b=[],c=0;c0){var f=d.valueOf();return d instanceof Date?[f-b._ONE_DAY,f+b._ONE_DAY]:[f-b._PADDING_FOR_IDENTICAL_DOMAIN,f+b._PADDING_FOR_IDENTICAL_DOMAIN]}var g=a.domain();if(g[0].valueOf()===g[1].valueOf())return c;var h=this._padProportion/2,i=a.invert(a.scale(d)-(a.scale(e)-a.scale(d))*h),j=a.invert(a.scale(e)+(a.scale(e)-a.scale(d))*h),k=this._paddingExceptions.values().concat(this._unregisteredPaddingExceptions.values()),l=d3.set(k);return l.has(d)&&(i=d),l.has(e)&&(j=e),[i,j]},b.prototype._niceDomain=function(a,b){return this._doNice?a._niceDomain(b,this._niceCount):b},b.prototype._includeDomain=function(a){var b=this._includedValues.values().concat(this._unregisteredIncludedValues.values());return b.reduce(function(a,b){return[Math.min(a[0],b),Math.max(a[1],b)]},a)},b._PADDING_FOR_IDENTICAL_DOMAIN=1,b._ONE_DAY=864e5,b}();a.Domainer=b}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(b){var c=function(b){function c(c){b.call(this),this._autoDomainAutomatically=!0,this._rendererAttrID2Extent={},this._typeCoercer=function(a){return a},this._domainModificationInProgress=!1,this._d3Scale=c,this.broadcaster=new a.Core.Broadcaster(this)}return __extends(c,b),c.prototype._getAllExtents=function(){return d3.values(this._rendererAttrID2Extent)},c.prototype._getExtent=function(){return[]},c.prototype.autoDomain=function(){return this._autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},c.prototype._autoDomainIfAutomaticMode=function(){this._autoDomainAutomatically&&this.autoDomain()},c.prototype.scale=function(a){return this._d3Scale(a)},c.prototype.domain=function(a){return null==a?this._getDomain():(this._autoDomainAutomatically=!1,this._setDomain(a),this)},c.prototype._getDomain=function(){return this._d3Scale.domain()},c.prototype._setDomain=function(a){this._domainModificationInProgress||(this._domainModificationInProgress=!0,this._d3Scale.domain(a),this.broadcaster.broadcast(),this._domainModificationInProgress=!1)},c.prototype.range=function(a){return null==a?this._d3Scale.range():(this._d3Scale.range(a),this)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype._updateExtent=function(a,b,c){return this._rendererAttrID2Extent[a+b]=c,this._autoDomainIfAutomaticMode(),this},c.prototype._removeExtent=function(a,b){return delete this._rendererAttrID2Extent[a+b],this._autoDomainIfAutomaticMode(),this},c}(a.Core.PlottableObject);b.AbstractScale=c}(b=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){var b;!function(b){var c=function(b){function c(c){b.call(this,c),this._numTicks=10,this._PADDING_FOR_IDENTICAL_DOMAIN=1,this._userSetDomainer=!1,this._domainer=new a.Domainer,this._typeCoercer=function(a){return+a},this._tickGenerator=function(a){return a.getDefaultTicks()}}return __extends(c,b),c.prototype._getExtent=function(){return this._domainer.computeDomain(this._getAllExtents(),this)},c.prototype.invert=function(a){return this._d3Scale.invert(a)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype._setDomain=function(c){var d=function(a){return a!==a||1/0===a||a===-1/0};return d(c[0])||d(c[1])?void a._Util.Methods.warn("Warning: QuantitativeScales cannot take NaN or Infinity as a domain value. Ignoring."):void b.prototype._setDomain.call(this,c)},c.prototype.interpolate=function(a){return null==a?this._d3Scale.interpolate():(this._d3Scale.interpolate(a),this)},c.prototype.rangeRound=function(a){return this._d3Scale.rangeRound(a),this},c.prototype.getDefaultTicks=function(){return this._d3Scale.ticks(this.numTicks())},c.prototype.clamp=function(a){return null==a?this._d3Scale.clamp():(this._d3Scale.clamp(a),this)},c.prototype.ticks=function(){return this._tickGenerator(this)},c.prototype.numTicks=function(a){return null==a?this._numTicks:(this._numTicks=a,this)},c.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},c.prototype.domainer=function(a){return null==a?this._domainer:(this._domainer=a,this._userSetDomainer=!0,this._autoDomainIfAutomaticMode(),this)},c.prototype._defaultExtent=function(){return[0,1]},c.prototype.tickGenerator=function(a){return null==a?this._tickGenerator:(this._tickGenerator=a,this)},c}(b.AbstractScale);b.AbstractQuantitative=c}(b=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){var b;!function(a){var b=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.AbstractQuantitative);a.Linear=b}(b=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){var b;!function(b){var c=function(b){function c(d){b.call(this,null==d?d3.scale.log():d),c.warned||(c.warned=!0,a._Util.Methods.warn("Plottable.Scale.Log is deprecated. If possible, use Plottable.Scale.ModifiedLog instead."))}return __extends(c,b),c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype._defaultExtent=function(){return[1,10]},c.warned=!1,c}(b.AbstractQuantitative);b.Log=c}(b=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){var b;!function(b){var c=function(b){function c(a){if(void 0===a&&(a=10),b.call(this,d3.scale.linear()),this._showIntermediateTicks=!1,this.base=a,this.pivot=this.base,this.untransformedDomain=this._defaultExtent(),this.numTicks(10),1>=a)throw new Error("ModifiedLogScale: The base must be > 1")}return __extends(c,b),c.prototype.adjustedLog=function(a){var b=0>a?-1:1;return a*=b,aa?-1:1;return a*=b,a=Math.pow(this.base,a),a=d&&e>=a}),m=j.concat(l).concat(k);return m.length<=1&&(m=d3.scale.linear().domain([d,e]).ticks(b)),m},c.prototype.logTicks=function(b,c){var d=this,e=this.howManyTicks(b,c);if(0===e)return[];var f=Math.floor(Math.log(b)/Math.log(this.base)),g=Math.ceil(Math.log(c)/Math.log(this.base)),h=d3.range(g,f,-Math.ceil((g-f)/e)),i=this._showIntermediateTicks?Math.floor(e/h.length):1,j=d3.range(this.base,1,-(this.base-1)/i).map(Math.floor),k=a._Util.Methods.uniq(j),l=h.map(function(a){return k.map(function(b){return Math.pow(d.base,a-1)*b})}),m=a._Util.Methods.flatten(l),n=m.filter(function(a){return a>=b&&c>=a}),o=n.sort(function(a,b){return a-b});return o},c.prototype.howManyTicks=function(b,c){var d=this.adjustedLog(a._Util.Methods.min(this.untransformedDomain,0)),e=this.adjustedLog(a._Util.Methods.max(this.untransformedDomain,0)),f=this.adjustedLog(b),g=this.adjustedLog(c),h=(g-f)/(e-d),i=Math.ceil(h*this.numTicks());return i},c.prototype.copy=function(){return new c(this.base)},c.prototype._niceDomain=function(a){return a},c.prototype.showIntermediateTicks=function(a){return null==a?this._showIntermediateTicks:void(this._showIntermediateTicks=a)},c}(b.AbstractQuantitative);b.ModifiedLog=c}(b=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){var b;!function(b){var c=function(b){function c(a){void 0===a&&(a=d3.scale.ordinal()),b.call(this,a),this._range=[0,1],this._typeCoercer=function(a){return null!=a&&a.toString?a.toString():a};var d=.3;this._innerPadding=c._convertToPlottableInnerPadding(d),this._outerPadding=c._convertToPlottableOuterPadding(.5,d)}return __extends(c,b),c.prototype._getExtent=function(){var b=this._getAllExtents();return a._Util.Methods.uniq(a._Util.Methods.flatten(b))},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype._setDomain=function(a){b.prototype._setDomain.call(this,a),this.range(this.range())},c.prototype.range=function(a){if(null==a)return this._range;this._range=a;var b=1-1/(1+this.innerPadding()),c=this.outerPadding()/(1+this.innerPadding());return this._d3Scale.rangeBands(a,b,c),this},c._convertToPlottableInnerPadding=function(a){return 1/(1-a)-1},c._convertToPlottableOuterPadding=function(a,b){return a/(1-b)},c.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},c.prototype.stepWidth=function(){return this.rangeBand()*(1+this.innerPadding())},c.prototype.innerPadding=function(a){return null==a?this._innerPadding:(this._innerPadding=a,this.range(this.range()),this.broadcaster.broadcast(),this)},c.prototype.outerPadding=function(a){return null==a?this._outerPadding:(this._outerPadding=a,this.range(this.range()),this.broadcaster.broadcast(),this)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.scale=function(a){return b.prototype.scale.call(this,a)+this.rangeBand()/2},c}(b.AbstractScale);b.Category=c}(b=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){var b;!function(b){var c=function(b){function c(a){var d;switch(a){case null:case void 0:d=d3.scale.ordinal().range(c._getPlottableColors());break;case"Category10":case"category10":case"10":d=d3.scale.category10();break;case"Category20":case"category20":case"20":d=d3.scale.category20();break;case"Category20b":case"category20b":case"20b":d=d3.scale.category20b();break;case"Category20c":case"category20c":case"20c":d=d3.scale.category20c();break;default:throw new Error("Unsupported ColorScale type")}b.call(this,d)}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._getPlottableColors=function(){for(var b,c=[],d=d3.select("body").append("div"),e=0;null!==(b=a._Util.Methods.colorTest(d,"plottable-colors-"+e));)c.push(b),e++;return d.remove(),c},c.prototype.scale=function(d){var e=b.prototype.scale.call(this,d),f=this.domain().indexOf(d),g=Math.floor(f/this.range().length),h=Math.log(g*c.LOOP_LIGHTEN_FACTOR+1);return a._Util.Methods.lightenColor(e,h)},c.HEX_SCALE_FACTOR=20,c.LOOP_LIGHTEN_FACTOR=1.6,c}(b.AbstractScale);b.Color=c}(b=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){var b;!function(b){var c=function(b){function c(a){b.call(this,null==a?d3.time.scale():a),this._typeCoercer=function(a){return a&&a._isAMomentObject||a instanceof Date?a:new Date(a)}}return __extends(c,b),c.prototype.tickInterval=function(a,b){var c=d3.time.scale();return c.domain(this.domain()),c.range(this.range()),c.ticks(a.range,b)},c.prototype._setDomain=function(a){if(a=a.map(this._typeCoercer),a[1]0&&this._setDomain([a._Util.Methods.min(b,function(a){return a[0]},0),a._Util.Methods.max(b,function(a){return a[1]},0)]),this},c._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"]},c}(b.AbstractScale);b.InterpolatedColor=c}(b=a.Scale||(a.Scale={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(a){var b=this;if(this._rescaleInProgress=!1,null==a)throw new Error("ScaleDomainCoordinator requires scales to coordinate");this._scales=a,this._scales.forEach(function(a){return a.broadcaster.registerListener(b,function(a){return b.rescale(a)})})}return a.prototype.rescale=function(a){if(!this._rescaleInProgress){this._rescaleInProgress=!0;var b=a.domain();this._scales.forEach(function(a){return a.domain(b)}),this._rescaleInProgress=!1}},a}();a.ScaleDomainCoordinator=b}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(b){var c;!function(b){function c(b){if(0>=b)throw new Error("interval must be positive number");return function(c){var d=c.domain(),e=Math.min(d[0],d[1]),f=Math.max(d[0],d[1]),g=Math.ceil(e/b)*b,h=Math.floor((f-g)/b)+1,i=e%b===0?[]:[e],j=a._Util.Methods.range(0,h).map(function(a){return g+a*b}),k=f%b===0?[]:[f];return i.concat(j).concat(k)}}function d(){return function(a){var b=a.getDefaultTicks();return b.filter(function(a,c){return a%1===0||0===c||c===b.length-1})}}b.intervalTickGenerator=c,b.integerTickGenerator=d}(c=b.TickGenerators||(b.TickGenerators={}))}(b=a.Scale||(a.Scale={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(b){var c=function(){function b(a){this.key=a}return b.prototype.setClass=function(a){return this._className=a,this},b.prototype.setup=function(a){this._renderArea=a},b.prototype.remove=function(){null!=this._getRenderArea()&&this._getRenderArea().remove()},b.prototype._enterData=function(){},b.prototype._drawStep=function(){},b.prototype._numberOfAnimationIterations=function(a){return a.length},b.prototype._applyMetadata=function(a,b,c){var d={};return d3.keys(a).forEach(function(e){d[e]=function(d,f){return a[e](d,f,b,c)}}),d},b.prototype._prepareDrawSteps=function(){},b.prototype._prepareData=function(a){return a},b.prototype.draw=function(b,c,d,e){var f=this,g=c.map(function(b){var c=f._applyMetadata(b.attrToProjector,d,e);return f._attrToProjector=a._Util.Methods.copyMap(c),{attrToProjector:c,animator:b.animator}}),h=this._prepareData(b,g);this._prepareDrawSteps(g),this._enterData(h);var i=this._numberOfAnimationIterations(h),j=0;return g.forEach(function(b){a._Util.Methods.setTimeout(function(){return f._drawStep(b)},j),j+=b.animator.getTiming(i)}),j},b.prototype._getRenderArea=function(){return this._renderArea},b.prototype._getSelector=function(){return""},b.prototype._getPixelPoint=function(){return null},b.prototype._getSelection=function(a){var b=this._getRenderArea().selectAll(this._getSelector());return d3.select(b[0][a])},b}();b.AbstractDrawer=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments)}return __extends(c,b),c.prototype._enterData=function(a){b.prototype._enterData.call(this,a),this._pathSelection.datum(a)},c.prototype.setup=function(a){this._pathSelection=a.append("path").classed(c.LINE_CLASS,!0).style({fill:"none","vector-effect":"non-scaling-stroke"}),b.prototype.setup.call(this,a)},c.prototype._createLine=function(a,b,c){return c||(c=function(){return!0}),d3.svg.line().x(a).y(b).defined(c)},c.prototype._numberOfAnimationIterations=function(){return 1},c.prototype._drawStep=function(d){var e=(b.prototype._drawStep.call(this,d),a._Util.Methods.copyMap(d.attrToProjector)),f=e.defined,g=e.x,h=e.y;delete e.x,delete e.y,e.defined&&delete e.defined,e.d=this._createLine(g,h,f),e.fill&&this._pathSelection.attr("fill",e.fill),e["class"]&&(this._pathSelection.attr("class",e["class"]),this._pathSelection.classed(c.LINE_CLASS,!0),delete e["class"]),d.animator.animate(this._pathSelection,e)},c.prototype._getSelector=function(){return"."+c.LINE_CLASS},c.prototype._getPixelPoint=function(a,b){return{x:this._attrToProjector.x(a,b),y:this._attrToProjector.y(a,b)}},c.prototype._getSelection=function(){return this._getRenderArea().select(this._getSelector())},c.LINE_CLASS="line",c}(b.AbstractDrawer);b.Line=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(c){function d(){c.apply(this,arguments),this._drawLine=!0}return __extends(d,c),d.prototype._enterData=function(a){this._drawLine?c.prototype._enterData.call(this,a):b.AbstractDrawer.prototype._enterData.call(this,a),this._areaSelection.datum(a)},d.prototype.drawLine=function(a){return this._drawLine=a,this},d.prototype.setup=function(a){this._areaSelection=a.append("path").classed(d.AREA_CLASS,!0).style({stroke:"none"}),this._drawLine?c.prototype.setup.call(this,a):b.AbstractDrawer.prototype.setup.call(this,a)},d.prototype._createArea=function(a,b,c,d){return d||(d=function(){return!0}),d3.svg.area().x(a).y0(b).y1(c).defined(d)},d.prototype._drawStep=function(e){this._drawLine?c.prototype._drawStep.call(this,e):b.AbstractDrawer.prototype._drawStep.call(this,e);var f=a._Util.Methods.copyMap(e.attrToProjector),g=f.x,h=f.y0,i=f.y,j=f.defined;delete f.x,delete f.y0,delete f.y,f.defined&&delete f.defined,f.d=this._createArea(g,h,i,j),f.fill&&this._areaSelection.attr("fill",f.fill),f["class"]&&(this._areaSelection.attr("class",f["class"]),this._areaSelection.classed(d.AREA_CLASS,!0),delete f["class"]),e.animator.animate(this._areaSelection,f)},d.prototype._getSelector=function(){return"path"},d.AREA_CLASS="area",d}(b.Line);b.Area=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype.svgElement=function(a){return this._svgElement=a,this},b.prototype._getDrawSelection=function(){return this._getRenderArea().selectAll(this._svgElement)},b.prototype._drawStep=function(b){a.prototype._drawStep.call(this,b);var c=this._getDrawSelection();b.attrToProjector.fill&&c.attr("fill",b.attrToProjector.fill),b.animator.animate(c,b.attrToProjector)},b.prototype._enterData=function(b){a.prototype._enterData.call(this,b);var c=this._getDrawSelection().data(b);c.enter().append(this._svgElement),null!=this._className&&c.classed(this._className,!0),c.exit().remove()},b.prototype._filterDefinedData=function(a,b){return b?a.filter(b):a},b.prototype._prepareDrawSteps=function(b){a.prototype._prepareDrawSteps.call(this,b),b.forEach(function(a){a.attrToProjector.defined&&delete a.attrToProjector.defined})},b.prototype._prepareData=function(b,c){var d=this;return c.reduce(function(a,b){return d._filterDefinedData(a,b.attrToProjector.defined)},a.prototype._prepareData.call(this,b,c))},b.prototype._getSelector=function(){return this._svgElement},b}(a.AbstractDrawer);a.Element=b}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=5,d=5,e=function(b){function e(a,c){b.call(this,a),this._labelsTooWide=!1,this.svgElement("rect"),this._isVertical=c}return __extends(e,b),e.prototype.setup=function(a){b.prototype.setup.call(this,a.append("g").classed("bar-area",!0)),this._textArea=a.append("g").classed("bar-label-text-area",!0),this._measurer=new SVGTypewriter.Measurers.CacheCharacterMeasurer(this._textArea),this._writer=new SVGTypewriter.Writers.Writer(this._measurer)},e.prototype.removeLabels=function(){this._textArea.selectAll("g").remove()},e.prototype._getIfLabelsTooWide=function(){return this._labelsTooWide},e.prototype.drawText=function(b,e,f,g){var h=this,i=b.map(function(b,i){var j=e.label(b,i,f,g).toString(),k=e.width(b,i,f,g),l=e.height(b,i,f,g),m=e.x(b,i,f,g),n=e.y(b,i,f,g),o=e.positive(b,i,f,g),p=h._measurer.measure(j),q=e.fill(b,i,f,g),r=1.6*a._Util.Color.contrast("white",q)v;if(p.height<=l&&p.width<=k){var x=Math.min((s-t)/2,c);o||(x=-1*x),h._isVertical?n+=x:m+=x;var y=h._textArea.append("g").attr("transform","translate("+m+","+n+")"),z=r?"dark-label":"light-label";y.classed(z,!0);var A,B;h._isVertical?(A="center",B=o?"top":"bottom"):(A=o?"left":"right",B="center");var C={selection:y,xAlign:A,yAlign:B,textRotation:0};h._writer.write(j,k,l,C)}return w});this._labelsTooWide=i.some(function(a){return a})},e.prototype._getPixelPoint=function(a,b){var c=this._attrToProjector.x(a,b),d=this._attrToProjector.y(a,b),e=this._attrToProjector.width(a,b),f=this._attrToProjector.height(a,b),g=this._isVertical?c+e/2:c+e,h=this._isVertical?d:d+f/2;return{x:g,y:h}},e}(b.Element);b.Rect=e}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(a){b.call(this,a),this._svgElement="path"}return __extends(c,b),c.prototype._createArc=function(a,b){return d3.svg.arc().innerRadius(a).outerRadius(b)},c.prototype.retargetProjectors=function(a){var b={};return d3.entries(a).forEach(function(a){b[a.key]=function(b,c){return a.value(b.data,c)}}),b},c.prototype._drawStep=function(c){var d=a._Util.Methods.copyMap(c.attrToProjector);d=this.retargetProjectors(d),this._attrToProjector=this.retargetProjectors(this._attrToProjector);var e=d["inner-radius"],f=d["outer-radius"];return delete d["inner-radius"],delete d["outer-radius"],d.d=this._createArc(e,f),b.prototype._drawStep.call(this,{attrToProjector:d,animator:c.animator})},c.prototype.draw=function(c,d,e,f){var g=function(a,b){return d[0].attrToProjector.value(a,b,e,f)},h=d3.layout.pie().sort(null).value(g)(c);return d.forEach(function(a){return delete a.attrToProjector.value}),h.forEach(function(b){b.value<0&&a._Util.Methods.warn("Negative values will not render correctly in a pie chart.")}),b.prototype.draw.call(this,h,d,e,f)},c.prototype._getPixelPoint=function(a,b){var c=this._attrToProjector["inner-radius"],d=this._attrToProjector["outer-radius"],e=(c(a,b)+d(a,b))/2,f=+this._getSelection(b).datum().startAngle,g=+this._getSelection(b).datum().endAngle,h=(f+g)/2;return{x:e*Math.sin(h),y:-e*Math.cos(h)}},c}(b.Element);b.Arc=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(a){b.call(this,a),this._svgElement="path",this._className="symbol"}return __extends(c,b),c.prototype._drawStep=function(c){var d=c.attrToProjector;this._attrToProjector=a._Util.Methods.copyMap(c.attrToProjector);var e=d.x,f=d.y;delete d.x,delete d.y;var g=d.r;delete d.r,d.transform=function(a,b){return"translate("+e(a,b)+","+f(a,b)+") scale("+g(a,b)/50+")"};var h=d.symbol;delete d.symbol,d.d=h,b.prototype._drawStep.call(this,c)},c.prototype._getPixelPoint=function(a,b){return{x:this._attrToProjector.x(a,b),y:this._attrToProjector.y(a,b)}},c}(b.Element);b.Symbol=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this.clipPathEnabled=!1,this._xAlignProportion=0,this._yAlignProportion=0,this._fixedHeightFlag=!1,this._fixedWidthFlag=!1,this._isSetup=!1,this._isAnchored=!1,this._interactionsToRegister=[],this._boxes=[],this._isTopLevelComponent=!1,this._xOffset=0,this._yOffset=0,this._cssClasses=["component"],this._removed=!1,this._usedLastLayout=!1}return __extends(c,b),c.prototype._anchor=function(a){if(this._removed)throw new Error("Can't reuse remove()-ed components!");"svg"===a.node().nodeName.toLowerCase()&&(this._rootSVG=a,this._rootSVG.classed("plottable",!0),this._rootSVG.style("overflow","visible"),this._isTopLevelComponent=!0),null!=this._element?a.node().appendChild(this._element.node()):(this._element=a.append("g"),this._setup()),this._isAnchored=!0},c.prototype._setup=function(){var a=this;this._isSetup||(this._cssClasses.forEach(function(b){a._element.classed(b,!0)}),this._cssClasses=null,this._backgroundContainer=this._element.append("g").classed("background-container",!0),this._addBox("background-fill",this._backgroundContainer),this._content=this._element.append("g").classed("content",!0),this._foregroundContainer=this._element.append("g").classed("foreground-container",!0),this._boxContainer=this._element.append("g").classed("box-container",!0),this.clipPathEnabled&&this._generateClipPath(),this._boundingBox=this._addBox("bounding-box"),this._interactionsToRegister.forEach(function(b){return a.registerInteraction(b)}),this._interactionsToRegister=null,this._isSetup=!0)},c.prototype._requestedSpace=function(){return{width:0,height:0,wantsWidth:!1,wantsHeight:!1}},c.prototype._computeLayout=function(b,c,d,e){var f=this;if(null==b||null==c||null==d||null==e){if(null==this._element)throw new Error("anchor must be called before computeLayout");if(!this._isTopLevelComponent)throw new Error("null arguments cannot be passed to _computeLayout() on a non-root node");b=0,c=0,null==this._rootSVG.attr("width")&&this._rootSVG.attr("width","100%"),null==this._rootSVG.attr("height")&&this._rootSVG.attr("height","100%");var g=this._rootSVG.node();d=a._Util.DOM.getElementWidth(g),e=a._Util.DOM.getElementHeight(g)}var h=this._requestedSpace(d,e);this._width=this._isFixedWidth()?Math.min(d,h.width):d,this._height=this._isFixedHeight()?Math.min(e,h.height):e,this._xOrigin=b+this._xOffset+(d-this.width())*this._xAlignProportion,this._yOrigin=c+this._yOffset+(e-this.height())*this._yAlignProportion,this._element.attr("transform","translate("+this._xOrigin+","+this._yOrigin+")"),this._boxes.forEach(function(a){return a.attr("width",f.width()).attr("height",f.height())})},c.prototype._render=function(){this._isAnchored&&this._isSetup&&this.width()>=0&&this.height()>=0&&a.Core.RenderController.registerToRender(this)},c.prototype._scheduleComputeLayout=function(){this._isAnchored&&this._isSetup&&a.Core.RenderController.registerToComputeLayout(this)},c.prototype._doRender=function(){},c.prototype._useLastCalculatedLayout=function(a){return null==a?this._usedLastLayout:(this._usedLastLayout=a,this)},c.prototype._invalidateLayout=function(){this._useLastCalculatedLayout(!1),this._isAnchored&&this._isSetup&&(this._isTopLevelComponent?this._scheduleComputeLayout():this._parent._invalidateLayout())},c.prototype.renderTo=function(b){if(null!=b){var c;if(c="string"==typeof b?d3.select(b):b,!c.node()||"svg"!==c.node().nodeName.toLowerCase())throw new Error("Plottable requires a valid SVG to renderTo");this._anchor(c)}if(null==this._element)throw new Error("If a component has never been rendered before, then renderTo must be given a node to render to, or a D3.Selection, or a selector string");return this._computeLayout(),this._render(),a.Core.RenderController.flush(),this},c.prototype.redraw=function(){return this._invalidateLayout(),this},c.prototype.xAlign=function(a){if(a=a.toLowerCase(),"left"===a)this._xAlignProportion=0;else if("center"===a)this._xAlignProportion=.5;else{if("right"!==a)throw new Error("Unsupported alignment");this._xAlignProportion=1}return this._invalidateLayout(),this},c.prototype.yAlign=function(a){if(a=a.toLowerCase(),"top"===a)this._yAlignProportion=0;else if("center"===a)this._yAlignProportion=.5;else{if("bottom"!==a)throw new Error("Unsupported alignment");this._yAlignProportion=1}return this._invalidateLayout(),this},c.prototype.xOffset=function(a){return this._xOffset=a,this._invalidateLayout(),this},c.prototype.yOffset=function(a){return this._yOffset=a,this._invalidateLayout(),this},c.prototype._addBox=function(a,b){if(null==this._element)throw new Error("Adding boxes before anchoring is currently disallowed");b=null==b?this._boxContainer:b;var c=b.append("rect");return null!=a&&c.classed(a,!0),this._boxes.push(c),null!=this.width()&&null!=this.height()&&c.attr("width",this.width()).attr("height",this.height()),c},c.prototype._generateClipPath=function(){var a=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;a=a.split("#")[0],this._element.attr("clip-path",'url("'+a+"#clipPath"+this.getID()+'")');var b=this._boxContainer.append("clipPath").attr("id","clipPath"+this.getID());this._addBox("clip-rect",b)},c.prototype.registerInteraction=function(a){return this._element?(!this._hitBox&&a._requiresHitbox()&&(this._hitBox=this._addBox("hit-box"),this._hitBox.style("fill","#ffffff").style("opacity",0)),a._anchor(this,this._hitBox)):this._interactionsToRegister.push(a),this},c.prototype.classed=function(a,b){if(null==b)return null==a?!1:null==this._element?-1!==this._cssClasses.indexOf(a):this._element.classed(a);if(null==a)return this;if(null==this._element){var c=this._cssClasses.indexOf(a);b&&-1===c?this._cssClasses.push(a):b||-1===c||this._cssClasses.splice(c,1)}else this._element.classed(a,b);return this},c.prototype._isFixedWidth=function(){return this._fixedWidthFlag},c.prototype._isFixedHeight=function(){return this._fixedHeightFlag},c.prototype._merge=function(b,c){var d;if(this._isSetup||this._isAnchored)throw new Error("Can't presently merge a component that's already been anchored");if(a.Component.Group.prototype.isPrototypeOf(b))return d=b,d._addComponent(this,c),d;var e=c?[this,b]:[b,this];return d=new a.Component.Group(e)},c.prototype.above=function(a){return this._merge(a,!1)},c.prototype.below=function(a){return this._merge(a,!0)},c.prototype.detach=function(){return this._isAnchored&&this._element.remove(),null!=this._parent&&this._parent._removeComponent(this),this._isAnchored=!1,this._parent=null,this},c.prototype.remove=function(){this._removed=!0,this.detach()},c.prototype.width=function(){return this._width},c.prototype.height=function(){return this._height},c.prototype.origin=function(){return{x:this._xOrigin,y:this._yOrigin}},c.prototype.originToSVG=function(){for(var a=this.origin(),b=this._parent;null!=b;){var c=b.origin();a.x+=c.x,a.y+=c.y,b=b._parent}return a},c.prototype.foreground=function(){return this._foregroundContainer},c.prototype.content=function(){return this._content},c.prototype.background=function(){return this._backgroundContainer},c.prototype.hitBox=function(){return this._hitBox},c}(a.Core.PlottableObject);b.AbstractComponent=c}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments),this._components=[]}return __extends(b,a),b.prototype._anchor=function(b){var c=this;a.prototype._anchor.call(this,b),this.components().forEach(function(a){return a._anchor(c._content)})},b.prototype._render=function(){this._components.forEach(function(a){return a._render()})},b.prototype._removeComponent=function(a){var b=this._components.indexOf(a);b>=0&&(this.components().splice(b,1),this._invalidateLayout())},b.prototype._addComponent=function(a,b){return void 0===b&&(b=!1),!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},b.prototype.empty=function(){return 0===this._components.length},b.prototype.detachAll=function(){return this.components().slice().forEach(function(a){return a.detach()}),this},b.prototype.remove=function(){a.prototype.remove.call(this),this.components().slice().forEach(function(a){return a.remove()})},b.prototype._useLastCalculatedLayout=function(b){return null!=b&&this.components().slice().forEach(function(a){return a._useLastCalculatedLayout(b)}),a.prototype._useLastCalculatedLayout.call(this,b)},b}(a.AbstractComponent);a.AbstractComponentContainer=b}(b=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){var b;!function(b){var c=function(b){function c(a){var c=this;void 0===a&&(a=[]),b.call(this),this.classed("component-group",!0),a.forEach(function(a){return c._addComponent(a)})}return __extends(c,b),c.prototype._requestedSpace=function(b,c){var d=this.components().map(function(a){return a._requestedSpace(b,c)});return{width:a._Util.Methods.max(d,function(a){return a.width},0),height:a._Util.Methods.max(d,function(a){return a.height},0),wantsWidth:d.map(function(a){return a.wantsWidth}).some(function(a){return a}),wantsHeight:d.map(function(a){return a.wantsHeight}).some(function(a){return a})}},c.prototype._merge=function(a,b){return this._addComponent(a,!b),this},c.prototype._computeLayout=function(a,c,d,e){var f=this;return b.prototype._computeLayout.call(this,a,c,d,e),this.components().forEach(function(a){a._computeLayout(0,0,f.width(),f.height())}),this},c.prototype._isFixedWidth=function(){return!1},c.prototype._isFixedHeight=function(){return!1},c}(b.AbstractComponentContainer);b.Group=c}(b=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){var b;!function(b){var c=function(b){function c(c,d,e){var f=this;if(void 0===e&&(e=a.Formatters.identity()),b.call(this),this._endTickLength=5,this._tickLength=5,this._tickLabelPadding=10,this._gutter=15,this._showEndTickLabels=!1,null==c||null==d)throw new Error("Axis requires a scale and orientation");this._scale=c,this.orient(d),this._setDefaultAlignment(),this.classed("axis",!0),this._isHorizontal()?this.classed("x-axis",!0):this.classed("y-axis",!0),this.formatter(e),this._scale.broadcaster.registerListener(this,function(){return f._rescale()})}return __extends(c,b),c.prototype.remove=function(){b.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},c.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},c.prototype._computeWidth=function(){return this._computedWidth=this._maxLabelTickLength(),this._computedWidth},c.prototype._computeHeight=function(){return this._computedHeight=this._maxLabelTickLength(),this._computedHeight},c.prototype._requestedSpace=function(a,b){var c=0,d=0;return this._isHorizontal()?(null==this._computedHeight&&this._computeHeight(),d=this._computedHeight+this._gutter):(null==this._computedWidth&&this._computeWidth(),c=this._computedWidth+this._gutter),{width:c,height:d,wantsWidth:!this._isHorizontal()&&c>a,wantsHeight:this._isHorizontal()&&d>b}},c.prototype._isFixedHeight=function(){return this._isHorizontal()},c.prototype._isFixedWidth=function(){return!this._isHorizontal()},c.prototype._rescale=function(){this._render()},c.prototype._computeLayout=function(a,c,d,e){b.prototype._computeLayout.call(this,a,c,d,e),this._scale.range(this._isHorizontal()?[0,this.width()]:[this.height(),0])},c.prototype._setup=function(){b.prototype._setup.call(this),this._tickMarkContainer=this._content.append("g").classed(c.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this._content.append("g").classed(c.TICK_LABEL_CLASS+"-container",!0),this._baseline=this._content.append("line").classed("baseline",!0)},c.prototype._getTickValues=function(){return[]},c.prototype._doRender=function(){var a=this._getTickValues(),b=this._tickMarkContainer.selectAll("."+c.TICK_MARK_CLASS).data(a);b.enter().append("line").classed(c.TICK_MARK_CLASS,!0),b.attr(this._generateTickMarkAttrHash()),d3.select(b[0][0]).classed(c.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),d3.select(b[0][a.length-1]).classed(c.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),b.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash())},c.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.width();break;case"top":a.x2=this.width(),a.y1=this.height(),a.y2=this.height();break;case"left":a.x1=this.width(),a.x2=this.width(),a.y2=this.height();break;case"right":a.y2=this.height()}return a},c.prototype._generateTickMarkAttrHash=function(a){var b=this;void 0===a&&(a=!1);var c={x1:0,y1:0,x2:0,y2:0},d=function(a){return b._scale.scale(a)};this._isHorizontal()?(c.x1=d,c.x2=d):(c.y1=d,c.y2=d);var e=a?this._endTickLength:this._tickLength;switch(this._orientation){case"bottom":c.y2=e;break;case"top":c.y1=this.height(),c.y2=this.height()-e;break;case"left":c.x1=this.width(),c.x2=this.width()-e;break;case"right":c.x2=e}return c},c.prototype._invalidateLayout=function(){this._computedWidth=null,this._computedHeight=null,b.prototype._invalidateLayout.call(this)},c.prototype._setDefaultAlignment=function(){switch(this._orientation){case"bottom":this.yAlign("top");break;case"top":this.yAlign("bottom");break;case"left":this.xAlign("right");break;case"right":this.xAlign("left")}},c.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this._invalidateLayout(),this)},c.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},c.prototype.endTickLength=function(a){if(null==a)return this._endTickLength;if(0>a)throw new Error("end tick length must be positive");return this._endTickLength=a,this._invalidateLayout(),this},c.prototype._maxLabelTickLength=function(){return this.showEndTickLabels()?Math.max(this.tickLength(),this.endTickLength()):this.tickLength()},c.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},c.prototype.gutter=function(a){if(null==a)return this._gutter;if(0>a)throw new Error("gutter size must be positive");return this._gutter=a,this._invalidateLayout(),this},c.prototype.orient=function(a){if(null==a)return this._orientation;var b=a.toLowerCase();if("top"!==b&&"bottom"!==b&&"left"!==b&&"right"!==b)throw new Error("unsupported orientation");return this._orientation=b,this._invalidateLayout(),this},c.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this._render(),this)},c.prototype._hideEndTickLabels=function(){var b=this._boundingBox.node().getBoundingClientRect(),d=this._tickLabelContainer.selectAll("."+c.TICK_LABEL_CLASS);if(0!==d[0].length){var e=d[0][0];a._Util.DOM.boxIsInside(e.getBoundingClientRect(),b)||d3.select(e).style("visibility","hidden");var f=d[0][d[0].length-1];a._Util.DOM.boxIsInside(f.getBoundingClientRect(),b)||d3.select(f).style("visibility","hidden")}},c.prototype._hideOverflowingTickLabels=function(){var b=this._boundingBox.node().getBoundingClientRect(),d=this._tickLabelContainer.selectAll("."+c.TICK_LABEL_CLASS);d.empty()||d.each(function(){a._Util.DOM.boxIsInside(this.getBoundingClientRect(),b)||d3.select(this).style("visibility","hidden")})},c.prototype._hideOverlappingTickLabels=function(){for(var a=this._tickLabelContainer.selectAll("."+c.TICK_LABEL_CLASS).filter(function(){var a=d3.select(this).style("visibility");return"inherit"===a||"visible"===a}),b=a[0].map(function(a){return a.getBoundingClientRect()}),d=1;!this._hasOverlapWithInterval(d,b)&&d=e.left)return!1}else if(d.top-this._tickLabelPadding<=e.bottom)return!1}return!0},c.END_TICK_MARK_CLASS="end-tick-mark",c.TICK_MARK_CLASS="tick-mark",c.TICK_LABEL_CLASS="tick-label",c}(a.Component.AbstractComponent);b.AbstractAxis=c}(b=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){var b;!function(b){var c=function(c){function d(b,d){c.call(this,b,d),this._possibleTimeAxisConfigurations=[[{interval:d3.time.second,step:1,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:5,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:10,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:15,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:30,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:1,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:5,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:10,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:15,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:30,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:1,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:3,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:6,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:12,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.day,step:1,formatter:a.Formatters.time("%a %e")},{interval:d3.time.month,step:1,formatter:a.Formatters.time("%B %Y")}],[{interval:d3.time.day,step:1,formatter:a.Formatters.time("%e")},{interval:d3.time.month,step:1,formatter:a.Formatters.time("%B %Y")}],[{interval:d3.time.month,step:1,formatter:a.Formatters.time("%B")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.month,step:1,formatter:a.Formatters.time("%b")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.month,step:3,formatter:a.Formatters.time("%b")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.month,step:6,formatter:a.Formatters.time("%b")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:1,formatter:a.Formatters.time("%y")}],[{interval:d3.time.year,step:5,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:25,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:50,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:100,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:200,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:500,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:1e3,formatter:a.Formatters.time("%Y")}]],this.classed("time-axis",!0),this.tickLabelPadding(5),this.tierLabelPositions(["between","between"])
-}return __extends(d,c),d.prototype.tierLabelPositions=function(a){if(null==a)return this._tierLabelPositions;if(!a.every(function(a){return"between"===a.toLowerCase()||"center"===a.toLowerCase()}))throw new Error("Unsupported position for tier labels");return this._tierLabelPositions=a,this._invalidateLayout(),this},d.prototype.axisConfigurations=function(a){return null==a?this._possibleTimeAxisConfigurations:(this._possibleTimeAxisConfigurations=a,this._invalidateLayout(),this)},d.prototype._getMostPreciseConfigurationIndex=function(){var b=this,c=this._possibleTimeAxisConfigurations.length;return this._possibleTimeAxisConfigurations.forEach(function(a,d){c>d&&a.every(function(a){return b._checkTimeAxisTierConfigurationWidth(a)})&&(c=d)}),c===this._possibleTimeAxisConfigurations.length&&(a._Util.Methods.warn("zoomed out too far: could not find suitable interval to display labels"),--c),c},d.prototype.orient=function(a){if(a&&("right"===a.toLowerCase()||"left"===a.toLowerCase()))throw new Error(a+" is not a supported orientation for TimeAxis - only horizontal orientations are supported");return c.prototype.orient.call(this,a)},d.prototype._computeHeight=function(){var a=this,b=this._measurer.measure().height;return this._tierHeights=this._tierLabelPositions.map(function(c){return b+a.tickLabelPadding()+("between"===c?0:a._maxLabelTickLength())}),this._computedHeight=d3.sum(this._tierHeights),this._computedHeight},d.prototype._getIntervalLength=function(a){var b=this._scale.domain()[0],c=a.interval.offset(b,a.step);if(c>this._scale.domain()[1])return this.width();var d=Math.abs(this._scale.scale(c)-this._scale.scale(b));return d},d.prototype._maxWidthForInterval=function(a){return this._measurer.measure(a.formatter(d._LONG_DATE)).width},d.prototype._checkTimeAxisTierConfigurationWidth=function(a){var b=this._maxWidthForInterval(a)+2*this.tickLabelPadding();return Math.min(this._getIntervalLength(a),this.width())>=b},d.prototype._setup=function(){c.prototype._setup.call(this),this._tierLabelContainers=[],this._tierMarkContainers=[],this._tierBaselines=[],this._tickLabelContainer.remove(),this._baseline.remove();for(var a=0;a=g.length||h.push(new Date((g[b+1].valueOf()-g[b].valueOf())/2+g[b].valueOf()))}):h=g;var i=c.selectAll("."+b.AbstractAxis.TICK_LABEL_CLASS).data(h,function(a){return a.valueOf()}),j=i.enter().append("g").classed(b.AbstractAxis.TICK_LABEL_CLASS,!0);j.append("text");var k="center"===this._tierLabelPositions[e]||1===d.step?0:this.tickLabelPadding(),l=(this._measurer.measure().height,"bottom"===this.orient()?d3.sum(this._tierHeights.slice(0,e+1))-this.tickLabelPadding():this.height()-d3.sum(this._tierHeights.slice(0,e))-this.tickLabelPadding()),m=i.selectAll("text");m.size()>0&&a._Util.DOM.translate(m,k,l),i.exit().remove(),i.attr("transform",function(a){return"translate("+f._scale.scale(a)+",0)"});var n="center"===this._tierLabelPositions[e]||1===d.step?"middle":"start";i.selectAll("text").text(d.formatter).style("text-anchor",n)},d.prototype._renderTickMarks=function(a,c){var d=this._tierMarkContainers[c].selectAll("."+b.AbstractAxis.TICK_MARK_CLASS).data(a);d.enter().append("line").classed(b.AbstractAxis.TICK_MARK_CLASS,!0);var e=this._generateTickMarkAttrHash(),f=this._tierHeights.slice(0,c).reduce(function(a,b){return a+b},0);"bottom"===this.orient()?(e.y1=f,e.y2=f+("center"===this._tierLabelPositions[c]?this.tickLength():this._tierHeights[c])):(e.y1=this.height()-f,e.y2=this.height()-(f+("center"===this._tierLabelPositions[c]?this.tickLength():this._tierHeights[c]))),d.attr(e),"bottom"===this.orient()?(e.y1=f,e.y2=f+this._tierHeights[c]):(e.y1=this.height()-f,e.y2=this.height()-(f+this._tierHeights[c])),d3.select(d[0][0]).attr(e),d3.select(d[0][0]).classed(b.AbstractAxis.END_TICK_MARK_CLASS,!0),d3.select(d[0][d.size()-1]).classed(b.AbstractAxis.END_TICK_MARK_CLASS,!0),d.exit().remove()},d.prototype._renderLabellessTickMarks=function(a){var c=this._tickMarkContainer.selectAll("."+b.AbstractAxis.TICK_MARK_CLASS).data(a);c.enter().append("line").classed(b.AbstractAxis.TICK_MARK_CLASS,!0);var d=this._generateTickMarkAttrHash();d.y2="bottom"===this.orient()?this.tickLabelPadding():this.height()-this.tickLabelPadding(),c.attr(d),c.exit().remove()},d.prototype._generateLabellessTicks=function(){return this._mostPreciseConfigIndex<1?[]:this._getTickIntervalValues(this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex-1][0])},d.prototype._doRender=function(){var a=this;this._mostPreciseConfigIndex=this._getMostPreciseConfigurationIndex();for(var b=this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex],c=0;c=j&&(h=this._generateLabellessTicks()),this._renderLabellessTickMarks(h),c=0;ce.left||j.left=b[1]?b[0]:b[1];return c===b[0]?a.ticks().filter(function(a){return a>=c&&d>=a}):a.ticks().filter(function(a){return a>=c&&d>=a}).reverse()},d.prototype._rescale=function(){if(this._isSetup){if(!this._isHorizontal()){var a=this._computeWidth();if(a>this.width()||aa,wantsHeight:e>b}},b.prototype._setup=function(){a.prototype._setup.call(this),this._textContainer=this._content.append("g"),this._measurer=new SVGTypewriter.Measurers.Measurer(this._textContainer),this._wrapper=new SVGTypewriter.Wrappers.Wrapper,this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper),this.text(this._text)},b.prototype.text=function(a){return void 0===a?this._text:(this._text=a,this._invalidateLayout(),this)},b.prototype.orient=function(a){if(null==a)return this._orientation;if(a=a.toLowerCase(),"horizontal"!==a&&"left"!==a&&"right"!==a)throw new Error(a+" is not a valid orientation for LabelComponent");return this._orientation=a,this._invalidateLayout(),this},b.prototype.padding=function(a){if(null==a)return this._padding;if(a=+a,0>a)throw new Error(a+" is not a valid padding value. Cannot be less than 0.");return this._padding=a,this._invalidateLayout(),this},b.prototype._doRender=function(){a.prototype._doRender.call(this),this._textContainer.selectAll("g").remove();var b=this._measurer.measure(this._text),c=Math.max(Math.min((this.height()-b.height)/2,this.padding()),0),d=Math.max(Math.min((this.width()-b.width)/2,this.padding()),0);this._textContainer.attr("transform","translate("+d+","+c+")");var e=this.width()-2*d,f=this.height()-2*c,g={horizontal:0,right:90,left:-90},h={selection:this._textContainer,xAlign:this._xAlignment,yAlign:this._yAlignment,textRotation:g[this.orient()]};this._writer.write(this._text,e,f,h)},b}(a.AbstractComponent);a.Label=b;var c=function(a){function b(b,c){a.call(this,b,c),this.classed("title-label",!0)}return __extends(b,a),b}(b);a.TitleLabel=c;var d=function(a){function b(b,c){a.call(this,b,c),this.classed("axis-label",!0)}return __extends(b,a),b}(b);a.AxisLabel=d}(b=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){var b;!function(b){var c=function(b){function c(c){var d=this;if(b.call(this),this._padding=5,this.classed("legend",!0),this.maxEntriesPerRow(1),null==c)throw new Error("Legend requires a colorScale");this._scale=c,this._scale.broadcaster.registerListener(this,function(){return d._invalidateLayout()}),this.xAlign("right").yAlign("top"),this._fixedWidthFlag=!0,this._fixedHeightFlag=!0,this._sortFn=function(a,b){return d._scale.domain().indexOf(a)-d._scale.domain().indexOf(b)},this._symbolGenerator=a.SymbolGenerators.d3Symbol("circle")}return __extends(c,b),c.prototype._setup=function(){b.prototype._setup.call(this);var a=this._content.append("g").classed(c.LEGEND_ROW_CLASS,!0),d=a.append("g").classed(c.LEGEND_ENTRY_CLASS,!0);d.append("text"),this._measurer=new SVGTypewriter.Measurers.Measurer(a),this._wrapper=(new SVGTypewriter.Wrappers.Wrapper).maxLines(1),this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper).addTitleElement(!0)},c.prototype.maxEntriesPerRow=function(a){return null==a?this._maxEntriesPerRow:(this._maxEntriesPerRow=a,this._invalidateLayout(),this)},c.prototype.sortFunction=function(a){return null==a?this._sortFn:(this._sortFn=a,this._invalidateLayout(),this)},c.prototype.scale=function(a){var b=this;return null!=a?(this._scale.broadcaster.deregisterListener(this),this._scale=a,this._scale.broadcaster.registerListener(this,function(){return b._invalidateLayout()}),this._invalidateLayout(),this):this._scale},c.prototype.remove=function(){b.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},c.prototype._calculateLayoutInfo=function(b,c){var d=this,e=this._measurer.measure().height,f=Math.max(0,b-this._padding),g=function(a){var b=e+d._measurer.measure(a).width+d._padding;return Math.min(b,f)},h=this._scale.domain().slice();h.sort(this.sortFunction());var i=a._Util.Methods.populateMap(h,g),j=this._packRows(f,h,i),k=Math.floor((c-2*this._padding)/e);return k!==k&&(k=0),{textHeight:e,entryLengths:i,rows:j,numRowsToDraw:Math.max(Math.min(k,j.length),0)}},c.prototype._requestedSpace=function(b,c){var d=this,e=this._calculateLayoutInfo(b,c),f=e.rows.map(function(a){return d3.sum(a,function(a){return e.entryLengths.get(a)})}),g=a._Util.Methods.max(f,0),h=a._Util.Methods.max(this._scale.domain(),function(a){return d._measurer.measure(a).width},0);h+=e.textHeight+this._padding;var i=this._padding+Math.max(g,h),j=e.numRowsToDraw*e.textHeight+2*this._padding,k=e.rows.length*e.textHeight+2*this._padding,l=Math.max(Math.ceil(this._scale.domain().length/this._maxEntriesPerRow),1),m=e.rows.length>l;return{width:this._padding+g,height:j,wantsWidth:i>b||m,wantsHeight:k>c}},c.prototype._packRows=function(a,b,c){var d=this,e=[],f=[],g=a;return b.forEach(function(b){var h=c.get(b);(h>g||f.length===d._maxEntriesPerRow)&&(e.push(f),f=[],g=a),f.push(b),g-=h}),0!==f.length&&e.push(f),e},c.prototype.getEntry=function(a){if(!this._isSetup)return d3.select();var b=d3.select(),d=this._calculateLayoutInfo(this.width(),this.height()),e=this._padding;return this._content.selectAll("g."+c.LEGEND_ROW_CLASS).each(function(f,g){var h=g*d.textHeight+e,i=(g+1)*d.textHeight+e,j=e,k=e;d3.select(this).selectAll("g."+c.LEGEND_ENTRY_CLASS).each(function(c){k+=d.entryLengths.get(c),k>=a.x&&j<=a.x&&i>=a.y&&h<=a.y&&(b=d3.select(this)),j+=d.entryLengths.get(c)})}),b},c.prototype._doRender=function(){var d=this;b.prototype._doRender.call(this);var e=this._calculateLayoutInfo(this.width(),this.height()),f=e.rows.slice(0,e.numRowsToDraw),g=this._content.selectAll("g."+c.LEGEND_ROW_CLASS).data(f);g.enter().append("g").classed(c.LEGEND_ROW_CLASS,!0),g.exit().remove(),g.attr("transform",function(a,b){return"translate(0, "+(b*e.textHeight+d._padding)+")"});var h=g.selectAll("g."+c.LEGEND_ENTRY_CLASS).data(function(a){return a}),i=h.enter().append("g").classed(c.LEGEND_ENTRY_CLASS,!0);i.append("path"),i.append("g").classed("text-container",!0),h.exit().remove();var j=this._padding;g.each(function(){var a=j,b=d3.select(this).selectAll("g."+c.LEGEND_ENTRY_CLASS);b.attr("transform",function(b){var c="translate("+a+", 0)";return a+=e.entryLengths.get(b),c})}),h.select("path").attr("d",this.symbolGenerator()).attr("transform","translate("+e.textHeight/2+","+e.textHeight/2+") scale("+.3*e.textHeight/a.SymbolGenerators.SYMBOL_GENERATOR_RADIUS+")").attr("fill",function(a){return d._scale.scale(a)}).attr("vector-effect","non-scaling-stroke").classed(c.LEGEND_SYMBOL_CLASS,!0);var k=this._padding,l=h.select("g.text-container");l.text(""),l.append("title").text(function(a){return a});var m=this;l.attr("transform","translate("+e.textHeight+", 0)").each(function(a){var b=d3.select(this),c=e.entryLengths.get(a)-e.textHeight-k,d={selection:b,xAlign:"left",yAlign:"top",textRotation:0};m._writer.write(a,c,m.height(),d)})},c.prototype.symbolGenerator=function(a){return null==a?this._symbolGenerator:(this._symbolGenerator=a,this._render(),this)},c.LEGEND_ROW_CLASS="legend-row",c.LEGEND_ENTRY_CLASS="legend-entry",c.LEGEND_SYMBOL_CLASS="legend-symbol",c}(b.AbstractComponent);b.Legend=c}(b=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){var b;!function(b){var c=function(b){function c(d,e,f){var g=this;if(void 0===e&&(e="horizontal"),void 0===f&&(f=a.Formatters.general()),b.call(this),this._padding=5,this._numSwatches=10,null==d)throw new Error("InterpolatedColorLegend requires a interpolatedColorScale");this._scale=d,this._scale.broadcaster.registerListener(this,function(){return g._invalidateLayout()}),this._formatter=f,this._orientation=c._ensureOrientation(e),this._fixedWidthFlag=!0,this._fixedHeightFlag=!0,this.classed("legend",!0).classed("interpolated-color-legend",!0)}return __extends(c,b),c.prototype.remove=function(){b.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},c.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this._invalidateLayout(),this)},c._ensureOrientation=function(a){if(a=a.toLowerCase(),"horizontal"===a||"left"===a||"right"===a)return a;throw new Error('"'+a+'" is not a valid orientation for InterpolatedColorLegend')},c.prototype.orient=function(a){return null==a?this._orientation:(this._orientation=c._ensureOrientation(a),this._invalidateLayout(),this)},c.prototype._generateTicks=function(){for(var a=this._scale.domain(),b=(a[1]-a[0])/this._numSwatches,c=[],d=0;d<=this._numSwatches;d++)c.push(a[0]+b*d);return c},c.prototype._setup=function(){b.prototype._setup.call(this),this._swatchContainer=this._content.append("g").classed("swatch-container",!0),this._swatchBoundingBox=this._content.append("rect").classed("swatch-bounding-box",!0),this._lowerLabel=this._content.append("g").classed(c.LEGEND_LABEL_CLASS,!0),this._upperLabel=this._content.append("g").classed(c.LEGEND_LABEL_CLASS,!0),this._measurer=new SVGTypewriter.Measurers.Measurer(this._content),this._wrapper=new SVGTypewriter.Wrappers.Wrapper,this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper)},c.prototype._requestedSpace=function(b,c){var d,e,f=this,g=this._measurer.measure().height,h=this._generateTicks(),i=h.length,j=this._scale.domain(),k=j.map(function(a){return f._measurer.measure(f._formatter(a)).width});if(this._isVertical()){var l=a._Util.Methods.max(k,0);e=this._padding+g+this._padding+l+this._padding,d=this._padding+i*g+this._padding}else d=this._padding+g+this._padding,e=this._padding+k[0]+this._padding+i*g+this._padding+k[1]+this._padding;return{width:e,height:d,wantsWidth:e>b,wantsHeight:d>c}},c.prototype._isVertical=function(){return"horizontal"!==this._orientation},c.prototype._doRender=function(){var a=this;b.prototype._doRender.call(this);var c,d,e,f,g=this._scale.domain(),h=(this._measurer.measure().height,this._formatter(g[0])),i=this._measurer.measure(h).width,j=this._formatter(g[1]),k=this._measurer.measure(j).width,l=this._generateTicks(),m=l.length,n=this._padding,o={x:0,y:0},p={x:0,y:0},q={selection:this._lowerLabel,xAlign:"center",yAlign:"center",textRotation:0},r={selection:this._upperLabel,xAlign:"center",yAlign:"center",textRotation:0},s={x:0,y:n,width:0,height:0};if(this._isVertical()){var t=Math.max(i,k);c=Math.max(this.width()-3*n-t,0),d=Math.max((this.height()-2*n)/m,0),f=function(a,b){return n+(m-(b+1))*d},r.yAlign="top",o.y=n,q.yAlign="bottom",p.y=-n,"left"===this._orientation?(e=function(){return n+t+n},r.xAlign="right",o.x=-(n+c+n),q.xAlign="right",p.x=-(n+c+n)):(e=function(){return n},r.xAlign="left",o.x=n+c+n,q.xAlign="left",p.x=n+c+n),s.width=c,s.height=m*d}else c=Math.max((this.width()-4*n-i-k)/m,0),d=Math.max(this.height()-2*n,0),e=function(a,b){return n+i+n+b*c},f=function(){return n},r.xAlign="right",o.x=-n,q.xAlign="left",p.x=n,s.width=m*c,s.height=d;s.x=e(null,0),this._upperLabel.text(""),this._writer.write(j,this.width(),this.height(),r);var u="translate("+o.x+", "+o.y+")";this._upperLabel.attr("transform",u),this._lowerLabel.text(""),this._writer.write(h,this.width(),this.height(),q);var v="translate("+p.x+", "+p.y+")";this._lowerLabel.attr("transform",v),this._swatchBoundingBox.attr(s);var w=this._swatchContainer.selectAll("rect.swatch").data(l);w.enter().append("rect").classed("swatch",!0),w.exit().remove(),w.attr({fill:function(b){return a._scale.scale(b)},width:c,height:d,x:e,y:f})},c.LEGEND_LABEL_CLASS="legend-label",c}(b.AbstractComponent);b.InterpolatedColorLegend=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){var e=this;if(null!=c&&!a.Scale.AbstractQuantitative.prototype.isPrototypeOf(c))throw new Error("xScale needs to inherit from Scale.AbstractQuantitative");if(null!=d&&!a.Scale.AbstractQuantitative.prototype.isPrototypeOf(d))throw new Error("yScale needs to inherit from Scale.AbstractQuantitative");b.call(this),this.classed("gridlines",!0),this._xScale=c,this._yScale=d,this._xScale&&this._xScale.broadcaster.registerListener(this,function(){return e._render()}),this._yScale&&this._yScale.broadcaster.registerListener(this,function(){return e._render()})}return __extends(c,b),c.prototype.remove=function(){return b.prototype.remove.call(this),this._xScale&&this._xScale.broadcaster.deregisterListener(this),this._yScale&&this._yScale.broadcaster.deregisterListener(this),this},c.prototype._setup=function(){b.prototype._setup.call(this),this._xLinesContainer=this._content.append("g").classed("x-gridlines",!0),this._yLinesContainer=this._content.append("g").classed("y-gridlines",!0)},c.prototype._doRender=function(){b.prototype._doRender.call(this),this._redrawXLines(),this._redrawYLines()},c.prototype._redrawXLines=function(){var a=this;if(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.height()).classed("zeroline",function(a){return 0===a}),d.exit().remove()}},c.prototype._redrawYLines=function(){var a=this;if(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.width()).attr("y2",c).classed("zeroline",function(a){return 0===a}),d.exit().remove()}},c}(b.AbstractComponent);b.Gridlines=c}(b=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){var b;!function(b){var c=function(b){function c(a){var c=this;void 0===a&&(a=[]),b.call(this),this._rowPadding=0,this._colPadding=0,this._rows=[],this._rowWeights=[],this._colWeights=[],this._nRows=0,this._nCols=0,this._calculatedLayout=null,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(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&&e!==y,D=f>0&&f!==z;if(!C&&!D)break;if(s>5)break}return e=i-d3.sum(v.guaranteedWidths),f=j-d3.sum(v.guaranteedHeights),o=c._calcProportionalSpace(l,e),p=c._calcProportionalSpace(k,f),{colProportionalSpace:o,rowProportionalSpace:p,guaranteedWidths:v.guaranteedWidths,guaranteedHeights:v.guaranteedHeights,wantsWidth:w,wantsHeight:x}},c.prototype._determineGuarantees=function(b,c){var d=a._Util.Methods.createFilledArray(0,this._nCols),e=a._Util.Methods.createFilledArray(0,this._nRows),f=a._Util.Methods.createFilledArray(!1,this._nCols),g=a._Util.Methods.createFilledArray(!1,this._nRows);return this._rows.forEach(function(a,h){a.forEach(function(a,i){var j;j=null!=a?a._requestedSpace(b[i],c[h]):{width:0,height:0,wantsWidth:!1,wantsHeight:!1};var k=Math.min(j.width,b[i]),l=Math.min(j.height,c[h]);d[i]=Math.max(d[i],k),e[h]=Math.max(e[h],l),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){return this._calculatedLayout=this._iterateLayout(a,b),{width:d3.sum(this._calculatedLayout.guaranteedWidths),height:d3.sum(this._calculatedLayout.guaranteedHeights),wantsWidth:this._calculatedLayout.wantsWidth,wantsHeight:this._calculatedLayout.wantsHeight}},c.prototype._computeLayout=function(c,d,e,f){var g=this;b.prototype._computeLayout.call(this,c,d,e,f);var h=this._useLastCalculatedLayout()?this._calculatedLayout:this._iterateLayout(this.width(),this.height());this._useLastCalculatedLayout(!0);var i=0,j=a._Util.Methods.addArrays(h.rowProportionalSpace,h.guaranteedHeights),k=a._Util.Methods.addArrays(h.colProportionalSpace,h.guaranteedWidths);this._rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a._computeLayout(c,i,k[d],j[b]),c+=k[d]+g._colPadding}),i+=j[b]+g._rowPadding})},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}(b.AbstractComponentContainer);b.Table=c}(b=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){var b;!function(b){var c=function(b){function c(){b.call(this),this._dataChanged=!1,this._projections={},this._animate=!1,this._animators={},this._animateOnNextRender=!0,this.clipPathEnabled=!0,this.classed("plot",!0),this._key2PlotDatasetKey=d3.map(),this._datasetKeysInOrder=[],this._nextSeriesIndex=0}return __extends(c,b),c.prototype._anchor=function(a){b.prototype._anchor.call(this,a),this._animateOnNextRender=!0,this._dataChanged=!0,this._updateScaleExtents()},c.prototype._setup=function(){var a=this;b.prototype._setup.call(this),this._renderArea=this._content.append("g").classed("render-area",!0),this._getDrawersInOrder().forEach(function(b){return b.setup(a._renderArea.append("g"))})},c.prototype.remove=function(){var a=this;b.prototype.remove.call(this),this._datasetKeysInOrder.forEach(function(b){return a.removeDataset(b)});var c=Object.keys(this._projections);c.forEach(function(b){var c=a._projections[b];c.scale&&c.scale.broadcaster.deregisterListener(a)})},c.prototype.addDataset=function(b,c){if("string"!=typeof b&&void 0!==c)throw new Error("invalid input to addDataset");"string"==typeof b&&"_"===b[0]&&a._Util.Methods.warn("Warning: Using _named series keys may produce collisions with unlabeled data sources");var d="string"==typeof b?b:"_"+this._nextSeriesIndex++,e="string"!=typeof b?b:c;return c=e instanceof a.Dataset?e:new a.Dataset(e),this._addDataset(d,c),this},c.prototype._addDataset=function(a,b){var c=this;this._key2PlotDatasetKey.has(a)&&this.removeDataset(a);var d=this._getDrawer(a),e=this._getPlotMetadataForDataset(a),f={drawer:d,dataset:b,key:a,plotMetadata:e};this._datasetKeysInOrder.push(a),this._key2PlotDatasetKey.set(a,f),this._isSetup&&d.setup(this._renderArea.append("g")),b.broadcaster.registerListener(this,function(){return c._onDatasetUpdate()}),this._onDatasetUpdate()},c.prototype._getDrawer=function(b){return new a._Drawer.AbstractDrawer(b)},c.prototype._getAnimator=function(b){return this._animate&&this._animateOnNextRender?this._animators[b]||new a.Animator.Null:new a.Animator.Null},c.prototype._onDatasetUpdate=function(){this._updateScaleExtents(),this._animateOnNextRender=!0,this._dataChanged=!0,this._render()},c.prototype.attr=function(a,b,c){return this.project(a,b,c)},c.prototype.project=function(b,c,d){var e=this;b=b.toLowerCase();var f=this._projections[b],g=f&&f.scale;return g&&this._datasetKeysInOrder.forEach(function(a){g._removeExtent(e.getID().toString()+"_"+a,b),g.broadcaster.deregisterListener(e)}),d&&d.broadcaster.registerListener(this,function(){return e._render()}),c=a._Util.Methods.accessorize(c),this._projections[b]={accessor:c,scale:d,attribute:b},this._updateScaleExtent(b),this._render(),this},c.prototype._generateAttrToProjector=function(){var a=this,b={};return d3.keys(this._projections).forEach(function(c){var d=a._projections[c],e=d.accessor,f=d.scale,g=f?function(a,b,c,d){return f.scale(e(a,b,c,d))}:e;b[c]=g}),b},c.prototype.generateProjectors=function(a){var b=this._generateAttrToProjector(),c=this._key2PlotDatasetKey.get(a),d=c.plotMetadata,e=c.dataset.metadata(),f={};return d3.entries(b).forEach(function(a){f[a.key]=function(b,c){return a.value(b,c,e,d)}}),f},c.prototype._doRender=function(){this._isAnchored&&(this._paint(),this._dataChanged=!1,this._animateOnNextRender=!1)},c.prototype.animate=function(a){return this._animate=a,this},c.prototype.detach=function(){return b.prototype.detach.call(this),this._updateScaleExtents(),this},c.prototype._updateScaleExtents=function(){var a=this;d3.keys(this._projections).forEach(function(b){return a._updateScaleExtent(b)})},c.prototype._updateScaleExtent=function(a){var b=this,c=this._projections[a];c.scale&&this._datasetKeysInOrder.forEach(function(d){var e=b._key2PlotDatasetKey.get(d),f=e.dataset,g=e.plotMetadata,h=f._getExtent(c.accessor,c.scale._typeCoercer,g),i=b.getID().toString()+"_"+d;0!==h.length&&b._isAnchored?c.scale._updateExtent(i,a,h):c.scale._removeExtent(i,a)})},c.prototype.animator=function(a,b){return void 0===b?this._animators[a]:(this._animators[a]=b,this)},c.prototype.datasetOrder=function(b){function c(b,c){var d=a._Util.Methods.intersection(d3.set(b),d3.set(c)),e=d.size();return e===b.length&&e===c.length}return void 0===b?this._datasetKeysInOrder:(c(b,this._datasetKeysInOrder)?(this._datasetKeysInOrder=b,this._onDatasetUpdate()):a._Util.Methods.warn("Attempted to change datasetOrder, but new order is not permutation of old. Ignoring."),this)},c.prototype.removeDataset=function(b){var c;if("string"==typeof b)c=b;else if("object"==typeof b){var d=-1;if(b instanceof a.Dataset){var e=this.datasets();d=e.indexOf(b)}else if(b instanceof Array){var f=this.datasets().map(function(a){return a.data()});d=f.indexOf(b)}-1!==d&&(c=this._datasetKeysInOrder[d])}return this._removeDataset(c)},c.prototype._removeDataset=function(a){if(null!=a&&this._key2PlotDatasetKey.has(a)){var b=this._key2PlotDatasetKey.get(a);b.drawer.remove();var c=d3.values(this._projections),d=this.getID().toString()+"_"+a;c.forEach(function(a){null!=a.scale&&a.scale._removeExtent(d,a.attribute)}),b.dataset.broadcaster.deregisterListener(this),this._datasetKeysInOrder.splice(this._datasetKeysInOrder.indexOf(a),1),this._key2PlotDatasetKey.remove(a),this._onDatasetUpdate()}return this},c.prototype.datasets=function(){var a=this;return this._datasetKeysInOrder.map(function(b){return a._key2PlotDatasetKey.get(b).dataset})},c.prototype._getDrawersInOrder=function(){var a=this;return this._datasetKeysInOrder.map(function(b){return a._key2PlotDatasetKey.get(b).drawer})},c.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:new a.Animator.Null}]},c.prototype._additionalPaint=function(){},c.prototype._getDataToDraw=function(){var a=this,b=d3.map();return this._datasetKeysInOrder.forEach(function(c){b.set(c,a._key2PlotDatasetKey.get(c).dataset.data())}),b},c.prototype._getPlotMetadataForDataset=function(a){return{datasetKey:a}},c.prototype._paint=function(){var b=this,c=this._generateDrawSteps(),d=this._getDataToDraw(),e=this._getDrawersInOrder(),f=this._datasetKeysInOrder.map(function(a,f){return e[f].draw(d.get(a),c,b._key2PlotDatasetKey.get(a).dataset.metadata(),b._key2PlotDatasetKey.get(a).plotMetadata)}),g=a._Util.Methods.max(f,0);this._additionalPaint(g)},c.prototype.getAllSelections=function(a,b){var c=this;void 0===a&&(a=this.datasetOrder()),void 0===b&&(b=!1);var d=[];if(d="string"==typeof a?[a]:a,b){var e=d3.set(d);d=this.datasetOrder().filter(function(a){return!e.has(a)})}var f=[];return d.forEach(function(a){var b=c._key2PlotDatasetKey.get(a);if(null!=b){var d=b.drawer;d._getRenderArea().selectAll(d._getSelector()).each(function(){f.push(this)})}}),d3.selectAll(f)},c.prototype.getAllPlotData=function(a){void 0===a&&(a=this.datasetOrder());var b=[];return b="string"==typeof a?[a]:a,this._getAllPlotData(b)},c.prototype._getAllPlotData=function(a){var b=this,c=[],d=[],e=[];return a.forEach(function(a){var f=b._key2PlotDatasetKey.get(a);if(null!=f){var g=f.drawer;f.dataset.data().forEach(function(a,b){c.push(a),d.push(g._getPixelPoint(a,b)),e.push(g._getSelection(b).node())})}}),{data:c,pixelPoints:d,selection:d3.selectAll(e)}},c.prototype.getClosestPlotData=function(a,b,c){void 0===b&&(b=1/0),void 0===c&&(c=this.datasetOrder());var d=[];return d="string"==typeof c?[c]:c,this._getClosestPlotData(a,d,b)},c.prototype._getClosestPlotData=function(b,c,d){void 0===d&&(d=1/0);var e,f=Math.pow(d,2),g=this.getAllPlotData(c);return g.pixelPoints.forEach(function(c,d){var g=a._Util.Methods.distanceSquared(c,b);f>g&&(f=g,e=d)}),null==e?{data:[],pixelPoints:[],selection:d3.select()}:{data:[g.data[e]],pixelPoints:[g.pixelPoints[e]],selection:d3.select(g.selection[0][e])}},c}(a.Component.AbstractComponent);b.AbstractPlot=c}(b=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){var b;!function(b){var c=function(b){function c(){b.call(this),this._colorScale=new a.Scale.Color,this.classed("pie-plot",!0)}return __extends(c,b),c.prototype._computeLayout=function(a,c,d,e){b.prototype._computeLayout.call(this,a,c,d,e),this._renderArea.attr("transform","translate("+this.width()/2+","+this.height()/2+")")},c.prototype.addDataset=function(c,d){return 1===this._datasetKeysInOrder.length?(a._Util.Methods.warn("Only one dataset is supported in Pie plots"),this):(b.prototype.addDataset.call(this,c,d),this)},c.prototype._generateAttrToProjector=function(){var a=this,c=b.prototype._generateAttrToProjector.call(this);c["inner-radius"]=c["inner-radius"]||d3.functor(0),c["outer-radius"]=c["outer-radius"]||d3.functor(Math.min(this.width(),this.height())/2);var d=function(b,c){return a._colorScale.scale(String(c))};return c.fill=c.fill||d,c},c.prototype._getDrawer=function(b){return new a._Drawer.Arc(b).setClass("arc")},c.prototype.getAllPlotData=function(a){var c=this,d=b.prototype.getAllPlotData.call(this,a);return d.pixelPoints.forEach(function(a){a.x=a.x+c.width()/2,a.y=a.y+c.height()/2}),d},c}(b.AbstractPlot);b.Pie=c}(b=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){var b;!function(b){var c=function(b){function c(a,c){var d=this;if(b.call(this),this._autoAdjustXScaleDomain=!1,this._autoAdjustYScaleDomain=!1,null==a||null==c)throw new Error("XYPlots require an xScale and yScale");this.classed("xy-plot",!0),this._xScale=a,this._yScale=c,this._updateXDomainer(),a.broadcaster.registerListener("yDomainAdjustment"+this.getID(),function(){return d._adjustYDomainOnChangeFromX()}),this._updateYDomainer(),c.broadcaster.registerListener("xDomainAdjustment"+this.getID(),function(){return d._adjustXDomainOnChangeFromY()})}return __extends(c,b),c.prototype.project=function(a,c,d){var e=this;return"x"===a&&d&&(this._xScale&&this._xScale.broadcaster.deregisterListener("yDomainAdjustment"+this.getID()),this._xScale=d,this._updateXDomainer(),d.broadcaster.registerListener("yDomainAdjustment"+this.getID(),function(){return e._adjustYDomainOnChangeFromX()})),"y"===a&&d&&(this._yScale&&this._yScale.broadcaster.deregisterListener("xDomainAdjustment"+this.getID()),this._yScale=d,this._updateYDomainer(),d.broadcaster.registerListener("xDomainAdjustment"+this.getID(),function(){return e._adjustXDomainOnChangeFromY()})),b.prototype.project.call(this,a,c,d),this},c.prototype.remove=function(){return b.prototype.remove.call(this),this._xScale&&this._xScale.broadcaster.deregisterListener("yDomainAdjustment"+this.getID()),this._yScale&&this._yScale.broadcaster.deregisterListener("xDomainAdjustment"+this.getID()),this},c.prototype.automaticallyAdjustYScaleOverVisiblePoints=function(a){return this._autoAdjustYScaleDomain=a,this._adjustYDomainOnChangeFromX(),this},c.prototype.automaticallyAdjustXScaleOverVisiblePoints=function(a){return this._autoAdjustXScaleDomain=a,this._adjustXDomainOnChangeFromY(),this},c.prototype._generateAttrToProjector=function(){var a=b.prototype._generateAttrToProjector.call(this),c=a.x,d=a.y;return a.defined=function(a,b,e,f){var g=c(a,b,e,f),h=d(a,b,e,f);return null!=g&&g===g&&null!=h&&h===h},a},c.prototype._computeLayout=function(c,d,e,f){b.prototype._computeLayout.call(this,c,d,e,f),this._xScale.range([0,this.width()]),this._yScale.range(this._yScale instanceof a.Scale.Category?[0,this.height()]:[this.height(),0])},c.prototype._updateXDomainer=function(){if(this._xScale instanceof a.Scale.AbstractQuantitative){var b=this._xScale;b._userSetDomainer||b.domainer().pad().nice()}},c.prototype._updateYDomainer=function(){if(this._yScale instanceof a.Scale.AbstractQuantitative){var b=this._yScale;b._userSetDomainer||b.domainer().pad().nice()}},c.prototype.showAllData=function(){this._xScale.autoDomain(),this._autoAdjustYScaleDomain||this._yScale.autoDomain()},c.prototype._adjustYDomainOnChangeFromX=function(){this._projectorsReady()&&this._autoAdjustYScaleDomain&&this._adjustDomainToVisiblePoints(this._xScale,this._yScale,!0)},c.prototype._adjustXDomainOnChangeFromY=function(){this._projectorsReady()&&this._autoAdjustXScaleDomain&&this._adjustDomainToVisiblePoints(this._yScale,this._xScale,!1)},c.prototype._adjustDomainToVisiblePoints=function(b,c,d){if(c instanceof a.Scale.AbstractQuantitative){var e,f=c,g=this._normalizeDatasets(d);if(b instanceof a.Scale.AbstractQuantitative){var h=b.domain();e=function(a){return h[0]<=a&&h[1]>=a}}else{var i=d3.set(b.domain());e=function(a){return i.has(a)}}var j=this._adjustDomainOverVisiblePoints(g,e);if(0===j.length)return;j=f.domainer().computeDomain([j],f),f.domain(j)}},c.prototype._normalizeDatasets=function(b){var c=this,d=this._projections[b?"x":"y"].accessor,e=this._projections[b?"y":"x"].accessor;return a._Util.Methods.flatten(this._datasetKeysInOrder.map(function(a){var b=c._key2PlotDatasetKey.get(a).dataset,f=c._key2PlotDatasetKey.get(a).plotMetadata;return b.data().map(function(a,c){return{a:d(a,c,b.metadata(),f),b:e(a,c,b.metadata(),f)}})}))},c.prototype._adjustDomainOverVisiblePoints=function(b,c){var d=b.filter(function(a){return c(a.a)}).map(function(a){return a.b}),e=[];return 0!==d.length&&(e=[a._Util.Methods.min(d,null),a._Util.Methods.max(d,null)]),e},c.prototype._projectorsReady=function(){return this._projections.x&&this._projections.y},c}(b.AbstractPlot);b.AbstractXYPlot=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this._defaultFillColor=(new a.Scale.Color).range()[0],this.classed("rectangle-plot",!0)}return __extends(c,b),c.prototype._getDrawer=function(b){return new a._Drawer.Rect(b,!0)},c.prototype._generateAttrToProjector=function(){var a=b.prototype._generateAttrToProjector.call(this),c=a.x1,d=a.y1,e=a.x2,f=a.y2;return a.width=function(a,b,d,f){return Math.abs(e(a,b,d,f)-c(a,b,d,f))},a.x=function(a,b,d,f){return Math.min(c(a,b,d,f),e(a,b,d,f))},a.height=function(a,b,c,e){return Math.abs(f(a,b,c,e)-d(a,b,c,e))},a.y=function(b,c,e,g){return Math.max(d(b,c,e,g),f(b,c,e,g))-a.height(b,c,e,g)},delete a.x1,delete a.y1,delete a.x2,delete a.y2,a.fill=a.fill||d3.functor(this._defaultFillColor),a},c.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("rectangles")}]},c}(b.AbstractXYPlot);b.Rectangle=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this._closeDetectionRadius=5,this.classed("scatter-plot",!0),this._defaultFillColor=(new a.Scale.Color).range()[0],this.animator("symbols-reset",new a.Animator.Null),this.animator("symbols",(new a.Animator.Base).duration(250).delay(5))}return __extends(c,b),c.prototype._getDrawer=function(b){return new a._Drawer.Symbol(b)},c.prototype._generateAttrToProjector=function(){var c=b.prototype._generateAttrToProjector.call(this);if(c.r=c.r||d3.functor(3),c.opacity=c.opacity||d3.functor(.6),c.fill=c.fill||d3.functor(this._defaultFillColor),c.symbol=c.symbol||a.SymbolGenerators.d3Symbol("circle"),c["vector-effect"]=c["vector-effect"]||d3.functor("non-scaling-stroke"),a._Util.Methods.isIE()&&null!=c["stroke-width"]){var d=c["stroke-width"];c["stroke-width"]=function(b,e,f,g){var h=d(b,e,f,g);return"non-scaling-stroke"===c["vector-effect"](b,e,f,g)?h*a.SymbolGenerators.SYMBOL_GENERATOR_RADIUS/c.r(b,e,f,g):h}}return c},c.prototype._generateDrawSteps=function(){var a=[];if(this._dataChanged&&this._animate){var b=this._generateAttrToProjector();b.r=function(){return 0},a.push({attrToProjector:b,animator:this._getAnimator("symbols-reset")})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("symbols")}),a},c.prototype._getClosestStruckPoint=function(a,b){var c,d,e,f,g=this,h=this._generateAttrToProjector(),i=(h.x,h.y,function(b,c,d,e){var f=h.x(b,c,d,e)-a.x,g=h.y(b,c,d,e)-a.y;return f*f+g*g}),j=!1,k=b*b;if(this._datasetKeysInOrder.forEach(function(a){var b=g._key2PlotDatasetKey.get(a).dataset,l=g._key2PlotDatasetKey.get(a).plotMetadata,m=g._key2PlotDatasetKey.get(a).drawer;m._getRenderArea().selectAll("path").each(function(a,g){var m=i(a,g,b.metadata(),l),n=h.r(a,g,b.metadata(),l);n*n>m?((!j||k>m)&&(c=this,f=g,k=m,d=b.metadata(),e=l),j=!0):!j&&k>m&&(c=this,f=g,k=m,d=b.metadata(),e=l)})}),!c)return{selection:null,pixelPositions:null,data:null};var l=d3.select(c),m=l.data(),n={x:h.x(m[0],f,d,e),y:h.y(m[0],f,d,e)};return{selection:l,pixelPositions:[n],data:m}},c.prototype._hoverOverComponent=function(){},c.prototype._hoverOutComponent=function(){},c.prototype._doHover=function(a){return this._getClosestStruckPoint(a,this._closeDetectionRadius)},c}(b.AbstractXYPlot);b.Scatter=c}(b=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){var b;!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d),this.classed("grid-plot",!0),c instanceof a.Scale.Category&&c.innerPadding(0).outerPadding(0),d instanceof a.Scale.Category&&d.innerPadding(0).outerPadding(0),this._colorScale=e,this.animator("cells",new a.Animator.Null)}return __extends(c,b),c.prototype.addDataset=function(c,d){return 1===this._datasetKeysInOrder.length?(a._Util.Methods.warn("Only one dataset is supported in Grid plots"),this):(b.prototype.addDataset.call(this,c,d),this)},c.prototype._getDrawer=function(b){return new a._Drawer.Rect(b,!0)},c.prototype.project=function(c,d,e){var f=this;return b.prototype.project.call(this,c,d,e),"x"===c&&(e instanceof a.Scale.Category&&(this.project("x1",function(a,b,c,d){return e.scale(f._projections.x.accessor(a,b,c,d))-e.rangeBand()/2}),this.project("x2",function(a,b,c,d){return e.scale(f._projections.x.accessor(a,b,c,d))+e.rangeBand()/2})),e instanceof a.Scale.AbstractQuantitative&&this.project("x1",function(a,b,c,d){return e.scale(f._projections.x.accessor(a,b,c,d))})),"y"===c&&(e instanceof a.Scale.Category&&(this.project("y1",function(a,b,c,d){return e.scale(f._projections.y.accessor(a,b,c,d))-e.rangeBand()/2}),this.project("y2",function(a,b,c,d){return e.scale(f._projections.y.accessor(a,b,c,d))+e.rangeBand()/2})),e instanceof a.Scale.AbstractQuantitative&&this.project("y1",function(a,b,c,d){return e.scale(f._projections.y.accessor(a,b,c,d))})),"fill"===c&&(this._colorScale=this._projections.fill.scale),this},c.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("cells")}]},c}(b.Rectangle);b.Grid=c}(b=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){var b;!function(b){var c=function(b){function c(c,d,e){void 0===e&&(e=!0),b.call(this,c,d),this._barAlignmentFactor=.5,this._barLabelFormatter=a.Formatters.identity(),this._barLabelsEnabled=!1,this._hoverMode="point",this._hideBarsIfAnyAreTooWide=!0,this.classed("bar-plot",!0),this._defaultFillColor=(new a.Scale.Color).range()[0],this.animator("bars-reset",new a.Animator.Null),this.animator("bars",new a.Animator.Base),this.animator("baseline",new a.Animator.Null),this._isVertical=e,this.baseline(0)}return __extends(c,b),c.prototype._getDrawer=function(b){return new a._Drawer.Rect(b,this._isVertical)},c.prototype._setup=function(){b.prototype._setup.call(this),this._baseline=this._renderArea.append("line").classed("baseline",!0)},c.prototype.baseline=function(a){return null==a?this._baselineValue:(this._baselineValue=a,this._updateXDomainer(),this._updateYDomainer(),this._render(),this)},c.prototype.barAlignment=function(a){var b=a.toLowerCase(),c=this.constructor._BarAlignmentToFactor;if(void 0===c[b])throw new Error("unsupported bar alignment");return this._barAlignmentFactor=c[b],this._render(),this},c.prototype._parseExtent=function(a){if("number"==typeof a)return{min:a,max:a};if(a instanceof Object&&"min"in a&&"max"in a)return a;throw new Error("input '"+a+"' can't be parsed as an Extent")},c.prototype.barLabelsEnabled=function(a){return void 0===a?this._barLabelsEnabled:(this._barLabelsEnabled=a,this._render(),this)},c.prototype.barLabelFormatter=function(a){return null==a?this._barLabelFormatter:(this._barLabelFormatter=a,this._render(),this)},c.prototype.getBars=function(a,b){var c=this;if(!this._isSetup)return d3.select();var d=this._parseExtent(a),e=this._parseExtent(b),f=this._datasetKeysInOrder.reduce(function(a,b){return a.concat(c._getBarsFromDataset(b,d,e))},[]);return d3.selectAll(f)},c.prototype._getBarsFromDataset=function(a,b,c){var d=.5,e=[],f=this._key2PlotDatasetKey.get(a).drawer;return f._getRenderArea().selectAll("rect").each(function(){var a=this.getBBox();a.x+a.width>=b.min-d&&a.x<=b.max+d&&a.y+a.height>=c.min-d&&a.y<=c.max+d&&e.push(this)}),e},c.prototype._updateDomainer=function(b){if(b instanceof a.Scale.AbstractQuantitative){var c=b;c._userSetDomainer||(null!=this._baselineValue?c.domainer().addPaddingException(this._baselineValue,"BAR_PLOT+"+this.getID()).addIncludedValue(this._baselineValue,"BAR_PLOT+"+this.getID()):c.domainer().removePaddingException("BAR_PLOT+"+this.getID()).removeIncludedValue("BAR_PLOT+"+this.getID()),c.domainer().pad().nice()),c._autoDomainIfAutomaticMode()}},c.prototype._updateYDomainer=function(){this._isVertical?this._updateDomainer(this._yScale):b.prototype._updateYDomainer.call(this)},c.prototype._updateXDomainer=function(){this._isVertical?b.prototype._updateXDomainer.call(this):this._updateDomainer(this._xScale)},c.prototype._additionalPaint=function(b){var c=this,d=this._isVertical?this._yScale:this._xScale,e=d.scale(this._baselineValue),f={x1:this._isVertical?0:e,y1:this._isVertical?e:0,x2:this._isVertical?this.width():e,y2:this._isVertical?e:this.height()};this._getAnimator("baseline").animate(this._baseline,f);var g=this._getDrawersInOrder();g.forEach(function(a){return a.removeLabels()}),this._barLabelsEnabled&&a._Util.Methods.setTimeout(function(){return c._drawLabels()},b)},c.prototype._drawLabels=function(){var a=this,b=this._getDrawersInOrder(),c=this._generateAttrToProjector(),d=this._getDataToDraw();this._datasetKeysInOrder.forEach(function(e,f){return b[f].drawText(d.get(e),c,a._key2PlotDatasetKey.get(e).dataset.metadata(),a._key2PlotDatasetKey.get(e).plotMetadata)}),this._hideBarsIfAnyAreTooWide&&b.some(function(a){return a._getIfLabelsTooWide()})&&b.forEach(function(a){return a.removeLabels()})},c.prototype._generateDrawSteps=function(){var a=[];if(this._dataChanged&&this._animate){var b=this._generateAttrToProjector(),c=this._isVertical?this._yScale:this._xScale,d=c.scale(this._baselineValue),e=this._isVertical?"y":"x",f=this._isVertical?"height":"width";b[e]=function(){return d},b[f]=function(){return 0},a.push({attrToProjector:b,animator:this._getAnimator("bars-reset")})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("bars")}),a},c.prototype._generateAttrToProjector=function(){var c=this,d=b.prototype._generateAttrToProjector.call(this),e=this._isVertical?this._yScale:this._xScale,f=this._isVertical?this._xScale:this._yScale,g=this._isVertical?"y":"x",h=this._isVertical?"x":"y",i=e.scale(this._baselineValue),j=d[h],k=d.width;null==k&&(k=function(){return c._getBarPixelWidth()});var l=d[g],m=function(a,b,c,d){return Math.abs(i-l(a,b,c,d))};d.width=this._isVertical?k:m,d.height=this._isVertical?m:k,d[h]=f instanceof a.Scale.Category?function(a,b,c,d){return j(a,b,c,d)-k(a,b,c,d)/2}:function(a,b,d,e){return j(a,b,d,e)-k(a,b,d,e)*c._barAlignmentFactor},d[g]=function(a,b,c,d){var e=l(a,b,c,d);return e>i?i:e};var n=this._projections[g].accessor;return this.barLabelsEnabled&&this.barLabelFormatter&&(d.label=function(a,b,d,e){return c._barLabelFormatter(n(a,b,d,e))},d.positive=function(a,b,c,d){return l(a,b,c,d)<=i}),d.fill=d.fill||d3.functor(this._defaultFillColor),d},c.prototype._getBarPixelWidth=function(){var b,d=this,e=this._isVertical?this._xScale:this._yScale;if(e instanceof a.Scale.Category)b=e.rangeBand();else{var f=this._isVertical?this._projections.x.accessor:this._projections.y.accessor,g=d3.set(a._Util.Methods.flatten(this._datasetKeysInOrder.map(function(a){var b=d._key2PlotDatasetKey.get(a).dataset,c=d._key2PlotDatasetKey.get(a).plotMetadata;return b.data().map(function(a,d){return f(a,d,b.metadata(),c).valueOf()})}))).values().map(function(a){return+a});g.sort(function(a,b){return a-b});var h=d3.pairs(g),i=this._isVertical?this.width():this.height();b=a._Util.Methods.min(h,function(a){return Math.abs(e.scale(a[1])-e.scale(a[0]))},i*c._SINGLE_BAR_DIMENSION_RATIO);var j=g.map(function(a){return e.scale(a)}),k=a._Util.Methods.min(j,0);0!==this._barAlignmentFactor&&k>0&&(b=Math.min(b,k/this._barAlignmentFactor));var l=a._Util.Methods.max(j,0);if(1!==this._barAlignmentFactor&&i>l){var m=i-l;b=Math.min(b,m/(1-this._barAlignmentFactor))}b*=c._BAR_WIDTH_RATIO}return b},c.prototype.hoverMode=function(a){if(null==a)return this._hoverMode;var b=a.toLowerCase();if("point"!==b&&"line"!==b)throw new Error(a+" is not a valid hover mode");return this._hoverMode=b,this},c.prototype._clearHoverSelection=function(){this._getDrawersInOrder().forEach(function(a){a._getRenderArea().selectAll("rect").classed("not-hovered hovered",!1)})},c.prototype._hoverOverComponent=function(){},c.prototype._hoverOutComponent=function(){this._clearHoverSelection()},c.prototype._doHover=function(a){var b=this,c=a.x,d=a.y;if("line"===this._hoverMode){var e={min:-1/0,max:1/0};this._isVertical?d=e:c=e}var f=this._parseExtent(c),g=this._parseExtent(d),h=[],i=[],j=this._generateAttrToProjector();this._datasetKeysInOrder.forEach(function(a){var c=b._key2PlotDatasetKey.get(a).dataset,d=b._key2PlotDatasetKey.get(a).plotMetadata,e=b._getBarsFromDataset(a,f,g);d3.selectAll(e).each(function(a,e){i.push(b._isVertical?{x:j.x(a,e,c.metadata(),d)+j.width(a,e,c.metadata(),d)/2,y:j.y(a,e,c.metadata(),d)+(j.positive(a,e,c.metadata(),d)?0:j.height(a,e,c.metadata(),d))}:{x:j.x(a,e,c.metadata(),d)+j.height(a,e,c.metadata(),d)/2,y:j.y(a,e,c.metadata(),d)+(j.positive(a,e,c.metadata(),d)?0:j.width(a,e,c.metadata(),d))})}),h=h.concat(e)});var k=d3.selectAll(h);return k.empty()?(this._clearHoverSelection(),{data:null,pixelPositions:null,selection:null}):(this._getDrawersInOrder().forEach(function(a){a._getRenderArea().selectAll("rect").classed({hovered:!1,"not-hovered":!0})
-}),k.classed({hovered:!0,"not-hovered":!1}),{data:k.data(),pixelPositions:i,selection:k})},c._BarAlignmentToFactor={left:0,center:.5,right:1},c._DEFAULT_WIDTH=10,c._BAR_WIDTH_RATIO=.95,c._SINGLE_BAR_DIMENSION_RATIO=.4,c}(b.AbstractXYPlot);b.Bar=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this._hoverDetectionRadius=15,this.classed("line-plot",!0),this.animator("reset",new a.Animator.Null),this.animator("main",(new a.Animator.Base).duration(600).easing("exp-in-out")),this._defaultStrokeColor=(new a.Scale.Color).range()[0]}return __extends(c,b),c.prototype._setup=function(){b.prototype._setup.call(this),this._hoverTarget=this.foreground().append("circle").classed("hover-target",!0).attr("r",this._hoverDetectionRadius).style("visibility","hidden")},c.prototype._rejectNullsAndNaNs=function(a,b,c,d,e){var f=e(a,b,c,d);return null!=f&&f===f},c.prototype._getDrawer=function(b){return new a._Drawer.Line(b)},c.prototype._getResetYFunction=function(){var a=this._yScale.domain(),b=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]),d=0>b&&b||c>0&&c||0,e=this._yScale.scale(d);return function(){return e}},c.prototype._generateDrawSteps=function(){var a=[];if(this._dataChanged&&this._animate){var b=this._generateAttrToProjector();b.y=this._getResetYFunction(),a.push({attrToProjector:b,animator:this._getAnimator("reset")})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("main")}),a},c.prototype._generateAttrToProjector=function(){var a=this,c=b.prototype._generateAttrToProjector.call(this),d=this._wholeDatumAttributes(),e=function(a){return-1===d.indexOf(a)},f=d3.keys(c).filter(e);f.forEach(function(a){var b=c[a];c[a]=function(a,c,d,e){return a.length>0?b(a[0],c,d,e):null}});var g=c.x,h=c.y;return c.defined=function(b,c,d,e){return a._rejectNullsAndNaNs(b,c,d,e,g)&&a._rejectNullsAndNaNs(b,c,d,e,h)},c.stroke=c.stroke||d3.functor(this._defaultStrokeColor),c["stroke-width"]=c["stroke-width"]||d3.functor("2px"),c},c.prototype._wholeDatumAttributes=function(){return["x","y"]},c.prototype._getClosestPlotData=function(b,c,d){var e=this;void 0===d&&(d=1/0);var f,g,h,i=d;return c.forEach(function(c){var d=e.getAllPlotData(c);d.pixelPoints.forEach(function(c,e){var j=a._Util.Methods.distanceSquared(b,c);i>j&&(i=j,f=d.data[e],h=c,g=d.selection)})}),null==f?{data:[],pixelPoints:[],selection:d3.select()}:{data:[f],pixelPoints:[h],selection:g}},c.prototype._getClosestWithinRange=function(a,b){var c,d,e=this,f=this._generateAttrToProjector(),g=f.x,h=f.y,i=function(b,c,d,e){var f=+g(b,c,d,e)-a.x,i=+h(b,c,d,e)-a.y;return f*f+i*i},j=b*b;return this._datasetKeysInOrder.forEach(function(a){var b=e._key2PlotDatasetKey.get(a).dataset,f=e._key2PlotDatasetKey.get(a).plotMetadata;b.data().forEach(function(a,e){var k=i(a,e,b.metadata(),f);j>k&&(c=a,d={x:g(a,e,b.metadata(),f),y:h(a,e,b.metadata(),f)},j=k)})}),{closestValue:c,closestPoint:d}},c.prototype._getAllPlotData=function(a){var b=this,c=[],d=[],e=[];return a.forEach(function(a){var f=b._key2PlotDatasetKey.get(a);if(null!=f){var g=f.drawer;f.dataset.data().forEach(function(a,b){c.push(a),d.push(g._getPixelPoint(a,b))}),f.dataset.data().length>0&&e.push(g._getSelection(0).node())}}),{data:c,pixelPoints:d,selection:d3.selectAll(e)}},c.prototype._hoverOverComponent=function(){},c.prototype._hoverOutComponent=function(){},c.prototype._doHover=function(a){var b=this._getClosestWithinRange(a,this._hoverDetectionRadius),c=b.closestValue;if(void 0===c)return{data:null,pixelPositions:null,selection:null};var d=b.closestPoint;return this._hoverTarget.attr({cx:b.closestPoint.x,cy:b.closestPoint.y}),{data:[c],pixelPositions:[d],selection:this._hoverTarget}},c}(b.AbstractXYPlot);b.Line=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this.classed("area-plot",!0),this.project("y0",0,d),this.animator("reset",new a.Animator.Null),this.animator("main",(new a.Animator.Base).duration(600).easing("exp-in-out")),this._defaultFillColor=(new a.Scale.Color).range()[0]}return __extends(c,b),c.prototype._onDatasetUpdate=function(){b.prototype._onDatasetUpdate.call(this),null!=this._yScale&&this._updateYDomainer()},c.prototype._getDrawer=function(b){return new a._Drawer.Area(b)},c.prototype._updateYDomainer=function(){var c=this;b.prototype._updateYDomainer.call(this);var d,e=this._projections.y0,f=e&&e.accessor;if(null!=f){var g=this.datasets().map(function(a){return a._getExtent(f,c._yScale._typeCoercer)}),h=a._Util.Methods.flatten(g),i=a._Util.Methods.uniq(h);1===i.length&&(d=i[0])}this._yScale._userSetDomainer||(null!=d?this._yScale.domainer().addPaddingException(d,"AREA_PLOT+"+this.getID()):this._yScale.domainer().removePaddingException("AREA_PLOT+"+this.getID()),this._yScale._autoDomainIfAutomaticMode())},c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),"y0"===a&&this._updateYDomainer(),this},c.prototype._getResetYFunction=function(){return this._generateAttrToProjector().y0},c.prototype._wholeDatumAttributes=function(){var a=b.prototype._wholeDatumAttributes.call(this);return a.push("y0"),a},c.prototype._generateAttrToProjector=function(){var a=b.prototype._generateAttrToProjector.call(this);return a["fill-opacity"]=a["fill-opacity"]||d3.functor(.25),a.fill=a.fill||d3.functor(this._defaultFillColor),a.stroke=a.stroke||d3.functor(this._defaultFillColor),a},c}(b.Line);b.Area=c}(b=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){var b;!function(b){var c=function(b){function c(a,c,d){void 0===d&&(d=!0),b.call(this,a,c,d)}return __extends(c,b),c.prototype._generateAttrToProjector=function(){var a=this,c=b.prototype._generateAttrToProjector.call(this),d=this._makeInnerScale(),e=function(){return d.rangeBand()};c.width=this._isVertical?e:c.width,c.height=this._isVertical?c.height:e;var f=c.x,g=c.y;return c.x=function(b,c,d,e){return a._isVertical?f(b,c,d,e)+e.position:f(b,d,d,e)},c.y=function(b,c,d,e){return a._isVertical?g(b,c,d,e):g(b,c,d,e)+e.position},c},c.prototype._updateClusterPosition=function(){var a=this,b=this._makeInnerScale();this._datasetKeysInOrder.forEach(function(c){var d=a._key2PlotDatasetKey.get(c).plotMetadata;d.position=b.scale(c)-b.rangeBand()/2})},c.prototype._makeInnerScale=function(){var b=new a.Scale.Category;if(b.domain(this._datasetKeysInOrder),this._projections.width){var c=this._projections.width,d=c.accessor,e=c.scale,f=e?function(a,b,c,f){return e.scale(d(a,b,c,f))}:d;b.range([0,f(null,0,null,null)])}else b.range([0,this._getBarPixelWidth()]);return b},c.prototype._getDataToDraw=function(){return this._updateClusterPosition(),b.prototype._getDataToDraw.call(this)},c.prototype._getPlotMetadataForDataset=function(a){var c=b.prototype._getPlotMetadataForDataset.call(this,a);return c.position=0,c},c}(b.Bar);b.ClusteredBar=c}(b=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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this._stackedExtent=[0,0]}return __extends(c,b),c.prototype._getPlotMetadataForDataset=function(a){var c=b.prototype._getPlotMetadataForDataset.call(this,a);return c.offsets=d3.map(),c},c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),this._projections.x&&this._projections.y&&("x"===a||"y"===a)&&this._updateStackOffsets(),this},c.prototype._onDatasetUpdate=function(){this._projectorsReady()&&this._updateStackOffsets(),b.prototype._onDatasetUpdate.call(this)},c.prototype._updateStackOffsets=function(){var b=this._generateDefaultMapArray(),c=this._getDomainKeys(),d=b.map(function(b){return a._Util.Methods.populateMap(c,function(a){return{key:a,value:Math.max(0,b.get(a).value)}})}),e=b.map(function(b){return a._Util.Methods.populateMap(c,function(a){return{key:a,value:Math.min(b.get(a).value,0)}})});this._setDatasetStackOffsets(this._stack(d),this._stack(e)),this._updateStackExtents()},c.prototype._updateStackExtents=function(){var b=this,c=(this.datasets(),this._valueAccessor()),d=this._keyAccessor(),e=a._Util.Methods.max(this._datasetKeysInOrder,function(e){var f=b._key2PlotDatasetKey.get(e).dataset,g=b._key2PlotDatasetKey.get(e).plotMetadata;return a._Util.Methods.max(f.data(),function(a,b){return+c(a,b,f.metadata(),g)+g.offsets.get(d(a,b,f.metadata(),g))},0)},0),f=a._Util.Methods.min(this._datasetKeysInOrder,function(e){var f=b._key2PlotDatasetKey.get(e).dataset,g=b._key2PlotDatasetKey.get(e).plotMetadata;return a._Util.Methods.min(f.data(),function(a,b){return+c(a,b,f.metadata(),g)+g.offsets.get(d(a,b,f.metadata(),g))},0)},0);this._stackedExtent=[Math.min(f,0),Math.max(0,e)]},c.prototype._stack=function(a){var b=this,c=function(a,b){a.offset=b};return d3.layout.stack().x(function(a){return a.key}).y(function(a){return+a.value}).values(function(a){return b._getDomainKeys().map(function(b){return a.get(b)})}).out(c)(a),a},c.prototype._setDatasetStackOffsets=function(a,b){var c=this,d=this._keyAccessor(),e=this._valueAccessor();this._datasetKeysInOrder.forEach(function(f,g){var h=c._key2PlotDatasetKey.get(f).dataset,i=c._key2PlotDatasetKey.get(f).plotMetadata,j=a[g],k=b[g],l=h.data().every(function(a,b){return e(a,b,h.metadata(),i)<=0});h.data().forEach(function(a,b){var c,f=d(a,b,h.metadata(),i),g=j.get(f).offset,m=k.get(f).offset,n=e(a,b,h.metadata(),i);c=0===n?l?m:g:n>0?g:m,i.offsets.set(f,c)})})},c.prototype._getDomainKeys=function(){var a=this,b=this._keyAccessor(),c=d3.set();return this._datasetKeysInOrder.forEach(function(d){var e=a._key2PlotDatasetKey.get(d).dataset,f=a._key2PlotDatasetKey.get(d).plotMetadata;e.data().forEach(function(a,d){c.add(b(a,d,e.metadata(),f))})}),c.values()},c.prototype._generateDefaultMapArray=function(){var b=this,c=this._keyAccessor(),d=this._valueAccessor(),e=this._getDomainKeys(),f=this._datasetKeysInOrder.map(function(){return a._Util.Methods.populateMap(e,function(a){return{key:a,value:0}})});return this._datasetKeysInOrder.forEach(function(a,e){var g=b._key2PlotDatasetKey.get(a).dataset,h=b._key2PlotDatasetKey.get(a).plotMetadata;g.data().forEach(function(a,b){var i=c(a,b,g.metadata(),h),j=d(a,b,g.metadata(),h);f[e].set(i,{key:i,value:j})})}),f},c.prototype._updateScaleExtents=function(){b.prototype._updateScaleExtents.call(this);var a=this._isVertical?this._yScale:this._xScale;a&&(this._isAnchored&&this._stackedExtent.length>0?a._updateExtent(this.getID().toString(),"_PLOTTABLE_PROTECTED_FIELD_STACK_EXTENT",this._stackedExtent):a._removeExtent(this.getID().toString(),"_PLOTTABLE_PROTECTED_FIELD_STACK_EXTENT"))},c.prototype._normalizeDatasets=function(b){var c=this,d=this._projections[b?"x":"y"].accessor,e=this._projections[b?"y":"x"].accessor,f=function(a,f,g,h){var i=d(a,f,g,h);return(c._isVertical?!b:b)&&(i+=h.offsets.get(e(a,f,g,h))),i},g=function(a,f,g,h){var i=e(a,f,g,h);return(c._isVertical?b:!b)&&(i+=h.offsets.get(d(a,f,g,h))),i};return a._Util.Methods.flatten(this._datasetKeysInOrder.map(function(a){var b=c._key2PlotDatasetKey.get(a).dataset,d=c._key2PlotDatasetKey.get(a).plotMetadata;return b.data().map(function(a,c){return{a:f(a,c,b.metadata(),d),b:g(a,c,b.metadata(),d)}})}))},c.prototype._keyAccessor=function(){return this._isVertical?this._projections.x.accessor:this._projections.y.accessor},c.prototype._valueAccessor=function(){return this._isVertical?this._projections.y.accessor:this._projections.x.accessor},c}(b.AbstractXYPlot);b.AbstractStacked=c}(b=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){var b;!function(b){var c=function(c){function d(a,b){c.call(this,a,b),this._baselineValue=0,this.classed("area-plot",!0),this._isVertical=!0}return __extends(d,c),d.prototype._getDrawer=function(b){return new a._Drawer.Area(b).drawLine(!1)},d.prototype._getAnimator=function(){return new a.Animator.Null},d.prototype._setup=function(){c.prototype._setup.call(this),this._baseline=this._renderArea.append("line").classed("baseline",!0)},d.prototype._additionalPaint=function(){var a=this._yScale.scale(this._baselineValue),b={x1:0,y1:a,x2:this.width(),y2:a};this._getAnimator("baseline").animate(this._baseline,b)},d.prototype._updateYDomainer=function(){c.prototype._updateYDomainer.call(this);var a=this._yScale;a._userSetDomainer||(a.domainer().addPaddingException(0,"STACKED_AREA_PLOT+"+this.getID()).addIncludedValue(0,"STACKED_AREA_PLOT+"+this.getID()),a._autoDomainIfAutomaticMode())},d.prototype.project=function(a,d,e){return c.prototype.project.call(this,a,d,e),b.AbstractStacked.prototype.project.apply(this,[a,d,e]),this},d.prototype._onDatasetUpdate=function(){return c.prototype._onDatasetUpdate.call(this),b.AbstractStacked.prototype._onDatasetUpdate.apply(this),this},d.prototype._generateAttrToProjector=function(){var a=this,b=c.prototype._generateAttrToProjector.call(this);null==this._projections["fill-opacity"]&&(b["fill-opacity"]=d3.functor(1));var d=this._projections.y.accessor,e=this._projections.x.accessor;return b.y=function(b,c,f,g){return a._yScale.scale(+d(b,c,f,g)+g.offsets.get(e(b,c,f,g)))},b.y0=function(b,c,d,f){return a._yScale.scale(f.offsets.get(e(b,c,d,f)))},b},d.prototype._wholeDatumAttributes=function(){return["x","y","defined"]},d.prototype._updateStackOffsets=function(){var c=this;if(this._projectorsReady()){var d=this._getDomainKeys(),e=this._isVertical?this._projections.x.accessor:this._projections.y.accessor,f=this._datasetKeysInOrder.map(function(a){var b=c._key2PlotDatasetKey.get(a).dataset,d=c._key2PlotDatasetKey.get(a).plotMetadata;return d3.set(b.data().map(function(a,c){return e(a,c,b.metadata(),d).toString()})).values()});f.some(function(a){return a.length!==d.length})&&a._Util.Methods.warn("the domains across the datasets are not the same. Plot may produce unintended behavior."),b.AbstractStacked.prototype._updateStackOffsets.call(this)}},d.prototype._updateStackExtents=function(){b.AbstractStacked.prototype._updateStackExtents.call(this)},d.prototype._stack=function(a){return b.AbstractStacked.prototype._stack.call(this,a)},d.prototype._setDatasetStackOffsets=function(a,c){b.AbstractStacked.prototype._setDatasetStackOffsets.call(this,a,c)},d.prototype._getDomainKeys=function(){return b.AbstractStacked.prototype._getDomainKeys.call(this)},d.prototype._generateDefaultMapArray=function(){return b.AbstractStacked.prototype._generateDefaultMapArray.call(this)},d.prototype._updateScaleExtents=function(){b.AbstractStacked.prototype._updateScaleExtents.call(this)},d.prototype._keyAccessor=function(){return b.AbstractStacked.prototype._keyAccessor.call(this)},d.prototype._valueAccessor=function(){return b.AbstractStacked.prototype._valueAccessor.call(this)},d.prototype._getPlotMetadataForDataset=function(a){return b.AbstractStacked.prototype._getPlotMetadataForDataset.call(this,a)},d.prototype._normalizeDatasets=function(a){return b.AbstractStacked.prototype._normalizeDatasets.call(this,a)},d}(b.Area);b.StackedArea=c}(b=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){var b;!function(b){var c=function(c){function d(a,b,d){void 0===d&&(d=!0),c.call(this,a,b,d)}return __extends(d,c),d.prototype._getAnimator=function(b){if(this._animate&&this._animateOnNextRender){if(this.animator(b))return this.animator(b);if("stacked-bar"===b){var c=this._isVertical?this._yScale:this._xScale,d=c.scale(this.baseline());return new a.Animator.MovingRect(d,this._isVertical)}}return new a.Animator.Null},d.prototype._generateAttrToProjector=function(){var a=this,b=c.prototype._generateAttrToProjector.call(this),d=this._isVertical?"y":"x",e=this._isVertical?"x":"y",f=this._isVertical?this._yScale:this._xScale,g=this._projections[d].accessor,h=this._projections[e].accessor,i=function(a,b,c,d){return f.scale(d.offsets.get(h(a,b,c,d)))},j=function(a,b,c,d){return f.scale(+g(a,b,c,d)+d.offsets.get(h(a,b,c,d)))},k=function(a,b,c,d){return Math.abs(j(a,b,c,d)-i(a,b,c,d))},l=function(a,b,c,d){return+g(a,b,c,d)<0?i(a,b,c,d):j(a,b,c,d)};return b[d]=function(b,c,d,e){return a._isVertical?l(b,c,d,e):l(b,c,d,e)-k(b,c,d,e)},b},d.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("stacked-bar")}]},d.prototype.project=function(a,d,e){return c.prototype.project.call(this,a,d,e),b.AbstractStacked.prototype.project.apply(this,[a,d,e]),this},d.prototype._onDatasetUpdate=function(){return c.prototype._onDatasetUpdate.call(this),b.AbstractStacked.prototype._onDatasetUpdate.apply(this),this},d.prototype._getPlotMetadataForDataset=function(a){return b.AbstractStacked.prototype._getPlotMetadataForDataset.call(this,a)},d.prototype._normalizeDatasets=function(a){return b.AbstractStacked.prototype._normalizeDatasets.call(this,a)},d.prototype._updateStackOffsets=function(){b.AbstractStacked.prototype._updateStackOffsets.call(this)},d.prototype._updateStackExtents=function(){b.AbstractStacked.prototype._updateStackExtents.call(this)},d.prototype._stack=function(a){return b.AbstractStacked.prototype._stack.call(this,a)},d.prototype._setDatasetStackOffsets=function(a,c){b.AbstractStacked.prototype._setDatasetStackOffsets.call(this,a,c)},d.prototype._getDomainKeys=function(){return b.AbstractStacked.prototype._getDomainKeys.call(this)},d.prototype._generateDefaultMapArray=function(){return b.AbstractStacked.prototype._generateDefaultMapArray.call(this)},d.prototype._updateScaleExtents=function(){b.AbstractStacked.prototype._updateScaleExtents.call(this)},d.prototype._keyAccessor=function(){return b.AbstractStacked.prototype._keyAccessor.call(this)},d.prototype._valueAccessor=function(){return b.AbstractStacked.prototype._valueAccessor.call(this)},d}(b.Bar);b.StackedBar=c}(b=a.Plot||(a.Plot={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(){}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.getTiming=function(){return 0},a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){this._duration=a.DEFAULT_DURATION_MILLISECONDS,this._delay=a.DEFAULT_DELAY_MILLISECONDS,this._easing=a.DEFAULT_EASING,this._maxIterativeDelay=a.DEFAULT_MAX_ITERATIVE_DELAY_MILLISECONDS,this._maxTotalDuration=a.DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS}return a.prototype.getTiming=function(a){var b=Math.max(this.maxTotalDuration()-this.duration(),0),c=Math.min(this.maxIterativeDelay(),b/Math.max(a-1,1)),d=c*a+this.delay()+this.duration();return d},a.prototype.animate=function(a,b){var c=this,d=a[0].length,e=Math.max(this.maxTotalDuration()-this.duration(),0),f=Math.min(this.maxIterativeDelay(),e/Math.max(d-1,1));return a.transition().ease(this.easing()).duration(this.duration()).delay(function(a,b){return c.delay()+f*b}).attr(b)},a.prototype.duration=function(a){return null==a?this._duration:(this._duration=a,this)},a.prototype.delay=function(a){return null==a?this._delay:(this._delay=a,this)},a.prototype.easing=function(a){return null==a?this._easing:(this._easing=a,this)},a.prototype.maxIterativeDelay=function(a){return null==a?this._maxIterativeDelay:(this._maxIterativeDelay=a,this)},a.prototype.maxTotalDuration=function(a){return null==a?this._maxTotalDuration:(this._maxTotalDuration=a,this)},a.DEFAULT_DURATION_MILLISECONDS=300,a.DEFAULT_DELAY_MILLISECONDS=0,a.DEFAULT_MAX_ITERATIVE_DELAY_MILLISECONDS=15,a.DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS=600,a.DEFAULT_EASING="exp-out",a}();a.Base=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(a){var b=function(a){function b(b,c){void 0===b&&(b=!0),void 0===c&&(c=!1),a.call(this),this.isVertical=b,this.isReverse=c}return __extends(b,a),b.prototype.animate=function(c,d){var e={};return b.ANIMATED_ATTRIBUTES.forEach(function(a){return e[a]=d[a]}),e[this._getMovingAttr()]=this._startMovingProjector(d),e[this._getGrowingAttr()]=function(){return 0},c.attr(e),a.prototype.animate.call(this,c,d)},b.prototype._startMovingProjector=function(a){if(this.isVertical===this.isReverse)return a[this._getMovingAttr()];var b=a[this._getMovingAttr()],c=a[this._getGrowingAttr()];return function(a,d,e,f){return b(a,d,e,f)+c(a,d,e,f)}},b.prototype._getGrowingAttr=function(){return this.isVertical?"height":"width"},b.prototype._getMovingAttr=function(){return this.isVertical?"y":"x"},b.ANIMATED_ATTRIBUTES=["height","width","x","y","fill"],b}(a.Base);a.Rect=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(a){var b=function(a){function b(b,c){void 0===c&&(c=!0),a.call(this,c),this.startPixelValue=b}return __extends(b,a),b.prototype._startMovingProjector=function(){return d3.functor(this.startPixelValue)},b}(a.Rect);a.MovingRect=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(b){var c=function(a){function b(){a.apply(this,arguments),this._event2Callback={},this._broadcasters=[],this._connected=!1}return __extends(b,a),b.prototype._hasNoListeners=function(){return this._broadcasters.every(function(a){return 0===a.getListenerKeys().length})},b.prototype._connect=function(){var a=this;this._connected||(Object.keys(this._event2Callback).forEach(function(b){var c=a._event2Callback[b];document.addEventListener(b,c)}),this._connected=!0)},b.prototype._disconnect=function(){var a=this;this._connected&&this._hasNoListeners()&&(Object.keys(this._event2Callback).forEach(function(b){var c=a._event2Callback[b];document.removeEventListener(b,c)}),this._connected=!1)},b.prototype._getWrappedCallback=function(a){return function(){return a()}},b.prototype._setCallback=function(a,b,c){null===c?(a.deregisterListener(b),this._disconnect()):(this._connect(),a.registerListener(b,this._getWrappedCallback(c)))},b}(a.Core.PlottableObject);b.AbstractDispatcher=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(b){function c(c){var d=this;b.call(this),this.translator=a._Util.ClientToSVGTranslator.getTranslator(c),this._lastMousePosition={x:-1,y:-1},this._moveBroadcaster=new a.Core.Broadcaster(this);var e=function(a){return d._measureAndBroadcast(a,d._moveBroadcaster)};this._event2Callback.mouseover=e,this._event2Callback.mousemove=e,this._event2Callback.mouseout=e,this._downBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.mousedown=function(a){return d._measureAndBroadcast(a,d._downBroadcaster)},this._upBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.mouseup=function(a){return d._measureAndBroadcast(a,d._upBroadcaster)},this._wheelBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.wheel=function(a){return d._measureAndBroadcast(a,d._wheelBroadcaster)},this._dblClickBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.dblclick=function(a){return d._measureAndBroadcast(a,d._dblClickBroadcaster)},this._broadcasters=[this._moveBroadcaster,this._downBroadcaster,this._upBroadcaster,this._wheelBroadcaster,this._dblClickBroadcaster]}return __extends(c,b),c.getDispatcher=function(b){var d=a._Util.DOM.getBoundingSVG(b),e=d[c._DISPATCHER_KEY];return null==e&&(e=new c(d),d[c._DISPATCHER_KEY]=e),e},c.prototype._getWrappedCallback=function(a){return function(b,c,d){return a(c,d)}},c.prototype.onMouseMove=function(a,b){return this._setCallback(this._moveBroadcaster,a,b),this},c.prototype.onMouseDown=function(a,b){return this._setCallback(this._downBroadcaster,a,b),this},c.prototype.onMouseUp=function(a,b){return this._setCallback(this._upBroadcaster,a,b),this},c.prototype.onWheel=function(a,b){return this._setCallback(this._wheelBroadcaster,a,b),this},c.prototype.onDblClick=function(a,b){return this._setCallback(this._dblClickBroadcaster,a,b),this},c.prototype._measureAndBroadcast=function(a,b){var c=this.translator.computePosition(a.clientX,a.clientY);null!=c&&(this._lastMousePosition=c,b.broadcast(this.getLastMousePosition(),a))},c.prototype.getLastMousePosition=function(){return this._lastMousePosition},c._DISPATCHER_KEY="__Plottable_Dispatcher_Mouse",c}(b.AbstractDispatcher);b.Mouse=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(b){function c(c){var d=this;b.call(this),this.translator=a._Util.ClientToSVGTranslator.getTranslator(c),this._lastTouchPosition={x:-1,y:-1},this._startBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.touchstart=function(a){return d._measureAndBroadcast(a,d._startBroadcaster)},this._moveBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.touchmove=function(a){return d._measureAndBroadcast(a,d._moveBroadcaster)},this._endBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.touchend=function(a){return d._measureAndBroadcast(a,d._endBroadcaster)},this._broadcasters=[this._moveBroadcaster,this._startBroadcaster,this._endBroadcaster]}return __extends(c,b),c.getDispatcher=function(b){var d=a._Util.DOM.getBoundingSVG(b),e=d[c._DISPATCHER_KEY];return null==e&&(e=new c(d),d[c._DISPATCHER_KEY]=e),e},c.prototype._getWrappedCallback=function(a){return function(b,c,d){return a(c,d)}},c.prototype.onTouchStart=function(a,b){return this._setCallback(this._startBroadcaster,a,b),this},c.prototype.onTouchMove=function(a,b){return this._setCallback(this._moveBroadcaster,a,b),this},c.prototype.onTouchEnd=function(a,b){return this._setCallback(this._endBroadcaster,a,b),this},c.prototype._measureAndBroadcast=function(a,b){var c=a.changedTouches[0],d=this.translator.computePosition(c.clientX,c.clientY);null!=d&&(this._lastTouchPosition=d,b.broadcast(this.getLastTouchPosition(),a))},c.prototype.getLastTouchPosition=function(){return this._lastTouchPosition},c._DISPATCHER_KEY="__Plottable_Dispatcher_Touch",c}(b.AbstractDispatcher);b.Touch=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(b){function c(){var c=this;b.call(this),this._event2Callback.keydown=function(a){return c._processKeydown(a)},this._keydownBroadcaster=new a.Core.Broadcaster(this),this._broadcasters=[this._keydownBroadcaster]}return __extends(c,b),c.getDispatcher=function(){var a=document[c._DISPATCHER_KEY];return null==a&&(a=new c,document[c._DISPATCHER_KEY]=a),a},c.prototype._getWrappedCallback=function(a){return function(b,c){return a(c.keyCode,c)}},c.prototype.onKeyDown=function(a,b){return this._setCallback(this._keydownBroadcaster,a,b),this},c.prototype._processKeydown=function(a){this._keydownBroadcaster.broadcast(a)},c._DISPATCHER_KEY="__Plottable_Dispatcher_Key",c}(b.AbstractDispatcher);b.Key=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._anchor=function(a,b){this._componentToListenTo=a,this._hitBox=b},b.prototype._requiresHitbox=function(){return!1},b.prototype._translateToComponentSpace=function(a){var b=this._componentToListenTo.originToSVG();return{x:a.x-b.x,y:a.y-b.y}},b.prototype._isInsideComponent=function(a){return 0<=a.x&&0<=a.y&&a.x<=this._componentToListenTo.width()&&a.y<=this._componentToListenTo.height()},b}(a.Core.PlottableObject);b.AbstractInteraction=c}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._anchor=function(b,c){var d=this;a.prototype._anchor.call(this,b,c),c.on(this._listenTo(),function(){var a=d3.mouse(c.node()),b=a[0],e=a[1];d._callback({x:b,y:e})})},b.prototype._requiresHitbox=function(){return!0},b.prototype._listenTo=function(){return"click"},b.prototype.callback=function(a){return this._callback=a,this},b}(a.AbstractInteraction);a.Click=b}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._anchor=function(b,c){var d=this;a.prototype._anchor.call(this,b,c),c.on(this._listenTo(),function(){var a=d3.mouse(c.node()),b=a[0],e=a[1];d._callback({x:b,y:e})})},b.prototype._requiresHitbox=function(){return!0},b.prototype._listenTo=function(){return"dblclick"},b.prototype.callback=function(a){return this._callback=a,this},b}(a.AbstractInteraction);a.DoubleClick=b}(b=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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this._keyCode2Callback={}}return __extends(c,b),c.prototype._anchor=function(c,d){var e=this;b.prototype._anchor.call(this,c,d),this._positionDispatcher=a.Dispatcher.Mouse.getDispatcher(this._componentToListenTo._element.node()),this._positionDispatcher.onMouseMove("Interaction.Key"+this.getID(),function(){return null}),this._keyDispatcher=a.Dispatcher.Key.getDispatcher(),this._keyDispatcher.onKeyDown("Interaction.Key"+this.getID(),function(a){return e._handleKeyEvent(a)})},c.prototype._handleKeyEvent=function(a){var b=this._translateToComponentSpace(this._positionDispatcher.getLastMousePosition());this._isInsideComponent(b)&&this._keyCode2Callback[a]&&this._keyCode2Callback[a]()
-},c.prototype.on=function(a,b){return this._keyCode2Callback[a]=b,this},c}(b.AbstractInteraction);b.Key=c}(b=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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this._overComponent=!1}return __extends(c,b),c.prototype._anchor=function(c,d){var e=this;b.prototype._anchor.call(this,c,d),this._mouseDispatcher=a.Dispatcher.Mouse.getDispatcher(this._componentToListenTo.content().node()),this._mouseDispatcher.onMouseMove("Interaction.Pointer"+this.getID(),function(a){return e._handlePointerEvent(a)}),this._touchDispatcher=a.Dispatcher.Touch.getDispatcher(this._componentToListenTo.content().node()),this._touchDispatcher.onTouchStart("Interaction.Pointer"+this.getID(),function(a){return e._handlePointerEvent(a)})},c.prototype._handlePointerEvent=function(a){var b=this._translateToComponentSpace(a);if(this._isInsideComponent(b)){var c=this._overComponent;this._overComponent=!0,!c&&this._pointerEnterCallback&&this._pointerEnterCallback(b),this._pointerMoveCallback&&this._pointerMoveCallback(b)}else this._overComponent&&(this._overComponent=!1,this._pointerExitCallback&&this._pointerExitCallback(b))},c.prototype.onPointerEnter=function(a){return void 0===a?this._pointerEnterCallback:(this._pointerEnterCallback=a,this)},c.prototype.onPointerMove=function(a){return void 0===a?this._pointerMoveCallback:(this._pointerMoveCallback=a,this)},c.prototype.onPointerExit=function(a){return void 0===a?this._pointerExitCallback:(this._pointerExitCallback=a,this)},c}(b.AbstractInteraction);b.Pointer=c}(b=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){var b;!function(a){var b=function(a){function b(b,c){var d=this;a.call(this),b&&(this._xScale=b,this._xScale.broadcaster.registerListener("pziX"+this.getID(),function(){return d.resetZoom()})),c&&(this._yScale=c,this._yScale.broadcaster.registerListener("pziY"+this.getID(),function(){return d.resetZoom()}))}return __extends(b,a),b.prototype.resetZoom=function(){var a=this;this._zoom=d3.behavior.zoom(),this._xScale&&this._zoom.x(this._xScale._d3Scale),this._yScale&&this._zoom.y(this._yScale._d3Scale),this._zoom.on("zoom",function(){return a._rerenderZoomed()}),this._zoom(this._hitBox)},b.prototype._anchor=function(b,c){a.prototype._anchor.call(this,b,c),this.resetZoom()},b.prototype._requiresHitbox=function(){return!0},b.prototype._rerenderZoomed=function(){if(this._xScale){var a=this._xScale._d3Scale.domain();this._xScale.domain(a)}if(this._yScale){var b=this._yScale._d3Scale.domain();this._yScale.domain(b)}},b}(a.AbstractInteraction);a.PanZoom=b}(b=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){var b;!function(a){var b=function(a){function b(){var b=this;a.call(this),this._origin=[0,0],this._location=[0,0],this._isDragging=!1,this._dragBehavior=d3.behavior.drag(),this._dragBehavior.on("dragstart",function(){return b._dragstart()}),this._dragBehavior.on("drag",function(){return b._drag()}),this._dragBehavior.on("dragend",function(){return b._dragend()})}return __extends(b,a),b.prototype.dragstart=function(a){return void 0===a?this._ondragstart:(this._ondragstart=a,this)},b.prototype._setOrigin=function(a,b){this._origin=[a,b]},b.prototype._getOrigin=function(){return this._origin.slice()},b.prototype._setLocation=function(a,b){this._location=[a,b]},b.prototype._getLocation=function(){return this._location.slice()},b.prototype.drag=function(a){return void 0===a?this._ondrag:(this._ondrag=a,this)},b.prototype.dragend=function(a){return void 0===a?this._ondragend:(this._ondragend=a,this)},b.prototype._dragstart=function(){this._isDragging=!0;var a=this._componentToListenTo.width(),b=this._componentToListenTo.height(),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);var d=d3.mouse(this._hitBox[0][0].parentNode);this._setOrigin(d[0],d[1]),this._doDragstart()},b.prototype._doDragstart=function(){null!=this._ondragstart&&this._ondragstart({x:this._getOrigin()[0],y:this._getOrigin()[1]})},b.prototype._drag=function(){this._setLocation(this._constrainX(d3.event.x),this._constrainY(d3.event.y)),this._doDrag()},b.prototype._doDrag=function(){if(null!=this._ondrag){var a={x:this._getOrigin()[0],y:this._getOrigin()[1]},b={x:this._getLocation()[0],y:this._getLocation()[1]};this._ondrag(a,b)}},b.prototype._dragend=function(){var a=d3.mouse(this._hitBox[0][0].parentNode);this._setLocation(this._constrainX(a[0]),this._constrainY(a[1])),this._isDragging=!1,this._doDragend()},b.prototype._doDragend=function(){if(null!=this._ondragend){var a={x:this._getOrigin()[0],y:this._getOrigin()[1]},b={x:this._getLocation()[0],y:this._getLocation()[1]};this._ondragend(a,b)}},b.prototype._anchor=function(b,c){return a.prototype._anchor.call(this,b,c),c.call(this._dragBehavior),this},b.prototype._requiresHitbox=function(){return!0},b.prototype.setupZoomCallback=function(a,b){function c(c,g){return null==c||null==g?(f&&(null!=a&&a.domain(d),null!=b&&b.domain(e)),void(f=!f)):(f=!1,null!=a&&a.domain([a.invert(c.x),a.invert(g.x)]),null!=b&&b.domain([b.invert(g.y),b.invert(c.y)]),void this.clearBox())}var d=null!=a?a.domain():null,e=null!=b?b.domain():null,f=!1;return this.drag(c),this.dragend(c),this},b}(a.AbstractInteraction);a.Drag=b}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments),this._boxIsDrawn=!1,this._resizeXEnabled=!1,this._resizeYEnabled=!1,this._cursorStyle=""}return __extends(b,a),b.prototype.resizeEnabled=function(a){return null==a?this._resizeXEnabled||this._resizeYEnabled:(this._resizeXEnabled=a&&this.canResizeX(),this._resizeYEnabled=a&&this.canResizeY(),this)},b.prototype.isResizingX=function(){return!!this._xResizing},b.prototype.isResizingY=function(){return!!this._yResizing},b.prototype.boxIsDrawn=function(){return this._boxIsDrawn},b.prototype.isResizing=function(){return this.isResizingX()||this.isResizingY()},b.prototype._dragstart=function(){var b=d3.mouse(this._hitBox[0][0].parentNode);if(this.boxIsDrawn()){var c=this._getResizeInfo(b[0],b[1]);if(this._xResizing=c.xResizing,this._yResizing=c.yResizing,this.isResizing())return}a.prototype._dragstart.call(this),this.clearBox()},b.prototype._getResizeInfo=function(a,c){function d(a,b,c,d){return Math.min(b,c)-d<=a&&a<=Math.max(b,c)+d}function e(a,b,c,d){var e=Math.min(a,b),f=Math.max(a,b),g=Math.min(d,(f-e)/2);return c>e-d&&e+g>c?{offset:c-e,positive:!1,origin:a===e}:c>f-g&&f+d>c?{offset:c-f,positive:!0,origin:a===f}:null}var f=null,g=null,h=this._getOrigin()[0],i=this._getOrigin()[1],j=this._getLocation()[0],k=this._getLocation()[1];return this._resizeXEnabled&&d(c,i,k,b.RESIZE_PADDING)&&(f=e(h,j,a,b.RESIZE_PADDING)),this._resizeYEnabled&&d(a,h,j,b.RESIZE_PADDING)&&(g=e(i,k,c,b.RESIZE_PADDING)),{xResizing:f,yResizing:g}},b.prototype._drag=function(){if(this.isResizing()){if(this.isResizingX()){var b=this._xResizing.offset,c=d3.event.x;0!==b&&(c+=b,this._xResizing.offset+=b>0?-1:1),this._xResizing.origin?this._setOrigin(this._constrainX(c),this._getOrigin()[1]):this._setLocation(this._constrainX(c),this._getLocation()[1])}if(this.isResizingY()){var d=this._yResizing.offset,e=d3.event.y;0!==d&&(e+=d,this._yResizing.offset+=d>0?-1:1),this._yResizing.origin?this._setOrigin(this._getOrigin()[0],this._constrainY(e)):this._setLocation(this._getLocation()[0],this._constrainY(e))}this._doDrag()}else a.prototype._drag.call(this);this.setBox(this._getOrigin()[0],this._getLocation()[0],this._getOrigin()[1],this._getLocation()[1])},b.prototype._dragend=function(){this._xResizing=null,this._yResizing=null,a.prototype._dragend.call(this)},b.prototype.clearBox=function(){return null!=this.dragBox?(this.dragBox.attr("height",0).attr("width",0),this._boxIsDrawn=!1,this):void 0},b.prototype.setBox=function(a,b,c,d){if(null!=this.dragBox){var e=Math.abs(a-b),f=Math.abs(c-d),g=Math.min(a,b),h=Math.min(c,d);return this.dragBox.attr({x:g,y:h,width:e,height:f}),this._boxIsDrawn=e>0&&f>0,this}},b.prototype._anchor=function(c,d){var e=this;a.prototype._anchor.call(this,c,d);var f=b._CLASS_DRAG_BOX,g=this._componentToListenTo.background();return this.dragBox=g.append("rect").classed(f,!0).attr("x",0).attr("y",0),d.on("mousemove",function(){return e._hover()}),this},b.prototype._hover=function(){if(this.resizeEnabled()&&!this._isDragging&&this._boxIsDrawn){var a=d3.mouse(this._hitBox[0][0].parentNode);this._cursorStyle=this._getCursorStyle(a[0],a[1])}else this._boxIsDrawn||(this._cursorStyle="");this._hitBox.style("cursor",this._cursorStyle)},b.prototype._getCursorStyle=function(a,b){var c=this._getResizeInfo(a,b),d=c.xResizing&&!c.xResizing.positive,e=c.xResizing&&c.xResizing.positive,f=c.yResizing&&!c.yResizing.positive,g=c.yResizing&&c.yResizing.positive;return d&&f||g&&e?"nwse-resize":f&&e||g&&d?"nesw-resize":d||e?"ew-resize":f||g?"ns-resize":""},b.prototype.canResizeX=function(){return!0},b.prototype.canResizeY=function(){return!0},b._CLASS_DRAG_BOX="drag-box",b.RESIZE_PADDING=10,b._CAN_RESIZE_X=!0,b._CAN_RESIZE_Y=!0,b}(a.Drag);a.DragBox=b}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._setOrigin=function(b){a.prototype._setOrigin.call(this,b,0)},b.prototype._setLocation=function(b){a.prototype._setLocation.call(this,b,this._componentToListenTo.height())},b.prototype.canResizeY=function(){return!1},b}(a.DragBox);a.XDragBox=b}(b=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){var b;!function(b){var c=function(b){function c(){a._Util.Methods.warn("XYDragBox is deprecated; use DragBox instead"),b.call(this)}return __extends(c,b),c}(b.DragBox);b.XYDragBox=c}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._setOrigin=function(b,c){a.prototype._setOrigin.call(this,0,c)},b.prototype._setLocation=function(b,c){a.prototype._setLocation.call(this,this._componentToListenTo.width(),c)},b.prototype.canResizeX=function(){return!1},b}(a.DragBox);a.YDragBox=b}(b=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){var b;!function(b){var c=function(b){function c(){b.call(this),this._overComponent=!1,this._currentHoverData={data:null,pixelPositions:null,selection:null},c.warned||(c.warned=!0,a._Util.Methods.warn("Interaction.Hover is deprecated; use Interaction.Pointer in conjunction with getClosestPlotData() instead."))}return __extends(c,b),c.prototype._anchor=function(c,d){var e=this;b.prototype._anchor.call(this,c,d),this._mouseDispatcher=a.Dispatcher.Mouse.getDispatcher(this._componentToListenTo._element.node()),this._mouseDispatcher.onMouseMove("hover"+this.getID(),function(a){return e._handlePointerEvent(a)}),this._touchDispatcher=a.Dispatcher.Touch.getDispatcher(this._componentToListenTo._element.node()),this._touchDispatcher.onTouchStart("hover"+this.getID(),function(a){return e._handlePointerEvent(a)})},c.prototype._handlePointerEvent=function(a){a=this._translateToComponentSpace(a),this._isInsideComponent(a)?(this._overComponent||this._componentToListenTo._hoverOverComponent(a),this.handleHoverOver(a),this._overComponent=!0):(this._componentToListenTo._hoverOutComponent(a),this.safeHoverOut(this._currentHoverData),this._currentHoverData={data:null,pixelPositions:null,selection:null},this._overComponent=!1)},c.diffHoverData=function(a,b){if(null==a.data||null==b.data)return a;var c=[],d=[],e=[];return a.data.forEach(function(f,g){-1===b.data.indexOf(f)&&(c.push(f),d.push(a.pixelPositions[g]),e.push(a.selection[0][g]))}),0===c.length?{data:null,pixelPositions:null,selection:null}:{data:c,pixelPositions:d,selection:d3.selectAll(e)}},c.prototype.handleHoverOver=function(a){var b=this._currentHoverData,d=this._componentToListenTo._doHover(a);this._currentHoverData=d;var e=c.diffHoverData(b,d);this.safeHoverOut(e);var f=c.diffHoverData(d,b);this.safeHoverOver(f)},c.prototype.safeHoverOut=function(a){this._hoverOutCallback&&a.data&&this._hoverOutCallback(a)},c.prototype.safeHoverOver=function(a){this._hoverOverCallback&&a.data&&this._hoverOverCallback(a)},c.prototype.onHoverOver=function(a){return this._hoverOverCallback=a,this},c.prototype.onHoverOut=function(a){return this._hoverOutCallback=a,this},c.prototype.getCurrentHoverData=function(){return this._currentHoverData},c.warned=!1,c}(b.AbstractInteraction);b.Hover=c}(b=a.Interaction||(a.Interaction={}))}(Plottable||(Plottable={}));var SVGTypewriter;!function(a){!function(a){!function(a){function b(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;c0&&"\n"===b[0]?"\n":"";if(g>=c){var i=g/3,j=Math.floor(c/i);return{wrappedToken:h+"...".substr(0,j),remainingToken:b}}for(;f+g>c;)e=a.Utils.StringMethods.trimEnd(e.substr(0,e.length-1)),f=d.measure(e).width;return{wrappedToken:h+e+"...",remainingToken:a.Utils.StringMethods.trimEnd(b.substring(e.length),"-").trim()}},b.prototype.wrapNextToken=function(b,c,d){if(!c.canFitText||c.availableLines===c.wrapping.noLines||!this.canFitToken(b,c.availableWidth,d))return this.finishWrapping(b,c,d);for(var e=b;e;){var f=this.breakTokenToFitInWidth(e,c.currentLine,c.availableWidth,d);if(c.currentLine=f.line,e=f.remainingToken,null!=e){if(c.wrapping.noBrokeWords+=+f.breakWord,++c.wrapping.noLines,c.availableLines===c.wrapping.noLines){var g=this.addEllipsis(c.currentLine,c.availableWidth,d);return c.wrapping.wrappedText+=g.wrappedToken,c.wrapping.truncatedText+=g.remainingToken+e,c.currentLine="\n",c}c.wrapping.wrappedText+=a.Utils.StringMethods.trimEnd(c.currentLine),c.currentLine="\n"}}return c},b.prototype.finishWrapping=function(a,b,c){if(b.canFitText&&b.availableLines!==b.wrapping.noLines&&this._allowBreakingWords&&"none"!==this._textTrimming){var d=this.addEllipsis(b.currentLine+a,b.availableWidth,c);b.wrapping.wrappedText+=d.wrappedToken,b.wrapping.truncatedText+=d.remainingToken,b.wrapping.noBrokeWords+=+(d.remainingToken.length0),b.currentLine=""}else b.wrapping.truncatedText+=a;return b.canFitText=!1,b},b.prototype.breakTokenToFitInWidth=function(a,b,c,d,e){if(void 0===e&&(e=this._breakingCharacter),d.measure(b+a).width<=c)return{remainingToken:null,line:b+a,breakWord:!1};if(""===a.trim())return{remainingToken:"",line:b,breakWord:!1};if(!this._allowBreakingWords)return{remainingToken:a,line:b,breakWord:!1};for(var f=0;f0&&(g=e),{remainingToken:a.substring(f),line:b+a.substring(0,f)+g,breakWord:f>0}},b}();b.Wrapper=c}(a.Wrappers||(a.Wrappers={}));a.Wrappers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype.wrap=function(c,d,e,f){var g=this;void 0===f&&(f=1/0);var h=c.split("\n");if(h.length>1)throw new Error("SingleLineWrapper is designed to work only on single line");var i=function(b){return a.prototype.wrap.call(g,c,d,b,f)},j=i(e);if(j.noLines<2)return j;for(var k=0,l=e,m=0;mk;++m){var n=(l+k)/2,o=i(n);this.areSameResults(j,o)?(l=n,j=o):k=n}return j},b.prototype.areSameResults=function(a,b){return a.noLines===b.noLines&&a.truncatedText===b.truncatedText},b.NO_WRAP_ITERATIONS=5,b}(a.Wrapper);a.SingleLineWrapper=b}(a.Wrappers||(a.Wrappers={}));a.Wrappers}(SVGTypewriter||(SVGTypewriter={}));var SVGTypewriter;!function(a){!function(b){var c=function(){function b(a,c){this._writerID=b.nextID++,this._elementID=0,this.measurer(a),c&&this.wrapper(c),this.addTitleElement(!1)}return b.prototype.measurer=function(a){return this._measurer=a,this},b.prototype.wrapper=function(a){return this._wrapper=a,this},b.prototype.addTitleElement=function(a){return this._addTitleElement=a,this},b.prototype.writeLine=function(c,d,e,f,g){var h=d.append("text");h.text(c);var i=e*b.XOffsetFactor[f],j=b.AnchorConverter[f];h.attr("text-anchor",j).classed("text-line",!0),a.Utils.DOM.transform(h,i,g).attr("y","-0.25em")},b.prototype.writeText=function(a,c,d,e,f,g){var h=this,i=a.split("\n"),j=this._measurer.measure().height,k=b.YOffsetFactor[g]*(e-i.length*j);i.forEach(function(a,b){h.writeLine(a,c,d,f,(b+1)*j+k)})},b.prototype.write=function(a,c,d,e){if(-1===b.SupportedRotation.indexOf(e.textRotation))throw new Error("unsupported rotation - "+e.textRotation);var f=Math.abs(Math.abs(e.textRotation)-90)>45,g=f?c:d,h=f?d:c,i=e.selection.append("g").classed("text-container",!0);this._addTitleElement&&i.append("title").text(a);var j=i.append("g").classed("text-area",!0),k=this._wrapper?this._wrapper.wrap(a,this._measurer,g,h).wrappedText:a;this.writeText(k,j,g,h,e.xAlign,e.yAlign);var l=d3.transform(""),m=d3.transform("");switch(l.rotate=e.textRotation,e.textRotation){case 90:l.translate=[c,0],m.rotate=-90,m.translate=[0,200];break;case-90:l.translate=[0,d],m.rotate=90,m.translate=[c,0];break;case 180:l.translate=[c,d],m.translate=[c,d],m.rotate=180}j.attr("transform",l.toString()),this.addClipPath(i,m),e.animator&&e.animator.animate(i)},b.prototype.addClipPath=function(b){var c=this._elementID++,d=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;d=d.split("#")[0];var e="clipPath"+this._writerID+"_"+c;b.select(".text-area").attr("clip-path",'url("'+d+"#"+e+'")');var f=b.append("clipPath").attr("id",e),g=a.Utils.DOM.getBBox(b.select(".text-area")),h=f.append("rect");h.classed("clip-rect",!0).attr(g)},b.nextID=0,b.SupportedRotation=[-90,0,180,90],b.AnchorConverter={left:"start",center:"middle",right:"end"},b.XOffsetFactor={left:0,center:.5,right:1},b.YOffsetFactor={top:0,center:.5,bottom:1},b}();b.Writer=c}(a.Writers||(a.Writers={}));a.Writers}(SVGTypewriter||(SVGTypewriter={}));var SVGTypewriter;!function(a){!function(b){var c=function(){function b(a,b){this.textMeasurer=this.getTextMeasurer(a,b)}return b.prototype.checkSelectionIsText=function(a){return"text"===a[0][0].tagName||!a.select("text").empty()},b.prototype.getTextMeasurer=function(a,b){var c=this;if(this.checkSelectionIsText(a)){var d,e=a.node().parentNode;return d="text"===a[0][0].tagName?a:a.select("text"),a.remove(),function(b){e.appendChild(a.node());var f=c.measureBBox(d,b);return a.remove(),f}}var f=a.append("text");return b&&f.classed(b,!0),f.remove(),function(b){a.node().appendChild(f.node());var d=c.measureBBox(f,b);return f.remove(),d}},b.prototype.measureBBox=function(b,c){b.text(c);var d=a.Utils.DOM.getBBox(b);return{width:d.width,height:d.height}},b.prototype.measure=function(a){return void 0===a&&(a=b.HEIGHT_TEXT),this.textMeasurer(a)},b.HEIGHT_TEXT="bqpdl",b}();b.AbstractMeasurer=c}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(a){var b=function(b){function c(a,c,d){void 0===c&&(c=null),void 0===d&&(d=!1),b.call(this,a,c),this.useGuards=d}return __extends(c,b),c.prototype._addGuards=function(b){return a.AbstractMeasurer.HEIGHT_TEXT+b+a.AbstractMeasurer.HEIGHT_TEXT},c.prototype.getGuardWidth=function(){return null==this.guardWidth&&(this.guardWidth=b.prototype.measure.call(this).width),this.guardWidth},c.prototype._measureLine=function(a){var c=this.useGuards?this._addGuards(a):a,d=b.prototype.measure.call(this,c);return d.width-=this.useGuards?2*this.getGuardWidth():0,d},c.prototype.measure=function(b){var c=this;if(void 0===b&&(b=a.AbstractMeasurer.HEIGHT_TEXT),""===b.trim())return{width:0,height:0};var d=b.trim().split("\n").map(function(a){return c._measureLine(a)});return{width:d3.max(d,function(a){return a.width}),height:d3.sum(d,function(a){return a.height})}},c}(a.AbstractMeasurer);a.Measurer=b}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._measureCharacter=function(b){return a.prototype._measureLine.call(this,b)},b.prototype._measureLine=function(a){var b=this,c=a.split("").map(function(a){return b._measureCharacter(a)});return{width:d3.sum(c,function(a){return a.width}),height:d3.max(c,function(a){return a.height})}},b}(a.Measurer);a.CharacterMeasurer=b}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(b){var c=function(b){function c(c,d){var e=this;b.call(this,c,d),this.cache=new a.Utils.Cache(function(a){return e._measureCharacterNotFromCache(a)},a.Utils.Methods.objEq)}return __extends(c,b),c.prototype._measureCharacterNotFromCache=function(a){return b.prototype._measureCharacter.call(this,a)},c.prototype._measureCharacter=function(a){return this.cache.get(a)},c.prototype.reset=function(){this.cache.clear()},c}(b.CharacterMeasurer);b.CacheCharacterMeasurer=c}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));
\ No newline at end of file
+var Plottable;!function(a){var b;!function(b){var c;!function(c){function d(a,b,c){return Math.min(b,c)<=a&&a<=Math.max(b,c)}function e(b){a.Config.SHOW_WARNINGS&&null!=window.console&&(null!=window.console.warn?console.warn(b):null!=window.console.log&&console.log(b))}function f(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 g(a,b){var c=d3.set();return a.forEach(function(a){b.has(a)&&c.add(a)}),c}function h(a){return"function"==typeof a?a:"string"==typeof a&&"#"!==a[0]?function(b){return b[a]}:function(){return a}}function i(a,b){var c=d3.set();return a.forEach(function(a){return c.add(a)}),b.forEach(function(a){return c.add(a)}),c}function j(a,b){var c=d3.map();return a.forEach(function(a,d){c.set(a,b(a,d))}),c}function k(a){var b=d3.set(),c=[];return a.forEach(function(a){b.has(a)||(b.add(a),c.push(a))}),c}function l(a,b){for(var c=[],d=0;b>d;d++)c[d]="function"==typeof a?a(d):a;return c}function m(a){return Array.prototype.concat.apply([],a)}function n(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;cf;++f)e[f]=a+c*f;return e}function t(a,b){for(var c=[],d=2;db?"0"+c:c});if(4===d.length&&"00"===d[3])return null;var e="#"+d.join("");return a.classed(b,!1),e}function v(a,b){var c=d3.hsl(a).brighter(b);return c.rgb().toString()}function w(a,c,d){var e=parseInt(a.substring(1,3),16),f=parseInt(a.substring(3,5),16),g=parseInt(a.substring(5,7),16),h=b.Color.rgbToHsl(e,f,g),i=Math.max(h[2]-d*c,0),j=b.Color.hslToRgb(h[0],h[1],i),k=j[0].toString(16),l=j[1].toString(16),m=j[2].toString(16);return k=k.length<2?"0"+k:k,l=l.length<2?"0"+l:l,m=m.length<2?"0"+m:m,"#"+k+l+m}function x(a,b){return Math.pow(b.y-a.y,2)+Math.pow(b.x-a.x,2)}function y(){var a=window.navigator.userAgent;return a.indexOf("MSIE ")>-1||a.indexOf("Trident/")>-1}c.inRange=d,c.warn=e,c.addArrays=f,c.intersection=g,c.accessorize=h,c.union=i,c.populateMap=j,c.uniq=k,c.createFilledArray=l,c.flatten=m,c.arrayEq=n,c.objEq=o,c.max=p,c.min=q,c.copyMap=r,c.range=s,c.setTimeout=t,c.colorTest=u,c.lightenColor=v,c.darkenColor=w,c.distanceSquared=x,c.isIE=y}(c=b.Methods||(b.Methods={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b;!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}(b=a.OpenSource||(a.OpenSource={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!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}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){this._keyValuePairs=[]}return a.prototype.set=function(a,b){if(a!==a)throw new Error("NaN may not be used as a key to the StrictEqualityAssociativeArray");for(var c=0;cb.right?!1:a.bottomb.bottom?!1:!0}function k(a,b){return Math.floor(b.left)<=Math.ceil(a.left)&&Math.floor(b.top)<=Math.ceil(a.top)&&Math.floor(a.right)<=Math.ceil(b.right)&&Math.floor(a.bottom)<=Math.ceil(b.bottom)}function l(a){var b=a.ownerSVGElement;return null!=b?b:"svg"===a.nodeName.toLowerCase()?a:null}a.getBBox=b,a.POLYFILL_TIMEOUT_MSEC=1e3/60,a.requestAnimationFramePolyfill=c,a.isSelectionRemovedFromSVG=e,a.getElementWidth=f,a.getElementHeight=g,a.getSVGPixelWidth=h,a.translate=i,a.boxesOverlap=j,a.boxIsInside=k,a.getBoundingSVG=l}(b=a.DOM||(a.DOM={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b;!function(a){function b(a){var b=d3.rgb(a),c=function(a){return a/=255,.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)},d=c(b.r),e=c(b.g),f=c(b.b);return.2126*d+.7152*e+.0722*f}function c(a,c){var d=b(a)+.05,e=b(c)+.05;return d>e?d/e:e/d}function d(a,b,c){a/=255,b/=255,c/=255;var d,e,f=Math.max(a,b,c),g=Math.min(a,b,c),h=(f+g)/2;if(f===g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return[d,e,h]}function e(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return[Math.round(255*e),Math.round(255*f),Math.round(255*g)]}a.contrast=c,a.rgbToHsl=d,a.hslToRgb=e}(b=a.Color||(a.Color={}))}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){a.MILLISECONDS_IN_ONE_DAY=864e5;var b;!function(b){function c(a,c,d){void 0===a&&(a=2),void 0===c&&(c="$"),void 0===d&&(d=!0);var e=b.fixed(a);return function(a){var b=e(Math.abs(a));return""!==b&&(d?b=c+b:b+=c,0>a&&(b="-"+b)),b}}function d(a){return void 0===a&&(a=3),l(a),function(b){return b.toFixed(a)}}function e(a){return void 0===a&&(a=3),l(a),function(b){if("number"==typeof b){var c=Math.pow(10,a);return String(Math.round(b*c)/c)}return String(b)}}function f(){return function(a){return String(a)}}function g(a){void 0===a&&(a=0);var c=b.fixed(a);return function(a){var b=100*a,d=a.toString(),e=Math.pow(10,d.length-(d.indexOf(".")+1));return b=parseInt((b*e).toString(),10)/e,c(b)+"%"}}function h(a){return void 0===a&&(a=3),l(a),function(b){return d3.format("."+a+"s")(b)}}function i(){var a=8,b={};return b[0]={format:".%L",filter:function(a){return 0!==a.getMilliseconds()}},b[1]={format:":%S",filter:function(a){return 0!==a.getSeconds()}},b[2]={format:"%I:%M",filter:function(a){return 0!==a.getMinutes()}},b[3]={format:"%I %p",filter:function(a){return 0!==a.getHours()}},b[4]={format:"%a %d",filter:function(a){return 0!==a.getDay()&&1!==a.getDate()}},b[5]={format:"%b %d",filter:function(a){return 1!==a.getDate()}},b[6]={format:"%b",filter:function(a){return 0!==a.getMonth()}},b[7]={format:"%Y",filter:function(){return!0}},function(c){for(var d=0;a>d;d++)if(b[d].filter(c))return d3.time.format(b[d].format)(c)}}function j(a){return d3.time.format(a)}function k(b,c,d){return void 0===b&&(b=0),void 0===c&&(c=a.MILLISECONDS_IN_ONE_DAY),void 0===d&&(d=""),function(a){var e=Math.round((a.valueOf()-b)/c);return e.toString()+d}}function l(a){if(0>a||a>20)throw new RangeError("Formatter precision must be between 0 and 20")}b.currency=c,b.fixed=d,b.general=e,b.identity=f,b.percentage=g,b.siSuffix=h,b.multiTime=i,b.time=j,b.relativeDate=k}(b=a.Formatters||(a.Formatters={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){function b(){return function(a){return d3.svg.symbol().type("circle").size(Math.PI*Math.pow(a/2,2))()}}function c(){return function(a){return d3.svg.symbol().type("square").size(Math.pow(a,2))()}}function d(){return function(a){return d3.svg.symbol().type("cross").size(5/9*Math.pow(a,2))()}}function e(){return function(a){return d3.svg.symbol().type("diamond").size(Math.tan(Math.PI/6)*Math.pow(a,2)/2)()}}function f(){return function(a){return d3.svg.symbol().type("triangle-up").size(Math.sqrt(3)*Math.pow(a/2,2))()}}function g(){return function(a){return d3.svg.symbol().type("triangle-down").size(Math.sqrt(3)*Math.pow(a/2,2))()}}a.circle=b,a.square=c,a.cross=d,a.diamond=e,a.triangleUp=f,a.triangleDown=g}(b=a.SymbolFactories||(a.SymbolFactories={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function b(a){this._svg=a,this._measureRect=document.createElementNS(a.namespaceURI,"rect"),this._measureRect.setAttribute("class","measure-rect"),this._measureRect.setAttribute("style","opacity: 0; visibility: hidden;"),this._measureRect.setAttribute("width","1"),this._measureRect.setAttribute("height","1"),this._svg.appendChild(this._measureRect)}return b.getTranslator=function(c){var d=a.DOM.getBoundingSVG(c),e=d[b._TRANSLATOR_KEY];return null==e&&(e=new b(d),d[b._TRANSLATOR_KEY]=e),e},b.prototype.computePosition=function(a,b){this._measureRect.setAttribute("x","0"),this._measureRect.setAttribute("y","0");var c=this._measureRect.getBoundingClientRect(),d={x:c.left,y:c.top},e=100;this._measureRect.setAttribute("x",String(e)),this._measureRect.setAttribute("y",String(e)),c=this._measureRect.getBoundingClientRect();var f={x:c.left,y:c.top};if(d.x===f.x||d.y===f.y)return null;var g=(f.x-d.x)/e,h=(f.y-d.y)/e;this._measureRect.setAttribute("x",String((a-d.x)/g)),this._measureRect.setAttribute("y",String((b-d.y)/h)),c=this._measureRect.getBoundingClientRect();var i={x:c.left,y:c.top},j={x:(i.x-d.x)/g,y:(i.y-d.y)/h};return j},b._TRANSLATOR_KEY="__Plottable_ClientToSVGTranslator",b}();a.ClientToSVGTranslator=b}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){a.SHOW_WARNINGS=!0}(b=a.Config||(a.Config={}))}(Plottable||(Plottable={}));var Plottable;!function(a){a.version="0.51.0"}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){}return a.CORAL_RED="#fd373e",a.INDIGO="#5279c7",a.ROBINS_EGG_BLUE="#06cccc",a.FERN="#63c261",a.BURNING_ORANGE="#ff7939",a.ROYAL_HEATH="#962565",a.CONIFER="#99ce50",a.CERISE_RED="#db2e65",a.BRIGHT_SUN="#fad419",a.JACARTA="#2c2b6f",a.PLOTTABLE_COLORS=[a.INDIGO,a.CORAL_RED,a.FERN,a.BRIGHT_SUN,a.JACARTA,a.BURNING_ORANGE,a.CERISE_RED,a.CONIFER,a.ROYAL_HEATH,a.ROBINS_EGG_BLUE],a}();a.Colors=b}(b=a.Core||(a.Core={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){this._plottableID=a._nextID++}return a.prototype.getID=function(){return this._plottableID},a._nextID=0,a}();a.PlottableObject=b}(b=a.Core||(a.Core={}))}(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){var b;!function(b){var c=function(b){function c(c){b.call(this),this._key2callback=new a._Util.StrictEqualityAssociativeArray,this._listenable=c}return __extends(c,b),c.prototype.registerListener=function(a,b){return this._key2callback.set(a,b),this},c.prototype.broadcast=function(){for(var a=this,b=[],c=0;c0){var f=d.valueOf();return d instanceof Date?[f-b._ONE_DAY,f+b._ONE_DAY]:[f-b._PADDING_FOR_IDENTICAL_DOMAIN,f+b._PADDING_FOR_IDENTICAL_DOMAIN]}var g=a.domain();if(g[0].valueOf()===g[1].valueOf())return c;var h=this._padProportion/2,i=a.invert(a.scale(d)-(a.scale(e)-a.scale(d))*h),j=a.invert(a.scale(e)+(a.scale(e)-a.scale(d))*h),k=this._paddingExceptions.values().concat(this._unregisteredPaddingExceptions.values()),l=d3.set(k);return l.has(d)&&(i=d),l.has(e)&&(j=e),[i,j]},b.prototype._niceDomain=function(a,b){return this._doNice?a._niceDomain(b,this._niceCount):b},b.prototype._includeDomain=function(a){var b=this._includedValues.values().concat(this._unregisteredIncludedValues.values());return b.reduce(function(a,b){return[Math.min(a[0],b),Math.max(a[1],b)]},a)},b._PADDING_FOR_IDENTICAL_DOMAIN=1,b._ONE_DAY=864e5,b}();a.Domainer=b}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(b){var c=function(b){function c(c){b.call(this),this._autoDomainAutomatically=!0,this._rendererAttrID2Extent={},this._typeCoercer=function(a){return a},this._domainModificationInProgress=!1,this._d3Scale=c,this.broadcaster=new a.Core.Broadcaster(this)}return __extends(c,b),c.prototype._getAllExtents=function(){return d3.values(this._rendererAttrID2Extent)},c.prototype._getExtent=function(){return[]},c.prototype.autoDomain=function(){return this._autoDomainAutomatically=!0,this._setDomain(this._getExtent()),this},c.prototype._autoDomainIfAutomaticMode=function(){this._autoDomainAutomatically&&this.autoDomain()},c.prototype.scale=function(a){return this._d3Scale(a)},c.prototype.domain=function(a){return null==a?this._getDomain():(this._autoDomainAutomatically=!1,this._setDomain(a),this)},c.prototype._getDomain=function(){return this._d3Scale.domain()},c.prototype._setDomain=function(a){this._domainModificationInProgress||(this._domainModificationInProgress=!0,this._d3Scale.domain(a),this.broadcaster.broadcast(),this._domainModificationInProgress=!1)},c.prototype.range=function(a){return null==a?this._d3Scale.range():(this._d3Scale.range(a),this)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype._updateExtent=function(a,b,c){return this._rendererAttrID2Extent[a+b]=c,this._autoDomainIfAutomaticMode(),this},c.prototype._removeExtent=function(a,b){return delete this._rendererAttrID2Extent[a+b],this._autoDomainIfAutomaticMode(),this},c}(a.Core.PlottableObject);b.AbstractScale=c}(b=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){var b;!function(b){var c=function(b){function c(c){b.call(this,c),this._numTicks=10,this._PADDING_FOR_IDENTICAL_DOMAIN=1,this._userSetDomainer=!1,this._domainer=new a.Domainer,this._typeCoercer=function(a){return+a},this._tickGenerator=function(a){return a.getDefaultTicks()}}return __extends(c,b),c.prototype._getExtent=function(){return this._domainer.computeDomain(this._getAllExtents(),this)},c.prototype.invert=function(a){return this._d3Scale.invert(a)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype._setDomain=function(c){var d=function(a){return a!==a||1/0===a||a===-1/0};return d(c[0])||d(c[1])?void a._Util.Methods.warn("Warning: QuantitativeScales cannot take NaN or Infinity as a domain value. Ignoring."):void b.prototype._setDomain.call(this,c)},c.prototype.interpolate=function(a){return null==a?this._d3Scale.interpolate():(this._d3Scale.interpolate(a),this)},c.prototype.rangeRound=function(a){return this._d3Scale.rangeRound(a),this},c.prototype.getDefaultTicks=function(){return this._d3Scale.ticks(this.numTicks())},c.prototype.clamp=function(a){return null==a?this._d3Scale.clamp():(this._d3Scale.clamp(a),this)},c.prototype.ticks=function(){return this._tickGenerator(this)},c.prototype.numTicks=function(a){return null==a?this._numTicks:(this._numTicks=a,this)},c.prototype._niceDomain=function(a,b){return this._d3Scale.copy().domain(a).nice(b).domain()},c.prototype.domainer=function(a){return null==a?this._domainer:(this._domainer=a,this._userSetDomainer=!0,this._autoDomainIfAutomaticMode(),this)},c.prototype._defaultExtent=function(){return[0,1]},c.prototype.tickGenerator=function(a){return null==a?this._tickGenerator:(this._tickGenerator=a,this)},c}(b.AbstractScale);b.AbstractQuantitative=c}(b=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){var b;!function(a){var b=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.AbstractQuantitative);a.Linear=b}(b=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){var b;!function(b){var c=function(b){function c(d){b.call(this,null==d?d3.scale.log():d),c.warned||(c.warned=!0,a._Util.Methods.warn("Plottable.Scale.Log is deprecated. If possible, use Plottable.Scale.ModifiedLog instead."))}return __extends(c,b),c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype._defaultExtent=function(){return[1,10]},c.warned=!1,c}(b.AbstractQuantitative);b.Log=c}(b=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){var b;!function(b){var c=function(b){function c(a){if(void 0===a&&(a=10),b.call(this,d3.scale.linear()),this._showIntermediateTicks=!1,this.base=a,this.pivot=this.base,this.untransformedDomain=this._defaultExtent(),this.numTicks(10),1>=a)throw new Error("ModifiedLogScale: The base must be > 1")}return __extends(c,b),c.prototype.adjustedLog=function(a){var b=0>a?-1:1;return a*=b,aa?-1:1;return a*=b,a=Math.pow(this.base,a),a=d&&e>=a}),m=j.concat(l).concat(k);return m.length<=1&&(m=d3.scale.linear().domain([d,e]).ticks(b)),m},c.prototype.logTicks=function(b,c){var d=this,e=this.howManyTicks(b,c);if(0===e)return[];var f=Math.floor(Math.log(b)/Math.log(this.base)),g=Math.ceil(Math.log(c)/Math.log(this.base)),h=d3.range(g,f,-Math.ceil((g-f)/e)),i=this._showIntermediateTicks?Math.floor(e/h.length):1,j=d3.range(this.base,1,-(this.base-1)/i).map(Math.floor),k=a._Util.Methods.uniq(j),l=h.map(function(a){return k.map(function(b){return Math.pow(d.base,a-1)*b})}),m=a._Util.Methods.flatten(l),n=m.filter(function(a){return a>=b&&c>=a}),o=n.sort(function(a,b){return a-b});return o},c.prototype.howManyTicks=function(b,c){var d=this.adjustedLog(a._Util.Methods.min(this.untransformedDomain,0)),e=this.adjustedLog(a._Util.Methods.max(this.untransformedDomain,0)),f=this.adjustedLog(b),g=this.adjustedLog(c),h=(g-f)/(e-d),i=Math.ceil(h*this.numTicks());return i},c.prototype.copy=function(){return new c(this.base)},c.prototype._niceDomain=function(a){return a},c.prototype.showIntermediateTicks=function(a){return null==a?this._showIntermediateTicks:void(this._showIntermediateTicks=a)},c}(b.AbstractQuantitative);b.ModifiedLog=c}(b=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){var b;!function(b){var c=function(b){function c(a){void 0===a&&(a=d3.scale.ordinal()),b.call(this,a),this._range=[0,1],this._typeCoercer=function(a){return null!=a&&a.toString?a.toString():a};var d=.3;this._innerPadding=c._convertToPlottableInnerPadding(d),this._outerPadding=c._convertToPlottableOuterPadding(.5,d)}return __extends(c,b),c.prototype._getExtent=function(){var b=this._getAllExtents();return a._Util.Methods.uniq(a._Util.Methods.flatten(b))},c.prototype.domain=function(a){return b.prototype.domain.call(this,a)},c.prototype._setDomain=function(a){b.prototype._setDomain.call(this,a),this.range(this.range())},c.prototype.range=function(a){if(null==a)return this._range;this._range=a;var b=1-1/(1+this.innerPadding()),c=this.outerPadding()/(1+this.innerPadding());return this._d3Scale.rangeBands(a,b,c),this},c._convertToPlottableInnerPadding=function(a){return 1/(1-a)-1},c._convertToPlottableOuterPadding=function(a,b){return a/(1-b)},c.prototype.rangeBand=function(){return this._d3Scale.rangeBand()},c.prototype.stepWidth=function(){return this.rangeBand()*(1+this.innerPadding())},c.prototype.innerPadding=function(a){return null==a?this._innerPadding:(this._innerPadding=a,this.range(this.range()),this.broadcaster.broadcast(),this)},c.prototype.outerPadding=function(a){return null==a?this._outerPadding:(this._outerPadding=a,this.range(this.range()),this.broadcaster.broadcast(),this)},c.prototype.copy=function(){return new c(this._d3Scale.copy())},c.prototype.scale=function(a){return b.prototype.scale.call(this,a)+this.rangeBand()/2},c}(b.AbstractScale);b.Category=c}(b=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){var b;!function(b){var c=function(b){function c(a){var d;switch(a){case null:case void 0:d=d3.scale.ordinal().range(c._getPlottableColors());break;case"Category10":case"category10":case"10":d=d3.scale.category10();break;case"Category20":case"category20":case"20":d=d3.scale.category20();break;case"Category20b":case"category20b":case"20b":d=d3.scale.category20b();break;case"Category20c":case"category20c":case"20c":d=d3.scale.category20c();break;default:throw new Error("Unsupported ColorScale type")}b.call(this,d)}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._getPlottableColors=function(){for(var b,c=[],d=d3.select("body").append("div"),e=0;null!==(b=a._Util.Methods.colorTest(d,"plottable-colors-"+e));)c.push(b),e++;return d.remove(),c},c.prototype.scale=function(d){var e=b.prototype.scale.call(this,d),f=this.domain().indexOf(d),g=Math.floor(f/this.range().length),h=Math.log(g*c.LOOP_LIGHTEN_FACTOR+1);return a._Util.Methods.lightenColor(e,h)},c.HEX_SCALE_FACTOR=20,c.LOOP_LIGHTEN_FACTOR=1.6,c}(b.AbstractScale);b.Color=c}(b=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){var b;!function(b){var c=function(b){function c(a){b.call(this,null==a?d3.time.scale():a),this._typeCoercer=function(a){return a&&a._isAMomentObject||a instanceof Date?a:new Date(a)}}return __extends(c,b),c.prototype.tickInterval=function(a,b){var c=d3.time.scale();return c.domain(this.domain()),c.range(this.range()),c.ticks(a.range,b)},c.prototype._setDomain=function(a){if(a=a.map(this._typeCoercer),a[1]0&&this._setDomain([a._Util.Methods.min(b,function(a){return a[0]},0),a._Util.Methods.max(b,function(a){return a[1]},0)]),this},c._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"]},c}(b.AbstractScale);b.InterpolatedColor=c}(b=a.Scale||(a.Scale={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(a){var b=this;if(this._rescaleInProgress=!1,null==a)throw new Error("ScaleDomainCoordinator requires scales to coordinate");this._scales=a,this._scales.forEach(function(a){return a.broadcaster.registerListener(b,function(a){return b.rescale(a)})})}return a.prototype.rescale=function(a){if(!this._rescaleInProgress){this._rescaleInProgress=!0;var b=a.domain();this._scales.forEach(function(a){return a.domain(b)}),this._rescaleInProgress=!1}},a}();a.ScaleDomainCoordinator=b}(b=a._Util||(a._Util={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(b){var c;!function(b){function c(b){if(0>=b)throw new Error("interval must be positive number");return function(c){var d=c.domain(),e=Math.min(d[0],d[1]),f=Math.max(d[0],d[1]),g=Math.ceil(e/b)*b,h=Math.floor((f-g)/b)+1,i=e%b===0?[]:[e],j=a._Util.Methods.range(0,h).map(function(a){return g+a*b}),k=f%b===0?[]:[f];return i.concat(j).concat(k)}}function d(){return function(a){var b=a.getDefaultTicks();return b.filter(function(a,c){return a%1===0||0===c||c===b.length-1})}}b.intervalTickGenerator=c,b.integerTickGenerator=d}(c=b.TickGenerators||(b.TickGenerators={}))}(b=a.Scale||(a.Scale={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(b){var c=function(){function b(a){this.key=a}return b.prototype.setClass=function(a){return this._className=a,this},b.prototype.setup=function(a){this._renderArea=a},b.prototype.remove=function(){null!=this._getRenderArea()&&this._getRenderArea().remove()},b.prototype._enterData=function(){},b.prototype._drawStep=function(){},b.prototype._numberOfAnimationIterations=function(a){return a.length},b.prototype._applyMetadata=function(a,b,c){var d={};return d3.keys(a).forEach(function(e){d[e]=function(d,f){return a[e](d,f,b,c)}}),d},b.prototype._prepareDrawSteps=function(){},b.prototype._prepareData=function(a){return a},b.prototype.draw=function(b,c,d,e){var f=this,g=c.map(function(b){var c=f._applyMetadata(b.attrToProjector,d,e);return f._attrToProjector=a._Util.Methods.copyMap(c),{attrToProjector:c,animator:b.animator}}),h=this._prepareData(b,g);this._prepareDrawSteps(g),this._enterData(h);var i=this._numberOfAnimationIterations(h),j=0;return g.forEach(function(b){a._Util.Methods.setTimeout(function(){return f._drawStep(b)},j),j+=b.animator.getTiming(i)}),j},b.prototype._getRenderArea=function(){return this._renderArea},b.prototype._getSelector=function(){return""},b.prototype._getPixelPoint=function(){return null},b.prototype._getSelection=function(a){var b=this._getRenderArea().selectAll(this._getSelector());return d3.select(b[0][a])},b}();b.AbstractDrawer=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments)}return __extends(c,b),c.prototype._enterData=function(a){b.prototype._enterData.call(this,a),this._pathSelection.datum(a)},c.prototype.setup=function(a){this._pathSelection=a.append("path").classed(c.LINE_CLASS,!0).style({fill:"none","vector-effect":"non-scaling-stroke"}),b.prototype.setup.call(this,a)},c.prototype._createLine=function(a,b,c){return c||(c=function(){return!0}),d3.svg.line().x(a).y(b).defined(c)},c.prototype._numberOfAnimationIterations=function(){return 1},c.prototype._drawStep=function(d){var e=(b.prototype._drawStep.call(this,d),a._Util.Methods.copyMap(d.attrToProjector)),f=e.defined,g=e.x,h=e.y;delete e.x,delete e.y,e.defined&&delete e.defined,e.d=this._createLine(g,h,f),e.fill&&this._pathSelection.attr("fill",e.fill),e["class"]&&(this._pathSelection.attr("class",e["class"]),this._pathSelection.classed(c.LINE_CLASS,!0),delete e["class"]),d.animator.animate(this._pathSelection,e)},c.prototype._getSelector=function(){return"."+c.LINE_CLASS},c.prototype._getPixelPoint=function(a,b){return{x:this._attrToProjector.x(a,b),y:this._attrToProjector.y(a,b)}},c.prototype._getSelection=function(){return this._getRenderArea().select(this._getSelector())},c.LINE_CLASS="line",c}(b.AbstractDrawer);b.Line=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(c){function d(){c.apply(this,arguments),this._drawLine=!0}return __extends(d,c),d.prototype._enterData=function(a){this._drawLine?c.prototype._enterData.call(this,a):b.AbstractDrawer.prototype._enterData.call(this,a),this._areaSelection.datum(a)},d.prototype.drawLine=function(a){return this._drawLine=a,this},d.prototype.setup=function(a){this._areaSelection=a.append("path").classed(d.AREA_CLASS,!0).style({stroke:"none"}),this._drawLine?c.prototype.setup.call(this,a):b.AbstractDrawer.prototype.setup.call(this,a)},d.prototype._createArea=function(a,b,c,d){return d||(d=function(){return!0}),d3.svg.area().x(a).y0(b).y1(c).defined(d)},d.prototype._drawStep=function(e){this._drawLine?c.prototype._drawStep.call(this,e):b.AbstractDrawer.prototype._drawStep.call(this,e);var f=a._Util.Methods.copyMap(e.attrToProjector),g=f.x,h=f.y0,i=f.y,j=f.defined;delete f.x,delete f.y0,delete f.y,f.defined&&delete f.defined,f.d=this._createArea(g,h,i,j),f.fill&&this._areaSelection.attr("fill",f.fill),f["class"]&&(this._areaSelection.attr("class",f["class"]),this._areaSelection.classed(d.AREA_CLASS,!0),delete f["class"]),e.animator.animate(this._areaSelection,f)},d.prototype._getSelector=function(){return"path"},d.AREA_CLASS="area",d}(b.Line);b.Area=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype.svgElement=function(a){return this._svgElement=a,this},b.prototype._getDrawSelection=function(){return this._getRenderArea().selectAll(this._svgElement)},b.prototype._drawStep=function(b){a.prototype._drawStep.call(this,b);var c=this._getDrawSelection();b.attrToProjector.fill&&c.attr("fill",b.attrToProjector.fill),b.animator.animate(c,b.attrToProjector)},b.prototype._enterData=function(b){a.prototype._enterData.call(this,b);var c=this._getDrawSelection().data(b);c.enter().append(this._svgElement),null!=this._className&&c.classed(this._className,!0),c.exit().remove()},b.prototype._filterDefinedData=function(a,b){return b?a.filter(b):a},b.prototype._prepareDrawSteps=function(b){a.prototype._prepareDrawSteps.call(this,b),b.forEach(function(a){a.attrToProjector.defined&&delete a.attrToProjector.defined})},b.prototype._prepareData=function(b,c){var d=this;return c.reduce(function(a,b){return d._filterDefinedData(a,b.attrToProjector.defined)},a.prototype._prepareData.call(this,b,c))},b.prototype._getSelector=function(){return this._svgElement},b}(a.AbstractDrawer);a.Element=b}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=5,d=5,e=function(b){function e(a,c){b.call(this,a),this._labelsTooWide=!1,this.svgElement("rect"),this._isVertical=c}return __extends(e,b),e.prototype.setup=function(a){b.prototype.setup.call(this,a.append("g").classed("bar-area",!0)),this._textArea=a.append("g").classed("bar-label-text-area",!0),this._measurer=new SVGTypewriter.Measurers.CacheCharacterMeasurer(this._textArea),this._writer=new SVGTypewriter.Writers.Writer(this._measurer)},e.prototype.removeLabels=function(){this._textArea.selectAll("g").remove()},e.prototype._getIfLabelsTooWide=function(){return this._labelsTooWide},e.prototype.drawText=function(b,e,f,g){var h=this,i=b.map(function(b,i){var j=e.label(b,i,f,g).toString(),k=e.width(b,i,f,g),l=e.height(b,i,f,g),m=e.x(b,i,f,g),n=e.y(b,i,f,g),o=e.positive(b,i,f,g),p=h._measurer.measure(j),q=e.fill(b,i,f,g),r=1.6*a._Util.Color.contrast("white",q)v;if(p.height<=l&&p.width<=k){var x=Math.min((s-t)/2,c);o||(x=-1*x),h._isVertical?n+=x:m+=x;var y=h._textArea.append("g").attr("transform","translate("+m+","+n+")"),z=r?"dark-label":"light-label";y.classed(z,!0);var A,B;h._isVertical?(A="center",B=o?"top":"bottom"):(A=o?"left":"right",B="center");var C={selection:y,xAlign:A,yAlign:B,textRotation:0};h._writer.write(j,k,l,C)}return w});this._labelsTooWide=i.some(function(a){return a})},e.prototype._getPixelPoint=function(a,b){var c=this._attrToProjector.x(a,b),d=this._attrToProjector.y(a,b),e=this._attrToProjector.width(a,b),f=this._attrToProjector.height(a,b),g=this._isVertical?c+e/2:c+e,h=this._isVertical?d:d+f/2;return{x:g,y:h}},e}(b.Element);b.Rect=e}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(a){b.call(this,a),this._svgElement="path"}return __extends(c,b),c.prototype._createArc=function(a,b){return d3.svg.arc().innerRadius(a).outerRadius(b)},c.prototype.retargetProjectors=function(a){var b={};return d3.entries(a).forEach(function(a){b[a.key]=function(b,c){return a.value(b.data,c)}}),b},c.prototype._drawStep=function(c){var d=a._Util.Methods.copyMap(c.attrToProjector);d=this.retargetProjectors(d),this._attrToProjector=this.retargetProjectors(this._attrToProjector);var e=d["inner-radius"],f=d["outer-radius"];return delete d["inner-radius"],delete d["outer-radius"],d.d=this._createArc(e,f),b.prototype._drawStep.call(this,{attrToProjector:d,animator:c.animator})},c.prototype.draw=function(c,d,e,f){var g=function(a,b){return d[0].attrToProjector.value(a,b,e,f)},h=d3.layout.pie().sort(null).value(g)(c);return d.forEach(function(a){return delete a.attrToProjector.value}),h.forEach(function(b){b.value<0&&a._Util.Methods.warn("Negative values will not render correctly in a pie chart.")}),b.prototype.draw.call(this,h,d,e,f)},c.prototype._getPixelPoint=function(a,b){var c=this._attrToProjector["inner-radius"],d=this._attrToProjector["outer-radius"],e=(c(a,b)+d(a,b))/2,f=+this._getSelection(b).datum().startAngle,g=+this._getSelection(b).datum().endAngle,h=(f+g)/2;return{x:e*Math.sin(h),y:-e*Math.cos(h)}},c}(b.Element);b.Arc=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(a){b.call(this,a),this._svgElement="path",this._className="symbol"}return __extends(c,b),c.prototype._drawStep=function(c){var d=c.attrToProjector;this._attrToProjector=a._Util.Methods.copyMap(c.attrToProjector);var e=d.x,f=d.y;delete d.x,delete d.y;var g=d.size;delete d.size,d.transform=function(a,b){return"translate("+e(a,b)+","+f(a,b)+")"};var h=d.symbol;delete d.symbol,d.d=d.d||function(a,b){return h(a,b)(g(a,b))},b.prototype._drawStep.call(this,c)},c.prototype._getPixelPoint=function(a,b){return{x:this._attrToProjector.x(a,b),y:this._attrToProjector.y(a,b)}},c}(b.Element);b.Symbol=c}(b=a._Drawer||(a._Drawer={}))}(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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this.clipPathEnabled=!1,this._xAlignProportion=0,this._yAlignProportion=0,this._fixedHeightFlag=!1,this._fixedWidthFlag=!1,this._isSetup=!1,this._isAnchored=!1,this._interactionsToRegister=[],this._boxes=[],this._isTopLevelComponent=!1,this._xOffset=0,this._yOffset=0,this._cssClasses=["component"],this._removed=!1,this._usedLastLayout=!1}return __extends(c,b),c.prototype._anchor=function(a){if(this._removed)throw new Error("Can't reuse remove()-ed components!");"svg"===a.node().nodeName.toLowerCase()&&(this._rootSVG=a,this._rootSVG.classed("plottable",!0),this._rootSVG.style("overflow","visible"),this._isTopLevelComponent=!0),null!=this._element?a.node().appendChild(this._element.node()):(this._element=a.append("g"),this._setup()),this._isAnchored=!0},c.prototype._setup=function(){var a=this;this._isSetup||(this._cssClasses.forEach(function(b){a._element.classed(b,!0)}),this._cssClasses=null,this._backgroundContainer=this._element.append("g").classed("background-container",!0),this._addBox("background-fill",this._backgroundContainer),this._content=this._element.append("g").classed("content",!0),this._foregroundContainer=this._element.append("g").classed("foreground-container",!0),this._boxContainer=this._element.append("g").classed("box-container",!0),this.clipPathEnabled&&this._generateClipPath(),this._boundingBox=this._addBox("bounding-box"),this._interactionsToRegister.forEach(function(b){return a.registerInteraction(b)}),this._interactionsToRegister=null,this._isSetup=!0)},c.prototype._requestedSpace=function(){return{width:0,height:0,wantsWidth:!1,wantsHeight:!1}},c.prototype._computeLayout=function(b,c,d,e){var f=this;if(null==b||null==c||null==d||null==e){if(null==this._element)throw new Error("anchor must be called before computeLayout");if(!this._isTopLevelComponent)throw new Error("null arguments cannot be passed to _computeLayout() on a non-root node");b=0,c=0,null==this._rootSVG.attr("width")&&this._rootSVG.attr("width","100%"),null==this._rootSVG.attr("height")&&this._rootSVG.attr("height","100%");var g=this._rootSVG.node();d=a._Util.DOM.getElementWidth(g),e=a._Util.DOM.getElementHeight(g)}var h=this._requestedSpace(d,e);this._width=this._isFixedWidth()?Math.min(d,h.width):d,this._height=this._isFixedHeight()?Math.min(e,h.height):e,this._xOrigin=b+this._xOffset+(d-this.width())*this._xAlignProportion,this._yOrigin=c+this._yOffset+(e-this.height())*this._yAlignProportion,this._element.attr("transform","translate("+this._xOrigin+","+this._yOrigin+")"),this._boxes.forEach(function(a){return a.attr("width",f.width()).attr("height",f.height())})},c.prototype._render=function(){this._isAnchored&&this._isSetup&&this.width()>=0&&this.height()>=0&&a.Core.RenderController.registerToRender(this)},c.prototype._scheduleComputeLayout=function(){this._isAnchored&&this._isSetup&&a.Core.RenderController.registerToComputeLayout(this)},c.prototype._doRender=function(){},c.prototype._useLastCalculatedLayout=function(a){return null==a?this._usedLastLayout:(this._usedLastLayout=a,this)},c.prototype._invalidateLayout=function(){this._useLastCalculatedLayout(!1),this._isAnchored&&this._isSetup&&(this._isTopLevelComponent?this._scheduleComputeLayout():this._parent._invalidateLayout())},c.prototype.renderTo=function(b){if(null!=b){var c;if(c="string"==typeof b?d3.select(b):b,!c.node()||"svg"!==c.node().nodeName.toLowerCase())throw new Error("Plottable requires a valid SVG to renderTo");this._anchor(c)}if(null==this._element)throw new Error("If a component has never been rendered before, then renderTo must be given a node to render to, or a D3.Selection, or a selector string");return this._computeLayout(),this._render(),a.Core.RenderController.flush(),this},c.prototype.redraw=function(){return this._invalidateLayout(),this},c.prototype.xAlign=function(a){if(a=a.toLowerCase(),"left"===a)this._xAlignProportion=0;else if("center"===a)this._xAlignProportion=.5;else{if("right"!==a)throw new Error("Unsupported alignment");this._xAlignProportion=1}return this._invalidateLayout(),this},c.prototype.yAlign=function(a){if(a=a.toLowerCase(),"top"===a)this._yAlignProportion=0;else if("center"===a)this._yAlignProportion=.5;else{if("bottom"!==a)throw new Error("Unsupported alignment");this._yAlignProportion=1}return this._invalidateLayout(),this},c.prototype.xOffset=function(a){return this._xOffset=a,this._invalidateLayout(),this},c.prototype.yOffset=function(a){return this._yOffset=a,this._invalidateLayout(),this},c.prototype._addBox=function(a,b){if(null==this._element)throw new Error("Adding boxes before anchoring is currently disallowed");b=null==b?this._boxContainer:b;var c=b.append("rect");return null!=a&&c.classed(a,!0),this._boxes.push(c),null!=this.width()&&null!=this.height()&&c.attr("width",this.width()).attr("height",this.height()),c},c.prototype._generateClipPath=function(){var a=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;a=a.split("#")[0],this._element.attr("clip-path",'url("'+a+"#clipPath"+this.getID()+'")');var b=this._boxContainer.append("clipPath").attr("id","clipPath"+this.getID());this._addBox("clip-rect",b)},c.prototype.registerInteraction=function(a){return this._element?(!this._hitBox&&a._requiresHitbox()&&(this._hitBox=this._addBox("hit-box"),this._hitBox.style("fill","#ffffff").style("opacity",0)),a._anchor(this,this._hitBox)):this._interactionsToRegister.push(a),this},c.prototype.classed=function(a,b){if(null==b)return null==a?!1:null==this._element?-1!==this._cssClasses.indexOf(a):this._element.classed(a);if(null==a)return this;if(null==this._element){var c=this._cssClasses.indexOf(a);b&&-1===c?this._cssClasses.push(a):b||-1===c||this._cssClasses.splice(c,1)}else this._element.classed(a,b);return this},c.prototype._isFixedWidth=function(){return this._fixedWidthFlag},c.prototype._isFixedHeight=function(){return this._fixedHeightFlag},c.prototype._merge=function(b,c){var d;if(this._isSetup||this._isAnchored)throw new Error("Can't presently merge a component that's already been anchored");if(a.Component.Group.prototype.isPrototypeOf(b))return d=b,d._addComponent(this,c),d;var e=c?[this,b]:[b,this];return d=new a.Component.Group(e)},c.prototype.above=function(a){return this._merge(a,!1)},c.prototype.below=function(a){return this._merge(a,!0)},c.prototype.detach=function(){return this._isAnchored&&this._element.remove(),null!=this._parent&&this._parent._removeComponent(this),this._isAnchored=!1,this._parent=null,this},c.prototype.remove=function(){this._removed=!0,this.detach()},c.prototype.width=function(){return this._width},c.prototype.height=function(){return this._height},c.prototype.origin=function(){return{x:this._xOrigin,y:this._yOrigin}},c.prototype.originToSVG=function(){for(var a=this.origin(),b=this._parent;null!=b;){var c=b.origin();a.x+=c.x,a.y+=c.y,b=b._parent}return a},c.prototype.foreground=function(){return this._foregroundContainer},c.prototype.content=function(){return this._content},c.prototype.background=function(){return this._backgroundContainer},c.prototype.hitBox=function(){return this._hitBox},c}(a.Core.PlottableObject);b.AbstractComponent=c}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments),this._components=[]}return __extends(b,a),b.prototype._anchor=function(b){var c=this;a.prototype._anchor.call(this,b),this.components().forEach(function(a){return a._anchor(c._content)})},b.prototype._render=function(){this._components.forEach(function(a){return a._render()})},b.prototype._removeComponent=function(a){var b=this._components.indexOf(a);b>=0&&(this.components().splice(b,1),this._invalidateLayout())},b.prototype._addComponent=function(a,b){return void 0===b&&(b=!1),!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},b.prototype.empty=function(){return 0===this._components.length},b.prototype.detachAll=function(){return this.components().slice().forEach(function(a){return a.detach()}),this},b.prototype.remove=function(){a.prototype.remove.call(this),this.components().slice().forEach(function(a){return a.remove()})},b.prototype._useLastCalculatedLayout=function(b){return null!=b&&this.components().slice().forEach(function(a){return a._useLastCalculatedLayout(b)}),a.prototype._useLastCalculatedLayout.call(this,b)},b}(a.AbstractComponent);a.AbstractComponentContainer=b}(b=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){var b;!function(b){var c=function(b){function c(a){var c=this;void 0===a&&(a=[]),b.call(this),this.classed("component-group",!0),a.forEach(function(a){return c._addComponent(a)})}return __extends(c,b),c.prototype._requestedSpace=function(b,c){var d=this.components().map(function(a){return a._requestedSpace(b,c)});return{width:a._Util.Methods.max(d,function(a){return a.width},0),height:a._Util.Methods.max(d,function(a){return a.height},0),wantsWidth:d.map(function(a){return a.wantsWidth}).some(function(a){return a}),wantsHeight:d.map(function(a){return a.wantsHeight}).some(function(a){return a})}},c.prototype._merge=function(a,b){return this._addComponent(a,!b),this},c.prototype._computeLayout=function(a,c,d,e){var f=this;return b.prototype._computeLayout.call(this,a,c,d,e),this.components().forEach(function(a){a._computeLayout(0,0,f.width(),f.height())}),this},c.prototype._isFixedWidth=function(){return!1},c.prototype._isFixedHeight=function(){return!1},c}(b.AbstractComponentContainer);b.Group=c}(b=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){var b;!function(b){var c=function(b){function c(c,d,e){var f=this;if(void 0===e&&(e=a.Formatters.identity()),b.call(this),this._endTickLength=5,this._tickLength=5,this._tickLabelPadding=10,this._gutter=15,this._showEndTickLabels=!1,null==c||null==d)throw new Error("Axis requires a scale and orientation");this._scale=c,this.orient(d),this._setDefaultAlignment(),this.classed("axis",!0),this._isHorizontal()?this.classed("x-axis",!0):this.classed("y-axis",!0),this.formatter(e),this._scale.broadcaster.registerListener(this,function(){return f._rescale()})}return __extends(c,b),c.prototype.remove=function(){b.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},c.prototype._isHorizontal=function(){return"top"===this._orientation||"bottom"===this._orientation},c.prototype._computeWidth=function(){return this._computedWidth=this._maxLabelTickLength(),this._computedWidth},c.prototype._computeHeight=function(){return this._computedHeight=this._maxLabelTickLength(),this._computedHeight},c.prototype._requestedSpace=function(a,b){var c=0,d=0;return this._isHorizontal()?(null==this._computedHeight&&this._computeHeight(),d=this._computedHeight+this._gutter):(null==this._computedWidth&&this._computeWidth(),c=this._computedWidth+this._gutter),{width:c,height:d,wantsWidth:!this._isHorizontal()&&c>a,wantsHeight:this._isHorizontal()&&d>b}},c.prototype._isFixedHeight=function(){return this._isHorizontal()},c.prototype._isFixedWidth=function(){return!this._isHorizontal()},c.prototype._rescale=function(){this._render()},c.prototype._computeLayout=function(a,c,d,e){b.prototype._computeLayout.call(this,a,c,d,e),this._scale.range(this._isHorizontal()?[0,this.width()]:[this.height(),0])},c.prototype._setup=function(){b.prototype._setup.call(this),this._tickMarkContainer=this._content.append("g").classed(c.TICK_MARK_CLASS+"-container",!0),this._tickLabelContainer=this._content.append("g").classed(c.TICK_LABEL_CLASS+"-container",!0),this._baseline=this._content.append("line").classed("baseline",!0)},c.prototype._getTickValues=function(){return[]},c.prototype._doRender=function(){var a=this._getTickValues(),b=this._tickMarkContainer.selectAll("."+c.TICK_MARK_CLASS).data(a);b.enter().append("line").classed(c.TICK_MARK_CLASS,!0),b.attr(this._generateTickMarkAttrHash()),d3.select(b[0][0]).classed(c.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),d3.select(b[0][a.length-1]).classed(c.END_TICK_MARK_CLASS,!0).attr(this._generateTickMarkAttrHash(!0)),b.exit().remove(),this._baseline.attr(this._generateBaselineAttrHash())},c.prototype._generateBaselineAttrHash=function(){var a={x1:0,y1:0,x2:0,y2:0};switch(this._orientation){case"bottom":a.x2=this.width();break;case"top":a.x2=this.width(),a.y1=this.height(),a.y2=this.height();break;case"left":a.x1=this.width(),a.x2=this.width(),a.y2=this.height();break;case"right":a.y2=this.height()}return a},c.prototype._generateTickMarkAttrHash=function(a){var b=this;void 0===a&&(a=!1);var c={x1:0,y1:0,x2:0,y2:0},d=function(a){return b._scale.scale(a)};this._isHorizontal()?(c.x1=d,c.x2=d):(c.y1=d,c.y2=d);var e=a?this._endTickLength:this._tickLength;switch(this._orientation){case"bottom":c.y2=e;break;case"top":c.y1=this.height(),c.y2=this.height()-e;break;case"left":c.x1=this.width(),c.x2=this.width()-e;break;case"right":c.x2=e}return c},c.prototype._invalidateLayout=function(){this._computedWidth=null,this._computedHeight=null,b.prototype._invalidateLayout.call(this)},c.prototype._setDefaultAlignment=function(){switch(this._orientation){case"bottom":this.yAlign("top");break;case"top":this.yAlign("bottom");break;case"left":this.xAlign("right");break;case"right":this.xAlign("left")}},c.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this._invalidateLayout(),this)},c.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},c.prototype.endTickLength=function(a){if(null==a)return this._endTickLength;if(0>a)throw new Error("end tick length must be positive");return this._endTickLength=a,this._invalidateLayout(),this},c.prototype._maxLabelTickLength=function(){return this.showEndTickLabels()?Math.max(this.tickLength(),this.endTickLength()):this.tickLength()},c.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},c.prototype.gutter=function(a){if(null==a)return this._gutter;if(0>a)throw new Error("gutter size must be positive");return this._gutter=a,this._invalidateLayout(),this},c.prototype.orient=function(a){if(null==a)return this._orientation;var b=a.toLowerCase();if("top"!==b&&"bottom"!==b&&"left"!==b&&"right"!==b)throw new Error("unsupported orientation");return this._orientation=b,this._invalidateLayout(),this},c.prototype.showEndTickLabels=function(a){return null==a?this._showEndTickLabels:(this._showEndTickLabels=a,this._render(),this)},c.prototype._hideEndTickLabels=function(){var b=this._boundingBox.node().getBoundingClientRect(),d=this._tickLabelContainer.selectAll("."+c.TICK_LABEL_CLASS);if(0!==d[0].length){var e=d[0][0];a._Util.DOM.boxIsInside(e.getBoundingClientRect(),b)||d3.select(e).style("visibility","hidden");var f=d[0][d[0].length-1];a._Util.DOM.boxIsInside(f.getBoundingClientRect(),b)||d3.select(f).style("visibility","hidden")}},c.prototype._hideOverflowingTickLabels=function(){var b=this._boundingBox.node().getBoundingClientRect(),d=this._tickLabelContainer.selectAll("."+c.TICK_LABEL_CLASS);d.empty()||d.each(function(){a._Util.DOM.boxIsInside(this.getBoundingClientRect(),b)||d3.select(this).style("visibility","hidden")})},c.prototype._hideOverlappingTickLabels=function(){for(var a=this._tickLabelContainer.selectAll("."+c.TICK_LABEL_CLASS).filter(function(){var a=d3.select(this).style("visibility");return"inherit"===a||"visible"===a}),b=a[0].map(function(a){return a.getBoundingClientRect()}),d=1;!this._hasOverlapWithInterval(d,b)&&d=e.left)return!1}else if(d.top-this._tickLabelPadding<=e.bottom)return!1}return!0},c.END_TICK_MARK_CLASS="end-tick-mark",c.TICK_MARK_CLASS="tick-mark",c.TICK_LABEL_CLASS="tick-label",c}(a.Component.AbstractComponent);b.AbstractAxis=c}(b=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){var b;!function(b){var c=function(c){function d(b,d){c.call(this,b,d),this._possibleTimeAxisConfigurations=[[{interval:d3.time.second,step:1,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:5,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:10,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:15,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.second,step:30,formatter:a.Formatters.time("%I:%M:%S %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:1,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:5,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:10,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:15,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.minute,step:30,formatter:a.Formatters.time("%I:%M %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:1,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:3,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:6,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.hour,step:12,formatter:a.Formatters.time("%I %p")},{interval:d3.time.day,step:1,formatter:a.Formatters.time("%B %e, %Y")}],[{interval:d3.time.day,step:1,formatter:a.Formatters.time("%a %e")},{interval:d3.time.month,step:1,formatter:a.Formatters.time("%B %Y")}],[{interval:d3.time.day,step:1,formatter:a.Formatters.time("%e")},{interval:d3.time.month,step:1,formatter:a.Formatters.time("%B %Y")}],[{interval:d3.time.month,step:1,formatter:a.Formatters.time("%B")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.month,step:1,formatter:a.Formatters.time("%b")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.month,step:3,formatter:a.Formatters.time("%b")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.month,step:6,formatter:a.Formatters.time("%b")},{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:1,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:1,formatter:a.Formatters.time("%y")}],[{interval:d3.time.year,step:5,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:25,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:50,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:100,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:200,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:500,formatter:a.Formatters.time("%Y")}],[{interval:d3.time.year,step:1e3,formatter:a.Formatters.time("%Y")}]],this.classed("time-axis",!0),this.tickLabelPadding(5),this.tierLabelPositions(["between","between"])
+}return __extends(d,c),d.prototype.tierLabelPositions=function(a){if(null==a)return this._tierLabelPositions;if(!a.every(function(a){return"between"===a.toLowerCase()||"center"===a.toLowerCase()}))throw new Error("Unsupported position for tier labels");return this._tierLabelPositions=a,this._invalidateLayout(),this},d.prototype.axisConfigurations=function(a){return null==a?this._possibleTimeAxisConfigurations:(this._possibleTimeAxisConfigurations=a,this._invalidateLayout(),this)},d.prototype._getMostPreciseConfigurationIndex=function(){var b=this,c=this._possibleTimeAxisConfigurations.length;return this._possibleTimeAxisConfigurations.forEach(function(a,d){c>d&&a.every(function(a){return b._checkTimeAxisTierConfigurationWidth(a)})&&(c=d)}),c===this._possibleTimeAxisConfigurations.length&&(a._Util.Methods.warn("zoomed out too far: could not find suitable interval to display labels"),--c),c},d.prototype.orient=function(a){if(a&&("right"===a.toLowerCase()||"left"===a.toLowerCase()))throw new Error(a+" is not a supported orientation for TimeAxis - only horizontal orientations are supported");return c.prototype.orient.call(this,a)},d.prototype._computeHeight=function(){var a=this,b=this._measurer.measure().height;return this._tierHeights=this._tierLabelPositions.map(function(c){return b+a.tickLabelPadding()+("between"===c?0:a._maxLabelTickLength())}),this._computedHeight=d3.sum(this._tierHeights),this._computedHeight},d.prototype._getIntervalLength=function(a){var b=this._scale.domain()[0],c=a.interval.offset(b,a.step);if(c>this._scale.domain()[1])return this.width();var d=Math.abs(this._scale.scale(c)-this._scale.scale(b));return d},d.prototype._maxWidthForInterval=function(a){return this._measurer.measure(a.formatter(d._LONG_DATE)).width},d.prototype._checkTimeAxisTierConfigurationWidth=function(a){var b=this._maxWidthForInterval(a)+2*this.tickLabelPadding();return Math.min(this._getIntervalLength(a),this.width())>=b},d.prototype._setup=function(){c.prototype._setup.call(this),this._tierLabelContainers=[],this._tierMarkContainers=[],this._tierBaselines=[],this._tickLabelContainer.remove(),this._baseline.remove();for(var a=0;a=g.length||h.push(new Date((g[b+1].valueOf()-g[b].valueOf())/2+g[b].valueOf()))}):h=g;var i=c.selectAll("."+b.AbstractAxis.TICK_LABEL_CLASS).data(h,function(a){return a.valueOf()}),j=i.enter().append("g").classed(b.AbstractAxis.TICK_LABEL_CLASS,!0);j.append("text");var k="center"===this._tierLabelPositions[e]||1===d.step?0:this.tickLabelPadding(),l=(this._measurer.measure().height,"bottom"===this.orient()?d3.sum(this._tierHeights.slice(0,e+1))-this.tickLabelPadding():this.height()-d3.sum(this._tierHeights.slice(0,e))-this.tickLabelPadding()),m=i.selectAll("text");m.size()>0&&a._Util.DOM.translate(m,k,l),i.exit().remove(),i.attr("transform",function(a){return"translate("+f._scale.scale(a)+",0)"});var n="center"===this._tierLabelPositions[e]||1===d.step?"middle":"start";i.selectAll("text").text(d.formatter).style("text-anchor",n)},d.prototype._renderTickMarks=function(a,c){var d=this._tierMarkContainers[c].selectAll("."+b.AbstractAxis.TICK_MARK_CLASS).data(a);d.enter().append("line").classed(b.AbstractAxis.TICK_MARK_CLASS,!0);var e=this._generateTickMarkAttrHash(),f=this._tierHeights.slice(0,c).reduce(function(a,b){return a+b},0);"bottom"===this.orient()?(e.y1=f,e.y2=f+("center"===this._tierLabelPositions[c]?this.tickLength():this._tierHeights[c])):(e.y1=this.height()-f,e.y2=this.height()-(f+("center"===this._tierLabelPositions[c]?this.tickLength():this._tierHeights[c]))),d.attr(e),"bottom"===this.orient()?(e.y1=f,e.y2=f+this._tierHeights[c]):(e.y1=this.height()-f,e.y2=this.height()-(f+this._tierHeights[c])),d3.select(d[0][0]).attr(e),d3.select(d[0][0]).classed(b.AbstractAxis.END_TICK_MARK_CLASS,!0),d3.select(d[0][d.size()-1]).classed(b.AbstractAxis.END_TICK_MARK_CLASS,!0),d.exit().remove()},d.prototype._renderLabellessTickMarks=function(a){var c=this._tickMarkContainer.selectAll("."+b.AbstractAxis.TICK_MARK_CLASS).data(a);c.enter().append("line").classed(b.AbstractAxis.TICK_MARK_CLASS,!0);var d=this._generateTickMarkAttrHash();d.y2="bottom"===this.orient()?this.tickLabelPadding():this.height()-this.tickLabelPadding(),c.attr(d),c.exit().remove()},d.prototype._generateLabellessTicks=function(){return this._mostPreciseConfigIndex<1?[]:this._getTickIntervalValues(this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex-1][0])},d.prototype._doRender=function(){var a=this;this._mostPreciseConfigIndex=this._getMostPreciseConfigurationIndex();for(var b=this._possibleTimeAxisConfigurations[this._mostPreciseConfigIndex],c=0;c=j&&(h=this._generateLabellessTicks()),this._renderLabellessTickMarks(h),c=0;ce.left||j.left=b[1]?b[0]:b[1];return c===b[0]?a.ticks().filter(function(a){return a>=c&&d>=a}):a.ticks().filter(function(a){return a>=c&&d>=a}).reverse()},d.prototype._rescale=function(){if(this._isSetup){if(!this._isHorizontal()){var a=this._computeWidth();if(a>this.width()||aa,wantsHeight:e>b}},b.prototype._setup=function(){a.prototype._setup.call(this),this._textContainer=this._content.append("g"),this._measurer=new SVGTypewriter.Measurers.Measurer(this._textContainer),this._wrapper=new SVGTypewriter.Wrappers.Wrapper,this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper),this.text(this._text)},b.prototype.text=function(a){return void 0===a?this._text:(this._text=a,this._invalidateLayout(),this)},b.prototype.orient=function(a){if(null==a)return this._orientation;if(a=a.toLowerCase(),"horizontal"!==a&&"left"!==a&&"right"!==a)throw new Error(a+" is not a valid orientation for LabelComponent");return this._orientation=a,this._invalidateLayout(),this},b.prototype.padding=function(a){if(null==a)return this._padding;if(a=+a,0>a)throw new Error(a+" is not a valid padding value. Cannot be less than 0.");return this._padding=a,this._invalidateLayout(),this},b.prototype._doRender=function(){a.prototype._doRender.call(this),this._textContainer.selectAll("g").remove();var b=this._measurer.measure(this._text),c=Math.max(Math.min((this.height()-b.height)/2,this.padding()),0),d=Math.max(Math.min((this.width()-b.width)/2,this.padding()),0);this._textContainer.attr("transform","translate("+d+","+c+")");var e=this.width()-2*d,f=this.height()-2*c,g={horizontal:0,right:90,left:-90},h={selection:this._textContainer,xAlign:this._xAlignment,yAlign:this._yAlignment,textRotation:g[this.orient()]};this._writer.write(this._text,e,f,h)},b}(a.AbstractComponent);a.Label=b;var c=function(a){function b(b,c){a.call(this,b,c),this.classed("title-label",!0)}return __extends(b,a),b}(b);a.TitleLabel=c;var d=function(a){function b(b,c){a.call(this,b,c),this.classed("axis-label",!0)}return __extends(b,a),b}(b);a.AxisLabel=d}(b=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){var b;!function(b){var c=function(b){function c(c){var d=this;if(b.call(this),this._padding=5,this.classed("legend",!0),this.maxEntriesPerRow(1),null==c)throw new Error("Legend requires a colorScale");this._scale=c,this._scale.broadcaster.registerListener(this,function(){return d._invalidateLayout()}),this.xAlign("right").yAlign("top"),this._fixedWidthFlag=!0,this._fixedHeightFlag=!0,this._sortFn=function(a,b){return d._scale.domain().indexOf(a)-d._scale.domain().indexOf(b)},this._symbolFactoryAccessor=function(){return a.SymbolFactories.circle()}}return __extends(c,b),c.prototype._setup=function(){b.prototype._setup.call(this);var a=this._content.append("g").classed(c.LEGEND_ROW_CLASS,!0),d=a.append("g").classed(c.LEGEND_ENTRY_CLASS,!0);d.append("text"),this._measurer=new SVGTypewriter.Measurers.Measurer(a),this._wrapper=(new SVGTypewriter.Wrappers.Wrapper).maxLines(1),this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper).addTitleElement(!0)},c.prototype.maxEntriesPerRow=function(a){return null==a?this._maxEntriesPerRow:(this._maxEntriesPerRow=a,this._invalidateLayout(),this)},c.prototype.sortFunction=function(a){return null==a?this._sortFn:(this._sortFn=a,this._invalidateLayout(),this)},c.prototype.scale=function(a){var b=this;return null!=a?(this._scale.broadcaster.deregisterListener(this),this._scale=a,this._scale.broadcaster.registerListener(this,function(){return b._invalidateLayout()}),this._invalidateLayout(),this):this._scale},c.prototype.remove=function(){b.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},c.prototype._calculateLayoutInfo=function(b,c){var d=this,e=this._measurer.measure().height,f=Math.max(0,b-this._padding),g=function(a){var b=e+d._measurer.measure(a).width+d._padding;return Math.min(b,f)},h=this._scale.domain().slice();h.sort(this.sortFunction());var i=a._Util.Methods.populateMap(h,g),j=this._packRows(f,h,i),k=Math.floor((c-2*this._padding)/e);return k!==k&&(k=0),{textHeight:e,entryLengths:i,rows:j,numRowsToDraw:Math.max(Math.min(k,j.length),0)}},c.prototype._requestedSpace=function(b,c){var d=this,e=this._calculateLayoutInfo(b,c),f=e.rows.map(function(a){return d3.sum(a,function(a){return e.entryLengths.get(a)})}),g=a._Util.Methods.max(f,0),h=a._Util.Methods.max(this._scale.domain(),function(a){return d._measurer.measure(a).width},0);h+=e.textHeight+this._padding;var i=this._padding+Math.max(g,h),j=e.numRowsToDraw*e.textHeight+2*this._padding,k=e.rows.length*e.textHeight+2*this._padding,l=Math.max(Math.ceil(this._scale.domain().length/this._maxEntriesPerRow),1),m=e.rows.length>l;return{width:this._padding+g,height:j,wantsWidth:i>b||m,wantsHeight:k>c}},c.prototype._packRows=function(a,b,c){var d=this,e=[],f=[],g=a;return b.forEach(function(b){var h=c.get(b);(h>g||f.length===d._maxEntriesPerRow)&&(e.push(f),f=[],g=a),f.push(b),g-=h}),0!==f.length&&e.push(f),e},c.prototype.getEntry=function(a){if(!this._isSetup)return d3.select();var b=d3.select(),d=this._calculateLayoutInfo(this.width(),this.height()),e=this._padding;return this._content.selectAll("g."+c.LEGEND_ROW_CLASS).each(function(f,g){var h=g*d.textHeight+e,i=(g+1)*d.textHeight+e,j=e,k=e;d3.select(this).selectAll("g."+c.LEGEND_ENTRY_CLASS).each(function(c){k+=d.entryLengths.get(c),k>=a.x&&j<=a.x&&i>=a.y&&h<=a.y&&(b=d3.select(this)),j+=d.entryLengths.get(c)})}),b},c.prototype._doRender=function(){var a=this;b.prototype._doRender.call(this);var d=this._calculateLayoutInfo(this.width(),this.height()),e=d.rows.slice(0,d.numRowsToDraw),f=this._content.selectAll("g."+c.LEGEND_ROW_CLASS).data(e);f.enter().append("g").classed(c.LEGEND_ROW_CLASS,!0),f.exit().remove(),f.attr("transform",function(b,c){return"translate(0, "+(c*d.textHeight+a._padding)+")"});var g=f.selectAll("g."+c.LEGEND_ENTRY_CLASS).data(function(a){return a}),h=g.enter().append("g").classed(c.LEGEND_ENTRY_CLASS,!0);h.append("path"),h.append("g").classed("text-container",!0),g.exit().remove();var i=this._padding;f.each(function(){var a=i,b=d3.select(this).selectAll("g."+c.LEGEND_ENTRY_CLASS);b.attr("transform",function(b){var c="translate("+a+", 0)";return a+=d.entryLengths.get(b),c})}),g.select("path").attr("d",function(b,c){return a.symbolFactoryAccessor()(b,c)(.6*d.textHeight)}).attr("transform","translate("+d.textHeight/2+","+d.textHeight/2+")").attr("fill",function(b){return a._scale.scale(b)}).classed(c.LEGEND_SYMBOL_CLASS,!0);var j=this._padding,k=g.select("g.text-container");k.text(""),k.append("title").text(function(a){return a});var l=this;k.attr("transform","translate("+d.textHeight+", 0)").each(function(a){var b=d3.select(this),c=d.entryLengths.get(a)-d.textHeight-j,e={selection:b,xAlign:"left",yAlign:"top",textRotation:0};l._writer.write(a,c,l.height(),e)})},c.prototype.symbolFactoryAccessor=function(a){return null==a?this._symbolFactoryAccessor:(this._symbolFactoryAccessor=a,this._render(),this)},c.LEGEND_ROW_CLASS="legend-row",c.LEGEND_ENTRY_CLASS="legend-entry",c.LEGEND_SYMBOL_CLASS="legend-symbol",c}(b.AbstractComponent);b.Legend=c}(b=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){var b;!function(b){var c=function(b){function c(d,e,f){var g=this;if(void 0===e&&(e="horizontal"),void 0===f&&(f=a.Formatters.general()),b.call(this),this._padding=5,this._numSwatches=10,null==d)throw new Error("InterpolatedColorLegend requires a interpolatedColorScale");this._scale=d,this._scale.broadcaster.registerListener(this,function(){return g._invalidateLayout()}),this._formatter=f,this._orientation=c._ensureOrientation(e),this._fixedWidthFlag=!0,this._fixedHeightFlag=!0,this.classed("legend",!0).classed("interpolated-color-legend",!0)}return __extends(c,b),c.prototype.remove=function(){b.prototype.remove.call(this),this._scale.broadcaster.deregisterListener(this)},c.prototype.formatter=function(a){return void 0===a?this._formatter:(this._formatter=a,this._invalidateLayout(),this)},c._ensureOrientation=function(a){if(a=a.toLowerCase(),"horizontal"===a||"left"===a||"right"===a)return a;throw new Error('"'+a+'" is not a valid orientation for InterpolatedColorLegend')},c.prototype.orient=function(a){return null==a?this._orientation:(this._orientation=c._ensureOrientation(a),this._invalidateLayout(),this)},c.prototype._generateTicks=function(){for(var a=this._scale.domain(),b=(a[1]-a[0])/this._numSwatches,c=[],d=0;d<=this._numSwatches;d++)c.push(a[0]+b*d);return c},c.prototype._setup=function(){b.prototype._setup.call(this),this._swatchContainer=this._content.append("g").classed("swatch-container",!0),this._swatchBoundingBox=this._content.append("rect").classed("swatch-bounding-box",!0),this._lowerLabel=this._content.append("g").classed(c.LEGEND_LABEL_CLASS,!0),this._upperLabel=this._content.append("g").classed(c.LEGEND_LABEL_CLASS,!0),this._measurer=new SVGTypewriter.Measurers.Measurer(this._content),this._wrapper=new SVGTypewriter.Wrappers.Wrapper,this._writer=new SVGTypewriter.Writers.Writer(this._measurer,this._wrapper)},c.prototype._requestedSpace=function(b,c){var d,e,f=this,g=this._measurer.measure().height,h=this._generateTicks(),i=h.length,j=this._scale.domain(),k=j.map(function(a){return f._measurer.measure(f._formatter(a)).width});if(this._isVertical()){var l=a._Util.Methods.max(k,0);e=this._padding+g+this._padding+l+this._padding,d=this._padding+i*g+this._padding}else d=this._padding+g+this._padding,e=this._padding+k[0]+this._padding+i*g+this._padding+k[1]+this._padding;return{width:e,height:d,wantsWidth:e>b,wantsHeight:d>c}},c.prototype._isVertical=function(){return"horizontal"!==this._orientation},c.prototype._doRender=function(){var a=this;b.prototype._doRender.call(this);var c,d,e,f,g=this._scale.domain(),h=(this._measurer.measure().height,this._formatter(g[0])),i=this._measurer.measure(h).width,j=this._formatter(g[1]),k=this._measurer.measure(j).width,l=this._generateTicks(),m=l.length,n=this._padding,o={x:0,y:0},p={x:0,y:0},q={selection:this._lowerLabel,xAlign:"center",yAlign:"center",textRotation:0},r={selection:this._upperLabel,xAlign:"center",yAlign:"center",textRotation:0},s={x:0,y:n,width:0,height:0};if(this._isVertical()){var t=Math.max(i,k);c=Math.max(this.width()-3*n-t,0),d=Math.max((this.height()-2*n)/m,0),f=function(a,b){return n+(m-(b+1))*d},r.yAlign="top",o.y=n,q.yAlign="bottom",p.y=-n,"left"===this._orientation?(e=function(){return n+t+n},r.xAlign="right",o.x=-(n+c+n),q.xAlign="right",p.x=-(n+c+n)):(e=function(){return n},r.xAlign="left",o.x=n+c+n,q.xAlign="left",p.x=n+c+n),s.width=c,s.height=m*d}else c=Math.max((this.width()-4*n-i-k)/m,0),d=Math.max(this.height()-2*n,0),e=function(a,b){return n+i+n+b*c},f=function(){return n},r.xAlign="right",o.x=-n,q.xAlign="left",p.x=n,s.width=m*c,s.height=d;s.x=e(null,0),this._upperLabel.text(""),this._writer.write(j,this.width(),this.height(),r);var u="translate("+o.x+", "+o.y+")";this._upperLabel.attr("transform",u),this._lowerLabel.text(""),this._writer.write(h,this.width(),this.height(),q);var v="translate("+p.x+", "+p.y+")";this._lowerLabel.attr("transform",v),this._swatchBoundingBox.attr(s);var w=this._swatchContainer.selectAll("rect.swatch").data(l);w.enter().append("rect").classed("swatch",!0),w.exit().remove(),w.attr({fill:function(b){return a._scale.scale(b)},width:c,height:d,x:e,y:f})},c.LEGEND_LABEL_CLASS="legend-label",c}(b.AbstractComponent);b.InterpolatedColorLegend=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){var e=this;if(null!=c&&!a.Scale.AbstractQuantitative.prototype.isPrototypeOf(c))throw new Error("xScale needs to inherit from Scale.AbstractQuantitative");if(null!=d&&!a.Scale.AbstractQuantitative.prototype.isPrototypeOf(d))throw new Error("yScale needs to inherit from Scale.AbstractQuantitative");b.call(this),this.classed("gridlines",!0),this._xScale=c,this._yScale=d,this._xScale&&this._xScale.broadcaster.registerListener(this,function(){return e._render()}),this._yScale&&this._yScale.broadcaster.registerListener(this,function(){return e._render()})}return __extends(c,b),c.prototype.remove=function(){return b.prototype.remove.call(this),this._xScale&&this._xScale.broadcaster.deregisterListener(this),this._yScale&&this._yScale.broadcaster.deregisterListener(this),this},c.prototype._setup=function(){b.prototype._setup.call(this),this._xLinesContainer=this._content.append("g").classed("x-gridlines",!0),this._yLinesContainer=this._content.append("g").classed("y-gridlines",!0)},c.prototype._doRender=function(){b.prototype._doRender.call(this),this._redrawXLines(),this._redrawYLines()},c.prototype._redrawXLines=function(){var a=this;if(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.height()).classed("zeroline",function(a){return 0===a}),d.exit().remove()}},c.prototype._redrawYLines=function(){var a=this;if(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.width()).attr("y2",c).classed("zeroline",function(a){return 0===a}),d.exit().remove()}},c}(b.AbstractComponent);b.Gridlines=c}(b=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){var b;!function(b){var c=function(b){function c(a){var c=this;void 0===a&&(a=[]),b.call(this),this._rowPadding=0,this._colPadding=0,this._rows=[],this._rowWeights=[],this._colWeights=[],this._nRows=0,this._nCols=0,this._calculatedLayout=null,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(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&&e!==y,D=f>0&&f!==z;if(!C&&!D)break;if(s>5)break}return e=i-d3.sum(v.guaranteedWidths),f=j-d3.sum(v.guaranteedHeights),o=c._calcProportionalSpace(l,e),p=c._calcProportionalSpace(k,f),{colProportionalSpace:o,rowProportionalSpace:p,guaranteedWidths:v.guaranteedWidths,guaranteedHeights:v.guaranteedHeights,wantsWidth:w,wantsHeight:x}},c.prototype._determineGuarantees=function(b,c){var d=a._Util.Methods.createFilledArray(0,this._nCols),e=a._Util.Methods.createFilledArray(0,this._nRows),f=a._Util.Methods.createFilledArray(!1,this._nCols),g=a._Util.Methods.createFilledArray(!1,this._nRows);return this._rows.forEach(function(a,h){a.forEach(function(a,i){var j;j=null!=a?a._requestedSpace(b[i],c[h]):{width:0,height:0,wantsWidth:!1,wantsHeight:!1};var k=Math.min(j.width,b[i]),l=Math.min(j.height,c[h]);d[i]=Math.max(d[i],k),e[h]=Math.max(e[h],l),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){return this._calculatedLayout=this._iterateLayout(a,b),{width:d3.sum(this._calculatedLayout.guaranteedWidths),height:d3.sum(this._calculatedLayout.guaranteedHeights),wantsWidth:this._calculatedLayout.wantsWidth,wantsHeight:this._calculatedLayout.wantsHeight}},c.prototype._computeLayout=function(c,d,e,f){var g=this;b.prototype._computeLayout.call(this,c,d,e,f);var h=this._useLastCalculatedLayout()?this._calculatedLayout:this._iterateLayout(this.width(),this.height());this._useLastCalculatedLayout(!0);var i=0,j=a._Util.Methods.addArrays(h.rowProportionalSpace,h.guaranteedHeights),k=a._Util.Methods.addArrays(h.colProportionalSpace,h.guaranteedWidths);this._rows.forEach(function(a,b){var c=0;a.forEach(function(a,d){null!=a&&a._computeLayout(c,i,k[d],j[b]),c+=k[d]+g._colPadding}),i+=j[b]+g._rowPadding})},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}(b.AbstractComponentContainer);b.Table=c}(b=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){var b;!function(b){var c=function(b){function c(){b.call(this),this._dataChanged=!1,this._projections={},this._animate=!1,this._animators={},this._animateOnNextRender=!0,this.clipPathEnabled=!0,this.classed("plot",!0),this._key2PlotDatasetKey=d3.map(),this._datasetKeysInOrder=[],this._nextSeriesIndex=0}return __extends(c,b),c.prototype._anchor=function(a){b.prototype._anchor.call(this,a),this._animateOnNextRender=!0,this._dataChanged=!0,this._updateScaleExtents()},c.prototype._setup=function(){var a=this;b.prototype._setup.call(this),this._renderArea=this._content.append("g").classed("render-area",!0),this._getDrawersInOrder().forEach(function(b){return b.setup(a._renderArea.append("g"))})},c.prototype.remove=function(){var a=this;b.prototype.remove.call(this),this._datasetKeysInOrder.forEach(function(b){return a.removeDataset(b)});var c=Object.keys(this._projections);c.forEach(function(b){var c=a._projections[b];c.scale&&c.scale.broadcaster.deregisterListener(a)})},c.prototype.addDataset=function(b,c){if("string"!=typeof b&&void 0!==c)throw new Error("invalid input to addDataset");"string"==typeof b&&"_"===b[0]&&a._Util.Methods.warn("Warning: Using _named series keys may produce collisions with unlabeled data sources");var d="string"==typeof b?b:"_"+this._nextSeriesIndex++,e="string"!=typeof b?b:c;return c=e instanceof a.Dataset?e:new a.Dataset(e),this._addDataset(d,c),this},c.prototype._addDataset=function(a,b){var c=this;this._key2PlotDatasetKey.has(a)&&this.removeDataset(a);var d=this._getDrawer(a),e=this._getPlotMetadataForDataset(a),f={drawer:d,dataset:b,key:a,plotMetadata:e};this._datasetKeysInOrder.push(a),this._key2PlotDatasetKey.set(a,f),this._isSetup&&d.setup(this._renderArea.append("g")),b.broadcaster.registerListener(this,function(){return c._onDatasetUpdate()}),this._onDatasetUpdate()},c.prototype._getDrawer=function(b){return new a._Drawer.AbstractDrawer(b)},c.prototype._getAnimator=function(b){return this._animate&&this._animateOnNextRender?this._animators[b]||new a.Animator.Null:new a.Animator.Null},c.prototype._onDatasetUpdate=function(){this._updateScaleExtents(),this._animateOnNextRender=!0,this._dataChanged=!0,this._render()},c.prototype.attr=function(a,b,c){return this.project(a,b,c)},c.prototype.project=function(b,c,d){var e=this;b=b.toLowerCase();var f=this._projections[b],g=f&&f.scale;return g&&this._datasetKeysInOrder.forEach(function(a){g._removeExtent(e.getID().toString()+"_"+a,b),g.broadcaster.deregisterListener(e)}),d&&d.broadcaster.registerListener(this,function(){return e._render()}),c=a._Util.Methods.accessorize(c),this._projections[b]={accessor:c,scale:d,attribute:b},this._updateScaleExtent(b),this._render(),this},c.prototype._generateAttrToProjector=function(){var a=this,b={};return d3.keys(this._projections).forEach(function(c){var d=a._projections[c],e=d.accessor,f=d.scale,g=f?function(a,b,c,d){return f.scale(e(a,b,c,d))}:e;b[c]=g}),b},c.prototype.generateProjectors=function(a){var b=this._generateAttrToProjector(),c=this._key2PlotDatasetKey.get(a),d=c.plotMetadata,e=c.dataset.metadata(),f={};return d3.entries(b).forEach(function(a){f[a.key]=function(b,c){return a.value(b,c,e,d)}}),f},c.prototype._doRender=function(){this._isAnchored&&(this._paint(),this._dataChanged=!1,this._animateOnNextRender=!1)},c.prototype.animate=function(a){return this._animate=a,this},c.prototype.detach=function(){return b.prototype.detach.call(this),this._updateScaleExtents(),this},c.prototype._updateScaleExtents=function(){var a=this;d3.keys(this._projections).forEach(function(b){return a._updateScaleExtent(b)})},c.prototype._updateScaleExtent=function(a){var b=this,c=this._projections[a];c.scale&&this._datasetKeysInOrder.forEach(function(d){var e=b._key2PlotDatasetKey.get(d),f=e.dataset,g=e.plotMetadata,h=f._getExtent(c.accessor,c.scale._typeCoercer,g),i=b.getID().toString()+"_"+d;0!==h.length&&b._isAnchored?c.scale._updateExtent(i,a,h):c.scale._removeExtent(i,a)})},c.prototype.animator=function(a,b){return void 0===b?this._animators[a]:(this._animators[a]=b,this)},c.prototype.datasetOrder=function(b){function c(b,c){var d=a._Util.Methods.intersection(d3.set(b),d3.set(c)),e=d.size();return e===b.length&&e===c.length}return void 0===b?this._datasetKeysInOrder:(c(b,this._datasetKeysInOrder)?(this._datasetKeysInOrder=b,this._onDatasetUpdate()):a._Util.Methods.warn("Attempted to change datasetOrder, but new order is not permutation of old. Ignoring."),this)},c.prototype.removeDataset=function(b){var c;if("string"==typeof b)c=b;else if("object"==typeof b){var d=-1;if(b instanceof a.Dataset){var e=this.datasets();d=e.indexOf(b)}else if(b instanceof Array){var f=this.datasets().map(function(a){return a.data()});d=f.indexOf(b)}-1!==d&&(c=this._datasetKeysInOrder[d])}return this._removeDataset(c)},c.prototype._removeDataset=function(a){if(null!=a&&this._key2PlotDatasetKey.has(a)){var b=this._key2PlotDatasetKey.get(a);b.drawer.remove();var c=d3.values(this._projections),d=this.getID().toString()+"_"+a;c.forEach(function(a){null!=a.scale&&a.scale._removeExtent(d,a.attribute)}),b.dataset.broadcaster.deregisterListener(this),this._datasetKeysInOrder.splice(this._datasetKeysInOrder.indexOf(a),1),this._key2PlotDatasetKey.remove(a),this._onDatasetUpdate()}return this},c.prototype.datasets=function(){var a=this;return this._datasetKeysInOrder.map(function(b){return a._key2PlotDatasetKey.get(b).dataset})},c.prototype._getDrawersInOrder=function(){var a=this;return this._datasetKeysInOrder.map(function(b){return a._key2PlotDatasetKey.get(b).drawer})},c.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:new a.Animator.Null}]},c.prototype._additionalPaint=function(){},c.prototype._getDataToDraw=function(){var a=this,b=d3.map();return this._datasetKeysInOrder.forEach(function(c){b.set(c,a._key2PlotDatasetKey.get(c).dataset.data())}),b},c.prototype._getPlotMetadataForDataset=function(a){return{datasetKey:a}},c.prototype._paint=function(){var b=this,c=this._generateDrawSteps(),d=this._getDataToDraw(),e=this._getDrawersInOrder(),f=this._datasetKeysInOrder.map(function(a,f){return e[f].draw(d.get(a),c,b._key2PlotDatasetKey.get(a).dataset.metadata(),b._key2PlotDatasetKey.get(a).plotMetadata)}),g=a._Util.Methods.max(f,0);this._additionalPaint(g)},c.prototype.getAllSelections=function(a,b){var c=this;void 0===a&&(a=this.datasetOrder()),void 0===b&&(b=!1);var d=[];if(d="string"==typeof a?[a]:a,b){var e=d3.set(d);d=this.datasetOrder().filter(function(a){return!e.has(a)})}var f=[];return d.forEach(function(a){var b=c._key2PlotDatasetKey.get(a);if(null!=b){var d=b.drawer;d._getRenderArea().selectAll(d._getSelector()).each(function(){f.push(this)})}}),d3.selectAll(f)},c.prototype.getAllPlotData=function(a){void 0===a&&(a=this.datasetOrder());var b=[];return b="string"==typeof a?[a]:a,this._getAllPlotData(b)},c.prototype._getAllPlotData=function(a){var b=this,c=[],d=[],e=[];return a.forEach(function(a){var f=b._key2PlotDatasetKey.get(a);if(null!=f){var g=f.drawer;f.dataset.data().forEach(function(a,b){c.push(a),d.push(g._getPixelPoint(a,b)),e.push(g._getSelection(b).node())})}}),{data:c,pixelPoints:d,selection:d3.selectAll(e)}},c.prototype.getClosestPlotData=function(a,b,c){void 0===b&&(b=1/0),void 0===c&&(c=this.datasetOrder());var d=[];return d="string"==typeof c?[c]:c,this._getClosestPlotData(a,d,b)},c.prototype._getClosestPlotData=function(b,c,d){void 0===d&&(d=1/0);var e,f=Math.pow(d,2),g=this.getAllPlotData(c);return g.pixelPoints.forEach(function(c,d){var g=a._Util.Methods.distanceSquared(c,b);f>g&&(f=g,e=d)}),null==e?{data:[],pixelPoints:[],selection:d3.select()}:{data:[g.data[e]],pixelPoints:[g.pixelPoints[e]],selection:d3.select(g.selection[0][e])}},c}(a.Component.AbstractComponent);b.AbstractPlot=c}(b=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){var b;!function(b){var c=function(b){function c(){b.call(this),this._colorScale=new a.Scale.Color,this.classed("pie-plot",!0)}return __extends(c,b),c.prototype._computeLayout=function(a,c,d,e){b.prototype._computeLayout.call(this,a,c,d,e),this._renderArea.attr("transform","translate("+this.width()/2+","+this.height()/2+")")},c.prototype.addDataset=function(c,d){return 1===this._datasetKeysInOrder.length?(a._Util.Methods.warn("Only one dataset is supported in Pie plots"),this):(b.prototype.addDataset.call(this,c,d),this)},c.prototype._generateAttrToProjector=function(){var a=this,c=b.prototype._generateAttrToProjector.call(this);c["inner-radius"]=c["inner-radius"]||d3.functor(0),c["outer-radius"]=c["outer-radius"]||d3.functor(Math.min(this.width(),this.height())/2);var d=function(b,c){return a._colorScale.scale(String(c))};return c.fill=c.fill||d,c},c.prototype._getDrawer=function(b){return new a._Drawer.Arc(b).setClass("arc")},c.prototype.getAllPlotData=function(a){var c=this,d=b.prototype.getAllPlotData.call(this,a);return d.pixelPoints.forEach(function(a){a.x=a.x+c.width()/2,a.y=a.y+c.height()/2}),d},c}(b.AbstractPlot);b.Pie=c}(b=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){var b;!function(b){var c=function(b){function c(a,c){var d=this;if(b.call(this),this._autoAdjustXScaleDomain=!1,this._autoAdjustYScaleDomain=!1,null==a||null==c)throw new Error("XYPlots require an xScale and yScale");this.classed("xy-plot",!0),this._xScale=a,this._yScale=c,this._updateXDomainer(),a.broadcaster.registerListener("yDomainAdjustment"+this.getID(),function(){return d._adjustYDomainOnChangeFromX()}),this._updateYDomainer(),c.broadcaster.registerListener("xDomainAdjustment"+this.getID(),function(){return d._adjustXDomainOnChangeFromY()})}return __extends(c,b),c.prototype.project=function(a,c,d){var e=this;return"x"===a&&d&&(this._xScale&&this._xScale.broadcaster.deregisterListener("yDomainAdjustment"+this.getID()),this._xScale=d,this._updateXDomainer(),d.broadcaster.registerListener("yDomainAdjustment"+this.getID(),function(){return e._adjustYDomainOnChangeFromX()})),"y"===a&&d&&(this._yScale&&this._yScale.broadcaster.deregisterListener("xDomainAdjustment"+this.getID()),this._yScale=d,this._updateYDomainer(),d.broadcaster.registerListener("xDomainAdjustment"+this.getID(),function(){return e._adjustXDomainOnChangeFromY()})),b.prototype.project.call(this,a,c,d),this},c.prototype.remove=function(){return b.prototype.remove.call(this),this._xScale&&this._xScale.broadcaster.deregisterListener("yDomainAdjustment"+this.getID()),this._yScale&&this._yScale.broadcaster.deregisterListener("xDomainAdjustment"+this.getID()),this},c.prototype.automaticallyAdjustYScaleOverVisiblePoints=function(a){return this._autoAdjustYScaleDomain=a,this._adjustYDomainOnChangeFromX(),this},c.prototype.automaticallyAdjustXScaleOverVisiblePoints=function(a){return this._autoAdjustXScaleDomain=a,this._adjustXDomainOnChangeFromY(),this},c.prototype._generateAttrToProjector=function(){var a=b.prototype._generateAttrToProjector.call(this),c=a.x,d=a.y;return a.defined=function(a,b,e,f){var g=c(a,b,e,f),h=d(a,b,e,f);return null!=g&&g===g&&null!=h&&h===h},a},c.prototype._computeLayout=function(c,d,e,f){b.prototype._computeLayout.call(this,c,d,e,f),this._xScale.range([0,this.width()]),this._yScale.range(this._yScale instanceof a.Scale.Category?[0,this.height()]:[this.height(),0])},c.prototype._updateXDomainer=function(){if(this._xScale instanceof a.Scale.AbstractQuantitative){var b=this._xScale;b._userSetDomainer||b.domainer().pad().nice()}},c.prototype._updateYDomainer=function(){if(this._yScale instanceof a.Scale.AbstractQuantitative){var b=this._yScale;b._userSetDomainer||b.domainer().pad().nice()}},c.prototype.showAllData=function(){this._xScale.autoDomain(),this._autoAdjustYScaleDomain||this._yScale.autoDomain()},c.prototype._adjustYDomainOnChangeFromX=function(){this._projectorsReady()&&this._autoAdjustYScaleDomain&&this._adjustDomainToVisiblePoints(this._xScale,this._yScale,!0)},c.prototype._adjustXDomainOnChangeFromY=function(){this._projectorsReady()&&this._autoAdjustXScaleDomain&&this._adjustDomainToVisiblePoints(this._yScale,this._xScale,!1)},c.prototype._adjustDomainToVisiblePoints=function(b,c,d){if(c instanceof a.Scale.AbstractQuantitative){var e,f=c,g=this._normalizeDatasets(d);if(b instanceof a.Scale.AbstractQuantitative){var h=b.domain();e=function(a){return h[0]<=a&&h[1]>=a}}else{var i=d3.set(b.domain());e=function(a){return i.has(a)}}var j=this._adjustDomainOverVisiblePoints(g,e);if(0===j.length)return;j=f.domainer().computeDomain([j],f),f.domain(j)}},c.prototype._normalizeDatasets=function(b){var c=this,d=this._projections[b?"x":"y"].accessor,e=this._projections[b?"y":"x"].accessor;return a._Util.Methods.flatten(this._datasetKeysInOrder.map(function(a){var b=c._key2PlotDatasetKey.get(a).dataset,f=c._key2PlotDatasetKey.get(a).plotMetadata;return b.data().map(function(a,c){return{a:d(a,c,b.metadata(),f),b:e(a,c,b.metadata(),f)}})}))},c.prototype._adjustDomainOverVisiblePoints=function(b,c){var d=b.filter(function(a){return c(a.a)}).map(function(a){return a.b}),e=[];return 0!==d.length&&(e=[a._Util.Methods.min(d,null),a._Util.Methods.max(d,null)]),e},c.prototype._projectorsReady=function(){return this._projections.x&&this._projections.y},c}(b.AbstractPlot);b.AbstractXYPlot=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this._defaultFillColor=(new a.Scale.Color).range()[0],this.classed("rectangle-plot",!0)}return __extends(c,b),c.prototype._getDrawer=function(b){return new a._Drawer.Rect(b,!0)},c.prototype._generateAttrToProjector=function(){var a=b.prototype._generateAttrToProjector.call(this),c=a.x1,d=a.y1,e=a.x2,f=a.y2;return a.width=function(a,b,d,f){return Math.abs(e(a,b,d,f)-c(a,b,d,f))},a.x=function(a,b,d,f){return Math.min(c(a,b,d,f),e(a,b,d,f))},a.height=function(a,b,c,e){return Math.abs(f(a,b,c,e)-d(a,b,c,e))},a.y=function(b,c,e,g){return Math.max(d(b,c,e,g),f(b,c,e,g))-a.height(b,c,e,g)},delete a.x1,delete a.y1,delete a.x2,delete a.y2,a.fill=a.fill||d3.functor(this._defaultFillColor),a},c.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("rectangles")}]},c}(b.AbstractXYPlot);b.Rectangle=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this._closeDetectionRadius=5,this.classed("scatter-plot",!0),this._defaultFillColor=(new a.Scale.Color).range()[0],this.animator("symbols-reset",new a.Animator.Null),this.animator("symbols",(new a.Animator.Base).duration(250).delay(5))}return __extends(c,b),c.prototype._getDrawer=function(b){return new a._Drawer.Symbol(b)},c.prototype._generateAttrToProjector=function(){var c=b.prototype._generateAttrToProjector.call(this);return c.size=c.size||d3.functor(6),c.opacity=c.opacity||d3.functor(.6),c.fill=c.fill||d3.functor(this._defaultFillColor),c.symbol=c.symbol||function(){return a.SymbolFactories.circle()},c},c.prototype._generateDrawSteps=function(){var a=[];if(this._dataChanged&&this._animate){var b=this._generateAttrToProjector();b.size=function(){return 0},a.push({attrToProjector:b,animator:this._getAnimator("symbols-reset")})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("symbols")}),a},c.prototype._getClosestStruckPoint=function(a,b){var c,d,e,f,g=this,h=this._generateAttrToProjector(),i=(h.x,h.y,function(b,c,d,e){var f=h.x(b,c,d,e)-a.x,g=h.y(b,c,d,e)-a.y;return f*f+g*g}),j=!1,k=b*b;if(this._datasetKeysInOrder.forEach(function(a){var b=g._key2PlotDatasetKey.get(a).dataset,l=g._key2PlotDatasetKey.get(a).plotMetadata,m=g._key2PlotDatasetKey.get(a).drawer;m._getRenderArea().selectAll("path").each(function(a,g){var m=i(a,g,b.metadata(),l),n=h.size(a,g,b.metadata(),l)/2;n*n>m?((!j||k>m)&&(c=this,f=g,k=m,d=b.metadata(),e=l),j=!0):!j&&k>m&&(c=this,f=g,k=m,d=b.metadata(),e=l)})}),!c)return{selection:null,pixelPositions:null,data:null};var l=d3.select(c),m=l.data(),n={x:h.x(m[0],f,d,e),y:h.y(m[0],f,d,e)};return{selection:l,pixelPositions:[n],data:m}},c.prototype._hoverOverComponent=function(){},c.prototype._hoverOutComponent=function(){},c.prototype._doHover=function(a){return this._getClosestStruckPoint(a,this._closeDetectionRadius)},c}(b.AbstractXYPlot);b.Scatter=c}(b=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){var b;!function(b){var c=function(b){function c(c,d,e){b.call(this,c,d),this.classed("grid-plot",!0),c instanceof a.Scale.Category&&c.innerPadding(0).outerPadding(0),d instanceof a.Scale.Category&&d.innerPadding(0).outerPadding(0),this._colorScale=e,this.animator("cells",new a.Animator.Null)}return __extends(c,b),c.prototype.addDataset=function(c,d){return 1===this._datasetKeysInOrder.length?(a._Util.Methods.warn("Only one dataset is supported in Grid plots"),this):(b.prototype.addDataset.call(this,c,d),this)},c.prototype._getDrawer=function(b){return new a._Drawer.Rect(b,!0)},c.prototype.project=function(c,d,e){var f=this;return b.prototype.project.call(this,c,d,e),"x"===c&&(e instanceof a.Scale.Category&&(this.project("x1",function(a,b,c,d){return e.scale(f._projections.x.accessor(a,b,c,d))-e.rangeBand()/2}),this.project("x2",function(a,b,c,d){return e.scale(f._projections.x.accessor(a,b,c,d))+e.rangeBand()/2})),e instanceof a.Scale.AbstractQuantitative&&this.project("x1",function(a,b,c,d){return e.scale(f._projections.x.accessor(a,b,c,d))})),"y"===c&&(e instanceof a.Scale.Category&&(this.project("y1",function(a,b,c,d){return e.scale(f._projections.y.accessor(a,b,c,d))-e.rangeBand()/2}),this.project("y2",function(a,b,c,d){return e.scale(f._projections.y.accessor(a,b,c,d))+e.rangeBand()/2})),e instanceof a.Scale.AbstractQuantitative&&this.project("y1",function(a,b,c,d){return e.scale(f._projections.y.accessor(a,b,c,d))})),"fill"===c&&(this._colorScale=this._projections.fill.scale),this},c.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("cells")}]},c}(b.Rectangle);b.Grid=c}(b=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){var b;!function(b){var c=function(b){function c(c,d,e){void 0===e&&(e=!0),b.call(this,c,d),this._barAlignmentFactor=.5,this._barLabelFormatter=a.Formatters.identity(),this._barLabelsEnabled=!1,this._hoverMode="point",this._hideBarsIfAnyAreTooWide=!0,this.classed("bar-plot",!0),this._defaultFillColor=(new a.Scale.Color).range()[0],this.animator("bars-reset",new a.Animator.Null),this.animator("bars",new a.Animator.Base),this.animator("baseline",new a.Animator.Null),this._isVertical=e,this.baseline(0)}return __extends(c,b),c.prototype._getDrawer=function(b){return new a._Drawer.Rect(b,this._isVertical)},c.prototype._setup=function(){b.prototype._setup.call(this),this._baseline=this._renderArea.append("line").classed("baseline",!0)},c.prototype.baseline=function(a){return null==a?this._baselineValue:(this._baselineValue=a,this._updateXDomainer(),this._updateYDomainer(),this._render(),this)},c.prototype.barAlignment=function(a){var b=a.toLowerCase(),c=this.constructor._BarAlignmentToFactor;if(void 0===c[b])throw new Error("unsupported bar alignment");return this._barAlignmentFactor=c[b],this._render(),this},c.prototype._parseExtent=function(a){if("number"==typeof a)return{min:a,max:a};if(a instanceof Object&&"min"in a&&"max"in a)return a;throw new Error("input '"+a+"' can't be parsed as an Extent")},c.prototype.barLabelsEnabled=function(a){return void 0===a?this._barLabelsEnabled:(this._barLabelsEnabled=a,this._render(),this)},c.prototype.barLabelFormatter=function(a){return null==a?this._barLabelFormatter:(this._barLabelFormatter=a,this._render(),this)},c.prototype.getBars=function(a,b){var c=this;if(!this._isSetup)return d3.select();var d=this._parseExtent(a),e=this._parseExtent(b),f=this._datasetKeysInOrder.reduce(function(a,b){return a.concat(c._getBarsFromDataset(b,d,e))},[]);return d3.selectAll(f)},c.prototype._getBarsFromDataset=function(a,b,c){var d=.5,e=[],f=this._key2PlotDatasetKey.get(a).drawer;return f._getRenderArea().selectAll("rect").each(function(){var a=this.getBBox();a.x+a.width>=b.min-d&&a.x<=b.max+d&&a.y+a.height>=c.min-d&&a.y<=c.max+d&&e.push(this)}),e},c.prototype._updateDomainer=function(b){if(b instanceof a.Scale.AbstractQuantitative){var c=b;c._userSetDomainer||(null!=this._baselineValue?c.domainer().addPaddingException(this._baselineValue,"BAR_PLOT+"+this.getID()).addIncludedValue(this._baselineValue,"BAR_PLOT+"+this.getID()):c.domainer().removePaddingException("BAR_PLOT+"+this.getID()).removeIncludedValue("BAR_PLOT+"+this.getID()),c.domainer().pad().nice()),c._autoDomainIfAutomaticMode()}},c.prototype._updateYDomainer=function(){this._isVertical?this._updateDomainer(this._yScale):b.prototype._updateYDomainer.call(this)},c.prototype._updateXDomainer=function(){this._isVertical?b.prototype._updateXDomainer.call(this):this._updateDomainer(this._xScale)},c.prototype._additionalPaint=function(b){var c=this,d=this._isVertical?this._yScale:this._xScale,e=d.scale(this._baselineValue),f={x1:this._isVertical?0:e,y1:this._isVertical?e:0,x2:this._isVertical?this.width():e,y2:this._isVertical?e:this.height()};this._getAnimator("baseline").animate(this._baseline,f);var g=this._getDrawersInOrder();g.forEach(function(a){return a.removeLabels()}),this._barLabelsEnabled&&a._Util.Methods.setTimeout(function(){return c._drawLabels()},b)},c.prototype._drawLabels=function(){var a=this,b=this._getDrawersInOrder(),c=this._generateAttrToProjector(),d=this._getDataToDraw();this._datasetKeysInOrder.forEach(function(e,f){return b[f].drawText(d.get(e),c,a._key2PlotDatasetKey.get(e).dataset.metadata(),a._key2PlotDatasetKey.get(e).plotMetadata)}),this._hideBarsIfAnyAreTooWide&&b.some(function(a){return a._getIfLabelsTooWide()})&&b.forEach(function(a){return a.removeLabels()})},c.prototype._generateDrawSteps=function(){var a=[];if(this._dataChanged&&this._animate){var b=this._generateAttrToProjector(),c=this._isVertical?this._yScale:this._xScale,d=c.scale(this._baselineValue),e=this._isVertical?"y":"x",f=this._isVertical?"height":"width";b[e]=function(){return d},b[f]=function(){return 0},a.push({attrToProjector:b,animator:this._getAnimator("bars-reset")})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("bars")}),a},c.prototype._generateAttrToProjector=function(){var c=this,d=b.prototype._generateAttrToProjector.call(this),e=this._isVertical?this._yScale:this._xScale,f=this._isVertical?this._xScale:this._yScale,g=this._isVertical?"y":"x",h=this._isVertical?"x":"y",i=e.scale(this._baselineValue),j=d[h],k=d.width;null==k&&(k=function(){return c._getBarPixelWidth()});var l=d[g],m=function(a,b,c,d){return Math.abs(i-l(a,b,c,d))};d.width=this._isVertical?k:m,d.height=this._isVertical?m:k,d[h]=f instanceof a.Scale.Category?function(a,b,c,d){return j(a,b,c,d)-k(a,b,c,d)/2}:function(a,b,d,e){return j(a,b,d,e)-k(a,b,d,e)*c._barAlignmentFactor},d[g]=function(a,b,c,d){var e=l(a,b,c,d);return e>i?i:e};var n=this._projections[g].accessor;return this.barLabelsEnabled&&this.barLabelFormatter&&(d.label=function(a,b,d,e){return c._barLabelFormatter(n(a,b,d,e))},d.positive=function(a,b,c,d){return l(a,b,c,d)<=i}),d.fill=d.fill||d3.functor(this._defaultFillColor),d},c.prototype._getBarPixelWidth=function(){var b,d=this,e=this._isVertical?this._xScale:this._yScale;if(e instanceof a.Scale.Category)b=e.rangeBand();else{var f=this._isVertical?this._projections.x.accessor:this._projections.y.accessor,g=d3.set(a._Util.Methods.flatten(this._datasetKeysInOrder.map(function(a){var b=d._key2PlotDatasetKey.get(a).dataset,c=d._key2PlotDatasetKey.get(a).plotMetadata;return b.data().map(function(a,d){return f(a,d,b.metadata(),c).valueOf()})}))).values().map(function(a){return+a});g.sort(function(a,b){return a-b});var h=d3.pairs(g),i=this._isVertical?this.width():this.height();b=a._Util.Methods.min(h,function(a){return Math.abs(e.scale(a[1])-e.scale(a[0]))},i*c._SINGLE_BAR_DIMENSION_RATIO);var j=g.map(function(a){return e.scale(a)}),k=a._Util.Methods.min(j,0);0!==this._barAlignmentFactor&&k>0&&(b=Math.min(b,k/this._barAlignmentFactor));var l=a._Util.Methods.max(j,0);if(1!==this._barAlignmentFactor&&i>l){var m=i-l;b=Math.min(b,m/(1-this._barAlignmentFactor))}b*=c._BAR_WIDTH_RATIO}return b},c.prototype.hoverMode=function(a){if(null==a)return this._hoverMode;var b=a.toLowerCase();if("point"!==b&&"line"!==b)throw new Error(a+" is not a valid hover mode");return this._hoverMode=b,this},c.prototype._clearHoverSelection=function(){this._getDrawersInOrder().forEach(function(a){a._getRenderArea().selectAll("rect").classed("not-hovered hovered",!1)})},c.prototype._hoverOverComponent=function(){},c.prototype._hoverOutComponent=function(){this._clearHoverSelection()},c.prototype._doHover=function(a){var b=this,c=a.x,d=a.y;if("line"===this._hoverMode){var e={min:-1/0,max:1/0};this._isVertical?d=e:c=e}var f=this._parseExtent(c),g=this._parseExtent(d),h=[],i=[],j=this._generateAttrToProjector();this._datasetKeysInOrder.forEach(function(a){var c=b._key2PlotDatasetKey.get(a).dataset,d=b._key2PlotDatasetKey.get(a).plotMetadata,e=b._getBarsFromDataset(a,f,g);d3.selectAll(e).each(function(a,e){i.push(b._isVertical?{x:j.x(a,e,c.metadata(),d)+j.width(a,e,c.metadata(),d)/2,y:j.y(a,e,c.metadata(),d)+(j.positive(a,e,c.metadata(),d)?0:j.height(a,e,c.metadata(),d))}:{x:j.x(a,e,c.metadata(),d)+j.height(a,e,c.metadata(),d)/2,y:j.y(a,e,c.metadata(),d)+(j.positive(a,e,c.metadata(),d)?0:j.width(a,e,c.metadata(),d))})}),h=h.concat(e)});var k=d3.selectAll(h);return k.empty()?(this._clearHoverSelection(),{data:null,pixelPositions:null,selection:null}):(this._getDrawersInOrder().forEach(function(a){a._getRenderArea().selectAll("rect").classed({hovered:!1,"not-hovered":!0})}),k.classed({hovered:!0,"not-hovered":!1}),{data:k.data(),pixelPositions:i,selection:k})},c._BarAlignmentToFactor={left:0,center:.5,right:1},c._DEFAULT_WIDTH=10,c._BAR_WIDTH_RATIO=.95,c._SINGLE_BAR_DIMENSION_RATIO=.4,c}(b.AbstractXYPlot);b.Bar=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this._hoverDetectionRadius=15,this.classed("line-plot",!0),this.animator("reset",new a.Animator.Null),this.animator("main",(new a.Animator.Base).duration(600).easing("exp-in-out")),this._defaultStrokeColor=(new a.Scale.Color).range()[0]}return __extends(c,b),c.prototype._setup=function(){b.prototype._setup.call(this),this._hoverTarget=this.foreground().append("circle").classed("hover-target",!0).attr("r",this._hoverDetectionRadius).style("visibility","hidden")},c.prototype._rejectNullsAndNaNs=function(a,b,c,d,e){var f=e(a,b,c,d);return null!=f&&f===f},c.prototype._getDrawer=function(b){return new a._Drawer.Line(b)},c.prototype._getResetYFunction=function(){var a=this._yScale.domain(),b=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]),d=0>b&&b||c>0&&c||0,e=this._yScale.scale(d);return function(){return e}},c.prototype._generateDrawSteps=function(){var a=[];if(this._dataChanged&&this._animate){var b=this._generateAttrToProjector();b.y=this._getResetYFunction(),a.push({attrToProjector:b,animator:this._getAnimator("reset")})}return a.push({attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("main")}),a},c.prototype._generateAttrToProjector=function(){var a=this,c=b.prototype._generateAttrToProjector.call(this),d=this._wholeDatumAttributes(),e=function(a){return-1===d.indexOf(a)},f=d3.keys(c).filter(e);f.forEach(function(a){var b=c[a];c[a]=function(a,c,d,e){return a.length>0?b(a[0],c,d,e):null}});var g=c.x,h=c.y;return c.defined=function(b,c,d,e){return a._rejectNullsAndNaNs(b,c,d,e,g)&&a._rejectNullsAndNaNs(b,c,d,e,h)},c.stroke=c.stroke||d3.functor(this._defaultStrokeColor),c["stroke-width"]=c["stroke-width"]||d3.functor("2px"),c},c.prototype._wholeDatumAttributes=function(){return["x","y"]},c.prototype._getClosestPlotData=function(b,c,d){var e=this;void 0===d&&(d=1/0);var f,g,h,i=d;return c.forEach(function(c){var d=e.getAllPlotData(c);d.pixelPoints.forEach(function(c,e){var j=a._Util.Methods.distanceSquared(b,c);i>j&&(i=j,f=d.data[e],h=c,g=d.selection)})}),null==f?{data:[],pixelPoints:[],selection:d3.select()}:{data:[f],pixelPoints:[h],selection:g}},c.prototype._getClosestWithinRange=function(a,b){var c,d,e=this,f=this._generateAttrToProjector(),g=f.x,h=f.y,i=function(b,c,d,e){var f=+g(b,c,d,e)-a.x,i=+h(b,c,d,e)-a.y;return f*f+i*i},j=b*b;return this._datasetKeysInOrder.forEach(function(a){var b=e._key2PlotDatasetKey.get(a).dataset,f=e._key2PlotDatasetKey.get(a).plotMetadata;b.data().forEach(function(a,e){var k=i(a,e,b.metadata(),f);j>k&&(c=a,d={x:g(a,e,b.metadata(),f),y:h(a,e,b.metadata(),f)},j=k)})}),{closestValue:c,closestPoint:d}},c.prototype._getAllPlotData=function(a){var b=this,c=[],d=[],e=[];return a.forEach(function(a){var f=b._key2PlotDatasetKey.get(a);if(null!=f){var g=f.drawer;f.dataset.data().forEach(function(a,b){c.push(a),d.push(g._getPixelPoint(a,b))}),f.dataset.data().length>0&&e.push(g._getSelection(0).node())}}),{data:c,pixelPoints:d,selection:d3.selectAll(e)}},c.prototype._hoverOverComponent=function(){},c.prototype._hoverOutComponent=function(){},c.prototype._doHover=function(a){var b=this._getClosestWithinRange(a,this._hoverDetectionRadius),c=b.closestValue;if(void 0===c)return{data:null,pixelPositions:null,selection:null};var d=b.closestPoint;return this._hoverTarget.attr({cx:b.closestPoint.x,cy:b.closestPoint.y}),{data:[c],pixelPositions:[d],selection:this._hoverTarget}},c}(b.AbstractXYPlot);b.Line=c}(b=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){var b;!function(b){var c=function(b){function c(c,d){b.call(this,c,d),this.classed("area-plot",!0),this.project("y0",0,d),this.animator("reset",new a.Animator.Null),this.animator("main",(new a.Animator.Base).duration(600).easing("exp-in-out")),this._defaultFillColor=(new a.Scale.Color).range()[0]}return __extends(c,b),c.prototype._onDatasetUpdate=function(){b.prototype._onDatasetUpdate.call(this),null!=this._yScale&&this._updateYDomainer()},c.prototype._getDrawer=function(b){return new a._Drawer.Area(b)},c.prototype._updateYDomainer=function(){var c=this;b.prototype._updateYDomainer.call(this);var d,e=this._projections.y0,f=e&&e.accessor;if(null!=f){var g=this.datasets().map(function(a){return a._getExtent(f,c._yScale._typeCoercer)}),h=a._Util.Methods.flatten(g),i=a._Util.Methods.uniq(h);1===i.length&&(d=i[0])}this._yScale._userSetDomainer||(null!=d?this._yScale.domainer().addPaddingException(d,"AREA_PLOT+"+this.getID()):this._yScale.domainer().removePaddingException("AREA_PLOT+"+this.getID()),this._yScale._autoDomainIfAutomaticMode())},c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),"y0"===a&&this._updateYDomainer(),this},c.prototype._getResetYFunction=function(){return this._generateAttrToProjector().y0},c.prototype._wholeDatumAttributes=function(){var a=b.prototype._wholeDatumAttributes.call(this);return a.push("y0"),a},c.prototype._generateAttrToProjector=function(){var a=b.prototype._generateAttrToProjector.call(this);return a["fill-opacity"]=a["fill-opacity"]||d3.functor(.25),a.fill=a.fill||d3.functor(this._defaultFillColor),a.stroke=a.stroke||d3.functor(this._defaultFillColor),a},c}(b.Line);b.Area=c}(b=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){var b;!function(b){var c=function(b){function c(a,c,d){void 0===d&&(d=!0),b.call(this,a,c,d)}return __extends(c,b),c.prototype._generateAttrToProjector=function(){var a=this,c=b.prototype._generateAttrToProjector.call(this),d=this._makeInnerScale(),e=function(){return d.rangeBand()};c.width=this._isVertical?e:c.width,c.height=this._isVertical?c.height:e;var f=c.x,g=c.y;return c.x=function(b,c,d,e){return a._isVertical?f(b,c,d,e)+e.position:f(b,d,d,e)},c.y=function(b,c,d,e){return a._isVertical?g(b,c,d,e):g(b,c,d,e)+e.position},c},c.prototype._updateClusterPosition=function(){var a=this,b=this._makeInnerScale();this._datasetKeysInOrder.forEach(function(c){var d=a._key2PlotDatasetKey.get(c).plotMetadata;d.position=b.scale(c)-b.rangeBand()/2})},c.prototype._makeInnerScale=function(){var b=new a.Scale.Category;if(b.domain(this._datasetKeysInOrder),this._projections.width){var c=this._projections.width,d=c.accessor,e=c.scale,f=e?function(a,b,c,f){return e.scale(d(a,b,c,f))}:d;b.range([0,f(null,0,null,null)])}else b.range([0,this._getBarPixelWidth()]);return b},c.prototype._getDataToDraw=function(){return this._updateClusterPosition(),b.prototype._getDataToDraw.call(this)},c.prototype._getPlotMetadataForDataset=function(a){var c=b.prototype._getPlotMetadataForDataset.call(this,a);return c.position=0,c},c}(b.Bar);b.ClusteredBar=c}(b=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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this._stackedExtent=[0,0]}return __extends(c,b),c.prototype._getPlotMetadataForDataset=function(a){var c=b.prototype._getPlotMetadataForDataset.call(this,a);return c.offsets=d3.map(),c},c.prototype.project=function(a,c,d){return b.prototype.project.call(this,a,c,d),this._projections.x&&this._projections.y&&("x"===a||"y"===a)&&this._updateStackOffsets(),this},c.prototype._onDatasetUpdate=function(){this._projectorsReady()&&this._updateStackOffsets(),b.prototype._onDatasetUpdate.call(this)},c.prototype._updateStackOffsets=function(){var b=this._generateDefaultMapArray(),c=this._getDomainKeys(),d=b.map(function(b){return a._Util.Methods.populateMap(c,function(a){return{key:a,value:Math.max(0,b.get(a).value)}})}),e=b.map(function(b){return a._Util.Methods.populateMap(c,function(a){return{key:a,value:Math.min(b.get(a).value,0)}})});this._setDatasetStackOffsets(this._stack(d),this._stack(e)),this._updateStackExtents()},c.prototype._updateStackExtents=function(){var b=this,c=(this.datasets(),this._valueAccessor()),d=this._keyAccessor(),e=a._Util.Methods.max(this._datasetKeysInOrder,function(e){var f=b._key2PlotDatasetKey.get(e).dataset,g=b._key2PlotDatasetKey.get(e).plotMetadata;return a._Util.Methods.max(f.data(),function(a,b){return+c(a,b,f.metadata(),g)+g.offsets.get(d(a,b,f.metadata(),g))},0)},0),f=a._Util.Methods.min(this._datasetKeysInOrder,function(e){var f=b._key2PlotDatasetKey.get(e).dataset,g=b._key2PlotDatasetKey.get(e).plotMetadata;return a._Util.Methods.min(f.data(),function(a,b){return+c(a,b,f.metadata(),g)+g.offsets.get(d(a,b,f.metadata(),g))},0)},0);this._stackedExtent=[Math.min(f,0),Math.max(0,e)]},c.prototype._stack=function(a){var b=this,c=function(a,b){a.offset=b};return d3.layout.stack().x(function(a){return a.key}).y(function(a){return+a.value}).values(function(a){return b._getDomainKeys().map(function(b){return a.get(b)})}).out(c)(a),a},c.prototype._setDatasetStackOffsets=function(a,b){var c=this,d=this._keyAccessor(),e=this._valueAccessor();this._datasetKeysInOrder.forEach(function(f,g){var h=c._key2PlotDatasetKey.get(f).dataset,i=c._key2PlotDatasetKey.get(f).plotMetadata,j=a[g],k=b[g],l=h.data().every(function(a,b){return e(a,b,h.metadata(),i)<=0});h.data().forEach(function(a,b){var c,f=d(a,b,h.metadata(),i),g=j.get(f).offset,m=k.get(f).offset,n=e(a,b,h.metadata(),i);c=0===n?l?m:g:n>0?g:m,i.offsets.set(f,c)})})},c.prototype._getDomainKeys=function(){var a=this,b=this._keyAccessor(),c=d3.set();return this._datasetKeysInOrder.forEach(function(d){var e=a._key2PlotDatasetKey.get(d).dataset,f=a._key2PlotDatasetKey.get(d).plotMetadata;e.data().forEach(function(a,d){c.add(b(a,d,e.metadata(),f))})}),c.values()},c.prototype._generateDefaultMapArray=function(){var b=this,c=this._keyAccessor(),d=this._valueAccessor(),e=this._getDomainKeys(),f=this._datasetKeysInOrder.map(function(){return a._Util.Methods.populateMap(e,function(a){return{key:a,value:0}})});return this._datasetKeysInOrder.forEach(function(a,e){var g=b._key2PlotDatasetKey.get(a).dataset,h=b._key2PlotDatasetKey.get(a).plotMetadata;g.data().forEach(function(a,b){var i=c(a,b,g.metadata(),h),j=d(a,b,g.metadata(),h);f[e].set(i,{key:i,value:j})})}),f},c.prototype._updateScaleExtents=function(){b.prototype._updateScaleExtents.call(this);var a=this._isVertical?this._yScale:this._xScale;a&&(this._isAnchored&&this._stackedExtent.length>0?a._updateExtent(this.getID().toString(),"_PLOTTABLE_PROTECTED_FIELD_STACK_EXTENT",this._stackedExtent):a._removeExtent(this.getID().toString(),"_PLOTTABLE_PROTECTED_FIELD_STACK_EXTENT"))},c.prototype._normalizeDatasets=function(b){var c=this,d=this._projections[b?"x":"y"].accessor,e=this._projections[b?"y":"x"].accessor,f=function(a,f,g,h){var i=d(a,f,g,h);return(c._isVertical?!b:b)&&(i+=h.offsets.get(e(a,f,g,h))),i},g=function(a,f,g,h){var i=e(a,f,g,h);return(c._isVertical?b:!b)&&(i+=h.offsets.get(d(a,f,g,h))),i};return a._Util.Methods.flatten(this._datasetKeysInOrder.map(function(a){var b=c._key2PlotDatasetKey.get(a).dataset,d=c._key2PlotDatasetKey.get(a).plotMetadata;return b.data().map(function(a,c){return{a:f(a,c,b.metadata(),d),b:g(a,c,b.metadata(),d)}})}))},c.prototype._keyAccessor=function(){return this._isVertical?this._projections.x.accessor:this._projections.y.accessor},c.prototype._valueAccessor=function(){return this._isVertical?this._projections.y.accessor:this._projections.x.accessor},c}(b.AbstractXYPlot);b.AbstractStacked=c}(b=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){var b;!function(b){var c=function(c){function d(a,b){c.call(this,a,b),this._baselineValue=0,this.classed("area-plot",!0),this._isVertical=!0}return __extends(d,c),d.prototype._getDrawer=function(b){return new a._Drawer.Area(b).drawLine(!1)},d.prototype._getAnimator=function(){return new a.Animator.Null},d.prototype._setup=function(){c.prototype._setup.call(this),this._baseline=this._renderArea.append("line").classed("baseline",!0)},d.prototype._additionalPaint=function(){var a=this._yScale.scale(this._baselineValue),b={x1:0,y1:a,x2:this.width(),y2:a};this._getAnimator("baseline").animate(this._baseline,b)},d.prototype._updateYDomainer=function(){c.prototype._updateYDomainer.call(this);var a=this._yScale;a._userSetDomainer||(a.domainer().addPaddingException(0,"STACKED_AREA_PLOT+"+this.getID()).addIncludedValue(0,"STACKED_AREA_PLOT+"+this.getID()),a._autoDomainIfAutomaticMode())},d.prototype.project=function(a,d,e){return c.prototype.project.call(this,a,d,e),b.AbstractStacked.prototype.project.apply(this,[a,d,e]),this},d.prototype._onDatasetUpdate=function(){return c.prototype._onDatasetUpdate.call(this),b.AbstractStacked.prototype._onDatasetUpdate.apply(this),this},d.prototype._generateAttrToProjector=function(){var a=this,b=c.prototype._generateAttrToProjector.call(this);null==this._projections["fill-opacity"]&&(b["fill-opacity"]=d3.functor(1));var d=this._projections.y.accessor,e=this._projections.x.accessor;return b.y=function(b,c,f,g){return a._yScale.scale(+d(b,c,f,g)+g.offsets.get(e(b,c,f,g)))},b.y0=function(b,c,d,f){return a._yScale.scale(f.offsets.get(e(b,c,d,f)))},b},d.prototype._wholeDatumAttributes=function(){return["x","y","defined"]},d.prototype._updateStackOffsets=function(){var c=this;if(this._projectorsReady()){var d=this._getDomainKeys(),e=this._isVertical?this._projections.x.accessor:this._projections.y.accessor,f=this._datasetKeysInOrder.map(function(a){var b=c._key2PlotDatasetKey.get(a).dataset,d=c._key2PlotDatasetKey.get(a).plotMetadata;return d3.set(b.data().map(function(a,c){return e(a,c,b.metadata(),d).toString()})).values()});f.some(function(a){return a.length!==d.length})&&a._Util.Methods.warn("the domains across the datasets are not the same. Plot may produce unintended behavior."),b.AbstractStacked.prototype._updateStackOffsets.call(this)}},d.prototype._updateStackExtents=function(){b.AbstractStacked.prototype._updateStackExtents.call(this)},d.prototype._stack=function(a){return b.AbstractStacked.prototype._stack.call(this,a)},d.prototype._setDatasetStackOffsets=function(a,c){b.AbstractStacked.prototype._setDatasetStackOffsets.call(this,a,c)},d.prototype._getDomainKeys=function(){return b.AbstractStacked.prototype._getDomainKeys.call(this)},d.prototype._generateDefaultMapArray=function(){return b.AbstractStacked.prototype._generateDefaultMapArray.call(this)},d.prototype._updateScaleExtents=function(){b.AbstractStacked.prototype._updateScaleExtents.call(this)},d.prototype._keyAccessor=function(){return b.AbstractStacked.prototype._keyAccessor.call(this)},d.prototype._valueAccessor=function(){return b.AbstractStacked.prototype._valueAccessor.call(this)},d.prototype._getPlotMetadataForDataset=function(a){return b.AbstractStacked.prototype._getPlotMetadataForDataset.call(this,a)},d.prototype._normalizeDatasets=function(a){return b.AbstractStacked.prototype._normalizeDatasets.call(this,a)},d}(b.Area);b.StackedArea=c}(b=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){var b;!function(b){var c=function(c){function d(a,b,d){void 0===d&&(d=!0),c.call(this,a,b,d)}return __extends(d,c),d.prototype._getAnimator=function(b){if(this._animate&&this._animateOnNextRender){if(this.animator(b))return this.animator(b);if("stacked-bar"===b){var c=this._isVertical?this._yScale:this._xScale,d=c.scale(this.baseline());return new a.Animator.MovingRect(d,this._isVertical)}}return new a.Animator.Null},d.prototype._generateAttrToProjector=function(){var a=this,b=c.prototype._generateAttrToProjector.call(this),d=this._isVertical?"y":"x",e=this._isVertical?"x":"y",f=this._isVertical?this._yScale:this._xScale,g=this._projections[d].accessor,h=this._projections[e].accessor,i=function(a,b,c,d){return f.scale(d.offsets.get(h(a,b,c,d)))},j=function(a,b,c,d){return f.scale(+g(a,b,c,d)+d.offsets.get(h(a,b,c,d)))},k=function(a,b,c,d){return Math.abs(j(a,b,c,d)-i(a,b,c,d))},l=function(a,b,c,d){return+g(a,b,c,d)<0?i(a,b,c,d):j(a,b,c,d)};return b[d]=function(b,c,d,e){return a._isVertical?l(b,c,d,e):l(b,c,d,e)-k(b,c,d,e)},b},d.prototype._generateDrawSteps=function(){return[{attrToProjector:this._generateAttrToProjector(),animator:this._getAnimator("stacked-bar")}]},d.prototype.project=function(a,d,e){return c.prototype.project.call(this,a,d,e),b.AbstractStacked.prototype.project.apply(this,[a,d,e]),this},d.prototype._onDatasetUpdate=function(){return c.prototype._onDatasetUpdate.call(this),b.AbstractStacked.prototype._onDatasetUpdate.apply(this),this},d.prototype._getPlotMetadataForDataset=function(a){return b.AbstractStacked.prototype._getPlotMetadataForDataset.call(this,a)},d.prototype._normalizeDatasets=function(a){return b.AbstractStacked.prototype._normalizeDatasets.call(this,a)},d.prototype._updateStackOffsets=function(){b.AbstractStacked.prototype._updateStackOffsets.call(this)},d.prototype._updateStackExtents=function(){b.AbstractStacked.prototype._updateStackExtents.call(this)},d.prototype._stack=function(a){return b.AbstractStacked.prototype._stack.call(this,a)},d.prototype._setDatasetStackOffsets=function(a,c){b.AbstractStacked.prototype._setDatasetStackOffsets.call(this,a,c)},d.prototype._getDomainKeys=function(){return b.AbstractStacked.prototype._getDomainKeys.call(this)},d.prototype._generateDefaultMapArray=function(){return b.AbstractStacked.prototype._generateDefaultMapArray.call(this)},d.prototype._updateScaleExtents=function(){b.AbstractStacked.prototype._updateScaleExtents.call(this)},d.prototype._keyAccessor=function(){return b.AbstractStacked.prototype._keyAccessor.call(this)},d.prototype._valueAccessor=function(){return b.AbstractStacked.prototype._valueAccessor.call(this)},d}(b.Bar);b.StackedBar=c}(b=a.Plot||(a.Plot={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(){}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){}return a.prototype.getTiming=function(){return 0},a.prototype.animate=function(a,b){return a.attr(b)},a}();a.Null=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var Plottable;!function(a){var b;!function(a){var b=function(){function a(){this._duration=a.DEFAULT_DURATION_MILLISECONDS,this._delay=a.DEFAULT_DELAY_MILLISECONDS,this._easing=a.DEFAULT_EASING,this._maxIterativeDelay=a.DEFAULT_MAX_ITERATIVE_DELAY_MILLISECONDS,this._maxTotalDuration=a.DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS}return a.prototype.getTiming=function(a){var b=Math.max(this.maxTotalDuration()-this.duration(),0),c=Math.min(this.maxIterativeDelay(),b/Math.max(a-1,1)),d=c*a+this.delay()+this.duration();return d},a.prototype.animate=function(a,b){var c=this,d=a[0].length,e=Math.max(this.maxTotalDuration()-this.duration(),0),f=Math.min(this.maxIterativeDelay(),e/Math.max(d-1,1));return a.transition().ease(this.easing()).duration(this.duration()).delay(function(a,b){return c.delay()+f*b}).attr(b)},a.prototype.duration=function(a){return null==a?this._duration:(this._duration=a,this)},a.prototype.delay=function(a){return null==a?this._delay:(this._delay=a,this)},a.prototype.easing=function(a){return null==a?this._easing:(this._easing=a,this)},a.prototype.maxIterativeDelay=function(a){return null==a?this._maxIterativeDelay:(this._maxIterativeDelay=a,this)},a.prototype.maxTotalDuration=function(a){return null==a?this._maxTotalDuration:(this._maxTotalDuration=a,this)},a.DEFAULT_DURATION_MILLISECONDS=300,a.DEFAULT_DELAY_MILLISECONDS=0,a.DEFAULT_MAX_ITERATIVE_DELAY_MILLISECONDS=15,a.DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS=600,a.DEFAULT_EASING="exp-out",a}();a.Base=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(a){var b=function(a){function b(b,c){void 0===b&&(b=!0),void 0===c&&(c=!1),a.call(this),this.isVertical=b,this.isReverse=c}return __extends(b,a),b.prototype.animate=function(c,d){var e={};return b.ANIMATED_ATTRIBUTES.forEach(function(a){return e[a]=d[a]}),e[this._getMovingAttr()]=this._startMovingProjector(d),e[this._getGrowingAttr()]=function(){return 0},c.attr(e),a.prototype.animate.call(this,c,d)},b.prototype._startMovingProjector=function(a){if(this.isVertical===this.isReverse)return a[this._getMovingAttr()];var b=a[this._getMovingAttr()],c=a[this._getGrowingAttr()];return function(a,d,e,f){return b(a,d,e,f)+c(a,d,e,f)}},b.prototype._getGrowingAttr=function(){return this.isVertical?"height":"width"},b.prototype._getMovingAttr=function(){return this.isVertical?"y":"x"},b.ANIMATED_ATTRIBUTES=["height","width","x","y","fill"],b}(a.Base);a.Rect=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(a){var b=function(a){function b(b,c){void 0===c&&(c=!0),a.call(this,c),this.startPixelValue=b}return __extends(b,a),b.prototype._startMovingProjector=function(){return d3.functor(this.startPixelValue)},b}(a.Rect);a.MovingRect=b}(b=a.Animator||(a.Animator={}))}(Plottable||(Plottable={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Plottable;!function(a){var b;!function(b){var c=function(a){function b(){a.apply(this,arguments),this._event2Callback={},this._broadcasters=[],this._connected=!1}return __extends(b,a),b.prototype._hasNoListeners=function(){return this._broadcasters.every(function(a){return 0===a.getListenerKeys().length})},b.prototype._connect=function(){var a=this;this._connected||(Object.keys(this._event2Callback).forEach(function(b){var c=a._event2Callback[b];document.addEventListener(b,c)}),this._connected=!0)},b.prototype._disconnect=function(){var a=this;this._connected&&this._hasNoListeners()&&(Object.keys(this._event2Callback).forEach(function(b){var c=a._event2Callback[b];document.removeEventListener(b,c)}),this._connected=!1)},b.prototype._getWrappedCallback=function(a){return function(){return a()}},b.prototype._setCallback=function(a,b,c){null===c?(a.deregisterListener(b),this._disconnect()):(this._connect(),a.registerListener(b,this._getWrappedCallback(c)))},b}(a.Core.PlottableObject);b.AbstractDispatcher=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(b){function c(c){var d=this;b.call(this),this.translator=a._Util.ClientToSVGTranslator.getTranslator(c),this._lastMousePosition={x:-1,y:-1},this._moveBroadcaster=new a.Core.Broadcaster(this);var e=function(a){return d._measureAndBroadcast(a,d._moveBroadcaster)};this._event2Callback.mouseover=e,this._event2Callback.mousemove=e,this._event2Callback.mouseout=e,this._downBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.mousedown=function(a){return d._measureAndBroadcast(a,d._downBroadcaster)},this._upBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.mouseup=function(a){return d._measureAndBroadcast(a,d._upBroadcaster)},this._wheelBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.wheel=function(a){return d._measureAndBroadcast(a,d._wheelBroadcaster)},this._dblClickBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.dblclick=function(a){return d._measureAndBroadcast(a,d._dblClickBroadcaster)},this._broadcasters=[this._moveBroadcaster,this._downBroadcaster,this._upBroadcaster,this._wheelBroadcaster,this._dblClickBroadcaster]}return __extends(c,b),c.getDispatcher=function(b){var d=a._Util.DOM.getBoundingSVG(b),e=d[c._DISPATCHER_KEY];return null==e&&(e=new c(d),d[c._DISPATCHER_KEY]=e),e},c.prototype._getWrappedCallback=function(a){return function(b,c,d){return a(c,d)}},c.prototype.onMouseMove=function(a,b){return this._setCallback(this._moveBroadcaster,a,b),this},c.prototype.onMouseDown=function(a,b){return this._setCallback(this._downBroadcaster,a,b),this},c.prototype.onMouseUp=function(a,b){return this._setCallback(this._upBroadcaster,a,b),this},c.prototype.onWheel=function(a,b){return this._setCallback(this._wheelBroadcaster,a,b),this},c.prototype.onDblClick=function(a,b){return this._setCallback(this._dblClickBroadcaster,a,b),this},c.prototype._measureAndBroadcast=function(a,b){var c=this.translator.computePosition(a.clientX,a.clientY);null!=c&&(this._lastMousePosition=c,b.broadcast(this.getLastMousePosition(),a))},c.prototype.getLastMousePosition=function(){return this._lastMousePosition},c._DISPATCHER_KEY="__Plottable_Dispatcher_Mouse",c}(b.AbstractDispatcher);b.Mouse=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(b){function c(c){var d=this;b.call(this),this.translator=a._Util.ClientToSVGTranslator.getTranslator(c),this._lastTouchPosition={x:-1,y:-1},this._startBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.touchstart=function(a){return d._measureAndBroadcast(a,d._startBroadcaster)},this._moveBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.touchmove=function(a){return d._measureAndBroadcast(a,d._moveBroadcaster)},this._endBroadcaster=new a.Core.Broadcaster(this),this._event2Callback.touchend=function(a){return d._measureAndBroadcast(a,d._endBroadcaster)},this._broadcasters=[this._moveBroadcaster,this._startBroadcaster,this._endBroadcaster]}return __extends(c,b),c.getDispatcher=function(b){var d=a._Util.DOM.getBoundingSVG(b),e=d[c._DISPATCHER_KEY];return null==e&&(e=new c(d),d[c._DISPATCHER_KEY]=e),e},c.prototype._getWrappedCallback=function(a){return function(b,c,d){return a(c,d)}},c.prototype.onTouchStart=function(a,b){return this._setCallback(this._startBroadcaster,a,b),this},c.prototype.onTouchMove=function(a,b){return this._setCallback(this._moveBroadcaster,a,b),this},c.prototype.onTouchEnd=function(a,b){return this._setCallback(this._endBroadcaster,a,b),this},c.prototype._measureAndBroadcast=function(a,b){var c=a.changedTouches[0],d=this.translator.computePosition(c.clientX,c.clientY);null!=d&&(this._lastTouchPosition=d,b.broadcast(this.getLastTouchPosition(),a))},c.prototype.getLastTouchPosition=function(){return this._lastTouchPosition},c._DISPATCHER_KEY="__Plottable_Dispatcher_Touch",c}(b.AbstractDispatcher);b.Touch=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(b){function c(){var c=this;b.call(this),this._event2Callback.keydown=function(a){return c._processKeydown(a)},this._keydownBroadcaster=new a.Core.Broadcaster(this),this._broadcasters=[this._keydownBroadcaster]}return __extends(c,b),c.getDispatcher=function(){var a=document[c._DISPATCHER_KEY];return null==a&&(a=new c,document[c._DISPATCHER_KEY]=a),a},c.prototype._getWrappedCallback=function(a){return function(b,c){return a(c.keyCode,c)}},c.prototype.onKeyDown=function(a,b){return this._setCallback(this._keydownBroadcaster,a,b),this},c.prototype._processKeydown=function(a){this._keydownBroadcaster.broadcast(a)},c._DISPATCHER_KEY="__Plottable_Dispatcher_Key",c}(b.AbstractDispatcher);b.Key=c}(b=a.Dispatcher||(a.Dispatcher={}))}(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){var b;!function(b){var c=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._anchor=function(a,b){this._componentToListenTo=a,this._hitBox=b},b.prototype._requiresHitbox=function(){return!1},b.prototype._translateToComponentSpace=function(a){var b=this._componentToListenTo.originToSVG();return{x:a.x-b.x,y:a.y-b.y}},b.prototype._isInsideComponent=function(a){return 0<=a.x&&0<=a.y&&a.x<=this._componentToListenTo.width()&&a.y<=this._componentToListenTo.height()},b}(a.Core.PlottableObject);b.AbstractInteraction=c}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._anchor=function(b,c){var d=this;a.prototype._anchor.call(this,b,c),c.on(this._listenTo(),function(){var a=d3.mouse(c.node()),b=a[0],e=a[1];d._callback({x:b,y:e})})},b.prototype._requiresHitbox=function(){return!0},b.prototype._listenTo=function(){return"click"},b.prototype.callback=function(a){return this._callback=a,this},b}(a.AbstractInteraction);a.Click=b}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._anchor=function(b,c){var d=this;a.prototype._anchor.call(this,b,c),c.on(this._listenTo(),function(){var a=d3.mouse(c.node()),b=a[0],e=a[1];d._callback({x:b,y:e})})},b.prototype._requiresHitbox=function(){return!0},b.prototype._listenTo=function(){return"dblclick"},b.prototype.callback=function(a){return this._callback=a,this},b}(a.AbstractInteraction);a.DoubleClick=b}(b=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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this._keyCode2Callback={}}return __extends(c,b),c.prototype._anchor=function(c,d){var e=this;b.prototype._anchor.call(this,c,d),this._positionDispatcher=a.Dispatcher.Mouse.getDispatcher(this._componentToListenTo._element.node()),this._positionDispatcher.onMouseMove("Interaction.Key"+this.getID(),function(){return null}),this._keyDispatcher=a.Dispatcher.Key.getDispatcher(),this._keyDispatcher.onKeyDown("Interaction.Key"+this.getID(),function(a){return e._handleKeyEvent(a)})},c.prototype._handleKeyEvent=function(a){var b=this._translateToComponentSpace(this._positionDispatcher.getLastMousePosition());this._isInsideComponent(b)&&this._keyCode2Callback[a]&&this._keyCode2Callback[a]()},c.prototype.on=function(a,b){return this._keyCode2Callback[a]=b,this},c}(b.AbstractInteraction);b.Key=c}(b=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){var b;!function(b){var c=function(b){function c(){b.apply(this,arguments),this._overComponent=!1}return __extends(c,b),c.prototype._anchor=function(c,d){var e=this;b.prototype._anchor.call(this,c,d),this._mouseDispatcher=a.Dispatcher.Mouse.getDispatcher(this._componentToListenTo.content().node()),this._mouseDispatcher.onMouseMove("Interaction.Pointer"+this.getID(),function(a){return e._handlePointerEvent(a)}),this._touchDispatcher=a.Dispatcher.Touch.getDispatcher(this._componentToListenTo.content().node()),this._touchDispatcher.onTouchStart("Interaction.Pointer"+this.getID(),function(a){return e._handlePointerEvent(a)})},c.prototype._handlePointerEvent=function(a){var b=this._translateToComponentSpace(a);if(this._isInsideComponent(b)){var c=this._overComponent;this._overComponent=!0,!c&&this._pointerEnterCallback&&this._pointerEnterCallback(b),this._pointerMoveCallback&&this._pointerMoveCallback(b)}else this._overComponent&&(this._overComponent=!1,this._pointerExitCallback&&this._pointerExitCallback(b))},c.prototype.onPointerEnter=function(a){return void 0===a?this._pointerEnterCallback:(this._pointerEnterCallback=a,this)},c.prototype.onPointerMove=function(a){return void 0===a?this._pointerMoveCallback:(this._pointerMoveCallback=a,this)},c.prototype.onPointerExit=function(a){return void 0===a?this._pointerExitCallback:(this._pointerExitCallback=a,this)},c}(b.AbstractInteraction);b.Pointer=c}(b=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){var b;!function(a){var b=function(a){function b(b,c){var d=this;a.call(this),b&&(this._xScale=b,this._xScale.broadcaster.registerListener("pziX"+this.getID(),function(){return d.resetZoom()})),c&&(this._yScale=c,this._yScale.broadcaster.registerListener("pziY"+this.getID(),function(){return d.resetZoom()}))}return __extends(b,a),b.prototype.resetZoom=function(){var a=this;this._zoom=d3.behavior.zoom(),this._xScale&&this._zoom.x(this._xScale._d3Scale),this._yScale&&this._zoom.y(this._yScale._d3Scale),this._zoom.on("zoom",function(){return a._rerenderZoomed()}),this._zoom(this._hitBox)},b.prototype._anchor=function(b,c){a.prototype._anchor.call(this,b,c),this.resetZoom()},b.prototype._requiresHitbox=function(){return!0},b.prototype._rerenderZoomed=function(){if(this._xScale){var a=this._xScale._d3Scale.domain();this._xScale.domain(a)}if(this._yScale){var b=this._yScale._d3Scale.domain();this._yScale.domain(b)}},b}(a.AbstractInteraction);a.PanZoom=b}(b=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){var b;!function(a){var b=function(a){function b(){var b=this;a.call(this),this._origin=[0,0],this._location=[0,0],this._isDragging=!1,this._dragBehavior=d3.behavior.drag(),this._dragBehavior.on("dragstart",function(){return b._dragstart()}),this._dragBehavior.on("drag",function(){return b._drag()}),this._dragBehavior.on("dragend",function(){return b._dragend()})}return __extends(b,a),b.prototype.dragstart=function(a){return void 0===a?this._ondragstart:(this._ondragstart=a,this)},b.prototype._setOrigin=function(a,b){this._origin=[a,b]},b.prototype._getOrigin=function(){return this._origin.slice()},b.prototype._setLocation=function(a,b){this._location=[a,b]},b.prototype._getLocation=function(){return this._location.slice()},b.prototype.drag=function(a){return void 0===a?this._ondrag:(this._ondrag=a,this)},b.prototype.dragend=function(a){return void 0===a?this._ondragend:(this._ondragend=a,this)},b.prototype._dragstart=function(){this._isDragging=!0;var a=this._componentToListenTo.width(),b=this._componentToListenTo.height(),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);var d=d3.mouse(this._hitBox[0][0].parentNode);this._setOrigin(d[0],d[1]),this._doDragstart()},b.prototype._doDragstart=function(){null!=this._ondragstart&&this._ondragstart({x:this._getOrigin()[0],y:this._getOrigin()[1]})},b.prototype._drag=function(){this._setLocation(this._constrainX(d3.event.x),this._constrainY(d3.event.y)),this._doDrag()},b.prototype._doDrag=function(){if(null!=this._ondrag){var a={x:this._getOrigin()[0],y:this._getOrigin()[1]},b={x:this._getLocation()[0],y:this._getLocation()[1]};this._ondrag(a,b)}},b.prototype._dragend=function(){var a=d3.mouse(this._hitBox[0][0].parentNode);this._setLocation(this._constrainX(a[0]),this._constrainY(a[1])),this._isDragging=!1,this._doDragend()},b.prototype._doDragend=function(){if(null!=this._ondragend){var a={x:this._getOrigin()[0],y:this._getOrigin()[1]},b={x:this._getLocation()[0],y:this._getLocation()[1]};this._ondragend(a,b)}},b.prototype._anchor=function(b,c){return a.prototype._anchor.call(this,b,c),c.call(this._dragBehavior),this},b.prototype._requiresHitbox=function(){return!0},b.prototype.setupZoomCallback=function(a,b){function c(c,g){return null==c||null==g?(f&&(null!=a&&a.domain(d),null!=b&&b.domain(e)),void(f=!f)):(f=!1,null!=a&&a.domain([a.invert(c.x),a.invert(g.x)]),null!=b&&b.domain([b.invert(g.y),b.invert(c.y)]),void this.clearBox())}var d=null!=a?a.domain():null,e=null!=b?b.domain():null,f=!1;return this.drag(c),this.dragend(c),this},b}(a.AbstractInteraction);a.Drag=b}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments),this._boxIsDrawn=!1,this._resizeXEnabled=!1,this._resizeYEnabled=!1,this._cursorStyle=""}return __extends(b,a),b.prototype.resizeEnabled=function(a){return null==a?this._resizeXEnabled||this._resizeYEnabled:(this._resizeXEnabled=a&&this.canResizeX(),this._resizeYEnabled=a&&this.canResizeY(),this)},b.prototype.isResizingX=function(){return!!this._xResizing},b.prototype.isResizingY=function(){return!!this._yResizing},b.prototype.boxIsDrawn=function(){return this._boxIsDrawn},b.prototype.isResizing=function(){return this.isResizingX()||this.isResizingY()},b.prototype._dragstart=function(){var b=d3.mouse(this._hitBox[0][0].parentNode);if(this.boxIsDrawn()){var c=this._getResizeInfo(b[0],b[1]);if(this._xResizing=c.xResizing,this._yResizing=c.yResizing,this.isResizing())return}a.prototype._dragstart.call(this),this.clearBox()},b.prototype._getResizeInfo=function(a,c){function d(a,b,c,d){return Math.min(b,c)-d<=a&&a<=Math.max(b,c)+d}function e(a,b,c,d){var e=Math.min(a,b),f=Math.max(a,b),g=Math.min(d,(f-e)/2);return c>e-d&&e+g>c?{offset:c-e,positive:!1,origin:a===e}:c>f-g&&f+d>c?{offset:c-f,positive:!0,origin:a===f}:null}var f=null,g=null,h=this._getOrigin()[0],i=this._getOrigin()[1],j=this._getLocation()[0],k=this._getLocation()[1];return this._resizeXEnabled&&d(c,i,k,b.RESIZE_PADDING)&&(f=e(h,j,a,b.RESIZE_PADDING)),this._resizeYEnabled&&d(a,h,j,b.RESIZE_PADDING)&&(g=e(i,k,c,b.RESIZE_PADDING)),{xResizing:f,yResizing:g}},b.prototype._drag=function(){if(this.isResizing()){if(this.isResizingX()){var b=this._xResizing.offset,c=d3.event.x;0!==b&&(c+=b,this._xResizing.offset+=b>0?-1:1),this._xResizing.origin?this._setOrigin(this._constrainX(c),this._getOrigin()[1]):this._setLocation(this._constrainX(c),this._getLocation()[1])}if(this.isResizingY()){var d=this._yResizing.offset,e=d3.event.y;0!==d&&(e+=d,this._yResizing.offset+=d>0?-1:1),this._yResizing.origin?this._setOrigin(this._getOrigin()[0],this._constrainY(e)):this._setLocation(this._getLocation()[0],this._constrainY(e))}this._doDrag()}else a.prototype._drag.call(this);this.setBox(this._getOrigin()[0],this._getLocation()[0],this._getOrigin()[1],this._getLocation()[1])},b.prototype._dragend=function(){this._xResizing=null,this._yResizing=null,a.prototype._dragend.call(this)},b.prototype.clearBox=function(){return null!=this.dragBox?(this.dragBox.attr("height",0).attr("width",0),this._boxIsDrawn=!1,this):void 0},b.prototype.setBox=function(a,b,c,d){if(null!=this.dragBox){var e=Math.abs(a-b),f=Math.abs(c-d),g=Math.min(a,b),h=Math.min(c,d);return this.dragBox.attr({x:g,y:h,width:e,height:f}),this._boxIsDrawn=e>0&&f>0,this}},b.prototype._anchor=function(c,d){var e=this;a.prototype._anchor.call(this,c,d);var f=b._CLASS_DRAG_BOX,g=this._componentToListenTo.background();return this.dragBox=g.append("rect").classed(f,!0).attr("x",0).attr("y",0),d.on("mousemove",function(){return e._hover()}),this},b.prototype._hover=function(){if(this.resizeEnabled()&&!this._isDragging&&this._boxIsDrawn){var a=d3.mouse(this._hitBox[0][0].parentNode);this._cursorStyle=this._getCursorStyle(a[0],a[1])}else this._boxIsDrawn||(this._cursorStyle="");this._hitBox.style("cursor",this._cursorStyle)},b.prototype._getCursorStyle=function(a,b){var c=this._getResizeInfo(a,b),d=c.xResizing&&!c.xResizing.positive,e=c.xResizing&&c.xResizing.positive,f=c.yResizing&&!c.yResizing.positive,g=c.yResizing&&c.yResizing.positive;return d&&f||g&&e?"nwse-resize":f&&e||g&&d?"nesw-resize":d||e?"ew-resize":f||g?"ns-resize":""},b.prototype.canResizeX=function(){return!0},b.prototype.canResizeY=function(){return!0},b._CLASS_DRAG_BOX="drag-box",b.RESIZE_PADDING=10,b._CAN_RESIZE_X=!0,b._CAN_RESIZE_Y=!0,b}(a.Drag);a.DragBox=b}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._setOrigin=function(b){a.prototype._setOrigin.call(this,b,0)},b.prototype._setLocation=function(b){a.prototype._setLocation.call(this,b,this._componentToListenTo.height())},b.prototype.canResizeY=function(){return!1},b}(a.DragBox);a.XDragBox=b}(b=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){var b;!function(b){var c=function(b){function c(){a._Util.Methods.warn("XYDragBox is deprecated; use DragBox instead"),b.call(this)}return __extends(c,b),c}(b.DragBox);b.XYDragBox=c}(b=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){var b;!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._setOrigin=function(b,c){a.prototype._setOrigin.call(this,0,c)},b.prototype._setLocation=function(b,c){a.prototype._setLocation.call(this,this._componentToListenTo.width(),c)},b.prototype.canResizeX=function(){return!1},b}(a.DragBox);a.YDragBox=b}(b=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){var b;!function(b){var c=function(b){function c(){b.call(this),this._overComponent=!1,this._currentHoverData={data:null,pixelPositions:null,selection:null},c.warned||(c.warned=!0,a._Util.Methods.warn("Interaction.Hover is deprecated; use Interaction.Pointer in conjunction with getClosestPlotData() instead."))}return __extends(c,b),c.prototype._anchor=function(c,d){var e=this;b.prototype._anchor.call(this,c,d),this._mouseDispatcher=a.Dispatcher.Mouse.getDispatcher(this._componentToListenTo._element.node()),this._mouseDispatcher.onMouseMove("hover"+this.getID(),function(a){return e._handlePointerEvent(a)}),this._touchDispatcher=a.Dispatcher.Touch.getDispatcher(this._componentToListenTo._element.node()),this._touchDispatcher.onTouchStart("hover"+this.getID(),function(a){return e._handlePointerEvent(a)})},c.prototype._handlePointerEvent=function(a){a=this._translateToComponentSpace(a),this._isInsideComponent(a)?(this._overComponent||this._componentToListenTo._hoverOverComponent(a),this.handleHoverOver(a),this._overComponent=!0):(this._componentToListenTo._hoverOutComponent(a),this.safeHoverOut(this._currentHoverData),this._currentHoverData={data:null,pixelPositions:null,selection:null},this._overComponent=!1)},c.diffHoverData=function(a,b){if(null==a.data||null==b.data)return a;var c=[],d=[],e=[];return a.data.forEach(function(f,g){-1===b.data.indexOf(f)&&(c.push(f),d.push(a.pixelPositions[g]),e.push(a.selection[0][g]))}),0===c.length?{data:null,pixelPositions:null,selection:null}:{data:c,pixelPositions:d,selection:d3.selectAll(e)}},c.prototype.handleHoverOver=function(a){var b=this._currentHoverData,d=this._componentToListenTo._doHover(a);this._currentHoverData=d;var e=c.diffHoverData(b,d);this.safeHoverOut(e);var f=c.diffHoverData(d,b);this.safeHoverOver(f)},c.prototype.safeHoverOut=function(a){this._hoverOutCallback&&a.data&&this._hoverOutCallback(a)},c.prototype.safeHoverOver=function(a){this._hoverOverCallback&&a.data&&this._hoverOverCallback(a)},c.prototype.onHoverOver=function(a){return this._hoverOverCallback=a,this},c.prototype.onHoverOut=function(a){return this._hoverOutCallback=a,this},c.prototype.getCurrentHoverData=function(){return this._currentHoverData},c.warned=!1,c}(b.AbstractInteraction);b.Hover=c}(b=a.Interaction||(a.Interaction={}))}(Plottable||(Plottable={}));var SVGTypewriter;!function(a){!function(a){!function(a){function b(a,b){if(null==a||null==b)return a===b;if(a.length!==b.length)return!1;for(var c=0;c0&&"\n"===b[0]?"\n":"";if(g>=c){var i=g/3,j=Math.floor(c/i);return{wrappedToken:h+"...".substr(0,j),remainingToken:b}}for(;f+g>c;)e=a.Utils.StringMethods.trimEnd(e.substr(0,e.length-1)),f=d.measure(e).width;return{wrappedToken:h+e+"...",remainingToken:a.Utils.StringMethods.trimEnd(b.substring(e.length),"-").trim()}},b.prototype.wrapNextToken=function(b,c,d){if(!c.canFitText||c.availableLines===c.wrapping.noLines||!this.canFitToken(b,c.availableWidth,d))return this.finishWrapping(b,c,d);for(var e=b;e;){var f=this.breakTokenToFitInWidth(e,c.currentLine,c.availableWidth,d);if(c.currentLine=f.line,e=f.remainingToken,null!=e){if(c.wrapping.noBrokeWords+=+f.breakWord,++c.wrapping.noLines,c.availableLines===c.wrapping.noLines){var g=this.addEllipsis(c.currentLine,c.availableWidth,d);return c.wrapping.wrappedText+=g.wrappedToken,c.wrapping.truncatedText+=g.remainingToken+e,c.currentLine="\n",c}c.wrapping.wrappedText+=a.Utils.StringMethods.trimEnd(c.currentLine),c.currentLine="\n"}}return c},b.prototype.finishWrapping=function(a,b,c){if(b.canFitText&&b.availableLines!==b.wrapping.noLines&&this._allowBreakingWords&&"none"!==this._textTrimming){var d=this.addEllipsis(b.currentLine+a,b.availableWidth,c);b.wrapping.wrappedText+=d.wrappedToken,b.wrapping.truncatedText+=d.remainingToken,b.wrapping.noBrokeWords+=+(d.remainingToken.length0),b.currentLine=""}else b.wrapping.truncatedText+=a;return b.canFitText=!1,b},b.prototype.breakTokenToFitInWidth=function(a,b,c,d,e){if(void 0===e&&(e=this._breakingCharacter),d.measure(b+a).width<=c)return{remainingToken:null,line:b+a,breakWord:!1};if(""===a.trim())return{remainingToken:"",line:b,breakWord:!1};if(!this._allowBreakingWords)return{remainingToken:a,line:b,breakWord:!1};for(var f=0;f0&&(g=e),{remainingToken:a.substring(f),line:b+a.substring(0,f)+g,breakWord:f>0}},b}();b.Wrapper=c}(a.Wrappers||(a.Wrappers={}));a.Wrappers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype.wrap=function(c,d,e,f){var g=this;void 0===f&&(f=1/0);var h=c.split("\n");if(h.length>1)throw new Error("SingleLineWrapper is designed to work only on single line");var i=function(b){return a.prototype.wrap.call(g,c,d,b,f)},j=i(e);if(j.noLines<2)return j;for(var k=0,l=e,m=0;mk;++m){var n=(l+k)/2,o=i(n);this.areSameResults(j,o)?(l=n,j=o):k=n}return j},b.prototype.areSameResults=function(a,b){return a.noLines===b.noLines&&a.truncatedText===b.truncatedText},b.NO_WRAP_ITERATIONS=5,b}(a.Wrapper);a.SingleLineWrapper=b}(a.Wrappers||(a.Wrappers={}));a.Wrappers}(SVGTypewriter||(SVGTypewriter={}));var SVGTypewriter;!function(a){!function(b){var c=function(){function b(a,c){this._writerID=b.nextID++,this._elementID=0,this.measurer(a),c&&this.wrapper(c),this.addTitleElement(!1)}return b.prototype.measurer=function(a){return this._measurer=a,this},b.prototype.wrapper=function(a){return this._wrapper=a,this},b.prototype.addTitleElement=function(a){return this._addTitleElement=a,this},b.prototype.writeLine=function(c,d,e,f,g){var h=d.append("text");h.text(c);var i=e*b.XOffsetFactor[f],j=b.AnchorConverter[f];h.attr("text-anchor",j).classed("text-line",!0),a.Utils.DOM.transform(h,i,g).attr("y","-0.25em")},b.prototype.writeText=function(a,c,d,e,f,g){var h=this,i=a.split("\n"),j=this._measurer.measure().height,k=b.YOffsetFactor[g]*(e-i.length*j);i.forEach(function(a,b){h.writeLine(a,c,d,f,(b+1)*j+k)})},b.prototype.write=function(a,c,d,e){if(-1===b.SupportedRotation.indexOf(e.textRotation))throw new Error("unsupported rotation - "+e.textRotation);var f=Math.abs(Math.abs(e.textRotation)-90)>45,g=f?c:d,h=f?d:c,i=e.selection.append("g").classed("text-container",!0);this._addTitleElement&&i.append("title").text(a);var j=i.append("g").classed("text-area",!0),k=this._wrapper?this._wrapper.wrap(a,this._measurer,g,h).wrappedText:a;this.writeText(k,j,g,h,e.xAlign,e.yAlign);var l=d3.transform(""),m=d3.transform("");switch(l.rotate=e.textRotation,e.textRotation){case 90:l.translate=[c,0],m.rotate=-90,m.translate=[0,200];break;case-90:l.translate=[0,d],m.rotate=90,m.translate=[c,0];break;case 180:l.translate=[c,d],m.translate=[c,d],m.rotate=180}j.attr("transform",l.toString()),this.addClipPath(i,m),e.animator&&e.animator.animate(i)},b.prototype.addClipPath=function(b){var c=this._elementID++,d=/MSIE [5-9]/.test(navigator.userAgent)?"":document.location.href;d=d.split("#")[0];var e="clipPath"+this._writerID+"_"+c;b.select(".text-area").attr("clip-path",'url("'+d+"#"+e+'")');var f=b.append("clipPath").attr("id",e),g=a.Utils.DOM.getBBox(b.select(".text-area")),h=f.append("rect");h.classed("clip-rect",!0).attr(g)},b.nextID=0,b.SupportedRotation=[-90,0,180,90],b.AnchorConverter={left:"start",center:"middle",right:"end"},b.XOffsetFactor={left:0,center:.5,right:1},b.YOffsetFactor={top:0,center:.5,bottom:1},b}();b.Writer=c}(a.Writers||(a.Writers={}));a.Writers}(SVGTypewriter||(SVGTypewriter={}));var SVGTypewriter;!function(a){!function(b){var c=function(){function b(a,b){this.textMeasurer=this.getTextMeasurer(a,b)}return b.prototype.checkSelectionIsText=function(a){return"text"===a[0][0].tagName||!a.select("text").empty()},b.prototype.getTextMeasurer=function(a,b){var c=this;if(this.checkSelectionIsText(a)){var d,e=a.node().parentNode;return d="text"===a[0][0].tagName?a:a.select("text"),a.remove(),function(b){e.appendChild(a.node());var f=c.measureBBox(d,b);return a.remove(),f}}var f=a.append("text");return b&&f.classed(b,!0),f.remove(),function(b){a.node().appendChild(f.node());var d=c.measureBBox(f,b);return f.remove(),d}},b.prototype.measureBBox=function(b,c){b.text(c);var d=a.Utils.DOM.getBBox(b);return{width:d.width,height:d.height}},b.prototype.measure=function(a){return void 0===a&&(a=b.HEIGHT_TEXT),this.textMeasurer(a)},b.HEIGHT_TEXT="bqpdl",b}();b.AbstractMeasurer=c}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(a){var b=function(b){function c(a,c,d){void 0===c&&(c=null),void 0===d&&(d=!1),b.call(this,a,c),this.useGuards=d}return __extends(c,b),c.prototype._addGuards=function(b){return a.AbstractMeasurer.HEIGHT_TEXT+b+a.AbstractMeasurer.HEIGHT_TEXT},c.prototype.getGuardWidth=function(){return null==this.guardWidth&&(this.guardWidth=b.prototype.measure.call(this).width),this.guardWidth},c.prototype._measureLine=function(a){var c=this.useGuards?this._addGuards(a):a,d=b.prototype.measure.call(this,c);return d.width-=this.useGuards?2*this.getGuardWidth():0,d},c.prototype.measure=function(b){var c=this;if(void 0===b&&(b=a.AbstractMeasurer.HEIGHT_TEXT),""===b.trim())return{width:0,height:0};var d=b.trim().split("\n").map(function(a){return c._measureLine(a)});return{width:d3.max(d,function(a){return a.width}),height:d3.sum(d,function(a){return a.height})}},c}(a.AbstractMeasurer);a.Measurer=b}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b.prototype._measureCharacter=function(b){return a.prototype._measureLine.call(this,b)},b.prototype._measureLine=function(a){var b=this,c=a.split("").map(function(a){return b._measureCharacter(a)});return{width:d3.sum(c,function(a){return a.width}),height:d3.max(c,function(a){return a.height})}},b}(a.Measurer);a.CharacterMeasurer=b}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));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},SVGTypewriter;!function(a){!function(b){var c=function(b){function c(c,d){var e=this;b.call(this,c,d),this.cache=new a.Utils.Cache(function(a){return e._measureCharacterNotFromCache(a)},a.Utils.Methods.objEq)}return __extends(c,b),c.prototype._measureCharacterNotFromCache=function(a){return b.prototype._measureCharacter.call(this,a)},c.prototype._measureCharacter=function(a){return this.cache.get(a)},c.prototype.reset=function(){this.cache.clear()},c}(b.CharacterMeasurer);b.CacheCharacterMeasurer=c}(a.Measurers||(a.Measurers={}));a.Measurers}(SVGTypewriter||(SVGTypewriter={}));
\ No newline at end of file
diff --git a/plottable.zip b/plottable.zip
index 2115993f09..4557dd1cc1 100644
Binary files a/plottable.zip and b/plottable.zip differ
diff --git a/quicktests/overlaying/tests/animations/animate_scatter.js b/quicktests/overlaying/tests/animations/animate_scatter.js
index a8525b97d1..d3bff4fcaf 100644
--- a/quicktests/overlaying/tests/animations/animate_scatter.js
+++ b/quicktests/overlaying/tests/animations/animate_scatter.js
@@ -7,8 +7,6 @@ function makeData() {
function run(svg, data, Plottable) {
"use strict";
- var doAnimate = true;
- var circleRenderer;
var xScale = new Plottable.Scale.Linear();
var xAxis = new Plottable.Axis.Numeric(xScale, "bottom");
@@ -18,14 +16,13 @@ function run(svg, data, Plottable) {
var d1 = new Plottable.Dataset(data[0]);
var d2 = new Plottable.Dataset(data[1]);
- circleRenderer = new Plottable.Plot.Scatter(xScale, yScale)
- .addDataset(d1)
- .addDataset(d2)
- .attr("r", 8)
- .project("x", "x", xScale)
- .project("y", "y", yScale)
- .attr("opacity", 0.75)
- .animate(doAnimate);
+ var circleRenderer = new Plottable.Plot.Scatter(xScale, yScale).addDataset(d1)
+ .addDataset(d2)
+ .attr("size", 16)
+ .project("x", "x", xScale)
+ .project("y", "y", yScale)
+ .attr("opacity", 0.75)
+ .animate(true);
var circleChart = new Plottable.Component.Table([[yAxis, circleRenderer],
[null, xAxis]]);
diff --git a/quicktests/overlaying/tests/animations/project_scatter.js b/quicktests/overlaying/tests/animations/project_scatter.js
index 7690e3fe5c..3f1bfa34dc 100644
--- a/quicktests/overlaying/tests/animations/project_scatter.js
+++ b/quicktests/overlaying/tests/animations/project_scatter.js
@@ -6,9 +6,6 @@ function makeData() {
function run(svg, data, Plottable) {
"use strict";
-
-
-
//data
var dataseries1 = new Plottable.Dataset(data[0]);
@@ -19,16 +16,15 @@ function run(svg, data, Plottable) {
var xAxis = new Plottable.Axis.Numeric(xScale, "bottom");
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
-
var widthProjector = function(d, i, m) {
- return 25-(d.y*7);
+ return (25 - (d.y * 7)) * 2;
};
var colorProjector = function(d, i, m) {
var x = 22;
- x += Math.floor(d.y*30);
+ x += Math.floor(d.y * 30);
var y = 10;
- y += Math.floor(d.x*40);
+ y += Math.floor(d.x * 40);
return ("#11" + x + y);
};
@@ -38,17 +34,16 @@ function run(svg, data, Plottable) {
//rendering
var renderAreaD1 = new Plottable.Plot.Scatter(xScale, yScale).addDataset(dataseries1)
- .attr("r", widthProjector)
- .attr("fill", colorProjector)
- .attr("opacity", opacityProjector)
- .project("x", "x", xScale)
- .project("y", "y", yScale)
- .animate(true);
+ .attr("size", widthProjector)
+ .attr("fill", colorProjector)
+ .attr("opacity", opacityProjector)
+ .project("x", "x", xScale)
+ .project("y", "y", yScale)
+ .animate(true);
//title + legend
var title1 = new Plottable.Component.TitleLabel( "Opacity, r, color", "horizontal");
-
var basicTable = new Plottable.Component.Table().addComponent(0,2, title1)
.addComponent(1, 1, yAxis)
.addComponent(1, 2, renderAreaD1)
diff --git a/quicktests/overlaying/tests/basic/heightWeight_project.js b/quicktests/overlaying/tests/basic/heightWeight_project.js
index a4a62c4eac..b705a944e9 100644
--- a/quicktests/overlaying/tests/basic/heightWeight_project.js
+++ b/quicktests/overlaying/tests/basic/heightWeight_project.js
@@ -18,20 +18,19 @@ function run(svg, data, Plottable) {
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
var xAccessor = function(d) { return d.age; };
var yAccessor = function(d) { return d.height; };
- var rAccessor = function(d) { return d.weight / 20; };
+ var sizeAccessor = function(d) { return d.weight / 10; };
var opacityAccessor = function(d) { return 0.5; };
var colorAccessor = function(d) {
return d.gender === "male" ? "#F35748" : "#2FA9E7";
};
var renderer = new Plottable.Plot.Scatter(xScale, yScale);
- renderer
- .addDataset(dataseries)
- .attr("x", xAccessor, xScale)
- .attr("y", yAccessor, yScale)
- .attr("r", rAccessor)
- .attr("fill", colorAccessor)
- .attr("opacity", opacityAccessor);
+ renderer.addDataset(dataseries)
+ .attr("x", xAccessor, xScale)
+ .attr("y", yAccessor, yScale)
+ .attr("size", sizeAccessor)
+ .attr("fill", colorAccessor)
+ .attr("opacity", opacityAccessor);
var chartTable = new Plottable.Component.Table([[yAxis, renderer],
[null, xAxis]]);
chartTable.renderTo(svg);
diff --git a/quicktests/overlaying/tests/basic/multi_scatter_with_modified_log.js b/quicktests/overlaying/tests/basic/multi_scatter_with_modified_log.js
index 57768690a3..e6664cd0b5 100644
--- a/quicktests/overlaying/tests/basic/multi_scatter_with_modified_log.js
+++ b/quicktests/overlaying/tests/basic/multi_scatter_with_modified_log.js
@@ -29,15 +29,14 @@ function run(svg, data, Plottable) {
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
//rendering
- var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale)
- .addDataset(d1)
- .addDataset(d2)
- .addDataset(d3)
- .addDataset(d4)
- .attr("fill", "color", colorScale)
- .attr("r", function(d) {return d.x * 12;})
- .project("x", "x", xScale)
- .project("y", "y", yScale);
+ var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale).addDataset(d1)
+ .addDataset(d2)
+ .addDataset(d3)
+ .addDataset(d4)
+ .attr("fill", "color", colorScale)
+ .attr("size", function(d) {return d.x * 24;})
+ .project("x", "x", xScale)
+ .project("y", "y", yScale);
//title + legend
var title1 = new Plottable.Component.TitleLabel( "Two Data Series", "horizontal");
diff --git a/quicktests/overlaying/tests/color/colorProjection.js b/quicktests/overlaying/tests/color/colorProjection.js
index e8a2a3d4fc..abe4765c09 100644
--- a/quicktests/overlaying/tests/color/colorProjection.js
+++ b/quicktests/overlaying/tests/color/colorProjection.js
@@ -11,50 +11,50 @@ function run(svg, data, Plottable) {
{ "x" : 1,
"y" : 4,
"r" : 0x99,
- "g" : 0xBB,
+ "g" : 0xBB,
"b" : 0x44
},
{ "x" : 2,
"y" : 3,
"r" : 0x99,
- "g" : 0x99,
+ "g" : 0x99,
"b" : 0xFD
},
{ "x" : 3,
"y" : 1,
"r" : 0xAA,
- "g" : 0x00,
+ "g" : 0x00,
"b" : 0x33
},
{ "x" : 4,
"y" : 5,
"r" : 0xB3,
- "g" : 0x55,
+ "g" : 0x55,
"b" : 0xF3
},
{ "x" : 5,
"y" : 3,
"r" : 0xDA,
- "g" : 0xDB,
+ "g" : 0xDB,
"b" : 0x00
}
];
-
+
var xScale = new Plottable.Scale.Linear();
var yScale = new Plottable.Scale.Linear();
-
- var ScatterPlot = new Plottable.Plot.Scatter(xScale, yScale);
- ScatterPlot.addDataset(DotData);
- ScatterPlot.project("x", "x", xScale).project("y", "y", yScale);
- ScatterPlot.project("r", function(d){return 15;});
- ScatterPlot.project("fill", function(d){return "#" + (d.r * 65536 + d.g * 256 + d.b).toString(16);});
- ScatterPlot.project("stroke", function(d){return "#" + (16777216 - d.r * 65536 - d.g * 256 - d.b).toString(16);});
- ScatterPlot.project("stroke-width", function(){ return 5; });
-
-
+
+ var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale).addDataset(DotData)
+ .project("x", "x", xScale)
+ .project("y", "y", yScale)
+ .project("size", function(d){return 30;})
+ .project("fill", function(d){return "#" + (d.r * 65536 + d.g * 256 + d.b).toString(16);})
+ .project("stroke", function(d){return "#" + (16777216 - d.r * 65536 - d.g * 256 - d.b).toString(16);})
+ .project("stroke-width", function(){ return 5; });
+
+
var xAxis = new Plottable.Axis.Numeric(xScale, "bottom");
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
-
+
var chart = new Plottable.Component.Table([[yAxis, ScatterPlot],
[null, xAxis]]);
chart.renderTo(svg);
diff --git a/quicktests/overlaying/tests/color/interpolatedScatter.js b/quicktests/overlaying/tests/color/interpolatedScatter.js
index 48994a3326..ba5d65eca0 100644
--- a/quicktests/overlaying/tests/color/interpolatedScatter.js
+++ b/quicktests/overlaying/tests/color/interpolatedScatter.js
@@ -23,13 +23,12 @@ function run(svg, data, Plottable) {
var yScale = new Plottable.Scale.Category();
var colorScale = new Plottable.Scale.InterpolatedColor();
- colorScale.colorRange(["#76DE5D","#A12A23"]);
- var plot = new Plottable.Plot.Scatter(xScale, yScale, colorScale);
- plot.addDataset(data);
- plot.project("x", "x", xScale).project("y", "y", yScale);
- plot.project("r", function(){ return 10;});
- plot.project("fill", function(d) { return d.val; }, colorScale);
-
+ colorScale.colorRange(["#76DE5D","#A12A23"]);
+ var plot = new Plottable.Plot.Scatter(xScale, yScale).addDataset(data)
+ .project("x", "x", xScale).project("y", "y", yScale)
+ .project("size", function(){ return 20;})
+ .project("fill", function(d) { return d.val; }, colorScale);
+
plot.renderTo(svg);
}
diff --git a/quicktests/overlaying/tests/interactions/basic_moveToFront.js b/quicktests/overlaying/tests/interactions/basic_moveToFront.js
index bb06069076..194c1394d3 100644
--- a/quicktests/overlaying/tests/interactions/basic_moveToFront.js
+++ b/quicktests/overlaying/tests/interactions/basic_moveToFront.js
@@ -25,12 +25,11 @@ function run(svg, data, Plottable) {
};
//rendering
- var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale) //0
- .addDataset(dataseries)
- .attr("fill", colorScale1.scale("scatter"))
- .attr("r", function(){return 10;})
- .project("x", "x", xScale)
- .project("y", "y", yScale);
+ var scatterPlot = new Plottable.Plot.Scatter(xScale, yScale).addDataset(dataseries) //0
+ .attr("fill", colorScale1.scale("scatter"))
+ .attr("size", function(){return 20;})
+ .project("x", "x", xScale)
+ .project("y", "y", yScale);
var linePlot = new Plottable.Plot.Line(xScale, yScale)
.addDataset(dataseries) //1
diff --git a/quicktests/overlaying/tests/interactions/interaction_hover_scatter.js b/quicktests/overlaying/tests/interactions/interaction_hover_scatter.js
index 012352070d..b3f95db5b7 100644
--- a/quicktests/overlaying/tests/interactions/interaction_hover_scatter.js
+++ b/quicktests/overlaying/tests/interactions/interaction_hover_scatter.js
@@ -14,16 +14,15 @@ function run(svg, data, Plottable) {
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
var title = new Plottable.Component.TitleLabel("Hover over points");
- var ds1 = new Plottable.Dataset(data[0], { color: "blue", r: 10 });
- var ds2 = new Plottable.Dataset(data[1], { color: "red", r: 15 });
-
- var plot = new Plottable.Plot.Scatter(xScale, yScale)
- .addDataset(ds1)
- .addDataset(ds2)
- .project("r", function(d, i, u) { return u.r; })
- .project("fill", function(d, i, u) { return u.color; })
- .project("x", function(d, i, u) { return d.x; }, xScale)
- .project("y", "y", yScale);
+ var ds1 = new Plottable.Dataset(data[0], { color: "blue", size: 20 });
+ var ds2 = new Plottable.Dataset(data[1], { color: "red", size: 30 });
+
+ var plot = new Plottable.Plot.Scatter(xScale, yScale).addDataset(ds1)
+ .addDataset(ds2)
+ .project("size", function(d, i, u) { return u.size; })
+ .project("fill", function(d, i, u) { return u.color; })
+ .project("x", function(d, i, u) { return d.x; }, xScale)
+ .project("y", "y", yScale);
var chart = new Plottable.Component.Table([
[null, title],
diff --git a/src/components/legend.ts b/src/components/legend.ts
index ed389148a2..43b4bbdd8a 100644
--- a/src/components/legend.ts
+++ b/src/components/legend.ts
@@ -23,7 +23,7 @@ export module Component {
private _measurer: SVGTypewriter.Measurers.Measurer;
private _wrapper: SVGTypewriter.Wrappers.Wrapper;
private _writer: SVGTypewriter.Writers.Writer;
- private _symbolGenerator: SymbolGenerator;
+ private _symbolFactoryAccessor: (datum: any, index: number) => SymbolFactory;
/**
* Creates a Legend.
@@ -50,7 +50,7 @@ export module Component {
this._fixedWidthFlag = true;
this._fixedHeightFlag = true;
this._sortFn = (a: string, b: string) => this._scale.domain().indexOf(a) - this._scale.domain().indexOf(b);
- this._symbolGenerator = SymbolGenerators.d3Symbol("circle");
+ this._symbolFactoryAccessor = () => SymbolFactories.circle();
}
protected _setup() {
@@ -272,11 +272,9 @@ export module Component {
});
});
- entries.select("path").attr("d", this.symbolGenerator())
- .attr("transform", "translate(" + (layout.textHeight / 2) + "," + layout.textHeight / 2 + ") " +
- "scale(" + (layout.textHeight * 0.3 / SymbolGenerators.SYMBOL_GENERATOR_RADIUS) + ")")
+ entries.select("path").attr("d", (d: any, i: number) => this.symbolFactoryAccessor()(d, i)(layout.textHeight * 0.6))
+ .attr("transform", "translate(" + (layout.textHeight / 2) + "," + layout.textHeight / 2 + ")")
.attr("fill", (value: string) => this._scale.scale(value) )
- .attr("vector-effect", "non-scaling-stroke")
.classed(Legend.LEGEND_SYMBOL_CLASS, true);
var padding = this._padding;
@@ -300,23 +298,24 @@ export module Component {
}
/**
- * Gets the SymbolGenerator of the legend, which dictates how
+ * Gets the symbolFactoryAccessor of the legend, which dictates how
* the symbol in each entry is drawn.
*
- * @returns {SymbolGenerator} The SymbolGenerator of the legend
+ * @returns {(datum: any, index: number) => symbolFactory} The symbolFactory accessor of the legend
*/
- public symbolGenerator(): SymbolGenerator;
+ public symbolFactoryAccessor(): (datum: any, index: number) => SymbolFactory;
/**
- * Sets the SymbolGenerator of the legend
+ * Sets the symbolFactoryAccessor of the legend
*
+ * @param {(datum: any, index: number) => symbolFactory} The symbolFactory accessor to set to
* @returns {Legend} The calling Legend
*/
- public symbolGenerator(symbolGenerator: SymbolGenerator): Legend;
- public symbolGenerator(symbolGenerator?: SymbolGenerator): any {
- if (symbolGenerator == null) {
- return this._symbolGenerator;
+ public symbolFactoryAccessor(symbolFactoryAccessor: (datum: any, index: number) => SymbolFactory): Legend;
+ public symbolFactoryAccessor(symbolFactoryAccessor?: (datum: any, index: number) => SymbolFactory): any {
+ if (symbolFactoryAccessor == null) {
+ return this._symbolFactoryAccessor;
} else {
- this._symbolGenerator = symbolGenerator;
+ this._symbolFactoryAccessor = symbolFactoryAccessor;
this._render();
return this;
}
diff --git a/src/components/plots/scatterPlot.ts b/src/components/plots/scatterPlot.ts
index 23eb9bdea8..ed45ba7a6d 100644
--- a/src/components/plots/scatterPlot.ts
+++ b/src/components/plots/scatterPlot.ts
@@ -30,25 +30,10 @@ export module Plot {
protected _generateAttrToProjector() {
var attrToProjector = super._generateAttrToProjector();
- attrToProjector["r"] = attrToProjector["r"] || d3.functor(3);
+ attrToProjector["size"] = attrToProjector["size"] || d3.functor(6);
attrToProjector["opacity"] = attrToProjector["opacity"] || d3.functor(0.6);
attrToProjector["fill"] = attrToProjector["fill"] || d3.functor(this._defaultFillColor);
- attrToProjector["symbol"] = attrToProjector["symbol"] || Plottable.SymbolGenerators.d3Symbol("circle");
- attrToProjector["vector-effect"] = attrToProjector["vector-effect"] || d3.functor("non-scaling-stroke");
-
- // HACKHACK vector-effect non-scaling-stroke has no effect in IE
- // https://connect.microsoft.com/IE/feedback/details/788819/svg-non-scaling-stroke
- if (_Util.Methods.isIE() && attrToProjector["stroke-width"] != null) {
- var strokeWidthProjector = attrToProjector["stroke-width"];
- attrToProjector["stroke-width"] = (d, i, u, m) => {
- var strokeWidth = strokeWidthProjector(d, i, u, m) ;
- if (attrToProjector["vector-effect"](d, i, u, m) === "non-scaling-stroke") {
- return strokeWidth * SymbolGenerators.SYMBOL_GENERATOR_RADIUS / attrToProjector["r"](d, i, u, m);
- } else {
- return strokeWidth;
- }
- };
- }
+ attrToProjector["symbol"] = attrToProjector["symbol"] || (() => SymbolFactories.circle());
return attrToProjector;
}
@@ -57,7 +42,7 @@ export module Plot {
var drawSteps: _Drawer.DrawStep[] = [];
if (this._dataChanged && this._animate) {
var resetAttrToProjector = this._generateAttrToProjector();
- resetAttrToProjector["r"] = () => 0;
+ resetAttrToProjector["size"] = () => 0;
drawSteps.push({attrToProjector: resetAttrToProjector, animator: this._getAnimator("symbols-reset")});
}
@@ -88,7 +73,7 @@ export module Plot {
var drawer = <_Drawer.Symbol>this._key2PlotDatasetKey.get(key).drawer;
drawer._getRenderArea().selectAll("path").each(function(d, i) {
var distSq = getDistSq(d, i, dataset.metadata(), plotMetadata);
- var r = attrToProjector["r"](d, i, dataset.metadata(), plotMetadata);
+ var r = attrToProjector["size"](d, i, dataset.metadata(), plotMetadata) / 2;
if (distSq < r * r) { // cursor is over this point
if (!overAPoint || distSq < minDistSq) {
diff --git a/src/drawers/symbolDrawer.ts b/src/drawers/symbolDrawer.ts
index e4eb05d0b1..498ecd4301 100644
--- a/src/drawers/symbolDrawer.ts
+++ b/src/drawers/symbolDrawer.ts
@@ -19,17 +19,17 @@ export module _Drawer {
delete attrToProjector["x"];
delete attrToProjector["y"];
- var rProjector = attrToProjector["r"];
- delete attrToProjector["r"];
+ var rProjector = attrToProjector["size"];
+ delete attrToProjector["size"];
attrToProjector["transform"] = (datum: any, index: number) =>
- "translate(" + xProjector(datum, index) + "," + yProjector(datum, index) + ") " +
- "scale(" + rProjector(datum, index) / 50 + ")";
+ "translate(" + xProjector(datum, index) + "," + yProjector(datum, index) + ")";
var symbolProjector = attrToProjector["symbol"];
delete attrToProjector["symbol"];
- attrToProjector["d"] = symbolProjector;
+ attrToProjector["d"] = attrToProjector["d"] || ((datum: any, index: number) =>
+ symbolProjector(datum, index)(rProjector(datum, index)));
super._drawStep(step);
}
diff --git a/src/reference.ts b/src/reference.ts
index 7985783056..02d8a3c2bf 100644
--- a/src/reference.ts
+++ b/src/reference.ts
@@ -8,7 +8,7 @@
///
///
-///
+///
///
diff --git a/src/utils/symbolFactories.ts b/src/utils/symbolFactories.ts
new file mode 100644
index 0000000000..182fd5b12c
--- /dev/null
+++ b/src/utils/symbolFactories.ts
@@ -0,0 +1,40 @@
+///
+
+module Plottable {
+
+ /**
+ * A SymbolFactory is a function that takes in a symbolSize which is the edge length of the render area
+ * and returns a string representing the 'd' attribute of the resultant 'path' element
+ */
+ export type SymbolFactory = (symbolSize: number) => string;
+
+ export module SymbolFactories {
+
+ export type StringAccessor = (datum: any, index: number) => string;
+
+ export function circle(): SymbolFactory {
+ return (symbolSize: number) => d3.svg.symbol().type("circle").size(Math.PI * Math.pow(symbolSize / 2, 2))();
+ }
+
+ export function square(): SymbolFactory {
+ return (symbolSize: number) => d3.svg.symbol().type("square").size(Math.pow(symbolSize, 2))();
+ }
+
+ export function cross(): SymbolFactory {
+ return (symbolSize: number) => d3.svg.symbol().type("cross").size((5 / 9) * Math.pow(symbolSize, 2))();
+ }
+
+ export function diamond(): SymbolFactory {
+ return (symbolSize: number) => d3.svg.symbol().type("diamond").size(Math.tan(Math.PI / 6) * Math.pow(symbolSize, 2) / 2)();
+ }
+
+ export function triangleUp(): SymbolFactory {
+ return (symbolSize: number) => d3.svg.symbol().type("triangle-up").size(Math.sqrt(3) * Math.pow(symbolSize / 2, 2))();
+ }
+
+ export function triangleDown(): SymbolFactory {
+ return (symbolSize: number) => d3.svg.symbol().type("triangle-down").size(Math.sqrt(3) * Math.pow(symbolSize / 2, 2))();
+ }
+
+ }
+}
diff --git a/src/utils/symbolGenerators.ts b/src/utils/symbolGenerators.ts
deleted file mode 100644
index 18a8af296e..0000000000
--- a/src/utils/symbolGenerators.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-///
-
-module Plottable {
-
- /**
- * A SymbolGenerator is a function that takes in a datum and the index of the datum to
- * produce an svg path string analogous to the datum/index pair.
- *
- * Note that SymbolGenerators used in Plottable will be assumed to work within a 100x100 square
- * to be scaled appropriately for use within Plottable
- */
- export type SymbolGenerator = (datum: any, index: number) => string;
-
- export module SymbolGenerators {
-
- /**
- * The radius that symbol generators will be assumed to have for their symbols.
- */
- export var SYMBOL_GENERATOR_RADIUS = 50;
-
- export type StringAccessor = ((datum: any, index: number) => string);
-
- /**
- * A wrapper for D3's symbol generator as documented here:
- * https://github.com/mbostock/d3/wiki/SVG-Shapes#symbol
- *
- * Note that since D3 symbols compute the path strings by knowing how much area it can take up instead of
- * knowing its dimensions, the total area expected may be off by some constant factor.
- *
- * @param {string | ((datum: any, index: number) => string)} symbolType Accessor for the d3 symbol type
- * @returns {SymbolGenerator} the symbol generator for a D3 symbol
- */
- export function d3Symbol(symbolType: string | StringAccessor) {
- // Since D3 symbols use a size concept, we have to convert our radius value to the corresponding area value
- // This is done by inspecting the symbol size calculation in d3.js and solving how sizes are calculated from a given radius
- var typeToSize = (symbolTypeString: string) => {
- var sizeFactor: number;
- switch(symbolTypeString) {
- case "circle":
- sizeFactor = Math.PI;
- break;
- case "square":
- sizeFactor = 4;
- break;
- case "cross":
- sizeFactor = 20/9;
- break;
- case "diamond":
- sizeFactor = 2 * Math.tan(Math.PI / 6);
- break;
- case "triangle-up":
- case "triangle-down":
- sizeFactor = Math.sqrt(3);
- break;
- default:
- sizeFactor = 1;
- break;
- }
-
- return sizeFactor * Math.pow(SYMBOL_GENERATOR_RADIUS, 2);
- };
-
- function ensureSymbolType(symTypeString: string) {
- if (d3.svg.symbolTypes.indexOf(symTypeString) === -1) {
- throw new Error(symTypeString + " is an invalid D3 symbol type. d3.svg.symbolTypes can retrieve the valid symbol types.");
- }
- return symTypeString;
- }
-
- var symbolSize = typeof(symbolType) === "string" ?
- typeToSize(ensureSymbolType( symbolType)) :
- (datum: any, index: number) => typeToSize(ensureSymbolType(( symbolType)(datum, index)));
-
- return d3.svg.symbol().type(symbolType).size(symbolSize);
- }
-
- }
-}
diff --git a/test/components/plots/scatterPlotTests.ts b/test/components/plots/scatterPlotTests.ts
index cf648ca083..c36301f835 100644
--- a/test/components/plots/scatterPlotTests.ts
+++ b/test/components/plots/scatterPlotTests.ts
@@ -81,15 +81,15 @@ describe("Plots", () => {
yScale.domain([400, 0]);
var data1 = [
- { x: 80, y: 200, r: 20 },
- { x: 100, y: 200, r: 20 },
- { x: 125, y: 200, r: 5 },
- { x: 138, y: 200, r: 5 }
+ { x: 80, y: 200, size: 40 },
+ { x: 100, y: 200, size: 40 },
+ { x: 125, y: 200, size: 10 },
+ { x: 138, y: 200, size: 10 }
];
var plot = new Plottable.Plot.Scatter(xScale, yScale);
plot.addDataset(data1);
- plot.project("x", "x").project("y", "y").project("r", "r");
+ plot.project("x", "x").project("y", "y").project("size", "size");
plot.renderTo(svg);
var twoOverlappingCirclesResult = ( plot)._getClosestStruckPoint({ x: 85, y: 200 }, 10);
diff --git a/test/testReference.ts b/test/testReference.ts
index f2f9b55b96..d8dccf8c3b 100644
--- a/test/testReference.ts
+++ b/test/testReference.ts
@@ -52,7 +52,6 @@
///
///
-///
///
///
///
diff --git a/test/tests.js b/test/tests.js
index 20487e9da7..1cd88e95c6 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -3671,14 +3671,14 @@ describe("Plots", function () {
xScale.domain([0, 400]);
yScale.domain([400, 0]);
var data1 = [
- { x: 80, y: 200, r: 20 },
- { x: 100, y: 200, r: 20 },
- { x: 125, y: 200, r: 5 },
- { x: 138, y: 200, r: 5 }
+ { x: 80, y: 200, size: 40 },
+ { x: 100, y: 200, size: 40 },
+ { x: 125, y: 200, size: 10 },
+ { x: 138, y: 200, size: 10 }
];
var plot = new Plottable.Plot.Scatter(xScale, yScale);
plot.addDataset(data1);
- plot.project("x", "x").project("y", "y").project("r", "r");
+ plot.project("x", "x").project("y", "y").project("size", "size");
plot.renderTo(svg);
var twoOverlappingCirclesResult = plot._getClosestStruckPoint({ x: 85, y: 200 }, 10);
assert.strictEqual(twoOverlappingCirclesResult.data[0], data1[0], "returns closest circle among circles that the test point touches");
@@ -7145,16 +7145,6 @@ describe("Formatters", function () {
});
});
-///
-var assert = chai.assert;
-describe("SymbolGenerators", function () {
- describe("d3Symbol", function () {
- it("throws an error if invalid symbol type is used", function () {
- assert.throws(function () { return Plottable.SymbolGenerators.d3Symbol("aaa"); }, Error, "invalid D3 symbol type");
- });
- });
-});
-
///
var assert = chai.assert;
describe("IDCounter", function () {
diff --git a/test/utils/symbolGeneratorsTests.ts b/test/utils/symbolGeneratorsTests.ts
deleted file mode 100644
index 97b9b0a84a..0000000000
--- a/test/utils/symbolGeneratorsTests.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-///
-
-var assert = chai.assert;
-
-describe("SymbolGenerators", () => {
- describe("d3Symbol", () => {
- it("throws an error if invalid symbol type is used", () => {
- assert.throws(() => Plottable.SymbolGenerators.d3Symbol("aaa"), Error, "invalid D3 symbol type");
- });
- });
-});
diff --git a/typings/d3/d3.d.ts b/typings/d3/d3.d.ts
index 4832f60223..80aa41f142 100644
--- a/typings/d3/d3.d.ts
+++ b/typings/d3/d3.d.ts
@@ -1674,7 +1674,7 @@ declare module D3 {
export interface Symbol {
type: (symbolType: string | ((datum: any, index: number) => string)) => Symbol;
size: (size: number | ((datum: any, index: number) => number)) => Symbol;
- (datum:any, index:number): string;
+ (datum?: any, index?: number): string;
}
export interface Brush {