Get trace name from clickdata

Right after posting this (and after a few hours of recapping basics in Dash), I realized I needed to pass in the current State. So this is how I resolved it:

    Output('test', 'children'),
    [Input('output-figure', 'clickData')],
#### ADDED HERE
    [State('output-figure', 'figure')])

def display_click_data(click_data, figure):
    
    if click_data is not None:
        curve_number = click_data['points'][0]['curveNumber']
        x_value = click_data['points'][0]['x']
        
        trace_name = figure['data'][curve_number]['name']
5 Likes