Issue with `selectedData`

I am seeing the same behavior.

I believe that this is a bug that occurred in 0.13.0 dash-core-components release.

I am currently using the selectedData as my callback trigger and when I upgrade past core-components 0.12.7 the selectedData no longer triggers the callback.

dash versions are:

dash (0.19.0)
dash-core-components (0.12.7)
dash-html-components (0.8.0)
dash-renderer (0.11.1)

@apander - Could you describe more about the issue that you are seeing? The parent thread described several issues. Could you also post a small, reproducable example? selectedData is working on the latest release (0.15.2) for the example in the docs: https://plot.ly/dash/interactive-graphing, so there is likely something unique about your particular example that might be causing it to fail. Thanks!

This code snippet at the end replicates the failure I am seeing. The intent is to plot a large timeseries and using the selectedData draw a vertical line at the end of the user selection it successfully runs using these versions

  • dash (0.19.0)
  • dash-core-components (0.12.7)
  • dash-html-components (0.8.0)
  • dash-renderer (0.11.1)

but when I upgrade to dash-core-components (0.15.2) no callbacks are triggered and the selection box freezes like the image below and never triggers the callback

I can see 2 major differences in the implementation I am pursuing

  • using scattergl to support large data sets

  • use of timeseries data

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import numpy as np
import plotly.graph_objs as go

app = dash.Dash('Time Series Explore')

rng = pd.date_range('1/1/2011', periods=6000, freq='H')
ts = pd.Series(np.random.randn(len(rng)), index=rng)
ts_index = [{'label': i, 'value': i} for i in ts.index]

def timeseries_graph(end):
 data = ts
 traces = []
 traces.append(go.Scattergl(
     x=ts.index,
     y=ts.values,
     mode='lines+markers', ))
 traces.append(go.Scattergl(
     x=[end, end],
     y=[-5, 5],
     mode='lines',
     name='selection end',
     line={'color': 'red', 'dash': "dot"}, ))

 return {'data': traces}

app.layout = html.Div(children=[
 dcc.Graph(
     id='transient-graph',
     figure={
         'data': [{'x': ts.index,
             'y': ts.values}]}

 ),])

@app.callback(
    Output('transient-graph', 'figure'),
    [Input('transient-graph', 'selectedData')])
def update_ts(selection):
    if selection:
        selected_end=selection['range']['x'][-1]
        plot = timeseries_graph(selected_end)
    else:
        plot = timeseries_graph(ts_index[-1])
 return plot


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

@chriddyp have you been able to replicate this bug?

1 Like