code: def test_grbs005_graph_customdata(dash_dcc):
      app = Dash(__name__)
  
      df = px.data.tips()
      df["id"] = df.index
  
      app.layout = html.Div(
          [
              dcc.Graph(
                  id="pie-chart",
                  figure=go.Figure(
                      data=[
                          go.Pie(
                              labels=df["day"],
                              ids=df["id"].map(str),
                              customdata=df["id"],
                          )
                      ]
                  ),
              ),
              dcc.Textarea(id="text-area"),
          ]
      )
  
      @app.callback(
          Output("text-area", "value"), Input("pie-chart", "clickData")
      )
      def handleClick(clickData):
          return json.dumps(clickData)
  
      dash_dcc.start_server(app)
      dash_dcc.wait_for_element("#pie-chart")
  
      dash_dcc.find_elements("g .slice")[0].click()
  
      data = dash_dcc.wait_for_element("#text-area").get_attribute(
          "value"
      )
      assert data != "", "graph clickData must contain data"
  
      data = json.loads(data)
      assert (
          "customdata" in data["points"][0]
      ), "graph clickData must contain customdata"
      assert (
          data["points"][0]["customdata"][0]
          == data["points"][0]["pointNumbers"][0]
      )
  
file_path: dash/components/dash-core-components/tests/integration/graph/test_graph_basics.py
imports: import json
  import pytest
  import pandas
  from multiprocessing import Value, Lock
  import numpy
  from time import sleep
  import plotly.express
  import plotly.graph_objects
  from dash import Dash, Input, Output, dcc, html
  import dash.testing.wait
label_desc: Use image node_id 5 for calling a global function with example usage: test_grbs005_graph_customdata(dash_dcc) and returns: json