Commit b0c2edfa authored by Mike Bostock's avatar Mike Bostock
Browse files

Merge branch 'fix-quantile-null' into 3.4.6

parents 624f21c9 4c9f77d2
...@@ -7703,9 +7703,7 @@ ...@@ -7703,9 +7703,7 @@
} }
scale.domain = function(x) { scale.domain = function(x) {
if (!arguments.length) return domain; if (!arguments.length) return domain;
domain = x.filter(function(d) { domain = x.filter(d3_number).sort(d3_ascending);
return !isNaN(d);
}).sort(d3_ascending);
return rescale(); return rescale();
}; };
scale.range = function(x) { scale.range = function(x) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import "../arrays/ascending"; import "../arrays/ascending";
import "../arrays/bisect"; import "../arrays/bisect";
import "../arrays/quantile"; import "../arrays/quantile";
import "../math/number";
import "scale"; import "scale";
d3.scale.quantile = function() { d3.scale.quantile = function() {
...@@ -24,7 +25,7 @@ function d3_scale_quantile(domain, range) { ...@@ -24,7 +25,7 @@ function d3_scale_quantile(domain, range) {
scale.domain = function(x) { scale.domain = function(x) {
if (!arguments.length) return domain; if (!arguments.length) return domain;
domain = x.filter(function(d) { return !isNaN(d); }).sort(d3_ascending); domain = x.filter(d3_number).sort(d3_ascending);
return rescale(); return rescale();
}; };
......
...@@ -30,7 +30,7 @@ suite.addBatch({ ...@@ -30,7 +30,7 @@ suite.addBatch({
assert.deepEqual(x.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]); assert.deepEqual(x.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
}, },
"non-numeric domain values are ignored": function(quantile) { "non-numeric domain values are ignored": function(quantile) {
var x = quantile().domain([6, 3, NaN, undefined, 7, 8, 8, 13, 20, 15, 16, 10, NaN]); var x = quantile().domain([6, 3, NaN, undefined, 7, 8, 8, 13, null, 20, 15, 16, 10, NaN]);
assert.deepEqual(x.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]); assert.deepEqual(x.domain(), [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]);
}, },
"quantiles returns the inner thresholds": function(quantile) { "quantiles returns the inner thresholds": function(quantile) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment