How get graph name or variable name or any thing else which can give identification of that graph on clickdata of graph

Hi there. I have a scenario in which I have small buttons under the graph card which are changing graph or updating graph. they are working fine. So now i have to update the graph on the click of the graph.

I have to know graph identification or want to know what variable name its plotting or any other identification of that graph like any name.
for now i am only getting this data

  "points": [
      "curveNumber": 1,
      "pointNumber": 1,
      "pointIndex": 1,
      "x": 2,
      "y": 4,
      "bbox": {
        "x0": 735.4,
        "x1": 755.4,
        "y0": 828.2,
        "y1": 848.2
      "customdata": [
fig = px.line(df, x=xs, y=ys, render_mode='svg', labels={'value': "Bpm"}, custom_data=['beat])

The curveNumber in click data gives the trace index of the point clicked, and you can find the trace doing[idx], where idx = click_data[”points"][0]["curveNumber]. In the trace you can find the info that you are looking for, for instance its name via[idx].name and so on.
Hope this helps!

1 Like

But the problem is how do we get fig in callback wherever we are only received clickdata.

Just pass the “figure” prop from dcc.Graph as State in the callback. fig will be a dictionary on this case, so you can’t access data by attribute any longer.

@jlfsjunior Thanks, I literally forgot about state.