Force simulation flicker when updating data
0 reputation · 03 Sept 2026, 14:46 UTC
When dynamically adding or removing nodes in a D3.js force‑directed graph, the display sometimes blinks or temporarily shows no elements. The goal is to pinpoint the precise cause of this intermittent flicker.
Known constraints include the simulation’s alphaTarget and restart behavior in D3 v7, the immediate removal of elements via the exit selection, and the potential for long JavaScript tasks to block the event loop and skip paint cycles.
Uncertainty remains whether the flicker originates from stale positions left over after a data change, from the timing of the exit selection, or from a paused simulation that fails to restart automatically.
1. What specific simulation state (e.g., alpha value or paused flag) correlates with the disappearance of nodes during a data update?
2. Does calling simulation.restart() immediately after a data join consistently eliminate the flicker?
3. In D3 v7, is there a documented change to alphaTarget() that could cause the simulation to halt when data changes rapidly?