You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm wondering if it's possible to make it easy to retrieve the active item in the updatemenus of a figure, from a Dash callback. I am in a similar situation to this post: https://community.plotly.com/t/get-active-button-in-updatemenus/9021 . Basically I need to know which button/trace is currently active/visible, and I'd have to keep the same thing active when I update this figure. I also need this information when updating other figures in my web app. Therefore it is very frustrating when I realize there is no easy way to do this (correct me if I am wrong, though).
Describe the solution you'd like
Perhaps make either the active item (for example its button index) a property of a figure, or the entire layout as a property (if a more general solution is needed), so that it could be easily retrieved in Dash callbacks through something like State('my_figure', 'active_updatemenus_item') or State('my_figure', 'layout').
Describe alternatives you've considered
First simple alternative is to retrieve the active item by passing the entire figure to the Dash callback, and then get the active item in its layout. This could work but is extremely inefficient -- I have a huge figure in my case, and just passing all of those data to the callback function takes a few seconds (!) for my browser. I occasionally need to trigger this callback every 0.5 seconds, so this amount of time is unacceptable. For smaller figures, the amount of time might not be so crazy, but still it is unnecessarily slow.
Another alternative is to use a dcc dropdown menu instead of the updatemenus, but updatemenus is just so nice, elegant, and already works for my purpose perfectly (except for this one small issue). It would be sad if I have to reinvent the wheel for a small issue like this.
The text was updated successfully, but these errors were encountered:
meng-du
changed the title
[Feature Request] Easy way to retrieve the active item in the updatemenus
[Feature Request] Easy way to retrieve the active item in the updatemenus (or retrieve any figure layout property without getting data)
Oct 20, 2021
Is your feature request related to a problem? Please describe.
I'm wondering if it's possible to make it easy to retrieve the active item in the
updatemenus
of a figure, from a Dash callback. I am in a similar situation to this post: https://community.plotly.com/t/get-active-button-in-updatemenus/9021 . Basically I need to know which button/trace is currently active/visible, and I'd have to keep the same thing active when I update this figure. I also need this information when updating other figures in my web app. Therefore it is very frustrating when I realize there is no easy way to do this (correct me if I am wrong, though).Describe the solution you'd like
Perhaps make either the active item (for example its button index) a property of a figure, or the entire layout as a property (if a more general solution is needed), so that it could be easily retrieved in Dash callbacks through something like
State('my_figure', 'active_updatemenus_item')
orState('my_figure', 'layout')
.Describe alternatives you've considered
First simple alternative is to retrieve the active item by passing the entire figure to the Dash callback, and then get the active item in its layout. This could work but is extremely inefficient -- I have a huge figure in my case, and just passing all of those data to the callback function takes a few seconds (!) for my browser. I occasionally need to trigger this callback every 0.5 seconds, so this amount of time is unacceptable. For smaller figures, the amount of time might not be so crazy, but still it is unnecessarily slow.
Another alternative is to use a dcc dropdown menu instead of the
updatemenus
, butupdatemenus
is just so nice, elegant, and already works for my purpose perfectly (except for this one small issue). It would be sad if I have to reinvent the wheel for a small issue like this.Additional context
See this post: https://community.plotly.com/t/get-active-button-in-updatemenus/9021
The text was updated successfully, but these errors were encountered: