The Mosaic element does that automatically. To get the effect in a regular stacked bar chart, you have to compute the proportions and stack those. Here is a script where I did so with inline transformations:

```
Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Variables(
X( :age ),
Y(
Transform Column(
"proportion",
Formula( Col Sum( :height, :age, :sex ) / Col Sum( :height, :age ) )
)
),
Overlay( :sex )
),
Elements( Bar( X, Y, Bar Style( "Stacked" ) ) ),
);
```

In "Col Sum( :height, :age, :sex )", the variables after the first are BY variables. Use Col Number() if you just want the counts instead of the sums.