Fix new d3.round implementation.
The second argument, n, is optional.
This commit is contained in:
Родитель
42352b259d
Коммит
cc5de6d7d1
|
@ -418,8 +418,9 @@ d3.requote = function(s) {
|
||||||
|
|
||||||
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
|
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
|
||||||
d3.round = function(x, n) {
|
d3.round = function(x, n) {
|
||||||
var ten_n = Math.pow(10, n);
|
return n
|
||||||
return Math.round(x * ten_n) / ten_n;
|
? Math.round(x * (n = Math.pow(10, n))) / n
|
||||||
|
: Math.round(x);
|
||||||
};
|
};
|
||||||
d3.xhr = function(url, mime, callback) {
|
d3.xhr = function(url, mime, callback) {
|
||||||
var req = new XMLHttpRequest;
|
var req = new XMLHttpRequest;
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,5 +1,5 @@
|
||||||
d3.round = function(x, n) {
|
d3.round = function(x, n) {
|
||||||
return n
|
return n
|
||||||
? Math.round(x * Math.pow(10, n)) * Math.pow(10, -n)
|
? Math.round(x * (n = Math.pow(10, n))) / n
|
||||||
: Math.round(x);
|
: Math.round(x);
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче