app/assets/javascripts/d3.v4.js in d3-rails-4.10.2 vs app/assets/javascripts/d3.v4.js in d3-rails-4.13.0
- old
+ new
@@ -1,19 +1,19 @@
-// https://d3js.org Version 4.10.2. Copyright 2017 Mike Bostock.
+// https://d3js.org Version 4.13.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 || {})));
}(this, (function (exports) { 'use strict';
-var version = "4.10.2";
+var version = "4.13.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) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
@@ -33,34 +33,34 @@
else lo = mid + 1;
}
return lo;
}
};
-};
+}
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
var ascendingBisect = bisector(ascending);
-var bisectRight$1 = ascendingBisect.right;
+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),
i0,
i1,
@@ -74,21 +74,21 @@
values[i] = reduce(value0, values1[i1]);
}
}
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,
mean = 0,
value,
@@ -114,18 +114,18 @@
}
}
}
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,
min,
max;
@@ -157,28 +157,28 @@
}
}
}
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,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
@@ -186,25 +186,26 @@
while (++i < n) {
range[i] = start + i * step;
}
return range;
-};
+}
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e2 = Math.sqrt(2);
-var ticks = function(start, stop, count) {
- var reverse = stop < start,
+function ticks(start, stop, count) {
+ var reverse,
i = -1,
n,
ticks,
step;
- if (reverse) n = start, start = stop, stop = n;
-
+ stop = +stop, start = +start, count = +count;
+ if (start === stop && count > 0) return [start];
+ if (reverse = stop < start) n = start, start = stop, stop = n;
if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
if (step > 0) {
start = Math.ceil(start / step);
stop = Math.floor(stop / step);
@@ -218,11 +219,11 @@
}
if (reverse) ticks.reverse();
return ticks;
-};
+}
function tickIncrement(start, stop, count) {
var step = (stop - start) / Math.max(0, count),
power = Math.floor(Math.log(step) / Math.LN10),
error = step / Math.pow(10, power);
@@ -239,15 +240,15 @@
else if (error >= e5) step1 *= 5;
else if (error >= e2) step1 *= 2;
return stop < start ? -step1 : step1;
}
-var sturges = function(values) {
+function sturges(values) {
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
-};
+}
-var histogram = function() {
+function histogram() {
var value = identity,
domain = extent,
threshold = sturges;
function histogram(data) {
@@ -288,11 +289,11 @@
// Assign data to bins by value, ignoring any outside the domain.
for (i = 0; i < n; ++i) {
x = values[i];
if (x0 <= x && x <= x1) {
- bins[bisectRight$1(tz, x, 0, m)].push(data[i]);
+ bins[bisectRight(tz, x, 0, m)].push(data[i]);
}
}
return bins;
}
@@ -308,35 +309,35 @@
histogram.thresholds = function(_) {
return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;
};
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);
if (p >= 1) return +valueof(values[n - 1], n - 1, values);
var n,
i = (n - 1) * p,
i0 = Math.floor(i),
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,
max;
@@ -365,13 +366,13 @@
}
}
}
return max;
-};
+}
-var mean = function(values, valueof) {
+function mean(values, valueof) {
var n = values.length,
m = n,
i = -1,
value,
sum = 0;
@@ -389,13 +390,13 @@
else --m;
}
}
if (m) return sum / m;
-};
+}
-var median = function(values, valueof) {
+function median(values, valueof) {
var n = values.length,
i = -1,
value,
numbers = [];
@@ -414,13 +415,13 @@
}
}
}
return threshold(numbers.sort(ascending), 0.5);
-};
+}
-var merge = function(arrays) {
+function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
@@ -436,13 +437,13 @@
merged[--j] = array[m];
}
}
return merged;
-};
+}
-var min = function(values, valueof) {
+function min(values, valueof) {
var n = values.length,
i = -1,
value,
min;
@@ -471,19 +472,19 @@
}
}
}
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,
j = 0,
xi,
@@ -496,13 +497,13 @@
xj = xi, j = i;
}
}
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;
while (m) {
@@ -511,13 +512,13 @@
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return array;
-};
+}
-var sum = function(values, valueof) {
+function sum(values, valueof) {
var n = values.length,
i = -1,
value,
sum = 0;
@@ -532,35 +533,35 @@
if (value = +valueof(values[i], i, values)) sum += 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;) {
row[j] = matrix[j][i];
}
}
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;
@@ -823,15 +824,15 @@
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
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 document = this.ownerDocument,
uri = this.namespaceURI;
@@ -845,211 +846,26 @@
return function() {
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
};
}
-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) {
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))) {
@@ -1058,23 +874,23 @@
}
}
}
return new Selection(subgroups, this._parents);
-};
+}
function empty$1() {
return [];
}
-var selectorAll = function(selector) {
+function selectorAll(selector) {
return selector == null ? empty$1 : 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) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
@@ -1083,13 +899,36 @@
}
}
}
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) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
@@ -1097,19 +936,19 @@
}
}
}
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;
this.namespaceURI = parent.namespaceURI;
this._next = null;
@@ -1123,15 +962,15 @@
insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },
querySelector: function(selector) { return this._parent.querySelector(selector); },
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__”.
function bindIndex(parent, group, enter, update, exit, data) {
var i = 0,
@@ -1201,11 +1040,11 @@
exit[i] = node;
}
}
}
-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; });
return data;
}
@@ -1242,17 +1081,17 @@
update = new Selection(update, parents);
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) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
@@ -1263,13 +1102,13 @@
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
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;) {
if (node = group[i]) {
if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
@@ -1277,13 +1116,13 @@
}
}
}
return this;
-};
+}
-var selection_sort = function(compare) {
+function selection_sort(compare) {
if (!compare) compare = ascending$1;
function compareNode(a, b) {
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
}
@@ -1296,61 +1135,61 @@
}
sortgroup.sort(compareNode);
}
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) {
var node = group[i];
if (node) return node;
}
}
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) {
if (node = group[i]) callback.call(node, node.__data__, i, group);
}
}
return this;
-};
+}
function attrRemove(name) {
return function() {
this.removeAttribute(name);
};
@@ -1388,11 +1227,11 @@
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
else this.setAttributeNS(fullname.space, fullname.local, v);
};
}
-var selection_attr = function(name, value) {
+function selection_attr(name, value) {
var fullname = namespace(name);
if (arguments.length < 2) {
var node = this.node();
return fullname.local
@@ -1402,17 +1241,17 @@
return this.each((value == null
? (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() {
this.style.removeProperty(name);
};
@@ -1430,18 +1269,18 @@
if (v == null) this.style.removeProperty(name);
else this.style.setProperty(name, v, priority);
};
}
-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)
|| defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
}
@@ -1464,18 +1303,18 @@
if (v == null) delete this[name];
else this[name] = v;
};
}
-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+/);
}
@@ -1534,11 +1373,11 @@
return function() {
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
};
}
-var selection_classed = function(name, value) {
+function selection_classed(name, value) {
var names = classArray(name + "");
if (arguments.length < 2) {
var list = classList(this.node()), i = -1, n = names.length;
while (++i < n) if (!list.contains(names[i])) return false;
@@ -1547,11 +1386,11 @@
return this.each((typeof value === "function"
? classedFunction : value
? classedTrue
: classedFalse)(names, value));
-};
+}
function textRemove() {
this.textContent = "";
}
@@ -1566,18 +1405,18 @@
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
};
}
-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 = "";
}
@@ -1592,69 +1431,189 @@
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
};
}
-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);
-};
+}
-var selection_datum = function(value) {
+function selection_cloneShallow() {
+ return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibling);
+}
+
+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),
event = window.CustomEvent;
if (typeof event === "function") {
@@ -1678,15 +1637,15 @@
return function() {
return dispatchEvent(this, type, params.apply(this, arguments));
};
}
-var selection_dispatch = function(type, params) {
+function selection_dispatch(type, params) {
return this.each((typeof params === "function"
? dispatchFunction
: dispatchConstant)(type, params));
-};
+}
var root = [null];
function Selection(groups, parents) {
this._groups = groups;
@@ -1723,68 +1682,127 @@
raise: selection_raise,
lower: selection_lower,
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$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 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) {
if ((touch = touches[i]).identifier === identifier) {
return point(node, touch);
}
}
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) {
points[i] = point(node, touches[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);
if ("onselectstart" in root) {
selection.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);
if (noclick) {
@@ -1797,15 +1815,15 @@
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;
this.type = type;
this.subject = subject;
@@ -1834,18 +1852,19 @@
function defaultSubject(d) {
return d == null ? {x: exports.event.x, y: exports.event.y} : d;
}
-function touchable() {
+function defaultTouchable() {
return "ontouchstart" in this;
}
-var drag = function() {
+function drag() {
var filter = defaultFilter$1,
container = defaultContainer,
subject = defaultSubject,
+ touchable = defaultTouchable,
gestures = {},
listeners = dispatch("start", "drag", "end"),
active = 0,
mousedownx,
mousedowny,
@@ -1965,26 +1984,30 @@
drag.subject = function(_) {
return arguments.length ? (subject = typeof _ === "function" ? _ : constant$2(_), drag) : subject;
};
+ drag.touchable = function(_) {
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$2(!!_), drag) : touchable;
+ };
+
drag.on = function() {
var value = listeners.on.apply(listeners, arguments);
return value === listeners ? drag : value;
};
drag.clickDistance = function(_) {
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
};
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);
for (var key in definition) prototype[key] = definition[key];
return prototype;
@@ -2491,39 +2514,39 @@
+ (4 - 6 * t2 + 3 * t3) * v1
+ (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
+ 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),
v1 = values[i],
v2 = values[i + 1],
v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
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),
v0 = values[(i + n - 1) % n],
v1 = values[i % n],
v2 = values[(i + 1) % 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) {
return a + t * d;
};
@@ -2600,40 +2623,40 @@
}
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(nb),
+ x = new Array(na),
c = new Array(nb),
i;
for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]);
for (; i < nb; ++i) c[i] = b[i];
return function(t) {
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 reinterpolate(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;
if (a === null || typeof a !== "object") a = {};
@@ -2649,11 +2672,11 @@
return function(t) {
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");
function zero(b) {
@@ -2666,11 +2689,11 @@
return function(t) {
return b(t) + "";
};
}
-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
bs, // string preceding current number in b, if any
i = -1, // index in s
@@ -2712,29 +2735,29 @@
: zero(b))
: (b = q.length, function(t) {
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 === "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);
-};
+}
-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;
var identity$2 = {
translateX: 0,
@@ -2743,11 +2766,11 @@
skewX: 0,
scaleX: 1,
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;
if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
@@ -2757,11 +2780,11 @@
rotate: Math.atan2(b, a) * degrees,
skewX: Math.atan(skewX) * degrees,
scaleX: scaleX,
scaleY: scaleY
};
-};
+}
var cssNode;
var cssRoot;
var cssView;
var svgNode;
@@ -2863,11 +2886,11 @@
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
// 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,
dy = uy1 - uy0,
d2 = dx * dx + dy * dy,
@@ -2907,11 +2930,11 @@
}
i.duration = S * 1000;
return i;
-};
+}
function hsl$1(hue$$1) {
return function(start, end) {
var h = hue$$1((start = hsl(start)).h, (end = hsl(end)).h),
s = nogamma(start.s, end.s),
@@ -2988,15 +3011,15 @@
}
var cubehelix$2 = cubehelix$1(hue);
var cubehelixLong = cubehelix$1(nogamma);
-var quantize = function(interpolator, n) {
+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;
@@ -3105,31 +3128,31 @@
if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
-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) {
t.stop();
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;
t.restart(function tick(elapsed) {
elapsed += total;
t.restart(tick, total += delay, time);
callback(elapsed);
}, delay, time);
return t;
-};
+}
var emptyOn = dispatch("start", "end", "interrupt");
var emptyTween = [];
var CREATED = 0;
@@ -3138,15 +3161,15 @@
var STARTED = 3;
var RUNNING = 4;
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.
on: emptyOn,
tween: emptyTween,
@@ -3155,31 +3178,31 @@
duration: timing.duration,
ease: timing.ease,
timer: null,
state: CREATED
});
-};
+}
function init(node, id) {
- var schedule = node.__transition;
- if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late");
+ var schedule = get$1(node, id);
+ if (schedule.state > CREATED) throw new Error("too late; already scheduled");
return schedule;
}
function set$1(node, id) {
- var schedule = node.__transition;
- if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error("too late");
+ var schedule = get$1(node, id);
+ if (schedule.state > STARTING) throw new Error("too late; already started");
return schedule;
}
function get$1(node, id) {
var schedule = node.__transition;
- if (!schedule || !(schedule = schedule[id])) throw new Error("too late");
+ if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
return schedule;
}
-function create(node, id, self) {
+function create$1(node, id, self) {
var schedules = node.__transition,
tween;
// Initialize the self timer when the transition is created.
// Note the actual delay is not known until the first callback!
@@ -3280,11 +3303,11 @@
for (var i in schedules) return; // eslint-disable-line no-unused-vars
delete node.__transition;
}
}
-var interrupt = function(node, name) {
+function interrupt(node, name) {
var schedules = node.__transition,
schedule$$1,
active,
empty = true,
i;
@@ -3301,17 +3324,17 @@
if (active) schedule$$1.on.call("interrupt", node, node.__data__, schedule$$1.index, schedule$$1.group);
delete schedules[i];
}
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;
return function() {
var schedule$$1 = set$1(this, id),
@@ -3358,11 +3381,11 @@
schedule$$1.tween = tween1;
};
}
-var transition_tween = function(name, value) {
+function transition_tween(name, value) {
var id = this._id;
name += "";
if (arguments.length < 2) {
@@ -3374,11 +3397,11 @@
}
return null;
}
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
-};
+}
function tweenValue(transition, name, value) {
var id = transition._id;
transition.each(function() {
@@ -3389,17 +3412,17 @@
return function(node) {
return get$1(node, id).value[name];
};
}
-var interpolate = function(a, b) {
+function interpolate(a, b) {
var c;
return (typeof b === "number" ? reinterpolate
: b instanceof color ? interpolateRgb
: (c = color(b)) ? (b = c, interpolateRgb)
: interpolateString)(a, b);
-};
+}
function attrRemove$1(name) {
return function() {
this.removeAttribute(name);
};
@@ -3459,17 +3482,17 @@
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
};
}
-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() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
@@ -3489,18 +3512,18 @@
}
tween._value = value;
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() {
init(this, id).delay = +value.apply(this, arguments);
};
@@ -3510,19 +3533,19 @@
return value = +value, function() {
init(this, id).delay = value;
};
}
-var transition_delay = function(value) {
+function transition_delay(value) {
var id = this._id;
return arguments.length
? this.each((typeof value === "function"
? delayFunction
: delayConstant)(id, value))
: get$1(this.node(), id).delay;
-};
+}
function durationFunction(id, value) {
return function() {
set$1(this, id).duration = +value.apply(this, arguments);
};
@@ -3532,36 +3555,36 @@
return value = +value, function() {
set$1(this, id).duration = value;
};
}
-var transition_duration = function(value) {
+function transition_duration(value) {
var id = this._id;
return arguments.length
? this.each((typeof value === "function"
? durationFunction
: durationConstant)(id, value))
: get$1(this.node(), id).duration;
-};
+}
function easeConstant(id, value) {
if (typeof value !== "function") throw new Error;
return function() {
set$1(this, id).ease = value;
};
}
-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) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
@@ -3569,13 +3592,13 @@
}
}
}
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) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group0[i] || group1[i]) {
@@ -3587,11 +3610,11 @@
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Transition(merges, this._parents, this._name, this._id);
-};
+}
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
var i = t.indexOf(".");
if (i >= 0) t = t.slice(0, i);
@@ -3612,31 +3635,31 @@
schedule$$1.on = on1;
};
}
-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 parent = this.parentNode;
for (var i in this.__transition) if (+i !== id) return;
if (parent) parent.removeChild(this);
};
}
-var transition_remove = function() {
+function transition_remove() {
return this.on("end.remove", removeFunction(this._id));
-};
+}
-var transition_select = function(select) {
+function transition_select(select) {
var name = this._name,
id = this._id;
if (typeof select !== "function") select = selector(select);
@@ -3649,13 +3672,13 @@
}
}
}
return new Transition(subgroups, this._parents, name, id);
-};
+}
-var transition_selectAll = function(select) {
+function transition_selectAll(select) {
var name = this._name,
id = this._id;
if (typeof select !== "function") select = selectorAll(select);
@@ -3672,17 +3695,17 @@
}
}
}
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,
value10,
interpolate0;
@@ -3724,19 +3747,19 @@
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
};
}
-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))
.on("end.style." + name, styleRemoveEnd(name))
: 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() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
@@ -3745,17 +3768,17 @@
}
tween._value = value;
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() {
this.textContent = value;
};
@@ -3766,17 +3789,17 @@
var value1 = value(this);
this.textContent = value1 == null ? "" : value1;
};
}
-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();
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
@@ -3792,11 +3815,11 @@
}
}
}
return new Transition(groups, this._parents, name, id1);
-};
+}
var id = 0;
function Transition(groups, parents, name, id) {
this._groups = groups;
@@ -4068,11 +4091,11 @@
}
}
return timing;
}
-var selection_transition = function(name) {
+function selection_transition(name) {
var id,
timing;
if (name instanceof Transition) {
id = name._id, name = name._name;
@@ -4087,18 +4110,18 @@
}
}
}
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;
if (schedules) {
@@ -4109,32 +4132,32 @@
}
}
}
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"};
@@ -4253,13 +4276,13 @@
function brushY() {
return brush$1(Y);
}
-var brush = function() {
+function brush() {
return brush$1(XY);
-};
+}
function brush$1(dim) {
var extent = defaultExtent,
filter = defaultFilter,
listeners = dispatch(brush, "start", "brush", "end"),
@@ -4679,11 +4702,11 @@
b.source.value + b.target.value
);
};
}
-var chord = function() {
+function chord() {
var padAngle = 0,
sortGroups = null,
sortSubgroups = null,
sortChords = null;
@@ -4787,19 +4810,19 @@
chord.sortChords = function(_) {
return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._;
};
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;
@@ -4946,11 +4969,11 @@
function defaultEndAngle(d) {
return d.endAngle;
}
-var ribbon = function() {
+function ribbon() {
var source = defaultSource,
target = defaultTarget,
radius = defaultRadius,
startAngle = defaultStartAngle,
endAngle = defaultEndAngle,
@@ -5003,15 +5026,15 @@
ribbon.target = function(_) {
return arguments.length ? (target = _, ribbon) : target;
};
ribbon.context = function(_) {
- return arguments.length ? ((context = _ == null ? null : _), ribbon) : context;
+ return arguments.length ? (context = _ == null ? null : _, ribbon) : context;
};
return ribbon;
-};
+}
var prefix = "$";
function Map() {}
@@ -5083,11 +5106,11 @@
else if (object) for (var key in object) map.set(key, object[key]);
return map;
}
-var nest = function() {
+function nest() {
var keys = [],
sortKeys = [],
sortValues,
rollup,
nest;
@@ -5137,11 +5160,11 @@
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 {};
}
@@ -5191,27 +5214,27 @@
}
return set;
}
-var keys = function(map) {
+function keys(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
-};
+}
-var values = function(map) {
+function values(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
-};
+}
-var entries = function(map) {
+function entries(map) {
var entries = [];
for (var key in map) entries.push({key: key, value: map[key]});
return entries;
-};
+}
var EOL = {};
var EOF = {};
var QUOTE = 34;
var NEWLINE = 10;
@@ -5244,20 +5267,20 @@
});
return columns;
}
-var dsv = function(delimiter) {
+function dsv(delimiter) {
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
DELIMITER = delimiter.charCodeAt(0);
function parse(text, f) {
var convert, columns, rows = parseRows(text, function(row, i) {
if (convert) return convert(row, i - 1);
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
});
- rows.columns = columns;
+ rows.columns = columns || [];
return rows;
}
function parseRows(text, f) {
var rows = [], // output rows
@@ -5335,11 +5358,11 @@
parse: parse,
parseRows: parseRows,
format: format,
formatRows: formatRows
};
-};
+}
var csv = dsv(",");
var csvParse = csv.parse;
var csvParseRows = csv.parseRows;
@@ -5351,11 +5374,11 @@
var tsvParse = tsv.parse;
var tsvParseRows = tsv.parseRows;
var tsvFormat = tsv.format;
var tsvFormatRows = tsv.formatRows;
-var center$1 = function(x, y) {
+function center$1(x, y) {
var nodes;
if (x == null) x = 0;
if (y == null) y = 0;
@@ -5386,27 +5409,27 @@
force.y = function(_) {
return arguments.length ? (y = +_, force) : y;
};
return force;
-};
+}
-var constant$6 = function(x) {
+function constant$6(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
var parent,
@@ -5484,11 +5507,11 @@
}
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,
y0 = this._y0,
x1 = this._x1,
@@ -5541,35 +5564,35 @@
this._x0 = x0;
this._y0 = y0;
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,
x1,
y1,
@@ -5632,13 +5655,13 @@
}
}
}
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,
node = this._root,
retainer,
@@ -5673,11 +5696,11 @@
// Find the point to remove.
while (node.data !== d) if (!(previous = node, node = node.next)) return this;
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;
// Remove this leaf.
@@ -5690,30 +5713,30 @@
if (retainer) retainer[j] = node;
else this._root = node;
}
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()) {
if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
@@ -5722,13 +5745,13 @@
if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
}
}
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()) {
var node = q.node;
if (node.length) {
@@ -5742,27 +5765,27 @@
}
while (q = next.pop()) {
callback(q.node, q.x0, q.y0, q.x1, q.y1);
}
return this;
-};
+}
function defaultX(d) {
return d[0];
}
-var tree_x = function(_) {
+function tree_x(_) {
return arguments.length ? (this._x = _, this) : this._x;
-};
+}
function defaultY(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);
return nodes == null ? tree : tree.addAll(nodes);
}
@@ -5821,19 +5844,19 @@
treeProto.visit = tree_visit;
treeProto.visitAfter = tree_visitAfter;
treeProto.x = tree_x;
treeProto.y = tree_y;
-function x$1(d) {
+function x(d) {
return d.x + d.vx;
}
function y(d) {
return d.y + d.vy;
}
-var collide = function(radius) {
+function collide(radius) {
var nodes,
radii,
strength = 1,
iterations = 1;
@@ -5847,11 +5870,11 @@
yi,
ri,
ri2;
for (var k = 0; k < iterations; ++k) {
- tree = quadtree(nodes, x$1, y).visitAfter(prepare);
+ tree = quadtree(nodes, x, y).visitAfter(prepare);
for (i = 0; i < n; ++i) {
node = nodes[i];
ri = radii[node.index], ri2 = ri * ri;
xi = node.x + node.vx;
yi = node.y + node.vy;
@@ -5914,11 +5937,11 @@
force.radius = function(_) {
return arguments.length ? (radius = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : radius;
};
return force;
-};
+}
function index(d) {
return d.index;
}
@@ -5926,11 +5949,11 @@
var node = nodeById.get(nodeId);
if (!node) throw new Error("missing: " + nodeId);
return node;
}
-var link = function(links) {
+function link(links) {
var id = index,
strength = defaultStrength,
strengths,
distance = constant$6(30),
distances,
@@ -6027,24 +6050,24 @@
force.distance = function(_) {
return arguments.length ? (distance = typeof _ === "function" ? _ : constant$6(+_), initializeDistance(), force) : distance;
};
return force;
-};
+}
-function x$2(d) {
+function x$1(d) {
return d.x;
}
function y$1(d) {
return d.y;
}
var initialRadius = 10;
var initialAngle = Math.PI * (3 - Math.sqrt(5));
-var simulation = function(nodes) {
+function simulation(nodes) {
var simulation,
alpha = 1,
alphaMin = 0.001,
alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
alphaTarget = 0,
@@ -6137,11 +6160,11 @@
velocityDecay: function(_) {
return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
},
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) {
var i = 0,
n = nodes.length,
@@ -6167,24 +6190,24 @@
on: function(name, _) {
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
}
};
-};
+}
-var manyBody = function() {
+function manyBody() {
var nodes,
node,
alpha,
strength = constant$6(-30),
strengths,
distanceMin2 = 1,
distanceMax2 = Infinity,
theta2 = 0.81;
function force(_) {
- var i, n = nodes.length, tree = quadtree(nodes, x$2, y$1).visitAfter(accumulate);
+ var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);
for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
}
function initialize() {
if (!nodes) return;
@@ -6192,21 +6215,21 @@
strengths = new Array(n);
for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
}
function accumulate(quad) {
- var strength = 0, q, c, x, y, i;
+ var strength = 0, q, c, weight = 0, x, y, i;
// For internal nodes, accumulate forces from child quadrants.
if (quad.length) {
for (x = y = i = 0; i < 4; ++i) {
- if ((q = quad[i]) && (c = q.value)) {
- strength += c, x += c * q.x, y += c * q.y;
+ if ((q = quad[i]) && (c = Math.abs(q.value))) {
+ strength += q.value, weight += c, x += c * q.x, y += c * q.y;
}
}
- quad.x = x / strength;
- quad.y = y / strength;
+ quad.x = x / weight;
+ quad.y = y / weight;
}
// For leaf nodes, accumulate forces from coincident quadrants.
else {
q = quad;
@@ -6277,13 +6300,69 @@
force.theta = function(_) {
return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
};
return force;
-};
+}
-var x$3 = function(x) {
+function radial(radius, x, y) {
+ var nodes,
+ strength = constant$6(0.1),
+ strengths,
+ radiuses;
+
+ if (typeof radius !== "function") radius = constant$6(+radius);
+ if (x == null) x = 0;
+ if (y == null) y = 0;
+
+ function force(alpha) {
+ for (var i = 0, n = nodes.length; i < n; ++i) {
+ var node = nodes[i],
+ dx = node.x - x || 1e-6,
+ dy = node.y - y || 1e-6,
+ r = Math.sqrt(dx * dx + dy * dy),
+ k = (radiuses[i] - r) * strengths[i] * alpha / r;
+ node.vx += dx * k;
+ node.vy += dy * k;
+ }
+ }
+
+ function initialize() {
+ if (!nodes) return;
+ var i, n = nodes.length;
+ strengths = new Array(n);
+ radiuses = new Array(n);
+ for (i = 0; i < n; ++i) {
+ radiuses[i] = +radius(nodes[i], i, nodes);
+ strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
+ }
+ }
+
+ force.initialize = function(_) {
+ nodes = _, initialize();
+ };
+
+ force.strength = function(_) {
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength;
+ };
+
+ force.radius = function(_) {
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : radius;
+ };
+
+ force.x = function(_) {
+ return arguments.length ? (x = +_, force) : x;
+ };
+
+ force.y = function(_) {
+ return arguments.length ? (y = +_, force) : y;
+ };
+
+ return force;
+}
+
+function x$2(x) {
var strength = constant$6(0.1),
nodes,
strengths,
xz;
@@ -6317,13 +6396,13 @@
force.x = function(_) {
return arguments.length ? (x = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : x;
};
return force;
-};
+}
-var y$2 = function(y) {
+function y$2(y) {
var strength = constant$6(0.1),
nodes,
strengths,
yz;
@@ -6357,32 +6436,32 @@
force.y = function(_) {
return arguments.length ? (y = typeof _ === "function" ? _ : constant$6(+_), 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);
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
return [
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 = [],
j = 0,
g = grouping[0],
@@ -6395,21 +6474,21 @@
g = grouping[j = (j + 1) % grouping.length];
}
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];
});
};
-};
+}
-var formatDefault = function(x, p) {
+function formatDefault(x, p) {
x = x.toPrecision(p);
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {
switch (x[i]) {
case ".": i0 = i1 = i; break;
@@ -6418,36 +6497,36 @@
default: if (i0 > 0) i0 = 0; break;
}
}
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
-};
+}
var prefixExponent;
-var formatPrefixAuto = function(x, p) {
+function formatPrefixAuto(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1],
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
n = coefficient.length;
return i === n ? coefficient
: 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],
exponent = d[1];
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); },
@@ -6517,17 +6596,17 @@
+ (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,
numerals = locale.numerals ? formatNumerals(locale.numerals) : identity$3,
percent = locale.percent || "%";
@@ -6582,11 +6661,11 @@
// 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.
if (maybeSuffix) {
i = -1, n = value.length;
@@ -6640,13 +6719,13 @@
return {
format: newFormat,
formatPrefix: formatPrefix
};
-};
+}
-var locale$1;
+var locale;
defaultLocale({
decimal: ".",
@@ -6654,39 +6733,39 @@
grouping: [3],
currency: ["$", ""]
});
function defaultLocale(definition) {
- locale$1 = formatLocale(definition);
- exports.format = locale$1.format;
- exports.formatPrefix = locale$1.formatPrefix;
- return locale$1;
+ locale = formatLocale(definition);
+ exports.format = locale.format;
+ exports.formatPrefix = locale.formatPrefix;
+ 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
// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3)
// 305–363 (1997).
// 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();
}
@@ -6814,17 +6893,17 @@
stream.polygonStart();
while (++i < n) streamLine(coordinates[i], stream, 1);
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;
@@ -6886,15 +6965,15 @@
// Advance the previous points.
lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
}
-var area = function(object) {
+function area(object) {
areaSum.reset();
geoStream(object, areaStream);
return areaSum * 2;
-};
+}
function spherical(cartesian) {
return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];
}
@@ -7062,11 +7141,11 @@
function rangeContains(range, x) {
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);
ranges = [];
geoStream(feature, boundsStream);
@@ -7097,11 +7176,11 @@
ranges = range = null;
return lambda0$1 === Infinity || phi0 === Infinity
? [[NaN, NaN], [NaN, NaN]]
: [[lambda0$1, phi0], [lambda1, phi1]];
-};
+}
var W0;
var W1;
var X0;
var Y0;
@@ -7221,11 +7300,11 @@
Y1 += w * (y0 + (y0 = y));
Z1 += w * (z0 + (z0 = z));
centroidPointCartesian(x0, y0, z0);
}
-var centroid = function(object) {
+function centroid(object) {
W0 = W1 =
X0 = Y0 = Z0 =
X1 = Y1 = Z1 =
X2 = Y2 = Z2 = 0;
geoStream(object, centroidStream);
@@ -7244,30 +7323,30 @@
// If the feature still has an undefined ccentroid, then return.
if (m < epsilon2$1) return [NaN, NaN];
}
return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1];
-};
+}
-var constant$7 = function(x) {
+function constant$7(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]);
}
if (a.invert && b.invert) compose.invert = function(x, y) {
return x = b.invert(x, y), x && a.invert(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];
}
@@ -7323,11 +7402,11 @@
};
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) {
coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates;
@@ -7337,11 +7416,11 @@
coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates;
};
return forward;
-};
+}
// Generates a circle centered at [0°, 0°], with a given radius and precision.
function circleStream(stream, radius, delta, direction, t0, t1) {
if (!delta) return;
var cosRadius = cos$1(radius),
@@ -7367,11 +7446,11 @@
cartesianNormalizeInPlace(point);
var radius = acos(-point[1]);
return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3;
}
-var circle = function() {
+function circle() {
var center = constant$7([0, 0]),
radius = constant$7(90),
precision = constant$7(6),
ring,
rotate,
@@ -7405,13 +7484,13 @@
circle.precision = function(_) {
return arguments.length ? (precision = typeof _ === "function" ? _ : constant$7(+_), circle) : precision;
};
return circle;
-};
+}
-var clipBuffer = function() {
+function clipBuffer() {
var lines = [],
line;
return {
point: function(x, y) {
line.push([x, y]);
@@ -7428,75 +7507,15 @@
lines = [];
line = null;
return result;
}
};
-};
+}
-var clipLine = function(a, b, x0, y0, x1, y1) {
- var ax = a[0],
- ay = a[1],
- bx = b[0],
- by = b[1],
- t0 = 0,
- t1 = 1,
- dx = bx - ax,
- dy = by - ay,
- r;
-
- r = x0 - ax;
- if (!dx && r > 0) return;
- r /= dx;
- if (dx < 0) {
- if (r < t0) return;
- if (r < t1) t1 = r;
- } else if (dx > 0) {
- if (r > t1) return;
- if (r > t0) t0 = r;
- }
-
- r = x1 - ax;
- if (!dx && r < 0) return;
- r /= dx;
- if (dx < 0) {
- if (r > t1) return;
- if (r > t0) t0 = r;
- } else if (dx > 0) {
- if (r < t0) return;
- if (r < t1) t1 = r;
- }
-
- r = y0 - ay;
- if (!dy && r > 0) return;
- r /= dy;
- if (dy < 0) {
- if (r < t0) return;
- if (r < t1) t1 = r;
- } else if (dy > 0) {
- if (r > t1) return;
- if (r > t0) t0 = r;
- }
-
- r = y1 - ay;
- if (!dy && r < 0) return;
- r /= dy;
- if (dy < 0) {
- if (r > t1) return;
- if (r > t0) t0 = r;
- } else if (dy > 0) {
- if (r < t0) return;
- if (r < t1) t1 = r;
- }
-
- 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 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;
this.z = points;
this.o = other; // another intersection
@@ -7506,11 +7525,11 @@
}
// 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 clipPolygon = function(segments, compareIntersection, startInside, interpolate, stream) {
+function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {
var subject = [],
clip = [],
i,
n;
@@ -7577,11 +7596,11 @@
points = current.z;
isSubject = !isSubject;
} while (!current.v);
stream.lineEnd();
}
-};
+}
function link$1(array) {
if (!(n = array.length)) return;
var n,
i = 0,
@@ -7594,17 +7613,535 @@
}
a.n = b = array[0];
b.p = a;
}
+var sum$1 = adder();
+
+function polygonContains(polygon, point) {
+ var lambda = point[0],
+ phi = point[1],
+ normal = [sin$1(lambda), -cos$1(lambda), 0],
+ angle = 0,
+ winding = 0;
+
+ sum$1.reset();
+
+ for (var i = 0, n = polygon.length; i < n; ++i) {
+ if (!(m = (ring = polygon[i]).length)) continue;
+ var ring,
+ m,
+ point0 = ring[m - 1],
+ lambda0 = point0[0],
+ phi0 = point0[1] / 2 + quarterPi,
+ sinPhi0 = sin$1(phi0),
+ cosPhi0 = cos$1(phi0);
+
+ for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
+ var point1 = ring[j],
+ lambda1 = point1[0],
+ phi1 = point1[1] / 2 + quarterPi,
+ sinPhi1 = sin$1(phi1),
+ cosPhi1 = cos$1(phi1),
+ delta = lambda1 - lambda0,
+ sign$$1 = delta >= 0 ? 1 : -1,
+ absDelta = sign$$1 * delta,
+ antimeridian = absDelta > pi$3,
+ k = sinPhi0 * sinPhi1;
+
+ sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));
+ angle += antimeridian ? delta + sign$$1 * tau$3 : delta;
+
+ // Are the longitudes either side of the point’s meridian (lambda),
+ // and are the latitudes smaller than the parallel (phi)?
+ if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
+ var arc = cartesianCross(cartesian(point0), cartesian(point1));
+ cartesianNormalizeInPlace(arc);
+ var intersection = cartesianCross(normal, arc);
+ cartesianNormalizeInPlace(intersection);
+ var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
+ if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
+ winding += antimeridian ^ delta >= 0 ? 1 : -1;
+ }
+ }
+ }
+ }
+
+ // First, determine whether the South pole is inside or outside:
+ //
+ // It is inside if:
+ // * the polygon winds around it in a clockwise direction.
+ // * the polygon does not (cumulatively) wind around it, but has a negative
+ // (counter-clockwise) area.
+ //
+ // Second, count the (signed) number of times a segment crosses a lambda
+ // from the point to the South pole. If it is zero, then the point is the
+ // same side as the South pole.
+
+ return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1);
+}
+
+function clip(pointVisible, clipLine, interpolate, start) {
+ return function(sink) {
+ var line = clipLine(sink),
+ ringBuffer = clipBuffer(),
+ ringSink = clipLine(ringBuffer),
+ polygonStarted = false,
+ polygon,
+ segments,
+ ring;
+
+ var clip = {
+ point: point,
+ lineStart: lineStart,
+ lineEnd: lineEnd,
+ polygonStart: function() {
+ clip.point = pointRing;
+ clip.lineStart = ringStart;
+ clip.lineEnd = ringEnd;
+ segments = [];
+ polygon = [];
+ },
+ polygonEnd: function() {
+ clip.point = point;
+ clip.lineStart = lineStart;
+ clip.lineEnd = lineEnd;
+ segments = merge(segments);
+ var startInside = polygonContains(polygon, start);
+ if (segments.length) {
+ if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
+ clipRejoin(segments, compareIntersection, startInside, interpolate, sink);
+ } else if (startInside) {
+ if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
+ sink.lineStart();
+ interpolate(null, null, 1, sink);
+ sink.lineEnd();
+ }
+ if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
+ segments = polygon = null;
+ },
+ sphere: function() {
+ sink.polygonStart();
+ sink.lineStart();
+ interpolate(null, null, 1, sink);
+ sink.lineEnd();
+ sink.polygonEnd();
+ }
+ };
+
+ function point(lambda, phi) {
+ if (pointVisible(lambda, phi)) sink.point(lambda, phi);
+ }
+
+ function pointLine(lambda, phi) {
+ line.point(lambda, phi);
+ }
+
+ function lineStart() {
+ clip.point = pointLine;
+ line.lineStart();
+ }
+
+ function lineEnd() {
+ clip.point = point;
+ line.lineEnd();
+ }
+
+ function pointRing(lambda, phi) {
+ ring.push([lambda, phi]);
+ ringSink.point(lambda, phi);
+ }
+
+ function ringStart() {
+ ringSink.lineStart();
+ ring = [];
+ }
+
+ function ringEnd() {
+ pointRing(ring[0][0], ring[0][1]);
+ ringSink.lineEnd();
+
+ var clean = ringSink.clean(),
+ ringSegments = ringBuffer.result(),
+ i, n = ringSegments.length, m,
+ segment,
+ point;
+
+ ring.pop();
+ polygon.push(ring);
+ ring = null;
+
+ if (!n) return;
+
+ // No intersections.
+ if (clean & 1) {
+ segment = ringSegments[0];
+ if ((m = segment.length - 1) > 0) {
+ if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
+ sink.lineStart();
+ for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);
+ sink.lineEnd();
+ }
+ return;
+ }
+
+ // Rejoin connected segments.
+ // TODO reuse ringBuffer.rejoin()?
+ if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
+
+ segments.push(ringSegments.filter(validSegment));
+ }
+
+ return clip;
+ };
+}
+
+function validSegment(segment) {
+ return segment.length > 1;
+}
+
+// Intersections are sorted along the clip edge. For both antimeridian cutting
+// and circle clipping, the same comparison is used.
+function compareIntersection(a, b) {
+ return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1])
+ - ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]);
+}
+
+var clipAntimeridian = clip(
+ function() { return true; },
+ clipAntimeridianLine,
+ clipAntimeridianInterpolate,
+ [-pi$3, -halfPi$2]
+);
+
+// Takes a line and cuts into visible segments. Return values: 0 - there were
+// intersections or the line was empty; 1 - no intersections; 2 - there were
+// intersections, and the first and last segments should be rejoined.
+function clipAntimeridianLine(stream) {
+ var lambda0 = NaN,
+ phi0 = NaN,
+ sign0 = NaN,
+ clean; // no intersections
+
+ return {
+ lineStart: function() {
+ stream.lineStart();
+ clean = 1;
+ },
+ point: function(lambda1, phi1) {
+ var sign1 = lambda1 > 0 ? pi$3 : -pi$3,
+ delta = abs(lambda1 - lambda0);
+ if (abs(delta - pi$3) < epsilon$2) { // line crosses a pole
+ stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$2 : -halfPi$2);
+ stream.point(sign0, phi0);
+ stream.lineEnd();
+ stream.lineStart();
+ stream.point(sign1, phi0);
+ stream.point(lambda1, phi0);
+ clean = 0;
+ } else if (sign0 !== sign1 && delta >= pi$3) { // line crosses antimeridian
+ if (abs(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies
+ if (abs(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2;
+ phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
+ stream.point(sign0, phi0);
+ stream.lineEnd();
+ stream.lineStart();
+ stream.point(sign1, phi0);
+ clean = 0;
+ }
+ stream.point(lambda0 = lambda1, phi0 = phi1);
+ sign0 = sign1;
+ },
+ lineEnd: function() {
+ stream.lineEnd();
+ lambda0 = phi0 = NaN;
+ },
+ clean: function() {
+ return 2 - clean; // if intersections, rejoin first and last segments
+ }
+ };
+}
+
+function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
+ var cosPhi0,
+ cosPhi1,
+ sinLambda0Lambda1 = sin$1(lambda0 - lambda1);
+ return abs(sinLambda0Lambda1) > epsilon$2
+ ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1)
+ - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0))
+ / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))
+ : (phi0 + phi1) / 2;
+}
+
+function clipAntimeridianInterpolate(from, to, direction, stream) {
+ var phi;
+ if (from == null) {
+ phi = direction * halfPi$2;
+ stream.point(-pi$3, phi);
+ stream.point(0, phi);
+ stream.point(pi$3, phi);
+ stream.point(pi$3, 0);
+ stream.point(pi$3, -phi);
+ stream.point(0, -phi);
+ stream.point(-pi$3, -phi);
+ stream.point(-pi$3, 0);
+ stream.point(-pi$3, phi);
+ } else if (abs(from[0] - to[0]) > epsilon$2) {
+ var lambda = from[0] < to[0] ? pi$3 : -pi$3;
+ phi = direction * lambda / 2;
+ stream.point(-lambda, phi);
+ stream.point(0, phi);
+ stream.point(lambda, phi);
+ } else {
+ stream.point(to[0], to[1]);
+ }
+}
+
+function clipCircle(radius) {
+ var cr = cos$1(radius),
+ delta = 6 * radians,
+ smallRadius = cr > 0,
+ notHemisphere = abs(cr) > epsilon$2; // TODO optimise for this common case
+
+ function interpolate(from, to, direction, stream) {
+ circleStream(stream, radius, delta, direction, from, to);
+ }
+
+ function visible(lambda, phi) {
+ return cos$1(lambda) * cos$1(phi) > cr;
+ }
+
+ // Takes a line and cuts into visible segments. Return values used for polygon
+ // clipping: 0 - there were intersections or the line was empty; 1 - no
+ // intersections 2 - there were intersections, and the first and last segments
+ // should be rejoined.
+ function clipLine(stream) {
+ var point0, // previous point
+ c0, // code for previous point
+ v0, // visibility of previous point
+ v00, // visibility of first point
+ clean; // no intersections
+ return {
+ lineStart: function() {
+ v00 = v0 = false;
+ clean = 1;
+ },
+ point: function(lambda, phi) {
+ var point1 = [lambda, phi],
+ point2,
+ v = visible(lambda, phi),
+ c = smallRadius
+ ? v ? 0 : code(lambda, phi)
+ : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0;
+ if (!point0 && (v00 = v0 = v)) stream.lineStart();
+ // Handle degeneracies.
+ // TODO ignore if not clipping polygons.
+ if (v !== v0) {
+ point2 = intersect(point0, point1);
+ if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) {
+ point1[0] += epsilon$2;
+ point1[1] += epsilon$2;
+ v = visible(point1[0], point1[1]);
+ }
+ }
+ if (v !== v0) {
+ clean = 0;
+ if (v) {
+ // outside going in
+ stream.lineStart();
+ point2 = intersect(point1, point0);
+ stream.point(point2[0], point2[1]);
+ } else {
+ // inside going out
+ point2 = intersect(point0, point1);
+ stream.point(point2[0], point2[1]);
+ stream.lineEnd();
+ }
+ point0 = point2;
+ } else if (notHemisphere && point0 && smallRadius ^ v) {
+ var t;
+ // If the codes for two points are different, or are both zero,
+ // and there this segment intersects with the small circle.
+ if (!(c & c0) && (t = intersect(point1, point0, true))) {
+ clean = 0;
+ if (smallRadius) {
+ stream.lineStart();
+ stream.point(t[0][0], t[0][1]);
+ stream.point(t[1][0], t[1][1]);
+ stream.lineEnd();
+ } else {
+ stream.point(t[1][0], t[1][1]);
+ stream.lineEnd();
+ stream.lineStart();
+ stream.point(t[0][0], t[0][1]);
+ }
+ }
+ }
+ if (v && (!point0 || !pointEqual(point0, point1))) {
+ stream.point(point1[0], point1[1]);
+ }
+ point0 = point1, v0 = v, c0 = c;
+ },
+ lineEnd: function() {
+ if (v0) stream.lineEnd();
+ point0 = null;
+ },
+ // Rejoin first and last segments if there were intersections and the first
+ // and last points were visible.
+ clean: function() {
+ return clean | ((v00 && v0) << 1);
+ }
+ };
+ }
+
+ // Intersects the great circle between a and b with the clip circle.
+ function intersect(a, b, two) {
+ var pa = cartesian(a),
+ pb = cartesian(b);
+
+ // We have two planes, n1.p = d1 and n2.p = d2.
+ // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
+ var n1 = [1, 0, 0], // normal
+ n2 = cartesianCross(pa, pb),
+ n2n2 = cartesianDot(n2, n2),
+ n1n2 = n2[0], // cartesianDot(n1, n2),
+ determinant = n2n2 - n1n2 * n1n2;
+
+ // Two polar points.
+ if (!determinant) return !two && a;
+
+ var c1 = cr * n2n2 / determinant,
+ c2 = -cr * n1n2 / determinant,
+ n1xn2 = cartesianCross(n1, n2),
+ A = cartesianScale(n1, c1),
+ B = cartesianScale(n2, c2);
+ cartesianAddInPlace(A, B);
+
+ // Solve |p(t)|^2 = 1.
+ var u = n1xn2,
+ w = cartesianDot(A, u),
+ uu = cartesianDot(u, u),
+ t2 = w * w - uu * (cartesianDot(A, A) - 1);
+
+ if (t2 < 0) return;
+
+ var t = sqrt(t2),
+ q = cartesianScale(u, (-w - t) / uu);
+ cartesianAddInPlace(q, A);
+ q = spherical(q);
+
+ if (!two) return q;
+
+ // Two intersection points.
+ var lambda0 = a[0],
+ lambda1 = b[0],
+ phi0 = a[1],
+ phi1 = b[1],
+ z;
+
+ if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
+
+ var delta = lambda1 - lambda0,
+ polar = abs(delta - pi$3) < epsilon$2,
+ meridian = polar || delta < epsilon$2;
+
+ if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;
+
+ // Check that the first point is between a and b.
+ if (meridian
+ ? polar
+ ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi0 : phi1)
+ : phi0 <= q[1] && q[1] <= phi1
+ : delta > pi$3 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
+ var q1 = cartesianScale(u, (-w + t) / uu);
+ cartesianAddInPlace(q1, A);
+ return [q, spherical(q1)];
+ }
+ }
+
+ // Generates a 4-bit vector representing the location of a point relative to
+ // the small circle's bounding box.
+ function code(lambda, phi) {
+ var r = smallRadius ? radius : pi$3 - radius,
+ code = 0;
+ if (lambda < -r) code |= 1; // left
+ else if (lambda > r) code |= 2; // right
+ if (phi < -r) code |= 4; // below
+ else if (phi > r) code |= 8; // above
+ return code;
+ }
+
+ return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);
+}
+
+function clipLine(a, b, x0, y0, x1, y1) {
+ var ax = a[0],
+ ay = a[1],
+ bx = b[0],
+ by = b[1],
+ t0 = 0,
+ t1 = 1,
+ dx = bx - ax,
+ dy = by - ay,
+ r;
+
+ r = x0 - ax;
+ if (!dx && r > 0) return;
+ r /= dx;
+ if (dx < 0) {
+ if (r < t0) return;
+ if (r < t1) t1 = r;
+ } else if (dx > 0) {
+ if (r > t1) return;
+ if (r > t0) t0 = r;
+ }
+
+ r = x1 - ax;
+ if (!dx && r < 0) return;
+ r /= dx;
+ if (dx < 0) {
+ if (r > t1) return;
+ if (r > t0) t0 = r;
+ } else if (dx > 0) {
+ if (r < t0) return;
+ if (r < t1) t1 = r;
+ }
+
+ r = y0 - ay;
+ if (!dy && r > 0) return;
+ r /= dy;
+ if (dy < 0) {
+ if (r < t0) return;
+ if (r < t1) t1 = r;
+ } else if (dy > 0) {
+ if (r > t1) return;
+ if (r > t0) t0 = r;
+ }
+
+ r = y1 - ay;
+ if (!dy && r < 0) return;
+ r /= dy;
+ if (dy < 0) {
+ if (r > t1) return;
+ if (r > t0) t0 = r;
+ } else if (dy > 0) {
+ if (r < t0) return;
+ if (r < t1) t1 = r;
+ }
+
+ 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;
// TODO Use d3-polygon’s polygonContains here for the ring check?
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
-function clipExtent(x0, y0, x1, y1) {
+function clipRectangle(x0, y0, x1, y1) {
function visible(x, y) {
return x0 <= x && x <= x1 && y0 <= y && y <= y1;
}
@@ -7693,11 +8230,11 @@
stream.lineStart();
interpolate(null, null, 1, stream);
stream.lineEnd();
}
if (visible) {
- clipPolygon(segments, compareIntersection, startInside, interpolate, stream);
+ clipRejoin(segments, compareIntersection, startInside, interpolate, stream);
}
stream.polygonEnd();
}
activeStream = stream, segments = polygon = ring = null;
}
@@ -7758,94 +8295,29 @@
return clipStream;
};
}
-var extent$1 = function() {
+function extent$1() {
var x0 = 0,
y0 = 0,
x1 = 960,
y1 = 500,
cache,
cacheStream,
clip;
return clip = {
stream: function(stream) {
- return cache && cacheStream === stream ? cache : cache = clipExtent(x0, y0, x1, y1)(cacheStream = stream);
+ return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream);
},
extent: function(_) {
return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]];
}
};
-};
+}
-var sum$1 = adder();
-
-var polygonContains = function(polygon, point) {
- var lambda = point[0],
- phi = point[1],
- normal = [sin$1(lambda), -cos$1(lambda), 0],
- angle = 0,
- winding = 0;
-
- sum$1.reset();
-
- for (var i = 0, n = polygon.length; i < n; ++i) {
- if (!(m = (ring = polygon[i]).length)) continue;
- var ring,
- m,
- point0 = ring[m - 1],
- lambda0 = point0[0],
- phi0 = point0[1] / 2 + quarterPi,
- sinPhi0 = sin$1(phi0),
- cosPhi0 = cos$1(phi0);
-
- for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
- var point1 = ring[j],
- lambda1 = point1[0],
- phi1 = point1[1] / 2 + quarterPi,
- sinPhi1 = sin$1(phi1),
- cosPhi1 = cos$1(phi1),
- delta = lambda1 - lambda0,
- sign$$1 = delta >= 0 ? 1 : -1,
- absDelta = sign$$1 * delta,
- antimeridian = absDelta > pi$3,
- k = sinPhi0 * sinPhi1;
-
- sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));
- angle += antimeridian ? delta + sign$$1 * tau$3 : delta;
-
- // Are the longitudes either side of the point’s meridian (lambda),
- // and are the latitudes smaller than the parallel (phi)?
- if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
- var arc = cartesianCross(cartesian(point0), cartesian(point1));
- cartesianNormalizeInPlace(arc);
- var intersection = cartesianCross(normal, arc);
- cartesianNormalizeInPlace(intersection);
- var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
- if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
- winding += antimeridian ^ delta >= 0 ? 1 : -1;
- }
- }
- }
- }
-
- // First, determine whether the South pole is inside or outside:
- //
- // It is inside if:
- // * the polygon winds around it in a clockwise direction.
- // * the polygon does not (cumulatively) wind around it, but has a negative
- // (counter-clockwise) area.
- //
- // Second, count the (signed) number of times a segment crosses a lambda
- // from the point to the South pole. If it is zero, then the point is the
- // same side as the South pole.
-
- return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1);
-};
-
var lengthSum = adder();
var lambda0$2;
var sinPhi0$1;
var cosPhi0$1;
@@ -7885,24 +8357,24 @@
z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta;
lengthSum.add(atan2(sqrt(x * x + y * y), z));
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 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 containsGeometry(object.geometry, point);
},
@@ -7975,15 +8447,15 @@
function pointRadians(point) {
return [point[0] * radians, point[1] * radians];
}
-var contains = function(object, point) {
+function contains(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 function(x) { return y.map(function(y) { return [x, y]; }); };
}
@@ -8084,11 +8556,11 @@
function graticule10() {
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,
y1 = b[1] * radians,
cy0 = cos$1(y0),
@@ -8117,15 +8589,15 @@
};
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;
@@ -8433,11 +8905,11 @@
+ "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius
+ "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius
+ "z";
}
-var index$1 = function(projection, context) {
+function index$1(projection, context) {
var pointRadius = 4.5,
projectionStream,
contextStream;
function path(object) {
@@ -8484,414 +8956,18 @@
pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
return path;
};
return path.projection(projection).context(context);
-};
-
-var clip = function(pointVisible, clipLine, interpolate, start) {
- return function(rotate, sink) {
- var line = clipLine(sink),
- rotatedStart = rotate.invert(start[0], start[1]),
- ringBuffer = clipBuffer(),
- ringSink = clipLine(ringBuffer),
- polygonStarted = false,
- polygon,
- segments,
- ring;
-
- var clip = {
- point: point,
- lineStart: lineStart,
- lineEnd: lineEnd,
- polygonStart: function() {
- clip.point = pointRing;
- clip.lineStart = ringStart;
- clip.lineEnd = ringEnd;
- segments = [];
- polygon = [];
- },
- polygonEnd: function() {
- clip.point = point;
- clip.lineStart = lineStart;
- clip.lineEnd = lineEnd;
- segments = merge(segments);
- var startInside = polygonContains(polygon, rotatedStart);
- if (segments.length) {
- if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
- clipPolygon(segments, compareIntersection, startInside, interpolate, sink);
- } else if (startInside) {
- if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
- sink.lineStart();
- interpolate(null, null, 1, sink);
- sink.lineEnd();
- }
- if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
- segments = polygon = null;
- },
- sphere: function() {
- sink.polygonStart();
- sink.lineStart();
- interpolate(null, null, 1, sink);
- sink.lineEnd();
- sink.polygonEnd();
- }
- };
-
- function point(lambda, phi) {
- var point = rotate(lambda, phi);
- if (pointVisible(lambda = point[0], phi = point[1])) sink.point(lambda, phi);
- }
-
- function pointLine(lambda, phi) {
- var point = rotate(lambda, phi);
- line.point(point[0], point[1]);
- }
-
- function lineStart() {
- clip.point = pointLine;
- line.lineStart();
- }
-
- function lineEnd() {
- clip.point = point;
- line.lineEnd();
- }
-
- function pointRing(lambda, phi) {
- ring.push([lambda, phi]);
- var point = rotate(lambda, phi);
- ringSink.point(point[0], point[1]);
- }
-
- function ringStart() {
- ringSink.lineStart();
- ring = [];
- }
-
- function ringEnd() {
- pointRing(ring[0][0], ring[0][1]);
- ringSink.lineEnd();
-
- var clean = ringSink.clean(),
- ringSegments = ringBuffer.result(),
- i, n = ringSegments.length, m,
- segment,
- point;
-
- ring.pop();
- polygon.push(ring);
- ring = null;
-
- if (!n) return;
-
- // No intersections.
- if (clean & 1) {
- segment = ringSegments[0];
- if ((m = segment.length - 1) > 0) {
- if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
- sink.lineStart();
- for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);
- sink.lineEnd();
- }
- return;
- }
-
- // Rejoin connected segments.
- // TODO reuse ringBuffer.rejoin()?
- if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
-
- segments.push(ringSegments.filter(validSegment));
- }
-
- return clip;
- };
-};
-
-function validSegment(segment) {
- return segment.length > 1;
}
-// Intersections are sorted along the clip edge. For both antimeridian cutting
-// and circle clipping, the same comparison is used.
-function compareIntersection(a, b) {
- return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1])
- - ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]);
-}
-
-var clipAntimeridian = clip(
- function() { return true; },
- clipAntimeridianLine,
- clipAntimeridianInterpolate,
- [-pi$3, -halfPi$2]
-);
-
-// Takes a line and cuts into visible segments. Return values: 0 - there were
-// intersections or the line was empty; 1 - no intersections; 2 - there were
-// intersections, and the first and last segments should be rejoined.
-function clipAntimeridianLine(stream) {
- var lambda0 = NaN,
- phi0 = NaN,
- sign0 = NaN,
- clean; // no intersections
-
+function transform(methods) {
return {
- lineStart: function() {
- stream.lineStart();
- clean = 1;
- },
- point: function(lambda1, phi1) {
- var sign1 = lambda1 > 0 ? pi$3 : -pi$3,
- delta = abs(lambda1 - lambda0);
- if (abs(delta - pi$3) < epsilon$2) { // line crosses a pole
- stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$2 : -halfPi$2);
- stream.point(sign0, phi0);
- stream.lineEnd();
- stream.lineStart();
- stream.point(sign1, phi0);
- stream.point(lambda1, phi0);
- clean = 0;
- } else if (sign0 !== sign1 && delta >= pi$3) { // line crosses antimeridian
- if (abs(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies
- if (abs(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2;
- phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
- stream.point(sign0, phi0);
- stream.lineEnd();
- stream.lineStart();
- stream.point(sign1, phi0);
- clean = 0;
- }
- stream.point(lambda0 = lambda1, phi0 = phi1);
- sign0 = sign1;
- },
- lineEnd: function() {
- stream.lineEnd();
- lambda0 = phi0 = NaN;
- },
- clean: function() {
- return 2 - clean; // if intersections, rejoin first and last segments
- }
+ stream: transformer(methods)
};
}
-function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
- var cosPhi0,
- cosPhi1,
- sinLambda0Lambda1 = sin$1(lambda0 - lambda1);
- return abs(sinLambda0Lambda1) > epsilon$2
- ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1)
- - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0))
- / (cosPhi0 * cosPhi1 * sinLambda0Lambda1))
- : (phi0 + phi1) / 2;
-}
-
-function clipAntimeridianInterpolate(from, to, direction, stream) {
- var phi;
- if (from == null) {
- phi = direction * halfPi$2;
- stream.point(-pi$3, phi);
- stream.point(0, phi);
- stream.point(pi$3, phi);
- stream.point(pi$3, 0);
- stream.point(pi$3, -phi);
- stream.point(0, -phi);
- stream.point(-pi$3, -phi);
- stream.point(-pi$3, 0);
- stream.point(-pi$3, phi);
- } else if (abs(from[0] - to[0]) > epsilon$2) {
- var lambda = from[0] < to[0] ? pi$3 : -pi$3;
- phi = direction * lambda / 2;
- stream.point(-lambda, phi);
- stream.point(0, phi);
- stream.point(lambda, phi);
- } else {
- stream.point(to[0], to[1]);
- }
-}
-
-var clipCircle = function(radius, delta) {
- var cr = cos$1(radius),
- smallRadius = cr > 0,
- notHemisphere = abs(cr) > epsilon$2; // TODO optimise for this common case
-
- function interpolate(from, to, direction, stream) {
- circleStream(stream, radius, delta, direction, from, to);
- }
-
- function visible(lambda, phi) {
- return cos$1(lambda) * cos$1(phi) > cr;
- }
-
- // Takes a line and cuts into visible segments. Return values used for polygon
- // clipping: 0 - there were intersections or the line was empty; 1 - no
- // intersections 2 - there were intersections, and the first and last segments
- // should be rejoined.
- function clipLine(stream) {
- var point0, // previous point
- c0, // code for previous point
- v0, // visibility of previous point
- v00, // visibility of first point
- clean; // no intersections
- return {
- lineStart: function() {
- v00 = v0 = false;
- clean = 1;
- },
- point: function(lambda, phi) {
- var point1 = [lambda, phi],
- point2,
- v = visible(lambda, phi),
- c = smallRadius
- ? v ? 0 : code(lambda, phi)
- : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0;
- if (!point0 && (v00 = v0 = v)) stream.lineStart();
- // Handle degeneracies.
- // TODO ignore if not clipping polygons.
- if (v !== v0) {
- point2 = intersect(point0, point1);
- if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) {
- point1[0] += epsilon$2;
- point1[1] += epsilon$2;
- v = visible(point1[0], point1[1]);
- }
- }
- if (v !== v0) {
- clean = 0;
- if (v) {
- // outside going in
- stream.lineStart();
- point2 = intersect(point1, point0);
- stream.point(point2[0], point2[1]);
- } else {
- // inside going out
- point2 = intersect(point0, point1);
- stream.point(point2[0], point2[1]);
- stream.lineEnd();
- }
- point0 = point2;
- } else if (notHemisphere && point0 && smallRadius ^ v) {
- var t;
- // If the codes for two points are different, or are both zero,
- // and there this segment intersects with the small circle.
- if (!(c & c0) && (t = intersect(point1, point0, true))) {
- clean = 0;
- if (smallRadius) {
- stream.lineStart();
- stream.point(t[0][0], t[0][1]);
- stream.point(t[1][0], t[1][1]);
- stream.lineEnd();
- } else {
- stream.point(t[1][0], t[1][1]);
- stream.lineEnd();
- stream.lineStart();
- stream.point(t[0][0], t[0][1]);
- }
- }
- }
- if (v && (!point0 || !pointEqual(point0, point1))) {
- stream.point(point1[0], point1[1]);
- }
- point0 = point1, v0 = v, c0 = c;
- },
- lineEnd: function() {
- if (v0) stream.lineEnd();
- point0 = null;
- },
- // Rejoin first and last segments if there were intersections and the first
- // and last points were visible.
- clean: function() {
- return clean | ((v00 && v0) << 1);
- }
- };
- }
-
- // Intersects the great circle between a and b with the clip circle.
- function intersect(a, b, two) {
- var pa = cartesian(a),
- pb = cartesian(b);
-
- // We have two planes, n1.p = d1 and n2.p = d2.
- // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
- var n1 = [1, 0, 0], // normal
- n2 = cartesianCross(pa, pb),
- n2n2 = cartesianDot(n2, n2),
- n1n2 = n2[0], // cartesianDot(n1, n2),
- determinant = n2n2 - n1n2 * n1n2;
-
- // Two polar points.
- if (!determinant) return !two && a;
-
- var c1 = cr * n2n2 / determinant,
- c2 = -cr * n1n2 / determinant,
- n1xn2 = cartesianCross(n1, n2),
- A = cartesianScale(n1, c1),
- B = cartesianScale(n2, c2);
- cartesianAddInPlace(A, B);
-
- // Solve |p(t)|^2 = 1.
- var u = n1xn2,
- w = cartesianDot(A, u),
- uu = cartesianDot(u, u),
- t2 = w * w - uu * (cartesianDot(A, A) - 1);
-
- if (t2 < 0) return;
-
- var t = sqrt(t2),
- q = cartesianScale(u, (-w - t) / uu);
- cartesianAddInPlace(q, A);
- q = spherical(q);
-
- if (!two) return q;
-
- // Two intersection points.
- var lambda0 = a[0],
- lambda1 = b[0],
- phi0 = a[1],
- phi1 = b[1],
- z;
-
- if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
-
- var delta = lambda1 - lambda0,
- polar = abs(delta - pi$3) < epsilon$2,
- meridian = polar || delta < epsilon$2;
-
- if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;
-
- // Check that the first point is between a and b.
- if (meridian
- ? polar
- ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi0 : phi1)
- : phi0 <= q[1] && q[1] <= phi1
- : delta > pi$3 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
- var q1 = cartesianScale(u, (-w + t) / uu);
- cartesianAddInPlace(q1, A);
- return [q, spherical(q1)];
- }
- }
-
- // Generates a 4-bit vector representing the location of a point relative to
- // the small circle's bounding box.
- function code(lambda, phi) {
- var r = smallRadius ? radius : pi$3 - radius,
- code = 0;
- if (lambda < -r) code |= 1; // left
- else if (lambda > r) code |= 2; // right
- if (phi < -r) code |= 4; // below
- else if (phi > r) code |= 8; // above
- return code;
- }
-
- return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);
-};
-
-var transform = function(methods) {
- return {
- stream: transformer(methods)
- };
-};
-
function transformer(methods) {
return function(stream) {
var s = new TransformStream;
for (var key in methods) s[key] = methods[key];
s.stream = stream;
@@ -8909,45 +8985,61 @@
lineEnd: function() { this.stream.lineEnd(); },
polygonStart: function() { this.stream.polygonStart(); },
polygonEnd: function() { this.stream.polygonEnd(); }
};
-function fitExtent(projection, extent, object) {
- var w = extent[1][0] - extent[0][0],
- h = extent[1][1] - extent[0][1],
- clip = projection.clipExtent && projection.clipExtent();
-
- projection
- .scale(150)
- .translate([0, 0]);
-
+function fit(projection, fitBounds, object) {
+ var clip = projection.clipExtent && projection.clipExtent();
+ projection.scale(150).translate([0, 0]);
if (clip != null) projection.clipExtent(null);
-
geoStream(object, projection.stream(boundsStream$1));
-
- var b = boundsStream$1.result(),
- k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
- x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
- y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
-
+ fitBounds(boundsStream$1.result());
if (clip != null) projection.clipExtent(clip);
+ return projection;
+}
- return projection
- .scale(k * 150)
- .translate([x, y]);
+function fitExtent(projection, extent, object) {
+ return fit(projection, function(b) {
+ var w = extent[1][0] - extent[0][0],
+ h = extent[1][1] - extent[0][1],
+ k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
+ x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
+ y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
+ projection.scale(150 * k).translate([x, y]);
+ }, object);
}
function fitSize(projection, size, object) {
return fitExtent(projection, [[0, 0], size], object);
}
+function fitWidth(projection, width, object) {
+ return fit(projection, function(b) {
+ var w = +width,
+ k = w / (b[1][0] - b[0][0]),
+ x = (w - k * (b[1][0] + b[0][0])) / 2,
+ y = -k * b[0][1];
+ projection.scale(150 * k).translate([x, y]);
+ }, object);
+}
+
+function fitHeight(projection, height, object) {
+ return fit(projection, function(b) {
+ var h = +height,
+ k = h / (b[1][1] - b[0][1]),
+ x = -k * b[0][0],
+ y = (h - k * (b[1][1] + b[0][1])) / 2;
+ projection.scale(150 * k).translate([x, y]);
+ }, object);
+}
+
var maxDepth = 16;
var 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({
point: function(x, y) {
x = project(x, y);
@@ -9043,10 +9135,19 @@
point: function(x, y) {
this.stream.point(x * radians, y * radians);
}
});
+function transformRotate(rotate) {
+ return transformer({
+ point: function(x, y) {
+ var r = rotate(x, y);
+ return this.stream.point(r[0], r[1]);
+ }
+ });
+}
+
function projection(project) {
return projectionMutator(function() { return project; })();
}
function projectionMutator(projectAt) {
@@ -9074,19 +9175,27 @@
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(preclip(rotate, projectResample(postclip(cacheStream = stream))));
+ return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
};
+ projection.preclip = function(_) {
+ return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;
+ };
+
+ projection.postclip = function(_) {
+ return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
+ };
+
projection.clipAngle = function(_) {
- return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians, 6 * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1;
+ return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1;
};
projection.clipExtent = function(_) {
- return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
+ 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]];
};
projection.scale = function(_) {
return arguments.length ? (k = +_, recenter()) : k;
};
@@ -9113,10 +9222,18 @@
projection.fitSize = function(size, object) {
return fitSize(projection, size, object);
};
+ projection.fitWidth = function(width, object) {
+ return fitWidth(projection, width, object);
+ };
+
+ projection.fitHeight = function(height, object) {
+ return fitHeight(projection, height, object);
+ };
+
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;
@@ -9181,24 +9298,24 @@
};
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.
function multiplex(streams) {
var n = streams.length;
@@ -9215,22 +9332,21 @@
// A composite projection for the United States, configured by default for
// 960×500. The projection also works quite well at 960×600 if you change the
// 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,
alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338
hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007
point, pointStream = {point: function(x, y) { point = [x, y]; }};
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);
}
albersUsa.invert = function(coordinates) {
@@ -9287,17 +9403,25 @@
albersUsa.fitSize = function(size, object) {
return fitSize(albersUsa, size, object);
};
+ albersUsa.fitWidth = function(width, object) {
+ return fitWidth(albersUsa, width, object);
+ };
+
+ albersUsa.fitHeight = function(height, object) {
+ return fitHeight(albersUsa, height, object);
+ };
+
function reset() {
cache = cacheStream = null;
return albersUsa;
}
return albersUsa.scale(1070);
-};
+}
function azimuthalRaw(scale) {
return function(x, y) {
var cx = cos$1(x),
cy = cos$1(y),
@@ -9328,42 +9452,42 @@
azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {
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);
});
azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {
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))];
}
mercatorRaw.invert = function(x, y) {
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),
center = m.center,
scale = m.scale,
@@ -9382,11 +9506,11 @@
m.center = function(_) {
return arguments.length ? (center(_), reclip()) : center();
};
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() {
var k = pi$3 * scale(),
t = m(rotation(m.rotate()).invert([0, 0]));
@@ -9423,26 +9547,26 @@
};
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),
n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0),
g = cy0 / n + y0;
@@ -9460,40 +9584,41 @@
};
return project;
}
-var conicEquidistant = function() {
+function conicEquidistant() {
return conicProjection(conicEquidistantRaw)
.scale(131.154)
.center([0, 13.9389]);
-};
+}
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) {
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 = identity$4, // clip extent
+ x0 = null, y0, x1, y1, // clip extent
+ postclip = identity$4,
cache,
cacheStream,
projection;
function reset() {
@@ -9501,14 +9626,17 @@
return projection;
}
return projection = {
stream: function(stream) {
- return cache && cacheStream === stream ? cache : cache = transform$$1(clip(cacheStream = stream));
+ return cache && cacheStream === stream ? cache : cache = transform$$1(postclip(cacheStream = stream));
},
+ postclip: function(_) {
+ return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
+ },
clipExtent: function(_) {
- return arguments.length ? (clip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
+ 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;
},
translate: function(_) {
@@ -9523,50 +9651,82 @@
fitExtent: function(extent, object) {
return fitExtent(projection, extent, object);
},
fitSize: function(size, object) {
return fitSize(projection, size, object);
+ },
+ fitWidth: function(width, object) {
+ return fitWidth(projection, width, object);
+ },
+ fitHeight: function(height, object) {
+ return fitHeight(projection, height, object);
}
};
+}
+
+function naturalEarth1Raw(lambda, phi) {
+ var phi2 = phi * phi, phi4 = phi2 * phi2;
+ return [
+ lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))),
+ phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))
+ ];
+}
+
+naturalEarth1Raw.invert = function(x, y) {
+ var phi = y, i = 25, delta;
+ do {
+ var phi2 = phi * phi, phi4 = phi2 * phi2;
+ phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) /
+ (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));
+ } while (abs(delta) > epsilon$2 && --i > 0);
+ return [
+ x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))),
+ phi
+ ];
};
+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 [cy * sin$1(x) / k, sin$1(y) / k];
}
stereographicRaw.invert = azimuthalInvert(function(z) {
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];
}
transverseMercatorRaw.invert = function(x, y) {
return [-y, 2 * atan(exp(x)) - halfPi$2];
};
-var transverseMercator = function() {
+function transverseMercator() {
var m = mercatorProjection(transverseMercatorRaw),
center = m.center,
rotate = m.rotate;
m.center = function(_) {
@@ -9577,11 +9737,11 @@
return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);
};
return rotate([0, 0, 90])
.scale(159.155);
-};
+}
function defaultSeparation(a, b) {
return a.parent === b.parent ? 1 : 2;
}
@@ -9611,11 +9771,11 @@
var children;
while (children = node.children) node = children[children.length - 1];
return node;
}
-var cluster = function() {
+function cluster() {
var separation = defaultSeparation,
dx = 1,
dy = 1,
nodeSize = false;
@@ -9662,26 +9822,26 @@
cluster.nodeSize = function(x) {
return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);
};
return cluster;
-};
+}
function count(node) {
var sum = 0,
children = node.children,
i = children && children.length;
if (!i) sum = 1;
else while (--i >= 0) sum += children[i].value;
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 (node = current.pop()) {
callback(node), children = node.children;
@@ -9689,24 +9849,24 @@
next.push(children[i]);
}
}
} 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;
if (children) for (i = children.length - 1; i >= 0; --i) {
nodes.push(children[i]);
}
}
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;
if (children) for (i = 0, n = children.length; i < n; ++i) {
nodes.push(children[i]);
@@ -9714,31 +9874,31 @@
}
while (node = next.pop()) {
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,
i = children && children.length;
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];
while (start !== ancestor) {
start = start.parent;
@@ -9748,11 +9908,11 @@
while (end !== ancestor) {
nodes.splice(k, 0, end);
end = end.parent;
}
return nodes;
-};
+}
function leastCommonAncestor(a, b) {
if (a === b) return a;
var aNodes = a.ancestors(),
bNodes = b.ancestors(),
@@ -9765,45 +9925,45 @@
b = bNodes.pop();
}
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) {
leaves.push(node);
}
});
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.
links.push({source: node.parent, target: node});
}
});
return links;
-};
+}
function hierarchy(data, children) {
var root = new Node(data),
valued = +data.value && (root.value = data.value),
node,
@@ -9886,21 +10046,21 @@
}
return array;
}
-var enclose = function(circles) {
+function enclose(circles) {
var i = 0, n = (circles = shuffle$1(slice$3.call(circles))).length, B = [], p, e;
while (i < n) {
p = circles[i];
if (e && enclosesWeak(e, p)) ++i;
else e = encloseBasis(B = extendBasis(B, p)), i = 0;
}
return e;
-};
+}
function extendBasis(B, p) {
var i, j;
if (enclosesWeakAll(p, B)) return [p];
@@ -10112,14 +10272,14 @@
for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;
return c.r;
}
-var siblings = function(circles) {
+function siblings(circles) {
packEnclose(circles);
return circles;
-};
+}
function optional(f) {
return f == null ? null : required(f);
}
@@ -10130,21 +10290,21 @@
function constantZero() {
return 0;
}
-var constant$8 = function(x) {
+function constant$8(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,
padding = constantZero;
@@ -10174,11 +10334,11 @@
pack.padding = function(x) {
return arguments.length ? (padding = typeof x === "function" ? x : constant$8(+x), pack) : padding;
};
return pack;
-};
+}
function radiusLeaf(radius) {
return function(node) {
if (!node.children) {
node.r = Math.max(0, +radius(node) || 0);
@@ -10212,31 +10372,31 @@
node.y = parent.y + k * node.y;
}
};
}
-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,
n = nodes.length,
k = parent.value && (x1 - x0) / parent.value;
while (++i < n) {
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,
round = false;
@@ -10280,11 +10440,11 @@
partition.padding = function(x) {
return arguments.length ? (padding = +x, partition) : padding;
};
return partition;
-};
+}
var keyPrefix$1 = "$";
var preroot = {depth: -1};
var ambiguous = {};
@@ -10294,11 +10454,11 @@
function defaultParentId(d) {
return d.parentId;
}
-var stratify = function() {
+function stratify() {
var id = defaultId,
parentId = defaultParentId;
function stratify(data) {
var d,
@@ -10351,11 +10511,11 @@
stratify.parentId = function(x) {
return arguments.length ? (parentId = required(x), stratify) : parentId;
};
return stratify;
-};
+}
function defaultSeparation$1(a, b) {
return a.parent === b.parent ? 1 : 2;
}
@@ -10450,11 +10610,11 @@
(tree.parent = new TreeNode(null, 0)).children = [tree];
return tree;
}
// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
-var tree = function() {
+function tree() {
var separation = defaultSeparation$1,
dx = 1,
dy = 1,
nodeSize = null;
@@ -10587,24 +10747,24 @@
tree.nodeSize = function(x) {
return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);
};
return tree;
-};
+}
-var treemapSlice = function(parent, x0, y0, x1, y1) {
+function treemapSlice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
n = nodes.length,
k = parent.value && (y1 - y0) / parent.value;
while (++i < n) {
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;
function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
var rows = [],
@@ -10666,11 +10826,11 @@
};
return squarify;
})(phi);
-var index$3 = function() {
+function index$3() {
var tile = squarify,
round = false,
dx = 1,
dy = 1,
paddingStack = [0],
@@ -10754,13 +10914,13 @@
treemap.paddingLeft = function(x) {
return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$8(+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);
for (sums[0] = sum = i = 0; i < n; ++i) {
@@ -10801,15 +10961,15 @@
var yk = (y0 * valueRight + y1 * valueLeft) / value;
partition(i, k, valueLeft, x0, y0, x1, yk);
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) {
function resquarify(parent, x0, y0, x1, y1) {
if ((rows = parent._squarify) && (rows.ratio === ratio)) {
@@ -10840,11 +11000,11 @@
};
return resquarify;
})(phi);
-var area$1 = function(polygon) {
+function area$1(polygon) {
var i = -1,
n = polygon.length,
a,
b = polygon[n - 1],
area = 0;
@@ -10854,13 +11014,13 @@
b = polygon[i];
area += a[1] * b[0] - a[0] * b[1];
}
return area / 2;
-};
+}
-var centroid$1 = function(polygon) {
+function centroid$1(polygon) {
var i = -1,
n = polygon.length,
x = 0,
y = 0,
a,
@@ -10875,19 +11035,19 @@
x += (a[0] + b[0]) * c;
y += (a[1] + b[1]) * c;
}
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];
}
@@ -10905,11 +11065,11 @@
}
return indexes.slice(0, size); // remove popped points
}
-var hull = function(points) {
+function hull(points) {
if ((n = points.length) < 3) return null;
var i,
n,
sortedPoints = new Array(n),
@@ -10931,13 +11091,13 @@
// Then add lower hull in left-to-right order.
for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]);
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$1(polygon, point) {
var n = polygon.length,
p = polygon[n - 1],
x = point[0], y = point[1],
x0 = p[0], y0 = p[1],
x1, y1,
@@ -10948,13 +11108,13 @@
if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside;
x0 = x1, y0 = y1;
}
return inside;
-};
+}
-var length$2 = function(polygon) {
+function length$2(polygon) {
var i = -1,
n = polygon.length,
b = polygon[n - 1],
xa,
ya,
@@ -10972,11 +11132,11 @@
ya -= yb;
perimeter += Math.sqrt(xa * xa + ya * ya);
}
return perimeter;
-};
+}
var slice$4 = [].slice;
var noabort = {};
@@ -11096,13 +11256,13 @@
if (concurrency == null) concurrency = Infinity;
else if (!((concurrency = +concurrency) >= 1)) throw new Error("invalid concurrency");
return new Queue(concurrency);
}
-var defaultSource$1 = function() {
+function defaultSource$1() {
return Math.random();
-};
+}
var uniform = (function sourceRandomUniform(source) {
function randomUniform(min, max) {
min = min == null ? 0 : +min;
max = max == null ? 1 : +max;
@@ -11194,11 +11354,11 @@
randomExponential.source = sourceRandomExponential;
return randomExponential;
})(defaultSource$1);
-var request = function(url, callback) {
+function request(url, callback) {
var request,
event = dispatch("beforesend", "progress", "load", "error"),
mimeType,
headers = map$1(),
xhr = new XMLHttpRequest,
@@ -11328,11 +11488,11 @@
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);
};
@@ -11343,20 +11503,20 @@
return type && type !== "text"
? xhr.response // null on error
: xhr.responseText; // "" on error
}
-var type$1 = function(defaultMimeType, response) {
+function type$1(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);
});
@@ -11372,19 +11532,19 @@
var xml = xhr.responseXML;
if (!xml) throw new Error("parse error");
return xml;
});
-var dsv$1 = function(defaultMimeType, parse) {
+function dsv$1(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);
};
@@ -11540,19 +11700,19 @@
function point$1() {
return pointish(band().paddingInner(1));
}
-var constant$9 = function(x) {
+function constant$9(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))
@@ -11597,11 +11757,11 @@
d[i] = deinterpolate(domain[i], domain[i + 1]);
r[i] = reinterpolate(range[i], range[i + 1]);
}
return function(x) {
- var i = bisectRight$1(domain, x, 1, j) - 1;
+ var i = bisectRight(domain, x, 1, j) - 1;
return r[i](d[i](x));
};
}
function copy(source, target) {
@@ -11658,11 +11818,11 @@
};
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),
precision;
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
@@ -11685,11 +11845,11 @@
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
break;
}
}
return exports.format(specifier);
-};
+}
function linearish(scale) {
var domain = scale.domain;
scale.ticks = function(count) {
@@ -11772,11 +11932,11 @@
};
return linearish(scale);
}
-var nice = function(domain, interval) {
+function nice(domain, interval) {
domain = domain.slice();
var i0 = 0,
i1 = domain.length - 1,
x0 = domain[i0],
@@ -11789,11 +11949,11 @@
}
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);
@@ -11962,11 +12122,11 @@
while (++i < n) thresholds[i - 1] = threshold(domain, i / n);
return scale;
}
function scale(x) {
- if (!isNaN(x = +x)) return range[bisectRight$1(thresholds, x)];
+ if (!isNaN(x = +x)) return range[bisectRight(thresholds, x)];
}
scale.invertExtent = function(y) {
var i = range.indexOf(y);
return i < 0 ? [NaN, NaN] : [
@@ -12006,11 +12166,11 @@
n = 1,
domain = [0.5],
range = [0, 1];
function scale(x) {
- if (x <= x) return range[bisectRight$1(domain, x, 0, n)];
+ if (x <= x) return range[bisectRight(domain, x, 0, n)];
}
function rescale() {
var i = -1;
domain = new Array(n);
@@ -12047,11 +12207,11 @@
var domain = [0.5],
range = [0, 1],
n = 1;
function scale(x) {
- if (x <= x) return range[bisectRight$1(domain, x, 0, n)];
+ if (x <= x) return range[bisectRight(domain, x, 0, n)];
}
scale.domain = function(_) {
return arguments.length ? (domain = slice$5.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
};
@@ -12098,15 +12258,16 @@
interval.offset = function(date, step) {
return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
};
interval.range = function(start, stop, step) {
- var range = [];
+ var range = [], previous;
start = interval.ceil(start);
step = step == null ? 1 : Math.floor(step);
if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
- do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop)
+ do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
+ while (previous < start && start < stop);
return range;
};
interval.filter = function(test) {
return newInterval(function(date) {
@@ -12435,20 +12596,25 @@
"b": formatShortMonth,
"B": formatMonth,
"c": null,
"d": formatDayOfMonth,
"e": formatDayOfMonth,
+ "f": formatMicroseconds,
"H": formatHour24,
"I": formatHour12,
"j": formatDayOfYear,
"L": formatMilliseconds,
"m": formatMonthNumber,
"M": formatMinutes,
"p": formatPeriod,
+ "Q": formatUnixTimestamp,
+ "s": formatUnixTimestampSeconds,
"S": formatSeconds,
+ "u": formatWeekdayNumberMonday,
"U": formatWeekNumberSunday,
- "w": formatWeekdayNumber,
+ "V": formatWeekNumberISO,
+ "w": formatWeekdayNumberSunday,
"W": formatWeekNumberMonday,
"x": null,
"X": null,
"y": formatYear,
"Y": formatFullYear,
@@ -12462,20 +12628,25 @@
"b": formatUTCShortMonth,
"B": formatUTCMonth,
"c": null,
"d": formatUTCDayOfMonth,
"e": formatUTCDayOfMonth,
+ "f": formatUTCMicroseconds,
"H": formatUTCHour24,
"I": formatUTCHour12,
"j": formatUTCDayOfYear,
"L": formatUTCMilliseconds,
"m": formatUTCMonthNumber,
"M": formatUTCMinutes,
"p": formatUTCPeriod,
+ "Q": formatUnixTimestamp,
+ "s": formatUnixTimestampSeconds,
"S": formatUTCSeconds,
+ "u": formatUTCWeekdayNumberMonday,
"U": formatUTCWeekNumberSunday,
- "w": formatUTCWeekdayNumber,
+ "V": formatUTCWeekNumberISO,
+ "w": formatUTCWeekdayNumberSunday,
"W": formatUTCWeekNumberMonday,
"x": null,
"X": null,
"y": formatUTCYear,
"Y": formatUTCFullYear,
@@ -12489,20 +12660,25 @@
"b": parseShortMonth,
"B": parseMonth,
"c": parseLocaleDateTime,
"d": parseDayOfMonth,
"e": parseDayOfMonth,
+ "f": parseMicroseconds,
"H": parseHour24,
"I": parseHour24,
"j": parseDayOfYear,
"L": parseMilliseconds,
"m": parseMonthNumber,
"M": parseMinutes,
"p": parsePeriod,
+ "Q": parseUnixTimestamp,
+ "s": parseUnixTimestampSeconds,
"S": parseSeconds,
+ "u": parseWeekdayNumberMonday,
"U": parseWeekNumberSunday,
- "w": parseWeekdayNumber,
+ "V": parseWeekNumberISO,
+ "w": parseWeekdayNumberSunday,
"W": parseWeekNumberMonday,
"x": parseLocaleDate,
"X": parseLocaleTime,
"y": parseYear,
"Y": parseFullYear,
@@ -12547,20 +12723,42 @@
}
function newParse(specifier, newDate) {
return function(string) {
var d = newYear(1900),
- i = parseSpecifier(d, specifier, string += "", 0);
+ i = parseSpecifier(d, specifier, string += "", 0),
+ week, day$$1;
if (i != string.length) return null;
+ // If a UNIX timestamp is specified, return it.
+ if ("Q" in d) return new Date(d.Q);
+
// The am-pm flag is 0 for AM, and 1 for PM.
if ("p" in d) d.H = d.H % 12 + d.p * 12;
// Convert day-of-week and week-of-year to day-of-year.
- if ("W" in d || "U" in d) {
- if (!("w" in d)) d.w = "W" in d ? 1 : 0;
- var day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
+ if ("V" in d) {
+ if (d.V < 1 || d.V > 53) return null;
+ if (!("w" in d)) d.w = 1;
+ if ("Z" in d) {
+ week = utcDate(newYear(d.y)), day$$1 = week.getUTCDay();
+ week = day$$1 > 4 || day$$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
+ week = utcDay.offset(week, (d.V - 1) * 7);
+ d.y = week.getUTCFullYear();
+ d.m = week.getUTCMonth();
+ d.d = week.getUTCDate() + (d.w + 6) % 7;
+ } else {
+ week = newDate(newYear(d.y)), day$$1 = week.getDay();
+ week = day$$1 > 4 || day$$1 === 0 ? monday.ceil(week) : monday(week);
+ week = day.offset(week, (d.V - 1) * 7);
+ d.y = week.getFullYear();
+ d.m = week.getMonth();
+ d.d = week.getDate() + (d.w + 6) % 7;
+ }
+ } else if ("W" in d || "U" in d) {
+ if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
+ day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
d.m = 0;
d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7;
}
// If a time zone is specified, all fields are interpreted as UTC and then
@@ -12700,11 +12898,11 @@
}
var pads = {"-": "", "_": " ", "0": "0"};
var numberRe = /^\s*\d+/;
var percentRe = /^%/;
-var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
+var requoteRe = /[\\^$*+?|[\]().{}]/g;
function pad(value, fill, width) {
var sign = value < 0 ? "-" : "",
string = (sign ? -value : value) + "",
length = string.length;
@@ -12723,22 +12921,32 @@
var map = {}, i = -1, n = names.length;
while (++i < n) map[names[i].toLowerCase()] = i;
return map;
}
-function parseWeekdayNumber(d, string, i) {
+function parseWeekdayNumberSunday(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 1));
return n ? (d.w = +n[0], i + n[0].length) : -1;
}
+function parseWeekdayNumberMonday(d, string, i) {
+ var n = numberRe.exec(string.slice(i, i + 1));
+ return n ? (d.u = +n[0], i + n[0].length) : -1;
+}
+
function parseWeekNumberSunday(d, string, i) {
- var n = numberRe.exec(string.slice(i));
+ var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.U = +n[0], i + n[0].length) : -1;
}
+function parseWeekNumberISO(d, string, i) {
+ var n = numberRe.exec(string.slice(i, i + 2));
+ return n ? (d.V = +n[0], i + n[0].length) : -1;
+}
+
function parseWeekNumberMonday(d, string, i) {
- var n = numberRe.exec(string.slice(i));
+ var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.W = +n[0], i + n[0].length) : -1;
}
function parseFullYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 4));
@@ -12749,11 +12957,11 @@
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
}
function parseZone(d, string, i) {
- var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6));
+ var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
}
function parseMonthNumber(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
@@ -12788,15 +12996,30 @@
function parseMilliseconds(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 3));
return n ? (d.L = +n[0], i + n[0].length) : -1;
}
+function parseMicroseconds(d, string, i) {
+ var n = numberRe.exec(string.slice(i, i + 6));
+ return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
+}
+
function parseLiteralPercent(d, string, i) {
var n = percentRe.exec(string.slice(i, i + 1));
return n ? i + n[0].length : -1;
}
+function parseUnixTimestamp(d, string, i) {
+ var n = numberRe.exec(string.slice(i));
+ return n ? (d.Q = +n[0], i + n[0].length) : -1;
+}
+
+function parseUnixTimestampSeconds(d, string, i) {
+ var n = numberRe.exec(string.slice(i));
+ return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1;
+}
+
function formatDayOfMonth(d, p) {
return pad(d.getDate(), p, 2);
}
function formatHour24(d, p) {
@@ -12813,10 +13036,14 @@
function formatMilliseconds(d, p) {
return pad(d.getMilliseconds(), p, 3);
}
+function formatMicroseconds(d, p) {
+ return formatMilliseconds(d, p) + "000";
+}
+
function formatMonthNumber(d, p) {
return pad(d.getMonth() + 1, p, 2);
}
function formatMinutes(d, p) {
@@ -12825,15 +13052,26 @@
function formatSeconds(d, p) {
return pad(d.getSeconds(), p, 2);
}
+function formatWeekdayNumberMonday(d) {
+ var day$$1 = d.getDay();
+ return day$$1 === 0 ? 7 : day$$1;
+}
+
function formatWeekNumberSunday(d, p) {
return pad(sunday.count(year(d), d), p, 2);
}
-function formatWeekdayNumber(d) {
+function formatWeekNumberISO(d, p) {
+ var day$$1 = d.getDay();
+ d = (day$$1 >= 4 || day$$1 === 0) ? thursday(d) : thursday.ceil(d);
+ return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
+}
+
+function formatWeekdayNumberSunday(d) {
return d.getDay();
}
function formatWeekNumberMonday(d, p) {
return pad(monday.count(year(d), d), p, 2);
@@ -12872,10 +13110,14 @@
function formatUTCMilliseconds(d, p) {
return pad(d.getUTCMilliseconds(), p, 3);
}
+function formatUTCMicroseconds(d, p) {
+ return formatUTCMilliseconds(d, p) + "000";
+}
+
function formatUTCMonthNumber(d, p) {
return pad(d.getUTCMonth() + 1, p, 2);
}
function formatUTCMinutes(d, p) {
@@ -12884,15 +13126,26 @@
function formatUTCSeconds(d, p) {
return pad(d.getUTCSeconds(), p, 2);
}
+function formatUTCWeekdayNumberMonday(d) {
+ var dow = d.getUTCDay();
+ return dow === 0 ? 7 : dow;
+}
+
function formatUTCWeekNumberSunday(d, p) {
return pad(utcSunday.count(utcYear(d), d), p, 2);
}
-function formatUTCWeekdayNumber(d) {
+function formatUTCWeekNumberISO(d, p) {
+ var day$$1 = d.getUTCDay();
+ d = (day$$1 >= 4 || day$$1 === 0) ? utcThursday(d) : utcThursday.ceil(d);
+ return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
+}
+
+function formatUTCWeekdayNumberSunday(d) {
return d.getUTCDay();
}
function formatUTCWeekNumberMonday(d, p) {
return pad(utcMonday.count(utcYear(d), d), p, 2);
@@ -12912,16 +13165,24 @@
function formatLiteralPercent() {
return "%";
}
-var locale$2;
+function formatUnixTimestamp(d) {
+ return +d;
+}
+function formatUnixTimestampSeconds(d) {
+ return Math.floor(+d / 1000);
+}
+var locale$1;
+
+
defaultLocale$1({
dateTime: "%x, %X",
date: "%-m/%-d/%Y",
time: "%-I:%M:%S %p",
periods: ["AM", "PM"],
@@ -12930,16 +13191,16 @@
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function defaultLocale$1(definition) {
- locale$2 = formatLocale$1(definition);
- exports.timeFormat = locale$2.format;
- exports.timeParse = locale$2.parse;
- exports.utcFormat = locale$2.utcFormat;
- exports.utcParse = locale$2.utcParse;
- return locale$2;
+ locale$1 = formatLocale$1(definition);
+ exports.timeFormat = locale$1.format;
+ exports.timeParse = locale$1.parse;
+ exports.utcFormat = locale$1.utcFormat;
+ exports.utcParse = locale$1.utcParse;
+ return locale$1;
}
var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
function formatIsoNative(date) {
@@ -13035,11 +13296,11 @@
} else if (i) {
i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
step = i[1];
interval = i[0];
} else {
- step = tickStep(start, stop, interval);
+ step = Math.max(tickStep(start, stop, interval), 1);
interval = millisecond$$1;
}
}
return step == null ? interval : interval.every(step);
@@ -13081,23 +13342,23 @@
};
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) {
+function colors(s) {
return s.match(/.{6}/g).map(function(x) {
return "#" + x;
});
-};
+}
var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6");
@@ -13111,18 +13372,18 @@
var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
var rainbow = cubehelix();
-var rainbow$1 = function(t) {
+function rainbow$1(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 ramp(range) {
var n = range.length;
return function(t) {
return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
@@ -13164,15 +13425,15 @@
};
return linearish(scale);
}
-var constant$10 = function(x) {
+function constant$10(x) {
return function constant() {
return x;
};
-};
+}
var abs$1 = Math.abs;
var atan2$1 = Math.atan2;
var cos$2 = Math.cos;
var max$2 = Math.max;
@@ -13261,11 +13522,11 @@
x11: cx0 * (r1 / r - 1),
y11: cy0 * (r1 / r - 1)
};
}
-var arc = function() {
+function arc() {
var innerRadius = arcInnerRadius,
outerRadius = arcOuterRadius,
cornerRadius = constant$10(0),
padRadius = null,
startAngle = arcStartAngle,
@@ -13441,15 +13702,15 @@
arc.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$10(+_), 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;
}
@@ -13475,24 +13736,24 @@
default: this._context.lineTo(x, y); break;
}
}
};
-var curveLinear = function(context) {
+function curveLinear(context) {
return new Linear(context);
-};
+}
-function x$4(p) {
+function x$3(p) {
return p[0];
}
function y$3(p) {
return p[1];
}
-var line = function() {
- var x$$1 = x$4,
+function line() {
+ var x$$1 = x$3,
y$$1 = y$3,
defined = constant$10(true),
context = null,
curve = curveLinear,
output = null;
@@ -13536,14 +13797,14 @@
line.context = function(_) {
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
};
return line;
-};
+}
-var area$2 = function() {
- var x0 = x$4,
+function area$2() {
+ var x0 = x$3,
x1 = null,
y0 = constant$10(0),
y1 = y$3,
defined = constant$10(true),
context = null,
@@ -13640,21 +13901,21 @@
area.context = function(_) {
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
};
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),
@@ -13723,11 +13984,11 @@
pie.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : padAngle;
};
return pie;
-};
+}
var curveRadialLinear = curveRadial(curveLinear);
function Radial(curve) {
this._curve = curve;
@@ -13773,15 +14034,15 @@
};
return l;
}
-var lineRadial$1 = function() {
+function lineRadial$1() {
return lineRadial(line().curve(curveRadialLinear));
-};
+}
-var areaRadial = function() {
+function areaRadial() {
var a = area$2().curve(curveRadialLinear),
c = a.curve,
x0 = a.lineX0,
x1 = a.lineX1,
y0 = a.lineY0,
@@ -13801,15 +14062,15 @@
a.curve = function(_) {
return arguments.length ? c(curveRadial(_)) : c()._curve;
};
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;
function linkSource(d) {
return d.source;
@@ -13820,11 +14081,11 @@
}
function link$2(curve) {
var source = linkSource,
target = linkTarget,
- x$$1 = x$4,
+ x$$1 = x$3,
y$$1 = y$3,
context = null;
function link() {
var buffer, argv = slice$6.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
@@ -13848,11 +14109,11 @@
link.y = function(_) {
return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$10(+_), link) : y$$1;
};
link.context = function(_) {
- return arguments.length ? ((context = _ == null ? null : _), link) : context;
+ return arguments.length ? (context = _ == null ? null : _, link) : context;
};
return link;
}
@@ -14010,11 +14271,11 @@
star,
triangle,
wye
];
-var symbol = function() {
+function symbol() {
var type = constant$10(circle$2),
size = constant$10(64),
context = null;
function symbol() {
@@ -14035,13 +14296,13 @@
symbol.context = function(_) {
return arguments.length ? (context = _ == null ? null : _, symbol) : context;
};
return symbol;
-};
+}
-var noop$2 = function() {};
+function noop$2() {}
function point$2(that, x, y) {
that._context.bezierCurveTo(
(2 * that._x0 + that._x1) / 3,
(2 * that._y0 + that._y1) / 3,
@@ -14087,13 +14348,13 @@
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
}
};
-var basis$2 = function(context) {
+function basis$2(context) {
return new Basis(context);
-};
+}
function BasisClosed(context) {
this._context = context;
}
@@ -14137,13 +14398,13 @@
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
}
};
-var basisClosed$1 = function(context) {
+function basisClosed$1(context) {
return new BasisClosed(context);
-};
+}
function BasisOpen(context) {
this._context = context;
}
@@ -14175,13 +14436,13 @@
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
}
};
-var basisOpen = function(context) {
+function basisOpen(context) {
return new BasisOpen(context);
-};
+}
function Bundle(context, beta) {
this._basis = new Basis(context);
this._beta = beta;
}
@@ -14640,13 +14901,13 @@
if (this._point) this._context.lineTo(x, y);
else this._point = 1, this._context.moveTo(x, y);
}
};
-var linearClosed = function(context) {
+function linearClosed(context) {
return new LinearClosed(context);
-};
+}
function sign$1(x) {
return x < 0 ? -1 : 1;
}
@@ -14811,13 +15072,13 @@
b[n - 1] = (x[n] + a[n - 1]) / 2;
for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
return [a, b];
}
-var natural = function(context) {
+function natural(context) {
return new Natural(context);
-};
+}
function Step(context, t) {
this._context = context;
this._t = t;
}
@@ -14857,43 +15118,43 @@
}
this._x = x, this._y = y;
}
};
-var step = function(context) {
+function step(context) {
return new Step(context, 0.5);
-};
+}
function stepBefore(context) {
return new Step(context, 0);
}
function stepAfter(context) {
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]];
for (j = 0; j < m; ++j) {
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() {
+function stack() {
var keys = constant$10([]),
order = none$2,
offset = none$1,
value = stackValue;
@@ -14936,22 +15197,22 @@
stack.offset = function(_) {
return arguments.length ? (offset = _ == null ? none$1 : _, stack) : offset;
};
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(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) {
if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) {
d[0] = yp, d[1] = yp += dy;
@@ -14960,22 +15221,22 @@
} else {
d[0] = yp;
}
}
}
-};
+}
-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) {
var si = series[order[i]],
sij0 = si[j][1] || 0,
@@ -14992,28 +15253,28 @@
s0[j - 1][1] += s0[j - 1][0] = y;
if (s1) y -= s2 / s1;
}
s0[j - 1][1] += s0[j - 1][0] = y;
none$1(series, order);
-};
+}
-var ascending$2 = function(series) {
+function ascending$2(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;
while (++i < n) if (v = +series[i][1]) s += v;
return s;
}
-var descending$2 = function(series) {
+function descending$2(series) {
return ascending$2(series).reverse();
-};
+}
-var insideOut = function(series) {
+function insideOut(series) {
var n = series.length,
i,
j,
sums = series.map(sum$2),
order = none$2(series).sort(function(a, b) { return sums[b] - sums[a]; }),
@@ -15032,23 +15293,23 @@
bottoms.push(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$11(x) {
return function() {
return x;
};
-};
+}
-function x$5(d) {
+function x$4(d) {
return d[0];
}
function y$4(d) {
return d[1];
@@ -15980,12 +16241,12 @@
return radius == null || d2 <= radius * radius ? cell.site : null;
}
};
-var voronoi = function() {
- var x$$1 = x$5,
+function voronoi() {
+ var x$$1 = x$4,
y$$1 = y$4,
extent = null;
function voronoi(data) {
return new Diagram(data.map(function(d, i) {
@@ -16023,17 +16284,17 @@
voronoi.size = function(_) {
return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]];
};
return voronoi;
-};
+}
-var constant$12 = function(x) {
+function constant$12(x) {
return function() {
return x;
};
-};
+}
function ZoomEvent(target, type, transform) {
this.target = target;
this.type = type;
this.transform = transform;
@@ -16092,14 +16353,14 @@
function nopropagation$2() {
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 !exports.event.button;
}
@@ -16123,24 +16384,33 @@
function defaultWheelDelta() {
return -exports.event.deltaY * (exports.event.deltaMode ? 120 : 1) / 500;
}
-function touchable$1() {
+function defaultTouchable$1() {
return "ontouchstart" in this;
}
-var zoom = function() {
+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(
+ 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)
+ );
+}
+
+function zoom() {
var filter = defaultFilter$2,
extent = defaultExtent$1,
+ constrain = defaultConstrain,
wheelDelta = defaultWheelDelta,
- k0 = 0,
- k1 = Infinity,
- x0 = -k1,
- x1 = k1,
- y0 = x0,
- y1 = x1,
+ touchable = defaultTouchable$1,
+ scaleExtent = [0, Infinity],
+ translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
duration = 250,
interpolate = interpolateZoom,
gestures = [],
listeners = dispatch("start", "zoom", "end"),
touchstarting,
@@ -16153,11 +16423,11 @@
selection
.property("__zoom", defaultTransform)
.on("wheel.zoom", wheeled)
.on("mousedown.zoom", mousedowned)
.on("dblclick.zoom", dblclicked)
- .filter(touchable$1)
+ .filter(touchable)
.on("touchstart.zoom", touchstarted)
.on("touchmove.zoom", touchmoved)
.on("touchend.zoom touchcancel.zoom", touchended)
.style("touch-action", "none")
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
@@ -16191,20 +16461,20 @@
var e = extent.apply(this, arguments),
t0 = this.__zoom,
p0 = centroid(e),
p1 = t0.invert(p0),
k1 = typeof k === "function" ? k.apply(this, arguments) : k;
- return constrain(translate(scale(t0, k1), p0, p1), e);
+ return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
});
};
zoom.translateBy = function(selection, x, y) {
zoom.transform(selection, function() {
return constrain(this.__zoom.translate(
typeof x === "function" ? x.apply(this, arguments) : x,
typeof y === "function" ? y.apply(this, arguments) : y
- ), extent.apply(this, arguments));
+ ), extent.apply(this, arguments), translateExtent);
});
};
zoom.translateTo = function(selection, x, y) {
zoom.transform(selection, function() {
@@ -16212,35 +16482,24 @@
t = this.__zoom,
p = centroid(e);
return constrain(identity$8.translate(p[0], p[1]).scale(t.k).translate(
typeof x === "function" ? -x.apply(this, arguments) : -x,
typeof y === "function" ? -y.apply(this, arguments) : -y
- ), e);
+ ), e, translateExtent);
});
};
function scale(transform$$1, k) {
- k = Math.max(k0, Math.min(k1, 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);
}
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 constrain(transform$$1, extent) {
- var dx0 = transform$$1.invertX(extent[0][0]) - x0,
- dx1 = transform$$1.invertX(extent[1][0]) - x1,
- dy0 = transform$$1.invertY(extent[0][1]) - y0,
- dy1 = transform$$1.invertY(extent[1][1]) - y1;
- return transform$$1.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)
- );
- }
-
function centroid(extent) {
return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
}
function schedule(transition, transform$$1, center) {
@@ -16313,11 +16572,11 @@
function wheeled() {
if (!filter.apply(this, arguments)) return;
var g = gesture(this, arguments),
t = this.__zoom,
- k = Math.max(k0, Math.min(k1, t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
p = mouse(this);
// If the mouse is in the same location as before, reuse it.
// If there were recent wheel events, reset the wheel idle timeout.
if (g.wheel) {
@@ -16337,11 +16596,11 @@
g.start();
}
noevent$2();
g.wheel = setTimeout(wheelidled, wheelDelay);
- g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent));
+ g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
function wheelidled() {
g.wheel = null;
g.end();
}
@@ -16365,11 +16624,11 @@
noevent$2();
if (!g.moved) {
var dx = exports.event.clientX - x0, dy = exports.event.clientY - y0;
g.moved = dx * dx + dy * dy > clickDistance2;
}
- g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent));
+ g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent, translateExtent));
}
function mouseupped() {
v.on("mousemove.zoom mouseup.zoom", null);
yesdrag(exports.event.view, g.moved);
@@ -16382,11 +16641,11 @@
if (!filter.apply(this, arguments)) return;
var t0 = this.__zoom,
p0 = mouse(this),
p1 = t0.invert(p0),
k1 = t0.k * (exports.event.shiftKey ? 0.5 : 2),
- t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments));
+ t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
noevent$2();
if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0);
else select(this).call(zoom.transform, t1);
}
@@ -16446,11 +16705,11 @@
p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
}
else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
else return;
- g.zoom("touch", constrain(translate(t, p, l), g.extent));
+ g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
}
function touchended() {
var g = gesture(this, arguments),
touches = exports.event.changedTouches,
@@ -16475,22 +16734,30 @@
zoom.filter = function(_) {
return arguments.length ? (filter = typeof _ === "function" ? _ : constant$12(!!_), zoom) : filter;
};
+ zoom.touchable = function(_) {
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$12(!!_), zoom) : touchable;
+ };
+
zoom.extent = function(_) {
return arguments.length ? (extent = typeof _ === "function" ? _ : constant$12([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
};
zoom.scaleExtent = function(_) {
- return arguments.length ? (k0 = +_[0], k1 = +_[1], zoom) : [k0, k1];
+ return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
};
zoom.translateExtent = function(_) {
- return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], zoom) : [[x0, y0], [x1, y1]];
+ return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
};
+ zoom.constrain = function(_) {
+ return arguments.length ? (constrain = _, zoom) : constrain;
+ };
+
zoom.duration = function(_) {
return arguments.length ? (duration = +_, zoom) : duration;
};
zoom.interpolate = function(_) {
@@ -16505,15 +16772,15 @@
zoom.clickDistance = function(_) {
return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
};
return zoom;
-};
+}
exports.version = version;
-exports.bisect = bisectRight$1;
-exports.bisectRight = bisectRight$1;
+exports.bisect = bisectRight;
+exports.bisectRight = bisectRight;
exports.bisectLeft = bisectLeft;
exports.ascending = ascending;
exports.bisector = bisector;
exports.cross = cross;
exports.descending = descending;
@@ -16615,12 +16882,13 @@
exports.easeElasticInOut = elasticInOut;
exports.forceCenter = center$1;
exports.forceCollide = collide;
exports.forceLink = link;
exports.forceManyBody = manyBody;
+exports.forceRadial = radial;
exports.forceSimulation = simulation;
-exports.forceX = x$3;
+exports.forceX = x$2;
exports.forceY = y$2;
exports.formatDefaultLocale = defaultLocale;
exports.formatLocale = formatLocale;
exports.formatSpecifier = formatSpecifier;
exports.precisionFixed = precisionFixed;
@@ -16628,11 +16896,14 @@
exports.precisionRound = precisionRound;
exports.geoArea = area;
exports.geoBounds = bounds;
exports.geoCentroid = centroid;
exports.geoCircle = circle;
+exports.geoClipAntimeridian = clipAntimeridian;
+exports.geoClipCircle = clipCircle;
exports.geoClipExtent = extent$1;
+exports.geoClipRectangle = clipRectangle;
exports.geoContains = contains;
exports.geoDistance = distance;
exports.geoGraticule = graticule;
exports.geoGraticule10 = graticule10;
exports.geoInterpolate = interpolate$1;
@@ -16657,10 +16928,12 @@
exports.geoIdentity = identity$5;
exports.geoProjection = projection;
exports.geoProjectionMutator = projectionMutator;
exports.geoMercator = mercator;
exports.geoMercatorRaw = mercatorRaw;
+exports.geoNaturalEarth1 = naturalEarth1;
+exports.geoNaturalEarth1Raw = naturalEarth1Raw;
exports.geoOrthographic = orthographic;
exports.geoOrthographicRaw = orthographicRaw;
exports.geoStereographic = stereographic;
exports.geoStereographicRaw = stereographicRaw;
exports.geoTransverseMercator = transverseMercator;
@@ -16752,15 +17025,17 @@
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.matcher = matcher$1;
exports.mouse = mouse;
exports.namespace = namespace;
exports.namespaces = namespaces;
+exports.clientPoint = point;
exports.select = select;
exports.selectAll = selectAll;
exports.selection = selection;
exports.selector = selector;
exports.selectorAll = selectorAll;