student student - 7 months ago 23
CSS Question

Chart bars not aligning with x axis values in d3.js

Trying to learn and implement d3.js for the first time.

In the fiddle, we needed to reduce the width of each bar from

line 46


.attr('width', '10')
line 50

When doing so, the horizontal x axis labels are getting dis-aligned with vertical bars which is not needed.

Tried to see a few solutions:

Any suggestions, kind folks?


Try this code:

.rangeBands([0, width], someValue)