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> <style type="text/css"> svg { background-color: #FFFFED; } </style> </head> <body> <svg width="1200" height="525"> <rect x="50" y="400" width="75" height="100" fill="#70B8FF" /> <rect x="50" y="300" width="75" height="100" fill="#F7F7F7" /> <rect x="50" y="200" width="75" height="100" fill="#FFFF4D" /> <rect x="57" y="190" width="25" height="10" fill="#FFFF4D" /> <rect x="93" y="190" width="25" height="10" fill="#FFFF4D" /> <rect x="170" y="300" width="75" height="200" fill="#B8E6B8" /> <rect x="170" y="225" width="75" height="75" fill="#FFFF4D" /> <rect x="170" y="25" width="75" height="200" fill="#0066FF" /> <rect x="177" y="15" width="25" height="10" fill="#0066FF" /> <rect x="213" y="15" width="25" height="10" fill="#0066FF" /> <rect x="290" y="450" width="75" height="50" fill="#3399FF" /> <rect x="290" y="400" width="75" height="50" fill="#FF3300" /> <rect x="290" y="350" width="75" height="50" fill="#FFFF4D" /> <rect x="297" y="340" width="25" height="10" fill="#FFFF4D" /> <rect x="333" y="340" width="25" height="10" fill="#FFFF4D" /> <rect x="410" y="450" width="75" height="50" fill="#FF6600" /> <rect x="410" y="400" width="75" height="50" fill="#FF6600" /> <rect x="410" y="350" width="75" height="50" fill="#FFFF4D" /> <rect x="417" y="340" width="25" height="10" fill="#FFFF4D" /> <rect x="453" y="340" width="25" height="10" fill="#FFFF4D" /> <rect x="530" y="425" width="75" height="75" fill="#33CCFF" /> <rect x="530" y="375" width="75" height="50" fill="#FFFF4D" /> <rect x="537" y="365" width="25" height="10" fill="#FFFF4D" /> <rect x="575" y="365" 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