How to create a stacked BarChart with custom bar origins as function?

I'm not sure whether this is documented or not. You can pass additional arguments to the ChartElementFunction like this:

r[{{xmin_, xmax_}, {ymin_, ymax_}}, y_, {origin_}] :=
                           Rectangle[{xmin, ymin + origin}, {xmax, ymax + origin}]

BarChart[{{1} -> 1, {1} -> 2, {2} -> 3}, ChartElementFunction -> r]

Mathematica graphics

edit

Perhaps more elegant and somewhat more obscure:

r[a_, _, {origin_}] := Rectangle @@ Transpose[a + {0, origin}]

Tags:

Charts