Most of your D3 applications will render graphics using SVG, but several shape generators in SVG can also generate Canvas, and you may choose to use Canvas in all or part of your application to improve performance if you have memory problems due to excessive objects created in the DOM.
This section provides a brief overview of the Canvas API, listing the methods you are most likely to use and some examples that can be compared to the ones created for SVG.
To draw using Canvas you need to create a <canvas> element in your page. You can do that using plain HTML:
<body>
<canvas id="canvas" width="400" height="300"></canvas>
</body>
Or using D3:
d3.select("body").append("canvas").attr("width", 400).attr("height", 300);
If you declare the Canvas element in HTML, you can...