Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have labeled the name(A,B,C) of each row on the left and value of each item , is there any way to put the total number(6,7,5) of each row on the right side without changing other labels?

BarChart[{{1, 2, 3}, {2, 4, 1}, {3, 1, 1}}, BarOrigin -> Left, 
 ChartLayout -> "Stacked", BarSpacing -> 0.5, 
 ChartLabels -> {Placed[{"A", "B", "C"}, Before], None}, 
 LabelingFunction -> (Placed[#1, Center] &)]

enter image description here

share|improve this question
up vote 13 down vote accepted

Maybe this helps:

BarChart[#, BarOrigin -> Left, ChartLayout -> "Stacked", 
 BarSpacing -> 0.5, 
 ChartLabels -> {Placed[{{"A", "B", "C"}, {Total@#[[1]], 
 Total@#[[2]], Total@#[[3]]}}, {Before, After}], None}, 
 LabelingFunction -> (Placed[#1, Center] &)] &@{{1, 2, 3}, {2, 4, 1}, {3, 1, 1}}

EDIT: slightly cleaner:

BarChart[#, BarOrigin -> Left, ChartLayout -> "Stacked", 
 BarSpacing -> 0.5, 
 ChartLabels -> {Placed[{{"A", "B", "C"}, Total@#}, {Before, After}], None}, 
 LabelingFunction -> (Placed[#1, Center] &)] &@{{1, 2, 3}, {2, 1, 1}, {3, 1, 1}}

enter image description here

share|improve this answer
    
Your answer is excellent! – withparadox2 Jan 12 '13 at 1:29
    
+1 and enjoy your first Enlightened badge. – Mr.Wizard Jan 12 '13 at 17:09
    
@Mr.Wizard - thanks! #paradox2 - glad it helped! – Pinguin Dirk Jan 13 '13 at 7:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.