Setting background image to paper using Raphael-JS

javascript, raphael

Solution

I would suggest you to add an image with :

var img = paper.image("foo.png", 10, 10, 80, 80);
img.attr({ "clip-rect": "20,20,30,30" });

The image is drawn with clipping to clip out the part you want, and you can control the offset of the image either with `img.translate(x,y)` or by the `paper.image`.

Problem

I am using Raphael-js to for creating a chart; Is it possible to set a background image for the Rapahel paper? Thanks,

Original source