dash-core-components icon indicating copy to clipboard operation
dash-core-components copied to clipboard

relayoutData not used when switching tabs

Open emmanuelle opened this issue 5 years ago • 2 comments

See the community post https://community.plot.ly/t/bug-maintaining-interactive-graph-state-across-tab-switches/32937/, which includes a standalone app reproducing the problem.

Problem: for an app with several tabs, if one tab includes a dcc.Graph, then switching tab loses information such as zoom or selection.

Is it related to https://github.com/plotly/dash-core-components/issues/311 ?

emmanuelle avatar Dec 25 '19 22:12 emmanuelle

Here is the example, for the record

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go
import numpy as np


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

fig = go.Figure()
x = [n * .1 for n in range(100)]
y = np.sin(x)
fig.add_trace(go.Scattergl(x=x, y=y, mode='lines'))

app.layout = html.Div(
    html.Div([
        html.H4('Interactive Graph in Tab Test'),
        dcc.Tabs(id="plot-tabs", value='graph',
                 children=[dcc.Tab(label='Graph', value='graph',
                                   children=[dcc.Graph(id='interactive-graph', figure=fig)]),
                           dcc.Tab(label='Other', value='other')])
    ])
)


if __name__ == '__main__':
    app.run_server(debug=True)

emmanuelle avatar Dec 25 '19 22:12 emmanuelle

Hi, just curious if there has been any update on this in the last year?

Thanks!

jauerb avatar Jan 11 '21 16:01 jauerb