.extent()property specify the area where it is possible to brush: top left and bottom right corners of the rectangle.
d3.brushand you get a 1 dimensional brush.
.on("start end", ...)
.on("start end", ...)when the brush is created. This will trigger the function
updateCharteach time a new brush is made.
selectedclass is added to the circle if it is in the selection.
.classedfunction is very handy since it automatically removes the class if elements are not in the selection anymore.
clipPathis used to avoid displaying the circle outside the chart area.
all(brush.move, null)is used to dismiss the grey brushing area once the selection has been done.