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

@types/d3-sankey

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-sankey

TypeScript definitions for d3-sankey

  • 0.12.4
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/d3-sankey?

@types/d3-sankey provides TypeScript type definitions for the d3-sankey library, which is used to create Sankey diagrams. Sankey diagrams are a type of flow diagram in which the width of the arrows is proportional to the flow rate. This package helps developers use d3-sankey with TypeScript by providing type definitions.

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

Creating a Sankey Diagram

This code demonstrates how to create a basic Sankey diagram using the d3-sankey library. The `sankey` function is used to generate the diagram from a graph object containing nodes and links.

const sankey = d3.sankey();
const graph = {
  nodes: [
    { name: 'A' },
    { name: 'B' },
    { name: 'C' }
  ],
  links: [
    { source: 0, target: 1, value: 10 },
    { source: 1, target: 2, value: 5 }
  ]
};
const sankeyGraph = sankey(graph);

Customizing Node Width

This code shows how to customize the width of the nodes in the Sankey diagram. The `nodeWidth` method is used to set the width of the nodes.

const sankey = d3.sankey().nodeWidth(20);
const graph = {
  nodes: [
    { name: 'A' },
    { name: 'B' },
    { name: 'C' }
  ],
  links: [
    { source: 0, target: 1, value: 10 },
    { source: 1, target: 2, value: 5 }
  ]
};
const sankeyGraph = sankey(graph);

Setting Node Padding

This code demonstrates how to set the padding between nodes in the Sankey diagram. The `nodePadding` method is used to specify the padding.

const sankey = d3.sankey().nodePadding(10);
const graph = {
  nodes: [
    { name: 'A' },
    { name: 'B' },
    { name: 'C' }
  ],
  links: [
    { source: 0, target: 1, value: 10 },
    { source: 1, target: 2, value: 5 }
  ]
};
const sankeyGraph = sankey(graph);

Other packages similar to @types/d3-sankey

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