score:8

Accepted answer

The band scale is the wrong tool in this situation. The main reason is that a band scale has an associated bandwidth.

You can tweak the paddingInner and paddingOuter values of the band scale to give you the expected result. However, the easiest solution is using a point scale instead. Point scales:

...are a variant of band scales with the bandwidth fixed to zero. (emphasis mine)

So, it should be:

var yScale = d3.scalePoint()

Related Query

More Query from same tag