plotly / dash-core-components

OBSOLETE: now part of https://github.com/plotly/dash
https://dash.plotly.com
MIT License
270 stars 146 forks source link

relayoutData not used when switching tabs #726

Open emmanuelle opened 4 years ago

emmanuelle commented 4 years ago

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 commented 4 years ago

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)
jauerb commented 3 years ago

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

Thanks!