-// https://d3js.org Version 4.12.0. Copyright 2017 Mike Bostock.
+// https://d3js.org v5.7.0 Copyright 2018 Mike Bostock
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (factory((global.d3 = global.d3 || {})));
+typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+typeof define === 'function' && define.amd ? define(['exports'], factory) :
+(factory((global.d3 = global.d3 || {})));
}(this, (function (exports) { 'use strict';
-var version = "4.12.0";
+var version = "5.7.0";
-var ascending = function(a, b) {
+function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
-};
+}
-var bisector = function(compare) {
+function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
return lo;
}
};
-};
+}
function ascendingComparator(f) {
return function(d, x) {
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
-var pairs = function(array, f) {
+function pairs(array, f) {
if (f == null) f = pair;
var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = f(p, p = array[++i]);
return pairs;
-};
+}
function pair(a, b) {
return [a, b];
}
-var cross = function(values0, values1, reduce) {
+function cross(values0, values1, reduce) {
var n0 = values0.length,
n1 = values1.length,
values = new Array(n0 * n1),
}
return values;
-};
+}
-var descending = function(a, b) {
+function descending(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
-};
+}
-var number = function(x) {
+function number(x) {
return x === null ? NaN : +x;
-};
+}
-var variance = function(values, valueof) {
+function variance(values, valueof) {
var n = values.length,
m = 0,
i = -1,
}
if (m > 1) return sum / (m - 1);
-};
+}
-var deviation = function(array, f) {
+function deviation(array, f) {
var v = variance(array, f);
return v ? Math.sqrt(v) : v;
-};
+}
-var extent = function(values, valueof) {
+function extent(values, valueof) {
var n = values.length,
i = -1,
value,
}
return [min, max];
-};
+}
var array = Array.prototype;
var slice = array.slice;
var map = array.map;
-var constant = function(x) {
+function constant(x) {
return function() {
return x;
};
-};
+}
-var identity = function(x) {
+function identity(x) {
return x;
-};
+}
-var sequence = function(start, stop, step) {
+function sequence(start, stop, step) {
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
var i = -1,
}
return range;
-};
+}
-var e10 = Math.sqrt(50);
-var e5 = Math.sqrt(10);
-var e2 = Math.sqrt(2);
+var e10 = Math.sqrt(50),
+ e5 = Math.sqrt(10),
+ e2 = Math.sqrt(2);
-var ticks = function(start, stop, count) {
+function ticks(start, stop, count) {
var reverse,
i = -1,
n,
if (reverse) ticks.reverse();
return ticks;
-};
+}
function tickIncrement(start, stop, count) {
var step = (stop - start) / Math.max(0, count),
return stop < start ? -step1 : step1;
}
-var sturges = function(values) {
+function thresholdSturges(values) {
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
-};
+}
-var histogram = function() {
+function histogram() {
var value = identity,
domain = extent,
- threshold = sturges;
+ threshold = thresholdSturges;
function histogram(data) {
var i,
// Convert number of thresholds into uniform thresholds.
if (!Array.isArray(tz)) {
tz = tickStep(x0, x1, tz);
- tz = sequence(Math.ceil(x0 / tz) * tz, Math.floor(x1 / tz) * tz, tz); // exclusive
+ tz = sequence(Math.ceil(x0 / tz) * tz, x1, tz); // exclusive
}
// Remove any thresholds outside the domain.
};
return histogram;
-};
+}
-var threshold = function(values, p, valueof) {
+function threshold(values, p, valueof) {
if (valueof == null) valueof = number;
if (!(n = values.length)) return;
if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
value0 = +valueof(values[i0], i0, values),
value1 = +valueof(values[i0 + 1], i0 + 1, values);
return value0 + (value1 - value0) * (i - i0);
-};
+}
-var freedmanDiaconis = function(values, min, max) {
+function freedmanDiaconis(values, min, max) {
values = map.call(values, number).sort(ascending);
return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3)));
-};
+}
-var scott = function(values, min, max) {
+function scott(values, min, max) {
return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
-};
+}
-var max = function(values, valueof) {
+function max(values, valueof) {
var n = values.length,
i = -1,
value,
}
return max;
-};
+}
-var mean = function(values, valueof) {
+function mean(values, valueof) {
var n = values.length,
m = n,
i = -1,
}
if (m) return sum / m;
-};
+}
-var median = function(values, valueof) {
+function median(values, valueof) {
var n = values.length,
i = -1,
value,
}
return threshold(numbers.sort(ascending), 0.5);
-};
+}
-var merge = function(arrays) {
+function merge(arrays) {
var n = arrays.length,
m,
i = -1,
}
return merged;
-};
+}
-var min = function(values, valueof) {
+function min(values, valueof) {
var n = values.length,
i = -1,
value,
}
return min;
-};
+}
-var permute = function(array, indexes) {
+function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
-};
+}
-var scan = function(values, compare) {
+function scan(values, compare) {
if (!(n = values.length)) return;
var n,
i = 0,
}
if (compare(xj, xj) === 0) return j;
-};
+}
-var shuffle = function(array, i0, i1) {
+function shuffle(array, i0, i1) {
var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
t,
i;
}
return array;
-};
+}
-var sum = function(values, valueof) {
+function sum(values, valueof) {
var n = values.length,
i = -1,
value,
}
return sum;
-};
+}
-var transpose = function(matrix) {
+function transpose(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
}
}
return transpose;
-};
+}
function length(d) {
return d.length;
}
-var zip = function() {
+function zip() {
return transpose(arguments);
-};
+}
var slice$1 = Array.prototype.slice;
-var identity$1 = function(x) {
+function identity$1(x) {
return x;
-};
+}
-var top = 1;
-var right = 2;
-var bottom = 3;
-var left = 4;
-var epsilon = 1e-6;
+var top = 1,
+ right = 2,
+ bottom = 3,
+ left = 4,
+ epsilon = 1e-6;
function translateX(x) {
return "translate(" + (x + 0.5) + ",0)";
path = path.merge(path.enter().insert("path", ".tick")
.attr("class", "domain")
- .attr("stroke", "#000"));
+ .attr("stroke", "currentColor"));
tick = tick.merge(tickEnter);
line = line.merge(tickEnter.append("line")
- .attr("stroke", "#000")
+ .attr("stroke", "currentColor")
.attr(x + "2", k * tickSizeInner));
text = text.merge(tickEnter.append("text")
- .attr("fill", "#000")
+ .attr("fill", "currentColor")
.attr(x, k * spacing)
.attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
path
.attr("d", orient === left || orient == right
- ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter
- : "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter);
+ ? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter : "M0.5," + range0 + "V" + range1)
+ : (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + ",0.5H" + range1));
tick
.attr("opacity", 1)
xmlns: "http://www.w3.org/2000/xmlns/"
};
-var namespace = function(name) {
+function namespace(name) {
var prefix = name += "", i = prefix.indexOf(":");
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;
-};
+}
function creatorInherit(name) {
return function() {
};
}
-var creator = function(name) {
+function creator(name) {
var fullname = namespace(name);
return (fullname.local
? creatorFixed
: creatorInherit)(fullname);
-};
-
-var nextId = 0;
-
-function local$1() {
- return new Local;
-}
-
-function Local() {
- this._ = "@" + (++nextId).toString(36);
-}
-
-Local.prototype = local$1.prototype = {
- constructor: Local,
- get: function(node) {
- var id = this._;
- while (!(id in node)) if (!(node = node.parentNode)) return;
- return node[id];
- },
- set: function(node, value) {
- return node[this._] = value;
- },
- remove: function(node) {
- return this._ in node && delete node[this._];
- },
- toString: function() {
- return this._;
- }
-};
-
-var matcher = function(selector) {
- return function() {
- return this.matches(selector);
- };
-};
-
-if (typeof document !== "undefined") {
- var element = document.documentElement;
- if (!element.matches) {
- var vendorMatches = element.webkitMatchesSelector
- || element.msMatchesSelector
- || element.mozMatchesSelector
- || element.oMatchesSelector;
- matcher = function(selector) {
- return function() {
- return vendorMatches.call(this, selector);
- };
- };
- }
-}
-
-var matcher$1 = matcher;
-
-var filterEvents = {};
-
-exports.event = null;
-
-if (typeof document !== "undefined") {
- var element$1 = document.documentElement;
- if (!("onmouseenter" in element$1)) {
- filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};
- }
-}
-
-function filterContextListener(listener, index, group) {
- listener = contextListener(listener, index, group);
- return function(event) {
- var related = event.relatedTarget;
- if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
- listener.call(this, event);
- }
- };
-}
-
-function contextListener(listener, index, group) {
- return function(event1) {
- var event0 = exports.event; // Events can be reentrant (e.g., focus).
- exports.event = event1;
- try {
- listener.call(this, this.__data__, index, group);
- } finally {
- exports.event = event0;
- }
- };
-}
-
-function parseTypenames$1(typenames) {
- return typenames.trim().split(/^|\s+/).map(function(t) {
- var name = "", i = t.indexOf(".");
- if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
- return {type: t, name: name};
- });
-}
-
-function onRemove(typename) {
- return function() {
- var on = this.__on;
- if (!on) return;
- for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
- if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
- this.removeEventListener(o.type, o.listener, o.capture);
- } else {
- on[++i] = o;
- }
- }
- if (++i) on.length = i;
- else delete this.__on;
- };
-}
-
-function onAdd(typename, value, capture) {
- var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
- return function(d, i, group) {
- var on = this.__on, o, listener = wrap(value, i, group);
- if (on) for (var j = 0, m = on.length; j < m; ++j) {
- if ((o = on[j]).type === typename.type && o.name === typename.name) {
- this.removeEventListener(o.type, o.listener, o.capture);
- this.addEventListener(o.type, o.listener = listener, o.capture = capture);
- o.value = value;
- return;
- }
- }
- this.addEventListener(typename.type, listener, capture);
- o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
- if (!on) this.__on = [o];
- else on.push(o);
- };
}
-var selection_on = function(typename, value, capture) {
- var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t;
-
- if (arguments.length < 2) {
- var on = this.node().__on;
- if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
- for (i = 0, o = on[j]; i < n; ++i) {
- if ((t = typenames[i]).type === o.type && t.name === o.name) {
- return o.value;
- }
- }
- }
- return;
- }
-
- on = value ? onAdd : onRemove;
- if (capture == null) capture = false;
- for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
- return this;
-};
-
-function customEvent(event1, listener, that, args) {
- var event0 = exports.event;
- event1.sourceEvent = exports.event;
- exports.event = event1;
- try {
- return listener.apply(that, args);
- } finally {
- exports.event = event0;
- }
-}
-
-var sourceEvent = function() {
- var current = exports.event, source;
- while (source = current.sourceEvent) current = source;
- return current;
-};
-
-var point = function(node, event) {
- var svg = node.ownerSVGElement || node;
-
- if (svg.createSVGPoint) {
- var point = svg.createSVGPoint();
- point.x = event.clientX, point.y = event.clientY;
- point = point.matrixTransform(node.getScreenCTM().inverse());
- return [point.x, point.y];
- }
-
- var rect = node.getBoundingClientRect();
- return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
-};
-
-var mouse = function(node) {
- var event = sourceEvent();
- if (event.changedTouches) event = event.changedTouches[0];
- return point(node, event);
-};
-
function none() {}
-var selector = function(selector) {
+function selector(selector) {
return selector == null ? none : function() {
return this.querySelector(selector);
};
-};
+}
-var selection_select = function(select) {
+function selection_select(select) {
if (typeof select !== "function") select = selector(select);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
}
return new Selection(subgroups, this._parents);
-};
+}
-function empty$1() {
+function empty() {
return [];
}
-var selectorAll = function(selector) {
- return selector == null ? empty$1 : function() {
+function selectorAll(selector) {
+ return selector == null ? empty : function() {
return this.querySelectorAll(selector);
};
-};
+}
-var selection_selectAll = function(select) {
+function selection_selectAll(select) {
if (typeof select !== "function") select = selectorAll(select);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
}
return new Selection(subgroups, parents);
+}
+
+var matcher = function(selector) {
+ return function() {
+ return this.matches(selector);
+ };
};
-var selection_filter = function(match) {
+if (typeof document !== "undefined") {
+ var element = document.documentElement;
+ if (!element.matches) {
+ var vendorMatches = element.webkitMatchesSelector
+ || element.msMatchesSelector
+ || element.mozMatchesSelector
+ || element.oMatchesSelector;
+ matcher = function(selector) {
+ return function() {
+ return vendorMatches.call(this, selector);
+ };
+ };
+ }
+}
+
+var matcher$1 = matcher;
+
+function selection_filter(match) {
if (typeof match !== "function") match = matcher$1(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
}
return new Selection(subgroups, this._parents);
-};
+}
-var sparse = function(update) {
+function sparse(update) {
return new Array(update.length);
-};
+}
-var selection_enter = function() {
+function selection_enter() {
return new Selection(this._enter || this._groups.map(sparse), this._parents);
-};
+}
function EnterNode(parent, datum) {
this.ownerDocument = parent.ownerDocument;
querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }
};
-var constant$1 = function(x) {
+function constant$1(x) {
return function() {
return x;
};
-};
+}
var keyPrefix = "$"; // Protect against keys like “__proto__”.
}
}
-var selection_data = function(value, key) {
+function selection_data(value, key) {
if (!value) {
data = new Array(this.size()), j = -1;
this.each(function(d) { data[++j] = d; });
update._enter = enter;
update._exit = exit;
return update;
-};
+}
-var selection_exit = function() {
+function selection_exit() {
return new Selection(this._exit || this._groups.map(sparse), this._parents);
-};
+}
-var selection_merge = function(selection$$1) {
+function selection_merge(selection$$1) {
for (var groups0 = this._groups, groups1 = selection$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
}
return new Selection(merges, this._parents);
-};
+}
-var selection_order = function() {
+function selection_order() {
for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
}
return this;
-};
+}
-var selection_sort = function(compare) {
+function selection_sort(compare) {
if (!compare) compare = ascending$1;
function compareNode(a, b) {
}
return new Selection(sortgroups, this._parents).order();
-};
+}
function ascending$1(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
-var selection_call = function() {
+function selection_call() {
var callback = arguments[0];
arguments[0] = this;
callback.apply(null, arguments);
return this;
-};
+}
-var selection_nodes = function() {
+function selection_nodes() {
var nodes = new Array(this.size()), i = -1;
this.each(function() { nodes[++i] = this; });
return nodes;
-};
+}
-var selection_node = function() {
+function selection_node() {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
}
return null;
-};
+}
-var selection_size = function() {
+function selection_size() {
var size = 0;
this.each(function() { ++size; });
return size;
-};
+}
-var selection_empty = function() {
+function selection_empty() {
return !this.node();
-};
+}
-var selection_each = function(callback) {
+function selection_each(callback) {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
}
return this;
-};
+}
function attrRemove(name) {
return function() {
};
}
-var selection_attr = function(name, value) {
+function selection_attr(name, value) {
var fullname = namespace(name);
if (arguments.length < 2) {
? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
? (fullname.local ? attrFunctionNS : attrFunction)
: (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
-};
+}
-var defaultView = function(node) {
+function defaultView(node) {
return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|| (node.document && node) // node is a Window
|| node.defaultView; // node is a Document
-};
+}
function styleRemove(name) {
return function() {
};
}
-var selection_style = function(name, value, priority) {
+function selection_style(name, value, priority) {
return arguments.length > 1
? this.each((value == null
? styleRemove : typeof value === "function"
? styleFunction
: styleConstant)(name, value, priority == null ? "" : priority))
: styleValue(this.node(), name);
-};
+}
function styleValue(node, name) {
return node.style.getPropertyValue(name)
};
}
-var selection_property = function(name, value) {
+function selection_property(name, value) {
return arguments.length > 1
? this.each((value == null
? propertyRemove : typeof value === "function"
? propertyFunction
: propertyConstant)(name, value))
: this.node()[name];
-};
+}
function classArray(string) {
return string.trim().split(/^|\s+/);
};
}
-var selection_classed = function(name, value) {
+function selection_classed(name, value) {
var names = classArray(name + "");
if (arguments.length < 2) {
? classedFunction : value
? classedTrue
: classedFalse)(names, value));
-};
+}
function textRemove() {
this.textContent = "";
};
}
-var selection_text = function(value) {
+function selection_text(value) {
return arguments.length
? this.each(value == null
? textRemove : (typeof value === "function"
? textFunction
: textConstant)(value))
: this.node().textContent;
-};
+}
function htmlRemove() {
this.innerHTML = "";
};
}
-var selection_html = function(value) {
+function selection_html(value) {
return arguments.length
? this.each(value == null
? htmlRemove : (typeof value === "function"
? htmlFunction
: htmlConstant)(value))
: this.node().innerHTML;
-};
+}
function raise() {
if (this.nextSibling) this.parentNode.appendChild(this);
}
-var selection_raise = function() {
+function selection_raise() {
return this.each(raise);
-};
+}
function lower() {
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
-var selection_lower = function() {
+function selection_lower() {
return this.each(lower);
-};
+}
-var selection_append = function(name) {
+function selection_append(name) {
var create = typeof name === "function" ? name : creator(name);
return this.select(function() {
return this.appendChild(create.apply(this, arguments));
});
-};
+}
function constantNull() {
return null;
}
-var selection_insert = function(name, before) {
+function selection_insert(name, before) {
var create = typeof name === "function" ? name : creator(name),
select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
return this.select(function() {
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
});
-};
+}
function remove() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
}
-var selection_remove = function() {
+function selection_remove() {
return this.each(remove);
-};
+}
+
+function selection_cloneShallow() {
+ return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibling);
+}
-var selection_datum = function(value) {
+function selection_cloneDeep() {
+ return this.parentNode.insertBefore(this.cloneNode(true), this.nextSibling);
+}
+
+function selection_clone(deep) {
+ return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
+}
+
+function selection_datum(value) {
return arguments.length
? this.property("__data__", value)
: this.node().__data__;
-};
+}
+
+var filterEvents = {};
+
+exports.event = null;
+
+if (typeof document !== "undefined") {
+ var element$1 = document.documentElement;
+ if (!("onmouseenter" in element$1)) {
+ filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};
+ }
+}
+
+function filterContextListener(listener, index, group) {
+ listener = contextListener(listener, index, group);
+ return function(event) {
+ var related = event.relatedTarget;
+ if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
+ listener.call(this, event);
+ }
+ };
+}
+
+function contextListener(listener, index, group) {
+ return function(event1) {
+ var event0 = exports.event; // Events can be reentrant (e.g., focus).
+ exports.event = event1;
+ try {
+ listener.call(this, this.__data__, index, group);
+ } finally {
+ exports.event = event0;
+ }
+ };
+}
+
+function parseTypenames$1(typenames) {
+ return typenames.trim().split(/^|\s+/).map(function(t) {
+ var name = "", i = t.indexOf(".");
+ if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
+ return {type: t, name: name};
+ });
+}
+
+function onRemove(typename) {
+ return function() {
+ var on = this.__on;
+ if (!on) return;
+ for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
+ if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
+ this.removeEventListener(o.type, o.listener, o.capture);
+ } else {
+ on[++i] = o;
+ }
+ }
+ if (++i) on.length = i;
+ else delete this.__on;
+ };
+}
+
+function onAdd(typename, value, capture) {
+ var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
+ return function(d, i, group) {
+ var on = this.__on, o, listener = wrap(value, i, group);
+ if (on) for (var j = 0, m = on.length; j < m; ++j) {
+ if ((o = on[j]).type === typename.type && o.name === typename.name) {
+ this.removeEventListener(o.type, o.listener, o.capture);
+ this.addEventListener(o.type, o.listener = listener, o.capture = capture);
+ o.value = value;
+ return;
+ }
+ }
+ this.addEventListener(typename.type, listener, capture);
+ o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};
+ if (!on) this.__on = [o];
+ else on.push(o);
+ };
+}
+
+function selection_on(typename, value, capture) {
+ var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t;
+
+ if (arguments.length < 2) {
+ var on = this.node().__on;
+ if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
+ for (i = 0, o = on[j]; i < n; ++i) {
+ if ((t = typenames[i]).type === o.type && t.name === o.name) {
+ return o.value;
+ }
+ }
+ }
+ return;
+ }
+
+ on = value ? onAdd : onRemove;
+ if (capture == null) capture = false;
+ for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
+ return this;
+}
+
+function customEvent(event1, listener, that, args) {
+ var event0 = exports.event;
+ event1.sourceEvent = exports.event;
+ exports.event = event1;
+ try {
+ return listener.apply(that, args);
+ } finally {
+ exports.event = event0;
+ }
+}
function dispatchEvent(node, type, params) {
var window = defaultView(node),
};
}
-var selection_dispatch = function(type, params) {
+function selection_dispatch(type, params) {
return this.each((typeof params === "function"
? dispatchFunction
: dispatchConstant)(type, params));
-};
+}
var root = [null];
append: selection_append,
insert: selection_insert,
remove: selection_remove,
+ clone: selection_clone,
datum: selection_datum,
on: selection_on,
dispatch: selection_dispatch
};
-var select = function(selector) {
+function select(selector) {
return typeof selector === "string"
? new Selection([[document.querySelector(selector)]], [document.documentElement])
: new Selection([[selector]], root);
+}
+
+function create(name) {
+ return select(creator(name).call(document.documentElement));
+}
+
+var nextId = 0;
+
+function local() {
+ return new Local;
+}
+
+function Local() {
+ this._ = "@" + (++nextId).toString(36);
+}
+
+Local.prototype = local.prototype = {
+ constructor: Local,
+ get: function(node) {
+ var id = this._;
+ while (!(id in node)) if (!(node = node.parentNode)) return;
+ return node[id];
+ },
+ set: function(node, value) {
+ return node[this._] = value;
+ },
+ remove: function(node) {
+ return this._ in node && delete node[this._];
+ },
+ toString: function() {
+ return this._;
+ }
};
-var selectAll = function(selector) {
+function sourceEvent() {
+ var current = exports.event, source;
+ while (source = current.sourceEvent) current = source;
+ return current;
+}
+
+function point(node, event) {
+ var svg = node.ownerSVGElement || node;
+
+ if (svg.createSVGPoint) {
+ var point = svg.createSVGPoint();
+ point.x = event.clientX, point.y = event.clientY;
+ point = point.matrixTransform(node.getScreenCTM().inverse());
+ return [point.x, point.y];
+ }
+
+ var rect = node.getBoundingClientRect();
+ return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
+}
+
+function mouse(node) {
+ var event = sourceEvent();
+ if (event.changedTouches) event = event.changedTouches[0];
+ return point(node, event);
+}
+
+function selectAll(selector) {
return typeof selector === "string"
? new Selection([document.querySelectorAll(selector)], [document.documentElement])
: new Selection([selector == null ? [] : selector], root);
-};
+}
-var touch = function(node, touches, identifier) {
+function touch(node, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
}
return null;
-};
+}
-var touches = function(node, touches) {
+function touches(node, touches) {
if (touches == null) touches = sourceEvent().touches;
for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {
}
return points;
-};
+}
function nopropagation() {
exports.event.stopImmediatePropagation();
}
-var noevent = function() {
+function noevent() {
exports.event.preventDefault();
exports.event.stopImmediatePropagation();
-};
+}
-var dragDisable = function(view) {
+function dragDisable(view) {
var root = view.document.documentElement,
- selection = select(view).on("dragstart.drag", noevent, true);
+ selection$$1 = select(view).on("dragstart.drag", noevent, true);
if ("onselectstart" in root) {
- selection.on("selectstart.drag", noevent, true);
+ selection$$1.on("selectstart.drag", noevent, true);
} else {
root.__noselect = root.style.MozUserSelect;
root.style.MozUserSelect = "none";
}
-};
+}
function yesdrag(view, noclick) {
var root = view.document.documentElement,
- selection = select(view).on("dragstart.drag", null);
+ selection$$1 = select(view).on("dragstart.drag", null);
if (noclick) {
- selection.on("click.drag", noevent, true);
- setTimeout(function() { selection.on("click.drag", null); }, 0);
+ selection$$1.on("click.drag", noevent, true);
+ setTimeout(function() { selection$$1.on("click.drag", null); }, 0);
}
if ("onselectstart" in root) {
- selection.on("selectstart.drag", null);
+ selection$$1.on("selectstart.drag", null);
} else {
root.style.MozUserSelect = root.__noselect;
delete root.__noselect;
}
}
-var constant$2 = function(x) {
+function constant$2(x) {
return function() {
return x;
};
-};
+}
function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
this.target = target;
};
// Ignore right-click, since that should open the context menu.
-function defaultFilter$1() {
+function defaultFilter() {
return !exports.event.button;
}
return "ontouchstart" in this;
}
-var drag = function() {
- var filter = defaultFilter$1,
+function drag() {
+ var filter = defaultFilter,
container = defaultContainer,
subject = defaultSubject,
touchable = defaultTouchable,
touchending,
clickDistance2 = 0;
- function drag(selection) {
- selection
+ function drag(selection$$1) {
+ selection$$1
.on("mousedown.drag", mousedowned)
.filter(touchable)
.on("touchstart.drag", touchstarted)
function touchstarted() {
if (!filter.apply(this, arguments)) return;
- var touches = exports.event.changedTouches,
+ var touches$$1 = exports.event.changedTouches,
c = container.apply(this, arguments),
- n = touches.length, i, gesture;
+ n = touches$$1.length, i, gesture;
for (i = 0; i < n; ++i) {
- if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {
+ if (gesture = beforestart(touches$$1[i].identifier, c, touch, this, arguments)) {
nopropagation();
gesture("start");
}
}
function touchmoved() {
- var touches = exports.event.changedTouches,
- n = touches.length, i, gesture;
+ var touches$$1 = exports.event.changedTouches,
+ n = touches$$1.length, i, gesture;
for (i = 0; i < n; ++i) {
- if (gesture = gestures[touches[i].identifier]) {
+ if (gesture = gestures[touches$$1[i].identifier]) {
noevent();
gesture("drag");
}
}
function touchended() {
- var touches = exports.event.changedTouches,
- n = touches.length, i, gesture;
+ var touches$$1 = exports.event.changedTouches,
+ n = touches$$1.length, i, gesture;
if (touchending) clearTimeout(touchending);
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
for (i = 0; i < n; ++i) {
- if (gesture = gestures[touches[i].identifier]) {
+ if (gesture = gestures[touches$$1[i].identifier]) {
nopropagation();
gesture("end");
}
}
}
- function beforestart(id, container, point, that, args) {
- var p = point(container, id), s, dx, dy,
+ function beforestart(id, container, point$$1, that, args) {
+ var p = point$$1(container, id), s, dx, dy,
sublisteners = listeners.copy();
if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
switch (type) {
case "start": gestures[id] = gesture, n = active++; break;
case "end": delete gestures[id], --active; // nobreak
- case "drag": p = point(container, id), n = active; break;
+ case "drag": p = point$$1(container, id), n = active; break;
}
customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
};
};
return drag;
-};
+}
-var define = function(constructor, factory, prototype) {
+function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
-};
+}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
var darker = 0.7;
var brighter = 1 / darker;
-var reI = "\\s*([+-]?\\d+)\\s*";
-var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
-var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
-var reHex3 = /^#([0-9a-f]{3})$/;
-var reHex6 = /^#([0-9a-f]{6})$/;
-var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
-var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
-var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
-var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
-var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
-var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
+var reI = "\\s*([+-]?\\d+)\\s*",
+ reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
+ reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
+ reHex3 = /^#([0-9a-f]{3})$/,
+ reHex6 = /^#([0-9a-f]{6})$/,
+ reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
+ reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
+ reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
+ reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
+ reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
+ reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
var named = {
aliceblue: 0xf0f8ff,
displayable: function() {
return this.rgb().displayable();
},
+ hex: function() {
+ return this.rgb().hex();
+ },
toString: function() {
return this.rgb() + "";
}
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
},
+ hex: function() {
+ return "#" + hex(this.r) + hex(this.g) + hex(this.b);
+ },
toString: function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
}
}));
+function hex(value) {
+ value = Math.max(0, Math.min(255, Math.round(value) || 0));
+ return (value < 16 ? "0" : "") + value.toString(16);
+}
+
function hsla(h, s, l, a) {
if (a <= 0) h = s = l = NaN;
else if (l <= 0 || l >= 1) h = s = NaN;
var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;
-var Kn = 18;
-var Xn = 0.950470;
-var Yn = 1;
-var Zn = 1.088830;
-var t0 = 4 / 29;
-var t1 = 6 / 29;
-var t2 = 3 * t1 * t1;
-var t3 = t1 * t1 * t1;
+// https://beta.observablehq.com/@mbostock/lab-and-rgb
+var K = 18,
+ Xn = 0.96422,
+ Yn = 1,
+ Zn = 0.82521,
+ t0 = 4 / 29,
+ t1 = 6 / 29,
+ t2 = 3 * t1 * t1,
+ t3 = t1 * t1 * t1;
function labConvert(o) {
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
if (o instanceof Hcl) {
+ if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
var h = o.h * deg2rad;
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}
if (!(o instanceof Rgb)) o = rgbConvert(o);
- var b = rgb2xyz(o.r),
- a = rgb2xyz(o.g),
- l = rgb2xyz(o.b),
- x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
- y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
- z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
+ var r = rgb2lrgb(o.r),
+ g = rgb2lrgb(o.g),
+ b = rgb2lrgb(o.b),
+ y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
+ if (r === g && g === b) x = z = y; else {
+ x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
+ z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
+ }
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}
+function gray(l, opacity) {
+ return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
+}
+
function lab(l, a, b, opacity) {
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}
define(Lab, lab, extend(Color, {
brighter: function(k) {
- return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
+ return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function(k) {
- return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
+ return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
rgb: function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
- y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
+ y = Yn * lab2xyz(y);
z = Zn * lab2xyz(z);
return new Rgb(
- xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
- xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
- xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
+ lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
+ lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
+ lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
this.opacity
);
}
return t > t1 ? t * t * t : t2 * (t - t0);
}
-function xyz2rgb(x) {
+function lrgb2rgb(x) {
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
-function rgb2xyz(x) {
+function rgb2lrgb(x) {
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}
function hclConvert(o) {
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
if (!(o instanceof Lab)) o = labConvert(o);
+ if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity);
var h = Math.atan2(o.b, o.a) * rad2deg;
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}
+function lch(l, c, h, opacity) {
+ return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
+}
+
function hcl(h, c, l, opacity) {
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}
define(Hcl, hcl, extend(Color, {
brighter: function(k) {
- return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
+ return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
},
darker: function(k) {
- return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
+ return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
},
rgb: function() {
return labConvert(this).rgb();
}
}));
-var A = -0.14861;
-var B = +1.78277;
-var C = -0.29227;
-var D = -0.90649;
-var E = +1.97294;
-var ED = E * D;
-var EB = E * B;
-var BC_DA = B * C - D * A;
+var A = -0.14861,
+ B = +1.78277,
+ C = -0.29227,
+ D = -0.90649,
+ E = +1.97294,
+ ED = E * D,
+ EB = E * B,
+ BC_DA = B * C - D * A;
function cubehelixConvert(o) {
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
+ t3 * v3) / 6;
}
-var basis$1 = function(values) {
+function basis$1(values) {
var n = values.length - 1;
return function(t) {
var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
return basis((t - i / n) * n, v0, v1, v2, v3);
};
-};
+}
-var basisClosed = function(values) {
+function basisClosed(values) {
var n = values.length;
return function(t) {
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
v3 = values[(i + 2) % n];
return basis((t - i / n) * n, v0, v1, v2, v3);
};
-};
+}
-var constant$3 = function(x) {
+function constant$3(x) {
return function() {
return x;
};
-};
+}
function linear(a, d) {
return function(t) {
var rgbBasis = rgbSpline(basis$1);
var rgbBasisClosed = rgbSpline(basisClosed);
-var array$1 = function(a, b) {
+function array$1(a, b) {
var nb = b ? b.length : 0,
na = a ? Math.min(nb, a.length) : 0,
x = new Array(na),
for (i = 0; i < na; ++i) c[i] = x[i](t);
return c;
};
-};
+}
-var date = function(a, b) {
+function date(a, b) {
var d = new Date;
return a = +a, b -= a, function(t) {
return d.setTime(a + b * t), d;
};
-};
+}
-var reinterpolate = function(a, b) {
+function interpolateNumber(a, b) {
return a = +a, b -= a, function(t) {
return a + b * t;
};
-};
+}
-var object = function(a, b) {
+function object(a, b) {
var i = {},
c = {},
k;
for (k in i) c[k] = i[k](t);
return c;
};
-};
+}
-var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
-var reB = new RegExp(reA.source, "g");
+var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
+ reB = new RegExp(reA.source, "g");
function zero(b) {
return function() {
};
}
-var interpolateString = function(a, b) {
+function interpolateString(a, b) {
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
am, // current match in a
bm, // current match in b
else s[++i] = bm;
} else { // interpolate non-matching numbers
s[++i] = null;
- q.push({i: i, x: reinterpolate(am, bm)});
+ q.push({i: i, x: interpolateNumber(am, bm)});
}
bi = reB.lastIndex;
}
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
-};
+}
-var interpolateValue = function(a, b) {
+function interpolateValue(a, b) {
var t = typeof b, c;
return b == null || t === "boolean" ? constant$3(b)
- : (t === "number" ? reinterpolate
+ : (t === "number" ? interpolateNumber
: t === "string" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString)
: b instanceof color ? interpolateRgb
: b instanceof Date ? date
: Array.isArray(b) ? array$1
: typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
- : reinterpolate)(a, b);
-};
+ : interpolateNumber)(a, b);
+}
+
+function discrete(range) {
+ var n = range.length;
+ return function(t) {
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
+ };
+}
+
+function hue$1(a, b) {
+ var i = hue(+a, +b);
+ return function(t) {
+ var x = i(t);
+ return x - 360 * Math.floor(x / 360);
+ };
+}
-var interpolateRound = function(a, b) {
+function interpolateRound(a, b) {
return a = +a, b -= a, function(t) {
return Math.round(a + b * t);
};
-};
+}
var degrees = 180 / Math.PI;
scaleY: 1
};
-var decompose = function(a, b, c, d, e, f) {
+function decompose(a, b, c, d, e, f) {
var scaleX, scaleY, skewX;
if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
scaleX: scaleX,
scaleY: scaleY
};
-};
+}
-var cssNode;
-var cssRoot;
-var cssView;
-var svgNode;
+var cssNode,
+ cssRoot,
+ cssView,
+ svgNode;
function parseCss(value) {
if (value === "none") return identity$2;
function translate(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push("translate(", null, pxComma, null, pxParen);
- q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});
+ q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
} else if (xb || yb) {
s.push("translate(" + xb + pxComma + yb + pxParen);
}
function rotate(a, b, s, q) {
if (a !== b) {
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
- q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: reinterpolate(a, b)});
+ q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b)});
} else if (b) {
s.push(pop(s) + "rotate(" + b + degParen);
}
function skewX(a, b, s, q) {
if (a !== b) {
- q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: reinterpolate(a, b)});
+ q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b)});
} else if (b) {
s.push(pop(s) + "skewX(" + b + degParen);
}
function scale(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
- q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)});
+ q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
} else if (xb !== 1 || yb !== 1) {
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
-var rho = Math.SQRT2;
-var rho2 = 2;
-var rho4 = 4;
-var epsilon2 = 1e-12;
+var rho = Math.SQRT2,
+ rho2 = 2,
+ rho4 = 4,
+ epsilon2 = 1e-12;
function cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
-var interpolateZoom = function(p0, p1) {
+function interpolateZoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
dx = ux1 - ux0,
i.duration = S * 1000;
return i;
-};
+}
function hsl$1(hue$$1) {
return function(start, end) {
var cubehelix$2 = cubehelix$1(hue);
var cubehelixLong = cubehelix$1(nogamma);
-var quantize = function(interpolator, n) {
+function piecewise(interpolate, values) {
+ var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
+ while (i < n) I[i] = interpolate(v, v = values[++i]);
+ return function(t) {
+ var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
+ return I[i](t - i);
+ };
+}
+
+function quantize(interpolator, n) {
var samples = new Array(n);
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
return samples;
-};
+}
-var frame = 0;
-var timeout = 0;
-var interval = 0;
-var pokeDelay = 1000;
-var taskHead;
-var taskTail;
-var clockLast = 0;
-var clockNow = 0;
-var clockSkew = 0;
-var clock = typeof performance === "object" && performance.now ? performance : Date;
-var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
+var frame = 0, // is an animation frame pending?
+ timeout = 0, // is a timeout pending?
+ interval = 0, // are any timers active?
+ pokeDelay = 1000, // how frequently we check for clock skew
+ taskHead,
+ taskTail,
+ clockLast = 0,
+ clockNow = 0,
+ clockSkew = 0,
+ clock = typeof performance === "object" && performance.now ? performance : Date,
+ setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };
function now() {
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
}
-var timeout$1 = function(callback, delay, time) {
+function timeout$1(callback, delay, time) {
var t = new Timer;
delay = delay == null ? 0 : +delay;
t.restart(function(elapsed) {
callback(elapsed + delay);
}, delay, time);
return t;
-};
+}
-var interval$1 = function(callback, delay, time) {
+function interval$1(callback, delay, time) {
var t = new Timer, total = delay;
if (delay == null) return t.restart(callback, delay, time), t;
delay = +delay, time = time == null ? now() : +time;
callback(elapsed);
}, delay, time);
return t;
-};
+}
var emptyOn = dispatch("start", "end", "interrupt");
var emptyTween = [];
var ENDING = 5;
var ENDED = 6;
-var schedule = function(node, name, id, index, group, timing) {
+function schedule(node, name, id, index, group, timing) {
var schedules = node.__transition;
if (!schedules) node.__transition = {};
else if (id in schedules) return;
- create(node, id, {
+ create$1(node, id, {
name: name,
index: index, // For context during callback.
group: group, // For context during callback.
timer: null,
state: CREATED
});
-};
+}
function init(node, id) {
var schedule = get$1(node, id);
return schedule;
}
-function create(node, id, self) {
+function create$1(node, id, self) {
var schedules = node.__transition,
tween;
}
}
-var interrupt = function(node, name) {
+function interrupt(node, name) {
var schedules = node.__transition,
schedule$$1,
active,
}
if (empty) delete node.__transition;
-};
+}
-var selection_interrupt = function(name) {
+function selection_interrupt(name) {
return this.each(function() {
interrupt(this, name);
});
-};
+}
function tweenRemove(id, name) {
var tween0, tween1;
};
}
-var transition_tween = function(name, value) {
+function transition_tween(name, value) {
var id = this._id;
name += "";
}
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
-};
+}
function tweenValue(transition, name, value) {
var id = transition._id;
};
}
-var interpolate = function(a, b) {
+function interpolate(a, b) {
var c;
- return (typeof b === "number" ? reinterpolate
+ return (typeof b === "number" ? interpolateNumber
: b instanceof color ? interpolateRgb
: (c = color(b)) ? (b = c, interpolateRgb)
: interpolateString)(a, b);
-};
+}
function attrRemove$1(name) {
return function() {
};
}
-var transition_attr = function(name, value) {
+function transition_attr(name, value) {
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate;
return this.attrTween(name, typeof value === "function"
? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value))
: value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)
: (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + ""));
-};
+}
function attrTweenNS(fullname, value) {
function tween() {
return tween;
}
-var transition_attrTween = function(name, value) {
+function transition_attrTween(name, value) {
var key = "attr." + name;
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
var fullname = namespace(name);
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
-};
+}
function delayFunction(id, value) {
return function() {
};
}
-var transition_delay = function(value) {
+function transition_delay(value) {
var id = this._id;
return arguments.length
? delayFunction
: delayConstant)(id, value))
: get$1(this.node(), id).delay;
-};
+}
function durationFunction(id, value) {
return function() {
};
}
-var transition_duration = function(value) {
+function transition_duration(value) {
var id = this._id;
return arguments.length
? durationFunction
: durationConstant)(id, value))
: get$1(this.node(), id).duration;
-};
+}
function easeConstant(id, value) {
if (typeof value !== "function") throw new Error;
};
}
-var transition_ease = function(value) {
+function transition_ease(value) {
var id = this._id;
return arguments.length
? this.each(easeConstant(id, value))
: get$1(this.node(), id).ease;
-};
+}
-var transition_filter = function(match) {
+function transition_filter(match) {
if (typeof match !== "function") match = matcher$1(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
}
return new Transition(subgroups, this._parents, this._name, this._id);
-};
+}
-var transition_merge = function(transition$$1) {
+function transition_merge(transition$$1) {
if (transition$$1._id !== this._id) throw new Error;
for (var groups0 = this._groups, groups1 = transition$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
}
return new Transition(merges, this._parents, this._name, this._id);
-};
+}
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
};
}
-var transition_on = function(name, listener) {
+function transition_on(name, listener) {
var id = this._id;
return arguments.length < 2
? get$1(this.node(), id).on.on(name)
: this.each(onFunction(id, name, listener));
-};
+}
function removeFunction(id) {
return function() {
};
}
-var transition_remove = function() {
+function transition_remove() {
return this.on("end.remove", removeFunction(this._id));
-};
+}
-var transition_select = function(select) {
+function transition_select(select$$1) {
var name = this._name,
id = this._id;
- if (typeof select !== "function") select = selector(select);
+ if (typeof select$$1 !== "function") select$$1 = selector(select$$1);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
- if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
+ if ((node = group[i]) && (subnode = select$$1.call(node, node.__data__, i, group))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
subgroup[i] = subnode;
schedule(subgroup[i], name, id, i, subgroup, get$1(node, id));
}
return new Transition(subgroups, this._parents, name, id);
-};
+}
-var transition_selectAll = function(select) {
+function transition_selectAll(select$$1) {
var name = this._name,
id = this._id;
- if (typeof select !== "function") select = selectorAll(select);
+ if (typeof select$$1 !== "function") select$$1 = selectorAll(select$$1);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
- for (var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) {
+ for (var children = select$$1.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) {
if (child = children[k]) {
schedule(child, name, id, k, children, inherit);
}
}
return new Transition(subgroups, parents, name, id);
-};
+}
var Selection$1 = selection.prototype.constructor;
-var transition_selection = function() {
+function transition_selection() {
return new Selection$1(this._groups, this._parents);
-};
+}
function styleRemove$1(name, interpolate$$1) {
var value00,
};
}
-var transition_style = function(name, value, priority) {
+function transition_style(name, value, priority) {
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
return value == null ? this
.styleTween(name, styleRemove$1(name, i))
: this.styleTween(name, typeof value === "function"
? styleFunction$1(name, i, tweenValue(this, "style." + name, value))
: styleConstant$1(name, i, value + ""), priority);
-};
+}
function styleTween(name, value, priority) {
function tween() {
return tween;
}
-var transition_styleTween = function(name, value, priority) {
+function transition_styleTween(name, value, priority) {
var key = "style." + (name += "");
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
-};
+}
function textConstant$1(value) {
return function() {
};
}
-var transition_text = function(value) {
+function transition_text(value) {
return this.tween("text", typeof value === "function"
? textFunction$1(tweenValue(this, "text", value))
: textConstant$1(value == null ? "" : value + ""));
-};
+}
-var transition_transition = function() {
+function transition_transition() {
var name = this._name,
id0 = this._id,
id1 = newId();
}
return new Transition(groups, this._parents, name, id1);
-};
+}
var id = 0;
return polyInOut;
})(exponent);
-var pi = Math.PI;
-var halfPi = pi / 2;
+var pi = Math.PI,
+ halfPi = pi / 2;
function sinIn(t) {
return 1 - Math.cos(t * halfPi);
return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
}
-var b1 = 4 / 11;
-var b2 = 6 / 11;
-var b3 = 8 / 11;
-var b4 = 3 / 4;
-var b5 = 9 / 11;
-var b6 = 10 / 11;
-var b7 = 15 / 16;
-var b8 = 21 / 22;
-var b9 = 63 / 64;
-var b0 = 1 / b1 / b1;
+var b1 = 4 / 11,
+ b2 = 6 / 11,
+ b3 = 8 / 11,
+ b4 = 3 / 4,
+ b5 = 9 / 11,
+ b6 = 10 / 11,
+ b7 = 15 / 16,
+ b8 = 21 / 22,
+ b9 = 63 / 64,
+ b0 = 1 / b1 / b1;
function bounceIn(t) {
return 1 - bounceOut(1 - t);
return backInOut;
})(overshoot);
-var tau = 2 * Math.PI;
-var amplitude = 1;
-var period = 0.3;
+var tau = 2 * Math.PI,
+ amplitude = 1,
+ period = 0.3;
var elasticIn = (function custom(a, p) {
var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
return timing;
}
-var selection_transition = function(name) {
+function selection_transition(name) {
var id,
timing;
}
return new Transition(groups, this._parents, name, id);
-};
+}
selection.prototype.interrupt = selection_interrupt;
selection.prototype.transition = selection_transition;
var root$1 = [null];
-var active = function(node, name) {
+function active(node, name) {
var schedules = node.__transition,
schedule$$1,
i;
}
return null;
-};
+}
-var constant$4 = function(x) {
+function constant$4(x) {
return function() {
return x;
};
-};
+}
-var BrushEvent = function(target, type, selection) {
+function BrushEvent(target, type, selection) {
this.target = target;
this.type = type;
this.selection = selection;
-};
+}
function nopropagation$1() {
exports.event.stopImmediatePropagation();
}
-var noevent$1 = function() {
+function noevent$1() {
exports.event.preventDefault();
exports.event.stopImmediatePropagation();
-};
+}
-var MODE_DRAG = {name: "drag"};
-var MODE_SPACE = {name: "space"};
-var MODE_HANDLE = {name: "handle"};
-var MODE_CENTER = {name: "center"};
+var MODE_DRAG = {name: "drag"},
+ MODE_SPACE = {name: "space"},
+ MODE_HANDLE = {name: "handle"},
+ MODE_CENTER = {name: "center"};
var X = {
name: "x",
}
// Ignore right-click, since that should open the context menu.
-function defaultFilter() {
+function defaultFilter$1() {
return !exports.event.button;
}
}
// Like d3.local, but with the name “__brush” rather than auto-generated.
-function local(node) {
+function local$1(node) {
while (!node.__brush) if (!(node = node.parentNode)) return;
return node.__brush;
}
-function empty(extent) {
+function empty$1(extent) {
return extent[0][0] === extent[1][0]
|| extent[0][1] === extent[1][1];
}
return brush$1(Y);
}
-var brush = function() {
+function brush() {
return brush$1(XY);
-};
+}
function brush$1(dim) {
var extent = defaultExtent,
- filter = defaultFilter,
+ filter = defaultFilter$1,
listeners = dispatch(brush, "start", "brush", "end"),
handleSize = 6,
touchending;
.attr("cursor", cursors.overlay)
.merge(overlay)
.each(function() {
- var extent = local(this).extent;
+ var extent = local$1(this).extent;
select(this)
.attr("x", extent[0][0])
.attr("y", extent[0][1])
.on("mousedown.brush touchstart.brush", started);
}
- brush.move = function(group, selection) {
+ brush.move = function(group, selection$$1) {
if (group.selection) {
group
.on("start.brush", function() { emitter(this, arguments).beforestart().start(); })
state = that.__brush,
emit = emitter(that, arguments),
selection0 = state.selection,
- selection1 = dim.input(typeof selection === "function" ? selection.apply(this, arguments) : selection, state.extent),
+ selection1 = dim.input(typeof selection$$1 === "function" ? selection$$1.apply(this, arguments) : selection$$1, state.extent),
i = interpolateValue(selection0, selection1);
function tween(t) {
- state.selection = t === 1 && empty(selection1) ? null : i(t);
+ state.selection = t === 1 && empty$1(selection1) ? null : i(t);
redraw.call(that);
emit.brush();
}
var that = this,
args = arguments,
state = that.__brush,
- selection1 = dim.input(typeof selection === "function" ? selection.apply(that, args) : selection, state.extent),
+ selection1 = dim.input(typeof selection$$1 === "function" ? selection$$1.apply(that, args) : selection$$1, state.extent),
emit = emitter(that, args).beforestart();
interrupt(that);
- state.selection = selection1 == null || empty(selection1) ? null : selection1;
+ state.selection = selection1 == null || empty$1(selection1) ? null : selection1;
redraw.call(that);
emit.start().brush().end();
});
function redraw() {
var group = select(this),
- selection = local(this).selection;
+ selection$$1 = local$1(this).selection;
- if (selection) {
+ if (selection$$1) {
group.selectAll(".selection")
.style("display", null)
- .attr("x", selection[0][0])
- .attr("y", selection[0][1])
- .attr("width", selection[1][0] - selection[0][0])
- .attr("height", selection[1][1] - selection[0][1]);
+ .attr("x", selection$$1[0][0])
+ .attr("y", selection$$1[0][1])
+ .attr("width", selection$$1[1][0] - selection$$1[0][0])
+ .attr("height", selection$$1[1][1] - selection$$1[0][1]);
group.selectAll(".handle")
.style("display", null)
- .attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })
- .attr("y", function(d) { return d.type[0] === "s" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })
- .attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })
- .attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });
+ .attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection$$1[1][0] - handleSize / 2 : selection$$1[0][0] - handleSize / 2; })
+ .attr("y", function(d) { return d.type[0] === "s" ? selection$$1[1][1] - handleSize / 2 : selection$$1[0][1] - handleSize / 2; })
+ .attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection$$1[1][0] - selection$$1[0][0] + handleSize : handleSize; })
+ .attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection$$1[1][1] - selection$$1[0][1] + handleSize : handleSize; });
}
else {
mode = (exports.event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (exports.event.altKey ? MODE_CENTER : MODE_HANDLE),
signX = dim === Y ? null : signsX[type],
signY = dim === X ? null : signsY[type],
- state = local(that),
+ state = local$1(that),
extent = state.extent,
- selection = state.selection,
+ selection$$1 = state.selection,
W = extent[0][0], w0, w1,
N = extent[0][1], n0, n1,
E = extent[1][0], e0, e1,
lockX,
lockY,
point0 = mouse(that),
- point = point0,
+ point$$1 = point0,
emit = emitter(that, arguments).beforestart();
if (type === "overlay") {
- state.selection = selection = [
+ state.selection = selection$$1 = [
[w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]],
[e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0]
];
} else {
- w0 = selection[0][0];
- n0 = selection[0][1];
- e0 = selection[1][0];
- s0 = selection[1][1];
+ w0 = selection$$1[0][0];
+ n0 = selection$$1[0][1];
+ e0 = selection$$1[1][0];
+ s0 = selection$$1[1][1];
}
w1 = w0;
function moved() {
var point1 = mouse(that);
if (shifting && !lockX && !lockY) {
- if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true;
+ if (Math.abs(point1[0] - point$$1[0]) > Math.abs(point1[1] - point$$1[1])) lockY = true;
else lockX = true;
}
- point = point1;
+ point$$1 = point1;
moving = true;
noevent$1();
move();
function move() {
var t;
- dx = point[0] - point0[0];
- dy = point[1] - point0[1];
+ dx = point$$1[0] - point0[0];
+ dy = point$$1[1] - point0[1];
switch (mode) {
case MODE_SPACE:
if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]);
}
- if (state.selection) selection = state.selection; // May be set by brush.move!
- if (lockX) w1 = selection[0][0], e1 = selection[1][0];
- if (lockY) n1 = selection[0][1], s1 = selection[1][1];
+ if (state.selection) selection$$1 = state.selection; // May be set by brush.move!
+ if (lockX) w1 = selection$$1[0][0], e1 = selection$$1[1][0];
+ if (lockY) n1 = selection$$1[0][1], s1 = selection$$1[1][1];
- if (selection[0][0] !== w1
- || selection[0][1] !== n1
- || selection[1][0] !== e1
- || selection[1][1] !== s1) {
+ if (selection$$1[0][0] !== w1
+ || selection$$1[0][1] !== n1
+ || selection$$1[1][0] !== e1
+ || selection$$1[1][1] !== s1) {
state.selection = [[w1, n1], [e1, s1]];
redraw.call(that);
emit.brush();
}
group.attr("pointer-events", "all");
overlay.attr("cursor", cursors.overlay);
- if (state.selection) selection = state.selection; // May be set by brush.move (on start)!
- if (empty(selection)) state.selection = null, redraw.call(that);
+ if (state.selection) selection$$1 = state.selection; // May be set by brush.move (on start)!
+ if (empty$1(selection$$1)) state.selection = null, redraw.call(that);
emit.end();
}
};
}
-var chord = function() {
+function chord() {
var padAngle = 0,
sortGroups = null,
sortSubgroups = null,
};
return chord;
-};
+}
var slice$2 = Array.prototype.slice;
-var constant$5 = function(x) {
+function constant$5(x) {
return function() {
return x;
};
-};
+}
-var pi$2 = Math.PI;
-var tau$2 = 2 * pi$2;
-var epsilon$1 = 1e-6;
-var tauEpsilon = tau$2 - epsilon$1;
+var pi$2 = Math.PI,
+ tau$2 = 2 * pi$2,
+ epsilon$1 = 1e-6,
+ tauEpsilon = tau$2 - epsilon$1;
function Path() {
this._x0 = this._y0 = // start of current subpath
}
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
- else if (!(l01_2 > epsilon$1)) {}
+ else if (!(l01_2 > epsilon$1));
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
// Equivalently, is (x1,y1) coincident with (x2,y2)?
return d.endAngle;
}
-var ribbon = function() {
+function ribbon() {
var source = defaultSource,
target = defaultTarget,
radius = defaultRadius,
};
ribbon.context = function(_) {
- return arguments.length ? (context = _ == null ? null : _, ribbon) : context;
+ return arguments.length ? ((context = _ == null ? null : _), ribbon) : context;
};
return ribbon;
-};
+}
var prefix = "$";
return map;
}
-var nest = function() {
+function nest() {
var keys = [],
sortKeys = [],
sortValues,
values,
result = createResult();
- while (++i < n) {
- if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) {
- values.push(value);
+ while (++i < n) {
+ if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) {
+ values.push(value);
+ } else {
+ valuesByKey.set(keyValue, [value]);
+ }
+ }
+
+ valuesByKey.each(function(values, key) {
+ setResult(result, key, apply(values, depth, createResult, setResult));
+ });
+
+ return result;
+ }
+
+ function entries(map, depth) {
+ if (++depth > keys.length) return map;
+ var array, sortKey = sortKeys[depth - 1];
+ if (rollup != null && depth >= keys.length) array = map.entries();
+ else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });
+ return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;
+ }
+
+ return nest = {
+ object: function(array) { return apply(array, 0, createObject, setObject); },
+ map: function(array) { return apply(array, 0, createMap, setMap); },
+ entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },
+ key: function(d) { keys.push(d); return nest; },
+ sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },
+ sortValues: function(order) { sortValues = order; return nest; },
+ rollup: function(f) { rollup = f; return nest; }
+ };
+}
+
+function createObject() {
+ return {};
+}
+
+function setObject(object, key, value) {
+ object[key] = value;
+}
+
+function createMap() {
+ return map$1();
+}
+
+function setMap(map, key, value) {
+ map.set(key, value);
+}
+
+function Set() {}
+
+var proto = map$1.prototype;
+
+Set.prototype = set$2.prototype = {
+ constructor: Set,
+ has: proto.has,
+ add: function(value) {
+ value += "";
+ this[prefix + value] = value;
+ return this;
+ },
+ remove: proto.remove,
+ clear: proto.clear,
+ values: proto.keys,
+ size: proto.size,
+ empty: proto.empty,
+ each: proto.each
+};
+
+function set$2(object, f) {
+ var set = new Set;
+
+ // Copy constructor.
+ if (object instanceof Set) object.each(function(value) { set.add(value); });
+
+ // Otherwise, assume it’s an array.
+ else if (object) {
+ var i = -1, n = object.length;
+ if (f == null) while (++i < n) set.add(object[i]);
+ else while (++i < n) set.add(f(object[i], i, object));
+ }
+
+ return set;
+}
+
+function keys(map) {
+ var keys = [];
+ for (var key in map) keys.push(key);
+ return keys;
+}
+
+function values(map) {
+ var values = [];
+ for (var key in map) values.push(map[key]);
+ return values;
+}
+
+function entries(map) {
+ var entries = [];
+ for (var key in map) entries.push({key: key, value: map[key]});
+ return entries;
+}
+
+var array$2 = Array.prototype;
+
+var slice$3 = array$2.slice;
+
+function ascending$2(a, b) {
+ return a - b;
+}
+
+function area(ring) {
+ var i = 0, n = ring.length, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];
+ while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];
+ return area;
+}
+
+function constant$6(x) {
+ return function() {
+ return x;
+ };
+}
+
+function contains(ring, hole) {
+ var i = -1, n = hole.length, c;
+ while (++i < n) if (c = ringContains(ring, hole[i])) return c;
+ return 0;
+}
+
+function ringContains(ring, point) {
+ var x = point[0], y = point[1], contains = -1;
+ for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) {
+ var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1];
+ if (segmentContains(pi, pj, point)) return 0;
+ if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) contains = -contains;
+ }
+ return contains;
+}
+
+function segmentContains(a, b, c) {
+ var i; return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);
+}
+
+function collinear(a, b, c) {
+ return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]);
+}
+
+function within(p, q, r) {
+ return p <= q && q <= r || r <= q && q <= p;
+}
+
+function noop$1() {}
+
+var cases = [
+ [],
+ [[[1.0, 1.5], [0.5, 1.0]]],
+ [[[1.5, 1.0], [1.0, 1.5]]],
+ [[[1.5, 1.0], [0.5, 1.0]]],
+ [[[1.0, 0.5], [1.5, 1.0]]],
+ [[[1.0, 1.5], [0.5, 1.0]], [[1.0, 0.5], [1.5, 1.0]]],
+ [[[1.0, 0.5], [1.0, 1.5]]],
+ [[[1.0, 0.5], [0.5, 1.0]]],
+ [[[0.5, 1.0], [1.0, 0.5]]],
+ [[[1.0, 1.5], [1.0, 0.5]]],
+ [[[0.5, 1.0], [1.0, 0.5]], [[1.5, 1.0], [1.0, 1.5]]],
+ [[[1.5, 1.0], [1.0, 0.5]]],
+ [[[0.5, 1.0], [1.5, 1.0]]],
+ [[[1.0, 1.5], [1.5, 1.0]]],
+ [[[0.5, 1.0], [1.0, 1.5]]],
+ []
+];
+
+function contours() {
+ var dx = 1,
+ dy = 1,
+ threshold$$1 = thresholdSturges,
+ smooth = smoothLinear;
+
+ function contours(values) {
+ var tz = threshold$$1(values);
+
+ // Convert number of thresholds into uniform thresholds.
+ if (!Array.isArray(tz)) {
+ var domain = extent(values), start = domain[0], stop = domain[1];
+ tz = tickStep(start, stop, tz);
+ tz = sequence(Math.floor(start / tz) * tz, Math.floor(stop / tz) * tz, tz);
+ } else {
+ tz = tz.slice().sort(ascending$2);
+ }
+
+ return tz.map(function(value) {
+ return contour(values, value);
+ });
+ }
+
+ // Accumulate, smooth contour rings, assign holes to exterior rings.
+ // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js
+ function contour(values, value) {
+ var polygons = [],
+ holes = [];
+
+ isorings(values, value, function(ring) {
+ smooth(ring, values, value);
+ if (area(ring) > 0) polygons.push([ring]);
+ else holes.push(ring);
+ });
+
+ holes.forEach(function(hole) {
+ for (var i = 0, n = polygons.length, polygon; i < n; ++i) {
+ if (contains((polygon = polygons[i])[0], hole) !== -1) {
+ polygon.push(hole);
+ return;
+ }
+ }
+ });
+
+ return {
+ type: "MultiPolygon",
+ value: value,
+ coordinates: polygons
+ };
+ }
+
+ // Marching squares with isolines stitched into rings.
+ // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js
+ function isorings(values, value, callback) {
+ var fragmentByStart = new Array,
+ fragmentByEnd = new Array,
+ x, y, t0, t1, t2, t3;
+
+ // Special case for the first row (y = -1, t2 = t3 = 0).
+ x = y = -1;
+ t1 = values[0] >= value;
+ cases[t1 << 1].forEach(stitch);
+ while (++x < dx - 1) {
+ t0 = t1, t1 = values[x + 1] >= value;
+ cases[t0 | t1 << 1].forEach(stitch);
+ }
+ cases[t1 << 0].forEach(stitch);
+
+ // General case for the intermediate rows.
+ while (++y < dy - 1) {
+ x = -1;
+ t1 = values[y * dx + dx] >= value;
+ t2 = values[y * dx] >= value;
+ cases[t1 << 1 | t2 << 2].forEach(stitch);
+ while (++x < dx - 1) {
+ t0 = t1, t1 = values[y * dx + dx + x + 1] >= value;
+ t3 = t2, t2 = values[y * dx + x + 1] >= value;
+ cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch);
+ }
+ cases[t1 | t2 << 3].forEach(stitch);
+ }
+
+ // Special case for the last row (y = dy - 1, t0 = t1 = 0).
+ x = -1;
+ t2 = values[y * dx] >= value;
+ cases[t2 << 2].forEach(stitch);
+ while (++x < dx - 1) {
+ t3 = t2, t2 = values[y * dx + x + 1] >= value;
+ cases[t2 << 2 | t3 << 3].forEach(stitch);
+ }
+ cases[t2 << 3].forEach(stitch);
+
+ function stitch(line) {
+ var start = [line[0][0] + x, line[0][1] + y],
+ end = [line[1][0] + x, line[1][1] + y],
+ startIndex = index(start),
+ endIndex = index(end),
+ f, g;
+ if (f = fragmentByEnd[startIndex]) {
+ if (g = fragmentByStart[endIndex]) {
+ delete fragmentByEnd[f.end];
+ delete fragmentByStart[g.start];
+ if (f === g) {
+ f.ring.push(end);
+ callback(f.ring);
+ } else {
+ fragmentByStart[f.start] = fragmentByEnd[g.end] = {start: f.start, end: g.end, ring: f.ring.concat(g.ring)};
+ }
+ } else {
+ delete fragmentByEnd[f.end];
+ f.ring.push(end);
+ fragmentByEnd[f.end = endIndex] = f;
+ }
+ } else if (f = fragmentByStart[endIndex]) {
+ if (g = fragmentByEnd[startIndex]) {
+ delete fragmentByStart[f.start];
+ delete fragmentByEnd[g.end];
+ if (f === g) {
+ f.ring.push(end);
+ callback(f.ring);
+ } else {
+ fragmentByStart[g.start] = fragmentByEnd[f.end] = {start: g.start, end: f.end, ring: g.ring.concat(f.ring)};
+ }
+ } else {
+ delete fragmentByStart[f.start];
+ f.ring.unshift(start);
+ fragmentByStart[f.start = startIndex] = f;
+ }
} else {
- valuesByKey.set(keyValue, [value]);
+ fragmentByStart[startIndex] = fragmentByEnd[endIndex] = {start: startIndex, end: endIndex, ring: [start, end]};
}
}
+ }
- valuesByKey.each(function(values, key) {
- setResult(result, key, apply(values, depth, createResult, setResult));
- });
-
- return result;
+ function index(point) {
+ return point[0] * 2 + point[1] * (dx + 1) * 4;
}
- function entries(map, depth) {
- if (++depth > keys.length) return map;
- var array, sortKey = sortKeys[depth - 1];
- if (rollup != null && depth >= keys.length) array = map.entries();
- else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });
- return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;
+ function smoothLinear(ring, values, value) {
+ ring.forEach(function(point) {
+ var x = point[0],
+ y = point[1],
+ xt = x | 0,
+ yt = y | 0,
+ v0,
+ v1 = values[yt * dx + xt];
+ if (x > 0 && x < dx && xt === x) {
+ v0 = values[yt * dx + xt - 1];
+ point[0] = x + (value - v0) / (v1 - v0) - 0.5;
+ }
+ if (y > 0 && y < dy && yt === y) {
+ v0 = values[(yt - 1) * dx + xt];
+ point[1] = y + (value - v0) / (v1 - v0) - 0.5;
+ }
+ });
}
- return nest = {
- object: function(array) { return apply(array, 0, createObject, setObject); },
- map: function(array) { return apply(array, 0, createMap, setMap); },
- entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },
- key: function(d) { keys.push(d); return nest; },
- sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },
- sortValues: function(order) { sortValues = order; return nest; },
- rollup: function(f) { rollup = f; return nest; }
+ contours.contour = contour;
+
+ contours.size = function(_) {
+ if (!arguments.length) return [dx, dy];
+ var _0 = Math.ceil(_[0]), _1 = Math.ceil(_[1]);
+ if (!(_0 > 0) || !(_1 > 0)) throw new Error("invalid size");
+ return dx = _0, dy = _1, contours;
};
-};
-function createObject() {
- return {};
+ contours.thresholds = function(_) {
+ return arguments.length ? (threshold$$1 = typeof _ === "function" ? _ : Array.isArray(_) ? constant$6(slice$3.call(_)) : constant$6(_), contours) : threshold$$1;
+ };
+
+ contours.smooth = function(_) {
+ return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours) : smooth === smoothLinear;
+ };
+
+ return contours;
}
-function setObject(object, key, value) {
- object[key] = value;
+// TODO Optimize edge cases.
+// TODO Optimize index calculation.
+// TODO Optimize arguments.
+function blurX(source, target, r) {
+ var n = source.width,
+ m = source.height,
+ w = (r << 1) + 1;
+ for (var j = 0; j < m; ++j) {
+ for (var i = 0, sr = 0; i < n + r; ++i) {
+ if (i < n) {
+ sr += source.data[i + j * n];
+ }
+ if (i >= r) {
+ if (i >= w) {
+ sr -= source.data[i - w + j * n];
+ }
+ target.data[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w);
+ }
+ }
+ }
}
-function createMap() {
- return map$1();
+// TODO Optimize edge cases.
+// TODO Optimize index calculation.
+// TODO Optimize arguments.
+function blurY(source, target, r) {
+ var n = source.width,
+ m = source.height,
+ w = (r << 1) + 1;
+ for (var i = 0; i < n; ++i) {
+ for (var j = 0, sr = 0; j < m + r; ++j) {
+ if (j < m) {
+ sr += source.data[i + j * n];
+ }
+ if (j >= r) {
+ if (j >= w) {
+ sr -= source.data[i + (j - w) * n];
+ }
+ target.data[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w);
+ }
+ }
+ }
}
-function setMap(map, key, value) {
- map.set(key, value);
+function defaultX(d) {
+ return d[0];
}
-function Set() {}
+function defaultY(d) {
+ return d[1];
+}
-var proto = map$1.prototype;
+function defaultWeight() {
+ return 1;
+}
+
+function density() {
+ var x = defaultX,
+ y = defaultY,
+ weight = defaultWeight,
+ dx = 960,
+ dy = 500,
+ r = 20, // blur radius
+ k = 2, // log2(grid cell size)
+ o = r * 3, // grid offset, to pad for blur
+ n = (dx + o * 2) >> k, // grid width
+ m = (dy + o * 2) >> k, // grid height
+ threshold$$1 = constant$6(20);
+
+ function density(data) {
+ var values0 = new Float32Array(n * m),
+ values1 = new Float32Array(n * m);
+
+ data.forEach(function(d, i, data) {
+ var xi = (+x(d, i, data) + o) >> k,
+ yi = (+y(d, i, data) + o) >> k,
+ wi = +weight(d, i, data);
+ if (xi >= 0 && xi < n && yi >= 0 && yi < m) {
+ values0[xi + yi * n] += wi;
+ }
+ });
-Set.prototype = set$2.prototype = {
- constructor: Set,
- has: proto.has,
- add: function(value) {
- value += "";
- this[prefix + value] = value;
- return this;
- },
- remove: proto.remove,
- clear: proto.clear,
- values: proto.keys,
- size: proto.size,
- empty: proto.empty,
- each: proto.each
-};
+ // TODO Optimize.
+ blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k);
+ blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k);
+ blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k);
+ blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k);
+ blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k);
+ blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k);
-function set$2(object, f) {
- var set = new Set;
+ var tz = threshold$$1(values0);
- // Copy constructor.
- if (object instanceof Set) object.each(function(value) { set.add(value); });
+ // Convert number of thresholds into uniform thresholds.
+ if (!Array.isArray(tz)) {
+ var stop = max(values0);
+ tz = tickStep(0, stop, tz);
+ tz = sequence(0, Math.floor(stop / tz) * tz, tz);
+ tz.shift();
+ }
- // Otherwise, assume it’s an array.
- else if (object) {
- var i = -1, n = object.length;
- if (f == null) while (++i < n) set.add(object[i]);
- else while (++i < n) set.add(f(object[i], i, object));
+ return contours()
+ .thresholds(tz)
+ .size([n, m])
+ (values0)
+ .map(transform);
}
- return set;
-}
+ function transform(geometry) {
+ geometry.value *= Math.pow(2, -2 * k); // Density in points per square pixel.
+ geometry.coordinates.forEach(transformPolygon);
+ return geometry;
+ }
-var keys = function(map) {
- var keys = [];
- for (var key in map) keys.push(key);
- return keys;
-};
+ function transformPolygon(coordinates) {
+ coordinates.forEach(transformRing);
+ }
-var values = function(map) {
- var values = [];
- for (var key in map) values.push(map[key]);
- return values;
-};
+ function transformRing(coordinates) {
+ coordinates.forEach(transformPoint);
+ }
-var entries = function(map) {
- var entries = [];
- for (var key in map) entries.push({key: key, value: map[key]});
- return entries;
-};
+ // TODO Optimize.
+ function transformPoint(coordinates) {
+ coordinates[0] = coordinates[0] * Math.pow(2, k) - o;
+ coordinates[1] = coordinates[1] * Math.pow(2, k) - o;
+ }
+
+ function resize() {
+ o = r * 3;
+ n = (dx + o * 2) >> k;
+ m = (dy + o * 2) >> k;
+ return density;
+ }
+
+ density.x = function(_) {
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$6(+_), density) : x;
+ };
+
+ density.y = function(_) {
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$6(+_), density) : y;
+ };
+
+ density.weight = function(_) {
+ return arguments.length ? (weight = typeof _ === "function" ? _ : constant$6(+_), density) : weight;
+ };
+
+ density.size = function(_) {
+ if (!arguments.length) return [dx, dy];
+ var _0 = Math.ceil(_[0]), _1 = Math.ceil(_[1]);
+ if (!(_0 >= 0) && !(_0 >= 0)) throw new Error("invalid size");
+ return dx = _0, dy = _1, resize();
+ };
+
+ density.cellSize = function(_) {
+ if (!arguments.length) return 1 << k;
+ if (!((_ = +_) >= 1)) throw new Error("invalid cell size");
+ return k = Math.floor(Math.log(_) / Math.LN2), resize();
+ };
+
+ density.thresholds = function(_) {
+ return arguments.length ? (threshold$$1 = typeof _ === "function" ? _ : Array.isArray(_) ? constant$6(slice$3.call(_)) : constant$6(_), density) : threshold$$1;
+ };
+
+ density.bandwidth = function(_) {
+ if (!arguments.length) return Math.sqrt(r * (r + 1));
+ if (!((_ = +_) >= 0)) throw new Error("invalid bandwidth");
+ return r = Math.round((Math.sqrt(4 * _ * _ + 1) - 1) / 2), resize();
+ };
-var EOL = {};
-var EOF = {};
-var QUOTE = 34;
-var NEWLINE = 10;
-var RETURN = 13;
+ return density;
+}
+
+var EOL = {},
+ EOF = {},
+ QUOTE = 34,
+ NEWLINE = 10,
+ RETURN = 13;
function objectConverter(columns) {
return new Function("d", "return {" + columns.map(function(name, i) {
return columns;
}
-var dsv = function(delimiter) {
+function dsvFormat(delimiter) {
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
DELIMITER = delimiter.charCodeAt(0);
format: format,
formatRows: formatRows
};
-};
+}
-var csv = dsv(",");
+var csv = dsvFormat(",");
var csvParse = csv.parse;
var csvParseRows = csv.parseRows;
var csvFormat = csv.format;
var csvFormatRows = csv.formatRows;
-var tsv = dsv("\t");
+var tsv = dsvFormat("\t");
var tsvParse = tsv.parse;
var tsvParseRows = tsv.parseRows;
var tsvFormat = tsv.format;
var tsvFormatRows = tsv.formatRows;
-var center$1 = function(x, y) {
+function responseBlob(response) {
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
+ return response.blob();
+}
+
+function blob(input, init) {
+ return fetch(input, init).then(responseBlob);
+}
+
+function responseArrayBuffer(response) {
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
+ return response.arrayBuffer();
+}
+
+function buffer(input, init) {
+ return fetch(input, init).then(responseArrayBuffer);
+}
+
+function responseText(response) {
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
+ return response.text();
+}
+
+function text(input, init) {
+ return fetch(input, init).then(responseText);
+}
+
+function dsvParse(parse) {
+ return function(input, init, row) {
+ if (arguments.length === 2 && typeof init === "function") row = init, init = undefined;
+ return text(input, init).then(function(response) {
+ return parse(response, row);
+ });
+ };
+}
+
+function dsv(delimiter, input, init, row) {
+ if (arguments.length === 3 && typeof init === "function") row = init, init = undefined;
+ var format = dsvFormat(delimiter);
+ return text(input, init).then(function(response) {
+ return format.parse(response, row);
+ });
+}
+
+var csv$1 = dsvParse(csvParse);
+var tsv$1 = dsvParse(tsvParse);
+
+function image(input, init) {
+ return new Promise(function(resolve, reject) {
+ var image = new Image;
+ for (var key in init) image[key] = init[key];
+ image.onerror = reject;
+ image.onload = function() { resolve(image); };
+ image.src = input;
+ });
+}
+
+function responseJson(response) {
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
+ return response.json();
+}
+
+function json(input, init) {
+ return fetch(input, init).then(responseJson);
+}
+
+function parser(type) {
+ return function(input, init) {
+ return text(input, init).then(function(text$$1) {
+ return (new DOMParser).parseFromString(text$$1, type);
+ });
+ };
+}
+
+var xml = parser("application/xml");
+
+var html = parser("text/html");
+
+var svg = parser("image/svg+xml");
+
+function center$1(x, y) {
var nodes;
if (x == null) x = 0;
};
return force;
-};
+}
-var constant$6 = function(x) {
+function constant$7(x) {
return function() {
return x;
};
-};
+}
-var jiggle = function() {
+function jiggle() {
return (Math.random() - 0.5) * 1e-6;
-};
+}
-var tree_add = function(d) {
+function tree_add(d) {
var x = +this._x.call(null, d),
y = +this._y.call(null, d);
return add(this.cover(x, y), x, y, d);
-};
+}
function add(tree, x, y, d) {
if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points
return this;
}
-var tree_cover = function(x, y) {
+function tree_cover(x, y) {
if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points
var x0 = this._x0,
this._x1 = x1;
this._y1 = y1;
return this;
-};
+}
-var tree_data = function() {
+function tree_data() {
var data = [];
this.visit(function(node) {
if (!node.length) do data.push(node.data); while (node = node.next)
});
return data;
-};
+}
-var tree_extent = function(_) {
+function tree_extent(_) {
return arguments.length
? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])
: isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
-};
+}
-var Quad = function(node, x0, y0, x1, y1) {
+function Quad(node, x0, y0, x1, y1) {
this.node = node;
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
-};
+}
-var tree_find = function(x, y, radius) {
+function tree_find(x, y, radius) {
var data,
x0 = this._x0,
y0 = this._y0,
}
return data;
-};
+}
-var tree_remove = function(d) {
+function tree_remove(d) {
if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points
var parent,
if (next = node.next) delete node.next;
// If there are multiple coincident points, remove just the point.
- if (previous) return next ? previous.next = next : delete previous.next, this;
+ if (previous) return (next ? previous.next = next : delete previous.next), this;
// If this is the root point, remove it.
if (!parent) return this._root = next, this;
}
return this;
-};
+}
function removeAll(data) {
for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
return this;
}
-var tree_root = function() {
+function tree_root() {
return this._root;
-};
+}
-var tree_size = function() {
+function tree_size() {
var size = 0;
this.visit(function(node) {
if (!node.length) do ++size; while (node = node.next)
});
return size;
-};
+}
-var tree_visit = function(callback) {
+function tree_visit(callback) {
var quads = [], q, node = this._root, child, x0, y0, x1, y1;
if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));
while (q = quads.pop()) {
}
}
return this;
-};
+}
-var tree_visitAfter = function(callback) {
+function tree_visitAfter(callback) {
var quads = [], next = [], q;
if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));
while (q = quads.pop()) {
callback(q.node, q.x0, q.y0, q.x1, q.y1);
}
return this;
-};
+}
-function defaultX(d) {
+function defaultX$1(d) {
return d[0];
}
-var tree_x = function(_) {
+function tree_x(_) {
return arguments.length ? (this._x = _, this) : this._x;
-};
+}
-function defaultY(d) {
+function defaultY$1(d) {
return d[1];
}
-var tree_y = function(_) {
+function tree_y(_) {
return arguments.length ? (this._y = _, this) : this._y;
-};
+}
function quadtree(nodes, x, y) {
- var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
+ var tree = new Quadtree(x == null ? defaultX$1 : x, y == null ? defaultY$1 : y, NaN, NaN, NaN, NaN);
return nodes == null ? tree : tree.addAll(nodes);
}
return d.y + d.vy;
}
-var collide = function(radius) {
+function collide(radius) {
var nodes,
radii,
strength = 1,
iterations = 1;
- if (typeof radius !== "function") radius = constant$6(radius == null ? 1 : +radius);
+ if (typeof radius !== "function") radius = constant$7(radius == null ? 1 : +radius);
function force() {
var i, n = nodes.length,
};
force.radius = function(_) {
- return arguments.length ? (radius = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : radius;
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : radius;
};
return force;
-};
+}
function index(d) {
return d.index;
return node;
}
-var link = function(links) {
+function link(links) {
var id = index,
strength = defaultStrength,
strengths,
- distance = constant$6(30),
+ distance = constant$7(30),
distances,
nodes,
count,
};
force.strength = function(_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initializeStrength(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initializeStrength(), force) : strength;
};
force.distance = function(_) {
- return arguments.length ? (distance = typeof _ === "function" ? _ : constant$6(+_), initializeDistance(), force) : distance;
+ return arguments.length ? (distance = typeof _ === "function" ? _ : constant$7(+_), initializeDistance(), force) : distance;
};
return force;
-};
+}
function x$1(d) {
return d.x;
return d.y;
}
-var initialRadius = 10;
-var initialAngle = Math.PI * (3 - Math.sqrt(5));
+var initialRadius = 10,
+ initialAngle = Math.PI * (3 - Math.sqrt(5));
-var simulation = function(nodes) {
+function simulation(nodes) {
var simulation,
alpha = 1,
alphaMin = 0.001,
},
force: function(name, _) {
- return arguments.length > 1 ? (_ == null ? forces.remove(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name);
+ return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
},
find: function(x, y, radius) {
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
}
};
-};
+}
-var manyBody = function() {
+function manyBody() {
var nodes,
node,
alpha,
- strength = constant$6(-30),
+ strength = constant$7(-30),
strengths,
distanceMin2 = 1,
distanceMax2 = Infinity,
};
force.strength = function(_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.distanceMin = function(_) {
};
return force;
-};
+}
-var radial = function(radius, x, y) {
+function radial(radius, x, y) {
var nodes,
- strength = constant$6(0.1),
+ strength = constant$7(0.1),
strengths,
radiuses;
- if (typeof radius !== "function") radius = constant$6(+radius);
+ if (typeof radius !== "function") radius = constant$7(+radius);
if (x == null) x = 0;
if (y == null) y = 0;
};
force.strength = function(_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.radius = function(_) {
- return arguments.length ? (radius = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : radius;
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : radius;
};
force.x = function(_) {
};
return force;
-};
+}
-var x$2 = function(x) {
- var strength = constant$6(0.1),
+function x$2(x) {
+ var strength = constant$7(0.1),
nodes,
strengths,
xz;
- if (typeof x !== "function") x = constant$6(x == null ? 0 : +x);
+ if (typeof x !== "function") x = constant$7(x == null ? 0 : +x);
function force(alpha) {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
};
force.strength = function(_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.x = function(_) {
- return arguments.length ? (x = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : x;
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : x;
};
return force;
-};
+}
-var y$2 = function(y) {
- var strength = constant$6(0.1),
+function y$2(y) {
+ var strength = constant$7(0.1),
nodes,
strengths,
yz;
- if (typeof y !== "function") y = constant$6(y == null ? 0 : +y);
+ if (typeof y !== "function") y = constant$7(y == null ? 0 : +y);
function force(alpha) {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
};
force.strength = function(_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.y = function(_) {
- return arguments.length ? (y = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : y;
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : y;
};
return force;
-};
+}
// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimal(1.23) returns ["123", 0].
-var formatDecimal = function(x, p) {
+function formatDecimal(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
var i, coefficient = x.slice(0, i);
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
-};
+}
-var exponent$1 = function(x) {
+function exponent$1(x) {
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
-};
+}
-var formatGroup = function(grouping, thousands) {
+function formatGroup(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
return t.reverse().join(thousands);
};
-};
+}
-var formatNumerals = function(numerals) {
+function formatNumerals(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
-};
+}
+
+// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
+var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
+
+function formatSpecifier(specifier) {
+ return new FormatSpecifier(specifier);
+}
+
+formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
+
+function FormatSpecifier(specifier) {
+ if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
+ var match;
+ this.fill = match[1] || " ";
+ this.align = match[2] || ">";
+ this.sign = match[3] || "-";
+ this.symbol = match[4] || "";
+ this.zero = !!match[5];
+ this.width = match[6] && +match[6];
+ this.comma = !!match[7];
+ this.precision = match[8] && +match[8].slice(1);
+ this.trim = !!match[9];
+ this.type = match[10] || "";
+}
-var formatDefault = function(x, p) {
- x = x.toPrecision(p);
+FormatSpecifier.prototype.toString = function() {
+ return this.fill
+ + this.align
+ + this.sign
+ + this.symbol
+ + (this.zero ? "0" : "")
+ + (this.width == null ? "" : Math.max(1, this.width | 0))
+ + (this.comma ? "," : "")
+ + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
+ + (this.trim ? "~" : "")
+ + this.type;
+};
- out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {
- switch (x[i]) {
+// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
+function formatTrim(s) {
+ out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
+ switch (s[i]) {
case ".": i0 = i1 = i; break;
case "0": if (i0 === 0) i0 = i; i1 = i; break;
- case "e": break out;
- default: if (i0 > 0) i0 = 0; break;
+ default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break;
}
}
-
- return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
-};
+ return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
+}
var prefixExponent;
-var formatPrefixAuto = function(x, p) {
+function formatPrefixAuto(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
: i > n ? coefficient + new Array(i - n + 1).join("0")
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
: "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!
-};
+}
-var formatRounded = function(x, p) {
+function formatRounded(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
-};
+}
var formatTypes = {
- "": formatDefault,
"%": function(x, p) { return (x * 100).toFixed(p); },
"b": function(x) { return Math.round(x).toString(2); },
"c": function(x) { return x + ""; },
"x": function(x) { return Math.round(x).toString(16); }
};
-// [[fill]align][sign][symbol][0][width][,][.precision][type]
-var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;
-
-function formatSpecifier(specifier) {
- return new FormatSpecifier(specifier);
-}
-
-formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
-
-function FormatSpecifier(specifier) {
- if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
-
- var match,
- fill = match[1] || " ",
- align = match[2] || ">",
- sign = match[3] || "-",
- symbol = match[4] || "",
- zero = !!match[5],
- width = match[6] && +match[6],
- comma = !!match[7],
- precision = match[8] && +match[8].slice(1),
- type = match[9] || "";
-
- // The "n" type is an alias for ",g".
- if (type === "n") comma = true, type = "g";
-
- // Map invalid types to the default format.
- else if (!formatTypes[type]) type = "";
-
- // If zero fill is specified, padding goes after sign and before digits.
- if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
-
- this.fill = fill;
- this.align = align;
- this.sign = sign;
- this.symbol = symbol;
- this.zero = zero;
- this.width = width;
- this.comma = comma;
- this.precision = precision;
- this.type = type;
-}
-
-FormatSpecifier.prototype.toString = function() {
- return this.fill
- + this.align
- + this.sign
- + this.symbol
- + (this.zero ? "0" : "")
- + (this.width == null ? "" : Math.max(1, this.width | 0))
- + (this.comma ? "," : "")
- + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
- + this.type;
-};
-
-var identity$3 = function(x) {
+function identity$3(x) {
return x;
-};
+}
var prefixes = ["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];
-var formatLocale = function(locale) {
+function formatLocale(locale) {
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$3,
currency = locale.currency,
decimal = locale.decimal,
width = specifier.width,
comma = specifier.comma,
precision = specifier.precision,
+ trim = specifier.trim,
type = specifier.type;
+ // The "n" type is an alias for ",g".
+ if (type === "n") comma = true, type = "g";
+
+ // The "" type, and any invalid type, is an alias for ".12~g".
+ else if (!formatTypes[type]) precision == null && (precision = 12), trim = true, type = "g";
+
+ // If zero fill is specified, padding goes after sign and before digits.
+ if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
+
// Compute the prefix and suffix.
// For SI-prefix, the suffix is lazily computed.
var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
// Is this an integer type?
// Can this type generate exponential notation?
var formatType = formatTypes[type],
- maybeSuffix = !type || /[defgprs%]/.test(type);
+ maybeSuffix = /[defgprs%]/.test(type);
// Set the default precision if not specified,
// or clamp the specified precision to the supported range.
// For significant precision, it must be in [1, 21].
// For fixed precision, it must be in [0, 20].
- precision = precision == null ? (type ? 6 : 12)
+ precision = precision == null ? 6
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
: Math.max(0, Math.min(20, precision));
var valueNegative = value < 0;
value = formatType(Math.abs(value), precision);
+ // Trim insignificant zeros.
+ if (trim) value = formatTrim(value);
+
// If a negative value rounds to zero during formatting, treat as positive.
if (valueNegative && +value === 0) valueNegative = false;
// Compute the prefix and suffix.
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
- valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : "");
+ valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
// Break the formatted value into the integer “value” part that can be
// grouped, and fractional or exponential “suffix” part that is not.
format: newFormat,
formatPrefix: formatPrefix
};
-};
+}
var locale;
-
-
defaultLocale({
decimal: ".",
thousands: ",",
return locale;
}
-var precisionFixed = function(step) {
+function precisionFixed(step) {
return Math.max(0, -exponent$1(Math.abs(step)));
-};
+}
-var precisionPrefix = function(step, value) {
+function precisionPrefix(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step)));
-};
+}
-var precisionRound = function(step, max) {
+function precisionRound(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent$1(max) - exponent$1(step)) + 1;
-};
+}
// Adds floating point numbers with twice the normal precision.
// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and
// Code adapted from GeographicLib by Charles F. F. Karney,
// http://geographiclib.sourceforge.net/
-var adder = function() {
+function adder() {
return new Adder;
-};
+}
function Adder() {
this.reset();
var cos$1 = Math.cos;
var ceil = Math.ceil;
var exp = Math.exp;
-
var log = Math.log;
var pow = Math.pow;
var sin$1 = Math.sin;
return (x = sin$1(x / 2)) * x;
}
-function noop$1() {}
+function noop$2() {}
function streamGeometry(geometry, stream) {
if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
stream.polygonEnd();
}
-var geoStream = function(object, stream) {
+function geoStream(object, stream) {
if (object && streamObjectType.hasOwnProperty(object.type)) {
streamObjectType[object.type](object, stream);
} else {
streamGeometry(object, stream);
}
-};
+}
var areaRingSum = adder();
-var areaSum = adder();
-var lambda00;
-var phi00;
-var lambda0;
-var cosPhi0;
-var sinPhi0;
+var areaSum = adder(),
+ lambda00,
+ phi00,
+ lambda0,
+ cosPhi0,
+ sinPhi0;
var areaStream = {
- point: noop$1,
- lineStart: noop$1,
- lineEnd: noop$1,
+ point: noop$2,
+ lineStart: noop$2,
+ lineEnd: noop$2,
polygonStart: function() {
areaRingSum.reset();
areaStream.lineStart = areaRingStart;
polygonEnd: function() {
var areaRing = +areaRingSum;
areaSum.add(areaRing < 0 ? tau$3 + areaRing : areaRing);
- this.lineStart = this.lineEnd = this.point = noop$1;
+ this.lineStart = this.lineEnd = this.point = noop$2;
},
sphere: function() {
areaSum.add(tau$3);
lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
}
-var area = function(object) {
+function area$1(object) {
areaSum.reset();
geoStream(object, areaStream);
return areaSum * 2;
-};
+}
function spherical(cartesian) {
return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];
d[0] /= l, d[1] /= l, d[2] /= l;
}
-var lambda0$1;
-var phi0;
-var lambda1;
-var phi1;
-var lambda2;
-var lambda00$1;
-var phi00$1;
-var p0;
-var deltaSum = adder();
-var ranges;
-var range;
+var lambda0$1, phi0, lambda1, phi1, // bounds
+ lambda2, // previous lambda-coordinate
+ lambda00$1, phi00$1, // first point
+ p0, // previous 3D point
+ deltaSum = adder(),
+ ranges,
+ range;
var boundsStream = {
point: boundsPoint,
return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
}
-var bounds = function(feature) {
+function bounds(feature) {
var i, n, a, b, merged, deltaMax, delta;
phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);
return lambda0$1 === Infinity || phi0 === Infinity
? [[NaN, NaN], [NaN, NaN]]
: [[lambda0$1, phi0], [lambda1, phi1]];
-};
+}
-var W0;
-var W1;
-var X0;
-var Y0;
-var Z0;
-var X1;
-var Y1;
-var Z1;
-var X2;
-var Y2;
-var Z2;
-var lambda00$2;
-var phi00$2;
-var x0;
-var y0;
-var z0; // previous point
+var W0, W1,
+ X0, Y0, Z0,
+ X1, Y1, Z1,
+ X2, Y2, Z2,
+ lambda00$2, phi00$2, // first point
+ x0, y0, z0; // previous point
var centroidStream = {
- sphere: noop$1,
+ sphere: noop$2,
point: centroidPoint,
lineStart: centroidLineStart,
lineEnd: centroidLineEnd,
centroidPointCartesian(x0, y0, z0);
}
-var centroid = function(object) {
+function centroid(object) {
W0 = W1 =
X0 = Y0 = Z0 =
X1 = Y1 = Z1 =
}
return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1];
-};
+}
-var constant$7 = function(x) {
+function constant$8(x) {
return function() {
return x;
};
-};
+}
-var compose = function(a, b) {
+function compose(a, b) {
function compose(x, y) {
return x = a(x, y), b(x[0], x[1]);
};
return compose;
-};
+}
function rotationIdentity(lambda, phi) {
return [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];
return rotation;
}
-var rotation = function(rotate) {
+function rotation(rotate) {
rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
function forward(coordinates) {
};
return forward;
-};
+}
// Generates a circle centered at [0°, 0°], with a given radius and precision.
function circleStream(stream, radius, delta, direction, t0, t1) {
return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3;
}
-var circle = function() {
- var center = constant$7([0, 0]),
- radius = constant$7(90),
- precision = constant$7(6),
+function circle() {
+ var center = constant$8([0, 0]),
+ radius = constant$8(90),
+ precision = constant$8(6),
ring,
rotate,
stream = {point: point};
}
circle.center = function(_) {
- return arguments.length ? (center = typeof _ === "function" ? _ : constant$7([+_[0], +_[1]]), circle) : center;
+ return arguments.length ? (center = typeof _ === "function" ? _ : constant$8([+_[0], +_[1]]), circle) : center;
};
circle.radius = function(_) {
- return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), circle) : radius;
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$8(+_), circle) : radius;
};
circle.precision = function(_) {
- return arguments.length ? (precision = typeof _ === "function" ? _ : constant$7(+_), circle) : precision;
+ return arguments.length ? (precision = typeof _ === "function" ? _ : constant$8(+_), circle) : precision;
};
return circle;
-};
+}
-var clipBuffer = function() {
+function clipBuffer() {
var lines = [],
line;
return {
lineStart: function() {
lines.push(line = []);
},
- lineEnd: noop$1,
+ lineEnd: noop$2,
rejoin: function() {
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
},
return result;
}
};
-};
+}
-var pointEqual = function(a, b) {
+function pointEqual(a, b) {
return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2;
-};
+}
function Intersection(point, points, other, entry) {
this.x = point;
// A generalized polygon clipping algorithm: given a polygon that has been cut
// into its visible line segments, and rejoins the segments by interpolating
// along the clip edge.
-var clipRejoin = function(segments, compareIntersection, startInside, interpolate, stream) {
+function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {
var subject = [],
clip = [],
i,
} while (!current.v);
stream.lineEnd();
}
-};
+}
function link$1(array) {
if (!(n = array.length)) return;
var sum$1 = adder();
-var polygonContains = function(polygon, point) {
+function polygonContains(polygon, point) {
var lambda = point[0],
phi = point[1],
+ sinPhi = sin$1(phi),
normal = [sin$1(lambda), -cos$1(lambda), 0],
angle = 0,
winding = 0;
sum$1.reset();
+ if (sinPhi === 1) phi = halfPi$2 + epsilon$2;
+ else if (sinPhi === -1) phi = -halfPi$2 - epsilon$2;
+
for (var i = 0, n = polygon.length; i < n; ++i) {
if (!(m = (ring = polygon[i]).length)) continue;
var ring,
// same side as the South pole.
return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1);
-};
+}
-var clip = function(pointVisible, clipLine, interpolate, start) {
+function clip(pointVisible, clipLine, interpolate, start) {
return function(sink) {
var line = clipLine(sink),
ringBuffer = clipBuffer(),
return clip;
};
-};
+}
function validSegment(segment) {
return segment.length > 1;
}
}
-var clipCircle = function(radius) {
+function clipCircle(radius) {
var cr = cos$1(radius),
delta = 6 * radians,
smallRadius = cr > 0,
}
return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);
-};
+}
-var clipLine = function(a, b, x0, y0, x1, y1) {
+function clipLine(a, b, x0, y0, x1, y1) {
var ax = a[0],
ay = a[1],
bx = b[0],
if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
return true;
-};
+}
-var clipMax = 1e9;
-var clipMin = -clipMax;
+var clipMax = 1e9, clipMin = -clipMax;
// TODO Use d3-polygon’s polygonContains here for the ring check?
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
};
}
-var extent$1 = function() {
+function extent$1() {
var x0 = 0,
y0 = 0,
x1 = 960,
return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];
}
};
-};
+}
-var lengthSum = adder();
-var lambda0$2;
-var sinPhi0$1;
-var cosPhi0$1;
+var lengthSum = adder(),
+ lambda0$2,
+ sinPhi0$1,
+ cosPhi0$1;
var lengthStream = {
- sphere: noop$1,
- point: noop$1,
+ sphere: noop$2,
+ point: noop$2,
lineStart: lengthLineStart,
- lineEnd: noop$1,
- polygonStart: noop$1,
- polygonEnd: noop$1
+ lineEnd: noop$2,
+ polygonStart: noop$2,
+ polygonEnd: noop$2
};
function lengthLineStart() {
}
function lengthLineEnd() {
- lengthStream.point = lengthStream.lineEnd = noop$1;
+ lengthStream.point = lengthStream.lineEnd = noop$2;
}
function lengthPointFirst(lambda, phi) {
lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi;
}
-var length$1 = function(object) {
+function length$1(object) {
lengthSum.reset();
geoStream(object, lengthStream);
return +lengthSum;
-};
+}
-var coordinates = [null, null];
-var object$1 = {type: "LineString", coordinates: coordinates};
+var coordinates = [null, null],
+ object$1 = {type: "LineString", coordinates: coordinates};
-var distance = function(a, b) {
+function distance(a, b) {
coordinates[0] = a;
coordinates[1] = b;
return length$1(object$1);
-};
+}
var containsObjectType = {
Feature: function(object, point) {
return [point[0] * radians, point[1] * radians];
}
-var contains = function(object, point) {
+function contains$1(object, point) {
return (object && containsObjectType.hasOwnProperty(object.type)
? containsObjectType[object.type]
: containsGeometry)(object, point);
-};
+}
function graticuleX(y0, y1, dy) {
var y = sequence(y0, y1 - epsilon$2, dy).concat(y1);
return graticule()();
}
-var interpolate$1 = function(a, b) {
+function interpolate$1(a, b) {
var x0 = a[0] * radians,
y0 = a[1] * radians,
x1 = b[0] * radians,
interpolate.distance = d;
return interpolate;
-};
+}
-var identity$4 = function(x) {
+function identity$4(x) {
return x;
-};
+}
-var areaSum$1 = adder();
-var areaRingSum$1 = adder();
-var x00;
-var y00;
-var x0$1;
-var y0$1;
+var areaSum$1 = adder(),
+ areaRingSum$1 = adder(),
+ x00,
+ y00,
+ x0$1,
+ y0$1;
var areaStream$1 = {
- point: noop$1,
- lineStart: noop$1,
- lineEnd: noop$1,
+ point: noop$2,
+ lineStart: noop$2,
+ lineEnd: noop$2,
polygonStart: function() {
areaStream$1.lineStart = areaRingStart$1;
areaStream$1.lineEnd = areaRingEnd$1;
},
polygonEnd: function() {
- areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$1;
+ areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$2;
areaSum$1.add(abs(areaRingSum$1));
areaRingSum$1.reset();
},
areaPoint$1(x00, y00);
}
-var x0$2 = Infinity;
-var y0$2 = x0$2;
-var x1 = -x0$2;
-var y1 = x1;
+var x0$2 = Infinity,
+ y0$2 = x0$2,
+ x1 = -x0$2,
+ y1 = x1;
var boundsStream$1 = {
point: boundsPoint$1,
- lineStart: noop$1,
- lineEnd: noop$1,
- polygonStart: noop$1,
- polygonEnd: noop$1,
+ lineStart: noop$2,
+ lineEnd: noop$2,
+ polygonStart: noop$2,
+ polygonEnd: noop$2,
result: function() {
var bounds = [[x0$2, y0$2], [x1, y1]];
x1 = y1 = -(y0$2 = x0$2 = Infinity);
// TODO Enforce positive area for exterior, negative area for interior?
-var X0$1 = 0;
-var Y0$1 = 0;
-var Z0$1 = 0;
-var X1$1 = 0;
-var Y1$1 = 0;
-var Z1$1 = 0;
-var X2$1 = 0;
-var Y2$1 = 0;
-var Z2$1 = 0;
-var x00$1;
-var y00$1;
-var x0$3;
-var y0$3;
+var X0$1 = 0,
+ Y0$1 = 0,
+ Z0$1 = 0,
+ X1$1 = 0,
+ Y1$1 = 0,
+ Z1$1 = 0,
+ X2$1 = 0,
+ Y2$1 = 0,
+ Z2$1 = 0,
+ x00$1,
+ y00$1,
+ x0$3,
+ y0$3;
var centroidStream$1 = {
point: centroidPoint$1,
}
}
},
- result: noop$1
+ result: noop$2
};
-var lengthSum$1 = adder();
-var lengthRing;
-var x00$2;
-var y00$2;
-var x0$4;
-var y0$4;
+var lengthSum$1 = adder(),
+ lengthRing,
+ x00$2,
+ y00$2,
+ x0$4,
+ y0$4;
var lengthStream$1 = {
- point: noop$1,
+ point: noop$2,
lineStart: function() {
lengthStream$1.point = lengthPointFirst$1;
},
lineEnd: function() {
if (lengthRing) lengthPoint$1(x00$2, y00$2);
- lengthStream$1.point = noop$1;
+ lengthStream$1.point = noop$2;
},
polygonStart: function() {
lengthRing = true;
+ "z";
}
-var index$1 = function(projection, context) {
+function index$1(projection, context) {
var pointRadius = 4.5,
projectionStream,
contextStream;
};
return path.projection(projection).context(context);
-};
+}
-var transform = function(methods) {
+function transform(methods) {
return {
stream: transformer(methods)
};
-};
+}
function transformer(methods) {
return function(stream) {
}, object);
}
-var maxDepth = 16;
-var cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance)
+var maxDepth = 16, // maximum depth of subdivision
+ cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance)
-var resample = function(project, delta2) {
+function resample(project, delta2) {
return +delta2 ? resample$1(project, delta2) : resampleNone(project);
-};
+}
function resampleNone(project) {
return transformer({
});
}
+function scaleTranslate(k, dx, dy) {
+ function transform$$1(x, y) {
+ return [dx + k * x, dy - k * y];
+ }
+ transform$$1.invert = function(x, y) {
+ return [(x - dx) / k, (dy - y) / k];
+ };
+ return transform$$1;
+}
+
+function scaleTranslateRotate(k, dx, dy, alpha) {
+ var cosAlpha = cos$1(alpha),
+ sinAlpha = sin$1(alpha),
+ a = cosAlpha * k,
+ b = sinAlpha * k,
+ ai = cosAlpha / k,
+ bi = sinAlpha / k,
+ ci = (sinAlpha * dy - cosAlpha * dx) / k,
+ fi = (sinAlpha * dx + cosAlpha * dy) / k;
+ function transform$$1(x, y) {
+ return [a * x - b * y + dx, dy - b * x - a * y];
+ }
+ transform$$1.invert = function(x, y) {
+ return [ai * x - bi * y + ci, fi - bi * x - ai * y];
+ };
+ return transform$$1;
+}
+
function projection(project) {
return projectionMutator(function() { return project; })();
}
var project,
k = 150, // scale
x = 480, y = 250, // translate
- dx, dy, lambda = 0, phi = 0, // center
- deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, projectRotate, // rotate
- theta = null, preclip = clipAntimeridian, // clip angle
- x0 = null, y0, x1, y1, postclip = identity$4, // clip extent
- delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision
+ lambda = 0, phi = 0, // center
+ deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, // pre-rotate
+ alpha = 0, // post-rotate
+ theta = null, preclip = clipAntimeridian, // pre-clip angle
+ x0 = null, y0, x1, y1, postclip = identity$4, // post-clip extent
+ delta2 = 0.5, // precision
+ projectResample,
+ projectTransform,
+ projectRotateTransform,
cache,
cacheStream;
function projection(point) {
- point = projectRotate(point[0] * radians, point[1] * radians);
- return [point[0] * k + dx, dy - point[1] * k];
+ return projectRotateTransform(point[0] * radians, point[1] * radians);
}
function invert(point) {
- point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k);
+ point = projectRotateTransform.invert(point[0], point[1]);
return point && [point[0] * degrees$1, point[1] * degrees$1];
}
- function projectTransform(x, y) {
- return x = project(x, y), [x[0] * k + dx, dy - x[1] * k];
- }
-
projection.stream = function(stream) {
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
};
return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1];
};
+ projection.angle = function(_) {
+ return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees$1;
+ };
+
projection.precision = function(_) {
return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
};
};
function recenter() {
- projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project);
- var center = project(lambda, phi);
- dx = x - center[0] * k;
- dy = y + center[1] * k;
+ var center = scaleTranslateRotate(k, 0, 0, alpha).apply(null, project(lambda, phi)),
+ transform$$1 = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], alpha);
+ rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
+ projectTransform = compose(project, transform$$1);
+ projectRotateTransform = compose(rotate, projectTransform);
+ projectResample = resample(projectTransform, delta2);
return reset();
}
return project;
}
-var conicEqualArea = function() {
+function conicEqualArea() {
return conicProjection(conicEqualAreaRaw)
.scale(155.424)
.center([0, 33.6442]);
-};
+}
-var albers = function() {
+function albers() {
return conicEqualArea()
.parallels([29.5, 45.5])
.scale(1070)
.translate([480, 250])
.rotate([96, 0])
.center([-0.6, 38.7]);
-};
+}
// The projections must have mutually exclusive clip regions on the sphere,
// as this will avoid emitting interleaving lines and polygons.
// scale to 1285 and adjust the translate accordingly. The set of standard
// parallels for each region comes from USGS, which is published here:
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
-var albersUsa = function() {
+function albersUsa() {
var cache,
cacheStream,
lower48 = albers(), lower48Point,
function albersUsa(coordinates) {
var x = coordinates[0], y = coordinates[1];
- return point = null, (lower48Point.point(x, y), point)
+ return point = null,
+ (lower48Point.point(x, y), point)
|| (alaskaPoint.point(x, y), point)
|| (hawaiiPoint.point(x, y), point);
}
}
return albersUsa.scale(1070);
-};
+}
function azimuthalRaw(scale) {
return function(x, y) {
return 2 * asin(z / 2);
});
-var azimuthalEqualArea = function() {
+function azimuthalEqualArea() {
return projection(azimuthalEqualAreaRaw)
.scale(124.75)
.clipAngle(180 - 1e-3);
-};
+}
var azimuthalEquidistantRaw = azimuthalRaw(function(c) {
return (c = acos(c)) && c / sin$1(c);
return z;
});
-var azimuthalEquidistant = function() {
+function azimuthalEquidistant() {
return projection(azimuthalEquidistantRaw)
.scale(79.4188)
.clipAngle(180 - 1e-3);
-};
+}
function mercatorRaw(lambda, phi) {
return [lambda, log(tan((halfPi$2 + phi) / 2))];
return [x, 2 * atan(exp(y)) - halfPi$2];
};
-var mercator = function() {
+function mercator() {
return mercatorProjection(mercatorRaw)
.scale(961 / tau$3);
-};
+}
function mercatorProjection(project) {
var m = projection(project),
};
m.clipExtent = function(_) {
- return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];
+ return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];
};
function reclip() {
return project;
}
-var conicConformal = function() {
+function conicConformal() {
return conicProjection(conicConformalRaw)
.scale(109.5)
.parallels([30, 30]);
-};
+}
function equirectangularRaw(lambda, phi) {
return [lambda, phi];
equirectangularRaw.invert = equirectangularRaw;
-var equirectangular = function() {
+function equirectangular() {
return projection(equirectangularRaw)
.scale(152.63);
-};
+}
function conicEquidistantRaw(y0, y1) {
var cy0 = cos$1(y0),
return project;
}
-var conicEquidistant = function() {
+function conicEquidistant() {
return conicProjection(conicEquidistantRaw)
.scale(131.154)
.center([0, 13.9389]);
+}
+
+var A1 = 1.340264,
+ A2 = -0.081106,
+ A3 = 0.000893,
+ A4 = 0.003796,
+ M = sqrt(3) / 2,
+ iterations = 12;
+
+function equalEarthRaw(lambda, phi) {
+ var l = asin(M * sin$1(phi)), l2 = l * l, l6 = l2 * l2 * l2;
+ return [
+ lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))),
+ l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))
+ ];
+}
+
+equalEarthRaw.invert = function(x, y) {
+ var l = y, l2 = l * l, l6 = l2 * l2 * l2;
+ for (var i = 0, delta, fy, fpy; i < iterations; ++i) {
+ fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;
+ fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);
+ l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;
+ if (abs(delta) < epsilon2$1) break;
+ }
+ return [
+ M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l),
+ asin(sin$1(l) / M)
+ ];
};
+function equalEarth() {
+ return projection(equalEarthRaw)
+ .scale(177.158);
+}
+
function gnomonicRaw(x, y) {
var cy = cos$1(y), k = cos$1(x) * cy;
return [cy * sin$1(x) / k, sin$1(y) / k];
gnomonicRaw.invert = azimuthalInvert(atan);
-var gnomonic = function() {
+function gnomonic() {
return projection(gnomonicRaw)
.scale(144.049)
.clipAngle(60);
-};
+}
-function scaleTranslate(kx, ky, tx, ty) {
+function scaleTranslate$1(kx, ky, tx, ty) {
return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? identity$4 : transformer({
point: function(x, y) {
this.stream.point(x * kx + tx, y * ky + ty);
});
}
-var identity$5 = function() {
+function identity$5() {
var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform$$1 = identity$4, // scale, translate and reflect
x0 = null, y0, x1, y1, // clip extent
postclip = identity$4,
return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
},
scale: function(_) {
- return arguments.length ? (transform$$1 = scaleTranslate((k = +_) * sx, k * sy, tx, ty), reset()) : k;
+ return arguments.length ? (transform$$1 = scaleTranslate$1((k = +_) * sx, k * sy, tx, ty), reset()) : k;
},
translate: function(_) {
- return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty];
+ return arguments.length ? (transform$$1 = scaleTranslate$1(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty];
},
reflectX: function(_) {
- return arguments.length ? (transform$$1 = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0;
+ return arguments.length ? (transform$$1 = scaleTranslate$1(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0;
},
reflectY: function(_) {
- return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0;
+ return arguments.length ? (transform$$1 = scaleTranslate$1(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0;
},
fitExtent: function(extent, object) {
return fitExtent(projection, extent, object);
return fitHeight(projection, height, object);
}
};
-};
+}
function naturalEarth1Raw(lambda, phi) {
var phi2 = phi * phi, phi4 = phi2 * phi2;
];
};
-var naturalEarth1 = function() {
+function naturalEarth1() {
return projection(naturalEarth1Raw)
.scale(175.295);
-};
+}
function orthographicRaw(x, y) {
return [cos$1(y) * sin$1(x), sin$1(y)];
orthographicRaw.invert = azimuthalInvert(asin);
-var orthographic = function() {
+function orthographic() {
return projection(orthographicRaw)
.scale(249.5)
.clipAngle(90 + epsilon$2);
-};
+}
function stereographicRaw(x, y) {
var cy = cos$1(y), k = 1 + cos$1(x) * cy;
return 2 * atan(z);
});
-var stereographic = function() {
+function stereographic() {
return projection(stereographicRaw)
.scale(250)
.clipAngle(142);
-};
+}
function transverseMercatorRaw(lambda, phi) {
return [log(tan((halfPi$2 + phi) / 2)), -lambda];
return [-y, 2 * atan(exp(x)) - halfPi$2];
};
-var transverseMercator = function() {
+function transverseMercator() {
var m = mercatorProjection(transverseMercatorRaw),
center = m.center,
rotate = m.rotate;
return rotate([0, 0, 90])
.scale(159.155);
-};
+}
function defaultSeparation(a, b) {
return a.parent === b.parent ? 1 : 2;
return node;
}
-var cluster = function() {
+function cluster() {
var separation = defaultSeparation,
dx = 1,
dy = 1,
};
return cluster;
-};
+}
function count(node) {
var sum = 0,
node.value = sum;
}
-var node_count = function() {
+function node_count() {
return this.eachAfter(count);
-};
+}
-var node_each = function(callback) {
+function node_each(callback) {
var node = this, current, next = [node], children, i, n;
do {
current = next.reverse(), next = [];
}
} while (next.length);
return this;
-};
+}
-var node_eachBefore = function(callback) {
+function node_eachBefore(callback) {
var node = this, nodes = [node], children, i;
while (node = nodes.pop()) {
callback(node), children = node.children;
}
}
return this;
-};
+}
-var node_eachAfter = function(callback) {
+function node_eachAfter(callback) {
var node = this, nodes = [node], next = [], children, i, n;
while (node = nodes.pop()) {
next.push(node), children = node.children;
callback(node);
}
return this;
-};
+}
-var node_sum = function(value) {
+function node_sum(value) {
return this.eachAfter(function(node) {
var sum = +value(node.data) || 0,
children = node.children,
while (--i >= 0) sum += children[i].value;
node.value = sum;
});
-};
+}
-var node_sort = function(compare) {
+function node_sort(compare) {
return this.eachBefore(function(node) {
if (node.children) {
node.children.sort(compare);
}
});
-};
+}
-var node_path = function(end) {
+function node_path(end) {
var start = this,
ancestor = leastCommonAncestor(start, end),
nodes = [start];
end = end.parent;
}
return nodes;
-};
+}
function leastCommonAncestor(a, b) {
if (a === b) return a;
return c;
}
-var node_ancestors = function() {
+function node_ancestors() {
var node = this, nodes = [node];
while (node = node.parent) {
nodes.push(node);
}
return nodes;
-};
+}
-var node_descendants = function() {
+function node_descendants() {
var nodes = [];
this.each(function(node) {
nodes.push(node);
});
return nodes;
-};
+}
-var node_leaves = function() {
+function node_leaves() {
var leaves = [];
this.eachBefore(function(node) {
if (!node.children) {
}
});
return leaves;
-};
+}
-var node_links = function() {
+function node_links() {
var root = this, links = [];
root.each(function(node) {
if (node !== root) { // Don’t include the root’s parent, if any.
}
});
return links;
-};
+}
function hierarchy(data, children) {
var root = new Node(data),
copy: node_copy
};
-var slice$3 = Array.prototype.slice;
+var slice$4 = Array.prototype.slice;
function shuffle$1(array) {
var m = array.length,
return array;
}
-var enclose = function(circles) {
- var i = 0, n = (circles = shuffle$1(slice$3.call(circles))).length, B = [], p, e;
+function enclose(circles) {
+ var i = 0, n = (circles = shuffle$1(slice$4.call(circles))).length, B = [], p, e;
while (i < n) {
p = circles[i];
}
return e;
-};
+}
function extendBasis(B, p) {
var i, j;
};
}
-function place(a, b, c) {
- var ax = a.x,
- ay = a.y,
- da = b.r + c.r,
- db = a.r + c.r,
- dx = b.x - ax,
- dy = b.y - ay,
- dc = dx * dx + dy * dy;
- if (dc) {
- var x = 0.5 + ((db *= db) - (da *= da)) / (2 * dc),
- y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
- c.x = ax + x * dx + y * dy;
- c.y = ay + x * dy - y * dx;
+function place(b, a, c) {
+ var dx = b.x - a.x, x, a2,
+ dy = b.y - a.y, y, b2,
+ d2 = dx * dx + dy * dy;
+ if (d2) {
+ a2 = a.r + c.r, a2 *= a2;
+ b2 = b.r + c.r, b2 *= b2;
+ if (a2 > b2) {
+ x = (d2 + b2 - a2) / (2 * d2);
+ y = Math.sqrt(Math.max(0, b2 / d2 - x * x));
+ c.x = b.x - x * dx - y * dy;
+ c.y = b.y - x * dy + y * dx;
+ } else {
+ x = (d2 + a2 - b2) / (2 * d2);
+ y = Math.sqrt(Math.max(0, a2 / d2 - x * x));
+ c.x = a.x + x * dx - y * dy;
+ c.y = a.y + x * dy + y * dx;
+ }
} else {
- c.x = ax + db;
- c.y = ay;
+ c.x = a.x + c.r;
+ c.y = a.y;
}
}
function intersects(a, b) {
- var dx = b.x - a.x,
- dy = b.y - a.y,
- dr = a.r + b.r;
- return dr * dr - 1e-6 > dx * dx + dy * dy;
+ var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;
+ return dr > 0 && dr * dr > dx * dx + dy * dy;
}
function score(node) {
return c.r;
}
-var siblings = function(circles) {
+function siblings(circles) {
packEnclose(circles);
return circles;
-};
+}
function optional(f) {
return f == null ? null : required(f);
return 0;
}
-var constant$8 = function(x) {
+function constant$9(x) {
return function() {
return x;
};
-};
+}
function defaultRadius$1(d) {
return Math.sqrt(d.value);
}
-var index$2 = function() {
+function index$2() {
var radius = null,
dx = 1,
dy = 1,
};
pack.padding = function(x) {
- return arguments.length ? (padding = typeof x === "function" ? x : constant$8(+x), pack) : padding;
+ return arguments.length ? (padding = typeof x === "function" ? x : constant$9(+x), pack) : padding;
};
return pack;
-};
+}
function radiusLeaf(radius) {
return function(node) {
};
}
-var roundNode = function(node) {
+function roundNode(node) {
node.x0 = Math.round(node.x0);
node.y0 = Math.round(node.y0);
node.x1 = Math.round(node.x1);
node.y1 = Math.round(node.y1);
-};
+}
-var treemapDice = function(parent, x0, y0, x1, y1) {
+function treemapDice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
node = nodes[i], node.y0 = y0, node.y1 = y1;
node.x0 = x0, node.x1 = x0 += node.value * k;
}
-};
+}
-var partition = function() {
+function partition() {
var dx = 1,
dy = 1,
padding = 0,
};
return partition;
-};
+}
-var keyPrefix$1 = "$";
-var preroot = {depth: -1};
-var ambiguous = {};
+var keyPrefix$1 = "$", // Protect against keys like “__proto__”.
+ preroot = {depth: -1},
+ ambiguous = {};
function defaultId(d) {
return d.id;
return d.parentId;
}
-var stratify = function() {
+function stratify() {
var id = defaultId,
parentId = defaultParentId;
};
return stratify;
-};
+}
function defaultSeparation$1(a, b) {
return a.parent === b.parent ? 1 : 2;
}
// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
-var tree = function() {
+function tree() {
var separation = defaultSeparation$1,
dx = 1,
dy = 1,
};
return tree;
-};
+}
-var treemapSlice = function(parent, x0, y0, x1, y1) {
+function treemapSlice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
node = nodes[i], node.x0 = x0, node.x1 = x1;
node.y0 = y0, node.y1 = y0 += node.value * k;
}
-};
+}
var phi = (1 + Math.sqrt(5)) / 2;
return squarify;
})(phi);
-var index$3 = function() {
+function index$3() {
var tile = squarify,
round = false,
dx = 1,
};
treemap.paddingInner = function(x) {
- return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$8(+x), treemap) : paddingInner;
+ return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$9(+x), treemap) : paddingInner;
};
treemap.paddingOuter = function(x) {
};
treemap.paddingTop = function(x) {
- return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$8(+x), treemap) : paddingTop;
+ return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$9(+x), treemap) : paddingTop;
};
treemap.paddingRight = function(x) {
- return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$8(+x), treemap) : paddingRight;
+ return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$9(+x), treemap) : paddingRight;
};
treemap.paddingBottom = function(x) {
- return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$8(+x), treemap) : paddingBottom;
+ return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$9(+x), treemap) : paddingBottom;
};
treemap.paddingLeft = function(x) {
- return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$8(+x), treemap) : paddingLeft;
+ return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$9(+x), treemap) : paddingLeft;
};
return treemap;
-};
+}
-var binary = function(parent, x0, y0, x1, y1) {
+function binary(parent, x0, y0, x1, y1) {
var nodes = parent.children,
i, n = nodes.length,
sum, sums = new Array(n + 1);
partition(k, j, valueRight, x0, yk, x1, y1);
}
}
-};
+}
-var sliceDice = function(parent, x0, y0, x1, y1) {
+function sliceDice(parent, x0, y0, x1, y1) {
(parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);
-};
+}
var resquarify = (function custom(ratio) {
return resquarify;
})(phi);
-var area$1 = function(polygon) {
+function area$2(polygon) {
var i = -1,
n = polygon.length,
a,
}
return area / 2;
-};
+}
-var centroid$1 = function(polygon) {
+function centroid$1(polygon) {
var i = -1,
n = polygon.length,
x = 0,
}
return k *= 3, [x / k, y / k];
-};
+}
// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of
// the 3D cross product in a quadrant I Cartesian coordinate system (+x is
// right, +y is up). Returns a positive value if ABC is counter-clockwise,
// negative if clockwise, and zero if the points are collinear.
-var cross$1 = function(a, b, c) {
+function cross$1(a, b, c) {
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
-};
+}
function lexicographicOrder(a, b) {
return a[0] - b[0] || a[1] - b[1];
return indexes.slice(0, size); // remove popped points
}
-var hull = function(points) {
+function hull(points) {
if ((n = points.length) < 3) return null;
var i,
for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);
return hull;
-};
+}
-var contains$1 = function(polygon, point) {
+function contains$2(polygon, point) {
var n = polygon.length,
p = polygon[n - 1],
x = point[0], y = point[1],
}
return inside;
-};
+}
-var length$2 = function(polygon) {
+function length$2(polygon) {
var i = -1,
n = polygon.length,
b = polygon[n - 1],
ya = yb;
b = polygon[i];
xb = b[0];
- yb = b[1];
- xa -= xb;
- ya -= yb;
- perimeter += Math.sqrt(xa * xa + ya * ya);
- }
-
- return perimeter;
-};
-
-var slice$4 = [].slice;
-
-var noabort = {};
-
-function Queue(size) {
- this._size = size;
- this._call =
- this._error = null;
- this._tasks = [];
- this._data = [];
- this._waiting =
- this._active =
- this._ended =
- this._start = 0; // inside a synchronous task callback?
-}
-
-Queue.prototype = queue.prototype = {
- constructor: Queue,
- defer: function(callback) {
- if (typeof callback !== "function") throw new Error("invalid callback");
- if (this._call) throw new Error("defer after await");
- if (this._error != null) return this;
- var t = slice$4.call(arguments, 1);
- t.push(callback);
- ++this._waiting, this._tasks.push(t);
- poke$1(this);
- return this;
- },
- abort: function() {
- if (this._error == null) abort(this, new Error("abort"));
- return this;
- },
- await: function(callback) {
- if (typeof callback !== "function") throw new Error("invalid callback");
- if (this._call) throw new Error("multiple await");
- this._call = function(error, results) { callback.apply(null, [error].concat(results)); };
- maybeNotify(this);
- return this;
- },
- awaitAll: function(callback) {
- if (typeof callback !== "function") throw new Error("invalid callback");
- if (this._call) throw new Error("multiple await");
- this._call = callback;
- maybeNotify(this);
- return this;
- }
-};
-
-function poke$1(q) {
- if (!q._start) {
- try { start$1(q); } // let the current task complete
- catch (e) {
- if (q._tasks[q._ended + q._active - 1]) abort(q, e); // task errored synchronously
- else if (!q._data) throw e; // await callback errored synchronously
- }
- }
-}
-
-function start$1(q) {
- while (q._start = q._waiting && q._active < q._size) {
- var i = q._ended + q._active,
- t = q._tasks[i],
- j = t.length - 1,
- c = t[j];
- t[j] = end(q, i);
- --q._waiting, ++q._active;
- t = c.apply(null, t);
- if (!q._tasks[i]) continue; // task finished synchronously
- q._tasks[i] = t || noabort;
- }
-}
-
-function end(q, i) {
- return function(e, r) {
- if (!q._tasks[i]) return; // ignore multiple callbacks
- --q._active, ++q._ended;
- q._tasks[i] = null;
- if (q._error != null) return; // ignore secondary errors
- if (e != null) {
- abort(q, e);
- } else {
- q._data[i] = r;
- if (q._waiting) poke$1(q);
- else maybeNotify(q);
- }
- };
-}
-
-function abort(q, e) {
- var i = q._tasks.length, t;
- q._error = e; // ignore active callbacks
- q._data = undefined; // allow gc
- q._waiting = NaN; // prevent starting
-
- while (--i >= 0) {
- if (t = q._tasks[i]) {
- q._tasks[i] = null;
- if (t.abort) {
- try { t.abort(); }
- catch (e) { /* ignore */ }
- }
- }
- }
-
- q._active = NaN; // allow notification
- maybeNotify(q);
-}
-
-function maybeNotify(q) {
- if (!q._active && q._call) {
- var d = q._data;
- q._data = undefined; // allow gc
- q._call(q._error, d);
+ yb = b[1];
+ xa -= xb;
+ ya -= yb;
+ perimeter += Math.sqrt(xa * xa + ya * ya);
}
-}
-function queue(concurrency) {
- if (concurrency == null) concurrency = Infinity;
- else if (!((concurrency = +concurrency) >= 1)) throw new Error("invalid concurrency");
- return new Queue(concurrency);
+ return perimeter;
}
-var defaultSource$1 = function() {
+function defaultSource$1() {
return Math.random();
-};
+}
var uniform = (function sourceRandomUniform(source) {
function randomUniform(min, max) {
return randomExponential;
})(defaultSource$1);
-var request = function(url, callback) {
- var request,
- event = dispatch("beforesend", "progress", "load", "error"),
- mimeType,
- headers = map$1(),
- xhr = new XMLHttpRequest,
- user = null,
- password = null,
- response,
- responseType,
- timeout = 0;
-
- // If IE does not support CORS, use XDomainRequest.
- if (typeof XDomainRequest !== "undefined"
- && !("withCredentials" in xhr)
- && /^(http(s)?:)?\/\//.test(url)) xhr = new XDomainRequest;
-
- "onload" in xhr
- ? xhr.onload = xhr.onerror = xhr.ontimeout = respond
- : xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); };
-
- function respond(o) {
- var status = xhr.status, result;
- if (!status && hasResponse(xhr)
- || status >= 200 && status < 300
- || status === 304) {
- if (response) {
- try {
- result = response.call(request, xhr);
- } catch (e) {
- event.call("error", request, e);
- return;
- }
- } else {
- result = xhr;
- }
- event.call("load", request, result);
- } else {
- event.call("error", request, o);
- }
- }
-
- xhr.onprogress = function(e) {
- event.call("progress", request, e);
- };
-
- request = {
- header: function(name, value) {
- name = (name + "").toLowerCase();
- if (arguments.length < 2) return headers.get(name);
- if (value == null) headers.remove(name);
- else headers.set(name, value + "");
- return request;
- },
-
- // If mimeType is non-null and no Accept header is set, a default is used.
- mimeType: function(value) {
- if (!arguments.length) return mimeType;
- mimeType = value == null ? null : value + "";
- return request;
- },
-
- // Specifies what type the response value should take;
- // for instance, arraybuffer, blob, document, or text.
- responseType: function(value) {
- if (!arguments.length) return responseType;
- responseType = value;
- return request;
- },
-
- timeout: function(value) {
- if (!arguments.length) return timeout;
- timeout = +value;
- return request;
- },
-
- user: function(value) {
- return arguments.length < 1 ? user : (user = value == null ? null : value + "", request);
- },
-
- password: function(value) {
- return arguments.length < 1 ? password : (password = value == null ? null : value + "", request);
- },
-
- // Specify how to convert the response content to a specific type;
- // changes the callback value on "load" events.
- response: function(value) {
- response = value;
- return request;
- },
-
- // Alias for send("GET", …).
- get: function(data, callback) {
- return request.send("GET", data, callback);
- },
-
- // Alias for send("POST", …).
- post: function(data, callback) {
- return request.send("POST", data, callback);
- },
-
- // If callback is non-null, it will be used for error and load events.
- send: function(method, data, callback) {
- xhr.open(method, url, true, user, password);
- if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");
- if (xhr.setRequestHeader) headers.each(function(value, name) { xhr.setRequestHeader(name, value); });
- if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType);
- if (responseType != null) xhr.responseType = responseType;
- if (timeout > 0) xhr.timeout = timeout;
- if (callback == null && typeof data === "function") callback = data, data = null;
- if (callback != null && callback.length === 1) callback = fixCallback(callback);
- if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
- event.call("beforesend", request, xhr);
- xhr.send(data == null ? null : data);
- return request;
- },
-
- abort: function() {
- xhr.abort();
- return request;
- },
-
- on: function() {
- var value = event.on.apply(event, arguments);
- return value === event ? request : value;
- }
- };
-
- if (callback != null) {
- if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
- return request.get(callback);
- }
-
- return request;
-};
-
-function fixCallback(callback) {
- return function(error, xhr) {
- callback(error == null ? xhr : null);
- };
-}
-
-function hasResponse(xhr) {
- var type = xhr.responseType;
- return type && type !== "text"
- ? xhr.response // null on error
- : xhr.responseText; // "" on error
-}
-
-var type$1 = function(defaultMimeType, response) {
- return function(url, callback) {
- var r = request(url).mimeType(defaultMimeType).response(response);
- if (callback != null) {
- if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
- return r.get(callback);
- }
- return r;
- };
-};
-
-var html = type$1("text/html", function(xhr) {
- return document.createRange().createContextualFragment(xhr.responseText);
-});
-
-var json = type$1("application/json", function(xhr) {
- return JSON.parse(xhr.responseText);
-});
-
-var text = type$1("text/plain", function(xhr) {
- return xhr.responseText;
-});
-
-var xml = type$1("application/xml", function(xhr) {
- var xml = xhr.responseXML;
- if (!xml) throw new Error("parse error");
- return xml;
-});
-
-var dsv$1 = function(defaultMimeType, parse) {
- return function(url, row, callback) {
- if (arguments.length < 3) callback = row, row = null;
- var r = request(url).mimeType(defaultMimeType);
- r.row = function(_) { return arguments.length ? r.response(responseOf(parse, row = _)) : row; };
- r.row(row);
- return callback ? r.get(callback) : r;
- };
-};
-
-function responseOf(parse, row) {
- return function(request$$1) {
- return parse(request$$1.responseText, row);
- };
-}
-
-var csv$1 = dsv$1("text/csv", csvParse);
-
-var tsv$1 = dsv$1("text/tab-separated-values", tsvParse);
-
-var array$2 = Array.prototype;
+var array$3 = Array.prototype;
-var map$3 = array$2.map;
-var slice$5 = array$2.slice;
+var map$2 = array$3.map;
+var slice$5 = array$3.slice;
var implicit = {name: "implicit"};
return pointish(band().paddingInner(1));
}
-var constant$9 = function(x) {
+function constant$a(x) {
return function() {
return x;
};
-};
+}
-var number$2 = function(x) {
+function number$2(x) {
return +x;
-};
+}
var unit = [0, 1];
function deinterpolateLinear(a, b) {
return (b -= (a = +a))
? function(x) { return (x - a) / b; }
- : constant$9(b);
+ : constant$a(b);
}
function deinterpolateClamp(deinterpolate) {
range = unit,
interpolate$$1 = interpolateValue,
clamp = false,
- piecewise,
+ piecewise$$1,
output,
input;
function rescale() {
- piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
+ piecewise$$1 = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
output = input = null;
return scale;
}
function scale(x) {
- return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);
+ return (output || (output = piecewise$$1(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);
}
scale.invert = function(y) {
- return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
+ return (input || (input = piecewise$$1(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
};
scale.domain = function(_) {
- return arguments.length ? (domain = map$3.call(_, number$2), rescale()) : domain.slice();
+ return arguments.length ? (domain = map$2.call(_, number$2), rescale()) : domain.slice();
};
scale.range = function(_) {
return rescale();
}
-var tickFormat = function(domain, count, specifier) {
+function tickFormat(domain, count, specifier) {
var start = domain[0],
stop = domain[domain.length - 1],
step = tickStep(start, stop, count == null ? 10 : count),
}
}
return exports.format(specifier);
-};
+}
function linearish(scale) {
var domain = scale.domain;
}
function linear$2() {
- var scale = continuous(deinterpolateLinear, reinterpolate);
+ var scale = continuous(deinterpolateLinear, interpolateNumber);
scale.copy = function() {
return copy(scale, linear$2());
scale.invert = scale;
scale.domain = scale.range = function(_) {
- return arguments.length ? (domain = map$3.call(_, number$2), scale) : domain.slice();
+ return arguments.length ? (domain = map$2.call(_, number$2), scale) : domain.slice();
};
scale.copy = function() {
return linearish(scale);
}
-var nice = function(domain, interval) {
+function nice(domain, interval) {
domain = domain.slice();
var i0 = 0,
domain[i0] = interval.floor(x0);
domain[i1] = interval.ceil(x1);
return domain;
-};
+}
function deinterpolate(a, b) {
return (b = Math.log(b / a))
? function(x) { return Math.log(x / a) / b; }
- : constant$9(b);
+ : constant$a(b);
}
-function reinterpolate$1(a, b) {
+function reinterpolate(a, b) {
return a < 0
? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }
: function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };
}
function log$1() {
- var scale = continuous(deinterpolate, reinterpolate$1).domain([1, 10]),
+ var scale = continuous(deinterpolate, reinterpolate).domain([1, 10]),
domain = scale.domain,
base = 10,
logs = logp(10),
function deinterpolate(a, b) {
return (b = raise$1(b, exponent) - (a = raise$1(a, exponent)))
? function(x) { return (raise$1(x, exponent) - a) / b; }
- : constant$9(b);
+ : constant$a(b);
}
function reinterpolate(a, b) {
return scale;
}
-var t0$1 = new Date;
-var t1$1 = new Date;
+var t0$1 = new Date,
+ t1$1 = new Date;
function newInterval(floori, offseti, count, field) {
return (end - start) / k;
});
};
-
var milliseconds = millisecond.range;
-var durationSecond$1 = 1e3;
-var durationMinute$1 = 6e4;
-var durationHour$1 = 36e5;
-var durationDay$1 = 864e5;
-var durationWeek$1 = 6048e5;
+var durationSecond = 1e3;
+var durationMinute = 6e4;
+var durationHour = 36e5;
+var durationDay = 864e5;
+var durationWeek = 6048e5;
var second = newInterval(function(date) {
- date.setTime(Math.floor(date / durationSecond$1) * durationSecond$1);
+ date.setTime(Math.floor(date / durationSecond) * durationSecond);
}, function(date, step) {
- date.setTime(+date + step * durationSecond$1);
+ date.setTime(+date + step * durationSecond);
}, function(start, end) {
- return (end - start) / durationSecond$1;
+ return (end - start) / durationSecond;
}, function(date) {
return date.getUTCSeconds();
});
-
var seconds = second.range;
var minute = newInterval(function(date) {
- date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1);
+ date.setTime(Math.floor(date / durationMinute) * durationMinute);
}, function(date, step) {
- date.setTime(+date + step * durationMinute$1);
+ date.setTime(+date + step * durationMinute);
}, function(start, end) {
- return (end - start) / durationMinute$1;
+ return (end - start) / durationMinute;
}, function(date) {
return date.getMinutes();
});
-
var minutes = minute.range;
var hour = newInterval(function(date) {
- var offset = date.getTimezoneOffset() * durationMinute$1 % durationHour$1;
- if (offset < 0) offset += durationHour$1;
- date.setTime(Math.floor((+date - offset) / durationHour$1) * durationHour$1 + offset);
+ var offset = date.getTimezoneOffset() * durationMinute % durationHour;
+ if (offset < 0) offset += durationHour;
+ date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset);
}, function(date, step) {
- date.setTime(+date + step * durationHour$1);
+ date.setTime(+date + step * durationHour);
}, function(start, end) {
- return (end - start) / durationHour$1;
+ return (end - start) / durationHour;
}, function(date) {
return date.getHours();
});
-
var hours = hour.range;
var day = newInterval(function(date) {
}, function(date, step) {
date.setDate(date.getDate() + step);
}, function(start, end) {
- return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1;
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;
}, function(date) {
return date.getDate() - 1;
});
-
var days = day.range;
function weekday(i) {
}, function(date, step) {
date.setDate(date.getDate() + step * 7);
}, function(start, end) {
- return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
});
}
}, function(date) {
return date.getMonth();
});
-
var months = month.range;
var year = newInterval(function(date) {
date.setFullYear(date.getFullYear() + step * k);
});
};
-
var years = year.range;
var utcMinute = newInterval(function(date) {
date.setUTCSeconds(0, 0);
}, function(date, step) {
- date.setTime(+date + step * durationMinute$1);
+ date.setTime(+date + step * durationMinute);
}, function(start, end) {
- return (end - start) / durationMinute$1;
+ return (end - start) / durationMinute;
}, function(date) {
return date.getUTCMinutes();
});
-
var utcMinutes = utcMinute.range;
var utcHour = newInterval(function(date) {
date.setUTCMinutes(0, 0, 0);
}, function(date, step) {
- date.setTime(+date + step * durationHour$1);
+ date.setTime(+date + step * durationHour);
}, function(start, end) {
- return (end - start) / durationHour$1;
+ return (end - start) / durationHour;
}, function(date) {
return date.getUTCHours();
});
-
var utcHours = utcHour.range;
var utcDay = newInterval(function(date) {
}, function(date, step) {
date.setUTCDate(date.getUTCDate() + step);
}, function(start, end) {
- return (end - start) / durationDay$1;
+ return (end - start) / durationDay;
}, function(date) {
return date.getUTCDate() - 1;
});
-
var utcDays = utcDay.range;
function utcWeekday(i) {
}, function(date, step) {
date.setUTCDate(date.getUTCDate() + step * 7);
}, function(start, end) {
- return (end - start) / durationWeek$1;
+ return (end - start) / durationWeek;
});
}
}, function(date) {
return date.getUTCMonth();
});
-
var utcMonths = utcMonth.range;
var utcYear = newInterval(function(date) {
date.setUTCFullYear(date.getUTCFullYear() + step * k);
});
};
-
var utcYears = utcYear.range;
function localDate(d) {
};
}
-var pads = {"-": "", "_": " ", "0": "0"};
-var numberRe = /^\s*\d+/;
-var percentRe = /^%/;
-var requoteRe = /[\\^$*+?|[\]().{}]/g;
+var pads = {"-": "", "_": " ", "0": "0"},
+ numberRe = /^\s*\d+/, // note: ignores next directive
+ percentRe = /^%/,
+ requoteRe = /[\\^$*+?|[\]().{}]/g;
function pad(value, fill, width) {
var sign = value < 0 ? "-" : "",
var locale$1;
-
-
-
-
defaultLocale$1({
dateTime: "%x, %X",
date: "%-m/%-d/%Y",
? parseIsoNative
: exports.utcParse(isoSpecifier);
-var durationSecond = 1000;
-var durationMinute = durationSecond * 60;
-var durationHour = durationMinute * 60;
-var durationDay = durationHour * 24;
-var durationWeek = durationDay * 7;
-var durationMonth = durationDay * 30;
-var durationYear = durationDay * 365;
+var durationSecond$1 = 1000,
+ durationMinute$1 = durationSecond$1 * 60,
+ durationHour$1 = durationMinute$1 * 60,
+ durationDay$1 = durationHour$1 * 24,
+ durationWeek$1 = durationDay$1 * 7,
+ durationMonth = durationDay$1 * 30,
+ durationYear = durationDay$1 * 365;
function date$1(t) {
return new Date(t);
}
function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) {
- var scale = continuous(deinterpolateLinear, reinterpolate),
+ var scale = continuous(deinterpolateLinear, interpolateNumber),
invert = scale.invert,
domain = scale.domain;
formatYear = format("%Y");
var tickIntervals = [
- [second$$1, 1, durationSecond],
- [second$$1, 5, 5 * durationSecond],
- [second$$1, 15, 15 * durationSecond],
- [second$$1, 30, 30 * durationSecond],
- [minute$$1, 1, durationMinute],
- [minute$$1, 5, 5 * durationMinute],
- [minute$$1, 15, 15 * durationMinute],
- [minute$$1, 30, 30 * durationMinute],
- [ hour$$1, 1, durationHour ],
- [ hour$$1, 3, 3 * durationHour ],
- [ hour$$1, 6, 6 * durationHour ],
- [ hour$$1, 12, 12 * durationHour ],
- [ day$$1, 1, durationDay ],
- [ day$$1, 2, 2 * durationDay ],
- [ week, 1, durationWeek ],
+ [second$$1, 1, durationSecond$1],
+ [second$$1, 5, 5 * durationSecond$1],
+ [second$$1, 15, 15 * durationSecond$1],
+ [second$$1, 30, 30 * durationSecond$1],
+ [minute$$1, 1, durationMinute$1],
+ [minute$$1, 5, 5 * durationMinute$1],
+ [minute$$1, 15, 15 * durationMinute$1],
+ [minute$$1, 30, 30 * durationMinute$1],
+ [ hour$$1, 1, durationHour$1 ],
+ [ hour$$1, 3, 3 * durationHour$1 ],
+ [ hour$$1, 6, 6 * durationHour$1 ],
+ [ hour$$1, 12, 12 * durationHour$1 ],
+ [ day$$1, 1, durationDay$1 ],
+ [ day$$1, 2, 2 * durationDay$1 ],
+ [ week, 1, durationWeek$1 ],
[ month$$1, 1, durationMonth ],
[ month$$1, 3, 3 * durationMonth ],
[ year$$1, 1, durationYear ]
];
- function tickFormat(date) {
- return (second$$1(date) < date ? formatMillisecond
- : minute$$1(date) < date ? formatSecond
- : hour$$1(date) < date ? formatMinute
- : day$$1(date) < date ? formatHour
- : month$$1(date) < date ? (week(date) < date ? formatDay : formatWeek)
- : year$$1(date) < date ? formatMonth
- : formatYear)(date);
+ function tickFormat(date$$1) {
+ return (second$$1(date$$1) < date$$1 ? formatMillisecond
+ : minute$$1(date$$1) < date$$1 ? formatSecond
+ : hour$$1(date$$1) < date$$1 ? formatMinute
+ : day$$1(date$$1) < date$$1 ? formatHour
+ : month$$1(date$$1) < date$$1 ? (week(date$$1) < date$$1 ? formatDay : formatWeek)
+ : year$$1(date$$1) < date$$1 ? formatMonth
+ : formatYear)(date$$1);
}
function tickInterval(interval, start, stop, step) {
};
scale.domain = function(_) {
- return arguments.length ? domain(map$3.call(_, number$3)) : domain().map(date$1);
+ return arguments.length ? domain(map$2.call(_, number$3)) : domain().map(date$1);
};
scale.ticks = function(interval, step) {
return scale;
}
-var time = function() {
+function time() {
return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
-};
+}
-var utcTime = function() {
+function utcTime() {
return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
-};
-
-var colors = function(s) {
- return s.match(/.{6}/g).map(function(x) {
- return "#" + x;
- });
-};
-
-var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
-
-var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6");
-
-var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9");
-
-var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5");
-
-var cubehelix$3 = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));
-
-var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
-
-var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
+}
-var rainbow = cubehelix();
+function sequential(interpolator) {
+ var x0 = 0,
+ x1 = 1,
+ k10 = 1,
+ clamp = false;
-var rainbow$1 = function(t) {
- if (t < 0 || t > 1) t -= Math.floor(t);
- var ts = Math.abs(t - 0.5);
- rainbow.h = 360 * t - 100;
- rainbow.s = 1.5 - 1.5 * ts;
- rainbow.l = 0.8 - 0.9 * ts;
- return rainbow + "";
-};
+ function scale(x) {
+ var t = (x - x0) * k10;
+ return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
+ }
-function ramp(range) {
- var n = range.length;
- return function(t) {
- return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
+ scale.domain = function(_) {
+ return arguments.length ? (x0 = +_[0], x1 = +_[1], k10 = x0 === x1 ? 0 : 1 / (x1 - x0), scale) : [x0, x1];
};
-}
-var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
+ scale.clamp = function(_) {
+ return arguments.length ? (clamp = !!_, scale) : clamp;
+ };
-var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
+ scale.interpolator = function(_) {
+ return arguments.length ? (interpolator = _, scale) : interpolator;
+ };
-var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
+ scale.copy = function() {
+ return sequential(interpolator).domain([x0, x1]).clamp(clamp);
+ };
-var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
+ return linearish(scale);
+}
-function sequential(interpolator) {
+function diverging(interpolator) {
var x0 = 0,
- x1 = 1,
+ x1 = 0.5,
+ x2 = 1,
+ k10 = 1,
+ k21 = 1,
clamp = false;
function scale(x) {
- var t = (x - x0) / (x1 - x0);
+ var t = 0.5 + ((x = +x) - x1) * (x < x1 ? k10 : k21);
return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
}
scale.domain = function(_) {
- return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];
+ return arguments.length ? (x0 = +_[0], x1 = +_[1], x2 = +_[2], k10 = x0 === x1 ? 0 : 0.5 / (x1 - x0), k21 = x1 === x2 ? 0 : 0.5 / (x2 - x1), scale) : [x0, x1, x2];
};
scale.clamp = function(_) {
};
scale.copy = function() {
- return sequential(interpolator).domain([x0, x1]).clamp(clamp);
+ return diverging(interpolator).domain([x0, x1, x2]).clamp(clamp);
};
return linearish(scale);
}
-var constant$10 = function(x) {
+function colors(specifier) {
+ var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
+ while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
+ return colors;
+}
+
+var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
+
+var Accent = colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");
+
+var Dark2 = colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");
+
+var Paired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
+
+var Pastel1 = colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");
+
+var Pastel2 = colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");
+
+var Set1 = colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");
+
+var Set2 = colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");
+
+var Set3 = colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");
+
+function ramp(scheme) {
+ return rgbBasis(scheme[scheme.length - 1]);
+}
+
+var scheme = new Array(3).concat(
+ "d8b365f5f5f55ab4ac",
+ "a6611adfc27d80cdc1018571",
+ "a6611adfc27df5f5f580cdc1018571",
+ "8c510ad8b365f6e8c3c7eae55ab4ac01665e",
+ "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e",
+ "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e",
+ "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e",
+ "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30",
+ "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30"
+).map(colors);
+
+var BrBG = ramp(scheme);
+
+var scheme$1 = new Array(3).concat(
+ "af8dc3f7f7f77fbf7b",
+ "7b3294c2a5cfa6dba0008837",
+ "7b3294c2a5cff7f7f7a6dba0008837",
+ "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837",
+ "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837",
+ "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837",
+ "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837",
+ "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b",
+ "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b"
+).map(colors);
+
+var PRGn = ramp(scheme$1);
+
+var scheme$2 = new Array(3).concat(
+ "e9a3c9f7f7f7a1d76a",
+ "d01c8bf1b6dab8e1864dac26",
+ "d01c8bf1b6daf7f7f7b8e1864dac26",
+ "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221",
+ "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221",
+ "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221",
+ "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221",
+ "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419",
+ "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419"
+).map(colors);
+
+var PiYG = ramp(scheme$2);
+
+var scheme$3 = new Array(3).concat(
+ "998ec3f7f7f7f1a340",
+ "5e3c99b2abd2fdb863e66101",
+ "5e3c99b2abd2f7f7f7fdb863e66101",
+ "542788998ec3d8daebfee0b6f1a340b35806",
+ "542788998ec3d8daebf7f7f7fee0b6f1a340b35806",
+ "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806",
+ "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806",
+ "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08",
+ "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08"
+).map(colors);
+
+var PuOr = ramp(scheme$3);
+
+var scheme$4 = new Array(3).concat(
+ "ef8a62f7f7f767a9cf",
+ "ca0020f4a58292c5de0571b0",
+ "ca0020f4a582f7f7f792c5de0571b0",
+ "b2182bef8a62fddbc7d1e5f067a9cf2166ac",
+ "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac",
+ "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac",
+ "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac",
+ "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061",
+ "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061"
+).map(colors);
+
+var RdBu = ramp(scheme$4);
+
+var scheme$5 = new Array(3).concat(
+ "ef8a62ffffff999999",
+ "ca0020f4a582bababa404040",
+ "ca0020f4a582ffffffbababa404040",
+ "b2182bef8a62fddbc7e0e0e09999994d4d4d",
+ "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d",
+ "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d",
+ "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d",
+ "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a",
+ "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a"
+).map(colors);
+
+var RdGy = ramp(scheme$5);
+
+var scheme$6 = new Array(3).concat(
+ "fc8d59ffffbf91bfdb",
+ "d7191cfdae61abd9e92c7bb6",
+ "d7191cfdae61ffffbfabd9e92c7bb6",
+ "d73027fc8d59fee090e0f3f891bfdb4575b4",
+ "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4",
+ "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4",
+ "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4",
+ "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695",
+ "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695"
+).map(colors);
+
+var RdYlBu = ramp(scheme$6);
+
+var scheme$7 = new Array(3).concat(
+ "fc8d59ffffbf91cf60",
+ "d7191cfdae61a6d96a1a9641",
+ "d7191cfdae61ffffbfa6d96a1a9641",
+ "d73027fc8d59fee08bd9ef8b91cf601a9850",
+ "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
+ "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
+ "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
+ "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
+ "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
+).map(colors);
+
+var RdYlGn = ramp(scheme$7);
+
+var scheme$8 = new Array(3).concat(
+ "fc8d59ffffbf99d594",
+ "d7191cfdae61abdda42b83ba",
+ "d7191cfdae61ffffbfabdda42b83ba",
+ "d53e4ffc8d59fee08be6f59899d5943288bd",
+ "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd",
+ "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd",
+ "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd",
+ "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2",
+ "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2"
+).map(colors);
+
+var Spectral = ramp(scheme$8);
+
+var scheme$9 = new Array(3).concat(
+ "e5f5f999d8c92ca25f",
+ "edf8fbb2e2e266c2a4238b45",
+ "edf8fbb2e2e266c2a42ca25f006d2c",
+ "edf8fbccece699d8c966c2a42ca25f006d2c",
+ "edf8fbccece699d8c966c2a441ae76238b45005824",
+ "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824",
+ "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b"
+).map(colors);
+
+var BuGn = ramp(scheme$9);
+
+var scheme$a = new Array(3).concat(
+ "e0ecf49ebcda8856a7",
+ "edf8fbb3cde38c96c688419d",
+ "edf8fbb3cde38c96c68856a7810f7c",
+ "edf8fbbfd3e69ebcda8c96c68856a7810f7c",
+ "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b",
+ "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b",
+ "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b"
+).map(colors);
+
+var BuPu = ramp(scheme$a);
+
+var scheme$b = new Array(3).concat(
+ "e0f3dba8ddb543a2ca",
+ "f0f9e8bae4bc7bccc42b8cbe",
+ "f0f9e8bae4bc7bccc443a2ca0868ac",
+ "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac",
+ "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e",
+ "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e",
+ "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081"
+).map(colors);
+
+var GnBu = ramp(scheme$b);
+
+var scheme$c = new Array(3).concat(
+ "fee8c8fdbb84e34a33",
+ "fef0d9fdcc8afc8d59d7301f",
+ "fef0d9fdcc8afc8d59e34a33b30000",
+ "fef0d9fdd49efdbb84fc8d59e34a33b30000",
+ "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000",
+ "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000",
+ "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000"
+).map(colors);
+
+var OrRd = ramp(scheme$c);
+
+var scheme$d = new Array(3).concat(
+ "ece2f0a6bddb1c9099",
+ "f6eff7bdc9e167a9cf02818a",
+ "f6eff7bdc9e167a9cf1c9099016c59",
+ "f6eff7d0d1e6a6bddb67a9cf1c9099016c59",
+ "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450",
+ "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450",
+ "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636"
+).map(colors);
+
+var PuBuGn = ramp(scheme$d);
+
+var scheme$e = new Array(3).concat(
+ "ece7f2a6bddb2b8cbe",
+ "f1eef6bdc9e174a9cf0570b0",
+ "f1eef6bdc9e174a9cf2b8cbe045a8d",
+ "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d",
+ "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b",
+ "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b",
+ "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858"
+).map(colors);
+
+var PuBu = ramp(scheme$e);
+
+var scheme$f = new Array(3).concat(
+ "e7e1efc994c7dd1c77",
+ "f1eef6d7b5d8df65b0ce1256",
+ "f1eef6d7b5d8df65b0dd1c77980043",
+ "f1eef6d4b9dac994c7df65b0dd1c77980043",
+ "f1eef6d4b9dac994c7df65b0e7298ace125691003f",
+ "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f",
+ "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f"
+).map(colors);
+
+var PuRd = ramp(scheme$f);
+
+var scheme$g = new Array(3).concat(
+ "fde0ddfa9fb5c51b8a",
+ "feebe2fbb4b9f768a1ae017e",
+ "feebe2fbb4b9f768a1c51b8a7a0177",
+ "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177",
+ "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177",
+ "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177",
+ "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a"
+).map(colors);
+
+var RdPu = ramp(scheme$g);
+
+var scheme$h = new Array(3).concat(
+ "edf8b17fcdbb2c7fb8",
+ "ffffcca1dab441b6c4225ea8",
+ "ffffcca1dab441b6c42c7fb8253494",
+ "ffffccc7e9b47fcdbb41b6c42c7fb8253494",
+ "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84",
+ "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84",
+ "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58"
+).map(colors);
+
+var YlGnBu = ramp(scheme$h);
+
+var scheme$i = new Array(3).concat(
+ "f7fcb9addd8e31a354",
+ "ffffccc2e69978c679238443",
+ "ffffccc2e69978c67931a354006837",
+ "ffffccd9f0a3addd8e78c67931a354006837",
+ "ffffccd9f0a3addd8e78c67941ab5d238443005a32",
+ "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32",
+ "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529"
+).map(colors);
+
+var YlGn = ramp(scheme$i);
+
+var scheme$j = new Array(3).concat(
+ "fff7bcfec44fd95f0e",
+ "ffffd4fed98efe9929cc4c02",
+ "ffffd4fed98efe9929d95f0e993404",
+ "ffffd4fee391fec44ffe9929d95f0e993404",
+ "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04",
+ "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04",
+ "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506"
+).map(colors);
+
+var YlOrBr = ramp(scheme$j);
+
+var scheme$k = new Array(3).concat(
+ "ffeda0feb24cf03b20",
+ "ffffb2fecc5cfd8d3ce31a1c",
+ "ffffb2fecc5cfd8d3cf03b20bd0026",
+ "ffffb2fed976feb24cfd8d3cf03b20bd0026",
+ "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026",
+ "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026",
+ "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026"
+).map(colors);
+
+var YlOrRd = ramp(scheme$k);
+
+var scheme$l = new Array(3).concat(
+ "deebf79ecae13182bd",
+ "eff3ffbdd7e76baed62171b5",
+ "eff3ffbdd7e76baed63182bd08519c",
+ "eff3ffc6dbef9ecae16baed63182bd08519c",
+ "eff3ffc6dbef9ecae16baed64292c62171b5084594",
+ "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594",
+ "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b"
+).map(colors);
+
+var Blues = ramp(scheme$l);
+
+var scheme$m = new Array(3).concat(
+ "e5f5e0a1d99b31a354",
+ "edf8e9bae4b374c476238b45",
+ "edf8e9bae4b374c47631a354006d2c",
+ "edf8e9c7e9c0a1d99b74c47631a354006d2c",
+ "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32",
+ "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32",
+ "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b"
+).map(colors);
+
+var Greens = ramp(scheme$m);
+
+var scheme$n = new Array(3).concat(
+ "f0f0f0bdbdbd636363",
+ "f7f7f7cccccc969696525252",
+ "f7f7f7cccccc969696636363252525",
+ "f7f7f7d9d9d9bdbdbd969696636363252525",
+ "f7f7f7d9d9d9bdbdbd969696737373525252252525",
+ "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525",
+ "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000"
+).map(colors);
+
+var Greys = ramp(scheme$n);
+
+var scheme$o = new Array(3).concat(
+ "efedf5bcbddc756bb1",
+ "f2f0f7cbc9e29e9ac86a51a3",
+ "f2f0f7cbc9e29e9ac8756bb154278f",
+ "f2f0f7dadaebbcbddc9e9ac8756bb154278f",
+ "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486",
+ "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486",
+ "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d"
+).map(colors);
+
+var Purples = ramp(scheme$o);
+
+var scheme$p = new Array(3).concat(
+ "fee0d2fc9272de2d26",
+ "fee5d9fcae91fb6a4acb181d",
+ "fee5d9fcae91fb6a4ade2d26a50f15",
+ "fee5d9fcbba1fc9272fb6a4ade2d26a50f15",
+ "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d",
+ "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d",
+ "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d"
+).map(colors);
+
+var Reds = ramp(scheme$p);
+
+var scheme$q = new Array(3).concat(
+ "fee6cefdae6be6550d",
+ "feeddefdbe85fd8d3cd94701",
+ "feeddefdbe85fd8d3ce6550da63603",
+ "feeddefdd0a2fdae6bfd8d3ce6550da63603",
+ "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04",
+ "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04",
+ "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704"
+).map(colors);
+
+var Oranges = ramp(scheme$q);
+
+var cubehelix$3 = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));
+
+var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
+
+var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
+
+var c = cubehelix();
+
+function rainbow(t) {
+ if (t < 0 || t > 1) t -= Math.floor(t);
+ var ts = Math.abs(t - 0.5);
+ c.h = 360 * t - 100;
+ c.s = 1.5 - 1.5 * ts;
+ c.l = 0.8 - 0.9 * ts;
+ return c + "";
+}
+
+var c$1 = rgb(),
+ pi_1_3 = Math.PI / 3,
+ pi_2_3 = Math.PI * 2 / 3;
+
+function sinebow(t) {
+ var x;
+ t = (0.5 - t) * Math.PI;
+ c$1.r = 255 * (x = Math.sin(t)) * x;
+ c$1.g = 255 * (x = Math.sin(t + pi_1_3)) * x;
+ c$1.b = 255 * (x = Math.sin(t + pi_2_3)) * x;
+ return c$1 + "";
+}
+
+function ramp$1(range) {
+ var n = range.length;
+ return function(t) {
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
+ };
+}
+
+var viridis = ramp$1(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
+
+var magma = ramp$1(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
+
+var inferno = ramp$1(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
+
+var plasma = ramp$1(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
+
+function constant$b(x) {
return function constant() {
return x;
};
-};
+}
var abs$1 = Math.abs;
var atan2$1 = Math.atan2;
};
}
-var arc = function() {
+function arc() {
var innerRadius = arcInnerRadius,
outerRadius = arcOuterRadius,
- cornerRadius = constant$10(0),
+ cornerRadius = constant$b(0),
padRadius = null,
startAngle = arcStartAngle,
endAngle = arcEndAngle,
};
arc.innerRadius = function(_) {
- return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$10(+_), arc) : innerRadius;
+ return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$b(+_), arc) : innerRadius;
};
arc.outerRadius = function(_) {
- return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$10(+_), arc) : outerRadius;
+ return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$b(+_), arc) : outerRadius;
};
arc.cornerRadius = function(_) {
- return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$10(+_), arc) : cornerRadius;
+ return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$b(+_), arc) : cornerRadius;
};
arc.padRadius = function(_) {
- return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$10(+_), arc) : padRadius;
+ return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$b(+_), arc) : padRadius;
};
arc.startAngle = function(_) {
- return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$10(+_), arc) : startAngle;
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$b(+_), arc) : startAngle;
};
arc.endAngle = function(_) {
- return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$10(+_), arc) : endAngle;
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$b(+_), arc) : endAngle;
};
arc.padAngle = function(_) {
- return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$10(+_), arc) : padAngle;
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$b(+_), arc) : padAngle;
};
arc.context = function(_) {
- return arguments.length ? (context = _ == null ? null : _, arc) : context;
+ return arguments.length ? ((context = _ == null ? null : _), arc) : context;
};
return arc;
-};
+}
function Linear(context) {
this._context = context;
}
};
-var curveLinear = function(context) {
+function curveLinear(context) {
return new Linear(context);
-};
+}
function x$3(p) {
return p[0];
return p[1];
}
-var line = function() {
+function line() {
var x$$1 = x$3,
y$$1 = y$3,
- defined = constant$10(true),
+ defined = constant$b(true),
context = null,
curve = curveLinear,
output = null;
}
line.x = function(_) {
- return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$10(+_), line) : x$$1;
+ return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$b(+_), line) : x$$1;
};
line.y = function(_) {
- return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$10(+_), line) : y$$1;
+ return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$b(+_), line) : y$$1;
};
line.defined = function(_) {
- return arguments.length ? (defined = typeof _ === "function" ? _ : constant$10(!!_), line) : defined;
+ return arguments.length ? (defined = typeof _ === "function" ? _ : constant$b(!!_), line) : defined;
};
line.curve = function(_) {
};
return line;
-};
+}
-var area$2 = function() {
+function area$3() {
var x0 = x$3,
x1 = null,
- y0 = constant$10(0),
+ y0 = constant$b(0),
y1 = y$3,
- defined = constant$10(true),
+ defined = constant$b(true),
context = null,
curve = curveLinear,
output = null;
}
area.x = function(_) {
- return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$10(+_), x1 = null, area) : x0;
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$b(+_), x1 = null, area) : x0;
};
area.x0 = function(_) {
- return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$10(+_), area) : x0;
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$b(+_), area) : x0;
};
area.x1 = function(_) {
- return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$10(+_), area) : x1;
+ return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$b(+_), area) : x1;
};
area.y = function(_) {
- return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$10(+_), y1 = null, area) : y0;
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$b(+_), y1 = null, area) : y0;
};
area.y0 = function(_) {
- return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$10(+_), area) : y0;
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$b(+_), area) : y0;
};
area.y1 = function(_) {
- return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$10(+_), area) : y1;
+ return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$b(+_), area) : y1;
};
area.lineX0 =
};
area.defined = function(_) {
- return arguments.length ? (defined = typeof _ === "function" ? _ : constant$10(!!_), area) : defined;
+ return arguments.length ? (defined = typeof _ === "function" ? _ : constant$b(!!_), area) : defined;
};
area.curve = function(_) {
};
return area;
-};
+}
-var descending$1 = function(a, b) {
+function descending$1(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
-};
+}
-var identity$7 = function(d) {
+function identity$7(d) {
return d;
-};
+}
-var pie = function() {
+function pie() {
var value = identity$7,
sortValues = descending$1,
sort = null,
- startAngle = constant$10(0),
- endAngle = constant$10(tau$4),
- padAngle = constant$10(0);
+ startAngle = constant$b(0),
+ endAngle = constant$b(tau$4),
+ padAngle = constant$b(0);
function pie(data) {
var i,
}
pie.value = function(_) {
- return arguments.length ? (value = typeof _ === "function" ? _ : constant$10(+_), pie) : value;
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant$b(+_), pie) : value;
};
pie.sortValues = function(_) {
};
pie.startAngle = function(_) {
- return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : startAngle;
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$b(+_), pie) : startAngle;
};
pie.endAngle = function(_) {
- return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : endAngle;
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$b(+_), pie) : endAngle;
};
pie.padAngle = function(_) {
- return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : padAngle;
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$b(+_), pie) : padAngle;
};
return pie;
-};
+}
var curveRadialLinear = curveRadial(curveLinear);
return l;
}
-var lineRadial$1 = function() {
+function lineRadial$1() {
return lineRadial(line().curve(curveRadialLinear));
-};
+}
-var areaRadial = function() {
- var a = area$2().curve(curveRadialLinear),
+function areaRadial() {
+ var a = area$3().curve(curveRadialLinear),
c = a.curve,
x0 = a.lineX0,
x1 = a.lineX1,
};
return a;
-};
+}
-var pointRadial = function(x, y) {
+function pointRadial(x, y) {
return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
-};
+}
var slice$6 = Array.prototype.slice;
};
link.x = function(_) {
- return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$10(+_), link) : x$$1;
+ return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$b(+_), link) : x$$1;
};
link.y = function(_) {
- return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$10(+_), link) : y$$1;
+ return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$b(+_), link) : y$$1;
};
link.context = function(_) {
- return arguments.length ? (context = _ == null ? null : _, link) : context;
+ return arguments.length ? ((context = _ == null ? null : _), link) : context;
};
return link;
}
};
-var tan30 = Math.sqrt(1 / 3);
-var tan30_2 = tan30 * 2;
+var tan30 = Math.sqrt(1 / 3),
+ tan30_2 = tan30 * 2;
var diamond = {
draw: function(context, size) {
}
};
-var ka = 0.89081309152928522810;
-var kr = Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10);
-var kx = Math.sin(tau$4 / 10) * kr;
-var ky = -Math.cos(tau$4 / 10) * kr;
+var ka = 0.89081309152928522810,
+ kr = Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10),
+ kx = Math.sin(tau$4 / 10) * kr,
+ ky = -Math.cos(tau$4 / 10) * kr;
var star = {
draw: function(context, size) {
}
};
-var c = -0.5;
-var s = Math.sqrt(3) / 2;
-var k = 1 / Math.sqrt(12);
-var a = (k / 2 + 1) * 3;
+var c$2 = -0.5,
+ s = Math.sqrt(3) / 2,
+ k = 1 / Math.sqrt(12),
+ a = (k / 2 + 1) * 3;
var wye = {
draw: function(context, size) {
context.moveTo(x0, y0);
context.lineTo(x1, y1);
context.lineTo(x2, y2);
- context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
- context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
- context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
- context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
- context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
- context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
+ context.lineTo(c$2 * x0 - s * y0, s * x0 + c$2 * y0);
+ context.lineTo(c$2 * x1 - s * y1, s * x1 + c$2 * y1);
+ context.lineTo(c$2 * x2 - s * y2, s * x2 + c$2 * y2);
+ context.lineTo(c$2 * x0 + s * y0, c$2 * y0 - s * x0);
+ context.lineTo(c$2 * x1 + s * y1, c$2 * y1 - s * x1);
+ context.lineTo(c$2 * x2 + s * y2, c$2 * y2 - s * x2);
context.closePath();
}
};
wye
];
-var symbol = function() {
- var type = constant$10(circle$2),
- size = constant$10(64),
+function symbol() {
+ var type = constant$b(circle$2),
+ size = constant$b(64),
context = null;
function symbol() {
}
symbol.type = function(_) {
- return arguments.length ? (type = typeof _ === "function" ? _ : constant$10(_), symbol) : type;
+ return arguments.length ? (type = typeof _ === "function" ? _ : constant$b(_), symbol) : type;
};
symbol.size = function(_) {
- return arguments.length ? (size = typeof _ === "function" ? _ : constant$10(+_), symbol) : size;
+ return arguments.length ? (size = typeof _ === "function" ? _ : constant$b(+_), symbol) : size;
};
symbol.context = function(_) {
};
return symbol;
-};
+}
-var noop$2 = function() {};
+function noop$3() {}
function point$2(that, x, y) {
that._context.bezierCurveTo(
}
};
-var basis$2 = function(context) {
+function basis$2(context) {
return new Basis(context);
-};
+}
function BasisClosed(context) {
this._context = context;
}
BasisClosed.prototype = {
- areaStart: noop$2,
- areaEnd: noop$2,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
}
};
-var basisClosed$1 = function(context) {
+function basisClosed$1(context) {
return new BasisClosed(context);
-};
+}
function BasisOpen(context) {
this._context = context;
}
};
-var basisOpen = function(context) {
+function basisOpen(context) {
return new BasisOpen(context);
-};
+}
function Bundle(context, beta) {
this._basis = new Basis(context);
}
CardinalClosed.prototype = {
- areaStart: noop$2,
- areaEnd: noop$2,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
}
CatmullRomClosed.prototype = {
- areaStart: noop$2,
- areaEnd: noop$2,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
}
LinearClosed.prototype = {
- areaStart: noop$2,
- areaEnd: noop$2,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function() {
this._point = 0;
},
}
};
-var linearClosed = function(context) {
+function linearClosed(context) {
return new LinearClosed(context);
-};
+}
function sign$1(x) {
return x < 0 ? -1 : 1;
return [a, b];
}
-var natural = function(context) {
+function natural(context) {
return new Natural(context);
-};
+}
function Step(context, t) {
this._context = context;
}
};
-var step = function(context) {
+function step(context) {
return new Step(context, 0.5);
-};
+}
function stepBefore(context) {
return new Step(context, 0);
return new Step(context, 1);
}
-var none$1 = function(series, order) {
+function none$1(series, order) {
if (!((n = series.length) > 1)) return;
for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
s0 = s1, s1 = series[order[i]];
s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
}
}
-};
+}
-var none$2 = function(series) {
+function none$2(series) {
var n = series.length, o = new Array(n);
while (--n >= 0) o[n] = n;
return o;
-};
+}
function stackValue(d, key) {
return d[key];
}
-var stack = function() {
- var keys = constant$10([]),
+function stack() {
+ var keys = constant$b([]),
order = none$2,
offset = none$1,
value = stackValue;
}
stack.keys = function(_) {
- return arguments.length ? (keys = typeof _ === "function" ? _ : constant$10(slice$6.call(_)), stack) : keys;
+ return arguments.length ? (keys = typeof _ === "function" ? _ : constant$b(slice$6.call(_)), stack) : keys;
};
stack.value = function(_) {
- return arguments.length ? (value = typeof _ === "function" ? _ : constant$10(+_), stack) : value;
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant$b(+_), stack) : value;
};
stack.order = function(_) {
- return arguments.length ? (order = _ == null ? none$2 : typeof _ === "function" ? _ : constant$10(slice$6.call(_)), stack) : order;
+ return arguments.length ? (order = _ == null ? none$2 : typeof _ === "function" ? _ : constant$b(slice$6.call(_)), stack) : order;
};
stack.offset = function(_) {
};
return stack;
-};
+}
-var expand = function(series, order) {
+function expand(series, order) {
if (!((n = series.length) > 0)) return;
for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
}
none$1(series, order);
-};
+}
-var diverging = function(series, order) {
+function diverging$1(series, order) {
if (!((n = series.length) > 1)) return;
for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
for (yp = yn = 0, i = 0; i < n; ++i) {
}
}
}
-};
+}
-var silhouette = function(series, order) {
+function silhouette(series, order) {
if (!((n = series.length) > 0)) return;
for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
s0[j][1] += s0[j][0] = -y / 2;
}
none$1(series, order);
-};
+}
-var wiggle = function(series, order) {
+function wiggle(series, order) {
if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;
for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
}
s0[j - 1][1] += s0[j - 1][0] = y;
none$1(series, order);
-};
+}
-var ascending$2 = function(series) {
+function ascending$3(series) {
var sums = series.map(sum$2);
return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; });
-};
+}
function sum$2(series) {
var s = 0, i = -1, n = series.length, v;
return s;
}
-var descending$2 = function(series) {
- return ascending$2(series).reverse();
-};
+function descending$2(series) {
+ return ascending$3(series).reverse();
+}
-var insideOut = function(series) {
+function insideOut(series) {
var n = series.length,
i,
j,
}
return bottoms.reverse().concat(tops);
-};
+}
-var reverse = function(series) {
+function reverse(series) {
return none$2(series).reverse();
-};
+}
-var constant$11 = function(x) {
+function constant$c(x) {
return function() {
return x;
};
-};
+}
function x$4(d) {
return d[0];
}
};
-var voronoi = function() {
+function voronoi() {
var x$$1 = x$4,
y$$1 = y$4,
extent = null;
};
voronoi.x = function(_) {
- return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$11(+_), voronoi) : x$$1;
+ return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$c(+_), voronoi) : x$$1;
};
voronoi.y = function(_) {
- return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$11(+_), voronoi) : y$$1;
+ return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$c(+_), voronoi) : y$$1;
};
voronoi.extent = function(_) {
};
return voronoi;
-};
+}
-var constant$12 = function(x) {
+function constant$d(x) {
return function() {
return x;
};
-};
+}
function ZoomEvent(target, type, transform) {
this.target = target;
exports.event.stopImmediatePropagation();
}
-var noevent$2 = function() {
+function noevent$2() {
exports.event.preventDefault();
exports.event.stopImmediatePropagation();
-};
+}
// Ignore right-click, since that should open the context menu.
function defaultFilter$2() {
return "ontouchstart" in this;
}
-function defaultConstrain(transform$$1, extent, translateExtent) {
- var dx0 = transform$$1.invertX(extent[0][0]) - translateExtent[0][0],
- dx1 = transform$$1.invertX(extent[1][0]) - translateExtent[1][0],
- dy0 = transform$$1.invertY(extent[0][1]) - translateExtent[0][1],
- dy1 = transform$$1.invertY(extent[1][1]) - translateExtent[1][1];
- return transform$$1.translate(
+function defaultConstrain(transform, extent, translateExtent) {
+ var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
+ dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
+ dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
+ dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
+ return transform.translate(
dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
);
}
-var zoom = function() {
+function zoom() {
var filter = defaultFilter$2,
extent = defaultExtent$1,
constrain = defaultConstrain,
wheelDelay = 150,
clickDistance2 = 0;
- function zoom(selection) {
- selection
+ function zoom(selection$$1) {
+ selection$$1
.property("__zoom", defaultTransform)
.on("wheel.zoom", wheeled)
.on("mousedown.zoom", mousedowned)
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
- zoom.transform = function(collection, transform$$1) {
- var selection = collection.selection ? collection.selection() : collection;
- selection.property("__zoom", defaultTransform);
- if (collection !== selection) {
- schedule(collection, transform$$1);
+ zoom.transform = function(collection, transform) {
+ var selection$$1 = collection.selection ? collection.selection() : collection;
+ selection$$1.property("__zoom", defaultTransform);
+ if (collection !== selection$$1) {
+ schedule(collection, transform);
} else {
- selection.interrupt().each(function() {
+ selection$$1.interrupt().each(function() {
gesture(this, arguments)
.start()
- .zoom(null, typeof transform$$1 === "function" ? transform$$1.apply(this, arguments) : transform$$1)
+ .zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform)
.end();
});
}
};
- zoom.scaleBy = function(selection, k) {
- zoom.scaleTo(selection, function() {
+ zoom.scaleBy = function(selection$$1, k) {
+ zoom.scaleTo(selection$$1, function() {
var k0 = this.__zoom.k,
k1 = typeof k === "function" ? k.apply(this, arguments) : k;
return k0 * k1;
});
};
- zoom.scaleTo = function(selection, k) {
- zoom.transform(selection, function() {
+ zoom.scaleTo = function(selection$$1, k) {
+ zoom.transform(selection$$1, function() {
var e = extent.apply(this, arguments),
t0 = this.__zoom,
p0 = centroid(e),
});
};
- zoom.translateBy = function(selection, x, y) {
- zoom.transform(selection, function() {
+ zoom.translateBy = function(selection$$1, x, y) {
+ zoom.transform(selection$$1, function() {
return constrain(this.__zoom.translate(
typeof x === "function" ? x.apply(this, arguments) : x,
typeof y === "function" ? y.apply(this, arguments) : y
});
};
- zoom.translateTo = function(selection, x, y) {
- zoom.transform(selection, function() {
+ zoom.translateTo = function(selection$$1, x, y) {
+ zoom.transform(selection$$1, function() {
var e = extent.apply(this, arguments),
t = this.__zoom,
p = centroid(e);
});
};
- function scale(transform$$1, k) {
+ function scale(transform, k) {
k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
- return k === transform$$1.k ? transform$$1 : new Transform(k, transform$$1.x, transform$$1.y);
+ return k === transform.k ? transform : new Transform(k, transform.x, transform.y);
}
- function translate(transform$$1, p0, p1) {
- var x = p0[0] - p1[0] * transform$$1.k, y = p0[1] - p1[1] * transform$$1.k;
- return x === transform$$1.x && y === transform$$1.y ? transform$$1 : new Transform(transform$$1.k, x, y);
+ function translate(transform, p0, p1) {
+ var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;
+ return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
}
function centroid(extent) {
return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
}
- function schedule(transition, transform$$1, center) {
- transition
+ function schedule(transition$$1, transform, center) {
+ transition$$1
.on("start.zoom", function() { gesture(this, arguments).start(); })
.on("interrupt.zoom end.zoom", function() { gesture(this, arguments).end(); })
.tween("zoom", function() {
p = center || centroid(e),
w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
a = that.__zoom,
- b = typeof transform$$1 === "function" ? transform$$1.apply(that, args) : transform$$1,
+ b = typeof transform === "function" ? transform.apply(that, args) : transform,
i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
return function(t) {
if (t === 1) t = b; // Avoid rounding error on end.
}
return this;
},
- zoom: function(key, transform$$1) {
- if (this.mouse && key !== "mouse") this.mouse[1] = transform$$1.invert(this.mouse[0]);
- if (this.touch0 && key !== "touch") this.touch0[1] = transform$$1.invert(this.touch0[0]);
- if (this.touch1 && key !== "touch") this.touch1[1] = transform$$1.invert(this.touch1[0]);
- this.that.__zoom = transform$$1;
+ zoom: function(key, transform) {
+ if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
+ if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
+ if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
+ this.that.__zoom = transform;
this.emit("zoom");
return this;
},
function touchstarted() {
if (!filter.apply(this, arguments)) return;
var g = gesture(this, arguments),
- touches = exports.event.changedTouches,
+ touches$$1 = exports.event.changedTouches,
started,
- n = touches.length, i, t, p;
+ n = touches$$1.length, i, t, p;
nopropagation$2();
for (i = 0; i < n; ++i) {
- t = touches[i], p = touch(this, touches, t.identifier);
+ t = touches$$1[i], p = touch(this, touches$$1, t.identifier);
p = [p, this.__zoom.invert(p), t.identifier];
if (!g.touch0) g.touch0 = p, started = true;
else if (!g.touch1) g.touch1 = p;
function touchmoved() {
var g = gesture(this, arguments),
- touches = exports.event.changedTouches,
- n = touches.length, i, t, p, l;
+ touches$$1 = exports.event.changedTouches,
+ n = touches$$1.length, i, t, p, l;
noevent$2();
if (touchstarting) touchstarting = clearTimeout(touchstarting);
for (i = 0; i < n; ++i) {
- t = touches[i], p = touch(this, touches, t.identifier);
+ t = touches$$1[i], p = touch(this, touches$$1, t.identifier);
if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;
else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;
}
function touchended() {
var g = gesture(this, arguments),
- touches = exports.event.changedTouches,
- n = touches.length, i, t;
+ touches$$1 = exports.event.changedTouches,
+ n = touches$$1.length, i, t;
nopropagation$2();
if (touchending) clearTimeout(touchending);
touchending = setTimeout(function() { touchending = null; }, touchDelay);
for (i = 0; i < n; ++i) {
- t = touches[i];
+ t = touches$$1[i];
if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;
else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;
}
}
zoom.wheelDelta = function(_) {
- return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant$12(+_), zoom) : wheelDelta;
+ return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant$d(+_), zoom) : wheelDelta;
};
zoom.filter = function(_) {
- return arguments.length ? (filter = typeof _ === "function" ? _ : constant$12(!!_), zoom) : filter;
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant$d(!!_), zoom) : filter;
};
zoom.touchable = function(_) {
- return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$12(!!_), zoom) : touchable;
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$d(!!_), zoom) : touchable;
};
zoom.extent = function(_) {
- return arguments.length ? (extent = typeof _ === "function" ? _ : constant$12([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
+ return arguments.length ? (extent = typeof _ === "function" ? _ : constant$d([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
};
zoom.scaleExtent = function(_) {
};
return zoom;
-};
+}
exports.version = version;
exports.bisect = bisectRight;
exports.histogram = histogram;
exports.thresholdFreedmanDiaconis = freedmanDiaconis;
exports.thresholdScott = scott;
-exports.thresholdSturges = sturges;
+exports.thresholdSturges = thresholdSturges;
exports.max = max;
exports.mean = mean;
exports.median = median;
exports.hsl = hsl;
exports.lab = lab;
exports.hcl = hcl;
+exports.lch = lch;
+exports.gray = gray;
exports.cubehelix = cubehelix;
+exports.contours = contours;
+exports.contourDensity = density;
exports.dispatch = dispatch;
exports.drag = drag;
exports.dragDisable = dragDisable;
exports.dragEnable = yesdrag;
-exports.dsvFormat = dsv;
+exports.dsvFormat = dsvFormat;
exports.csvParse = csvParse;
exports.csvParseRows = csvParseRows;
exports.csvFormat = csvFormat;
exports.easeElasticIn = elasticIn;
exports.easeElasticOut = elasticOut;
exports.easeElasticInOut = elasticInOut;
+exports.blob = blob;
+exports.buffer = buffer;
+exports.dsv = dsv;
+exports.csv = csv$1;
+exports.tsv = tsv$1;
+exports.image = image;
+exports.json = json;
+exports.text = text;
+exports.xml = xml;
+exports.html = html;
+exports.svg = svg;
exports.forceCenter = center$1;
exports.forceCollide = collide;
exports.forceLink = link;
exports.precisionFixed = precisionFixed;
exports.precisionPrefix = precisionPrefix;
exports.precisionRound = precisionRound;
-exports.geoArea = area;
+exports.geoArea = area$1;
exports.geoBounds = bounds;
exports.geoCentroid = centroid;
exports.geoCircle = circle;
exports.geoClipCircle = clipCircle;
exports.geoClipExtent = extent$1;
exports.geoClipRectangle = clipRectangle;
-exports.geoContains = contains;
+exports.geoContains = contains$1;
exports.geoDistance = distance;
exports.geoGraticule = graticule;
exports.geoGraticule10 = graticule10;
exports.geoConicEqualAreaRaw = conicEqualAreaRaw;
exports.geoConicEquidistant = conicEquidistant;
exports.geoConicEquidistantRaw = conicEquidistantRaw;
+exports.geoEqualEarth = equalEarth;
+exports.geoEqualEarthRaw = equalEarthRaw;
exports.geoEquirectangular = equirectangular;
exports.geoEquirectangularRaw = equirectangularRaw;
exports.geoGnomonic = gnomonic;
exports.interpolateBasis = basis$1;
exports.interpolateBasisClosed = basisClosed;
exports.interpolateDate = date;
-exports.interpolateNumber = reinterpolate;
+exports.interpolateDiscrete = discrete;
+exports.interpolateHue = hue$1;
+exports.interpolateNumber = interpolateNumber;
exports.interpolateObject = object;
exports.interpolateRound = interpolateRound;
exports.interpolateString = interpolateString;
exports.interpolateHclLong = hclLong;
exports.interpolateCubehelix = cubehelix$2;
exports.interpolateCubehelixLong = cubehelixLong;
+exports.piecewise = piecewise;
exports.quantize = quantize;
exports.path = path;
-exports.polygonArea = area$1;
+exports.polygonArea = area$2;
exports.polygonCentroid = centroid$1;
exports.polygonHull = hull;
-exports.polygonContains = contains$1;
+exports.polygonContains = contains$2;
exports.polygonLength = length$2;
exports.quadtree = quadtree;
-exports.queue = queue;
exports.randomUniform = uniform;
exports.randomNormal = normal;
exports.randomLogNormal = logNormal;
exports.randomBates = bates;
exports.randomIrwinHall = irwinHall;
exports.randomExponential = exponential$1;
-exports.request = request;
-exports.html = html;
-exports.json = json;
-exports.text = text;
-exports.xml = xml;
-exports.csv = csv$1;
-exports.tsv = tsv$1;
exports.scaleBand = band;
exports.scalePoint = point$1;
exports.scaleIdentity = identity$6;
exports.scaleThreshold = threshold$1;
exports.scaleTime = time;
exports.scaleUtc = utcTime;
+exports.scaleSequential = sequential;
+exports.scaleDiverging = diverging;
exports.schemeCategory10 = category10;
-exports.schemeCategory20b = category20b;
-exports.schemeCategory20c = category20c;
-exports.schemeCategory20 = category20;
+exports.schemeAccent = Accent;
+exports.schemeDark2 = Dark2;
+exports.schemePaired = Paired;
+exports.schemePastel1 = Pastel1;
+exports.schemePastel2 = Pastel2;
+exports.schemeSet1 = Set1;
+exports.schemeSet2 = Set2;
+exports.schemeSet3 = Set3;
+exports.interpolateBrBG = BrBG;
+exports.schemeBrBG = scheme;
+exports.interpolatePRGn = PRGn;
+exports.schemePRGn = scheme$1;
+exports.interpolatePiYG = PiYG;
+exports.schemePiYG = scheme$2;
+exports.interpolatePuOr = PuOr;
+exports.schemePuOr = scheme$3;
+exports.interpolateRdBu = RdBu;
+exports.schemeRdBu = scheme$4;
+exports.interpolateRdGy = RdGy;
+exports.schemeRdGy = scheme$5;
+exports.interpolateRdYlBu = RdYlBu;
+exports.schemeRdYlBu = scheme$6;
+exports.interpolateRdYlGn = RdYlGn;
+exports.schemeRdYlGn = scheme$7;
+exports.interpolateSpectral = Spectral;
+exports.schemeSpectral = scheme$8;
+exports.interpolateBuGn = BuGn;
+exports.schemeBuGn = scheme$9;
+exports.interpolateBuPu = BuPu;
+exports.schemeBuPu = scheme$a;
+exports.interpolateGnBu = GnBu;
+exports.schemeGnBu = scheme$b;
+exports.interpolateOrRd = OrRd;
+exports.schemeOrRd = scheme$c;
+exports.interpolatePuBuGn = PuBuGn;
+exports.schemePuBuGn = scheme$d;
+exports.interpolatePuBu = PuBu;
+exports.schemePuBu = scheme$e;
+exports.interpolatePuRd = PuRd;
+exports.schemePuRd = scheme$f;
+exports.interpolateRdPu = RdPu;
+exports.schemeRdPu = scheme$g;
+exports.interpolateYlGnBu = YlGnBu;
+exports.schemeYlGnBu = scheme$h;
+exports.interpolateYlGn = YlGn;
+exports.schemeYlGn = scheme$i;
+exports.interpolateYlOrBr = YlOrBr;
+exports.schemeYlOrBr = scheme$j;
+exports.interpolateYlOrRd = YlOrRd;
+exports.schemeYlOrRd = scheme$k;
+exports.interpolateBlues = Blues;
+exports.schemeBlues = scheme$l;
+exports.interpolateGreens = Greens;
+exports.schemeGreens = scheme$m;
+exports.interpolateGreys = Greys;
+exports.schemeGreys = scheme$n;
+exports.interpolatePurples = Purples;
+exports.schemePurples = scheme$o;
+exports.interpolateReds = Reds;
+exports.schemeReds = scheme$p;
+exports.interpolateOranges = Oranges;
+exports.schemeOranges = scheme$q;
exports.interpolateCubehelixDefault = cubehelix$3;
-exports.interpolateRainbow = rainbow$1;
+exports.interpolateRainbow = rainbow;
exports.interpolateWarm = warm;
exports.interpolateCool = cool;
+exports.interpolateSinebow = sinebow;
exports.interpolateViridis = viridis;
exports.interpolateMagma = magma;
exports.interpolateInferno = inferno;
exports.interpolatePlasma = plasma;
-exports.scaleSequential = sequential;
+exports.create = create;
exports.creator = creator;
-exports.local = local$1;
+exports.local = local;
exports.matcher = matcher$1;
exports.mouse = mouse;
exports.namespace = namespace;
exports.window = defaultView;
exports.customEvent = customEvent;
exports.arc = arc;
-exports.area = area$2;
+exports.area = area$3;
exports.line = line;
exports.pie = pie;
exports.areaRadial = areaRadial;
exports.curveStepBefore = stepBefore;
exports.stack = stack;
exports.stackOffsetExpand = expand;
-exports.stackOffsetDiverging = diverging;
+exports.stackOffsetDiverging = diverging$1;
exports.stackOffsetNone = none$1;
exports.stackOffsetSilhouette = silhouette;
exports.stackOffsetWiggle = wiggle;
-exports.stackOrderAscending = ascending$2;
+exports.stackOrderAscending = ascending$3;
exports.stackOrderDescending = descending$2;
exports.stackOrderInsideOut = insideOut;
exports.stackOrderNone = none$2;