Skip to main content

Ivan Teoh

Something personal yet public

176-step4.js

(Source)

1
2
3
4
5
6
function reDomain(maxValue) {
    var dy = Math.pow(10, Math.round(Math.log(maxValue) / Math.log(10)) - 1);
    return Math.ceil(maxValue / dy) * dy;
}

var newCeilY = reDomain(newMaxY);