Skip to main content
100%

Multiple polygons with d3.js

✓ Published0🌍 Public
SSokrates86
Last edited Feb 26, 2013
Created on Jan 12, 2016

Three polygons render in a fixed 960 by 700 SVG canvas, with each polygon’s vertices scaled from x,y coordinates in JSON data to pixel positions using `d3.scale.linear`. The example loads `polygons.json` via `d3.json`, binds the polygon array to SVG elements, and sets each `polygon`’s `points` attribute by mapping coordinate pairs through the scales. All polygons share a black stroke with a width of two pixels. The code uses D3 v3’s selection and data-join patterns, with no interactivity or animation present.

AI-generated description

Similar vizzes