Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 5, 2024 via pnpm

d3-selection 1.4.2

Data-driven DOM manipulation: select elements and join them to data.
Package summary
Share
0
issues
1
license
1
BSD-3-Clause
Package created
26 May 2015
Version published
23 Jul 2020
Maintainers
2
Total deps
1
Direct deps
0
License
BSD-3-Clause

Issues

0
This package has no issues

Licenses

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
d3-selection@1.4.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of d3-selection 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does d3-selection do?

d3-selection is a JavaScript library that provides a flexible way of interacting with the Document Object Model (DOM). This library allows you to select elements and bind them to data, transforming the DOM based on the data and user interaction. Users can set attributes, styles, properties, HTML, or text content using this library, and join elements to data. It is particularly useful for data-driven transformations of the DOM.

How do you use d3-selection?

To make use of d3-selection, start by installing it via npm using the command npm install d3-selection. Once installed, you can import it into your JavaScript file via the import statement. This library provides various methods for selecting, appending, and manipulating DOM elements. A typical usage pattern can be seen below:

import * as d3 from 'd3-selection';

// Select elements and apply transformations
d3.selectAll("p") 
    .attr("class", "graf") 
    .style("color", "red");

// This is equivalent to:
const p = d3.selectAll("p");
p.attr("class", "graf");
p.style("color", "red");

In the example above, all paragraph elements in the current document are selected and have the class "graf" and color "red" applied to them.

You might also use the .append method to append new elements:

import * as d3 from 'd3-selection';

d3.select("body") 
  .append("svg")
    .attr("width", 960)
    .attr("height", 500)
  .append("g")
    .attr("transform", "translate(20,20)")
  .append("rect")
    .attr("width", 920)
    .attr("height", 460);

In this second example, an SVG element is appended to the body, and various transformations and additions are chained using method chaining.

Where are the d3-selection docs?

You can find the d3-selection documentation on the d3-selection GitHub page. The page contains comprehensive information about every feature of the library, from installing, selecting elements, modifying elements, joining data, handling events, control flow, local variables, to namespaces. Each section contains examples showing how to use the particular feature. Browse through the different sections in the API Reference portion to fully understand how to use d3-selection.