Stacked bar-chart show totals per bar

Hi,

I have a stacked bar chart and was wondering how/ if it is possible to show the totals on top of a bar. Any clue how can this be implemented?

Thanks

Hi @mr.t,

Are you wanting to place text labels on the bars? Do you have any example images of what you want?

In any case, I don’t think there will be a built-in option to do this, but you can probably get to what you want by adding one or more extra scatter traces (after all of your bars) with scatter.mode set to text.

-Jon

@jmmease thanks

I thought of using either a scatter trace or annotations for having a static representation of the totals above each bar.

Is there functionality to show the totals of the visible only bars, and update them (the totals) when making bar categories visible after clicking them in the legend?

Hi @mr.t,

There’s nothing built in to dynamically compute totals like that. But I think it would be possible to pull that off in the Jupyter notebook using Python callbacks. If you’re interested in this approach, and you want to post a small example of your stacked bar chart, I could show you what that would look like.

-Jon

Is it possible to make a feature request for this? It would be handy. Currently, I have to plot two separate plots, to show totals and to show the split stack. Rather than having to eyeball totals from the stack axis, I would love it if total was shown on top of each stack on hover by default. There’s certainly space there for it.