Gathering detailed insights and metrics for d3-voronoi
Gathering detailed insights and metrics for d3-voronoi
Gathering detailed insights and metrics for d3-voronoi
Gathering detailed insights and metrics for d3-voronoi
d3-delaunay
Compute the Voronoi diagram of a set of two-dimensional points.
@types/d3-voronoi
TypeScript definitions for d3-voronoi
d3-voronoi-map
D3 plugin which computes a map (one-level treemap), based on Voronoi tesselation
d3-geo-voronoi
Spherical Voronoi Diagram and Delaunay Triangulation
Compute the Voronoi diagram of a set of two-dimensional points.
npm install d3-voronoi
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
251 Stars
127 Commits
61 Forks
22 Watchers
2 Branches
6 Contributors
Updated on Jul 10, 2025
Latest Version
1.1.4
Package Id
d3-voronoi@1.1.4
Size
27.72 kB
NPM Version
6.2.0
Node Version
10.8.0
Published on
Aug 24, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
Deprecation notice: Consider using the newer d3-delaunay instead of d3-voronoi. Based on Delaunator, d3-delaunay is 5-10× faster than d3-voronoi to construct the Delaunay triangulation or the Voronoi diagram, is more robust numerically, has Canvas rendering built-in, allows traversal of the Delaunay graph, and a variety of other improvements.
This module implements Steven J. Fortune’s algorithm for computing the Voronoi diagram or Delaunay triangulation of a set of two-dimensional points. This implementation is largely based on work by Raymond Hill.
Voronoi diagrams are not only visually attractive but practical tools for interaction, such as to increase the target area of points in a scatterplot. See “Strikeouts on the Rise” in The New York Times and this multi-line chart for examples; also see Tovi Grossman’s paper on bubble cursors for a related technique. Voronoi diagrams can also be used to automate label positioning, and Delaunay meshes are useful in computing adjacency or grouping of visual elements.
If you use NPM, npm install d3-voronoi
. Otherwise, download the latest release. You can also load directly from d3js.org, either as a standalone library or as part of D3 4.0. AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3
global is exported:
1<script src="https://d3js.org/d3-voronoi.v1.min.js"></script> 2<script> 3 4var voronoi = d3.voronoi(); 5 6</script>
Try d3-voronoi in your browser.
Creates a new Voronoi layout with default x- and y- accessors and a null extent.
Computes the Voronoi diagram for the specified data points.
If x is specified, sets the x-coordinate accessor. If x is not specified, returns the current x-coordinate accessor, which defaults to:
1function x(d) { 2 return d[0]; 3}
If y is specified, sets the y-coordinate accessor. If y is not specified, returns the current y-coordinate accessor, which defaults to:
1function y(d) { 2 return d[1]; 3}
If extent is specified, sets the clip extent of the Voronoi layout to the specified bounds and returns the layout. The extent bounds are specified as an array [[x0, y0], [x1, y1]], where x0 is the left side of the extent, y0 is the top, x1 is the right and y1 is the bottom. If extent is not specified, returns the current clip extent which defaults to null. A clip extent is required when using voronoi.polygons.
An alias for voronoi.extent where the minimum x and y of the extent are ⟨0,0⟩. Equivalent to:
1voronoi.extent([[0, 0], size]);
Returns a sparse array of polygons, one for each unique input point in the specified data points, corresponding to the cells in the computed Voronoi diagram. Equivalent to:
1voronoi(data).polygons();
See diagram.polygons for more detail. Note: an extent is required.
Returns the Delaunay triangulation of the specified data array as an array of triangles. Each triangle is a three-element array of elements from data. Equivalent to:
1voronoi(data).triangles();
See diagram.triangles for more detail.
Returns the Delaunay triangulation of the specified data array as an array of links. Each link has source
and target
attributes referring to elements in data. Equivalent to:
1voronoi(data).links();
See diagram.links for more detail.
The computed Voronoi diagram returned by voronoi has the following properties:
For each set of coincident input points, one of the points is chosen arbitrarily and assigned the associated cell; the other coincident input points’ entries are missing from the returned sparse array.
Returns a sparse array of polygons clipped to the extent, one for each cell (each unique input point) in the diagram. Each polygon is represented as an array of points [x, y] where x and y are the point coordinates, and a data
field that refers to the corresponding element in data. Polygons are open: they do not contain a closing point that duplicates the first point; a triangle, for example, is an array of three points. Polygons are also counterclockwise, assuming the origin ⟨0,0⟩ is in the top-left corner.
For each set of coincident input points, one of the points is chosen arbitrarily and assigned the associated polygon; the other coincident input points’ entries are missing from the returned sparse array.
Returns the Delaunay triangulation of the specified data array as an array of triangles. Each triangle is a three-element array of elements from data. Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the extent, a subset of the Delaunay triangulation is returned.
Returns the Delaunay triangulation of the specified data array as an array of links, one for each edge in the mesh. Each link has the following attributes:
source
- the source node, an element in data.target
- the target node, an element in data.Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the extent, a subset of the Delaunay links is returned.
# diagram.find(x, y[, radius]) <>
Returns the nearest site to point [x, y]. If radius is specified, only sites within radius distance are considered.
See Philippe Rivière’s bl.ocks.org/1b7ddbcd71454d685d1259781968aefc for an example.
# cell
Each cell in the diagram is an object with the following properties:
site
- the site of the cell’s associated input point.halfedges
- an array of indexes into diagram.edges representing the cell’s polygon.# site
Each site in the diagram is an array [x, y] with two additional properties:
index
- the site’s index, corresponding to the associated input point.data
- the input data corresponding to this site.# edge
Each edge in the diagram is an array [[x0, y0], [x1, y1]] with two additional properties:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/24 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
16 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More