D3.js brush.on() Function
The brush.on() function in D3.js is used to set the event listener for the specified typenames and returns the brush.
brush.on( typenames, listener )
Parameters: This function accepts two parameters as mentioned above and described below:
- typenames: It is the string containing one or more typenames separated by whitespace.
- listener: It is the function to be used as the event listener for the specified typenames. It is an optional parameter.
Return Value: This function returns the brush to be used.
Below programs illustrate the brush.on() function in D3.js: