Line Graph not updating after selecting rows in Dash DataTable

I have a callback that returns a line graph if a row in a Dash Table is selected

@app.callback(
    Output('vitals', 'children'),
    Input('events-table', "derived_virtual_data"),
    Input('events-table', 'derived_virtual_selected_rows'),
)
def update_line_graph(all_rows, selected_rows):
    if selected_rows: # basically if this is not empty (when someone selects a row)
         ... do a bunch of transformations...
            return [
            dcc.Graph(
                id='vitals',
                figure=px.line(
                            data_frame=dff_ts,
                            x='SimulationTime',
                            y='Value',
                            color='Attribute'
                        )
                )
            ]

When I select a row for the firs time, the graph pops out fine. But the problem arises when I select another row. Note that the row selection is set as single. Is it because its returning a Div and not updating figure ? If so , how can I modify that

Hi @Kapla

It’s OK to return a Div instead of updating a figure, so that’s not the source of the problem. Could you post a minimal app with some sample data that reproduces the error?