Merge branch 'simplify-arguments' of git://github.com/jasondavies/d3 into 3.0
Conflicts: src/core/ease.js src/core/selection-datum.js
This commit is contained in:
Коммит
9828afda19
|
@ -157,10 +157,7 @@
|
|||
function d3_ease_elastic(a, p) {
|
||||
var s;
|
||||
if (arguments.length < 2) p = .45;
|
||||
if (arguments.length < 1) {
|
||||
a = 1;
|
||||
s = p / 4;
|
||||
} else s = p / (2 * π) * Math.asin(1 / a);
|
||||
if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4;
|
||||
return function(t) {
|
||||
return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
|
||||
};
|
||||
|
@ -823,7 +820,7 @@
|
|||
};
|
||||
scale.tickFormat = function(n, format) {
|
||||
if (arguments.length < 2) format = d3_scale_logFormat;
|
||||
if (arguments.length < 1) return format;
|
||||
if (!arguments.length) return format;
|
||||
var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
|
||||
return function(d) {
|
||||
return d / pow(f(log(d) + e)) <= k ? format(d) : "";
|
||||
|
@ -4074,24 +4071,24 @@
|
|||
return this.each(d3_selection_property(name, value));
|
||||
};
|
||||
d3_selectionPrototype.text = function(value) {
|
||||
return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
|
||||
return arguments.length ? this.each(typeof value === "function" ? function() {
|
||||
var v = value.apply(this, arguments);
|
||||
this.textContent = v == null ? "" : v;
|
||||
} : value == null ? function() {
|
||||
this.textContent = "";
|
||||
} : function() {
|
||||
this.textContent = value;
|
||||
});
|
||||
}) : this.node().textContent;
|
||||
};
|
||||
d3_selectionPrototype.html = function(value) {
|
||||
return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
|
||||
return arguments.length ? this.each(typeof value === "function" ? function() {
|
||||
var v = value.apply(this, arguments);
|
||||
this.innerHTML = v == null ? "" : v;
|
||||
} : value == null ? function() {
|
||||
this.innerHTML = "";
|
||||
} : function() {
|
||||
this.innerHTML = value;
|
||||
});
|
||||
}) : this.node().innerHTML;
|
||||
};
|
||||
d3_selectionPrototype.append = function(name) {
|
||||
function append() {
|
||||
|
@ -4207,7 +4204,7 @@
|
|||
return update;
|
||||
};
|
||||
d3_selectionPrototype.datum = function(value) {
|
||||
return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
|
||||
return arguments.length ? this.property("__data__", value) : this.property("__data__");
|
||||
};
|
||||
d3_selectionPrototype.filter = function(filter) {
|
||||
var subgroups = [], subgroup, group, node;
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -84,8 +84,8 @@ function d3_ease_circle(t) {
|
|||
function d3_ease_elastic(a, p) {
|
||||
var s;
|
||||
if (arguments.length < 2) p = 0.45;
|
||||
if (arguments.length < 1) { a = 1; s = p / 4; }
|
||||
else s = p / (2 * π) * Math.asin(1 / a);
|
||||
if (arguments.length) s = p / (2 * π) * Math.asin(1 / a);
|
||||
else a = 1, s = p / 4;
|
||||
return function(t) {
|
||||
return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
d3_selectionPrototype.datum = function(value) {
|
||||
return arguments.length < 1
|
||||
? this.property("__data__")
|
||||
: this.property("__data__", value);
|
||||
return arguments.length
|
||||
? this.property("__data__", value)
|
||||
: this.property("__data__");
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
d3_selectionPrototype.html = function(value) {
|
||||
return arguments.length < 1
|
||||
? this.node().innerHTML : this.each(typeof value === "function"
|
||||
return arguments.length
|
||||
? this.each(typeof value === "function"
|
||||
? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
|
||||
? function() { this.innerHTML = ""; }
|
||||
: function() { this.innerHTML = value; });
|
||||
: function() { this.innerHTML = value; })
|
||||
: this.node().innerHTML;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
d3_selectionPrototype.text = function(value) {
|
||||
return arguments.length < 1
|
||||
? this.node().textContent : this.each(typeof value === "function"
|
||||
return arguments.length
|
||||
? this.each(typeof value === "function"
|
||||
? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
|
||||
? function() { this.textContent = ""; }
|
||||
: function() { this.textContent = value; });
|
||||
: function() { this.textContent = value; })
|
||||
: this.node().textContent;
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ function d3_scale_log(linear, log) {
|
|||
|
||||
scale.tickFormat = function(n, format) {
|
||||
if (arguments.length < 2) format = d3_scale_logFormat;
|
||||
if (arguments.length < 1) return format;
|
||||
if (!arguments.length) return format;
|
||||
var k = Math.max(.1, n / scale.ticks().length),
|
||||
f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
|
||||
e;
|
||||
|
|
Загрузка…
Ссылка в новой задаче