D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
connieGao0819
Full window
Github gist
Spatial region By JianiGao
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <title>Spatial region</title> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <!-- There are more than one method to create the given marks. An easy way of implementation is simply use <rect> label within <svg>. The HTML code below will do the same job as the D3.js script. <svg width="960" height="500"> <rect x="10" y="20" width="20" height="20"/> <rect x="45" y="40" width="40" height="40"/> <rect x="100" y="10" width="60" height="60"/> </svg> --> <script> // Feel free to change or delete any of the code you see in this editor! var svg = d3.select("body").append("svg") .attr("width", 960) .attr("height", 500) svg.append("rect") .attr("x", 10) .attr("y", 20) .attr("width", 20) .attr("height", 20) svg.append("rect") .attr("x", 40) .attr("y", 40) .attr("width", 40) .attr("height", 40) svg.append("rect") .attr("x", 100) .attr("y", 10) .attr("width", 60) .attr("height", 60) </script> </body>
https://d3js.org/d3.v4.min.js