1
d3.range([start, ]stop[, step])

Returns an array containing an arithmetic progression, similar to the Python built-in range. This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale.

If step is ommitted, it defaults to 1. If start ommitted, it defaults to 0. The stop value is exclusive; it is not included in the result.

The arguments are not required to be integers; however, the results are more predicable if they are.

1
2
d3.range(0, 1, 1/49) // BAD, and returns 50 elements
d3.range(49).map(d => (d/49)) // GOOD, and returns 49 elements