mirror of
https://gitee.com/antv/g6.git
synced 2024-12-15 18:11:08 +08:00
6134 lines
483 KiB
JavaScript
6134 lines
483 KiB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||
// https://d3js.org/d3-array/ Version 1.0.1. Copyright 2016 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';
|
||
|
||
function ascending(a, b) {
|
||
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
||
}
|
||
|
||
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;
|
||
while (lo < hi) {
|
||
var mid = lo + hi >>> 1;
|
||
if (compare(a[mid], x) < 0) lo = mid + 1;
|
||
else hi = mid;
|
||
}
|
||
return lo;
|
||
},
|
||
right: function(a, x, lo, hi) {
|
||
if (lo == null) lo = 0;
|
||
if (hi == null) hi = a.length;
|
||
while (lo < hi) {
|
||
var mid = lo + hi >>> 1;
|
||
if (compare(a[mid], x) > 0) hi = mid;
|
||
else lo = mid + 1;
|
||
}
|
||
return lo;
|
||
}
|
||
};
|
||
}
|
||
|
||
function ascendingComparator(f) {
|
||
return function(d, x) {
|
||
return ascending(f(d), x);
|
||
};
|
||
}
|
||
|
||
var ascendingBisect = bisector(ascending);
|
||
var bisectRight = ascendingBisect.right;
|
||
var bisectLeft = ascendingBisect.left;
|
||
|
||
function descending(a, b) {
|
||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
||
}
|
||
|
||
function number(x) {
|
||
return x === null ? NaN : +x;
|
||
}
|
||
|
||
function variance(array, f) {
|
||
var n = array.length,
|
||
m = 0,
|
||
a,
|
||
d,
|
||
s = 0,
|
||
i = -1,
|
||
j = 0;
|
||
|
||
if (f == null) {
|
||
while (++i < n) {
|
||
if (!isNaN(a = number(array[i]))) {
|
||
d = a - m;
|
||
m += d / ++j;
|
||
s += d * (a - m);
|
||
}
|
||
}
|
||
}
|
||
|
||
else {
|
||
while (++i < n) {
|
||
if (!isNaN(a = number(f(array[i], i, array)))) {
|
||
d = a - m;
|
||
m += d / ++j;
|
||
s += d * (a - m);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (j > 1) return s / (j - 1);
|
||
}
|
||
|
||
function deviation(array, f) {
|
||
var v = variance(array, f);
|
||
return v ? Math.sqrt(v) : v;
|
||
}
|
||
|
||
function extent(array, f) {
|
||
var i = -1,
|
||
n = array.length,
|
||
a,
|
||
b,
|
||
c;
|
||
|
||
if (f == null) {
|
||
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
|
||
while (++i < n) if ((b = array[i]) != null) {
|
||
if (a > b) a = b;
|
||
if (c < b) c = b;
|
||
}
|
||
}
|
||
|
||
else {
|
||
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = c = b; break; }
|
||
while (++i < n) if ((b = f(array[i], i, array)) != null) {
|
||
if (a > b) a = b;
|
||
if (c < b) c = b;
|
||
}
|
||
}
|
||
|
||
return [a, c];
|
||
}
|
||
|
||
var array = Array.prototype;
|
||
|
||
var slice = array.slice;
|
||
var map = array.map;
|
||
|
||
function constant(x) {
|
||
return function() {
|
||
return x;
|
||
};
|
||
}
|
||
|
||
function identity(x) {
|
||
return x;
|
||
}
|
||
|
||
function range(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);
|
||
|
||
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);
|
||
function ticks(start, stop, count) {
|
||
var step = tickStep(start, stop, count);
|
||
return range(
|
||
Math.ceil(start / step) * step,
|
||
Math.floor(stop / step) * step + step / 2, // inclusive
|
||
step
|
||
);
|
||
}
|
||
|
||
function tickStep(start, stop, count) {
|
||
var step0 = Math.abs(stop - start) / Math.max(0, count),
|
||
step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
|
||
error = step0 / step1;
|
||
if (error >= e10) step1 *= 10;
|
||
else if (error >= e5) step1 *= 5;
|
||
else if (error >= e2) step1 *= 2;
|
||
return stop < start ? -step1 : step1;
|
||
}
|
||
|
||
function sturges(values) {
|
||
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
|
||
}
|
||
|
||
function histogram() {
|
||
var value = identity,
|
||
domain = extent,
|
||
threshold = sturges;
|
||
|
||
function histogram(data) {
|
||
var i,
|
||
n = data.length,
|
||
x,
|
||
values = new Array(n);
|
||
|
||
for (i = 0; i < n; ++i) {
|
||
values[i] = value(data[i], i, data);
|
||
}
|
||
|
||
var xz = domain(values),
|
||
x0 = xz[0],
|
||
x1 = xz[1],
|
||
tz = threshold(values, x0, x1);
|
||
|
||
// Convert number of thresholds into uniform thresholds.
|
||
if (!Array.isArray(tz)) tz = ticks(x0, x1, tz);
|
||
|
||
// Remove any thresholds outside the domain.
|
||
var m = tz.length;
|
||
while (tz[0] <= x0) tz.shift(), --m;
|
||
while (tz[m - 1] >= x1) tz.pop(), --m;
|
||
|
||
var bins = new Array(m + 1),
|
||
bin;
|
||
|
||
// Initialize bins.
|
||
for (i = 0; i <= m; ++i) {
|
||
bin = bins[i] = [];
|
||
bin.x0 = i > 0 ? tz[i - 1] : x0;
|
||
bin.x1 = i < m ? tz[i] : x1;
|
||
}
|
||
|
||
// 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(tz, x, 0, m)].push(data[i]);
|
||
}
|
||
}
|
||
|
||
return bins;
|
||
}
|
||
|
||
histogram.value = function(_) {
|
||
return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value;
|
||
};
|
||
|
||
histogram.domain = function(_) {
|
||
return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain;
|
||
};
|
||
|
||
histogram.thresholds = function(_) {
|
||
return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold;
|
||
};
|
||
|
||
return histogram;
|
||
}
|
||
|
||
function quantile(array, p, f) {
|
||
if (f == null) f = number;
|
||
if (!(n = array.length)) return;
|
||
if ((p = +p) <= 0 || n < 2) return +f(array[0], 0, array);
|
||
if (p >= 1) return +f(array[n - 1], n - 1, array);
|
||
var n,
|
||
h = (n - 1) * p,
|
||
i = Math.floor(h),
|
||
a = +f(array[i], i, array),
|
||
b = +f(array[i + 1], i + 1, array);
|
||
return a + (b - a) * (h - i);
|
||
}
|
||
|
||
function freedmanDiaconis(values, min, max) {
|
||
values = map.call(values, number).sort(ascending);
|
||
return Math.ceil((max - min) / (2 * (quantile(values, 0.75) - quantile(values, 0.25)) * Math.pow(values.length, -1 / 3)));
|
||
}
|
||
|
||
function scott(values, min, max) {
|
||
return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
|
||
}
|
||
|
||
function max(array, f) {
|
||
var i = -1,
|
||
n = array.length,
|
||
a,
|
||
b;
|
||
|
||
if (f == null) {
|
||
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
|
||
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
|
||
}
|
||
|
||
else {
|
||
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; }
|
||
while (++i < n) if ((b = f(array[i], i, array)) != null && b > a) a = b;
|
||
}
|
||
|
||
return a;
|
||
}
|
||
|
||
function mean(array, f) {
|
||
var s = 0,
|
||
n = array.length,
|
||
a,
|
||
i = -1,
|
||
j = n;
|
||
|
||
if (f == null) {
|
||
while (++i < n) if (!isNaN(a = number(array[i]))) s += a; else --j;
|
||
}
|
||
|
||
else {
|
||
while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) s += a; else --j;
|
||
}
|
||
|
||
if (j) return s / j;
|
||
}
|
||
|
||
function median(array, f) {
|
||
var numbers = [],
|
||
n = array.length,
|
||
a,
|
||
i = -1;
|
||
|
||
if (f == null) {
|
||
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
|
||
}
|
||
|
||
else {
|
||
while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) numbers.push(a);
|
||
}
|
||
|
||
return quantile(numbers.sort(ascending), 0.5);
|
||
}
|
||
|
||
function merge(arrays) {
|
||
var n = arrays.length,
|
||
m,
|
||
i = -1,
|
||
j = 0,
|
||
merged,
|
||
array;
|
||
|
||
while (++i < n) j += arrays[i].length;
|
||
merged = new Array(j);
|
||
|
||
while (--n >= 0) {
|
||
array = arrays[n];
|
||
m = array.length;
|
||
while (--m >= 0) {
|
||
merged[--j] = array[m];
|
||
}
|
||
}
|
||
|
||
return merged;
|
||
}
|
||
|
||
function min(array, f) {
|
||
var i = -1,
|
||
n = array.length,
|
||
a,
|
||
b;
|
||
|
||
if (f == null) {
|
||
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
|
||
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
|
||
}
|
||
|
||
else {
|
||
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; }
|
||
while (++i < n) if ((b = f(array[i], i, array)) != null && a > b) a = b;
|
||
}
|
||
|
||
return a;
|
||
}
|
||
|
||
function pairs(array) {
|
||
var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n);
|
||
while (i < n) pairs[i] = [p, p = array[++i]];
|
||
return pairs;
|
||
}
|
||
|
||
function permute(array, indexes) {
|
||
var i = indexes.length, permutes = new Array(i);
|
||
while (i--) permutes[i] = array[indexes[i]];
|
||
return permutes;
|
||
}
|
||
|
||
function scan(array, compare) {
|
||
if (!(n = array.length)) return;
|
||
var i = 0,
|
||
n,
|
||
j = 0,
|
||
xi,
|
||
xj = array[j];
|
||
|
||
if (!compare) compare = ascending;
|
||
|
||
while (++i < n) if (compare(xi = array[i], xj) < 0 || compare(xj, xj) !== 0) xj = xi, j = i;
|
||
|
||
if (compare(xj, xj) === 0) return j;
|
||
}
|
||
|
||
function shuffle(array, i0, i1) {
|
||
var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0),
|
||
t,
|
||
i;
|
||
|
||
while (m) {
|
||
i = Math.random() * m-- | 0;
|
||
t = array[m + i0];
|
||
array[m + i0] = array[i + i0];
|
||
array[i + i0] = t;
|
||
}
|
||
|
||
return array;
|
||
}
|
||
|
||
function sum(array, f) {
|
||
var s = 0,
|
||
n = array.length,
|
||
a,
|
||
i = -1;
|
||
|
||
if (f == null) {
|
||
while (++i < n) if (a = +array[i]) s += a; // Note: zero and null are equivalent.
|
||
}
|
||
|
||
else {
|
||
while (++i < n) if (a = +f(array[i], i, array)) s += a;
|
||
}
|
||
|
||
return s;
|
||
}
|
||
|
||
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;
|
||
}
|
||
|
||
function zip() {
|
||
return transpose(arguments);
|
||
}
|
||
|
||
exports.bisect = bisectRight;
|
||
exports.bisectRight = bisectRight;
|
||
exports.bisectLeft = bisectLeft;
|
||
exports.ascending = ascending;
|
||
exports.bisector = bisector;
|
||
exports.descending = descending;
|
||
exports.deviation = deviation;
|
||
exports.extent = extent;
|
||
exports.histogram = histogram;
|
||
exports.thresholdFreedmanDiaconis = freedmanDiaconis;
|
||
exports.thresholdScott = scott;
|
||
exports.thresholdSturges = sturges;
|
||
exports.max = max;
|
||
exports.mean = mean;
|
||
exports.median = median;
|
||
exports.merge = merge;
|
||
exports.min = min;
|
||
exports.pairs = pairs;
|
||
exports.permute = permute;
|
||
exports.quantile = quantile;
|
||
exports.range = range;
|
||
exports.scan = scan;
|
||
exports.shuffle = shuffle;
|
||
exports.sum = sum;
|
||
exports.ticks = ticks;
|
||
exports.tickStep = tickStep;
|
||
exports.transpose = transpose;
|
||
exports.variance = variance;
|
||
exports.zip = zip;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
}));
|
||
},{}],2:[function(require,module,exports){
|
||
// https://d3js.org/d3-collection/ Version 1.0.2. Copyright 2016 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 prefix = "$";
|
||
|
||
function Map() {}
|
||
|
||
Map.prototype = map.prototype = {
|
||
constructor: Map,
|
||
has: function(key) {
|
||
return (prefix + key) in this;
|
||
},
|
||
get: function(key) {
|
||
return this[prefix + key];
|
||
},
|
||
set: function(key, value) {
|
||
this[prefix + key] = value;
|
||
return this;
|
||
},
|
||
remove: function(key) {
|
||
var property = prefix + key;
|
||
return property in this && delete this[property];
|
||
},
|
||
clear: function() {
|
||
for (var property in this) if (property[0] === prefix) delete this[property];
|
||
},
|
||
keys: function() {
|
||
var keys = [];
|
||
for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));
|
||
return keys;
|
||
},
|
||
values: function() {
|
||
var values = [];
|
||
for (var property in this) if (property[0] === prefix) values.push(this[property]);
|
||
return values;
|
||
},
|
||
entries: function() {
|
||
var entries = [];
|
||
for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});
|
||
return entries;
|
||
},
|
||
size: function() {
|
||
var size = 0;
|
||
for (var property in this) if (property[0] === prefix) ++size;
|
||
return size;
|
||
},
|
||
empty: function() {
|
||
for (var property in this) if (property[0] === prefix) return false;
|
||
return true;
|
||
},
|
||
each: function(f) {
|
||
for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);
|
||
}
|
||
};
|
||
|
||
function map(object, f) {
|
||
var map = new Map;
|
||
|
||
// Copy constructor.
|
||
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });
|
||
|
||
// Index array by numeric index or specified key function.
|
||
else if (Array.isArray(object)) {
|
||
var i = -1,
|
||
n = object.length,
|
||
o;
|
||
|
||
if (f == null) while (++i < n) map.set(i, object[i]);
|
||
else while (++i < n) map.set(f(o = object[i], i, object), o);
|
||
}
|
||
|
||
// Convert object to map.
|
||
else if (object) for (var key in object) map.set(key, object[key]);
|
||
|
||
return map;
|
||
}
|
||
|
||
var nest = function() {
|
||
var keys = [],
|
||
sortKeys = [],
|
||
sortValues,
|
||
rollup,
|
||
nest;
|
||
|
||
function apply(array, depth, createResult, setResult) {
|
||
if (depth >= keys.length) return rollup != null
|
||
? rollup(array) : (sortValues != null
|
||
? array.sort(sortValues)
|
||
: array);
|
||
|
||
var i = -1,
|
||
n = array.length,
|
||
key = keys[depth++],
|
||
keyValue,
|
||
value,
|
||
valuesByKey = map(),
|
||
values,
|
||
result = createResult();
|
||
|
||
while (++i < n) {
|
||
if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) {
|
||
values.push(value);
|
||
} else {
|
||
valuesByKey.set(keyValue, [value]);
|
||
}
|
||
}
|
||
|
||
valuesByKey.each(function(values, key) {
|
||
setResult(result, key, apply(values, depth, createResult, setResult));
|
||
});
|
||
|
||
return result;
|
||
}
|
||
|
||
function entries(map$$1, depth) {
|
||
if (++depth > keys.length) return map$$1;
|
||
var array, sortKey = sortKeys[depth - 1];
|
||
if (rollup != null && depth >= keys.length) array = map$$1.entries();
|
||
else array = [], map$$1.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });
|
||
return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;
|
||
}
|
||
|
||
return nest = {
|
||
object: function(array) { return apply(array, 0, createObject, setObject); },
|
||
map: function(array) { return apply(array, 0, createMap, setMap); },
|
||
entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },
|
||
key: function(d) { keys.push(d); return nest; },
|
||
sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },
|
||
sortValues: function(order) { sortValues = order; return nest; },
|
||
rollup: function(f) { rollup = f; return nest; }
|
||
};
|
||
};
|
||
|
||
function createObject() {
|
||
return {};
|
||
}
|
||
|
||
function setObject(object, key, value) {
|
||
object[key] = value;
|
||
}
|
||
|
||
function createMap() {
|
||
return map();
|
||
}
|
||
|
||
function setMap(map$$1, key, value) {
|
||
map$$1.set(key, value);
|
||
}
|
||
|
||
function Set() {}
|
||
|
||
var proto = map.prototype;
|
||
|
||
Set.prototype = set.prototype = {
|
||
constructor: Set,
|
||
has: proto.has,
|
||
add: function(value) {
|
||
value += "";
|
||
this[prefix + value] = value;
|
||
return this;
|
||
},
|
||
remove: proto.remove,
|
||
clear: proto.clear,
|
||
values: proto.keys,
|
||
size: proto.size,
|
||
empty: proto.empty,
|
||
each: proto.each
|
||
};
|
||
|
||
function set(object, f) {
|
||
var set = new Set;
|
||
|
||
// Copy constructor.
|
||
if (object instanceof Set) object.each(function(value) { set.add(value); });
|
||
|
||
// Otherwise, assume it’s an array.
|
||
else if (object) {
|
||
var i = -1, n = object.length;
|
||
if (f == null) while (++i < n) set.add(object[i]);
|
||
else while (++i < n) set.add(f(object[i], i, object));
|
||
}
|
||
|
||
return set;
|
||
}
|
||
|
||
var keys = function(map) {
|
||
var keys = [];
|
||
for (var key in map) keys.push(key);
|
||
return keys;
|
||
};
|
||
|
||
var values = function(map) {
|
||
var values = [];
|
||
for (var key in map) values.push(map[key]);
|
||
return values;
|
||
};
|
||
|
||
var entries = function(map) {
|
||
var entries = [];
|
||
for (var key in map) entries.push({key: key, value: map[key]});
|
||
return entries;
|
||
};
|
||
|
||
exports.nest = nest;
|
||
exports.set = set;
|
||
exports.map = map;
|
||
exports.keys = keys;
|
||
exports.values = values;
|
||
exports.entries = entries;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
})));
|
||
|
||
},{}],3:[function(require,module,exports){
|
||
// https://d3js.org/d3-color/ Version 1.0.2. Copyright 2016 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 define = function(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;
|
||
}
|
||
|
||
function Color() {}
|
||
|
||
var darker = 0.7;
|
||
var brighter = 1 / darker;
|
||
|
||
var reI = "\\s*([+-]?\\d+)\\s*";
|
||
var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
|
||
var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
|
||
var reHex3 = /^#([0-9a-f]{3})$/;
|
||
var reHex6 = /^#([0-9a-f]{6})$/;
|
||
var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
|
||
var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
|
||
var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
|
||
var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
|
||
var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
|
||
var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
|
||
|
||
var named = {
|
||
aliceblue: 0xf0f8ff,
|
||
antiquewhite: 0xfaebd7,
|
||
aqua: 0x00ffff,
|
||
aquamarine: 0x7fffd4,
|
||
azure: 0xf0ffff,
|
||
beige: 0xf5f5dc,
|
||
bisque: 0xffe4c4,
|
||
black: 0x000000,
|
||
blanchedalmond: 0xffebcd,
|
||
blue: 0x0000ff,
|
||
blueviolet: 0x8a2be2,
|
||
brown: 0xa52a2a,
|
||
burlywood: 0xdeb887,
|
||
cadetblue: 0x5f9ea0,
|
||
chartreuse: 0x7fff00,
|
||
chocolate: 0xd2691e,
|
||
coral: 0xff7f50,
|
||
cornflowerblue: 0x6495ed,
|
||
cornsilk: 0xfff8dc,
|
||
crimson: 0xdc143c,
|
||
cyan: 0x00ffff,
|
||
darkblue: 0x00008b,
|
||
darkcyan: 0x008b8b,
|
||
darkgoldenrod: 0xb8860b,
|
||
darkgray: 0xa9a9a9,
|
||
darkgreen: 0x006400,
|
||
darkgrey: 0xa9a9a9,
|
||
darkkhaki: 0xbdb76b,
|
||
darkmagenta: 0x8b008b,
|
||
darkolivegreen: 0x556b2f,
|
||
darkorange: 0xff8c00,
|
||
darkorchid: 0x9932cc,
|
||
darkred: 0x8b0000,
|
||
darksalmon: 0xe9967a,
|
||
darkseagreen: 0x8fbc8f,
|
||
darkslateblue: 0x483d8b,
|
||
darkslategray: 0x2f4f4f,
|
||
darkslategrey: 0x2f4f4f,
|
||
darkturquoise: 0x00ced1,
|
||
darkviolet: 0x9400d3,
|
||
deeppink: 0xff1493,
|
||
deepskyblue: 0x00bfff,
|
||
dimgray: 0x696969,
|
||
dimgrey: 0x696969,
|
||
dodgerblue: 0x1e90ff,
|
||
firebrick: 0xb22222,
|
||
floralwhite: 0xfffaf0,
|
||
forestgreen: 0x228b22,
|
||
fuchsia: 0xff00ff,
|
||
gainsboro: 0xdcdcdc,
|
||
ghostwhite: 0xf8f8ff,
|
||
gold: 0xffd700,
|
||
goldenrod: 0xdaa520,
|
||
gray: 0x808080,
|
||
green: 0x008000,
|
||
greenyellow: 0xadff2f,
|
||
grey: 0x808080,
|
||
honeydew: 0xf0fff0,
|
||
hotpink: 0xff69b4,
|
||
indianred: 0xcd5c5c,
|
||
indigo: 0x4b0082,
|
||
ivory: 0xfffff0,
|
||
khaki: 0xf0e68c,
|
||
lavender: 0xe6e6fa,
|
||
lavenderblush: 0xfff0f5,
|
||
lawngreen: 0x7cfc00,
|
||
lemonchiffon: 0xfffacd,
|
||
lightblue: 0xadd8e6,
|
||
lightcoral: 0xf08080,
|
||
lightcyan: 0xe0ffff,
|
||
lightgoldenrodyellow: 0xfafad2,
|
||
lightgray: 0xd3d3d3,
|
||
lightgreen: 0x90ee90,
|
||
lightgrey: 0xd3d3d3,
|
||
lightpink: 0xffb6c1,
|
||
lightsalmon: 0xffa07a,
|
||
lightseagreen: 0x20b2aa,
|
||
lightskyblue: 0x87cefa,
|
||
lightslategray: 0x778899,
|
||
lightslategrey: 0x778899,
|
||
lightsteelblue: 0xb0c4de,
|
||
lightyellow: 0xffffe0,
|
||
lime: 0x00ff00,
|
||
limegreen: 0x32cd32,
|
||
linen: 0xfaf0e6,
|
||
magenta: 0xff00ff,
|
||
maroon: 0x800000,
|
||
mediumaquamarine: 0x66cdaa,
|
||
mediumblue: 0x0000cd,
|
||
mediumorchid: 0xba55d3,
|
||
mediumpurple: 0x9370db,
|
||
mediumseagreen: 0x3cb371,
|
||
mediumslateblue: 0x7b68ee,
|
||
mediumspringgreen: 0x00fa9a,
|
||
mediumturquoise: 0x48d1cc,
|
||
mediumvioletred: 0xc71585,
|
||
midnightblue: 0x191970,
|
||
mintcream: 0xf5fffa,
|
||
mistyrose: 0xffe4e1,
|
||
moccasin: 0xffe4b5,
|
||
navajowhite: 0xffdead,
|
||
navy: 0x000080,
|
||
oldlace: 0xfdf5e6,
|
||
olive: 0x808000,
|
||
olivedrab: 0x6b8e23,
|
||
orange: 0xffa500,
|
||
orangered: 0xff4500,
|
||
orchid: 0xda70d6,
|
||
palegoldenrod: 0xeee8aa,
|
||
palegreen: 0x98fb98,
|
||
paleturquoise: 0xafeeee,
|
||
palevioletred: 0xdb7093,
|
||
papayawhip: 0xffefd5,
|
||
peachpuff: 0xffdab9,
|
||
peru: 0xcd853f,
|
||
pink: 0xffc0cb,
|
||
plum: 0xdda0dd,
|
||
powderblue: 0xb0e0e6,
|
||
purple: 0x800080,
|
||
rebeccapurple: 0x663399,
|
||
red: 0xff0000,
|
||
rosybrown: 0xbc8f8f,
|
||
royalblue: 0x4169e1,
|
||
saddlebrown: 0x8b4513,
|
||
salmon: 0xfa8072,
|
||
sandybrown: 0xf4a460,
|
||
seagreen: 0x2e8b57,
|
||
seashell: 0xfff5ee,
|
||
sienna: 0xa0522d,
|
||
silver: 0xc0c0c0,
|
||
skyblue: 0x87ceeb,
|
||
slateblue: 0x6a5acd,
|
||
slategray: 0x708090,
|
||
slategrey: 0x708090,
|
||
snow: 0xfffafa,
|
||
springgreen: 0x00ff7f,
|
||
steelblue: 0x4682b4,
|
||
tan: 0xd2b48c,
|
||
teal: 0x008080,
|
||
thistle: 0xd8bfd8,
|
||
tomato: 0xff6347,
|
||
turquoise: 0x40e0d0,
|
||
violet: 0xee82ee,
|
||
wheat: 0xf5deb3,
|
||
white: 0xffffff,
|
||
whitesmoke: 0xf5f5f5,
|
||
yellow: 0xffff00,
|
||
yellowgreen: 0x9acd32
|
||
};
|
||
|
||
define(Color, color, {
|
||
displayable: function() {
|
||
return this.rgb().displayable();
|
||
},
|
||
toString: function() {
|
||
return this.rgb() + "";
|
||
}
|
||
});
|
||
|
||
function color(format) {
|
||
var m;
|
||
format = (format + "").trim().toLowerCase();
|
||
return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00
|
||
: (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000
|
||
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
|
||
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
|
||
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
|
||
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
|
||
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
|
||
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
|
||
: named.hasOwnProperty(format) ? rgbn(named[format])
|
||
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
|
||
: null;
|
||
}
|
||
|
||
function rgbn(n) {
|
||
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
|
||
}
|
||
|
||
function rgba(r, g, b, a) {
|
||
if (a <= 0) r = g = b = NaN;
|
||
return new Rgb(r, g, b, a);
|
||
}
|
||
|
||
function rgbConvert(o) {
|
||
if (!(o instanceof Color)) o = color(o);
|
||
if (!o) return new Rgb;
|
||
o = o.rgb();
|
||
return new Rgb(o.r, o.g, o.b, o.opacity);
|
||
}
|
||
|
||
function rgb(r, g, b, opacity) {
|
||
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
||
}
|
||
|
||
function Rgb(r, g, b, opacity) {
|
||
this.r = +r;
|
||
this.g = +g;
|
||
this.b = +b;
|
||
this.opacity = +opacity;
|
||
}
|
||
|
||
define(Rgb, rgb, extend(Color, {
|
||
brighter: function(k) {
|
||
k = k == null ? brighter : Math.pow(brighter, k);
|
||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
||
},
|
||
darker: function(k) {
|
||
k = k == null ? darker : Math.pow(darker, k);
|
||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
||
},
|
||
rgb: function() {
|
||
return this;
|
||
},
|
||
displayable: function() {
|
||
return (0 <= this.r && this.r <= 255)
|
||
&& (0 <= this.g && this.g <= 255)
|
||
&& (0 <= this.b && this.b <= 255)
|
||
&& (0 <= this.opacity && this.opacity <= 1);
|
||
},
|
||
toString: function() {
|
||
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
|
||
return (a === 1 ? "rgb(" : "rgba(")
|
||
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
|
||
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
|
||
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
|
||
+ (a === 1 ? ")" : ", " + a + ")");
|
||
}
|
||
}));
|
||
|
||
function hsla(h, s, l, a) {
|
||
if (a <= 0) h = s = l = NaN;
|
||
else if (l <= 0 || l >= 1) h = s = NaN;
|
||
else if (s <= 0) h = NaN;
|
||
return new Hsl(h, s, l, a);
|
||
}
|
||
|
||
function hslConvert(o) {
|
||
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
||
if (!(o instanceof Color)) o = color(o);
|
||
if (!o) return new Hsl;
|
||
if (o instanceof Hsl) return o;
|
||
o = o.rgb();
|
||
var r = o.r / 255,
|
||
g = o.g / 255,
|
||
b = o.b / 255,
|
||
min = Math.min(r, g, b),
|
||
max = Math.max(r, g, b),
|
||
h = NaN,
|
||
s = max - min,
|
||
l = (max + min) / 2;
|
||
if (s) {
|
||
if (r === max) h = (g - b) / s + (g < b) * 6;
|
||
else if (g === max) h = (b - r) / s + 2;
|
||
else h = (r - g) / s + 4;
|
||
s /= l < 0.5 ? max + min : 2 - max - min;
|
||
h *= 60;
|
||
} else {
|
||
s = l > 0 && l < 1 ? 0 : h;
|
||
}
|
||
return new Hsl(h, s, l, o.opacity);
|
||
}
|
||
|
||
function hsl(h, s, l, opacity) {
|
||
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
||
}
|
||
|
||
function Hsl(h, s, l, opacity) {
|
||
this.h = +h;
|
||
this.s = +s;
|
||
this.l = +l;
|
||
this.opacity = +opacity;
|
||
}
|
||
|
||
define(Hsl, hsl, extend(Color, {
|
||
brighter: function(k) {
|
||
k = k == null ? brighter : Math.pow(brighter, k);
|
||
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
||
},
|
||
darker: function(k) {
|
||
k = k == null ? darker : Math.pow(darker, k);
|
||
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
||
},
|
||
rgb: function() {
|
||
var h = this.h % 360 + (this.h < 0) * 360,
|
||
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
||
l = this.l,
|
||
m2 = l + (l < 0.5 ? l : 1 - l) * s,
|
||
m1 = 2 * l - m2;
|
||
return new Rgb(
|
||
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
||
hsl2rgb(h, m1, m2),
|
||
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
||
this.opacity
|
||
);
|
||
},
|
||
displayable: function() {
|
||
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
||
&& (0 <= this.l && this.l <= 1)
|
||
&& (0 <= this.opacity && this.opacity <= 1);
|
||
}
|
||
}));
|
||
|
||
/* From FvD 13.37, CSS Color Module Level 3 */
|
||
function hsl2rgb(h, m1, m2) {
|
||
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
||
: h < 180 ? m2
|
||
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
|
||
: m1) * 255;
|
||
}
|
||
|
||
var deg2rad = Math.PI / 180;
|
||
var rad2deg = 180 / Math.PI;
|
||
|
||
var Kn = 18;
|
||
var Xn = 0.950470;
|
||
var Yn = 1;
|
||
var Zn = 1.088830;
|
||
var t0 = 4 / 29;
|
||
var t1 = 6 / 29;
|
||
var t2 = 3 * t1 * t1;
|
||
var t3 = t1 * t1 * t1;
|
||
|
||
function labConvert(o) {
|
||
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
|
||
if (o instanceof Hcl) {
|
||
var h = o.h * deg2rad;
|
||
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
|
||
}
|
||
if (!(o instanceof Rgb)) o = rgbConvert(o);
|
||
var b = rgb2xyz(o.r),
|
||
a = rgb2xyz(o.g),
|
||
l = rgb2xyz(o.b),
|
||
x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
|
||
y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
|
||
z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
|
||
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
|
||
}
|
||
|
||
function lab(l, a, b, opacity) {
|
||
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
|
||
}
|
||
|
||
function Lab(l, a, b, opacity) {
|
||
this.l = +l;
|
||
this.a = +a;
|
||
this.b = +b;
|
||
this.opacity = +opacity;
|
||
}
|
||
|
||
define(Lab, lab, extend(Color, {
|
||
brighter: function(k) {
|
||
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
||
},
|
||
darker: function(k) {
|
||
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
|
||
},
|
||
rgb: function() {
|
||
var y = (this.l + 16) / 116,
|
||
x = isNaN(this.a) ? y : y + this.a / 500,
|
||
z = isNaN(this.b) ? y : y - this.b / 200;
|
||
y = Yn * lab2xyz(y);
|
||
x = Xn * lab2xyz(x);
|
||
z = Zn * lab2xyz(z);
|
||
return new Rgb(
|
||
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
|
||
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
|
||
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
|
||
this.opacity
|
||
);
|
||
}
|
||
}));
|
||
|
||
function xyz2lab(t) {
|
||
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
|
||
}
|
||
|
||
function lab2xyz(t) {
|
||
return t > t1 ? t * t * t : t2 * (t - t0);
|
||
}
|
||
|
||
function xyz2rgb(x) {
|
||
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
||
}
|
||
|
||
function rgb2xyz(x) {
|
||
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
|
||
}
|
||
|
||
function hclConvert(o) {
|
||
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
|
||
if (!(o instanceof Lab)) o = labConvert(o);
|
||
var h = Math.atan2(o.b, o.a) * rad2deg;
|
||
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
|
||
}
|
||
|
||
function hcl(h, c, l, opacity) {
|
||
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
|
||
}
|
||
|
||
function Hcl(h, c, l, opacity) {
|
||
this.h = +h;
|
||
this.c = +c;
|
||
this.l = +l;
|
||
this.opacity = +opacity;
|
||
}
|
||
|
||
define(Hcl, hcl, extend(Color, {
|
||
brighter: function(k) {
|
||
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
|
||
},
|
||
darker: function(k) {
|
||
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
|
||
},
|
||
rgb: function() {
|
||
return labConvert(this).rgb();
|
||
}
|
||
}));
|
||
|
||
var A = -0.14861;
|
||
var B = +1.78277;
|
||
var C = -0.29227;
|
||
var D = -0.90649;
|
||
var E = +1.97294;
|
||
var ED = E * D;
|
||
var EB = E * B;
|
||
var BC_DA = B * C - D * A;
|
||
|
||
function cubehelixConvert(o) {
|
||
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
|
||
if (!(o instanceof Rgb)) o = rgbConvert(o);
|
||
var r = o.r / 255,
|
||
g = o.g / 255,
|
||
b = o.b / 255,
|
||
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
|
||
bl = b - l,
|
||
k = (E * (g - l) - C * bl) / D,
|
||
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
|
||
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
|
||
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
|
||
}
|
||
|
||
function cubehelix(h, s, l, opacity) {
|
||
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
|
||
}
|
||
|
||
function Cubehelix(h, s, l, opacity) {
|
||
this.h = +h;
|
||
this.s = +s;
|
||
this.l = +l;
|
||
this.opacity = +opacity;
|
||
}
|
||
|
||
define(Cubehelix, cubehelix, extend(Color, {
|
||
brighter: function(k) {
|
||
k = k == null ? brighter : Math.pow(brighter, k);
|
||
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
||
},
|
||
darker: function(k) {
|
||
k = k == null ? darker : Math.pow(darker, k);
|
||
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
|
||
},
|
||
rgb: function() {
|
||
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
|
||
l = +this.l,
|
||
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
|
||
cosh = Math.cos(h),
|
||
sinh = Math.sin(h);
|
||
return new Rgb(
|
||
255 * (l + a * (A * cosh + B * sinh)),
|
||
255 * (l + a * (C * cosh + D * sinh)),
|
||
255 * (l + a * (E * cosh)),
|
||
this.opacity
|
||
);
|
||
}
|
||
}));
|
||
|
||
exports.color = color;
|
||
exports.rgb = rgb;
|
||
exports.hsl = hsl;
|
||
exports.lab = lab;
|
||
exports.hcl = hcl;
|
||
exports.cubehelix = cubehelix;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
})));
|
||
|
||
},{}],4:[function(require,module,exports){
|
||
// https://d3js.org/d3-dispatch/ Version 1.0.1. Copyright 2016 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 noop = {value: function() {}};
|
||
|
||
function dispatch() {
|
||
for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
|
||
if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t);
|
||
_[t] = [];
|
||
}
|
||
return new Dispatch(_);
|
||
}
|
||
|
||
function Dispatch(_) {
|
||
this._ = _;
|
||
}
|
||
|
||
function parseTypenames(typenames, types) {
|
||
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);
|
||
if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
||
return {type: t, name: name};
|
||
});
|
||
}
|
||
|
||
Dispatch.prototype = dispatch.prototype = {
|
||
constructor: Dispatch,
|
||
on: function(typename, callback) {
|
||
var _ = this._,
|
||
T = parseTypenames(typename + "", _),
|
||
t,
|
||
i = -1,
|
||
n = T.length;
|
||
|
||
// If no callback was specified, return the callback of the given type and name.
|
||
if (arguments.length < 2) {
|
||
while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
|
||
return;
|
||
}
|
||
|
||
// If a type was specified, set the callback for the given type and name.
|
||
// Otherwise, if a null callback was specified, remove callbacks of the given name.
|
||
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
|
||
while (++i < n) {
|
||
if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
|
||
else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
copy: function() {
|
||
var copy = {}, _ = this._;
|
||
for (var t in _) copy[t] = _[t].slice();
|
||
return new Dispatch(copy);
|
||
},
|
||
call: function(type, that) {
|
||
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
|
||
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
||
for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
||
},
|
||
apply: function(type, that, args) {
|
||
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
|
||
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
|
||
}
|
||
};
|
||
|
||
function get(type, name) {
|
||
for (var i = 0, n = type.length, c; i < n; ++i) {
|
||
if ((c = type[i]).name === name) {
|
||
return c.value;
|
||
}
|
||
}
|
||
}
|
||
|
||
function set(type, name, callback) {
|
||
for (var i = 0, n = type.length; i < n; ++i) {
|
||
if (type[i].name === name) {
|
||
type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
|
||
break;
|
||
}
|
||
}
|
||
if (callback != null) type.push({name: name, value: callback});
|
||
return type;
|
||
}
|
||
|
||
exports.dispatch = dispatch;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
}));
|
||
},{}],5:[function(require,module,exports){
|
||
// https://d3js.org/d3-format/ Version 1.0.2. Copyright 2016 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';
|
||
|
||
// 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].
|
||
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)
|
||
];
|
||
}
|
||
|
||
function exponent(x) {
|
||
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
|
||
}
|
||
|
||
function formatGroup(grouping, thousands) {
|
||
return function(value, width) {
|
||
var i = value.length,
|
||
t = [],
|
||
j = 0,
|
||
g = grouping[0],
|
||
length = 0;
|
||
|
||
while (i > 0 && g > 0) {
|
||
if (length + g + 1 > width) g = Math.max(1, width - length);
|
||
t.push(value.substring(i -= g, i + g));
|
||
if ((length += g + 1) > width) break;
|
||
g = grouping[j = (j + 1) % grouping.length];
|
||
}
|
||
|
||
return t.reverse().join(thousands);
|
||
};
|
||
}
|
||
|
||
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;
|
||
case "0": if (i0 === 0) i0 = i; i1 = i; break;
|
||
case "e": break out;
|
||
default: if (i0 > 0) i0 = 0; break;
|
||
}
|
||
}
|
||
|
||
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
|
||
}
|
||
|
||
var prefixExponent;
|
||
|
||
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!
|
||
}
|
||
|
||
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); },
|
||
"c": function(x) { return x + ""; },
|
||
"d": function(x) { return Math.round(x).toString(10); },
|
||
"e": function(x, p) { return x.toExponential(p); },
|
||
"f": function(x, p) { return x.toFixed(p); },
|
||
"g": function(x, p) { return x.toPrecision(p); },
|
||
"o": function(x) { return Math.round(x).toString(8); },
|
||
"p": function(x, p) { return formatRounded(x * 100, p); },
|
||
"r": formatRounded,
|
||
"s": formatPrefixAuto,
|
||
"X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
|
||
"x": function(x) { return Math.round(x).toString(16); }
|
||
};
|
||
|
||
// [[fill]align][sign][symbol][0][width][,][.precision][type]
|
||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;
|
||
|
||
function formatSpecifier(specifier) {
|
||
return new FormatSpecifier(specifier);
|
||
}
|
||
|
||
function FormatSpecifier(specifier) {
|
||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
||
|
||
var match,
|
||
fill = match[1] || " ",
|
||
align = match[2] || ">",
|
||
sign = match[3] || "-",
|
||
symbol = match[4] || "",
|
||
zero = !!match[5],
|
||
width = match[6] && +match[6],
|
||
comma = !!match[7],
|
||
precision = match[8] && +match[8].slice(1),
|
||
type = match[9] || "";
|
||
|
||
// The "n" type is an alias for ",g".
|
||
if (type === "n") comma = true, type = "g";
|
||
|
||
// Map invalid types to the default format.
|
||
else if (!formatTypes[type]) type = "";
|
||
|
||
// If zero fill is specified, padding goes after sign and before digits.
|
||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
|
||
|
||
this.fill = fill;
|
||
this.align = align;
|
||
this.sign = sign;
|
||
this.symbol = symbol;
|
||
this.zero = zero;
|
||
this.width = width;
|
||
this.comma = comma;
|
||
this.precision = precision;
|
||
this.type = type;
|
||
}
|
||
|
||
FormatSpecifier.prototype.toString = function() {
|
||
return this.fill
|
||
+ this.align
|
||
+ this.sign
|
||
+ this.symbol
|
||
+ (this.zero ? "0" : "")
|
||
+ (this.width == null ? "" : Math.max(1, this.width | 0))
|
||
+ (this.comma ? "," : "")
|
||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
|
||
+ this.type;
|
||
};
|
||
|
||
var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
||
|
||
function identity(x) {
|
||
return x;
|
||
}
|
||
|
||
function formatLocale(locale) {
|
||
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,
|
||
currency = locale.currency,
|
||
decimal = locale.decimal;
|
||
|
||
function newFormat(specifier) {
|
||
specifier = formatSpecifier(specifier);
|
||
|
||
var fill = specifier.fill,
|
||
align = specifier.align,
|
||
sign = specifier.sign,
|
||
symbol = specifier.symbol,
|
||
zero = specifier.zero,
|
||
width = specifier.width,
|
||
comma = specifier.comma,
|
||
precision = specifier.precision,
|
||
type = specifier.type;
|
||
|
||
// Compute the prefix and suffix.
|
||
// For SI-prefix, the suffix is lazily computed.
|
||
var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
|
||
suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? "%" : "";
|
||
|
||
// What format function should we use?
|
||
// Is this an integer type?
|
||
// Can this type generate exponential notation?
|
||
var formatType = formatTypes[type],
|
||
maybeSuffix = !type || /[defgprs%]/.test(type);
|
||
|
||
// Set the default precision if not specified,
|
||
// or clamp the specified precision to the supported range.
|
||
// For significant precision, it must be in [1, 21].
|
||
// For fixed precision, it must be in [0, 20].
|
||
precision = precision == null ? (type ? 6 : 12)
|
||
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
|
||
: Math.max(0, Math.min(20, precision));
|
||
|
||
function format(value) {
|
||
var valuePrefix = prefix,
|
||
valueSuffix = suffix,
|
||
i, n, c;
|
||
|
||
if (type === "c") {
|
||
valueSuffix = formatType(value) + valueSuffix;
|
||
value = "";
|
||
} else {
|
||
value = +value;
|
||
|
||
// Convert negative to positive, and compute the prefix.
|
||
// Note that -0 is not less than 0, but 1 / -0 is!
|
||
var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);
|
||
|
||
// Perform the initial formatting.
|
||
value = formatType(value, precision);
|
||
|
||
// If the original value was negative, it may be rounded to zero during
|
||
// formatting; treat this as (positive) zero.
|
||
if (valueNegative) {
|
||
i = -1, n = value.length;
|
||
valueNegative = false;
|
||
while (++i < n) {
|
||
if (c = value.charCodeAt(i), (48 < c && c < 58)
|
||
|| (type === "x" && 96 < c && c < 103)
|
||
|| (type === "X" && 64 < c && c < 71)) {
|
||
valueNegative = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Compute the prefix and suffix.
|
||
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
||
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (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;
|
||
while (++i < n) {
|
||
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
||
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
||
value = value.slice(0, i);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// If the fill character is not "0", grouping is applied before padding.
|
||
if (comma && !zero) value = group(value, Infinity);
|
||
|
||
// Compute the padding.
|
||
var length = valuePrefix.length + value.length + valueSuffix.length,
|
||
padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
||
|
||
// If the fill character is "0", grouping is applied after padding.
|
||
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
||
|
||
// Reconstruct the final output based on the desired alignment.
|
||
switch (align) {
|
||
case "<": return valuePrefix + value + valueSuffix + padding;
|
||
case "=": return valuePrefix + padding + value + valueSuffix;
|
||
case "^": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
|
||
}
|
||
return padding + valuePrefix + value + valueSuffix;
|
||
}
|
||
|
||
format.toString = function() {
|
||
return specifier + "";
|
||
};
|
||
|
||
return format;
|
||
}
|
||
|
||
function formatPrefix(specifier, value) {
|
||
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
|
||
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
|
||
k = Math.pow(10, -e),
|
||
prefix = prefixes[8 + e / 3];
|
||
return function(value) {
|
||
return f(k * value) + prefix;
|
||
};
|
||
}
|
||
|
||
return {
|
||
format: newFormat,
|
||
formatPrefix: formatPrefix
|
||
};
|
||
}
|
||
|
||
var locale;
|
||
defaultLocale({
|
||
decimal: ".",
|
||
thousands: ",",
|
||
grouping: [3],
|
||
currency: ["$", ""]
|
||
});
|
||
|
||
function defaultLocale(definition) {
|
||
locale = formatLocale(definition);
|
||
exports.format = locale.format;
|
||
exports.formatPrefix = locale.formatPrefix;
|
||
return locale;
|
||
}
|
||
|
||
function precisionFixed(step) {
|
||
return Math.max(0, -exponent(Math.abs(step)));
|
||
}
|
||
|
||
function precisionPrefix(step, value) {
|
||
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
|
||
}
|
||
|
||
function precisionRound(step, max) {
|
||
step = Math.abs(step), max = Math.abs(max) - step;
|
||
return Math.max(0, exponent(max) - exponent(step)) + 1;
|
||
}
|
||
|
||
exports.formatDefaultLocale = defaultLocale;
|
||
exports.formatLocale = formatLocale;
|
||
exports.formatSpecifier = formatSpecifier;
|
||
exports.precisionFixed = precisionFixed;
|
||
exports.precisionPrefix = precisionPrefix;
|
||
exports.precisionRound = precisionRound;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
}));
|
||
},{}],6:[function(require,module,exports){
|
||
// https://d3js.org/d3-interpolate/ Version 1.1.2. Copyright 2016 Mike Bostock.
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-color')) :
|
||
typeof define === 'function' && define.amd ? define(['exports', 'd3-color'], factory) :
|
||
(factory((global.d3 = global.d3 || {}),global.d3));
|
||
}(this, (function (exports,d3Color) { 'use strict';
|
||
|
||
function basis(t1, v0, v1, v2, v3) {
|
||
var t2 = t1 * t1, t3 = t2 * t1;
|
||
return ((1 - 3 * t1 + 3 * t2 - t3) * v0
|
||
+ (4 - 6 * t2 + 3 * t3) * v1
|
||
+ (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
|
||
+ t3 * v3) / 6;
|
||
}
|
||
|
||
var basis$1 = function(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) {
|
||
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 = function(x) {
|
||
return function() {
|
||
return x;
|
||
};
|
||
};
|
||
|
||
function linear(a, d) {
|
||
return function(t) {
|
||
return a + t * d;
|
||
};
|
||
}
|
||
|
||
function exponential(a, b, y) {
|
||
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
||
return Math.pow(a + t * b, y);
|
||
};
|
||
}
|
||
|
||
function hue(a, b) {
|
||
var d = b - a;
|
||
return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
|
||
}
|
||
|
||
function gamma(y) {
|
||
return (y = +y) === 1 ? nogamma : function(a, b) {
|
||
return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
|
||
};
|
||
}
|
||
|
||
function nogamma(a, b) {
|
||
var d = b - a;
|
||
return d ? linear(a, d) : constant(isNaN(a) ? b : a);
|
||
}
|
||
|
||
var rgb$1 = (function rgbGamma(y) {
|
||
var color$$1 = gamma(y);
|
||
|
||
function rgb$$1(start, end) {
|
||
var r = color$$1((start = d3Color.rgb(start)).r, (end = d3Color.rgb(end)).r),
|
||
g = color$$1(start.g, end.g),
|
||
b = color$$1(start.b, end.b),
|
||
opacity = color$$1(start.opacity, end.opacity);
|
||
return function(t) {
|
||
start.r = r(t);
|
||
start.g = g(t);
|
||
start.b = b(t);
|
||
start.opacity = opacity(t);
|
||
return start + "";
|
||
};
|
||
}
|
||
|
||
rgb$$1.gamma = rgbGamma;
|
||
|
||
return rgb$$1;
|
||
})(1);
|
||
|
||
function rgbSpline(spline) {
|
||
return function(colors) {
|
||
var n = colors.length,
|
||
r = new Array(n),
|
||
g = new Array(n),
|
||
b = new Array(n),
|
||
i, color$$1;
|
||
for (i = 0; i < n; ++i) {
|
||
color$$1 = d3Color.rgb(colors[i]);
|
||
r[i] = color$$1.r || 0;
|
||
g[i] = color$$1.g || 0;
|
||
b[i] = color$$1.b || 0;
|
||
}
|
||
r = spline(r);
|
||
g = spline(g);
|
||
b = spline(b);
|
||
color$$1.opacity = 1;
|
||
return function(t) {
|
||
color$$1.r = r(t);
|
||
color$$1.g = g(t);
|
||
color$$1.b = b(t);
|
||
return color$$1 + "";
|
||
};
|
||
};
|
||
}
|
||
|
||
var rgbBasis = rgbSpline(basis$1);
|
||
var rgbBasisClosed = rgbSpline(basisClosed);
|
||
|
||
var array = function(a, b) {
|
||
var nb = b ? b.length : 0,
|
||
na = a ? Math.min(nb, a.length) : 0,
|
||
x = new Array(nb),
|
||
c = new Array(nb),
|
||
i;
|
||
|
||
for (i = 0; i < na; ++i) x[i] = value(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) {
|
||
var d = new Date;
|
||
return a = +a, b -= a, function(t) {
|
||
return d.setTime(a + b * t), d;
|
||
};
|
||
};
|
||
|
||
var number = function(a, b) {
|
||
return a = +a, b -= a, function(t) {
|
||
return a + b * t;
|
||
};
|
||
};
|
||
|
||
var object = function(a, b) {
|
||
var i = {},
|
||
c = {},
|
||
k;
|
||
|
||
if (a === null || typeof a !== "object") a = {};
|
||
if (b === null || typeof b !== "object") b = {};
|
||
|
||
for (k in b) {
|
||
if (k in a) {
|
||
i[k] = value(a[k], b[k]);
|
||
} else {
|
||
c[k] = b[k];
|
||
}
|
||
}
|
||
|
||
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) {
|
||
return function() {
|
||
return b;
|
||
};
|
||
}
|
||
|
||
function one(b) {
|
||
return function(t) {
|
||
return b(t) + "";
|
||
};
|
||
}
|
||
|
||
var string = function(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
|
||
s = [], // string constants and placeholders
|
||
q = []; // number interpolators
|
||
|
||
// Coerce inputs to strings.
|
||
a = a + "", b = b + "";
|
||
|
||
// Interpolate pairs of numbers in a & b.
|
||
while ((am = reA.exec(a))
|
||
&& (bm = reB.exec(b))) {
|
||
if ((bs = bm.index) > bi) { // a string precedes the next number in b
|
||
bs = b.slice(bi, bs);
|
||
if (s[i]) s[i] += bs; // coalesce with previous string
|
||
else s[++i] = bs;
|
||
}
|
||
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
|
||
if (s[i]) s[i] += bm; // coalesce with previous string
|
||
else s[++i] = bm;
|
||
} else { // interpolate non-matching numbers
|
||
s[++i] = null;
|
||
q.push({i: i, x: number(am, bm)});
|
||
}
|
||
bi = reB.lastIndex;
|
||
}
|
||
|
||
// Add remains of b.
|
||
if (bi < b.length) {
|
||
bs = b.slice(bi);
|
||
if (s[i]) s[i] += bs; // coalesce with previous string
|
||
else s[++i] = bs;
|
||
}
|
||
|
||
// Special optimization for only a single match.
|
||
// Otherwise, interpolate each of the numbers and rejoin the string.
|
||
return s.length < 2 ? (q[0]
|
||
? one(q[0].x)
|
||
: 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 value = function(a, b) {
|
||
var t = typeof b, c;
|
||
return b == null || t === "boolean" ? constant(b)
|
||
: (t === "number" ? number
|
||
: t === "string" ? ((c = d3Color.color(b)) ? (b = c, rgb$1) : string)
|
||
: b instanceof d3Color.color ? rgb$1
|
||
: b instanceof Date ? date
|
||
: Array.isArray(b) ? array
|
||
: isNaN(b) ? object
|
||
: number)(a, b);
|
||
};
|
||
|
||
var round = function(a, b) {
|
||
return a = +a, b -= a, function(t) {
|
||
return Math.round(a + b * t);
|
||
};
|
||
};
|
||
|
||
var degrees = 180 / Math.PI;
|
||
|
||
var identity = {
|
||
translateX: 0,
|
||
translateY: 0,
|
||
rotate: 0,
|
||
skewX: 0,
|
||
scaleX: 1,
|
||
scaleY: 1
|
||
};
|
||
|
||
var decompose = function(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;
|
||
return {
|
||
translateX: e,
|
||
translateY: f,
|
||
rotate: Math.atan2(b, a) * degrees,
|
||
skewX: Math.atan(skewX) * degrees,
|
||
scaleX: scaleX,
|
||
scaleY: scaleY
|
||
};
|
||
};
|
||
|
||
var cssNode;
|
||
var cssRoot;
|
||
var cssView;
|
||
var svgNode;
|
||
|
||
function parseCss(value) {
|
||
if (value === "none") return identity;
|
||
if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
|
||
cssNode.style.transform = value;
|
||
value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
|
||
cssRoot.removeChild(cssNode);
|
||
value = value.slice(7, -1).split(",");
|
||
return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
|
||
}
|
||
|
||
function parseSvg(value) {
|
||
if (value == null) return identity;
|
||
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
||
svgNode.setAttribute("transform", value);
|
||
if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
|
||
value = value.matrix;
|
||
return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
||
}
|
||
|
||
function interpolateTransform(parse, pxComma, pxParen, degParen) {
|
||
|
||
function pop(s) {
|
||
return s.length ? s.pop() + " " : "";
|
||
}
|
||
|
||
function translate(xa, ya, xb, yb, s, q) {
|
||
if (xa !== xb || ya !== yb) {
|
||
var i = s.push("translate(", null, pxComma, null, pxParen);
|
||
q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
|
||
} else if (xb || yb) {
|
||
s.push("translate(" + xb + pxComma + yb + pxParen);
|
||
}
|
||
}
|
||
|
||
function rotate(a, b, s, q) {
|
||
if (a !== b) {
|
||
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
|
||
q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)});
|
||
} else if (b) {
|
||
s.push(pop(s) + "rotate(" + b + degParen);
|
||
}
|
||
}
|
||
|
||
function skewX(a, b, s, q) {
|
||
if (a !== b) {
|
||
q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)});
|
||
} else if (b) {
|
||
s.push(pop(s) + "skewX(" + b + degParen);
|
||
}
|
||
}
|
||
|
||
function scale(xa, ya, xb, yb, s, q) {
|
||
if (xa !== xb || ya !== yb) {
|
||
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
||
q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
|
||
} else if (xb !== 1 || yb !== 1) {
|
||
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
||
}
|
||
}
|
||
|
||
return function(a, b) {
|
||
var s = [], // string constants and placeholders
|
||
q = []; // number interpolators
|
||
a = parse(a), b = parse(b);
|
||
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
||
rotate(a.rotate, b.rotate, s, q);
|
||
skewX(a.skewX, b.skewX, s, q);
|
||
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
||
a = b = null; // gc
|
||
return function(t) {
|
||
var i = -1, n = q.length, o;
|
||
while (++i < n) s[(o = q[i]).i] = o.x(t);
|
||
return s.join("");
|
||
};
|
||
};
|
||
}
|
||
|
||
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
||
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
||
|
||
var rho = Math.SQRT2;
|
||
var rho2 = 2;
|
||
var rho4 = 4;
|
||
var epsilon2 = 1e-12;
|
||
|
||
function cosh(x) {
|
||
return ((x = Math.exp(x)) + 1 / x) / 2;
|
||
}
|
||
|
||
function sinh(x) {
|
||
return ((x = Math.exp(x)) - 1 / x) / 2;
|
||
}
|
||
|
||
function tanh(x) {
|
||
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
|
||
}
|
||
|
||
// p0 = [ux0, uy0, w0]
|
||
// p1 = [ux1, uy1, w1]
|
||
var zoom = function(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,
|
||
i,
|
||
S;
|
||
|
||
// Special case for u0 ≅ u1.
|
||
if (d2 < epsilon2) {
|
||
S = Math.log(w1 / w0) / rho;
|
||
i = function(t) {
|
||
return [
|
||
ux0 + t * dx,
|
||
uy0 + t * dy,
|
||
w0 * Math.exp(rho * t * S)
|
||
];
|
||
};
|
||
}
|
||
|
||
// General case.
|
||
else {
|
||
var d1 = Math.sqrt(d2),
|
||
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
|
||
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
|
||
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
|
||
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
||
S = (r1 - r0) / rho;
|
||
i = function(t) {
|
||
var s = t * S,
|
||
coshr0 = cosh(r0),
|
||
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
||
return [
|
||
ux0 + u * dx,
|
||
uy0 + u * dy,
|
||
w0 * coshr0 / cosh(rho * s + r0)
|
||
];
|
||
};
|
||
}
|
||
|
||
i.duration = S * 1000;
|
||
|
||
return i;
|
||
};
|
||
|
||
function hsl$1(hue$$1) {
|
||
return function(start, end) {
|
||
var h = hue$$1((start = d3Color.hsl(start)).h, (end = d3Color.hsl(end)).h),
|
||
s = nogamma(start.s, end.s),
|
||
l = nogamma(start.l, end.l),
|
||
opacity = nogamma(start.opacity, end.opacity);
|
||
return function(t) {
|
||
start.h = h(t);
|
||
start.s = s(t);
|
||
start.l = l(t);
|
||
start.opacity = opacity(t);
|
||
return start + "";
|
||
};
|
||
}
|
||
}
|
||
|
||
var hsl$2 = hsl$1(hue);
|
||
var hslLong = hsl$1(nogamma);
|
||
|
||
function lab$1(start, end) {
|
||
var l = nogamma((start = d3Color.lab(start)).l, (end = d3Color.lab(end)).l),
|
||
a = nogamma(start.a, end.a),
|
||
b = nogamma(start.b, end.b),
|
||
opacity = nogamma(start.opacity, end.opacity);
|
||
return function(t) {
|
||
start.l = l(t);
|
||
start.a = a(t);
|
||
start.b = b(t);
|
||
start.opacity = opacity(t);
|
||
return start + "";
|
||
};
|
||
}
|
||
|
||
function hcl$1(hue$$1) {
|
||
return function(start, end) {
|
||
var h = hue$$1((start = d3Color.hcl(start)).h, (end = d3Color.hcl(end)).h),
|
||
c = nogamma(start.c, end.c),
|
||
l = nogamma(start.l, end.l),
|
||
opacity = nogamma(start.opacity, end.opacity);
|
||
return function(t) {
|
||
start.h = h(t);
|
||
start.c = c(t);
|
||
start.l = l(t);
|
||
start.opacity = opacity(t);
|
||
return start + "";
|
||
};
|
||
}
|
||
}
|
||
|
||
var hcl$2 = hcl$1(hue);
|
||
var hclLong = hcl$1(nogamma);
|
||
|
||
function cubehelix$1(hue$$1) {
|
||
return (function cubehelixGamma(y) {
|
||
y = +y;
|
||
|
||
function cubehelix$$1(start, end) {
|
||
var h = hue$$1((start = d3Color.cubehelix(start)).h, (end = d3Color.cubehelix(end)).h),
|
||
s = nogamma(start.s, end.s),
|
||
l = nogamma(start.l, end.l),
|
||
opacity = nogamma(start.opacity, end.opacity);
|
||
return function(t) {
|
||
start.h = h(t);
|
||
start.s = s(t);
|
||
start.l = l(Math.pow(t, y));
|
||
start.opacity = opacity(t);
|
||
return start + "";
|
||
};
|
||
}
|
||
|
||
cubehelix$$1.gamma = cubehelixGamma;
|
||
|
||
return cubehelix$$1;
|
||
})(1);
|
||
}
|
||
|
||
var cubehelix$2 = cubehelix$1(hue);
|
||
var cubehelixLong = cubehelix$1(nogamma);
|
||
|
||
var quantize = function(interpolator, n) {
|
||
var samples = new Array(n);
|
||
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
|
||
return samples;
|
||
};
|
||
|
||
exports.interpolate = value;
|
||
exports.interpolateArray = array;
|
||
exports.interpolateBasis = basis$1;
|
||
exports.interpolateBasisClosed = basisClosed;
|
||
exports.interpolateDate = date;
|
||
exports.interpolateNumber = number;
|
||
exports.interpolateObject = object;
|
||
exports.interpolateRound = round;
|
||
exports.interpolateString = string;
|
||
exports.interpolateTransformCss = interpolateTransformCss;
|
||
exports.interpolateTransformSvg = interpolateTransformSvg;
|
||
exports.interpolateZoom = zoom;
|
||
exports.interpolateRgb = rgb$1;
|
||
exports.interpolateRgbBasis = rgbBasis;
|
||
exports.interpolateRgbBasisClosed = rgbBasisClosed;
|
||
exports.interpolateHsl = hsl$2;
|
||
exports.interpolateHslLong = hslLong;
|
||
exports.interpolateLab = lab$1;
|
||
exports.interpolateHcl = hcl$2;
|
||
exports.interpolateHclLong = hclLong;
|
||
exports.interpolateCubehelix = cubehelix$2;
|
||
exports.interpolateCubehelixLong = cubehelixLong;
|
||
exports.quantize = quantize;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
})));
|
||
|
||
},{"d3-color":3}],7:[function(require,module,exports){
|
||
// https://d3js.org/d3-scale/ Version 1.0.3. Copyright 2016 Mike Bostock.
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format'), require('d3-color')) :
|
||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-collection', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format', 'd3-color'], factory) :
|
||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
|
||
}(this, function (exports,d3Array,d3Collection,d3Interpolate,d3Format,d3Time,d3TimeFormat,d3Color) { 'use strict';
|
||
|
||
var array = Array.prototype;
|
||
|
||
var map$1 = array.map;
|
||
var slice = array.slice;
|
||
|
||
var implicit = {name: "implicit"};
|
||
|
||
function ordinal(range) {
|
||
var index = d3Collection.map(),
|
||
domain = [],
|
||
unknown = implicit;
|
||
|
||
range = range == null ? [] : slice.call(range);
|
||
|
||
function scale(d) {
|
||
var key = d + "", i = index.get(key);
|
||
if (!i) {
|
||
if (unknown !== implicit) return unknown;
|
||
index.set(key, i = domain.push(d));
|
||
}
|
||
return range[(i - 1) % range.length];
|
||
}
|
||
|
||
scale.domain = function(_) {
|
||
if (!arguments.length) return domain.slice();
|
||
domain = [], index = d3Collection.map();
|
||
var i = -1, n = _.length, d, key;
|
||
while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
|
||
return scale;
|
||
};
|
||
|
||
scale.range = function(_) {
|
||
return arguments.length ? (range = slice.call(_), scale) : range.slice();
|
||
};
|
||
|
||
scale.unknown = function(_) {
|
||
return arguments.length ? (unknown = _, scale) : unknown;
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return ordinal()
|
||
.domain(domain)
|
||
.range(range)
|
||
.unknown(unknown);
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
function band() {
|
||
var scale = ordinal().unknown(undefined),
|
||
domain = scale.domain,
|
||
ordinalRange = scale.range,
|
||
range = [0, 1],
|
||
step,
|
||
bandwidth,
|
||
round = false,
|
||
paddingInner = 0,
|
||
paddingOuter = 0,
|
||
align = 0.5;
|
||
|
||
delete scale.unknown;
|
||
|
||
function rescale() {
|
||
var n = domain().length,
|
||
reverse = range[1] < range[0],
|
||
start = range[reverse - 0],
|
||
stop = range[1 - reverse];
|
||
step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
||
if (round) step = Math.floor(step);
|
||
start += (stop - start - step * (n - paddingInner)) * align;
|
||
bandwidth = step * (1 - paddingInner);
|
||
if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
|
||
var values = d3Array.range(n).map(function(i) { return start + step * i; });
|
||
return ordinalRange(reverse ? values.reverse() : values);
|
||
}
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? (domain(_), rescale()) : domain();
|
||
};
|
||
|
||
scale.range = function(_) {
|
||
return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice();
|
||
};
|
||
|
||
scale.rangeRound = function(_) {
|
||
return range = [+_[0], +_[1]], round = true, rescale();
|
||
};
|
||
|
||
scale.bandwidth = function() {
|
||
return bandwidth;
|
||
};
|
||
|
||
scale.step = function() {
|
||
return step;
|
||
};
|
||
|
||
scale.round = function(_) {
|
||
return arguments.length ? (round = !!_, rescale()) : round;
|
||
};
|
||
|
||
scale.padding = function(_) {
|
||
return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
|
||
};
|
||
|
||
scale.paddingInner = function(_) {
|
||
return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
|
||
};
|
||
|
||
scale.paddingOuter = function(_) {
|
||
return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;
|
||
};
|
||
|
||
scale.align = function(_) {
|
||
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return band()
|
||
.domain(domain())
|
||
.range(range)
|
||
.round(round)
|
||
.paddingInner(paddingInner)
|
||
.paddingOuter(paddingOuter)
|
||
.align(align);
|
||
};
|
||
|
||
return rescale();
|
||
}
|
||
|
||
function pointish(scale) {
|
||
var copy = scale.copy;
|
||
|
||
scale.padding = scale.paddingOuter;
|
||
delete scale.paddingInner;
|
||
delete scale.paddingOuter;
|
||
|
||
scale.copy = function() {
|
||
return pointish(copy());
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
function point() {
|
||
return pointish(band().paddingInner(1));
|
||
}
|
||
|
||
function constant(x) {
|
||
return function() {
|
||
return x;
|
||
};
|
||
}
|
||
|
||
function number(x) {
|
||
return +x;
|
||
}
|
||
|
||
var unit = [0, 1];
|
||
|
||
function deinterpolate(a, b) {
|
||
return (b -= (a = +a))
|
||
? function(x) { return (x - a) / b; }
|
||
: constant(b);
|
||
}
|
||
|
||
function deinterpolateClamp(deinterpolate) {
|
||
return function(a, b) {
|
||
var d = deinterpolate(a = +a, b = +b);
|
||
return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };
|
||
};
|
||
}
|
||
|
||
function reinterpolateClamp(reinterpolate) {
|
||
return function(a, b) {
|
||
var r = reinterpolate(a = +a, b = +b);
|
||
return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };
|
||
};
|
||
}
|
||
|
||
function bimap(domain, range, deinterpolate, reinterpolate) {
|
||
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
|
||
if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);
|
||
else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);
|
||
return function(x) { return r0(d0(x)); };
|
||
}
|
||
|
||
function polymap(domain, range, deinterpolate, reinterpolate) {
|
||
var j = Math.min(domain.length, range.length) - 1,
|
||
d = new Array(j),
|
||
r = new Array(j),
|
||
i = -1;
|
||
|
||
// Reverse descending domains.
|
||
if (domain[j] < domain[0]) {
|
||
domain = domain.slice().reverse();
|
||
range = range.slice().reverse();
|
||
}
|
||
|
||
while (++i < j) {
|
||
d[i] = deinterpolate(domain[i], domain[i + 1]);
|
||
r[i] = reinterpolate(range[i], range[i + 1]);
|
||
}
|
||
|
||
return function(x) {
|
||
var i = d3Array.bisect(domain, x, 1, j) - 1;
|
||
return r[i](d[i](x));
|
||
};
|
||
}
|
||
|
||
function copy(source, target) {
|
||
return target
|
||
.domain(source.domain())
|
||
.range(source.range())
|
||
.interpolate(source.interpolate())
|
||
.clamp(source.clamp());
|
||
}
|
||
|
||
// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
|
||
// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].
|
||
function continuous(deinterpolate$$, reinterpolate) {
|
||
var domain = unit,
|
||
range = unit,
|
||
interpolate = d3Interpolate.interpolate,
|
||
clamp = false,
|
||
piecewise,
|
||
output,
|
||
input;
|
||
|
||
function rescale() {
|
||
piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
|
||
output = input = null;
|
||
return scale;
|
||
}
|
||
|
||
function scale(x) {
|
||
return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate$$) : deinterpolate$$, interpolate)))(+x);
|
||
}
|
||
|
||
scale.invert = function(y) {
|
||
return (input || (input = piecewise(range, domain, deinterpolate, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
|
||
};
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? (domain = map$1.call(_, number), rescale()) : domain.slice();
|
||
};
|
||
|
||
scale.range = function(_) {
|
||
return arguments.length ? (range = slice.call(_), rescale()) : range.slice();
|
||
};
|
||
|
||
scale.rangeRound = function(_) {
|
||
return range = slice.call(_), interpolate = d3Interpolate.interpolateRound, rescale();
|
||
};
|
||
|
||
scale.clamp = function(_) {
|
||
return arguments.length ? (clamp = !!_, rescale()) : clamp;
|
||
};
|
||
|
||
scale.interpolate = function(_) {
|
||
return arguments.length ? (interpolate = _, rescale()) : interpolate;
|
||
};
|
||
|
||
return rescale();
|
||
}
|
||
|
||
function tickFormat(domain, count, specifier) {
|
||
var start = domain[0],
|
||
stop = domain[domain.length - 1],
|
||
step = d3Array.tickStep(start, stop, count == null ? 10 : count),
|
||
precision;
|
||
specifier = d3Format.formatSpecifier(specifier == null ? ",f" : specifier);
|
||
switch (specifier.type) {
|
||
case "s": {
|
||
var value = Math.max(Math.abs(start), Math.abs(stop));
|
||
if (specifier.precision == null && !isNaN(precision = d3Format.precisionPrefix(step, value))) specifier.precision = precision;
|
||
return d3Format.formatPrefix(specifier, value);
|
||
}
|
||
case "":
|
||
case "e":
|
||
case "g":
|
||
case "p":
|
||
case "r": {
|
||
if (specifier.precision == null && !isNaN(precision = d3Format.precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
||
break;
|
||
}
|
||
case "f":
|
||
case "%": {
|
||
if (specifier.precision == null && !isNaN(precision = d3Format.precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
||
break;
|
||
}
|
||
}
|
||
return d3Format.format(specifier);
|
||
}
|
||
|
||
function linearish(scale) {
|
||
var domain = scale.domain;
|
||
|
||
scale.ticks = function(count) {
|
||
var d = domain();
|
||
return d3Array.ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
||
};
|
||
|
||
scale.tickFormat = function(count, specifier) {
|
||
return tickFormat(domain(), count, specifier);
|
||
};
|
||
|
||
scale.nice = function(count) {
|
||
var d = domain(),
|
||
i = d.length - 1,
|
||
n = count == null ? 10 : count,
|
||
start = d[0],
|
||
stop = d[i],
|
||
step = d3Array.tickStep(start, stop, n);
|
||
|
||
if (step) {
|
||
step = d3Array.tickStep(Math.floor(start / step) * step, Math.ceil(stop / step) * step, n);
|
||
d[0] = Math.floor(start / step) * step;
|
||
d[i] = Math.ceil(stop / step) * step;
|
||
domain(d);
|
||
}
|
||
|
||
return scale;
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
function linear() {
|
||
var scale = continuous(deinterpolate, d3Interpolate.interpolateNumber);
|
||
|
||
scale.copy = function() {
|
||
return copy(scale, linear());
|
||
};
|
||
|
||
return linearish(scale);
|
||
}
|
||
|
||
function identity() {
|
||
var domain = [0, 1];
|
||
|
||
function scale(x) {
|
||
return +x;
|
||
}
|
||
|
||
scale.invert = scale;
|
||
|
||
scale.domain = scale.range = function(_) {
|
||
return arguments.length ? (domain = map$1.call(_, number), scale) : domain.slice();
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return identity().domain(domain);
|
||
};
|
||
|
||
return linearish(scale);
|
||
}
|
||
|
||
function nice(domain, interval) {
|
||
domain = domain.slice();
|
||
|
||
var i0 = 0,
|
||
i1 = domain.length - 1,
|
||
x0 = domain[i0],
|
||
x1 = domain[i1],
|
||
t;
|
||
|
||
if (x1 < x0) {
|
||
t = i0, i0 = i1, i1 = t;
|
||
t = x0, x0 = x1, x1 = t;
|
||
}
|
||
|
||
domain[i0] = interval.floor(x0);
|
||
domain[i1] = interval.ceil(x1);
|
||
return domain;
|
||
}
|
||
|
||
function deinterpolate$1(a, b) {
|
||
return (b = Math.log(b / a))
|
||
? function(x) { return Math.log(x / a) / b; }
|
||
: constant(b);
|
||
}
|
||
|
||
function reinterpolate(a, b) {
|
||
return a < 0
|
||
? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }
|
||
: function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };
|
||
}
|
||
|
||
function pow10(x) {
|
||
return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
|
||
}
|
||
|
||
function powp(base) {
|
||
return base === 10 ? pow10
|
||
: base === Math.E ? Math.exp
|
||
: function(x) { return Math.pow(base, x); };
|
||
}
|
||
|
||
function logp(base) {
|
||
return base === Math.E ? Math.log
|
||
: base === 10 && Math.log10
|
||
|| base === 2 && Math.log2
|
||
|| (base = Math.log(base), function(x) { return Math.log(x) / base; });
|
||
}
|
||
|
||
function reflect(f) {
|
||
return function(x) {
|
||
return -f(-x);
|
||
};
|
||
}
|
||
|
||
function log() {
|
||
var scale = continuous(deinterpolate$1, reinterpolate).domain([1, 10]),
|
||
domain = scale.domain,
|
||
base = 10,
|
||
logs = logp(10),
|
||
pows = powp(10);
|
||
|
||
function rescale() {
|
||
logs = logp(base), pows = powp(base);
|
||
if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);
|
||
return scale;
|
||
}
|
||
|
||
scale.base = function(_) {
|
||
return arguments.length ? (base = +_, rescale()) : base;
|
||
};
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? (domain(_), rescale()) : domain();
|
||
};
|
||
|
||
scale.ticks = function(count) {
|
||
var d = domain(),
|
||
u = d[0],
|
||
v = d[d.length - 1],
|
||
r;
|
||
|
||
if (r = v < u) i = u, u = v, v = i;
|
||
|
||
var i = logs(u),
|
||
j = logs(v),
|
||
p,
|
||
k,
|
||
t,
|
||
n = count == null ? 10 : +count,
|
||
z = [];
|
||
|
||
if (!(base % 1) && j - i < n) {
|
||
i = Math.round(i) - 1, j = Math.round(j) + 1;
|
||
if (u > 0) for (; i < j; ++i) {
|
||
for (k = 1, p = pows(i); k < base; ++k) {
|
||
t = p * k;
|
||
if (t < u) continue;
|
||
if (t > v) break;
|
||
z.push(t);
|
||
}
|
||
} else for (; i < j; ++i) {
|
||
for (k = base - 1, p = pows(i); k >= 1; --k) {
|
||
t = p * k;
|
||
if (t < u) continue;
|
||
if (t > v) break;
|
||
z.push(t);
|
||
}
|
||
}
|
||
} else {
|
||
z = d3Array.ticks(i, j, Math.min(j - i, n)).map(pows);
|
||
}
|
||
|
||
return r ? z.reverse() : z;
|
||
};
|
||
|
||
scale.tickFormat = function(count, specifier) {
|
||
if (specifier == null) specifier = base === 10 ? ".0e" : ",";
|
||
if (typeof specifier !== "function") specifier = d3Format.format(specifier);
|
||
if (count === Infinity) return specifier;
|
||
if (count == null) count = 10;
|
||
var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
|
||
return function(d) {
|
||
var i = d / pows(Math.round(logs(d)));
|
||
if (i * base < base - 0.5) i *= base;
|
||
return i <= k ? specifier(d) : "";
|
||
};
|
||
};
|
||
|
||
scale.nice = function() {
|
||
return domain(nice(domain(), {
|
||
floor: function(x) { return pows(Math.floor(logs(x))); },
|
||
ceil: function(x) { return pows(Math.ceil(logs(x))); }
|
||
}));
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return copy(scale, log().base(base));
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
function raise(x, exponent) {
|
||
return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
|
||
}
|
||
|
||
function pow() {
|
||
var exponent = 1,
|
||
scale = continuous(deinterpolate, reinterpolate),
|
||
domain = scale.domain;
|
||
|
||
function deinterpolate(a, b) {
|
||
return (b = raise(b, exponent) - (a = raise(a, exponent)))
|
||
? function(x) { return (raise(x, exponent) - a) / b; }
|
||
: constant(b);
|
||
}
|
||
|
||
function reinterpolate(a, b) {
|
||
b = raise(b, exponent) - (a = raise(a, exponent));
|
||
return function(t) { return raise(a + b * t, 1 / exponent); };
|
||
}
|
||
|
||
scale.exponent = function(_) {
|
||
return arguments.length ? (exponent = +_, domain(domain())) : exponent;
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return copy(scale, pow().exponent(exponent));
|
||
};
|
||
|
||
return linearish(scale);
|
||
}
|
||
|
||
function sqrt() {
|
||
return pow().exponent(0.5);
|
||
}
|
||
|
||
function quantile$1() {
|
||
var domain = [],
|
||
range = [],
|
||
thresholds = [];
|
||
|
||
function rescale() {
|
||
var i = 0, n = Math.max(1, range.length);
|
||
thresholds = new Array(n - 1);
|
||
while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n);
|
||
return scale;
|
||
}
|
||
|
||
function scale(x) {
|
||
if (!isNaN(x = +x)) return range[d3Array.bisect(thresholds, x)];
|
||
}
|
||
|
||
scale.invertExtent = function(y) {
|
||
var i = range.indexOf(y);
|
||
return i < 0 ? [NaN, NaN] : [
|
||
i > 0 ? thresholds[i - 1] : domain[0],
|
||
i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
|
||
];
|
||
};
|
||
|
||
scale.domain = function(_) {
|
||
if (!arguments.length) return domain.slice();
|
||
domain = [];
|
||
for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
|
||
domain.sort(d3Array.ascending);
|
||
return rescale();
|
||
};
|
||
|
||
scale.range = function(_) {
|
||
return arguments.length ? (range = slice.call(_), rescale()) : range.slice();
|
||
};
|
||
|
||
scale.quantiles = function() {
|
||
return thresholds.slice();
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return quantile$1()
|
||
.domain(domain)
|
||
.range(range);
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
function quantize() {
|
||
var x0 = 0,
|
||
x1 = 1,
|
||
n = 1,
|
||
domain = [0.5],
|
||
range = [0, 1];
|
||
|
||
function scale(x) {
|
||
if (x <= x) return range[d3Array.bisect(domain, x, 0, n)];
|
||
}
|
||
|
||
function rescale() {
|
||
var i = -1;
|
||
domain = new Array(n);
|
||
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
||
return scale;
|
||
}
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
|
||
};
|
||
|
||
scale.range = function(_) {
|
||
return arguments.length ? (n = (range = slice.call(_)).length - 1, rescale()) : range.slice();
|
||
};
|
||
|
||
scale.invertExtent = function(y) {
|
||
var i = range.indexOf(y);
|
||
return i < 0 ? [NaN, NaN]
|
||
: i < 1 ? [x0, domain[0]]
|
||
: i >= n ? [domain[n - 1], x1]
|
||
: [domain[i - 1], domain[i]];
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return quantize()
|
||
.domain([x0, x1])
|
||
.range(range);
|
||
};
|
||
|
||
return linearish(scale);
|
||
}
|
||
|
||
function threshold() {
|
||
var domain = [0.5],
|
||
range = [0, 1],
|
||
n = 1;
|
||
|
||
function scale(x) {
|
||
if (x <= x) return range[d3Array.bisect(domain, x, 0, n)];
|
||
}
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
|
||
};
|
||
|
||
scale.range = function(_) {
|
||
return arguments.length ? (range = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
|
||
};
|
||
|
||
scale.invertExtent = function(y) {
|
||
var i = range.indexOf(y);
|
||
return [domain[i - 1], domain[i]];
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return threshold()
|
||
.domain(domain)
|
||
.range(range);
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
var durationSecond = 1000;
|
||
var durationMinute = durationSecond * 60;
|
||
var durationHour = durationMinute * 60;
|
||
var durationDay = durationHour * 24;
|
||
var durationWeek = durationDay * 7;
|
||
var durationMonth = durationDay * 30;
|
||
var durationYear = durationDay * 365;
|
||
function date(t) {
|
||
return new Date(t);
|
||
}
|
||
|
||
function number$1(t) {
|
||
return t instanceof Date ? +t : +new Date(+t);
|
||
}
|
||
|
||
function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
|
||
var scale = continuous(deinterpolate, d3Interpolate.interpolateNumber),
|
||
invert = scale.invert,
|
||
domain = scale.domain;
|
||
|
||
var formatMillisecond = format(".%L"),
|
||
formatSecond = format(":%S"),
|
||
formatMinute = format("%I:%M"),
|
||
formatHour = format("%I %p"),
|
||
formatDay = format("%a %d"),
|
||
formatWeek = format("%b %d"),
|
||
formatMonth = format("%B"),
|
||
formatYear = format("%Y");
|
||
|
||
var tickIntervals = [
|
||
[second, 1, durationSecond],
|
||
[second, 5, 5 * durationSecond],
|
||
[second, 15, 15 * durationSecond],
|
||
[second, 30, 30 * durationSecond],
|
||
[minute, 1, durationMinute],
|
||
[minute, 5, 5 * durationMinute],
|
||
[minute, 15, 15 * durationMinute],
|
||
[minute, 30, 30 * durationMinute],
|
||
[ hour, 1, durationHour ],
|
||
[ hour, 3, 3 * durationHour ],
|
||
[ hour, 6, 6 * durationHour ],
|
||
[ hour, 12, 12 * durationHour ],
|
||
[ day, 1, durationDay ],
|
||
[ day, 2, 2 * durationDay ],
|
||
[ week, 1, durationWeek ],
|
||
[ month, 1, durationMonth ],
|
||
[ month, 3, 3 * durationMonth ],
|
||
[ year, 1, durationYear ]
|
||
];
|
||
|
||
function tickFormat(date) {
|
||
return (second(date) < date ? formatMillisecond
|
||
: minute(date) < date ? formatSecond
|
||
: hour(date) < date ? formatMinute
|
||
: day(date) < date ? formatHour
|
||
: month(date) < date ? (week(date) < date ? formatDay : formatWeek)
|
||
: year(date) < date ? formatMonth
|
||
: formatYear)(date);
|
||
}
|
||
|
||
function tickInterval(interval, start, stop, step) {
|
||
if (interval == null) interval = 10;
|
||
|
||
// If a desired tick count is specified, pick a reasonable tick interval
|
||
// based on the extent of the domain and a rough estimate of tick size.
|
||
// Otherwise, assume interval is already a time interval and use it.
|
||
if (typeof interval === "number") {
|
||
var target = Math.abs(stop - start) / interval,
|
||
i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target);
|
||
if (i === tickIntervals.length) {
|
||
step = d3Array.tickStep(start / durationYear, stop / durationYear, interval);
|
||
interval = year;
|
||
} 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 = d3Array.tickStep(start, stop, interval);
|
||
interval = millisecond;
|
||
}
|
||
}
|
||
|
||
return step == null ? interval : interval.every(step);
|
||
}
|
||
|
||
scale.invert = function(y) {
|
||
return new Date(invert(y));
|
||
};
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? domain(map$1.call(_, number$1)) : domain().map(date);
|
||
};
|
||
|
||
scale.ticks = function(interval, step) {
|
||
var d = domain(),
|
||
t0 = d[0],
|
||
t1 = d[d.length - 1],
|
||
r = t1 < t0,
|
||
t;
|
||
if (r) t = t0, t0 = t1, t1 = t;
|
||
t = tickInterval(interval, t0, t1, step);
|
||
t = t ? t.range(t0, t1 + 1) : []; // inclusive stop
|
||
return r ? t.reverse() : t;
|
||
};
|
||
|
||
scale.tickFormat = function(count, specifier) {
|
||
return specifier == null ? tickFormat : format(specifier);
|
||
};
|
||
|
||
scale.nice = function(interval, step) {
|
||
var d = domain();
|
||
return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
|
||
? domain(nice(d, interval))
|
||
: scale;
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
|
||
};
|
||
|
||
return scale;
|
||
}
|
||
|
||
function time() {
|
||
return calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
|
||
}
|
||
|
||
function utcTime() {
|
||
return calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
|
||
}
|
||
|
||
function colors(s) {
|
||
return s.match(/.{6}/g).map(function(x) {
|
||
return "#" + x;
|
||
});
|
||
}
|
||
|
||
var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
|
||
|
||
var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6");
|
||
|
||
var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9");
|
||
|
||
var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5");
|
||
|
||
var cubehelix$1 = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(300, 0.5, 0.0), d3Color.cubehelix(-240, 0.5, 1.0));
|
||
|
||
var warm = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(-100, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8));
|
||
|
||
var cool = d3Interpolate.interpolateCubehelixLong(d3Color.cubehelix(260, 0.75, 0.35), d3Color.cubehelix(80, 1.50, 0.8));
|
||
|
||
var rainbow = d3Color.cubehelix();
|
||
|
||
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)))];
|
||
};
|
||
}
|
||
|
||
var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
|
||
|
||
var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
|
||
|
||
var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
|
||
|
||
var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
|
||
|
||
function sequential(interpolator) {
|
||
var x0 = 0,
|
||
x1 = 1,
|
||
clamp = false;
|
||
|
||
function scale(x) {
|
||
var t = (x - x0) / (x1 - x0);
|
||
return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
|
||
}
|
||
|
||
scale.domain = function(_) {
|
||
return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1];
|
||
};
|
||
|
||
scale.clamp = function(_) {
|
||
return arguments.length ? (clamp = !!_, scale) : clamp;
|
||
};
|
||
|
||
scale.interpolator = function(_) {
|
||
return arguments.length ? (interpolator = _, scale) : interpolator;
|
||
};
|
||
|
||
scale.copy = function() {
|
||
return sequential(interpolator).domain([x0, x1]).clamp(clamp);
|
||
};
|
||
|
||
return linearish(scale);
|
||
}
|
||
|
||
exports.scaleBand = band;
|
||
exports.scalePoint = point;
|
||
exports.scaleIdentity = identity;
|
||
exports.scaleLinear = linear;
|
||
exports.scaleLog = log;
|
||
exports.scaleOrdinal = ordinal;
|
||
exports.scaleImplicit = implicit;
|
||
exports.scalePow = pow;
|
||
exports.scaleSqrt = sqrt;
|
||
exports.scaleQuantile = quantile$1;
|
||
exports.scaleQuantize = quantize;
|
||
exports.scaleThreshold = threshold;
|
||
exports.scaleTime = time;
|
||
exports.scaleUtc = utcTime;
|
||
exports.schemeCategory10 = category10;
|
||
exports.schemeCategory20b = category20b;
|
||
exports.schemeCategory20c = category20c;
|
||
exports.schemeCategory20 = category20;
|
||
exports.interpolateCubehelixDefault = cubehelix$1;
|
||
exports.interpolateRainbow = rainbow$1;
|
||
exports.interpolateWarm = warm;
|
||
exports.interpolateCool = cool;
|
||
exports.interpolateViridis = viridis;
|
||
exports.interpolateMagma = magma;
|
||
exports.interpolateInferno = inferno;
|
||
exports.interpolatePlasma = plasma;
|
||
exports.scaleSequential = sequential;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
}));
|
||
},{"d3-array":1,"d3-collection":2,"d3-color":3,"d3-format":5,"d3-interpolate":6,"d3-time":10,"d3-time-format":9}],8:[function(require,module,exports){
|
||
// https://d3js.org/d3-selection/ Version 1.0.2. Copyright 2016 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 xhtml = "http://www.w3.org/1999/xhtml";
|
||
|
||
var namespaces = {
|
||
svg: "http://www.w3.org/2000/svg",
|
||
xhtml: xhtml,
|
||
xlink: "http://www.w3.org/1999/xlink",
|
||
xml: "http://www.w3.org/XML/1998/namespace",
|
||
xmlns: "http://www.w3.org/2000/xmlns/"
|
||
};
|
||
|
||
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;
|
||
return uri === xhtml && document.documentElement.namespaceURI === xhtml
|
||
? document.createElement(name)
|
||
: document.createElementNS(uri, name);
|
||
};
|
||
}
|
||
|
||
function creatorFixed(fullname) {
|
||
return function() {
|
||
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
||
};
|
||
}
|
||
|
||
function creator(name) {
|
||
var fullname = namespace(name);
|
||
return (fullname.local
|
||
? creatorFixed
|
||
: creatorInherit)(fullname);
|
||
}
|
||
|
||
var nextId = 0;
|
||
|
||
function local() {
|
||
return new Local;
|
||
}
|
||
|
||
function Local() {
|
||
this._ = "@" + (++nextId).toString(36);
|
||
}
|
||
|
||
Local.prototype = local.prototype = {
|
||
constructor: Local,
|
||
get: function(node) {
|
||
var id = this._;
|
||
while (!(id in node)) if (!(node = node.parentNode)) return;
|
||
return node[id];
|
||
},
|
||
set: function(node, value) {
|
||
return node[this._] = value;
|
||
},
|
||
remove: function(node) {
|
||
return this._ in node && delete node[this._];
|
||
},
|
||
toString: function() {
|
||
return this._;
|
||
}
|
||
};
|
||
|
||
var 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(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(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 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 none() {}
|
||
|
||
function selector(selector) {
|
||
return selector == null ? none : function() {
|
||
return this.querySelector(selector);
|
||
};
|
||
}
|
||
|
||
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))) {
|
||
if ("__data__" in node) subnode.__data__ = node.__data__;
|
||
subgroup[i] = subnode;
|
||
}
|
||
}
|
||
}
|
||
|
||
return new Selection(subgroups, this._parents);
|
||
}
|
||
|
||
function empty() {
|
||
return [];
|
||
}
|
||
|
||
function selectorAll(selector) {
|
||
return selector == null ? empty : function() {
|
||
return this.querySelectorAll(selector);
|
||
};
|
||
}
|
||
|
||
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]) {
|
||
subgroups.push(select.call(node, node.__data__, i, group));
|
||
parents.push(node);
|
||
}
|
||
}
|
||
}
|
||
|
||
return new Selection(subgroups, parents);
|
||
}
|
||
|
||
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)) {
|
||
subgroup.push(node);
|
||
}
|
||
}
|
||
}
|
||
|
||
return new Selection(subgroups, this._parents);
|
||
}
|
||
|
||
function sparse(update) {
|
||
return new Array(update.length);
|
||
}
|
||
|
||
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;
|
||
this._parent = parent;
|
||
this.__data__ = datum;
|
||
}
|
||
|
||
EnterNode.prototype = {
|
||
constructor: EnterNode,
|
||
appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
|
||
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); }
|
||
};
|
||
|
||
function constant(x) {
|
||
return function() {
|
||
return x;
|
||
};
|
||
}
|
||
|
||
var keyPrefix = "$"; // Protect against keys like “__proto__”.
|
||
|
||
function bindIndex(parent, group, enter, update, exit, data) {
|
||
var i = 0,
|
||
node,
|
||
groupLength = group.length,
|
||
dataLength = data.length;
|
||
|
||
// Put any non-null nodes that fit into update.
|
||
// Put any null nodes into enter.
|
||
// Put any remaining data into enter.
|
||
for (; i < dataLength; ++i) {
|
||
if (node = group[i]) {
|
||
node.__data__ = data[i];
|
||
update[i] = node;
|
||
} else {
|
||
enter[i] = new EnterNode(parent, data[i]);
|
||
}
|
||
}
|
||
|
||
// Put any non-null nodes that don’t fit into exit.
|
||
for (; i < groupLength; ++i) {
|
||
if (node = group[i]) {
|
||
exit[i] = node;
|
||
}
|
||
}
|
||
}
|
||
|
||
function bindKey(parent, group, enter, update, exit, data, key) {
|
||
var i,
|
||
node,
|
||
nodeByKeyValue = {},
|
||
groupLength = group.length,
|
||
dataLength = data.length,
|
||
keyValues = new Array(groupLength),
|
||
keyValue;
|
||
|
||
// Compute the key for each node.
|
||
// If multiple nodes have the same key, the duplicates are added to exit.
|
||
for (i = 0; i < groupLength; ++i) {
|
||
if (node = group[i]) {
|
||
keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);
|
||
if (keyValue in nodeByKeyValue) {
|
||
exit[i] = node;
|
||
} else {
|
||
nodeByKeyValue[keyValue] = node;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Compute the key for each datum.
|
||
// If there a node associated with this key, join and add it to update.
|
||
// If there is not (or the key is a duplicate), add it to enter.
|
||
for (i = 0; i < dataLength; ++i) {
|
||
keyValue = keyPrefix + key.call(parent, data[i], i, data);
|
||
if (node = nodeByKeyValue[keyValue]) {
|
||
update[i] = node;
|
||
node.__data__ = data[i];
|
||
nodeByKeyValue[keyValue] = null;
|
||
} else {
|
||
enter[i] = new EnterNode(parent, data[i]);
|
||
}
|
||
}
|
||
|
||
// Add any remaining nodes that were not bound to data to exit.
|
||
for (i = 0; i < groupLength; ++i) {
|
||
if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {
|
||
exit[i] = node;
|
||
}
|
||
}
|
||
}
|
||
|
||
function selection_data(value, key) {
|
||
if (!value) {
|
||
data = new Array(this.size()), j = -1;
|
||
this.each(function(d) { data[++j] = d; });
|
||
return data;
|
||
}
|
||
|
||
var bind = key ? bindKey : bindIndex,
|
||
parents = this._parents,
|
||
groups = this._groups;
|
||
|
||
if (typeof value !== "function") value = constant(value);
|
||
|
||
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
||
var parent = parents[j],
|
||
group = groups[j],
|
||
groupLength = group.length,
|
||
data = value.call(parent, parent && parent.__data__, j, parents),
|
||
dataLength = data.length,
|
||
enterGroup = enter[j] = new Array(dataLength),
|
||
updateGroup = update[j] = new Array(dataLength),
|
||
exitGroup = exit[j] = new Array(groupLength);
|
||
|
||
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
||
|
||
// Now connect the enter nodes to their following update node, such that
|
||
// appendChild can insert the materialized enter node before this node,
|
||
// rather than at the end of the parent node.
|
||
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
|
||
if (previous = enterGroup[i0]) {
|
||
if (i0 >= i1) i1 = i0 + 1;
|
||
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
|
||
previous._next = next || null;
|
||
}
|
||
}
|
||
}
|
||
|
||
update = new Selection(update, parents);
|
||
update._enter = enter;
|
||
update._exit = exit;
|
||
return update;
|
||
}
|
||
|
||
function selection_exit() {
|
||
return new Selection(this._exit || this._groups.map(sparse), this._parents);
|
||
}
|
||
|
||
function selection_merge(selection) {
|
||
|
||
for (var groups0 = this._groups, groups1 = selection._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;
|
||
}
|
||
}
|
||
}
|
||
|
||
for (; j < m0; ++j) {
|
||
merges[j] = groups0[j];
|
||
}
|
||
|
||
return new Selection(merges, this._parents);
|
||
}
|
||
|
||
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);
|
||
next = node;
|
||
}
|
||
}
|
||
}
|
||
|
||
return this;
|
||
}
|
||
|
||
function selection_sort(compare) {
|
||
if (!compare) compare = ascending;
|
||
|
||
function compareNode(a, b) {
|
||
return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
||
}
|
||
|
||
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
||
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
|
||
if (node = group[i]) {
|
||
sortgroup[i] = node;
|
||
}
|
||
}
|
||
sortgroup.sort(compareNode);
|
||
}
|
||
|
||
return new Selection(sortgroups, this._parents).order();
|
||
}
|
||
|
||
function ascending(a, b) {
|
||
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
||
}
|
||
|
||
function selection_call() {
|
||
var callback = arguments[0];
|
||
arguments[0] = this;
|
||
callback.apply(null, arguments);
|
||
return this;
|
||
}
|
||
|
||
function selection_nodes() {
|
||
var nodes = new Array(this.size()), i = -1;
|
||
this.each(function() { nodes[++i] = this; });
|
||
return nodes;
|
||
}
|
||
|
||
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;
|
||
}
|
||
|
||
function selection_size() {
|
||
var size = 0;
|
||
this.each(function() { ++size; });
|
||
return size;
|
||
}
|
||
|
||
function selection_empty() {
|
||
return !this.node();
|
||
}
|
||
|
||
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);
|
||
};
|
||
}
|
||
|
||
function attrRemoveNS(fullname) {
|
||
return function() {
|
||
this.removeAttributeNS(fullname.space, fullname.local);
|
||
};
|
||
}
|
||
|
||
function attrConstant(name, value) {
|
||
return function() {
|
||
this.setAttribute(name, value);
|
||
};
|
||
}
|
||
|
||
function attrConstantNS(fullname, value) {
|
||
return function() {
|
||
this.setAttributeNS(fullname.space, fullname.local, value);
|
||
};
|
||
}
|
||
|
||
function attrFunction(name, value) {
|
||
return function() {
|
||
var v = value.apply(this, arguments);
|
||
if (v == null) this.removeAttribute(name);
|
||
else this.setAttribute(name, v);
|
||
};
|
||
}
|
||
|
||
function attrFunctionNS(fullname, value) {
|
||
return function() {
|
||
var v = value.apply(this, arguments);
|
||
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
|
||
else this.setAttributeNS(fullname.space, fullname.local, v);
|
||
};
|
||
}
|
||
|
||
function selection_attr(name, value) {
|
||
var fullname = namespace(name);
|
||
|
||
if (arguments.length < 2) {
|
||
var node = this.node();
|
||
return fullname.local
|
||
? node.getAttributeNS(fullname.space, fullname.local)
|
||
: node.getAttribute(fullname);
|
||
}
|
||
|
||
return this.each((value == null
|
||
? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
|
||
? (fullname.local ? attrFunctionNS : attrFunction)
|
||
: (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
|
||
}
|
||
|
||
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);
|
||
};
|
||
}
|
||
|
||
function styleConstant(name, value, priority) {
|
||
return function() {
|
||
this.style.setProperty(name, value, priority);
|
||
};
|
||
}
|
||
|
||
function styleFunction(name, value, priority) {
|
||
return function() {
|
||
var v = value.apply(this, arguments);
|
||
if (v == null) this.style.removeProperty(name);
|
||
else this.style.setProperty(name, v, priority);
|
||
};
|
||
}
|
||
|
||
function selection_style(name, value, priority) {
|
||
var node;
|
||
return arguments.length > 1
|
||
? this.each((value == null
|
||
? styleRemove : typeof value === "function"
|
||
? styleFunction
|
||
: styleConstant)(name, value, priority == null ? "" : priority))
|
||
: defaultView(node = this.node())
|
||
.getComputedStyle(node, null)
|
||
.getPropertyValue(name);
|
||
}
|
||
|
||
function propertyRemove(name) {
|
||
return function() {
|
||
delete this[name];
|
||
};
|
||
}
|
||
|
||
function propertyConstant(name, value) {
|
||
return function() {
|
||
this[name] = value;
|
||
};
|
||
}
|
||
|
||
function propertyFunction(name, value) {
|
||
return function() {
|
||
var v = value.apply(this, arguments);
|
||
if (v == null) delete this[name];
|
||
else this[name] = v;
|
||
};
|
||
}
|
||
|
||
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+/);
|
||
}
|
||
|
||
function classList(node) {
|
||
return node.classList || new ClassList(node);
|
||
}
|
||
|
||
function ClassList(node) {
|
||
this._node = node;
|
||
this._names = classArray(node.getAttribute("class") || "");
|
||
}
|
||
|
||
ClassList.prototype = {
|
||
add: function(name) {
|
||
var i = this._names.indexOf(name);
|
||
if (i < 0) {
|
||
this._names.push(name);
|
||
this._node.setAttribute("class", this._names.join(" "));
|
||
}
|
||
},
|
||
remove: function(name) {
|
||
var i = this._names.indexOf(name);
|
||
if (i >= 0) {
|
||
this._names.splice(i, 1);
|
||
this._node.setAttribute("class", this._names.join(" "));
|
||
}
|
||
},
|
||
contains: function(name) {
|
||
return this._names.indexOf(name) >= 0;
|
||
}
|
||
};
|
||
|
||
function classedAdd(node, names) {
|
||
var list = classList(node), i = -1, n = names.length;
|
||
while (++i < n) list.add(names[i]);
|
||
}
|
||
|
||
function classedRemove(node, names) {
|
||
var list = classList(node), i = -1, n = names.length;
|
||
while (++i < n) list.remove(names[i]);
|
||
}
|
||
|
||
function classedTrue(names) {
|
||
return function() {
|
||
classedAdd(this, names);
|
||
};
|
||
}
|
||
|
||
function classedFalse(names) {
|
||
return function() {
|
||
classedRemove(this, names);
|
||
};
|
||
}
|
||
|
||
function classedFunction(names, value) {
|
||
return function() {
|
||
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
||
};
|
||
}
|
||
|
||
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;
|
||
return true;
|
||
}
|
||
|
||
return this.each((typeof value === "function"
|
||
? classedFunction : value
|
||
? classedTrue
|
||
: classedFalse)(names, value));
|
||
}
|
||
|
||
function textRemove() {
|
||
this.textContent = "";
|
||
}
|
||
|
||
function textConstant(value) {
|
||
return function() {
|
||
this.textContent = value;
|
||
};
|
||
}
|
||
|
||
function textFunction(value) {
|
||
return function() {
|
||
var v = value.apply(this, arguments);
|
||
this.textContent = v == null ? "" : v;
|
||
};
|
||
}
|
||
|
||
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 = "";
|
||
}
|
||
|
||
function htmlConstant(value) {
|
||
return function() {
|
||
this.innerHTML = value;
|
||
};
|
||
}
|
||
|
||
function htmlFunction(value) {
|
||
return function() {
|
||
var v = value.apply(this, arguments);
|
||
this.innerHTML = v == null ? "" : v;
|
||
};
|
||
}
|
||
|
||
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);
|
||
}
|
||
|
||
function selection_raise() {
|
||
return this.each(raise);
|
||
}
|
||
|
||
function lower() {
|
||
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
||
}
|
||
|
||
function selection_lower() {
|
||
return this.each(lower);
|
||
}
|
||
|
||
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;
|
||
}
|
||
|
||
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);
|
||
}
|
||
|
||
function selection_remove() {
|
||
return this.each(remove);
|
||
}
|
||
|
||
function selection_datum(value) {
|
||
return arguments.length
|
||
? this.property("__data__", value)
|
||
: this.node().__data__;
|
||
}
|
||
|
||
function dispatchEvent(node, type, params) {
|
||
var window = defaultView(node),
|
||
event = window.CustomEvent;
|
||
|
||
if (event) {
|
||
event = new event(type, params);
|
||
} else {
|
||
event = window.document.createEvent("Event");
|
||
if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
|
||
else event.initEvent(type, false, false);
|
||
}
|
||
|
||
node.dispatchEvent(event);
|
||
}
|
||
|
||
function dispatchConstant(type, params) {
|
||
return function() {
|
||
return dispatchEvent(this, type, params);
|
||
};
|
||
}
|
||
|
||
function dispatchFunction(type, params) {
|
||
return function() {
|
||
return dispatchEvent(this, type, params.apply(this, arguments));
|
||
};
|
||
}
|
||
|
||
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;
|
||
this._parents = parents;
|
||
}
|
||
|
||
function selection() {
|
||
return new Selection([[document.documentElement]], root);
|
||
}
|
||
|
||
Selection.prototype = selection.prototype = {
|
||
constructor: Selection,
|
||
select: selection_select,
|
||
selectAll: selection_selectAll,
|
||
filter: selection_filter,
|
||
data: selection_data,
|
||
enter: selection_enter,
|
||
exit: selection_exit,
|
||
merge: selection_merge,
|
||
order: selection_order,
|
||
sort: selection_sort,
|
||
call: selection_call,
|
||
nodes: selection_nodes,
|
||
node: selection_node,
|
||
size: selection_size,
|
||
empty: selection_empty,
|
||
each: selection_each,
|
||
attr: selection_attr,
|
||
style: selection_style,
|
||
property: selection_property,
|
||
classed: selection_classed,
|
||
text: selection_text,
|
||
html: selection_html,
|
||
raise: selection_raise,
|
||
lower: selection_lower,
|
||
append: selection_append,
|
||
insert: selection_insert,
|
||
remove: selection_remove,
|
||
datum: selection_datum,
|
||
on: selection_on,
|
||
dispatch: selection_dispatch
|
||
};
|
||
|
||
function select(selector) {
|
||
return typeof selector === "string"
|
||
? new Selection([[document.querySelector(selector)]], [document.documentElement])
|
||
: new Selection([[selector]], root);
|
||
}
|
||
|
||
function selectAll(selector) {
|
||
return typeof selector === "string"
|
||
? new Selection([document.querySelectorAll(selector)], [document.documentElement])
|
||
: new Selection([selector == null ? [] : selector], root);
|
||
}
|
||
|
||
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;
|
||
}
|
||
|
||
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;
|
||
}
|
||
|
||
exports.creator = creator;
|
||
exports.local = local;
|
||
exports.matcher = matcher$1;
|
||
exports.mouse = mouse;
|
||
exports.namespace = namespace;
|
||
exports.namespaces = namespaces;
|
||
exports.select = select;
|
||
exports.selectAll = selectAll;
|
||
exports.selection = selection;
|
||
exports.selector = selector;
|
||
exports.selectorAll = selectorAll;
|
||
exports.touch = touch;
|
||
exports.touches = touches;
|
||
exports.window = defaultView;
|
||
exports.customEvent = customEvent;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
}));
|
||
},{}],9:[function(require,module,exports){
|
||
// https://d3js.org/d3-time-format/ Version 2.0.3. Copyright 2016 Mike Bostock.
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-time')) :
|
||
typeof define === 'function' && define.amd ? define(['exports', 'd3-time'], factory) :
|
||
(factory((global.d3 = global.d3 || {}),global.d3));
|
||
}(this, (function (exports,d3Time) { 'use strict';
|
||
|
||
function localDate(d) {
|
||
if (0 <= d.y && d.y < 100) {
|
||
var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
|
||
date.setFullYear(d.y);
|
||
return date;
|
||
}
|
||
return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
|
||
}
|
||
|
||
function utcDate(d) {
|
||
if (0 <= d.y && d.y < 100) {
|
||
var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
|
||
date.setUTCFullYear(d.y);
|
||
return date;
|
||
}
|
||
return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
|
||
}
|
||
|
||
function newYear(y) {
|
||
return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};
|
||
}
|
||
|
||
function formatLocale(locale) {
|
||
var locale_dateTime = locale.dateTime,
|
||
locale_date = locale.date,
|
||
locale_time = locale.time,
|
||
locale_periods = locale.periods,
|
||
locale_weekdays = locale.days,
|
||
locale_shortWeekdays = locale.shortDays,
|
||
locale_months = locale.months,
|
||
locale_shortMonths = locale.shortMonths;
|
||
|
||
var periodRe = formatRe(locale_periods),
|
||
periodLookup = formatLookup(locale_periods),
|
||
weekdayRe = formatRe(locale_weekdays),
|
||
weekdayLookup = formatLookup(locale_weekdays),
|
||
shortWeekdayRe = formatRe(locale_shortWeekdays),
|
||
shortWeekdayLookup = formatLookup(locale_shortWeekdays),
|
||
monthRe = formatRe(locale_months),
|
||
monthLookup = formatLookup(locale_months),
|
||
shortMonthRe = formatRe(locale_shortMonths),
|
||
shortMonthLookup = formatLookup(locale_shortMonths);
|
||
|
||
var formats = {
|
||
"a": formatShortWeekday,
|
||
"A": formatWeekday,
|
||
"b": formatShortMonth,
|
||
"B": formatMonth,
|
||
"c": null,
|
||
"d": formatDayOfMonth,
|
||
"e": formatDayOfMonth,
|
||
"H": formatHour24,
|
||
"I": formatHour12,
|
||
"j": formatDayOfYear,
|
||
"L": formatMilliseconds,
|
||
"m": formatMonthNumber,
|
||
"M": formatMinutes,
|
||
"p": formatPeriod,
|
||
"S": formatSeconds,
|
||
"U": formatWeekNumberSunday,
|
||
"w": formatWeekdayNumber,
|
||
"W": formatWeekNumberMonday,
|
||
"x": null,
|
||
"X": null,
|
||
"y": formatYear,
|
||
"Y": formatFullYear,
|
||
"Z": formatZone,
|
||
"%": formatLiteralPercent
|
||
};
|
||
|
||
var utcFormats = {
|
||
"a": formatUTCShortWeekday,
|
||
"A": formatUTCWeekday,
|
||
"b": formatUTCShortMonth,
|
||
"B": formatUTCMonth,
|
||
"c": null,
|
||
"d": formatUTCDayOfMonth,
|
||
"e": formatUTCDayOfMonth,
|
||
"H": formatUTCHour24,
|
||
"I": formatUTCHour12,
|
||
"j": formatUTCDayOfYear,
|
||
"L": formatUTCMilliseconds,
|
||
"m": formatUTCMonthNumber,
|
||
"M": formatUTCMinutes,
|
||
"p": formatUTCPeriod,
|
||
"S": formatUTCSeconds,
|
||
"U": formatUTCWeekNumberSunday,
|
||
"w": formatUTCWeekdayNumber,
|
||
"W": formatUTCWeekNumberMonday,
|
||
"x": null,
|
||
"X": null,
|
||
"y": formatUTCYear,
|
||
"Y": formatUTCFullYear,
|
||
"Z": formatUTCZone,
|
||
"%": formatLiteralPercent
|
||
};
|
||
|
||
var parses = {
|
||
"a": parseShortWeekday,
|
||
"A": parseWeekday,
|
||
"b": parseShortMonth,
|
||
"B": parseMonth,
|
||
"c": parseLocaleDateTime,
|
||
"d": parseDayOfMonth,
|
||
"e": parseDayOfMonth,
|
||
"H": parseHour24,
|
||
"I": parseHour24,
|
||
"j": parseDayOfYear,
|
||
"L": parseMilliseconds,
|
||
"m": parseMonthNumber,
|
||
"M": parseMinutes,
|
||
"p": parsePeriod,
|
||
"S": parseSeconds,
|
||
"U": parseWeekNumberSunday,
|
||
"w": parseWeekdayNumber,
|
||
"W": parseWeekNumberMonday,
|
||
"x": parseLocaleDate,
|
||
"X": parseLocaleTime,
|
||
"y": parseYear,
|
||
"Y": parseFullYear,
|
||
"Z": parseZone,
|
||
"%": parseLiteralPercent
|
||
};
|
||
|
||
// These recursive directive definitions must be deferred.
|
||
formats.x = newFormat(locale_date, formats);
|
||
formats.X = newFormat(locale_time, formats);
|
||
formats.c = newFormat(locale_dateTime, formats);
|
||
utcFormats.x = newFormat(locale_date, utcFormats);
|
||
utcFormats.X = newFormat(locale_time, utcFormats);
|
||
utcFormats.c = newFormat(locale_dateTime, utcFormats);
|
||
|
||
function newFormat(specifier, formats) {
|
||
return function(date) {
|
||
var string = [],
|
||
i = -1,
|
||
j = 0,
|
||
n = specifier.length,
|
||
c,
|
||
pad,
|
||
format;
|
||
|
||
if (!(date instanceof Date)) date = new Date(+date);
|
||
|
||
while (++i < n) {
|
||
if (specifier.charCodeAt(i) === 37) {
|
||
string.push(specifier.slice(j, i));
|
||
if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
|
||
else pad = c === "e" ? " " : "0";
|
||
if (format = formats[c]) c = format(date, pad);
|
||
string.push(c);
|
||
j = i + 1;
|
||
}
|
||
}
|
||
|
||
string.push(specifier.slice(j, i));
|
||
return string.join("");
|
||
};
|
||
}
|
||
|
||
function newParse(specifier, newDate) {
|
||
return function(string) {
|
||
var d = newYear(1900),
|
||
i = parseSpecifier(d, specifier, string += "", 0);
|
||
if (i != string.length) return null;
|
||
|
||
// 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 = "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 + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
|
||
}
|
||
|
||
// If a time zone is specified, all fields are interpreted as UTC and then
|
||
// offset according to the specified time zone.
|
||
if ("Z" in d) {
|
||
d.H += d.Z / 100 | 0;
|
||
d.M += d.Z % 100;
|
||
return utcDate(d);
|
||
}
|
||
|
||
// Otherwise, all fields are in local time.
|
||
return newDate(d);
|
||
};
|
||
}
|
||
|
||
function parseSpecifier(d, specifier, string, j) {
|
||
var i = 0,
|
||
n = specifier.length,
|
||
m = string.length,
|
||
c,
|
||
parse;
|
||
|
||
while (i < n) {
|
||
if (j >= m) return -1;
|
||
c = specifier.charCodeAt(i++);
|
||
if (c === 37) {
|
||
c = specifier.charAt(i++);
|
||
parse = parses[c in pads ? specifier.charAt(i++) : c];
|
||
if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
|
||
} else if (c != string.charCodeAt(j++)) {
|
||
return -1;
|
||
}
|
||
}
|
||
|
||
return j;
|
||
}
|
||
|
||
function parsePeriod(d, string, i) {
|
||
var n = periodRe.exec(string.slice(i));
|
||
return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseShortWeekday(d, string, i) {
|
||
var n = shortWeekdayRe.exec(string.slice(i));
|
||
return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseWeekday(d, string, i) {
|
||
var n = weekdayRe.exec(string.slice(i));
|
||
return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseShortMonth(d, string, i) {
|
||
var n = shortMonthRe.exec(string.slice(i));
|
||
return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseMonth(d, string, i) {
|
||
var n = monthRe.exec(string.slice(i));
|
||
return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseLocaleDateTime(d, string, i) {
|
||
return parseSpecifier(d, locale_dateTime, string, i);
|
||
}
|
||
|
||
function parseLocaleDate(d, string, i) {
|
||
return parseSpecifier(d, locale_date, string, i);
|
||
}
|
||
|
||
function parseLocaleTime(d, string, i) {
|
||
return parseSpecifier(d, locale_time, string, i);
|
||
}
|
||
|
||
function formatShortWeekday(d) {
|
||
return locale_shortWeekdays[d.getDay()];
|
||
}
|
||
|
||
function formatWeekday(d) {
|
||
return locale_weekdays[d.getDay()];
|
||
}
|
||
|
||
function formatShortMonth(d) {
|
||
return locale_shortMonths[d.getMonth()];
|
||
}
|
||
|
||
function formatMonth(d) {
|
||
return locale_months[d.getMonth()];
|
||
}
|
||
|
||
function formatPeriod(d) {
|
||
return locale_periods[+(d.getHours() >= 12)];
|
||
}
|
||
|
||
function formatUTCShortWeekday(d) {
|
||
return locale_shortWeekdays[d.getUTCDay()];
|
||
}
|
||
|
||
function formatUTCWeekday(d) {
|
||
return locale_weekdays[d.getUTCDay()];
|
||
}
|
||
|
||
function formatUTCShortMonth(d) {
|
||
return locale_shortMonths[d.getUTCMonth()];
|
||
}
|
||
|
||
function formatUTCMonth(d) {
|
||
return locale_months[d.getUTCMonth()];
|
||
}
|
||
|
||
function formatUTCPeriod(d) {
|
||
return locale_periods[+(d.getUTCHours() >= 12)];
|
||
}
|
||
|
||
return {
|
||
format: function(specifier) {
|
||
var f = newFormat(specifier += "", formats);
|
||
f.toString = function() { return specifier; };
|
||
return f;
|
||
},
|
||
parse: function(specifier) {
|
||
var p = newParse(specifier += "", localDate);
|
||
p.toString = function() { return specifier; };
|
||
return p;
|
||
},
|
||
utcFormat: function(specifier) {
|
||
var f = newFormat(specifier += "", utcFormats);
|
||
f.toString = function() { return specifier; };
|
||
return f;
|
||
},
|
||
utcParse: function(specifier) {
|
||
var p = newParse(specifier, utcDate);
|
||
p.toString = function() { return specifier; };
|
||
return p;
|
||
}
|
||
};
|
||
}
|
||
|
||
var pads = {"-": "", "_": " ", "0": "0"};
|
||
var numberRe = /^\s*\d+/;
|
||
var percentRe = /^%/;
|
||
var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
|
||
|
||
function pad(value, fill, width) {
|
||
var sign = value < 0 ? "-" : "",
|
||
string = (sign ? -value : value) + "",
|
||
length = string.length;
|
||
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
|
||
}
|
||
|
||
function requote(s) {
|
||
return s.replace(requoteRe, "\\$&");
|
||
}
|
||
|
||
function formatRe(names) {
|
||
return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
|
||
}
|
||
|
||
function formatLookup(names) {
|
||
var map = {}, i = -1, n = names.length;
|
||
while (++i < n) map[names[i].toLowerCase()] = i;
|
||
return map;
|
||
}
|
||
|
||
function parseWeekdayNumber(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i, i + 1));
|
||
return n ? (d.w = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseWeekNumberSunday(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i));
|
||
return n ? (d.U = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseWeekNumberMonday(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i));
|
||
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));
|
||
return n ? (d.y = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseYear(d, string, i) {
|
||
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));
|
||
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));
|
||
return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseDayOfMonth(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i, i + 2));
|
||
return n ? (d.d = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseDayOfYear(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i, i + 3));
|
||
return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseHour24(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i, i + 2));
|
||
return n ? (d.H = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseMinutes(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i, i + 2));
|
||
return n ? (d.M = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
function parseSeconds(d, string, i) {
|
||
var n = numberRe.exec(string.slice(i, i + 2));
|
||
return n ? (d.S = +n[0], i + n[0].length) : -1;
|
||
}
|
||
|
||
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 parseLiteralPercent(d, string, i) {
|
||
var n = percentRe.exec(string.slice(i, i + 1));
|
||
return n ? i + n[0].length : -1;
|
||
}
|
||
|
||
function formatDayOfMonth(d, p) {
|
||
return pad(d.getDate(), p, 2);
|
||
}
|
||
|
||
function formatHour24(d, p) {
|
||
return pad(d.getHours(), p, 2);
|
||
}
|
||
|
||
function formatHour12(d, p) {
|
||
return pad(d.getHours() % 12 || 12, p, 2);
|
||
}
|
||
|
||
function formatDayOfYear(d, p) {
|
||
return pad(1 + d3Time.timeDay.count(d3Time.timeYear(d), d), p, 3);
|
||
}
|
||
|
||
function formatMilliseconds(d, p) {
|
||
return pad(d.getMilliseconds(), p, 3);
|
||
}
|
||
|
||
function formatMonthNumber(d, p) {
|
||
return pad(d.getMonth() + 1, p, 2);
|
||
}
|
||
|
||
function formatMinutes(d, p) {
|
||
return pad(d.getMinutes(), p, 2);
|
||
}
|
||
|
||
function formatSeconds(d, p) {
|
||
return pad(d.getSeconds(), p, 2);
|
||
}
|
||
|
||
function formatWeekNumberSunday(d, p) {
|
||
return pad(d3Time.timeSunday.count(d3Time.timeYear(d), d), p, 2);
|
||
}
|
||
|
||
function formatWeekdayNumber(d) {
|
||
return d.getDay();
|
||
}
|
||
|
||
function formatWeekNumberMonday(d, p) {
|
||
return pad(d3Time.timeMonday.count(d3Time.timeYear(d), d), p, 2);
|
||
}
|
||
|
||
function formatYear(d, p) {
|
||
return pad(d.getFullYear() % 100, p, 2);
|
||
}
|
||
|
||
function formatFullYear(d, p) {
|
||
return pad(d.getFullYear() % 10000, p, 4);
|
||
}
|
||
|
||
function formatZone(d) {
|
||
var z = d.getTimezoneOffset();
|
||
return (z > 0 ? "-" : (z *= -1, "+"))
|
||
+ pad(z / 60 | 0, "0", 2)
|
||
+ pad(z % 60, "0", 2);
|
||
}
|
||
|
||
function formatUTCDayOfMonth(d, p) {
|
||
return pad(d.getUTCDate(), p, 2);
|
||
}
|
||
|
||
function formatUTCHour24(d, p) {
|
||
return pad(d.getUTCHours(), p, 2);
|
||
}
|
||
|
||
function formatUTCHour12(d, p) {
|
||
return pad(d.getUTCHours() % 12 || 12, p, 2);
|
||
}
|
||
|
||
function formatUTCDayOfYear(d, p) {
|
||
return pad(1 + d3Time.utcDay.count(d3Time.utcYear(d), d), p, 3);
|
||
}
|
||
|
||
function formatUTCMilliseconds(d, p) {
|
||
return pad(d.getUTCMilliseconds(), p, 3);
|
||
}
|
||
|
||
function formatUTCMonthNumber(d, p) {
|
||
return pad(d.getUTCMonth() + 1, p, 2);
|
||
}
|
||
|
||
function formatUTCMinutes(d, p) {
|
||
return pad(d.getUTCMinutes(), p, 2);
|
||
}
|
||
|
||
function formatUTCSeconds(d, p) {
|
||
return pad(d.getUTCSeconds(), p, 2);
|
||
}
|
||
|
||
function formatUTCWeekNumberSunday(d, p) {
|
||
return pad(d3Time.utcSunday.count(d3Time.utcYear(d), d), p, 2);
|
||
}
|
||
|
||
function formatUTCWeekdayNumber(d) {
|
||
return d.getUTCDay();
|
||
}
|
||
|
||
function formatUTCWeekNumberMonday(d, p) {
|
||
return pad(d3Time.utcMonday.count(d3Time.utcYear(d), d), p, 2);
|
||
}
|
||
|
||
function formatUTCYear(d, p) {
|
||
return pad(d.getUTCFullYear() % 100, p, 2);
|
||
}
|
||
|
||
function formatUTCFullYear(d, p) {
|
||
return pad(d.getUTCFullYear() % 10000, p, 4);
|
||
}
|
||
|
||
function formatUTCZone() {
|
||
return "+0000";
|
||
}
|
||
|
||
function formatLiteralPercent() {
|
||
return "%";
|
||
}
|
||
|
||
var locale$1;
|
||
|
||
|
||
|
||
|
||
|
||
defaultLocale({
|
||
dateTime: "%x, %X",
|
||
date: "%-m/%-d/%Y",
|
||
time: "%-I:%M:%S %p",
|
||
periods: ["AM", "PM"],
|
||
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||
shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
||
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(definition) {
|
||
locale$1 = formatLocale(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) {
|
||
return date.toISOString();
|
||
}
|
||
|
||
var formatIso = Date.prototype.toISOString
|
||
? formatIsoNative
|
||
: exports.utcFormat(isoSpecifier);
|
||
|
||
function parseIsoNative(string) {
|
||
var date = new Date(string);
|
||
return isNaN(date) ? null : date;
|
||
}
|
||
|
||
var parseIso = +new Date("2000-01-01T00:00:00.000Z")
|
||
? parseIsoNative
|
||
: exports.utcParse(isoSpecifier);
|
||
|
||
exports.timeFormatDefaultLocale = defaultLocale;
|
||
exports.timeFormatLocale = formatLocale;
|
||
exports.isoFormat = formatIso;
|
||
exports.isoParse = parseIso;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
})));
|
||
|
||
},{"d3-time":10}],10:[function(require,module,exports){
|
||
// https://d3js.org/d3-time/ Version 1.0.4. Copyright 2016 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 t0 = new Date;
|
||
var t1 = new Date;
|
||
|
||
function newInterval(floori, offseti, count, field) {
|
||
|
||
function interval(date) {
|
||
return floori(date = new Date(+date)), date;
|
||
}
|
||
|
||
interval.floor = interval;
|
||
|
||
interval.ceil = function(date) {
|
||
return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
|
||
};
|
||
|
||
interval.round = function(date) {
|
||
var d0 = interval(date),
|
||
d1 = interval.ceil(date);
|
||
return date - d0 < d1 - date ? d0 : d1;
|
||
};
|
||
|
||
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 = [];
|
||
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)
|
||
return range;
|
||
};
|
||
|
||
interval.filter = function(test) {
|
||
return newInterval(function(date) {
|
||
if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
|
||
}, function(date, step) {
|
||
if (date >= date) while (--step >= 0) while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty
|
||
});
|
||
};
|
||
|
||
if (count) {
|
||
interval.count = function(start, end) {
|
||
t0.setTime(+start), t1.setTime(+end);
|
||
floori(t0), floori(t1);
|
||
return Math.floor(count(t0, t1));
|
||
};
|
||
|
||
interval.every = function(step) {
|
||
step = Math.floor(step);
|
||
return !isFinite(step) || !(step > 0) ? null
|
||
: !(step > 1) ? interval
|
||
: interval.filter(field
|
||
? function(d) { return field(d) % step === 0; }
|
||
: function(d) { return interval.count(0, d) % step === 0; });
|
||
};
|
||
}
|
||
|
||
return interval;
|
||
}
|
||
|
||
var millisecond = newInterval(function() {
|
||
// noop
|
||
}, function(date, step) {
|
||
date.setTime(+date + step);
|
||
}, function(start, end) {
|
||
return end - start;
|
||
});
|
||
|
||
// An optimized implementation for this simple case.
|
||
millisecond.every = function(k) {
|
||
k = Math.floor(k);
|
||
if (!isFinite(k) || !(k > 0)) return null;
|
||
if (!(k > 1)) return millisecond;
|
||
return newInterval(function(date) {
|
||
date.setTime(Math.floor(date / k) * k);
|
||
}, function(date, step) {
|
||
date.setTime(+date + step * k);
|
||
}, function(start, end) {
|
||
return (end - start) / k;
|
||
});
|
||
};
|
||
|
||
var milliseconds = millisecond.range;
|
||
|
||
var durationSecond = 1e3;
|
||
var durationMinute = 6e4;
|
||
var durationHour = 36e5;
|
||
var durationDay = 864e5;
|
||
var durationWeek = 6048e5;
|
||
|
||
var second = newInterval(function(date) {
|
||
date.setTime(Math.floor(date / durationSecond) * durationSecond);
|
||
}, function(date, step) {
|
||
date.setTime(+date + step * durationSecond);
|
||
}, function(start, end) {
|
||
return (end - start) / durationSecond;
|
||
}, function(date) {
|
||
return date.getUTCSeconds();
|
||
});
|
||
|
||
var seconds = second.range;
|
||
|
||
var minute = newInterval(function(date) {
|
||
date.setTime(Math.floor(date / durationMinute) * durationMinute);
|
||
}, function(date, step) {
|
||
date.setTime(+date + step * durationMinute);
|
||
}, function(start, end) {
|
||
return (end - start) / durationMinute;
|
||
}, function(date) {
|
||
return date.getMinutes();
|
||
});
|
||
|
||
var minutes = minute.range;
|
||
|
||
var hour = newInterval(function(date) {
|
||
var offset = date.getTimezoneOffset() * durationMinute % durationHour;
|
||
if (offset < 0) offset += durationHour;
|
||
date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset);
|
||
}, function(date, step) {
|
||
date.setTime(+date + step * durationHour);
|
||
}, function(start, end) {
|
||
return (end - start) / durationHour;
|
||
}, function(date) {
|
||
return date.getHours();
|
||
});
|
||
|
||
var hours = hour.range;
|
||
|
||
var day = newInterval(function(date) {
|
||
date.setHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setDate(date.getDate() + step);
|
||
}, function(start, end) {
|
||
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;
|
||
}, function(date) {
|
||
return date.getDate() - 1;
|
||
});
|
||
|
||
var days = day.range;
|
||
|
||
function weekday(i) {
|
||
return newInterval(function(date) {
|
||
date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
|
||
date.setHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setDate(date.getDate() + step * 7);
|
||
}, function(start, end) {
|
||
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
|
||
});
|
||
}
|
||
|
||
var sunday = weekday(0);
|
||
var monday = weekday(1);
|
||
var tuesday = weekday(2);
|
||
var wednesday = weekday(3);
|
||
var thursday = weekday(4);
|
||
var friday = weekday(5);
|
||
var saturday = weekday(6);
|
||
|
||
var sundays = sunday.range;
|
||
var mondays = monday.range;
|
||
var tuesdays = tuesday.range;
|
||
var wednesdays = wednesday.range;
|
||
var thursdays = thursday.range;
|
||
var fridays = friday.range;
|
||
var saturdays = saturday.range;
|
||
|
||
var month = newInterval(function(date) {
|
||
date.setDate(1);
|
||
date.setHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setMonth(date.getMonth() + step);
|
||
}, function(start, end) {
|
||
return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
|
||
}, function(date) {
|
||
return date.getMonth();
|
||
});
|
||
|
||
var months = month.range;
|
||
|
||
var year = newInterval(function(date) {
|
||
date.setMonth(0, 1);
|
||
date.setHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setFullYear(date.getFullYear() + step);
|
||
}, function(start, end) {
|
||
return end.getFullYear() - start.getFullYear();
|
||
}, function(date) {
|
||
return date.getFullYear();
|
||
});
|
||
|
||
// An optimized implementation for this simple case.
|
||
year.every = function(k) {
|
||
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
|
||
date.setFullYear(Math.floor(date.getFullYear() / k) * k);
|
||
date.setMonth(0, 1);
|
||
date.setHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setFullYear(date.getFullYear() + step * k);
|
||
});
|
||
};
|
||
|
||
var years = year.range;
|
||
|
||
var utcMinute = newInterval(function(date) {
|
||
date.setUTCSeconds(0, 0);
|
||
}, function(date, step) {
|
||
date.setTime(+date + step * durationMinute);
|
||
}, function(start, end) {
|
||
return (end - start) / durationMinute;
|
||
}, function(date) {
|
||
return date.getUTCMinutes();
|
||
});
|
||
|
||
var utcMinutes = utcMinute.range;
|
||
|
||
var utcHour = newInterval(function(date) {
|
||
date.setUTCMinutes(0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setTime(+date + step * durationHour);
|
||
}, function(start, end) {
|
||
return (end - start) / durationHour;
|
||
}, function(date) {
|
||
return date.getUTCHours();
|
||
});
|
||
|
||
var utcHours = utcHour.range;
|
||
|
||
var utcDay = newInterval(function(date) {
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setUTCDate(date.getUTCDate() + step);
|
||
}, function(start, end) {
|
||
return (end - start) / durationDay;
|
||
}, function(date) {
|
||
return date.getUTCDate() - 1;
|
||
});
|
||
|
||
var utcDays = utcDay.range;
|
||
|
||
function utcWeekday(i) {
|
||
return newInterval(function(date) {
|
||
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setUTCDate(date.getUTCDate() + step * 7);
|
||
}, function(start, end) {
|
||
return (end - start) / durationWeek;
|
||
});
|
||
}
|
||
|
||
var utcSunday = utcWeekday(0);
|
||
var utcMonday = utcWeekday(1);
|
||
var utcTuesday = utcWeekday(2);
|
||
var utcWednesday = utcWeekday(3);
|
||
var utcThursday = utcWeekday(4);
|
||
var utcFriday = utcWeekday(5);
|
||
var utcSaturday = utcWeekday(6);
|
||
|
||
var utcSundays = utcSunday.range;
|
||
var utcMondays = utcMonday.range;
|
||
var utcTuesdays = utcTuesday.range;
|
||
var utcWednesdays = utcWednesday.range;
|
||
var utcThursdays = utcThursday.range;
|
||
var utcFridays = utcFriday.range;
|
||
var utcSaturdays = utcSaturday.range;
|
||
|
||
var utcMonth = newInterval(function(date) {
|
||
date.setUTCDate(1);
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setUTCMonth(date.getUTCMonth() + step);
|
||
}, function(start, end) {
|
||
return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
|
||
}, function(date) {
|
||
return date.getUTCMonth();
|
||
});
|
||
|
||
var utcMonths = utcMonth.range;
|
||
|
||
var utcYear = newInterval(function(date) {
|
||
date.setUTCMonth(0, 1);
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setUTCFullYear(date.getUTCFullYear() + step);
|
||
}, function(start, end) {
|
||
return end.getUTCFullYear() - start.getUTCFullYear();
|
||
}, function(date) {
|
||
return date.getUTCFullYear();
|
||
});
|
||
|
||
// An optimized implementation for this simple case.
|
||
utcYear.every = function(k) {
|
||
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
|
||
date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
|
||
date.setUTCMonth(0, 1);
|
||
date.setUTCHours(0, 0, 0, 0);
|
||
}, function(date, step) {
|
||
date.setUTCFullYear(date.getUTCFullYear() + step * k);
|
||
});
|
||
};
|
||
|
||
var utcYears = utcYear.range;
|
||
|
||
exports.timeInterval = newInterval;
|
||
exports.timeMillisecond = millisecond;
|
||
exports.timeMilliseconds = milliseconds;
|
||
exports.utcMillisecond = millisecond;
|
||
exports.utcMilliseconds = milliseconds;
|
||
exports.timeSecond = second;
|
||
exports.timeSeconds = seconds;
|
||
exports.utcSecond = second;
|
||
exports.utcSeconds = seconds;
|
||
exports.timeMinute = minute;
|
||
exports.timeMinutes = minutes;
|
||
exports.timeHour = hour;
|
||
exports.timeHours = hours;
|
||
exports.timeDay = day;
|
||
exports.timeDays = days;
|
||
exports.timeWeek = sunday;
|
||
exports.timeWeeks = sundays;
|
||
exports.timeSunday = sunday;
|
||
exports.timeSundays = sundays;
|
||
exports.timeMonday = monday;
|
||
exports.timeMondays = mondays;
|
||
exports.timeTuesday = tuesday;
|
||
exports.timeTuesdays = tuesdays;
|
||
exports.timeWednesday = wednesday;
|
||
exports.timeWednesdays = wednesdays;
|
||
exports.timeThursday = thursday;
|
||
exports.timeThursdays = thursdays;
|
||
exports.timeFriday = friday;
|
||
exports.timeFridays = fridays;
|
||
exports.timeSaturday = saturday;
|
||
exports.timeSaturdays = saturdays;
|
||
exports.timeMonth = month;
|
||
exports.timeMonths = months;
|
||
exports.timeYear = year;
|
||
exports.timeYears = years;
|
||
exports.utcMinute = utcMinute;
|
||
exports.utcMinutes = utcMinutes;
|
||
exports.utcHour = utcHour;
|
||
exports.utcHours = utcHours;
|
||
exports.utcDay = utcDay;
|
||
exports.utcDays = utcDays;
|
||
exports.utcWeek = utcSunday;
|
||
exports.utcWeeks = utcSundays;
|
||
exports.utcSunday = utcSunday;
|
||
exports.utcSundays = utcSundays;
|
||
exports.utcMonday = utcMonday;
|
||
exports.utcMondays = utcMondays;
|
||
exports.utcTuesday = utcTuesday;
|
||
exports.utcTuesdays = utcTuesdays;
|
||
exports.utcWednesday = utcWednesday;
|
||
exports.utcWednesdays = utcWednesdays;
|
||
exports.utcThursday = utcThursday;
|
||
exports.utcThursdays = utcThursdays;
|
||
exports.utcFriday = utcFriday;
|
||
exports.utcFridays = utcFridays;
|
||
exports.utcSaturday = utcSaturday;
|
||
exports.utcSaturdays = utcSaturdays;
|
||
exports.utcMonth = utcMonth;
|
||
exports.utcMonths = utcMonths;
|
||
exports.utcYear = utcYear;
|
||
exports.utcYears = utcYears;
|
||
|
||
Object.defineProperty(exports, '__esModule', { value: true });
|
||
|
||
})));
|
||
|
||
},{}],11:[function(require,module,exports){
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = color;
|
||
|
||
var _legend = require("./legend");
|
||
|
||
var _legend2 = _interopRequireDefault(_legend);
|
||
|
||
var _d3Dispatch = require("d3-dispatch");
|
||
|
||
var _d3Scale = require("d3-scale");
|
||
|
||
var _d3Format = require("d3-format");
|
||
|
||
var _d3Array = require("d3-array");
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function color() {
|
||
var scale = (0, _d3Scale.scaleLinear)(),
|
||
shape = "rect",
|
||
shapeWidth = 15,
|
||
shapeHeight = 15,
|
||
shapeRadius = 10,
|
||
shapePadding = 2,
|
||
cells = [5],
|
||
cellFilter = void 0,
|
||
labels = [],
|
||
classPrefix = "",
|
||
useClass = false,
|
||
title = "",
|
||
locale = _legend2.default.d3_defaultLocale,
|
||
specifier = _legend2.default.d3_defaultFormatSpecifier,
|
||
labelOffset = 10,
|
||
labelAlign = "middle",
|
||
labelDelimiter = _legend2.default.d3_defaultDelimiter,
|
||
labelWrap = void 0,
|
||
orient = "vertical",
|
||
ascending = false,
|
||
path = void 0,
|
||
titleWidth = void 0,
|
||
legendDispatcher = (0, _d3Dispatch.dispatch)("cellover", "cellout", "cellclick");
|
||
|
||
function legend(svg) {
|
||
var type = _legend2.default.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter),
|
||
legendG = svg.selectAll("g").data([scale]);
|
||
|
||
legendG.enter().append("g").attr("class", classPrefix + "legendCells");
|
||
|
||
if (cellFilter) {
|
||
_legend2.default.d3_filterCells(type, cellFilter);
|
||
}
|
||
|
||
var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
|
||
|
||
var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
|
||
cellEnter.append(shape).attr("class", classPrefix + "swatch");
|
||
|
||
var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch").data(type.data);
|
||
|
||
//add event handlers
|
||
_legend2.default.d3_addEvents(cellEnter, legendDispatcher);
|
||
|
||
cell.exit().transition().style("opacity", 0).remove();
|
||
shapes.exit().transition().style("opacity", 0).remove();
|
||
|
||
shapes = shapes.merge(shapes);
|
||
|
||
_legend2.default.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path);
|
||
var text = _legend2.default.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);
|
||
|
||
// we need to merge the selection, otherwise changes in the legend (e.g. change of orientation) are applied only to the new cells and not the existing ones.
|
||
cell = cellEnter.merge(cell);
|
||
|
||
// sets placement
|
||
var textSize = text.nodes().map(function (d) {
|
||
return d.getBBox();
|
||
}),
|
||
shapeSize = shapes.nodes().map(function (d) {
|
||
return d.getBBox();
|
||
});
|
||
//sets scale
|
||
//everything is fill except for line which is stroke,
|
||
if (!useClass) {
|
||
if (shape == "line") {
|
||
shapes.style("stroke", type.feature);
|
||
} else {
|
||
shapes.style("fill", type.feature);
|
||
}
|
||
} else {
|
||
shapes.attr("class", function (d) {
|
||
return classPrefix + "swatch " + type.feature(d);
|
||
});
|
||
}
|
||
|
||
var cellTrans = void 0,
|
||
textTrans = void 0,
|
||
textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;
|
||
|
||
//positions cells and text
|
||
if (orient === "vertical") {
|
||
(function () {
|
||
var cellSize = textSize.map(function (d, i) {
|
||
return Math.max(d.height, shapeSize[i].height);
|
||
});
|
||
|
||
cellTrans = function cellTrans(d, i) {
|
||
var height = (0, _d3Array.sum)(cellSize.slice(0, i));
|
||
return "translate(0, " + (height + i * shapePadding) + ")";
|
||
};
|
||
|
||
textTrans = function textTrans(d, i) {
|
||
return "translate( " + (shapeSize[i].width + shapeSize[i].x + labelOffset) + ", " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
|
||
};
|
||
})();
|
||
} else if (orient === "horizontal") {
|
||
cellTrans = function cellTrans(d, i) {
|
||
return "translate(" + i * (shapeSize[i].width + shapePadding) + ",0)";
|
||
};
|
||
textTrans = function textTrans(d, i) {
|
||
return "translate(" + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n " + (shapeSize[i].height + shapeSize[i].y + labelOffset + 8) + ")";
|
||
};
|
||
}
|
||
|
||
_legend2.default.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
|
||
_legend2.default.d3_title(svg, title, classPrefix, titleWidth);
|
||
|
||
cell.transition().style("opacity", 1);
|
||
}
|
||
|
||
legend.scale = function (_) {
|
||
if (!arguments.length) return scale;
|
||
scale = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.cells = function (_) {
|
||
if (!arguments.length) return cells;
|
||
if (_.length > 1 || _ >= 2) {
|
||
cells = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.cellFilter = function (_) {
|
||
if (!arguments.length) return cellFilter;
|
||
cellFilter = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.shape = function (_, d) {
|
||
if (!arguments.length) return shape;
|
||
if (_ == "rect" || _ == "circle" || _ == "line" || _ == "path" && typeof d === "string") {
|
||
shape = _;
|
||
path = d;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.shapeWidth = function (_) {
|
||
if (!arguments.length) return shapeWidth;
|
||
shapeWidth = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.shapeHeight = function (_) {
|
||
if (!arguments.length) return shapeHeight;
|
||
shapeHeight = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.shapeRadius = function (_) {
|
||
if (!arguments.length) return shapeRadius;
|
||
shapeRadius = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.shapePadding = function (_) {
|
||
if (!arguments.length) return shapePadding;
|
||
shapePadding = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.labels = function (_) {
|
||
if (!arguments.length) return labels;
|
||
labels = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelAlign = function (_) {
|
||
if (!arguments.length) return labelAlign;
|
||
if (_ == "start" || _ == "end" || _ == "middle") {
|
||
labelAlign = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.locale = function (_) {
|
||
if (!arguments.length) return locale;
|
||
locale = (0, _d3Format.formatLocale)(_);
|
||
return legend;
|
||
};
|
||
|
||
legend.labelFormat = function (_) {
|
||
if (!arguments.length) return legend.locale().format(specifier);
|
||
specifier = (0, _d3Format.formatSpecifier)(_);
|
||
return legend;
|
||
};
|
||
|
||
legend.labelOffset = function (_) {
|
||
if (!arguments.length) return labelOffset;
|
||
labelOffset = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelDelimiter = function (_) {
|
||
if (!arguments.length) return labelDelimiter;
|
||
labelDelimiter = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelWrap = function (_) {
|
||
if (!arguments.length) return labelWrap;
|
||
labelWrap = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.useClass = function (_) {
|
||
if (!arguments.length) return useClass;
|
||
if (_ === true || _ === false) {
|
||
useClass = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.orient = function (_) {
|
||
if (!arguments.length) return orient;
|
||
_ = _.toLowerCase();
|
||
if (_ == "horizontal" || _ == "vertical") {
|
||
orient = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.ascending = function (_) {
|
||
if (!arguments.length) return ascending;
|
||
ascending = !!_;
|
||
return legend;
|
||
};
|
||
|
||
legend.classPrefix = function (_) {
|
||
if (!arguments.length) return classPrefix;
|
||
classPrefix = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.title = function (_) {
|
||
if (!arguments.length) return title;
|
||
title = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.titleWidth = function (_) {
|
||
if (!arguments.length) return titleWidth;
|
||
titleWidth = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.textWrap = function (_) {
|
||
if (!arguments.length) return textWrap;
|
||
textWrap = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.on = function () {
|
||
var value = legendDispatcher.on.apply(legendDispatcher, arguments);
|
||
return value === legendDispatcher ? legend : value;
|
||
};
|
||
|
||
return legend;
|
||
}
|
||
|
||
},{"./legend":13,"d3-array":1,"d3-dispatch":4,"d3-format":5,"d3-scale":7}],12:[function(require,module,exports){
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
var thresholdLabels = exports.thresholdLabels = function thresholdLabels(_ref) {
|
||
var i = _ref.i,
|
||
genLength = _ref.genLength,
|
||
generatedLabels = _ref.generatedLabels,
|
||
labelDelimiter = _ref.labelDelimiter;
|
||
|
||
if (i === 0) {
|
||
var values = generatedLabels[i].split(" " + labelDelimiter + " ");
|
||
return "Less than " + values[1];
|
||
} else if (i === genLength - 1) {
|
||
var _values = generatedLabels[i].split(" " + labelDelimiter + " ");
|
||
return _values[0] + " or more";
|
||
}
|
||
return generatedLabels[i];
|
||
};
|
||
|
||
exports.default = {
|
||
thresholdLabels: thresholdLabels
|
||
};
|
||
|
||
},{}],13:[function(require,module,exports){
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
||
var _d3Selection = require("d3-selection");
|
||
|
||
var _d3Format = require("d3-format");
|
||
|
||
var d3_identity = function d3_identity(d) {
|
||
return d;
|
||
};
|
||
|
||
var d3_reverse = function d3_reverse(arr) {
|
||
var mirror = [];
|
||
for (var i = 0, l = arr.length; i < l; i++) {
|
||
mirror[i] = arr[l - i - 1];
|
||
}
|
||
return mirror;
|
||
};
|
||
|
||
//Text wrapping code adapted from Mike Bostock
|
||
var d3_textWrapping = function d3_textWrapping(text, width) {
|
||
text.each(function () {
|
||
var text = (0, _d3Selection.select)(this),
|
||
words = text.text().split(/\s+/).reverse(),
|
||
word,
|
||
line = [],
|
||
lineNumber = 0,
|
||
lineHeight = 1.2,
|
||
//ems
|
||
y = text.attr("y"),
|
||
dy = parseFloat(text.attr("dy")) || 0,
|
||
tspan = text.text(null).append("tspan").attr("x", 0).attr("dy", dy + "em");
|
||
|
||
while (word = words.pop()) {
|
||
line.push(word);
|
||
tspan.text(line.join(" "));
|
||
if (tspan.node().getComputedTextLength() > width && line.length > 1) {
|
||
line.pop();
|
||
tspan.text(line.join(" "));
|
||
line = [word];
|
||
tspan = text.append("tspan").attr("x", 0).attr("dy", lineHeight + dy + "em").text(word);
|
||
}
|
||
}
|
||
});
|
||
};
|
||
|
||
var d3_mergeLabels = function d3_mergeLabels() {
|
||
var gen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||
var labels = arguments[1];
|
||
var domain = arguments[2];
|
||
var range = arguments[3];
|
||
var labelDelimiter = arguments[4];
|
||
|
||
if ((typeof labels === "undefined" ? "undefined" : _typeof(labels)) === "object") {
|
||
if (labels.length === 0) return gen;
|
||
|
||
var i = labels.length;
|
||
for (; i < gen.length; i++) {
|
||
labels.push(gen[i]);
|
||
}
|
||
return labels;
|
||
} else if (typeof labels === "function") {
|
||
var customLabels = [];
|
||
var genLength = gen.length;
|
||
for (var _i = 0; _i < genLength; _i++) {
|
||
customLabels.push(labels({
|
||
i: _i,
|
||
genLength: genLength,
|
||
generatedLabels: gen,
|
||
domain: domain,
|
||
range: range,
|
||
labelDelimiter: labelDelimiter
|
||
}));
|
||
}
|
||
return customLabels;
|
||
}
|
||
|
||
return gen;
|
||
};
|
||
|
||
var d3_linearLegend = function d3_linearLegend(scale, cells, labelFormat) {
|
||
var data = [];
|
||
|
||
if (cells.length > 1) {
|
||
data = cells;
|
||
} else {
|
||
var domain = scale.domain(),
|
||
increment = (domain[domain.length - 1] - domain[0]) / (cells - 1);
|
||
var i = 0;
|
||
|
||
for (; i < cells; i++) {
|
||
data.push(domain[0] + i * increment);
|
||
}
|
||
}
|
||
|
||
var labels = data.map(labelFormat);
|
||
return {
|
||
data: data,
|
||
labels: labels,
|
||
feature: function feature(d) {
|
||
return scale(d);
|
||
}
|
||
};
|
||
};
|
||
|
||
var d3_quantLegend = function d3_quantLegend(scale, labelFormat, labelDelimiter) {
|
||
var labels = scale.range().map(function (d) {
|
||
var invert = scale.invertExtent(d);
|
||
return labelFormat(invert[0]) + " " + labelDelimiter + " " + labelFormat(invert[1]);
|
||
});
|
||
|
||
return {
|
||
data: scale.range(),
|
||
labels: labels,
|
||
feature: d3_identity
|
||
};
|
||
};
|
||
|
||
var d3_ordinalLegend = function d3_ordinalLegend(scale) {
|
||
return {
|
||
data: scale.domain(),
|
||
labels: scale.domain(),
|
||
feature: function feature(d) {
|
||
return scale(d);
|
||
}
|
||
};
|
||
};
|
||
|
||
var d3_cellOver = function d3_cellOver(cellDispatcher, d, obj) {
|
||
cellDispatcher.call("cellover", obj, d);
|
||
};
|
||
|
||
var d3_cellOut = function d3_cellOut(cellDispatcher, d, obj) {
|
||
cellDispatcher.call("cellout", obj, d);
|
||
};
|
||
|
||
var d3_cellClick = function d3_cellClick(cellDispatcher, d, obj) {
|
||
cellDispatcher.call("cellclick", obj, d);
|
||
};
|
||
|
||
exports.default = {
|
||
d3_drawShapes: function d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path) {
|
||
if (shape === "rect") {
|
||
shapes.attr("height", shapeHeight).attr("width", shapeWidth);
|
||
} else if (shape === "circle") {
|
||
shapes.attr("r", shapeRadius);
|
||
} else if (shape === "line") {
|
||
shapes.attr("x1", 0).attr("x2", shapeWidth).attr("y1", 0).attr("y2", 0);
|
||
} else if (shape === "path") {
|
||
shapes.attr("d", path);
|
||
}
|
||
},
|
||
|
||
d3_addText: function d3_addText(svg, enter, labels, classPrefix, labelWidth) {
|
||
enter.append("text").attr("class", classPrefix + "label");
|
||
var text = svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").data(labels).text(d3_identity);
|
||
|
||
if (labelWidth) {
|
||
svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").call(d3_textWrapping, labelWidth);
|
||
}
|
||
|
||
return text;
|
||
},
|
||
|
||
d3_calcType: function d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter) {
|
||
var type = scale.invertExtent ? d3_quantLegend(scale, labelFormat, labelDelimiter) : scale.ticks ? d3_linearLegend(scale, cells, labelFormat) : d3_ordinalLegend(scale);
|
||
|
||
//for d3.scaleSequential that doesn't have a range function
|
||
var range = scale.range && scale.range() || scale.domain();
|
||
type.labels = d3_mergeLabels(type.labels, labels, scale.domain(), range, labelDelimiter);
|
||
|
||
if (ascending) {
|
||
type.labels = d3_reverse(type.labels);
|
||
type.data = d3_reverse(type.data);
|
||
}
|
||
|
||
return type;
|
||
},
|
||
|
||
d3_filterCells: function d3_filterCells(type, cellFilter) {
|
||
var filterCells = type.data.map(function (d, i) {
|
||
return { data: d, label: type.labels[i] };
|
||
}).filter(cellFilter);
|
||
var dataValues = filterCells.map(function (d) {
|
||
return d.data;
|
||
});
|
||
var labelValues = filterCells.map(function (d) {
|
||
return d.label;
|
||
});
|
||
type.data = type.data.filter(function (d) {
|
||
return dataValues.indexOf(d) !== -1;
|
||
});
|
||
type.labels = type.labels.filter(function (d) {
|
||
return labelValues.indexOf(d) !== -1;
|
||
});
|
||
return type;
|
||
},
|
||
|
||
d3_placement: function d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign) {
|
||
cell.attr("transform", cellTrans);
|
||
text.attr("transform", textTrans);
|
||
if (orient === "horizontal") {
|
||
text.style("text-anchor", labelAlign);
|
||
}
|
||
},
|
||
|
||
d3_addEvents: function d3_addEvents(cells, dispatcher) {
|
||
cells.on("mouseover.legend", function (d) {
|
||
d3_cellOver(dispatcher, d, this);
|
||
}).on("mouseout.legend", function (d) {
|
||
d3_cellOut(dispatcher, d, this);
|
||
}).on("click.legend", function (d) {
|
||
d3_cellClick(dispatcher, d, this);
|
||
});
|
||
},
|
||
|
||
d3_title: function d3_title(svg, title, classPrefix, titleWidth) {
|
||
if (title !== "") {
|
||
var titleText = svg.selectAll("text." + classPrefix + "legendTitle");
|
||
|
||
titleText.data([title]).enter().append("text").attr("class", classPrefix + "legendTitle");
|
||
|
||
svg.selectAll("text." + classPrefix + "legendTitle").text(title);
|
||
|
||
if (titleWidth) {
|
||
svg.selectAll("text." + classPrefix + "legendTitle").call(d3_textWrapping, titleWidth);
|
||
}
|
||
|
||
var cellsSvg = svg.select("." + classPrefix + "legendCells");
|
||
var yOffset = svg.select("." + classPrefix + "legendTitle").nodes().map(function (d) {
|
||
return d.getBBox().height;
|
||
})[0],
|
||
xOffset = -cellsSvg.nodes().map(function (d) {
|
||
return d.getBBox().x;
|
||
})[0];
|
||
cellsSvg.attr("transform", "translate(" + xOffset + "," + yOffset + ")");
|
||
}
|
||
},
|
||
|
||
d3_defaultLocale: {
|
||
format: _d3Format.format,
|
||
formatPrefix: _d3Format.formatPrefix
|
||
},
|
||
|
||
d3_defaultFormatSpecifier: ".01f",
|
||
|
||
d3_defaultDelimiter: "to"
|
||
};
|
||
|
||
},{"d3-format":5,"d3-selection":8}],14:[function(require,module,exports){
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = size;
|
||
|
||
var _legend = require("./legend");
|
||
|
||
var _legend2 = _interopRequireDefault(_legend);
|
||
|
||
var _d3Dispatch = require("d3-dispatch");
|
||
|
||
var _d3Scale = require("d3-scale");
|
||
|
||
var _d3Format = require("d3-format");
|
||
|
||
var _d3Array = require("d3-array");
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function size() {
|
||
var scale = (0, _d3Scale.scaleLinear)(),
|
||
shape = "rect",
|
||
shapeWidth = 15,
|
||
shapePadding = 2,
|
||
cells = [5],
|
||
cellFilter = void 0,
|
||
labels = [],
|
||
classPrefix = "",
|
||
title = "",
|
||
locale = _legend2.default.d3_defaultLocale,
|
||
specifier = _legend2.default.d3_defaultFormatSpecifier,
|
||
labelOffset = 10,
|
||
labelAlign = "middle",
|
||
labelDelimiter = _legend2.default.d3_defaultDelimiter,
|
||
labelWrap = void 0,
|
||
orient = "vertical",
|
||
ascending = false,
|
||
path = void 0,
|
||
titleWidth = void 0,
|
||
legendDispatcher = (0, _d3Dispatch.dispatch)("cellover", "cellout", "cellclick");
|
||
|
||
function legend(svg) {
|
||
var type = _legend2.default.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter),
|
||
legendG = svg.selectAll("g").data([scale]);
|
||
|
||
if (cellFilter) {
|
||
_legend2.default.d3_filterCells(type, cellFilter);
|
||
}
|
||
|
||
legendG.enter().append("g").attr("class", classPrefix + "legendCells");
|
||
|
||
var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
|
||
var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
|
||
cellEnter.append(shape).attr("class", classPrefix + "swatch");
|
||
|
||
var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch");
|
||
|
||
//add event handlers
|
||
_legend2.default.d3_addEvents(cellEnter, legendDispatcher);
|
||
|
||
cell.exit().transition().style("opacity", 0).remove();
|
||
|
||
shapes.exit().transition().style("opacity", 0).remove();
|
||
shapes = shapes.merge(shapes);
|
||
|
||
//creates shape
|
||
if (shape === "line") {
|
||
_legend2.default.d3_drawShapes(shape, shapes, 0, shapeWidth);
|
||
shapes.attr("stroke-width", type.feature);
|
||
} else {
|
||
_legend2.default.d3_drawShapes(shape, shapes, type.feature, type.feature, type.feature, path);
|
||
}
|
||
|
||
var text = _legend2.default.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);
|
||
|
||
// we need to merge the selection, otherwise changes in the legend (e.g. change of orientation) are applied only to the new cells and not the existing ones.
|
||
cell = cellEnter.merge(cell);
|
||
|
||
//sets placement
|
||
|
||
var textSize = text.nodes().map(function (d) {
|
||
return d.getBBox();
|
||
}),
|
||
shapeSize = shapes.nodes().map(function (d, i) {
|
||
var bbox = d.getBBox();
|
||
var stroke = scale(type.data[i]);
|
||
|
||
if (shape === "line" && orient === "horizontal") {
|
||
bbox.height = bbox.height + stroke;
|
||
} else if (shape === "line" && orient === "vertical") {
|
||
bbox.width = bbox.width;
|
||
}
|
||
return bbox;
|
||
});
|
||
|
||
var maxH = (0, _d3Array.max)(shapeSize, function (d) {
|
||
return d.height + d.y;
|
||
}),
|
||
maxW = (0, _d3Array.max)(shapeSize, function (d) {
|
||
return d.width + d.x;
|
||
});
|
||
|
||
var cellTrans = void 0,
|
||
textTrans = void 0,
|
||
textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;
|
||
|
||
//positions cells and text
|
||
if (orient === "vertical") {
|
||
(function () {
|
||
var cellSize = textSize.map(function (d, i) {
|
||
return Math.max(d.height, shapeSize[i].height);
|
||
});
|
||
var y = shape == "circle" || shape == "line" ? shapeSize[0].height / 2 : 0;
|
||
cellTrans = function cellTrans(d, i) {
|
||
var height = (0, _d3Array.sum)(cellSize.slice(0, i));
|
||
|
||
return "translate(0, " + (y + height + i * shapePadding) + ")";
|
||
};
|
||
|
||
textTrans = function textTrans(d, i) {
|
||
return "translate( " + (maxW + labelOffset) + ",\n " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
|
||
};
|
||
})();
|
||
} else if (orient === "horizontal") {
|
||
(function () {
|
||
cellTrans = function cellTrans(d, i) {
|
||
var width = (0, _d3Array.sum)(shapeSize.slice(0, i), function (d) {
|
||
return d.width;
|
||
});
|
||
var y = shape == "circle" || shape == "line" ? maxH / 2 : 0;
|
||
return "translate(" + (width + i * shapePadding) + ", " + y + ")";
|
||
};
|
||
|
||
var offset = shape == "line" ? maxH / 2 : maxH;
|
||
textTrans = function textTrans(d, i) {
|
||
return "translate( " + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n " + (offset + labelOffset) + ")";
|
||
};
|
||
})();
|
||
}
|
||
|
||
_legend2.default.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
|
||
_legend2.default.d3_title(svg, title, classPrefix, titleWidth);
|
||
|
||
cell.transition().style("opacity", 1);
|
||
}
|
||
|
||
legend.scale = function (_) {
|
||
if (!arguments.length) return scale;
|
||
scale = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.cells = function (_) {
|
||
if (!arguments.length) return cells;
|
||
if (_.length > 1 || _ >= 2) {
|
||
cells = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.cellFilter = function (_) {
|
||
if (!arguments.length) return cellFilter;
|
||
cellFilter = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.shape = function (_, d) {
|
||
if (!arguments.length) return shape;
|
||
if (_ == "rect" || _ == "circle" || _ == "line") {
|
||
shape = _;
|
||
path = d;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.shapeWidth = function (_) {
|
||
if (!arguments.length) return shapeWidth;
|
||
shapeWidth = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.shapePadding = function (_) {
|
||
if (!arguments.length) return shapePadding;
|
||
shapePadding = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.labels = function (_) {
|
||
if (!arguments.length) return labels;
|
||
labels = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelAlign = function (_) {
|
||
if (!arguments.length) return labelAlign;
|
||
if (_ == "start" || _ == "end" || _ == "middle") {
|
||
labelAlign = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.locale = function (_) {
|
||
if (!arguments.length) return locale;
|
||
locale = (0, _d3Format.formatLocale)(_);
|
||
return legend;
|
||
};
|
||
|
||
legend.labelFormat = function (_) {
|
||
if (!arguments.length) return legend.locale().format(specifier);
|
||
specifier = (0, _d3Format.formatSpecifier)(_);
|
||
return legend;
|
||
};
|
||
|
||
legend.labelOffset = function (_) {
|
||
if (!arguments.length) return labelOffset;
|
||
labelOffset = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelDelimiter = function (_) {
|
||
if (!arguments.length) return labelDelimiter;
|
||
labelDelimiter = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelWrap = function (_) {
|
||
if (!arguments.length) return labelWrap;
|
||
labelWrap = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.orient = function (_) {
|
||
if (!arguments.length) return orient;
|
||
_ = _.toLowerCase();
|
||
if (_ == "horizontal" || _ == "vertical") {
|
||
orient = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.ascending = function (_) {
|
||
if (!arguments.length) return ascending;
|
||
ascending = !!_;
|
||
return legend;
|
||
};
|
||
|
||
legend.classPrefix = function (_) {
|
||
if (!arguments.length) return classPrefix;
|
||
classPrefix = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.title = function (_) {
|
||
if (!arguments.length) return title;
|
||
title = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.titleWidth = function (_) {
|
||
if (!arguments.length) return titleWidth;
|
||
titleWidth = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.on = function () {
|
||
var value = legendDispatcher.on.apply(legendDispatcher, arguments);
|
||
return value === legendDispatcher ? legend : value;
|
||
};
|
||
|
||
return legend;
|
||
}
|
||
|
||
},{"./legend":13,"d3-array":1,"d3-dispatch":4,"d3-format":5,"d3-scale":7}],15:[function(require,module,exports){
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", {
|
||
value: true
|
||
});
|
||
exports.default = symbol;
|
||
|
||
var _legend = require("./legend");
|
||
|
||
var _legend2 = _interopRequireDefault(_legend);
|
||
|
||
var _d3Dispatch = require("d3-dispatch");
|
||
|
||
var _d3Scale = require("d3-scale");
|
||
|
||
var _d3Format = require("d3-format");
|
||
|
||
var _d3Array = require("d3-array");
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function symbol() {
|
||
var scale = (0, _d3Scale.scaleLinear)(),
|
||
shape = "path",
|
||
shapeWidth = 15,
|
||
shapeHeight = 15,
|
||
shapeRadius = 10,
|
||
shapePadding = 5,
|
||
cells = [5],
|
||
cellFilter = void 0,
|
||
labels = [],
|
||
classPrefix = "",
|
||
title = "",
|
||
locale = _legend2.default.d3_defaultLocale,
|
||
specifier = _legend2.default.d3_defaultFormatSpecifier,
|
||
labelAlign = "middle",
|
||
labelOffset = 10,
|
||
labelDelimiter = _legend2.default.d3_defaultDelimiter,
|
||
labelWrap = void 0,
|
||
orient = "vertical",
|
||
ascending = false,
|
||
titleWidth = void 0,
|
||
legendDispatcher = (0, _d3Dispatch.dispatch)("cellover", "cellout", "cellclick");
|
||
|
||
function legend(svg) {
|
||
var type = _legend2.default.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter),
|
||
legendG = svg.selectAll("g").data([scale]);
|
||
|
||
if (cellFilter) {
|
||
_legend2.default.d3_filterCells(type, cellFilter);
|
||
}
|
||
|
||
legendG.enter().append("g").attr("class", classPrefix + "legendCells");
|
||
|
||
var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
|
||
var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
|
||
cellEnter.append(shape).attr("class", classPrefix + "swatch");
|
||
|
||
var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch");
|
||
|
||
//add event handlers
|
||
_legend2.default.d3_addEvents(cellEnter, legendDispatcher);
|
||
|
||
//remove old shapes
|
||
cell.exit().transition().style("opacity", 0).remove();
|
||
shapes.exit().transition().style("opacity", 0).remove();
|
||
shapes = shapes.merge(shapes);
|
||
|
||
_legend2.default.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, type.feature);
|
||
var text = _legend2.default.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);
|
||
|
||
// we need to merge the selection, otherwise changes in the legend (e.g. change of orientation) are applied only to the new cells and not the existing ones.
|
||
cell = cellEnter.merge(cell);
|
||
|
||
// sets placement
|
||
var textSize = text.nodes().map(function (d) {
|
||
return d.getBBox();
|
||
}),
|
||
shapeSize = shapes.nodes().map(function (d) {
|
||
return d.getBBox();
|
||
});
|
||
|
||
var maxH = (0, _d3Array.max)(shapeSize, function (d) {
|
||
return d.height;
|
||
}),
|
||
maxW = (0, _d3Array.max)(shapeSize, function (d) {
|
||
return d.width;
|
||
});
|
||
|
||
var cellTrans = void 0,
|
||
textTrans = void 0,
|
||
textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;
|
||
|
||
//positions cells and text
|
||
if (orient === "vertical") {
|
||
(function () {
|
||
var cellSize = textSize.map(function (d, i) {
|
||
return Math.max(maxH, d.height);
|
||
});
|
||
|
||
cellTrans = function cellTrans(d, i) {
|
||
var height = (0, _d3Array.sum)(cellSize.slice(0, i));
|
||
return "translate(0, " + (height + i * shapePadding) + " )";
|
||
};
|
||
textTrans = function textTrans(d, i) {
|
||
return "translate( " + (maxW + labelOffset) + ",\n " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
|
||
};
|
||
})();
|
||
} else if (orient === "horizontal") {
|
||
cellTrans = function cellTrans(d, i) {
|
||
return "translate( " + i * (maxW + shapePadding) + ",0)";
|
||
};
|
||
textTrans = function textTrans(d, i) {
|
||
return "translate( " + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n " + (maxH + labelOffset) + ")";
|
||
};
|
||
}
|
||
|
||
_legend2.default.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
|
||
_legend2.default.d3_title(svg, title, classPrefix, titleWidth);
|
||
cell.transition().style("opacity", 1);
|
||
}
|
||
|
||
legend.scale = function (_) {
|
||
if (!arguments.length) return scale;
|
||
scale = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.cells = function (_) {
|
||
if (!arguments.length) return cells;
|
||
if (_.length > 1 || _ >= 2) {
|
||
cells = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.cellFilter = function (_) {
|
||
if (!arguments.length) return cellFilter;
|
||
cellFilter = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.shapePadding = function (_) {
|
||
if (!arguments.length) return shapePadding;
|
||
shapePadding = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.labels = function (_) {
|
||
if (!arguments.length) return labels;
|
||
labels = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelAlign = function (_) {
|
||
if (!arguments.length) return labelAlign;
|
||
if (_ == "start" || _ == "end" || _ == "middle") {
|
||
labelAlign = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.locale = function (_) {
|
||
if (!arguments.length) return locale;
|
||
locale = (0, _d3Format.formatLocale)(_);
|
||
return legend;
|
||
};
|
||
|
||
legend.labelFormat = function (_) {
|
||
if (!arguments.length) return legend.locale().format(specifier);
|
||
specifier = (0, _d3Format.formatSpecifier)(_);
|
||
return legend;
|
||
};
|
||
|
||
legend.labelOffset = function (_) {
|
||
if (!arguments.length) return labelOffset;
|
||
labelOffset = +_;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelDelimiter = function (_) {
|
||
if (!arguments.length) return labelDelimiter;
|
||
labelDelimiter = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.labelWrap = function (_) {
|
||
if (!arguments.length) return labelWrap;
|
||
labelWrap = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.orient = function (_) {
|
||
if (!arguments.length) return orient;
|
||
_ = _.toLowerCase();
|
||
if (_ == "horizontal" || _ == "vertical") {
|
||
orient = _;
|
||
}
|
||
return legend;
|
||
};
|
||
|
||
legend.ascending = function (_) {
|
||
if (!arguments.length) return ascending;
|
||
ascending = !!_;
|
||
return legend;
|
||
};
|
||
|
||
legend.classPrefix = function (_) {
|
||
if (!arguments.length) return classPrefix;
|
||
classPrefix = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.title = function (_) {
|
||
if (!arguments.length) return title;
|
||
title = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.titleWidth = function (_) {
|
||
if (!arguments.length) return titleWidth;
|
||
titleWidth = _;
|
||
return legend;
|
||
};
|
||
|
||
legend.on = function () {
|
||
var value = legendDispatcher.on.apply(legendDispatcher, arguments);
|
||
return value === legendDispatcher ? legend : value;
|
||
};
|
||
|
||
return legend;
|
||
}
|
||
|
||
},{"./legend":13,"d3-array":1,"d3-dispatch":4,"d3-format":5,"d3-scale":7}],16:[function(require,module,exports){
|
||
'use strict';
|
||
|
||
var _color = require('./color');
|
||
|
||
var _color2 = _interopRequireDefault(_color);
|
||
|
||
var _size = require('./size');
|
||
|
||
var _size2 = _interopRequireDefault(_size);
|
||
|
||
var _symbol = require('./symbol');
|
||
|
||
var _symbol2 = _interopRequireDefault(_symbol);
|
||
|
||
var _helpers = require('./helpers');
|
||
|
||
var _helpers2 = _interopRequireDefault(_helpers);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
d3.legendColor = _color2.default;
|
||
d3.legendSize = _size2.default;
|
||
d3.legendSymbol = _symbol2.default;
|
||
d3.legendHelpers = _helpers2.default;
|
||
|
||
},{"./color":11,"./helpers":12,"./size":14,"./symbol":15}]},{},[16])
|
||
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZDMtYXJyYXkvYnVpbGQvZDMtYXJyYXkuanMiLCJub2RlX21vZHVsZXMvZDMtY29sbGVjdGlvbi9idWlsZC9kMy1jb2xsZWN0aW9uLmpzIiwibm9kZV9tb2R1bGVzL2QzLWNvbG9yL2J1aWxkL2QzLWNvbG9yLmpzIiwibm9kZV9tb2R1bGVzL2QzLWRpc3BhdGNoL2J1aWxkL2QzLWRpc3BhdGNoLmpzIiwibm9kZV9tb2R1bGVzL2QzLWZvcm1hdC9idWlsZC9kMy1mb3JtYXQuanMiLCJub2RlX21vZHVsZXMvZDMtaW50ZXJwb2xhdGUvYnVpbGQvZDMtaW50ZXJwb2xhdGUuanMiLCJub2RlX21vZHVsZXMvZDMtc2NhbGUvYnVpbGQvZDMtc2NhbGUuanMiLCJub2RlX21vZHVsZXMvZDMtc2VsZWN0aW9uL2J1aWxkL2QzLXNlbGVjdGlvbi5qcyIsIm5vZGVfbW9kdWxlcy9kMy10aW1lLWZvcm1hdC9idWlsZC9kMy10aW1lLWZvcm1hdC5qcyIsIm5vZGVfbW9kdWxlcy9kMy10aW1lL2J1aWxkL2QzLXRpbWUuanMiLCJzcmMvY29sb3IuanMiLCJzcmMvaGVscGVycy5qcyIsInNyYy9sZWdlbmQuanMiLCJzcmMvc2l6ZS5qcyIsInNyYy9zeW1ib2wuanMiLCJzcmMvd2ViLmpzIl0sIm5hbWVzIjpbXSwib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KyBkeSAqIGR5LFxuICAgICAgaSxcbiAgICAgIFM7XG5cbiAgLy8gU3BlY2lhbCBjYXNlIGZvciB1MCDiiYUgdTEuXG4gIGlmIChkMiA8IGVwc2lsb24yKSB7XG4gICAgUyA9IE1hdGgubG9nKHcxIC8gdzApIC8gcmhvO1xuICAgIGkgPSBmdW5jdGlvbih0KSB7XG4gICAgICByZXR1cm4gW1xuICAgICAgICB1eDAgKyB0ICogZHgsXG4gICAgICAgIHV5MCArIHQgKiBkeSxcbiAgICAgICAgdzAgKiBNYXRoLmV4cChyaG8gKiB0ICogUylcbiAgICAgIF07XG4gICAgfTtcbiAgfVxuXG4gIC8vIEdlbmVyYWwgY2FzZS5cbiAgZWxzZSB7XG4gICAgdmFyIGQxID0gTWF0aC5zcXJ0KGQyKSxcbiAgICAgICAgYjAgPSAodzEgKiB3MSAtIHcwICogdzAgKyByaG80ICogZDIpIC8gKDIgKiB3MCAqIHJobzIgKiBkMSksXG4gICAgICAgIGIxID0gKHcxICogdzEgLSB3MCAqIHcwIC0gcmhvNCAqIGQyKSAvICgyICogdzEgKiByaG8yICogZDEpLFxuICAgICAgICByMCA9IE1hdGgubG9nKE1hdGguc3FydChiMCAqIGIwICsgMSkgLSBiMCksXG4gICAgICAgIHIxID0gTWF0aC5sb2coTWF0aC5zcXJ0KGIxICogYjEgKyAxKSAtIGIxKTtcbiAgICBTID0gKHIxIC0gcjApIC8gcmhvO1xuICAgIGkgPSBmdW5jdGlvbih0KSB7XG4gICAgICB2YXIgcyA9IHQgKiBTLFxuICAgICAgICAgIGNvc2hyMCA9IGNvc2gocjApLFxuICAgICAgICAgIHUgPSB3MCAvIChyaG8yICogZDEpICogKGNvc2hyMCAqIHRhbmgocmhvICogcyArIHIwKSAtIHNpbmgocjApKTtcbiAgICAgIHJldHVybiBbXG4gICAgICAgIHV4MCArIHUgKiBkeCxcbiAgICAgICAgdXkwICsgdSAqIGR5LFxuICAgICAgICB3MCAqIGNvc2hyMCAvIGNvc2gocmhvIC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Xk7XG4gICAgICB3aGlsZSAoKytpIDwgbikgaWYgKCFpbmRleC5oYXMoa2V5ID0gKGQgPSBfW2ldKSArIFwiXCIpKSBpbmRleC5zZXQoa2V5LCBkb21haW4ucHVzaChkKSk7XG4gICAgICByZXR1cm4gc2NhbGU7XG4gICAgfTtcblxuICAgIHNjYWxlLnJhbmdlID0gZnVuY3Rpb24oXykge1xuICAgICAgcmV0dXJuIGFyZ3VtZW50cy5sZW5ndGggPyAocmFuZ2UgPSBzbGljZS5jYWxsKF8pLCBzY2FsZSkgOiByYW5nZS5zbGljZSgpO1xuICAgIH07XG5cbiAgICBzY2FsZS51bmtub3duID0gZnVuY3Rpb24oXykge1xuICAgICAgcmV0dXJuIGFyZ3VtZW50cy5sZW5ndGggPyAodW5rbm93biA9IF8sIHNjYWxlKSA6IHVua25vd247XG4gICAgfTtcblxuICAgIHNjYWxlLmNvcHkgPSBmdW5jdGlvbigpIHtcbiAgICAgIHJldHVybiBvcmRpbmFsKClcbiAgICAgICAgICAuZG9tYWluKGRvbWFpbilcbiAgICAgICAgICAucmFuZ2UocmFuZ2UpXG4gICAgICAgICAgLnVua25vd24odW5rbm93bik7XG4gICAgfTtcblxuICAgIHJldHVybiBzY2FsZTtcbiAgfVxuXG4gIGZ1bmN0aW9uIGJhbmQoKSB7XG4gICAgdmFyIHNjYWxlID0gb3JkaW5hbCgpLnVua25vd24odW5kZWZpbmVkKSxcbiAgICAgICAgZG9tYWluID0gc2NhbGUuZG9tYWluLFxuICAgICAgICBvcmRpbmFsUmFuZ2UgPSBzY2FsZS5yYW5nZSxcbiAgICAgICAgcmFuZ2UgPSBbMCwgMV0sXG4gICAgICAgIHN0ZXAsXG4gICAgICAgIGJhbmR3aWR0aCxcbiAgICAgICAgcm91bmQgPSBmYWxzZSxcbiAgICAgICAgcGFkZGluZ0lubmVyID0gMCxcbiAgICAgICAgcGFkZGluZ091dGVyID0gMCxcbiAgICAgICAgYWxpZ24gPSAwLjU7XG5cbiAgICBkZWxldGU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9IGk7XG5cbiAgICAgIHZhciBpID0gbG9ncyh1KSxcbiAgICAgICAgICBqID0gbG9ncyh2KSxcbiAgICAgICAgICBwLFxuICAgICAgICAgIGssXG4gICAgICAgICAgdCxcbiAgICAgICAgICBuID0gY291bnQgPT0gbnVsbCA/IDEwIDogK2NvdW50LFxuICAgICAgICAgIHogPSBbXTtcblxuICAgICAgaWYgKCEoYmFzZSAlIDEpICYmIGogLSBpIDwgbikge1xuICAgICAgICBpID0gTWF0aC5yb3VuZChpKSAtIDEsIGogPSBNYXRoLnJvdW5kKGopICsgMTtcbiAgICAgICAgaWYgKHUgPiAwKSBmb3IgKDsgaSA8IGo7ICsraSkge1xuICAgICAgICAgIGZvciAoayA9IDEsIHAgPSBwb3dzKGkpOyBrIDwgYmFzZTsgKytrKSB7XG4gICAgICAgICAgICB0ID0gcCAqIGs7XG4gICAgICAgICAgICBpZiAodCA8IHUpIGNvbnRpbnVlO1xuICAgICAgICAgICAgaWYgKHQgPiB2KSBicmVhaztcbiAgICAgICAgICAgIHoucHVzaCh0KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBmb3IgKDsgaSA8IGo7ICsraSkge1xuICAgICAgICAgIGZvciAoayA9IGJhc2UgLSAxLCBwID0gcG93cyhpKTsgayA+PSAxOyAtLWspIHtcbiAgICAgICAgICAgIHQgPSBwICogaztcbiAgICAgICAgICAgIGlmICh0IDwgdSkgY29udGludWU7XG4gICAgICAgICAgICBpZiAodCA+IHYpIGJyZWFrO1xuICAgICAgICAgICAgei5wdXNoKHQpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgeiA9IGQzQXJyYXkudGlja3MoaSwgaiwgTWF0aC5taW4oaiAtIGksIG4pKS5tYXAocG93cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiByID8gei5yZXZlcnNlKCkgOiB6O1xuICAgIH07XG5cbiAgICBzY2FsZS50aWNrRm9ybWF0ID0gZnVuY3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Ib3VyID0gZm9ybWF0KFwiJUkgJXBcIiksXG4gICAgICAgIGZvcm1hdERheSA9IGZvcm1hdChcIiVhICVkXCIpLFxuICAgICAgICBmb3JtYXRXZWVrID0gZm9ybWF0KFwiJWIgJWRcIiksXG4gICAgICAgIGZvcm1hdE1vbnRoID0gZm9ybWF0KFwiJUJcIiksXG4gICAgICAgIGZvcm1hdFllYXIgPSBmb3JtYXQoXCIlWVwiKTtcblxuICAgIHZhciB0aWNrSW50ZXJ2YWxzID0gW1xuICAgICAgW3NlY29uZCwgIDEsICAgICAgZHVyYXRpb25TZWNvbmRdLFxuICAgICAgW3NlY29uZCwgIDUsICA1ICogZHVyYXRpb25TZWNvbmRdLFxuICAgICAgW3NlY29uZCwgMTUsIDE1ICogZHVyYXRpb25TZWNvbmRdLFxuICAgICAgW3NlY29uZCwgMzAsIDMwICogZHVyYXRpb25TZWNvbmRdLFxuICAgICAgW21pbnV0ZSwgIDEsICAgICAgZHVyYXRpb25NaW51dGVdLFxuICAgICAgW21pbnV0ZSwgIDUsICA1ICogZHVyYXRpb25NaW51dGVdLFxuICAgICAgW21pbnV0ZSwgMTUsIDE1ICogZHVyYXRpb25NaW51dGVdLFxuICAgICAgW21pbnV0ZSwgMzAsIDMwICogZHVyYXRpb25NaW51dGVdLFxuICAgICAgWyAgaG91ciwgIDEsICAgICAgZHVyYXRpb25Ib3VyICBdLFxuICAgICAgWyAgaG91ciwgIDMsICAzICogZHVyYXRpb25Ib3VyICBdLFxuICAgICAgWyAgaG91ciwgIDYsICA2ICogZHVyYXRpb25Ib3VyICBdLFxuICAgICAgWyAgaG91ciwgMTIsIDEyICogZHVyYXRpb25Ib3VyICBdLFxuICAgICAgWyAgIGRheSwgIDEsICAgICAgZHVyYXRpb25EYXkgICBdLFxuICAgICAgWyAgIGRheSwgIDIsICAyICogZHVyYXRpb25EYXkgICBdLFxuICAgICAgWyAgd2VlaywgIDEsICAgICAgZHVyYXRpb25XZWVrICBdLFxuICAgICAgWyBtb250aCw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