D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
jrzief
Full window
Github gist
Basic Shapes
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> <div id=shapes> </div> <script> var svg = d3.select("#shapes") .append("svg") .attr("width", 500) .attr("height", 400); svg.append("line") .attr("x1", 20) .attr("y1", 70) .attr("x2", 100) .attr("y2", 350) .attr("stroke", "brown") .attr("stroke-width", 5); svg.append("rect") .attr("x", 200) .attr("y", 50) .attr("width", 240) .attr("height", 120) .attr("fill", "blue") svg.append("circle") .attr("cx", 200) .attr("cy", 260) .attr("r", 60) .attr("fill", "purple") svg.append("ellipse") .attr("cx", 350) .attr("cy", 250) .attr("rx", 50) .attr("ry", 70) .attr("fill", "yellow"); </script> </body>
https://d3js.org/d3.v4.min.js