-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
the docstring from each propType is transferred to the Python classes
`updatemode: ‘replace’` will completely clear and redraw the figure, without keeping any state in the graph nor tweening between transitions. This is used for examples that update the data of the sunburst chart through callbacks
cc @alexcjohnson also folks from @plotly/dash might be interested in general |
Thanks @chriddyp - that's right, you had asked about server-side data updates, I forgot about this use case and without it couldn't think of a plausible way to handle that. Thanks for getting this started. This reminds me actually of our discussion about
That one's pretty easy... should be fixed by
What if, instead of adding
Absolutely, it would be easy to support
Yep, that's probably the reason it's flashy. I suspect if we ensure root-preserving changes always animate, the flashes would go away even if we end up doing two updates back-to-back: one to the new selected node, the second to update the data based on the server's new data for that node. We may need some extra logic to short-circuit the first update once the second one starts, or it may already do that, I'm not sure. I'm happy to give this approach a shot tomorrow if you think it sounds interesting. |
Yeah, that would be very cool! This sounds like a good approach for growing a tree out progressively via clicking on the nodes. I could still imagine a case where you would want to jump around in the tree. In that case, the root would still change but we might jump from level 1 to level 14. The real world use case might be a search box to look up a particular node in some huge network and when you've selected it, you'd display it's children. In that case, would we need to keep track of the levels as well inside the object? That is, so that if we transition we don't tween and instead of directly appending the nodes to the internal representation of the network, we create some sparse array of the network? |
That's a good point, you wouldn't want to animate if nothing displayed is the same before/after, even within the same network. OK, so the logic is a bit more complex than just "did the root node change", but I suspect we can still figure this out internal to the D3 component. Might be as simple as having it calculate the enter / exit joins, and see if anything is left behind as a node to update. |
@chriddyp the approach I described above did eventually work, but it was super awkward to manage changing both Multi-output callbacks would certainly help in this case. But I wonder, does each callback really need to fire independently? I naively would have thought that some piece of state changes and we'd fire whatever callbacks are necessary to propagate that change all the way through the dependency graph, before presenting just the final state back to the app. If we did that, then chained, parallel, and multi-output callbacks would all be functionally equivalent, and a single input change would only cause a single rerender. Is there a reason not to do it that way, or have we just not gotten to that yet? Anyway check it out. I haven't updated the prose yet to reflect the new code, there will be a bunch of things to add based on the experience of making it work right in all these cases. |
Merged - I'll make a new PR to update the docs |
No description provided.