okld / streamlit-elements

Create a draggable and resizable dashboard in Streamlit, featuring Material UI widgets, Monaco editor (Visual Studio Code), Nivo charts, and more!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom layers on Sunburst chart?

fralik opened this issue · comments

I see in documentation that Nivo Sunburst supports custom layers via it's layers property. However, I do not understand what can be provided as a custom layer. I see that it may be a function, so I made one. However, attempting to return a string from it or an object, results in exception.

def custom_layer(obj):
    nodes = obj['nodes']
    centerX = obj['centerX']
    centerY = obj['centerY']
    print(f"centerX: {centerX}, centerY: {centerY}")
    return html.div("custom_layer")

nivo.Sunburst(data=DATA, enableArcLabels=True, arcLabel="id", layers=["arcs", 'arcLabels', custom_layer])

It throws an non-identifiable exception since react is minified.