Selecting the value at the center of a sunburst plot after updating

I managed to fix it in the end. What I needed was apparently “percentEntry” in the clickData.

if clickData is not None:
        if clickData["points"][0]["percentEntry"] == 1 and clickData["points"][0]["parent"] == "":
            root_label = "ZERO2"
        elif clickData["points"][0]["percentEntry"] == 1:
            root_label = clickData["points"][0]["parent"]
        else:
            root_label = clickData["points"][0]["id"]
    else:
        root_label = "ZERO2"

Found it in a plotly js version of a sunburst that a colleague had made, and eventually in a the comments from a question in 2020.

I can’t for the life of me find any documentation telling me what percentEntry is, or anything documenting why or how one needs to do this when one comes back up a tree in a sunburst plot, so I don’t know if this is how it’s supposed to be done. It does appear to work though.