d3-scale icon indicating copy to clipboard operation
d3-scale copied to clipboard

The default tickFormat with a collapsed domain lacks sufficient precision

Open Fil opened this issue 1 year ago • 2 comments

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)

Fil avatar Jun 17 '24 12:06 Fil

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?)

IspolatovDenis avatar Apr 16 '25 09:04 IspolatovDenis

Thanks. Did you test #287?

Fil avatar Apr 16 '25 11:04 Fil