Update graph zoom from callback

Hello! So I have a dash app that displays data over periods of time. Since there is a slider for the user to reduce or expand the time range observed, which updates all the graphs and maps to the selected range. However, I would like to improve performance by having the callbacks set the x-axis range of the graphs as opposed to re rendering them every time. Is this possible?

You can access the layout by putting the the figure in a State of the callback. The fig is basically a json object, you can go in there, edit what you need from the layout and use that as the output. So if your callback would look something like this…

Output(‘myfig’,‘figure’)
Input(‘myslider’,‘value’)
State(‘myfig’,‘figure’)

I do something similar to that to add points to a map so that I’m not re-rendering every time.

1 Like

Very nice idea. Any tips on what attributes to edit to change the xaxis range shown?