Skip to main content
100%

Lasso in d3 v4 with Canvas

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 4, 2018
Created on Sep 4, 2018

A lasso tool selects and recolors randomly distributed points rendered on an HTML canvas. Dragging the cursor draws a dashed polygon on an overlaid SVG layer, which closes when the cursor nears its starting point. On completion, `d3.polygonContains` filters points inside the selection, recoloring chosen points black and unselected ones light gray. The visualization uses D3 v4’s drag behavior for interaction, `canvas` for point rendering, and SVG for the lasso path.

AI-generated description

Lasso with d3 v4 and canvas

Example of a lasso technique using data drawn on canvas (or really anywhere) and an SVG interaction layer for drawing the lasso.

Click and drag to select nodes.

Excuse my laziness in the dist files. I coded lasso.js and script.js and then ran buble to compile them for the block.

forked from <a href='http://bl.ocks.org/pbeshai/'>pbeshai</a>'s block: <a href='http://bl.ocks.org/pbeshai/8008075f9ce771ee8be39e8c38907570'>Lasso with d3 v4 and Canvas</a>

mit Licensed

Similar vizzes