Commit 78ce531f authored by Mike Bostock's avatar Mike Bostock

Back-port d3/d3-scale#9 fix.

parent e7652fc1
......@@ -10,7 +10,7 @@
"animation",
"canvas"
],
"version": "3.5.11",
"version": "3.5.12",
"main": "d3.js",
"scripts": [
"d3.js"
......
!function() {
var d3 = {
version: "3.5.11"
version: "3.5.12"
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
......@@ -7565,7 +7565,9 @@
return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
}
function d3_scale_linearNice(domain, m) {
return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
return domain;
}
function d3_scale_linearTickRange(domain, m) {
if (m == null) m = 10;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@
Package.describe({
name: "d3js:d3", // http://atmospherejs.com/d3js/d3
summary: "D3 (official): A JavaScript visualization library for HTML and SVG.",
version: "3.5.11",
version: "3.5.12",
git: "https://github.com/mbostock/d3.git"
});
......
{
"name": "d3",
"version": "3.5.11",
"version": "3.5.12",
"description": "A JavaScript visualization library for HTML and SVG.",
"keywords": [
"dom",
......
......@@ -88,7 +88,9 @@ function d3_scale_linearRebind(scale, linear) {
}
function d3_scale_linearNice(domain, m) {
return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
return domain;
}
function d3_scale_linearTickRange(domain, m) {
......
!function(){
var d3 = {version: "3.5.11"}; // semver
var d3 = {version: "3.5.12"}; // semver
......@@ -255,6 +255,8 @@ suite.addBatch({
assert.deepEqual(x.domain(), [130, 0]);
var x = d3.scale.linear().domain([0, 0.49]).nice();
assert.deepEqual(x.domain(), [0, 0.5]);
var x = d3.scale.linear().domain([-0.1, 51.1]).nice(8);
assert.deepEqual(x.domain(), [-10, 60]);
},
"has no effect on degenerate domains": function(d3) {
var x = d3.scale.linear().domain([0, 0]).nice();
......@@ -266,7 +268,7 @@ suite.addBatch({
var x = d3.scale.linear().domain([1.1, 1, 2, 3, 10.9]).nice();
assert.deepEqual(x.domain(), [1, 1, 2, 3, 11]);
var x = d3.scale.linear().domain([123.1, 1, 2, 3, -0.9]).nice();
assert.deepEqual(x.domain(), [130, 1, 2, 3, -10]);
assert.deepEqual(x.domain(), [140, 1, 2, 3, -20]);
},
"accepts a tick count to control nicing step": function(d3) {
var x = d3.scale.linear().domain([12, 87]).nice(5);
......
......@@ -202,7 +202,7 @@ suite.addBatch({
var x = d3.scale.pow().domain([1.1, 1, 2, 3, 10.9]).nice();
assert.deepEqual(x.domain(), [1, 1, 2, 3, 11]);
var x = d3.scale.pow().domain([123.1, 1, 2, 3, -0.9]).nice();
assert.deepEqual(x.domain(), [130, 1, 2, 3, -10]);
assert.deepEqual(x.domain(), [140, 1, 2, 3, -20]);
},
"accepts a tick count to control nicing step": function(d3) {
var x = d3.scale.pow().domain([12, 87]).nice(5);
......
......@@ -199,7 +199,7 @@ suite.addBatch({
var x = d3.scale.sqrt().domain([1.1, 1, 2, 3, 10.9]).nice(), f = d3.format(".6f");
assert.deepEqual(x.domain().map(f), [1, 1, 2, 3, 11]);
var x = d3.scale.sqrt().domain([123.1, 1, 2, 3, -0.9]).nice();
assert.deepEqual(x.domain().map(f), [130, 1, 2, 3, "-10.000000"]);
assert.deepEqual(x.domain().map(f), [140, 1, 2, 3, -20]);
},
"preserves specified domain exactly, with no floating point error": function(d3) {
var x = d3.scale.sqrt().domain([0, 5]).nice();
......
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