Accepted answer

I never used d3.lasso before but looking at this bl.ock using d3 v4, looks like your code is missing a few minor things:

  1. Area to be passed to d3 lasso is now done using targetArea

     var lasso = d3.lasso()
  2. Items passed to d3 lasso must be a d3 selection and not a string

    var circles = svg.selectAll("circle")...
    var lasso = d3.lasso()

And of course, using the actual minified lasso code in a script tag, here's a snippet:

Also, I've added some CSS to the selected circles just to differentiate when compared with others:

.selected {
   fill: steelblue;

Hope this helps.

Related Query