react-d3-graph icon indicating copy to clipboard operation
react-d3-graph copied to clipboard

adding staticGraph:true to graph.config makes nodes disappear

Open adisingh50 opened this issue 3 years ago • 2 comments

Describe the bug I'm trying to render a directed React D3 Graph with 47 nodes. However, I also want to harcode the x and y coordinates for each of the 47 nodes to have the exact visual display that I desire (thiswill automatically create proper links between them). The staticGraph: true property should do just this according to the official documentation. But when I add this property to my graph Config, all my nodes (which were previously rendering in random locations) just disappear. I have already hardcoded x,y coordinates for every node in the graph. When I don't include the staticGraph property, but have the x,y coordinates harcoded for each node, the nodes simply just render in random locations..

Expected behavior I would expect the x, y coordinates to completely dictate where the nodes are rendered. But when I set staticGraph: true, nothing renders at all..

Screenshots My hard coded coordinates: image

Graph without staticGraph: true: image

Graph with staticGraph: true:... just a blank screen

Environment:

  • OS: Windows
  • Browser: Chrome
  • Node version: v12.17.0
  • react-d3-graph version: ^2.6.0
  • d3 version: ^5.5.0
  • react version: ^17.0.1

adisingh50 avatar Feb 27 '21 16:02 adisingh50

Hi @adisingh50 ,

Sorry to hear that it does not work as expected.

Could you please provide a minimal sandbox reproduction starting from this one. It would help to investigate.

Thanks !

antoninklopp avatar Feb 27 '21 21:02 antoninklopp

Strange 🤔 This one works fine for me. See the GIF where I refresh the page a few times, and nodes 1, 2, and 3 appear in a fixed position every time.

demo

danielcaldas avatar Mar 18 '21 11:03 danielcaldas