Accepted answer

The problem you're having is that your current code is appending <text> to a <circle>, which won't show up. Instead, you need to create a group <g> for each node that contains both the <circle> and the <text>. Try this:

var nodes = svg.selectAll("g")

    .attr("r", 10)
    .style("fill", function (d, i) { return colors(i); })

    .attr("x", 12)
    .attr("dy", ".35em")
    .text(function (d) { return; });

Updated JSFiddle here.

Related Query

More Query from same tag