explaingit

d3/d3-voronoi

Analysis updated 2026-07-25 · repo last pushed 2019-10-01

250JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

TLDR

A JavaScript library that divides a surface into regions around given points, creating Voronoi diagrams and Delaunay triangulations for data visualization. It is deprecated in favor of d3-delaunay.

Mindmap

mindmap
  root((repo))
    What it does
      Divides surface into regions
      Finds nearest point
      Creates Delaunay triangulation
    Use cases
      Interactive charts and maps
      Hover areas for small dots
      Non-overlapping label placement
    Tech stack
      JavaScript
    Audience
      Visualization developers
    Status
      Deprecated
      Replaced by d3-delaunay

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Make small data points on a scatterplot easier to hover over or click by giving each a larger surrounding area.

USE CASE 2

Position labels on a chart or map so they do not overlap.

USE CASE 3

Find the nearest data point to any spot a user clicks.

USE CASE 4

Determine which points in a dataset are neighbors of each other.

What is it built with?

JavaScript

How does it compare?

d3/d3-voronoijaimeisme/comfystudionodejs/postject
Stars250251247
LanguageJavaScriptJavaScriptJavaScript
Last pushed2019-10-012024-12-21
MaintenanceDormantStale
Setup difficultyeasyhardmoderate
Complexity2/54/53/5
Audiencedeveloperdesignerdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Note that this library is deprecated, the authors recommend using the newer d3-delaunay replacement instead.

The license is not specified in the repository explanation.

In plain English

D3-voronoi is a JavaScript library that takes a set of points on a flat surface and divides that surface into regions, so that every spot in a given region is closest to the point it belongs to. This division is called a Voronoi diagram. If you have ever seen a map that looks like it is cracked into irregular shapes, where each shape centers on a city or data point, that is what this tool creates. Behind the scenes, the library uses a classic algorithm by Steven J. Fortune to draw the boundaries between these regions. You give it a list of coordinates, and it hands back the polygon shapes, the lines between them, or a related structure called a Delaunay triangulation, which is a mesh of triangles connecting nearby points. You can also ask it to find the nearest point to any spot you click. People building interactive charts and maps use this to make small data points easier to hover over or click. For example, The New York Times used it in a baseball visualization so that even tiny dots on a scatterplot had a large, easy-to-hit surrounding area. It is also handy for positioning labels so they do not overlap, or for figuring out which points are neighbors of each other. One notable thing about this project is that it is deprecated. The authors recommend a newer, faster, and more robust replacement called d3-delaunay. That said, this older library still works and offers a straightforward set of tools for anyone who needs to reason about the space between points.

Copy-paste prompts

Prompt 1
Using d3-voronoi, write a function that takes an array of x/y coordinates and returns the Voronoi polygons for each point.
Prompt 2
Create a scatterplot where each data point has a large, easy-to-hover Voronoi cell around it using d3-voronoi, similar to The New York Times baseball visualization.
Prompt 3
How do I use d3-voronoi to find the nearest point in my dataset to a specific mouse click coordinate?
Prompt 4
Using d3-voronoi, compute the Delaunay triangulation for a set of points and render the triangle mesh on an SVG canvas.

Frequently asked questions

What is d3-voronoi?

A JavaScript library that divides a surface into regions around given points, creating Voronoi diagrams and Delaunay triangulations for data visualization. It is deprecated in favor of d3-delaunay.

What language is d3-voronoi written in?

Mainly JavaScript. The stack also includes JavaScript.

Is d3-voronoi actively maintained?

Dormant — no commits in 2+ years (last push 2019-10-01).

What license does d3-voronoi use?

The license is not specified in the repository explanation.

How hard is d3-voronoi to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is d3-voronoi for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.