Add text label to d3 node in Force layout
<p>This is my code look like, you can also have full code on <a href="https://jsfiddle.net/ShuanWu/7pvhxfzg/" rel="noreferrer">JsFiddle</a> .
I want to have labels on every node, but I can't.
By the way, labels can be embedded in the circle in the <a href="http://i.stack.imgur.com/0IV8Y.jpg" rel="noreferrer">console</a>.</p>

<pre><code>var nodes = svg.selectAll("circle")
                    .data(dataset.nodes)
                    .enter()
                    .append("circle")
                    .attr("r", 10)
                    .style("fill", function(d, i){
                        return colors(i);
                    })
                    .call(force.drag);
    var label = nodes.append("svg:text")
                    .text(function (d) { return d.name; })
                    .style("text-anchor", "middle")
                    .style("fill", "#555")
                    .style("font-family", "Arial")
                    .style("font-size", 12);



    force.on("tick", function(){
        edges.attr("x1", function(d){ return d.source.x; })
             .attr("y1", function(d){ return d.source.y; })
             .attr("x2", function(d){ return d.target.x; })
             .attr("y2", function(d){ return d.target.y; });
        nodes.attr("cx", function(d){ return d.x; })
             .attr("cy", function(d){ return d.y; });
        label.attr("x", function(d){ return d.x; })
             .attr("y", function (d) {return d.y - 10; });


    });
</code></pre>