There are several ways to achieve what you want, but I believe the solution below is both simple and efficient.
I'll start with an example that is similar to yours, and also does not have any hyperlinks:
link to jsfiddle - starting point,
and will walk you through all necessary but simple modifications.
First, let's add field "url" for nodes that we want to have labels as hyperlinks:
{
"children": [{
"name": "AgglomerativeCluster",
"size": 3938,
"url": "http://www.example.com/"
}, {
"name": "CommunityStructure",
"size": 3812,
"url": "http://www.example.com/"
}, {
"name": "HierarchicalCluster",
"size": 6714,
"url": "http://www.example.com/"
}, {
"name": "MergeEdge",
"size": 743,
"url": "http://www.example.com/"
}
Now, let's write code that selects all labels whose node data contain anything in field "url", and for each such label adds appropriate clock handler that will open correspondent url: (it also sets different cursor pointer for mouseovers so that user knows the label is actually a hyperlink)
d3.selectAll(".node text")
.filter(function(d){ return d.url; })
.style("cursor", "pointer")
.on("click", function(d){
document.location.href = d.url;
});
That's it!
link to jsfiddle - finished example