D3.js brushY() Function
Last Updated :
31 Jul, 2020
The d3.brushY() function in D3.js is used to create a new one-dimensional brush along the y-dimension.
Syntax:
d3.brushY();
Parameters: This function does not accept any parameters.
Return Value: This function returns a newly created One Dimensional brush along the y-axis
Example: In this example, we will create a One Dimensional brush along with the y-axis brush of size 600×600 pixels on an SVG element using this method.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
D3.js | d3.brushY() Function
</ title >
< script src =
</ script >
</ head >
< body >
< svg width = 600 height = 600 id = "brush" ></ svg >
< script >
// Selecting SVG element
d3.select("#brush")
// Creating a brush along y-axis
// using the d3.brush function
.call( d3.brushY()
// Initialise the brush area: start at
// 0,0 and finishes at given width,height
.extent( [ [0,0], [600,600] ] )
)
</ script >
</ body >
</ html >
|
Output:
Reference: https://devdocs.io/d3~5/d3-brush#brushY
Share your thoughts in the comments
Please Login to comment...