Wiki ▸ [[API Reference]] ▸ [[Geometry]] Polygon
A Polygon is a set of line segments that form a closed path, such that the end of the last line segment is the beginning of the first. Polygons require 3 or more points in order to have an area or centroid.
# d3.geom.polygon([vertices])
Returns a polygon with points at the specified vertices.
# polygon.area()
Returns the area of the polygon.
# polygon.centroid()
Returns the centroid of the polygon. The centroid as calculated by D3 is the average coordinate value of the points of the polygon.