Fixed precision for the default log tick format.
Also add @jmarca's test case.
This commit is contained in:
Родитель
da47ae88bd
Коммит
3de298bc37
|
@ -2533,7 +2533,7 @@ function d3_scale_log(linear, log) {
|
||||||
return d3_scale_linearRebind(scale, linear);
|
return d3_scale_linearRebind(scale, linear);
|
||||||
};
|
};
|
||||||
|
|
||||||
var d3_scale_logFormat = d3.format("e");
|
var d3_scale_logFormat = d3.format(".0e");
|
||||||
|
|
||||||
function d3_scale_logp(x) {
|
function d3_scale_logp(x) {
|
||||||
return Math.log(x) / Math.LN10;
|
return Math.log(x) / Math.LN10;
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -66,7 +66,7 @@ function d3_scale_log(linear, log) {
|
||||||
return d3_scale_linearRebind(scale, linear);
|
return d3_scale_linearRebind(scale, linear);
|
||||||
};
|
};
|
||||||
|
|
||||||
var d3_scale_logFormat = d3.format("e");
|
var d3_scale_logFormat = d3.format(".0e");
|
||||||
|
|
||||||
function d3_scale_logp(x) {
|
function d3_scale_logp(x) {
|
||||||
return Math.log(x) / Math.LN10;
|
return Math.log(x) / Math.LN10;
|
||||||
|
|
|
@ -157,6 +157,11 @@ suite.addBatch({
|
||||||
"1e+1", "2e+1", "3e+1", "4e+1", "5e+1", "6e+1", "7e+1", "8e+1", "9e+1",
|
"1e+1", "2e+1", "3e+1", "4e+1", "5e+1", "6e+1", "7e+1", "8e+1", "9e+1",
|
||||||
"1e+2"
|
"1e+2"
|
||||||
]);
|
]);
|
||||||
|
var x = log().domain([0.49999, 0.006029505943610648]);
|
||||||
|
assert.deepEqual(x.ticks().map(x.tickFormat()), [
|
||||||
|
"7e-3", "8e-3", "9e-3", "1e-2", "2e-2", "3e-2", "4e-2", "5e-2",
|
||||||
|
"6e-2", "7e-2", "8e-2", "9e-2", "1e-1", "2e-1", "3e-1", "4e-1"
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
"can generate fewer ticks, if desired": function(log) {
|
"can generate fewer ticks, if desired": function(log) {
|
||||||
var x = log();
|
var x = log();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче