interactive svg + canvas plot
An interactive plot combines 200 randomly positioned circles, with half rendered as blue SVG elements and half as black canvas shapes. A single d3.layout.force simulation drives collision detection and movement for all nodes, while d3.behavior.zoom enables panning and zooming. The SVG circles update via attribute transforms, and the canvas layer redraws its context on every tick.
AI-generated descriptionA D3 demonstration of SVG and Canvas intermingling. Blue circles are plotted in SVG, black circles in canvas. One force to rule them all. The plot is zoomable and pannable.
Inspired by M. Bostock's Canvas / SVG zoom comparison series and collision detection examples [1] [2] .
forked from <a href='http://bl.ocks.org/sxv/'>sxv</a>'s block: <a href='http://bl.ocks.org/sxv/4485778'>Interactive SVG + Canvas Plot</a>