First and last thresholds are set to data extent (not explicitly stated limits)
mkfreeman opened this issue · 2 comments
mkfreeman commented
Based on the documentation, Thresholds are defined as an array of values [x0, x1, …]. Given that, I would expect the bin limits (x0
, x1
) to match the threshold arguments. However, the x0
of the first bin is set to the data minimum, and the x1
of the last bin is set to the data maximum. For example:
// expect x0:1, x1: 2, but returns x0: 1.5, x1: 1.5
d3.bin().thresholds([1, 2])([1.5]).map(d => ({x0: d.x0, x1: d.x1}))
mbostock commented
See bin.domain:
Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, and the last bin.x1 is always equal to the maximum domain value.
mkfreeman commented
Thanks for clarifying!