-
-
Notifications
You must be signed in to change notification settings - Fork 146
"Live Figure" - new Graph props for current state of figure #584
Comments
Would this change the way |
What should be the content of this prop? The whole layout, with a few exceptions ( |
The key criterion, IMO, is that anything that can potentially be modified via GUI actions must be included, whether it actually was modified or not. So that would absolutely include Beyond that, we could imagine sending back either:
I don't offhand see any really simple option, but if we want to whitelist the editable attributes they can be found by looking for the The most robust way to do this might be to bake it into plotly.js - mark each of these attributes as editable within the attribute spec, which we could test during the The simpler way, but harder to keep in sync with new plotly.js features, would be to just write this partial clone into Search plotlyjs source for `_guiRe`
|
this seems pretty easy, no? basically exclude everything with an |
BTW this issue is titled "live figure" but I think a better name would be "slim figure" :) |
I'm a little hesitant to include "everything but the big entries" unless there's a clear use case for it. If we say "we're just including the values that can be changed by the GUI" that necessarily provides all the info about what users have done on the graph which is the primary reason for this prop, minimizes the overhead of generating this object, and makes it completely obvious which attributes are and are not included. Anyway if we do go that route:
As far as plotlyjs is concerned those keys are just an artifact of schema generation; any attribute that's a
Yes, we'd want to comb through the layout schema to see if there's anything else in this category, but should be straightforward. |
Is there any progress on this? I have got stuck in achieving selected legends to sync two graphs. 😢 |
Currently the way to respond to zoom events, legend toggle events, etc. is to listen to
relayoutData
andrestyleData
. This gets super complicated though since it only contains the latest changes, which may be a partial zoom (single axis, single-ended) or completely unrelated to the information you actually care about. So to make a really robust app, the dev needs to manually accumulate these changes in aStore
or something.It would be way better to just expose the current state of the figure as its own prop. Then, to avoid infinite loops, the normal usage pattern would be to use
relayoutData
as anInput
just to trigger the callback, and useliveFigure
or whatever we call it asState
.But of course we don't want the entire figure, we need to at least exclude data arrays as they may be huge and slow things down.
The
uirevision
system collects attribute patterns that can be set by the UI - we could presumably piggyback off that, though that's reaching fairly deep into plotly.js unless we build this functionality directly into plotly.js. Alternatively we could clone the whole figure minus data arrays - or even just clip all arrays, though there are a few that we need to keep in their entirety (hiddenlabels
,selectedpoints
...)The text was updated successfully, but these errors were encountered: