If you follow the code in the example you gave, the size of the <circle>
elements is being decided here:
node.append("circle")
.attr("r", function(d) { return d.r; })
// ...
To fix the size of circles to, say, 50
, you can do this:
node.append("circle")
.attr("r", function(d) { return 50; })
// ...
Update
This will, however, break the layout as pointed out in the comment. To fix that, one can provide the same value
to each node:
// Returns a flattened hierarchy containing all leaf nodes under the root.
function classes(root) {
var classes = [];
function recurse(name, node) {
if (node.children) node.children.forEach(function(child) { recurse(node.name, child); });
else classes.push({packageName: name, className: node.name, value: node.size});
}
recurse(null, root);
return {children: classes};
}
to:
// Returns a flattened hierarchy containing all leaf nodes under the root.
function classes(root) {
var classes = [];
function recurse(name, node) {
if (node.children) node.children.forEach(function(child) { recurse(node.name, child); });
else classes.push({packageName: name, className: node.name, value: 1});
}
recurse(null, root);
return {children: classes};
}