Dmitry Baranovskiy released version 1.4 of Raphaël JS, his powerful JavaScript vector graphics library this week and now includes touch support for mobile devices such as the iPad.

Raphaël has a nice, well documented API:

// Creates canvas 320 × 200 at 10, 50
var paper = Raphael(10, 50, 320, 200);

// Creates circle at x = 50, y = 40, with radius 10
var circle = paper.circle(50, 40, 10);
// Sets the fill attribute of the circle to red (#f00)
circle.attr("fill", "#f00");

// Sets the stroke attribute of the circle to white
circle.attr("stroke", "#fff");

If you need charts, then try gRaphaël which supports sexy, simple graphics with a few lines of JavaScript:

// Creates canvas 640 × 480 at 10, 50
var paper = Raphael(10, 50, 640, 480);
// Creates pie chart at with center at 320, 200, radius 100
// and data: [55, 20, 13, 32, 5, 1, 2, 10]
r.g.piechart(320, 240, 100, [55, 20, 13, 32, 5, 1, 2, 10]);

screenshot

[Source on GitHub] [Homepage]


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.