4 ms·
What is your specific use case for using Canvas along with D3?
by npalli 13y ago
What is your specific use case for using Canvas along with D3?
- crm416 13y agoSeconded--canvas support would be great. I too had to mix D3 with some canvas drawing. The specific use case was that I had a number of diagrams, most of which were handled by D3, but one of which required pixel-by-pixel rendering (i.e., each pixel in the canvas was colored according to some data).
- sophacles 13y agoRight now everything I want to do is capable of being done reasonably well in SVG, however, there has been talk of effects that we wish to add that are easier done in canvas. We are doing a graph diagram using force directed layout, and are displaying various overlays of paths through the graph based on input data parameters. As I mentioned, this is currently all fine in SVG, however, we'd like to in the future be able to make those overlays a bit more dynamic in the graphic sense - by adding some effects that canvas makes easy. Also, our future drawing of the graph will include enough custom shapes and images/sprites that the canvas context + drawing objects will result in cleaner code than the equivalent SVG operations. Also, and this part is a personal bias, I just dislike SVG and it's DOM for runtime graphics manipulation, and prefer the canvas API for it.
- ph0rque 13y agoWe are doing a graph diagram using force directed layout... Can you provide a link to this?
- npalli 13y agoThanks for the detailed comment. As you might imagine, I think the killer feature of D3 is the binding of data to the DOM and all the awesome manipulation that is possible (via CSS/javascript/jquery etc.). It also happens to scale very well for us. So I look for examples where Canvas is a better fit.
- enoex1 13y agocanvas can better handle drawing thing which involve tons of objects, as you're working with pixels instead of DOM elements. here's an example of canvas being used for parallel coordinates: http://bl.ocks.org/syntagmatic/2420080 http://bl.ocks.org/syntagmatic/2420080