diff -r efd9c589177a -r c0b4a8b5a012 toolkit/javascript/d3/src/scale/nice.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/javascript/d3/src/scale/nice.js Thu Apr 10 14:20:23 2014 +0200 @@ -0,0 +1,24 @@ +function d3_scale_nice(domain, nice) { + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + dx; + + if (x1 < x0) { + dx = i0; i0 = i1; i1 = dx; + dx = x0; x0 = x1; x1 = dx; + } + + if (dx = x1 - x0) { + nice = nice(dx); + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + + return domain; +} + +function d3_scale_niceDefault() { + return Math; +}