react-d3-graph
react-d3-graph copied to clipboard
adding staticGraph:true to graph.config makes nodes disappear
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:
Graph without staticGraph: true
:
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
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 !
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.