Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptD3.js brushY() Function

D3.js brushY() Function

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
        "https://d3js.org/d3.v4.min.js"
    </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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments