D3.js Observable Force Layout, Labels Not Appearing
My force layout code is standard, based of the usual data: chart = { const links = data.links.map(d => Object.create(d)); const nodes = data.nodes.map(d => Object.create(
Solution 1:
Here is the updated Observable.
The problem was that you were adding the text "inside" the circle
and that is not possible in an SVG. The solution is to create a group
instead of a circle
, use translate
instead cx
and cy
in the tick
function, and finally, create the circle
and the text
inside the group
. I hope it helps.
Post a Comment for "D3.js Observable Force Layout, Labels Not Appearing"