D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
estebanafonso
Full window
Github gist
LEGO SVG
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>LEGO Data!!!</title> <script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script> </head> <body> <svg width="1000" height="800"> <rect x="50" y="450" width="75" height="100" fill="#70B8FF" /> <rect x="50" y="350" width="75" height="100" fill="#F7F7F7" /> <rect x="50" y="250" width="75" height="100" fill="#FFFF4D" /> <rect x="57" y="240" width="25" height="10" fill="#FFFF4D" /> <rect x="93" y="240" width="25" height="10" fill="#FFFF4D" /> <rect x="170" y="350" width="75" height="200" fill="#B8E6B8" /> <rect x="170" y="275" width="75" height="75" fill="#FFFF4D" /> <rect x="170" y="75" width="75" height="200" fill="#0066FF" /> <rect x="177" y="65" width="25" height="10" fill="#0066FF" /> <rect x="213" y="65" width="25" height="10" fill="#0066FF" /> <rect x="290" y="500" width="75" height="50" fill="#3399FF" /> <rect x="290" y="450" width="75" height="50" fill="#FF3300" /> <rect x="290" y="400" width="75" height="50" fill="#FFFF4D" /> <rect x="297" y="390" width="25" height="10" fill="#FFFF4D" /> <rect x="333" y="390" width="25" height="10" fill="#FFFF4D" /> <rect x="410" y="500" width="75" height="50" fill="#FF6600" /> <rect x="410" y="450" width="75" height="50" fill="#FF6600" /> <rect x="410" y="400" width="75" height="50" fill="#FFFF4D" /> <rect x="417" y="390" width="25" height="10" fill="#FFFF4D" /> <rect x="453" y="390" width="25" height="10" fill="#FFFF4D" /> <rect x="530" y="475" width="75" height="75" fill="#33CCFF" /> <rect x="530" y="425" width="75" height="50" fill="#FFFF4D" /> <rect x="537" y="415" width="25" height="10" fill="#FFFF4D" /> <rect x="575" y="415" width="25" height="10" fill="#FFFF4D" /> </svg> <script type="text/javascript"> //Load in contents of CSV file d3.csv("lego.csv", function(data) { //Now CSV contents have been transformed into //an array of JSON objects. //Log 'data' to the console, for verification. console.log(data); }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js