You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other d3 scales with continuous domain seem to happily support the first endpoint greater than the second (super handy for swapping axes around etc), but scaleQuantize didn't do what I expected.
The text was updated successfully, but these errors were encountered:
Correct—the code currently assumes that the domain is in ascending order, and the behavior is undefined if it’s not. (It uses d3.bisect internally.)
There are other scales that require ascending domains, namely d3.scaleThreshold. (d3.scaleQuantile internally computes a sorted array of quantile thresholds from an unsorted domain, so it’s likewise not possible to have a “descending” quantile scale.)
That said it seems reasonable here to support a descending quantize scale. However, I’m not sure what quantize.invertExtent should return in this case. Should it return [x0, x1] where x0 < x1 for a descending domain, or x0 > x1? My intuition is the latter, so that the order of the array returned by invertExtent is consistent with the domain. But I’m not entirely sure.
Using
https://d3js.org/d3.v4.min.js
:Other d3 scales with continuous domain seem to happily support the first endpoint greater than the second (super handy for swapping axes around etc), but
scaleQuantize
didn't do what I expected.The text was updated successfully, but these errors were encountered: