Brushes can be used to draw a barchart. This gives an easy way to input or adjust values with the mouse !!!
The d3 brush is a complex piece of logic taking care of events and user feed-backs. Among other characterics it exposes a nice selection rectangle which can be used as a bar !!!
2D-brushes come in two flavors see official API v4 doc
Let's try both of them on this example.
Code is made of:
Enjoy !!
https://d3js.org/d3.v4.min.js