Horizontal stacked bar chart: add a Total

Solved
hardgratte Posted messages 482 Status Membre -  
hardgratte Posted messages 482 Status Membre -
Hello,

I am building a stacked horizontal bar chart, and I need to display the total for each bar.
In the attached image, I added a "Total" bar in black to show the value (the label of the bar; the values come from the associated table). My first idea was to make this bar transparent and that would be it.
But when I do that, the width of the chart window stays the same and does not adjust to the visible chart (without the hidden Total bars). I get a large chart that is half empty.

I wanted to use a combination chart (by assigning my Total values to a Line or Scatter type), but I understand that this option is very limited with this type of chart (stacked horizontal bars).

I have scratched my head in every direction, but I haven't found a solution.

I am counting on you, thank you in advance for your suggestions.



Configuration: Windows / Chrome 101.0.4951.64

3 réponses

tontong Posted messages 2575 Registration date   Status Membre Last intervention   1 064
 
Hello,
Another solution, although a bit cumbersome: add a text box at the end of each bar and enter the text =Sheet1!$B$2 in the formula bar. $B$3, $B$4... for the other bars.
Alternatively, you can add a series =0 and change the label 0 to =Sheet1!$B$2. (B3, B4, etc.)
This alternative is simplified for those who have already installed XY chart labels.
1
hardgratte Posted messages 482 Status Membre 76
 
Hello,

I finally did the second variant (I needed it to remain automated) and it works quite well.
Thank you for the suggestion :)
0
ccm81 Posted messages 11033 Status Membre 2 434
 
Hello

An idea
Take the total range as x-axis labels
https://www.cjoint.com/c/LErony8MgSB

Best regards
0
hardgratte Posted messages 482 Status Membre 76
 
Hello, thank you for your suggestion.
It's an idea I've considered, but I already have labels on the Y-axis. I can't replace them with the Total.
0
ccm81 Posted messages 11033 Status Membre 2 434
 
0
hardgratte Posted messages 482 Status Membre 76
 
It could have worked too, but my labels on the Y-axis are very long and cannot be oriented vertically (and it's not possible to orient them otherwise when selecting multiple labels, see a previous post: https://forums.commentcamarche.net/forum/affich-37592908-graphique-barres-empilees-orientation-des-etiquettes#p37594887)

Thanks anyway :)
0