This JS+D3 gist creates a scatterplot with zooming and panning enabled as well as a brush for selecting or deselecting points using the iris dataset within data.tsv.
The "Get Selection" button gets the current selection of points and prints their ids to the JS console (i.e. console.log(selection);).
The "Clear Selection" button clears the current selection.