jQuery SVG vs. Raphael [closed]
What the trade-offs are between the two
Where the development momentum seems to be.
I don’t need the VML/IE support in Raphael, or the plotting abilities of jQuery SVG. I’m primarily interested in the most elegant way to create, animate, and manipulate individual items on an SVG canvas.
I’ve recently used both Raphael and jQuery SVG – and here are my thoughts:
Pros: a good starter library, easy to do a LOT of things with SVG quickly. Well written and documented. Lots of examples and Demos. Very extensible architecture. Great with animation.
Cons: is a layer over the actual SVG markup, makes it difficult to do more complex things with SVG – such as grouping (it supports Sets, but not groups). Doesn’t do great w/ editing of already existing elements.
Pros: a jquery plugin, if you’re already using jQuery. Well written and documented. Lots of examples and demos. Supports most SVG elements, allows native access to elements easily
Cons: architecture not as extensible as Raphael. Some things could be better documented (like configure of SVG element). Doesn’t do great w/ editing of already existing elements. Relies on SVG semantics for animation – which is not that great.
SnapSVG as a pure SVG version of Raphael
SnapSVG is the successor of Raphael. It is supported only in the SVG enabled browsers and supports almost all the features of SVG.
If you’re doing something quick and easy, Raphael is an easy choice. If you’re going to do something more complex, I chose to use jQuery SVG because I can manipulate the actual markup significantly easier than with Raphael. And if you want a non-jQuery solution then SnapSVG is a good option.
I’m a huge fan of Raphael and the development momentum seems to be going strong (version 0.85 was released late last week). Another big plus is that its developer, Dmitry Baranovskiy, is currently working on a Raphael charting plugin, g.raphael, which looks like its shaping up to be pretty slick (there are a few samples of the output from the early versions on Flickr).
However, just to throw another possible contender into the SVG library mix, Google’s SVG Web looks very promising indeed (even though I’m not a big fan of Flash, which it uses to render in non-SVG compliant browsers). Probably one to watch, especially with the upcoming SVG Open conference.
Raphael is definitely easier to set up and get going, but note that there are ways of expressing things in SVG that are not possible in Raphael. As noted above there are no “groups”. This implies that you can’t implement layers of Coordinate Transfomations. Instead there is only one coordinate transform available.
If your design depends on nested coordinate transforms, Raphael is not for you.
Oh Raphael has moved on significantly since June.
There is a new charting library that can work with it and these are very eye catching.
Raphael also supports full SVG path syntax and is incorporating really advanced path methods. Come see 1.2.8+ at my site (Shameless plug) and then bounce over to the Dmitry’s site from there.
I think it is not totally unrelated but did you consider canvas? something like Process JS can make it simpler.