Option to execute component commands on initialization
See original GitHub issueWe talked about this briefly before and it didn’t sound like a good idea, but I really think this is proving to be necessary. Syntax:
"updatemenus": [{
"active": 0,
"executeoninitialization": true,
"buttons": [{
"method": "animate"
}]
}]
This would trigger execution of the command if the internally active button/step index was previously undefined. Once that has happened, it won’t automatically be executed again.
Here’s situations it would help with:
-
Playing animations on load in the UI. Right now they just get played with
Plotly.animate(gd)
(I think), which is not acceptable because it’s entirely unconfigured, giving a better than average chance that it will look pretty junky. -
synchronizing the initial state. Right now you have to load a bunch of frames and also set up the initial plot state and set the slider component value and configure a command that correctly reconstructs the exact state. Long story short, the inability to execute a command that sets the state automatically means you have to do your best to make things look correct and then just cross your fingers that you got it right. Executing the command would just make it right in the first place.
-
Slider transform. cc: @bpostlethwaite. Right now when the magic workspace transform generates frames slider etc, it doesn’t actually set that frame. This leads to a difficult initialization problem that, at best, has to be hacked around. If it actually executed the command that configured the filter, this problem would go away.
cc: @etpinard
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
Hi, it doesn’t seem to be much activity/discussion on this issue? I am facing the problem explained in the merged issue #1955 and consider the proposed workaround as way too complicated. Isn’t it obvious that if I need to set the default slider step to other than 0, I should see the frame related to this step?
To me, setting whether or not an animation should start right after the first draw depends on the plot context in plotly lingo (i.e. its environment).
For example on plot.ly, you can make the case that animations in shareplot and embed should start right away. But, I doubt that someone editing a graph in the workspace would want it to animate while editing.
Generally, per-context options are handled in the config object e.g.
Plotly.plot(gd, data, layout, { editable: true })
.