Hi,
Afte a logn hiatus I am back to some web development. I was using D3 v3 for svg graphs and now I see that v4 is out. I see many changes and in the documenation it seems 'canvas' is also supported. Was it supported earlier too? Do you prefer canvas over SVG?
Thanks, Rao
D3 is agnostic about the media that you render the data on. As a rule of thumb
If you want easy interactivity (out of the box since these are DOM nodes) + nifty rendering quality go for SVG.
If you want nifty animation that updates many particles, for canvas
Lorefnon
Open Web Enthusiast
D3 does not provide an object model over canvas (similar to paper.js). But you can render your output to canvas through custom renderers and bind them to datasets through d3.
This is illustrated very well by this example that uses both canvas and SVG.
Apart from custom rendering logic as in above there are other approaches towards using using canvas eg. by rendering svg (generated through d3) on canvas through javascript based svg renderers.
The support that you have found in documentation mostly refers to utilities for zooming and panning etc. (d3-zoom) which are very useful for interactive visualizations, and utilities to serialize canvas path commands to svg.
Using canvas can be helpful when the DOM involved in visualization is very complex. This article highlights some interesting use cases.