Skip to main content
100%

Brush Slider Test

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 3, 2018
Created on Sep 3, 2018

This example demonstrates a brush-style slider that filters a numeric range, displaying the selected minimum and maximum values as text above the axis. Rendered as SVG, it uses D3 v4’s `d3.brushX()` to create the interactive selection and `d3.brushSelection` to read the current range. The x-axis is generated with `d3.axisBottom` and a linear scale, with the brush initially positioned between 20 and 50 via `brush.move`. The code also notes key API changes from D3 v3 to v4, such as handling brush extents on the brushed element.

AI-generated description

Update 1/27/2017

This has been updated to d3.js v4 with comments explaining some of the changes. Brushes have been one of the more difficult aspects of moving from v3 to v4, but updating this block has clarified a lot for me.


Testing a brush-style slider, loosely based on Mike Bostock's <a href="https://bl.ocks.org/mbostock/4349545">Brush Handles example.</a>

The number feedback at the top can be sent to a chart as a filter.

forked from <a href='http://bl.ocks.org/alexmacy/'>alexmacy</a>'s block: <a href='http://bl.ocks.org/alexmacy/eb284831aff6f9d0119b'>Brush Slider Test</a>

forked from <a href='http://bl.ocks.org/jerryorta-dev/'>jerryorta-dev</a>'s block: <a href='http://bl.ocks.org/jerryorta-dev/c87e857e01071197ac693e7de5cb2cc4'>Brush Slider Test</a>

mit Licensed

Similar vizzes