✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Bar chart labels on bar

Hi,

Is there a way to setup the layout in a bar chart to have the y axis labels on top of the bar when hovered over as opposed to at left of the bar?
currrently when i hover over a bar it show the label on the left of the bar but because the word is quite long it gets cut off… this of course can be remedied by adding some right margin in layout but some words are just too long and still get cut off

i jsut want to make this plot prettier doesn’t necessarily have to be labels on top of bar

thanks

It would be clearer if you have included your code. I am guessing your code looks like this:

data = [go.Bar(x=X, y=Y,
               orientation='h'
                )]
dcc.Graph( figure={'data':data,
                   'layout':layout})

You can add ‘text’ to change the hover info, which can be a list or just use Y so that the labels on you yaxis can be shown.

 data = [go.Bar(x=X, y=Y, text=Y,
               orientation='h'
                )]
dcc.Graph( figure={'data':data,
                   'layout':layout})