force-graph
force-graph copied to clipboard
Change node hover label
When hovering over a node, a label is shown, i want to edit this label without changing the name value of the node, i couldn't find that on the documentation, any ideas ?
Thank you
You can use the nodeLabel
accessor method to customize the labels whichever way you want, f.e.:
.nodeLabel(node => /* your logic */)
Is there a way to return a React.Element, an DOM element, or an image ? I would like further customization on this hover label, but not sure how to go about it.
If it still needs to be a string, is there a way to format it ? Add
or a title/body style to it ?
Thanks for your great work @vasturiano ! :)
@pebubblemaps you can return an html string for basic formatting if you'd like. For Example:
.nodeLabel(node => `<b>${node.id}</b>`)