| changeset 47 | c0b4a8b5a012 |
| 46:efd9c589177a | 47:c0b4a8b5a012 |
|---|---|
1 function d3_scale_nice(domain, nice) { |
|
2 var i0 = 0, |
|
3 i1 = domain.length - 1, |
|
4 x0 = domain[i0], |
|
5 x1 = domain[i1], |
|
6 dx; |
|
7 |
|
8 if (x1 < x0) { |
|
9 dx = i0; i0 = i1; i1 = dx; |
|
10 dx = x0; x0 = x1; x1 = dx; |
|
11 } |
|
12 |
|
13 if (dx = x1 - x0) { |
|
14 nice = nice(dx); |
|
15 domain[i0] = nice.floor(x0); |
|
16 domain[i1] = nice.ceil(x1); |
|
17 } |
|
18 |
|
19 return domain; |
|
20 } |
|
21 |
|
22 function d3_scale_niceDefault() { |
|
23 return Math; |
|
24 } |