# On\_click event - grab data from multiple scatter traces to scatter object

**URL:** <https://community.plotly.com/t/on-click-event-grab-data-from-multiple-scatter-traces-to-scatter-object/36354>\
**Category:** 📊 Plotly Python\
**Created:** [March 18, 2020, 11:05am UTC](https://community.plotly.com/t/on-click-event-grab-data-from-multiple-scatter-traces-to-scatter-object/36354 "2020-03-18T11:05:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![smaciu](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@smaciu](https://community.plotly.com/u/smaciu)\
**Post date:** [March 18, 2020, 11:05am UTC](https://community.plotly.com/t/on-click-event-grab-data-from-multiple-scatter-traces-to-scatter-object/36354/1 "2020-03-18T11:05:39Z")

</div>

**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:  
print(scatter.name)

scatter.on\_click(update\_point)

f
