Hi, everyone! I am trying to call print() function when points related to trace1 are being clicked. But for some reason callback function still triggers when I click on points related to trace2. What am I doing wrong? And is there a solution to replace on_click() function’s multiply calls (one call for one trace) with one?
f = go.FigureWidget(make_subplots(rows=2, cols=1))
trace1 = go.Scatter(x=[3, 4, 5], y=[10, 11, 12])
trace2 = go.Scatter(x=[6, 7, 8], y=[13, 14, 15])
f.add_trace(trace1, row=1, col=1)
f.add_trace(trace2, row=2, col=1)
def test(trace, points, selector):
print("ayaya")
scatter = f.data[0]
scatter.on_click(test)
f