source:
Dev/trunk/d3/src/scale/nice.js
@
140
Last change on this file since 140 was 76, checked in by fpvanagthoven, 14 years ago | |
---|---|
File size: 380 bytes |
Rev | Line | |
---|---|---|
[76] | 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 | nice = nice(x1 - x0); | |
14 | domain[i0] = nice.floor(x0); | |
15 | domain[i1] = nice.ceil(x1); | |
16 | return domain; | |
17 | } | |
18 | ||
19 | function d3_scale_niceDefault() { | |
20 | return Math; | |
21 | } |
Note: See TracBrowser
for help on using the repository browser.