d3-scale
d3-scale copied to clipboard
The default tickFormat with a collapsed domain lacks sufficient precision
d3.scaleLinear().domain([5.5, 5.5]).tickFormat(7.5)(5.5) // "6"
We don’t handle the tick step being zero well.
(originally https://github.com/observablehq/plot/issues/2076#issuecomment-2172184218)
When a zero-size domain is specified, values outside that domain are scaled to the center, which seems counterintuitive. Example:
- const scale = d3.scaleLinear().domain([10, 10]).range([0, 100])
- scale(10) // expect 50 (?)
- scale(9) // expect some less than 0 or Infinity(or -Infinity?)
- scale(11) // expect some more than 100 (or Infinity?)
Thanks. Did you test #287?