.attr('x', d => { return xScale(d['date']); }).attr('y', d => { return yVolumeScale(d['volume']); }) The first attr() method defines the x-coordinate.
svg.selectAll().data(volData).enter().append('rect').attr('x', d => { return xScale(d['date']); }).attr('y', d => { return yVolumeScale(d['volume']); }).attr('fill', (d, i) => { if (i === 0) { return '#03a678'; } else { return volData[i - 1].close > d.close?