npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

d3-network-time

v0.2.1

Published

a d3 plugin to create a temporal network

Readme

d3-network-time

This is a d3 plugin to create a temporal network visualization.

d3-force is used to construct the graph layout. This plugin can be used in two ways:

  • dynamic: animates the evolution of the network over time, with the option to display each iteration between dates, or just a single step transition between two dates
  • static: only displays the network at a specific point in time

alt text

Examples

  • an example for a highly connected graph
  • an example for a disjointed graph, showing how to use the API with element styling

Installing

If you use NPM, npm install d3-network-time and import it with

import { network } from "d3-network-time"

Otherwise, download the latest build. AMD, CommonJS, and vanilla environments are supported. In vanilla, you must include a script tag with the d3 library before including d3-network-map.js, and a d3 global is exported:

<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="d3-network-map.js"></script>
<script>
  var network = d3.network()

  var simulation = d3.forceSimulation()

  var radiusScale = d3.scaleSqrt().domain([1, 50]).range([3, 25])
  var radiusAccessor = (d) => radiusScale(d.value)

  network(simulation)
    .selector(".Network")
    .width(1200)
    .height(800)
    .start(1217567877)
    .end(1218036494)
    .animation({ mode: "auto", step: "day", show_time: true })
    .style({ radiusAccessor })(data)
</script>

API Reference

# d3.network()

Constructs a new network generator with the default configuration values.

# network(data)

Creates a network layout with the specified data. The animation starts automatically.

The dataset must contain an object of nodes and links with the following attributes:

Timestamps of nodes and links must be in UNIX Epoch time.

var data = {
  nodes: [
    {
      id: "1",
      date: 1217567877000,
    },
    {
      id: "2",
      date: 1217567877000,
    },
    {
      id: "3",
      date: 1218036494000,
    },
  ],
  links: [
    {
      start_id: "1",
      end_id: "2",
      date: 1217567877000,
    },
    {
      start_id: "1",
      end_id: "3",
      date: 1218036494000,
    },
  ],
}

# network([simulation])

This is the new simulation to initialize. Users can specify forces to layout the graph according to their requirements. Nodes and edges should not be specified here.

# network.selector([selector])

This is the CSS selector for the div element containing the svg element in which the network is rendered in.

# network.height([height])

This height gives the height of the svg element in which the network is rendered in. If height is not specified, it defaults to 800 pixels.

# network.width([width])

This width gives the width of the svg element in which the network is rendered in. If width is not specified, it defaults to 800 pixels.

# network.start([start])

start represents the date (a UNIX Epoch timestamp) which the animation begins at. If start is not specified, returns the first date found in data.links.

# network.end([end])

end represents the date (a UNIX Epoch timestamp) which the animation stops. If end is not specified, returns the last date found in data.links.

# network.animation([animation])

The animation represents the animation parameters. If animation is not specified, it defaults to {mode: null, step: 'day', show_time: false}. This is a static render of graph only at the specified start value, ignoring the end value, if provided.

If animation.mode is 'auto', the animation runs upon function invocation, displaying each iteration between a range of dates between start and end value. If style.mode is 'step', then only a transition between start and end value is displayed.

animation.step: represents the time iteration gap and has to be any of the following values: ['year', 'month', 'day', 'week', 'hour', 'minute', 'second', 'millisecond']

animation.show_time: allows user to show or hide the timestamp header

# network.style([style])

The style represents the style of the graph elements. If style is not specified, it defaults to the styles specified in consts.js. Some attributes such as node and edge color and opacity have to be represented as accessors, while some attributes such as text size and color are represented as a single value.

npm version history:

0.0.1-0.0.3: Time iteration based on YYYY-MM-DD datetime string 0.1.0: Time iteration based on UNIX epoch timstamp 0.2.0: Allow user to style graph elements and customize force-directed layout