Socket
Socket
Sign inDemoInstall

@types/d3-force

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-force

TypeScript definitions for d3-force


Version published
Weekly downloads
1.7M
decreased by-3.67%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-force?

@types/d3-force provides TypeScript type definitions for the d3-force module, which is part of the D3.js library. D3-force is used for creating and managing force-directed graphs, which are a type of network visualization where nodes are positioned based on physical simulation of forces.

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

Force Simulation

This feature allows you to create a force simulation with nodes. The simulation applies forces to the nodes, such as charge and centering forces, to position them in a visually appealing way.

const simulation = d3.forceSimulation(nodes)
  .force('charge', d3.forceManyBody())
  .force('center', d3.forceCenter(width / 2, height / 2));

Force Links

This feature allows you to create links between nodes in the force simulation. The links can have properties such as distance, which determines how far apart the nodes should be.

const linkForce = d3.forceLink(links)
  .id(d => d.id)
  .distance(50);
simulation.force('link', linkForce);

Force Collide

This feature adds a collision force to the simulation, which prevents nodes from overlapping by specifying a radius for each node.

const collideForce = d3.forceCollide(10);
simulation.force('collide', collideForce);

Force X and Y

These features allow you to apply forces that pull nodes towards specific x and y coordinates, respectively. The strength of the force can be adjusted.

const forceX = d3.forceX(width / 2).strength(0.1);
const forceY = d3.forceY(height / 2).strength(0.1);
simulation.force('x', forceX).force('y', forceY);

Other packages similar to @types/d3-force

FAQs

Package last updated on 17 Jun 2024

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