Sunburst being empty

Hi guys,

I have a problem with the Sunburst chart. I have a script that creates a sunburst chart.
The following input produces an empty/blank svg. The same script for some other data is working as intended. Since I calculate the parent values from the leaves, the values should match. And I also donโ€™t have any negative values included.
I am very thankful for any ideas :slight_smile:

EMPTY SVG

ids =['id1', 'id2', 'id3', 'id4', 'id5', 'id6', 'id7', 'id8', 'id9']
parents = ['id7', 'id7', 'id7', 'id8', 'id8', 'id8', 'id9', 'id9', '']
labels=['TTM <5<br>Years', 'TTM<br>5-10<br>Years', 'T', 'T', 'T', 'T', 'Buy', 'Sell', ' ']
values = [128.18, 72.98, 19.45, 0.38, 1.53, 6.0, 220.61, 7.91, 228.51]
colors = ['4C81B3', '4C81B3', '4C81B3', 'FFA750', 'FFA750', 'FFA750', '004C93', 'FF8205', 'FFFFFF']

    fig2 = go.Figure(
        go.Sunburst(
            ids=ids,
            labels=labels,
            parents=parents,
            values=values,
            branchvalues='total',
            rotation=90,
            insidetextorientation='radial',
            insidetextfont={"color": "white", "family": "Calibri"},
            marker={"colors": colors},
            sort=False
        ), layout=go.Layout(margin=dict(l=0, r=0, t=0, b=0), width=400, height=400, font=dict(size=14, family="Calibri")))
fig2.write_image("Test.svg")

CORRECT SVG

ids =['id1', 'id2', 'id3', 'id4', 'id5', 'id6', 'id7', 'id8', 'id9']
parents =['id7', 'id7', 'id7', 'id8', 'id8', 'id8', 'id9', 'id9', '']
labels=['TTM <5<br>Years', 'TTM<br>5-10<br>Years', 'T', 'T', 'T', 'T', 'Buy', 'Sell', ' ']
values =[106.31, 117.77, 20.06, 0.21, 4.49, 3.82, 244.14, 8.520000000000001, 252.66]
colors =['4C81B3', '4C81B3', '4C81B3', 'FFA750', 'FFA750', 'FFA750', '004C93', 'FF8205', 'FFFFFF']
fig2 = go.Figure(
        go.Sunburst(
            ids=ids,
            labels=labels,
            parents=parents,
            values=values,
            branchvalues='total',
            rotation=90,
            insidetextorientation='radial',
            insidetextfont={"color": "white", "family": "Calibri"},
            marker={"colors": colors},
            sort=False
        ), layout=go.Layout(margin=dict(l=0, r=0, t=0, b=0), width=400, height=400, font=dict(size=14, family="Calibri")))
fig2.write_image("Test.svg")

Not sure what to say, butโ€ฆ

The value for a parent has to be at least as large as the sum of the values for its children, so the final value has to be at least 220.61 + 7.91 = 228.52, not 228.51

Ok, then there hast du be some rounding issues happening in between. I am calculating all parent values as pandas sums. Iโ€˜ll have a look into that.

Gesendet von Outlook fรผr iOS

OK. I should also have said, if you run the version that doesnโ€™t work, an informative error message appears in the browser developer tools console.