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

Fire event to give indication of when graph is currently animating (laying out)

Open michaelbdavid opened this issue 5 years ago • 3 comments

Is your feature request related to a problem? Please describe. I'd like to be able to detect when graph is currently animating or has finished animating.

Describe the solution you'd like Could we add a onAnimate handler that would fire whenever a animating change was happening? Some type of listener that would give a status of what is happening with graph. Even a call that i could make that would give back if graph is currently animating.

Describe your use case Currently when I dynamically add nodes to my graph if any other action occurs that updates the graph state the animating layout never finishes leaving my graph with nodes that are far appart.

Describe alternatives you've considered I've tried using pause and restart simulation but that doesn't seem to help with this problem. Animating of nodes still stops when update or hover over action occurs.

michaelbdavid avatar Oct 23 '20 19:10 michaelbdavid

What do you think about tracking the nodes' position gradually (e.g., every 1 second), and once the nodes are in the same position before and after 1 second, it means the graph is no longer animating.

I would be interested in hearing other people here understand if we have a legitimate quorum that would justify building some internal mechanism (e.g., a callback) that you could hook into to understand whether the graph has finishing animating or not.

danielcaldas avatar Nov 17 '20 13:11 danielcaldas

Hey @danielcaldas, Yes this would be awesome, just any indication to allow me to know when graph is done. Another thought I had on this if we cannot add this callback is there a way to turn off animation? So graph just appears.

michaelbdavid avatar Nov 17 '20 16:11 michaelbdavid

Another thought I had on this if we cannot add this callback, is there a way to turn off animation?

Hmm.. not that I can think of at the moment. We always need to wait for the graph to layout in order to get the final result.

danielcaldas avatar Nov 18 '20 10:11 danielcaldas