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

d3-selection

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-selection

Data-driven DOM manipulation: select elements and join them to data.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5M
increased by3.48%
Maintainers
2
Weekly downloads
 
Created

What is d3-selection?

The d3-selection package is a part of the D3.js library, which is used for manipulating documents based on data. It provides powerful tools for selecting elements, binding data to them, and applying transformations to the document.

What are d3-selection's main functionalities?

Selecting Elements

This feature allows you to select DOM elements and apply styles or other transformations to them. In this example, the background color of the body element is changed to light blue.

d3.select('body').style('background-color', 'lightblue');

Binding Data

This feature allows you to bind data to DOM elements and use that data to drive transformations. In this example, the font size of each paragraph element is set based on the bound data.

d3.selectAll('p').data([4, 8, 15, 16, 23, 42]).style('font-size', function(d) { return d + 'px'; });

Entering and Exiting Elements

This feature allows you to handle data-driven creation and removal of elements. In this example, new paragraph elements are created for each data point that does not already have a corresponding paragraph.

var p = d3.select('body').selectAll('p').data([4, 8, 15, 16, 23, 42]);
p.enter().append('p').text(function(d) { return 'New paragraph with data: ' + d; });

Other packages similar to d3-selection

Keywords

FAQs

Package last updated on 23 Aug 2020

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