Mesh properties driving materials?

Is there any way to drive cycles materials (e.g. colour, transparency etc) from mesh properties like X, Y, Z size, scale, rotation etc?

I’d like to be able to scale a series of cubes vertically (e.g. for a bar chart) and have the colour automatically change via a colour ramp - based on their relative size.

It can be done in a minute or two, easier to see than say.


Cool - cheers.