Skip to main content
100%

interactive svg + canvas plot

✓ Published0🌍 Public
MMbrownshoes
Last edited Nov 1, 2017
Created on Nov 1, 2017

This interactive plot demonstrates the combination of SVG and Canvas rendering in a single D3 visualization, with blue circles drawn as SVG nodes and black circles drawn on a Canvas layer. A shared force-directed layout, created using `d3.layout.force`, moves all 200 nodes together, with collision detection handled through a quadtree (`d3.geom.quadtree`) to prevent overlap. The visualization supports pan and zoom via `d3.behavior.zoom`, which scales the linear projective x and y mappings and triggers a redraw of both the SVG and Canvas layers.

AI-generated description

A 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>

mit Licensed

Similar vizzes