Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/d3-brush

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-brush

TypeScript definitions for d3-brush

  • 1.1.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8M
decreased by-0.3%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-brush?

@types/d3-brush provides TypeScript type definitions for the d3-brush module, which is part of the D3.js library. The d3-brush module allows for the creation of interactive brushing and linking features in data visualizations, enabling users to select and highlight specific regions of a chart.

What are @types/d3-brush's main functionalities?

Creating a Brush

This code initializes a basic brush. A brush is an interactive selection tool that allows users to select a region within a chart.

const brush = d3.brush();

Setting Brush Extent

This code sets the extent of the brush, defining the area within which the brush can be used. The extent is defined by two points: the top-left and bottom-right corners.

brush.extent([[0, 0], [width, height]]);

Handling Brush Events

This code attaches event listeners to the brush for 'brush' and 'end' events. The 'brushed' function is called whenever the brush is moved or resized, allowing you to handle the selection.

brush.on('brush end', brushed);

function brushed(event) {
  const selection = event.selection;
  // Handle the brush selection
}

Applying Brush to an SVG Element

This code applies the brush to an SVG element. The brush is appended to a group element within the SVG, and the 'call' method is used to apply the brush behavior to the group.

d3.select('svg').append('g').attr('class', 'brush').call(brush);

Other packages similar to @types/d3-brush

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc