javascript - Difficulty in displaying text in Force layout ? (D3js) -


i using force layout , have problem in displaying text in layout. here screenshot :enter image description here

and code :

svg.selectall("circle")     .data(data)     .enter().append("circle")         .attr("class", "node")         .attr("fill", "blue")         .attr("r", 4.5)         .attr("dx", ".10em")         .attr("dy", ".10em")         .text(function(d){ return d.name}); 

the text there in code, not showing in browser. changed color nothing helps.

as @lars kotthoff mentioned circles don't support text(). should change code sample this:

 svg.selectall("circle")      .data(data)     .enter().append("circle")     .attr("class", "node")     .attr("fill", "blue")     .attr("r", 4.5)     .attr("cx", ".10em")     .attr("cy", ".10em");   svg.selectall("text")     .data(data)     .enter().append("text")     .attr("class", "node")     .attr("fill", "red")     .attr("dx", ".10em")     .attr("dy", ".10em")     .text(function(d){ return d.name}); 

jsfiddle code here.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -