Advanced filtering using brushes

In the previous section, we saw that D3.js can handle all the filtering action with solely modifying the domain and range attributes of the axis object. Filtering and selecting data is a common task in data visualization; therefore, D3.js implements a much more advanced filtering method called brushes.

A brush is a D3.js module initialized with an x and/or a y axis scale and automatically creates a draggable and resizeable box on top of a visualization container. While dragging and resizing this box, the brush automatically adapts the range and domain of the axis scales. A brush often looks similar to the following image:

Filtering time scale axis with a brush

This brush looks really cool as a filter; we also want ...

Get Data Visualization with D3 and AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.