How to identify the clicked Trace from a group of traces

Hi,
Am asking if it is possible to identify a clicked Trace from group of traces !
for exemple i have plotted 5 traces with one common xAxis and different yAxes ,
so we have traces like this order [ Trace1 ,Trace2 ,Trace3 ,Trace4, Trace5 ]
for exemple the traces are plotted as plotType = Line , is it possible when i click on specific trace ( trace 3 for exemple) to be identified by click_events of Plotly .
Thanks in advance .
Jasser.

Hi jasser, wellcome to the Community,
I’m not sure but clickData do not have the info you need?
See if this link helps:

1 Like

Hey @Eduardo , thanks for replying ,
am afraid that it’s not a solution for my problem ,
in fact what i want is to integrate a colorpicker at graphs , so when i have multiple traces , i need to change one trace color ( trace number = x for exemple ) , so i need to know what trace is that to pass the x parameter into the restyle fucntion : like updatePlotColor() { let update = {'marker.color': this.color}; PlotlyModule.plotlyjs.restyle("plotDiv", update, x); }

Hey plotly community , i found my own solution which consists to plotly_click event
i grabbed the yAxis selected with :

        this.clickedTraceIndex = traceArray.indexOf(event.points[0].data.name)

where traceArray is the array containing all traces names ( just strings )
then with clickedTraceIndex i continue doing my job .
thanks ( to be closed )

1 Like