score:1

Accepted answer

I'm not sure what you mean by rotating the bars to columns, but all you have to do to achieve what you want is to add another set of text elements using the existing selection:

bar.append("text")
  .attr("x", 0)
  .attr("y", barHeight / 2)
  .attr("dy", ".35em")
  .attr("dx", "-1em")
  .style("fill", "black")
  .text(function(d) { return d.name; });

Complete example here. I've also shifted the bars to allow space for the new labels.


Related Query

More Query from same tag