Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

How can I manipulate the hovertemplate using Sunbust chart?

I’m trying to customize hover information using the below code:

fig = px.sunburst(top_10, path=['Title','Country'], values='Rating', color='Rating',
                  color_continuous_scale='YlGn', title='Highst Rated Movies on Netflix in Each Countries')

fig.update_traces(hovertemplate='Title: %{values} <br>Country: %{}')

I tried to sue %{path[‘Title’]}, hoping it would work but I’m not able to get %{} part working. Is there way to manipulate hover information here?

Thank you in advance!

Hi @sarahekim53
I think you can add hover_data=[‘title’,‘country’] inside you px.sunburst(). Then try something like this:

        "<b>%{customdata[0]}</b><br><br>" +
         <b>%{customdata[1]}</b><br><br>" +

Thank you so much, I was struggling with this so much but I see how hover_data works clearly now.

1 Like