-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reheating the simulation #25
Comments
Thanks for reaching out! Using the latest version ( As for the other configuration parameters, there are exposed properties that lets you manipulate this, such as |
Hi, thanks for the update, much appreciated! I had a few more questions if you don't mind :-) With respect to the simulation, it would be nice to be able to manually control the tick function e.g. to say Furthermore, it would be handy to be able to manually- redraw - the canvas, e.g. because you've changed the color for a node. Currently I do this by using a function inside In that scenario, what would be the best way to redraw the canvas (without changing node positions etc.)? Finally, it would also be handy to be able to have direct access to the Clearly you could assign PS: I'm using your package in vue.js, which works quite well. No fancy binding, inside a component after mount I just create an instance of Anyways, thanks for you help, much appreciated! :-) |
Hi @FrissAnalytics, I'm looking into using this with vue as well, and was just wondering if you might be interested in sharing your own vue implementation for this? |
@FrissAnalytics a few answers to your questions:
You can control the dry-run ticks by doing
Changing the assignment or the behavior of
The issue with exposing the context is that you wouldn't be able to do much manipulation with it, since it is cleared at every raf tick. Anything you'd write to it would be wiped almost immediately in the following tick. This is why it's not exposed, and all the relevant draws need to happen in the As for |
@vasturiano Thanks for your comments! I'm happy to offer some bigger, more worked out examples for others, that also include vue and vuetify so others can see how your awesome package can be applied in those contexts. One nice thing of the vuetify docs is that they have a codepen for all the examples, which is especially nice if you want to play around with the code and experiment. If you want I can help in setting up a bunch of them for your package based on your existing code examples. With respect to the Especially if you don't use the edge particles and you have largely unchanging data there is little need to keep the event loop running after the simulation freezes. For instance, currently on a graph of e.g. 200 nodes, even after the simulation freezes, the It's a bit unfortunate that currently when you apply |
@FrissAnalytics good points. It's a little difficult to keep track of the variety of scenarios that the simulation could go dormant, even though there is certainly room for performance improvement. Currently the decision is to let the consumer handle that state by choosing when to call As for vue.js I would love to see a bindings repo, similar to what there is for React at react-force-graph. |
@vasturiano I think it would be really helpful to decouple the pointer interaction events from the |
@vasturiano I would also be interested in decoupling the pointer events from pause and resumeAnimation functions. Mainly I would like to render the graph only once it's done with positioning, allow the user to add nodes through click (triggering a rerender) and only ever show the result of the finished positioning and not showing the steps to reach the new position. |
@klaraseitz you can achieve this by setting |
@vasturiano great thanks! And as for the pointer events. I would like to pauseAnimations onEngineStop. Such that neither the linkCanvasObject nor the nodeCanvasObject get called after the enginestop but click/hover interactions can still be caught. (on clicking/dragging a node animations should resume) I tried |
@klaraseitz if your overall intent is to improve the graph performance by bypassing rerenders after the simulation engine has stopped, note that there's been a flag added on The option is More details about it in this issue. |
@vasturiano Oh perfect!! I saw that option but thought my current version already had that. Now that I upgraded it works really smoothly. Thanks so much, Great library! |
@vasturiano Sorry for bringing this back up but I am running into a refresh issue with the graph. |
Hi, |
@pebubblemaps don't know if I understand your question completely, but you can just fix nodes into place by setting a For instance, after a given number of ticks, when the layout engine has done its thing, loop over all the nodes and fix all the node x, y positions. See this. example for details. The difference with the example is that in the example only the node that gets dragged is fixed, but if you fix all the nodes, the graph does not move. Assuming
You can set the node After the nodes have a fixed position, you can pan and zoom the graph with node hovers without a reheat, meaning that the nodes do not change position anymore. |
Hi Vasturiano!
Thanks for your amazing library, super useful!
In some use cases I want to reheat the force simulation after it has started or change some settings on the fly. Often this requires access to the main simulation object, e.g. by saying simulation.alpha(1).restart(), as per d3.
I guess in general it's very useful to be able to access the main simulation object in case you need it. Is this possible or is there a way this can be done or to expose it?
Any help is much appreciated :-)
The text was updated successfully, but these errors were encountered: