Out of the box, Raphael cannot do this, you need a plugin. Here's the jsfiddle for the simple one I created: http://jsfiddle.net/tcouc/qncEC/
The defineLinearGradient function simply adds svg linear gradients to the defs section, and the strokeLinearGradient function adds the stroke attribute to refer to the identifier of the linear gradient you create.
I made it so that you can reference the gradient in more than one form.
Note that you cannot just set the stroke using the attr function of the raphael element - it will not work - internally, the attr function tries to convert the value specified in the stroke argument to an expression in the rgb expression and fails, so my strokeLinearGradient function
Hope that helps
Toby couchman
source share