How to affect a graph from a selection of row in DataTable component

I have a callback that generates a linegraph

    Output('vitals', 'figure'),
    [Input('datasets', 'data'), # store component
     Input('filter1', 'value')],
def create_line_graph(datasets_store, selected_sim):

I also have a callback for my DataTable right after:

    [Output('events-table', 'columns'),
     Output('events-table', 'data'),
     Output('events-table', 'tooltip_data')],
    [Input('datasets', 'data'),
     Input('filter1', 'value'),
     Input('filter2', 'value'),
     Input('filter3', 'value')]

I would like to have another callback that updates the line graph when I select a row from the DataTable
I started with this callback logic but I believe I cant do this because the output value is the same as the first callback.
How can I solve this: essentially have my graph and table get created at launch and then allow interaction with the Data Table to update the line graph ?

    Output('vitals', 'figure'),
    Input('events-table', "derived_virtual_data"),
    Input('events-table', 'derived_virtual_selected_rows'),
    Input('datasets', 'data'), # store component
    Input('filter1', 'value')
def update_line_graph(all_rows, selected_rows, datasets_store, selected_sim):
     filter_value = all_rows[selected_rows[0]]['Col']

I think that the easiest approach would be to combine the two callbacks outputting the figure as one and handle the data selection inside it. They are essentially doing the same thing anyway, which is to create a figure.

Depending on what you want to do with the selection from DataTable, you could consider taking a look on extendData or prependData from dcc.Graph. If you are just adding points, this would be way more efficient than rewriting the whole figure.