okld / streamlit-elements

Create a draggable and resizable dashboard in Streamlit, featuring Material UI widgets, Monaco editor (Visual Studio Code), Nivo charts, and more!
MIT License
679 stars 77 forks source link

Custom layers on Sunburst chart? #7

Open fralik opened 2 years ago

fralik commented 2 years ago

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.