Socket
Socket
Sign inDemoInstall

@types/d3-brush

Package Overview
Dependencies
1
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-brush


Version published
Weekly downloads
1.4M
decreased by-8.68%
Maintainers
1
Install size
79.9 kB
Created
Weekly downloads
 

Package description

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

Readme

Source

Installation

npm install --save @types/d3-brush

Summary

This package contains type definitions for d3-brush (https://github.com/d3/d3-brush/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-brush.

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: @types/d3-selection

Credits

These definitions were written by Tom Wanzek, Alex Ford, Boris Yankov, and Nathan Bierema.

FAQs

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc