Hacker News new | past | comments | ask | show | jobs | submit login

Unlike Raphaël or its predecessor library Protovis (http://mbostock.github.com/protovis/), D3 uses SVG as the graphical representation.

This is more verbose, but is actually really powerful, because there's no translation between what your code is doing and what the browser is using to display your graphics. You can do anything SVG can do in your visualizations, and it is much easier to debug.




Raphaël uses SVG (and VML for IE browsers). Says so on the main page.


Yes, and so does Protovis. But you don't interface with SVG directly. To draw a circle in Raphaël, you use Raphaël.circle. In Protovis, you use pv.Dot.

To draw a circle in D3? svg:circle.


So both use SVG, you just use the SVG syntax. How is that an advantage? The whole point of libraries like that is not to abstract the presentation layer.

Raphaël can be switched to WebGL, for instance, and you won't even need to rewrite any code using that library, while you're stuck with the verbose low level calls to a particular implementation of SVG.


You're missing the point.

Raphaël is a simple, unified interface to SVG and VML. You ask for a circle, and it will make one, whether in SVG or VML.

But if you have an array of data and want to visualize it, you have to write the code that creates the circle (and its position, size, color, etc) for each point. And if that data changes, you have to write the code which adds circles, removes circles, or animates the update of existing circles with the new corresponding data.

D3 is a general library to help you write that code, but it assumes you are working with DOM objects. It will create/remove/update HTML, SVG, or VML elements -- whatever you want. D3 is not a renderer abstraction library like Raphaël; it is a data to DOM mapper.

You could make something like D3 for Raphaël, but it makes sense to just assume you have SVG support now. You get to use its groups, CSS, and standard DOM events, without reinventing those wheels.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: