4 ms·
I'd argue that much of D3's power comes not from the update pattern for DOM elements, but the reusable components pattern. http://bost.ocks.org/mike/chart/ htt
by oscilloscope 12y ago
I'd argue that much of D3's power comes not from the update pattern for DOM elements, but the reusable components pattern.
http://bost.ocks.org/mike/chart/ http://bost.ocks.org/mike/chart/
Examples in the core library, all compatible with Canvas, include scales, layouts, geographic projections, time/color utilities, CSV/TSV loading, and behaviors (drag/zoom/etc). There's some built-in canvas rendering like d3.geo.path which can be provided a canvas context.
The only things you lose are selections and the convenient transitions that go along with selections. But you can use these to modify and transition the canvas elements themselves!
- cls59 12y agoIn most cases you also loose the ability to specify graphic components declaratively through .append() and .attr(). Instead, you must imperatively specify how to produce the drawing from the data by manipulating the canvas context. I have use d3 to create composite graphics that included elements rendered to canvas and it certainly is powerful. But, I still believe that the sweet spot of the library requires being able to work with the DOM and CSS.