Better nicing for pow scales.
This commit is contained in:
Родитель
9bf55832ea
Коммит
1dfcda4888
|
@ -1,4 +1,4 @@
|
|||
(function(){d3 = {version: "1.20.1"}; // semver
|
||||
(function(){d3 = {version: "1.20.2"}; // semver
|
||||
if (!Date.now) Date.now = function() {
|
||||
return +new Date;
|
||||
};
|
||||
|
@ -2245,7 +2245,7 @@ d3.scale.linear = function() {
|
|||
};
|
||||
|
||||
function d3_scale_linearNice(dx) {
|
||||
dx = Math.pow(10, Math.round(Math.log(dx) / Math.log(10)) - 1);
|
||||
dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
|
||||
return {
|
||||
floor: function(x) { return Math.floor(x / dx) * dx; },
|
||||
ceil: function(x) { return Math.ceil(x / dx) * dx; },
|
||||
|
@ -2382,7 +2382,7 @@ d3.scale.pow = function() {
|
|||
scale.tickFormat = tick.tickFormat;
|
||||
|
||||
scale.nice = function() {
|
||||
return scale.domain(d3_scale_nice(scale.domain(), d3_scale_niceDefault));
|
||||
return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
|
||||
};
|
||||
|
||||
scale.exponent = function(x) {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1 +1 @@
|
|||
d3 = {version: "1.20.1"}; // semver
|
||||
d3 = {version: "1.20.2"}; // semver
|
||||
|
|
|
@ -91,7 +91,7 @@ d3.scale.linear = function() {
|
|||
};
|
||||
|
||||
function d3_scale_linearNice(dx) {
|
||||
dx = Math.pow(10, Math.round(Math.log(dx) / Math.log(10)) - 1);
|
||||
dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
|
||||
return {
|
||||
floor: function(x) { return Math.floor(x / dx) * dx; },
|
||||
ceil: function(x) { return Math.ceil(x / dx) * dx; },
|
||||
|
|
|
@ -31,7 +31,7 @@ d3.scale.pow = function() {
|
|||
scale.tickFormat = tick.tickFormat;
|
||||
|
||||
scale.nice = function() {
|
||||
return scale.domain(d3_scale_nice(scale.domain(), d3_scale_niceDefault));
|
||||
return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
|
||||
};
|
||||
|
||||
scale.exponent = function(x) {
|
||||
|
|
|
@ -43,7 +43,7 @@ nice():
|
|||
[ 1.100, 10.900 ] -> 1.000, 11.000
|
||||
[ 10.900, 1.100 ] -> 11.000, 1.000
|
||||
[ 0.700, 11.001 ] -> 0.000, 12.000
|
||||
[ 123.100, 6.700 ] -> 124.000, 6.000
|
||||
[ 0.000, 0.490 ] -> 0.000, 1.000
|
||||
[ 123.100, 6.700 ] -> 130.000, 0.000
|
||||
[ 0.000, 0.490 ] -> 0.000, 0.500
|
||||
[ 0.100, 1.000, 2.500, 3.000, 10.900 ] -> 0.000, 1.000, 2.500, 3.000, 11.000
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче