a small and simple implementation for a lasso selection in d3.
install with:
bower install -S https://github.com/HendrikStrobelt/d3-simple-lasso.git
initiate it with:
d3lasso(backgroundSelection, overlaySelection, elementsSelection, xAccessor, yAccessor, callback)
the elements are:
- backgroundSelection is a d3 selection of a background
<g>
element (see example.html) where mouse clicks are detected - overlaySelection is a d3 selection of a overlay
<g>
element (see example.html) where the selection polygon is drawn - elementsSelection is a d3 selection that contains the elements to be highlighted
- xAccessor and yAccessor are functions on how to retrieve x and y coordinates from the data object that represent each item. Default is
function(d){return d.y}
- callback is a callback function that is called with the selection of all items in the lasso area. Default is
function(sel){ sel.classed("selected",true); }