D3.js Is Way More Than Just Another Visualization Framework
Join the DZone community and get the full member experience.
Join For FreeIf you're an experienced web developer, you probably (a) are intimately familiar with the DOM, and (b) still find data-driven JavaScript apps a little unusual.
You may know about how Backbone.js has brought MVC architecture to the web -- and if you like data-driven programming, but aren't already using Backbone, you really need to check it out. (And if you're thinking about Backbone but can't quite dive fully into its particular brand of JavaScript MVC: DZone is hoping to publish a Backbone Refcard some time soon, so stay tuned!)
But even if you already develop web apps that handle lots of data, you may still think of complex visualization as a thin skin on top of the DOM.
Well, not so thin with Mike Bostock's D3.js in town. ('D3' = 'Data-Driven Documents'.)
In the abstract, D3's idea is simple:
D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. As a trivial example, you can use D3 to generate a basic HTML table from an array of numbers. Or, use the same data to create an interactive SVG bar chart with smooth transitions and interaction.
But the design details and syntax get pretty weird pretty quick, at least to the dev-eye still habituated to the notion that 'visualization is a thin skin'.
So, for instance, when I first ran into D3, I felt an immediate surge of excitement, followed by a quick back-burnering, sensing that programming with D3 would require a bit of a brain-paradigm shift.
But if you think data-driven documents sound cool,and want to learn more quickly, check out this talk by Mike Dewar (from a recent New York Open Statistical Programming Meetup):
Mike hacks an impressively systematic, extremely clear path straight from JSON data through a prettily-formatted document. Well worth the 56 minutes (especially with all Mike's code samples on github).
Finally, when you're a little more comfortable with the API, here's a neat D3.js playground for you (complete with CSS editor), with a few notes from the creator.
Tons of fun, and potentially extremely useful tool. Enjoy!
Opinions expressed by DZone contributors are their own.
Comments