✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

On_click event - grab data from multiple scatter traces to scatter object

Hello, I am trying to capture the trace name of the scatter.on_click event. While it allows to do that for an individual trace (one at the time) it does not allow me to combine the data from multiple traces (A & B from below example) under same scatter object. Anyone know how to fix it? Appreciate the advice. Many thanks

Below is the code:

import plotly.graph_objects as go

f = go.FigureWidget([go.Scatter(x=[1,2,3], y=[3,5,6], mode=‘lines’, name=‘A’),
go.Scatter(x=[4,5,6], y=[5,7,9], mode=‘lines’, name=‘B’)])

scatter = f.data[0] # trace A data
scatter = f.data[1] # trace B data overrides the the first trace A

f.layout.hovermode = ‘closest’

def update_point(trace, points, selector):
for i in points.point_inds: