D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
greenmna
Full window
Github gist
The basics of Shapes in SVG
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <script> // Edit the code below to change me! var svg = d3.select("body").append("svg") .attr("width", 960) .attr("height", 540) svg.append("rect") .attr("fill", "white") .attr("stroke", "black") .attr("width", 150) .attr("height", 100) .attr("x", 100) .attr("y", 200) svg.append("circle") .attr("r", 25) .attr("cx", 175) .attr("cy", 250) .attr("fill", "red") svg.append("rect") .attr("fill", "cadetblue") .attr("stroke", "black") .attr("width", 150) .attr("height", 100) .attr("x", 400) .attr("y", 200) svg.append("rect") .attr("fill", "yellow") .attr("stroke", "black") .attr("width", 150) .attr("height", 40) .attr("x", 400) .attr("y", 230) svg.append("polygon") .attr("fill", "black") .attr("width", 50) .attr("height", 50) .attr("points", "485,253 401,299 399,201") </script> </body>
https://d3js.org/d3.v4.min.js