d3/d3-force

New data at .data() makes svg to redraw instead of updating nodes position

mjmlopes opened this issue · 1 comments

Considering this working example https://bl.ocks.org/colbenkharrl/21b3808492b93a21de841bc5ceac4e47, the data update makes the svg update without being re-drawn.

However, if the node and links data reference is new, even if the contents are the same, the svg is re-drawn on every update.

Here https://jsfiddle.net/nx9wctdk/ , inside the function update(), the call update_local() will make the graph working as expected. The call update_http() will make the graph to be re-drawn.

Tested with D3 v4.13.0 and D3 v6.3.1 in Firefox 78.6.0esr and Chrome 86.0.4240.111. No errors are thrown on dev tools.

Thanks.

Please use Stack Overflow tag d3.js to ask for help. Stack Overflow provides a better collaborative forum: thousands of D3-related questions have been asked there, and some answers may be relevant to you.

When asking for help, please include a link to demonstrate the issue, preferably as an Observable notebook. It is often impossible to debug from code snippets alone. Isolate the issue and reduce your code as much as possible before asking for help. The less code you post, the easier it is for someone to debug, and the more likely you are to get a helpful response.

If you have a question about D3’s behavior and want to discuss it with other users, also consider the d3-js Google Group or joining the d3-js Slack.

Thank you! 🤗