I'm using D3's forced layout graph to plot the data.
When I call the update
function using setInterval
with new data, the force layout graph nodes start from a random position. How can I fix this?
I read other answers such as using dx dy
or alpha(0)
, in case of alpha(0)
it did not work but dx dy
using was successful until the data is changed and then the new node is not in same position as it is supposed to be.
My Current working fiddle: https://jsfiddle.net/mootqvs1/5/
In D3.js version 3 you have a property fixed for the node to stay at the current position. In version 4 this property is replaced with d.fx and d.fy, if they are set the node will stay at that position.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.