uber / react-digraph

A library for creating directed graph editors
MIT License
2.62k stars 269 forks source link

How can we add custom text over the node tooltip? #264

Open Malikx-Alee opened 4 years ago

Malikx-Alee commented 4 years ago

Currently the node does not show handleToolTipText like edges.

Below is the code for edges but it does not work for nodes:

edges:[
{
      type: "Dependence",
      source: "Exposition",
      target: "Exposed",
      handleTooltipText:
        "Dependence - Drag and Drop to Another Node to Reconnect",
    }
]
yatingupta10 commented 3 years ago

+1

ajbogh commented 3 years ago

You can override node rendering with the renderNode function and return your own SVG component with the tooltip. Overriding the node rendering allows you to do so much more with the nodes that is not possible with the default nodes.

Edges are different. We needed the handleTooltipText (provided by a contributor) because react-digraph has to render the edges itself. We do provide an afterRenderEdge function to help modify those edges, but we don't provide a renderEdge function.