Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

dcc Graphs reset their relayout on tab change #1007

Open
matt-sd-watson opened this issue May 2, 2023 · 0 comments
Open

dcc Graphs reset their relayout on tab change #1007

matt-sd-watson opened this issue May 2, 2023 · 0 comments

Comments

@matt-sd-watson
Copy link

matt-sd-watson commented May 2, 2023

I have a few dcc.Graphs that render histograms in my Dash app. In one instance, I have a callback that will update a shape on the histogram if the proper data exists in dcc.Loading.

Upon updating the callback, the relayout of the graph will look something like this:

{'shapes': [{'editable': True, 'label': {'text': ''}, 'xref': 'x', 'yref': 'y', 'layer': 'above', 'opacity': 1, 'line': {'color': '#444', 'width': 4, 'dash': 'solid'}, 'fillcolor': 'rgba(0,0,0,0)', 'fillrule': 'evenodd', 'type': 'rect', 'x0': 10.060903897849462, 'y0': 44456.17081925675, 'x1': 23.7705813172043, 'y1': -804.9102618243243}]}

however, on a tab change within the app, upon returning to the tab with the histogram, the relayout of the histogram has updated to:

{'autosize': True}

despite having no logic within the callbacks to allow a callback on a tab change. This continues to occur even by limiting callbacks to no include certain actions such as:

ctx.triggered_id != "tabs"

where tabs is the id of the tab set.

This is odd because the shape that is declared in the callback is not removed or modified in any way, but the change to the relayout affects a number of other linked callbacks erroneously.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant