Tooltip template for node and links

I am looking for a way to have the same tooltips for node and links. Does sbdy knows how to do it ?


You could share the same tooltip Adornment for each of your node and link templates.


I wanted a tooltip kind of thing on links,so that on hover we can see the value. So i tried the below code but it is not working. Also the tooltips does works for node but not for link. Please let me know if it is possible to have a tooltip on link.

routing: go.Link.AvoidsNodes, // link route should avoid nodes
corner: 4, // rounded corners
toShortLength: 4,
curve: go.Link.JumpOver, // Bezier curve
this.GO(go.Shape, { toArrow: ‘Standard’, stroke: ‘#4d4d4d’}),
this.GO(go.TextBlock, { margin: 5 },
new go.Binding(“text”, “name”)),
toolTip: // define a tooltip for each node that displays the color as text
this.GO(go.Adornment, “Auto”,
this.GO(go.Shape, { fill: “#FFFFCC” }),
this.GO(go.TextBlock, { margin: 4 },
new go.Binding(“text”, “color”))
) // end of Adornment

If you are using a GraphLinksModel and if your link data objects have “color” properties, that should work.

See the Basic sample,

As per basic example, can we show tooltip on link by loading tooltip text from server.
I mean whenever we get response from server after that assign that text to tooltip an show tooltip.

If you are using an Adornment as a tooltip, then if you using Bindings in the Adornment and you call Model.set in order to modify the link data object, the visible Adornment will automatically update using the new data values. Or if the Adornment/tooltip isn’t visible at the moment, it will get new values when it is shown.

If you are using an HTML tooltip, you’ll need to update the HTML yourself.