score:1

Accepted answer

You can use the y attribute to position vertically your text. Your code is a bit hard to test because we don't have access to your json, so blindly the code for the text part would be :

node.append("text")
    .text(function(d) {return d.children ? "" : d.name ;})
    .attr("text-anchor", "middle")
    .attr("class", "nodetext")
    .attr("data-classname", function(d) {return d.className;})
    .attr("style", function(d) {return "font-size:" + d.r/4;})
    .on("click", function(d) { window.open("https://twitter.com/hashtag/" + d.name.trim() + "\?src=hash"); })
    .on("mouseover", function(d) {
          d3.select(this).attr("r", 10).style("fill", "#2f4cff");
          d3.select(this).style("cursor", "pointer"); 

        })                  
    .on("mouseout", function(d) {
      d3.select(this).attr("r", 5.5).style("fill", "#000");
    });

node.append("text")
    .text(function(d) {return d.children ? "" : d.value ;})
    .attr("text-anchor", "middle")
    .attr("class", "nodevalue")
    .attr("y", 15) // adding y attribute to offset vertically your text
    .attr("data-classname", function(d) {return d.className;})
    .attr("style", function(d) {return "font-size:" + d.r/4;});

Related Query

More Query from same tag