I was trying to use Raphael JS graphics library. I would like to use the attribute gradient which should accept an object. Documentation says to refer to SVG specs. I found the gradient object in SVG, for instance
<linearGradient id='myFillGrad' x1='0%' y1='100%' x2='100%' y2='0%'> <stop offset='5%' stop-color='red' /> <stop offset='95%' stop-color='blue' stop-opacity='0.5' /> </linearGradient>
but how can I reference that from within my javascript?
circle.attr('gradient', 'myFillGrad');
doesn’t work 🙂 Thanks in advance
UPDATE: Rewritten for the latest Raphael API:
The documentation for the new
attr()API is found here.