kopia lustrzana https://github.com/robhawkes/vizicities
Updated D3
rodzic
49dd02b694
commit
6d54c1601b
|
@ -1,6 +1,6 @@
|
|||
d3 = function() {
|
||||
var d3 = {
|
||||
version: "3.3.9"
|
||||
version: "3.3.13"
|
||||
};
|
||||
if (!Date.now) Date.now = function() {
|
||||
return +new Date();
|
||||
|
@ -607,7 +607,7 @@ d3 = function() {
|
|||
d3_selectionPrototype.classed = function(name, value) {
|
||||
if (arguments.length < 2) {
|
||||
if (typeof name === "string") {
|
||||
var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
|
||||
var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1;
|
||||
if (value = node.classList) {
|
||||
while (++i < n) if (!value.contains(name[i])) return false;
|
||||
} else {
|
||||
|
@ -624,8 +624,11 @@ d3 = function() {
|
|||
function d3_selection_classedRe(name) {
|
||||
return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
|
||||
}
|
||||
function d3_selection_classes(name) {
|
||||
return name.trim().split(/^|\s+/);
|
||||
}
|
||||
function d3_selection_classed(name, value) {
|
||||
name = name.trim().split(/\s+/).map(d3_selection_classedName);
|
||||
name = d3_selection_classes(name).map(d3_selection_classedName);
|
||||
var n = name.length;
|
||||
function classedConstant() {
|
||||
var i = -1;
|
||||
|
@ -840,7 +843,7 @@ d3 = function() {
|
|||
subgroups.push(subgroup = []);
|
||||
subgroup.parentNode = (group = this[j]).parentNode;
|
||||
for (var i = 0, n = group.length; i < n; i++) {
|
||||
if ((node = group[i]) && filter.call(node, node.__data__, i)) {
|
||||
if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
|
||||
subgroup.push(node);
|
||||
}
|
||||
}
|
||||
|
@ -1937,11 +1940,11 @@ d3 = function() {
|
|||
var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
|
||||
function dsv(url, row, callback) {
|
||||
if (arguments.length < 3) callback = row, row = null;
|
||||
var xhr = d3.xhr(url, mimeType, callback);
|
||||
var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);
|
||||
xhr.row = function(_) {
|
||||
return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;
|
||||
};
|
||||
return xhr.row(row);
|
||||
return xhr;
|
||||
}
|
||||
function response(request) {
|
||||
return dsv.parse(request.responseText);
|
||||
|
@ -3574,7 +3577,7 @@ d3 = function() {
|
|||
function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
|
||||
var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
|
||||
if (d2 > 4 * δ2 && depth--) {
|
||||
var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
|
||||
var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
|
||||
if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
|
||||
resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
|
||||
stream.point(x2, y2);
|
||||
|
@ -4166,14 +4169,21 @@ d3 = function() {
|
|||
return d3_geo_projection(d3_geo_stereographic);
|
||||
}).raw = d3_geo_stereographic;
|
||||
function d3_geo_transverseMercator(λ, φ) {
|
||||
var B = Math.cos(φ) * Math.sin(λ);
|
||||
return [ Math.log((1 + B) / (1 - B)) / 2, Math.atan2(Math.tan(φ), Math.cos(λ)) ];
|
||||
return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ];
|
||||
}
|
||||
d3_geo_transverseMercator.invert = function(x, y) {
|
||||
return [ Math.atan2(d3_sinh(x), Math.cos(y)), d3_asin(Math.sin(y) / d3_cosh(x)) ];
|
||||
return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ];
|
||||
};
|
||||
(d3.geo.transverseMercator = function() {
|
||||
return d3_geo_mercatorProjection(d3_geo_transverseMercator);
|
||||
var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate;
|
||||
projection.center = function(_) {
|
||||
return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ -_[1], _[0] ]);
|
||||
};
|
||||
projection.rotate = function(_) {
|
||||
return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(),
|
||||
[ _[0], _[1], _[2] - 90 ]);
|
||||
};
|
||||
return projection.rotate([ 0, 0 ]);
|
||||
}).raw = d3_geo_transverseMercator;
|
||||
d3.geom = {};
|
||||
function d3_geom_pointX(d) {
|
||||
|
@ -6847,10 +6857,16 @@ d3 = function() {
|
|||
return Math.exp(random());
|
||||
};
|
||||
},
|
||||
bates: function(m) {
|
||||
var random = d3.random.irwinHall(m);
|
||||
return function() {
|
||||
return random() / m;
|
||||
};
|
||||
},
|
||||
irwinHall: function(m) {
|
||||
return function() {
|
||||
for (var s = 0, j = 0; j < m; j++) s += Math.random();
|
||||
return s / m;
|
||||
return s;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -7946,7 +7962,7 @@ d3 = function() {
|
|||
for (var j = 0, m = this.length; j < m; j++) {
|
||||
subgroups.push(subgroup = []);
|
||||
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
|
||||
if ((node = group[i]) && filter.call(node, node.__data__, i)) {
|
||||
if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
|
||||
subgroup.push(node);
|
||||
}
|
||||
}
|
||||
|
@ -8236,16 +8252,17 @@ d3 = function() {
|
|||
}
|
||||
}
|
||||
if (scale1.rangeBand) {
|
||||
var dx = scale1.rangeBand() / 2, x = function(d) {
|
||||
return scale1(d) + dx;
|
||||
var x = scale1, dx = x.rangeBand() / 2;
|
||||
scale0 = scale1 = function(d) {
|
||||
return x(d) + dx;
|
||||
};
|
||||
tickEnter.call(tickTransform, x);
|
||||
tickUpdate.call(tickTransform, x);
|
||||
} else if (scale0.rangeBand) {
|
||||
scale0 = scale1;
|
||||
} else {
|
||||
tickEnter.call(tickTransform, scale0);
|
||||
tickUpdate.call(tickTransform, scale1);
|
||||
tickExit.call(tickTransform, scale1);
|
||||
}
|
||||
tickEnter.call(tickTransform, scale0);
|
||||
tickUpdate.call(tickTransform, scale1);
|
||||
});
|
||||
}
|
||||
axis.scale = function(x) {
|
||||
|
@ -9225,7 +9242,9 @@ d3 = function() {
|
|||
var d3_time_scaleMilliseconds = {
|
||||
range: function(start, stop, step) {
|
||||
return d3.range(+start, +stop, step).map(d3_time_scaleDate);
|
||||
}
|
||||
},
|
||||
floor: d3_identity,
|
||||
ceil: d3_identity
|
||||
};
|
||||
var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
|
||||
return [ m[0].utc, m[1] ];
|
||||
|
|
Ładowanie…
Reference in New Issue