d3 / d3-scale

Encodings that map abstract data to visual representation.
https://d3js.org/d3-scale
ISC License
1.59k stars 286 forks source link

log.ticks and precise floats #234

Closed nejc0mins closed 3 years ago

nejc0mins commented 3 years ago

Similar to #81, except on a log scale.

const testLog = scaleLog().domain([0.15, 0.68]);
console.log(testLog.ticks());

This will output: [0.2, 0.30000000000000004, 0.4, 0.5, 0.6000000000000001]

I am using the latest version (3.2.3)

mbostock commented 3 years ago

I suspect this is only possible if the base is 10 (not in general), so it’ll probably require some special-case logic. I’m not planning on implementing this, but feel free to take a crack at it.