Home
<!doctype html> <html> <head> <script src="https://d3js.org/d3.v4.min.js"></script> </head> <body> <script> var width = 500; var height = 500; //Create SVG element var svg = d3.select("body") .append("svg") .attr("width", width) .attr("height", height); //Create and append rectangle element svg.append("rect") .attr("x", 0) .attr("y", 0) .attr("width", 200) .attr("height", 100) </script> </body> </html>
Result: