Black Lives Matter. Please consider donating to Black Girls Code today.

Passing customdata via a Sunburst Graph in Dash

Here is what I’m going for:

I used a datatable to generate a list of ‘cost centers’. I select the row in that datatable to generate the sunburst plot for a given cost center that has nested financial data. I click on a wedge in the sunburst plot to generate another datatable that has the detailed costs for that particular wedge.

In order to get the detailed cost for that particular wedge, I need the cost center. For the first click, I can grab the state of the initial datatable and get the cost center. Every other click, the state of the initial datatable is gone. So I tried to put the cost center as customdata within the sunburst plot. The customdata is passing just fine into the graph creation, but doesn’t seem to be there in the ‘point’ object in the callback.

Any thoughts?

So, the question can still stand… not sure why the customdata gets lost in the Sunburst.

But, after some reading, the dcc.Store element is basically perfect for this (not sure why I haven’t used it in the past).