The x and y coordinates for svg begin in the upper left corner. You want y to start at the bottom. The code below assumes you are adding some function line by line:
svg.selectAll('rect') .data(dataset) .enter() .append('rect')
To make the stroke chart act the way you want, set the y attribute to start at the distance data[i] above the axis:
.attr('y', function(d) { return height - d; })
Then you have to make a distance, continuing the remaining data[i] along the axis.
.attr('height', function(d) { return d; })
What is it!
Jared wilber
source share