Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Different way of counting in every level of the treemap

Hi,
I’m trying to implement a treemap that represents buildings, The first level is the building types and the second level is the building specialty. Given that the same building can have only one type and may have many specialties. I couldn’t have a sperate count for each level

however, I succeeded in making the real count appear to the leave levels which are the specialties by using this code :

fig.update_traces(hovertemplate='%{customdata[0]}')
    
    
    fig.data[0].customdata = [
    v if fig.data[0].ids[i]
    not in fig.data[0].parents else [""]
    for i, v in enumerate(fig.data[0].customdata)
]