D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
rachelwalexander
Full window
Github gist
Spokane county drug sentences, 1990-2013
<!DOCTYPE html> <head> <meta charset="utf-8"> <title>Rachel's SVG</title> <script type="text/javascript" src="https://d3js.org/d3.v3.js"></script> <style type="text/css"> body { background-color: #FFFFFF; } #square { background-color: #000000; } p { font: Helvetica, sans-serif; } </style> </head> <body> <p>These have nothing to do with my data about jail sentences, but I had fun making the square. Check out the console for more!</p> <svg id="square" width="200" height="200"> <line x1="0" y1="0" x2="100" y2="100" stroke="blue" stroke-width="3" /> <line x1="100" y1="0" x2="100" y2="100" stroke="red" stroke-width="3" /> <line x1="200" y1="0" x2="100" y2="100" stroke="green" stroke-width="3" /> <line x1="0" y1="100" x2="100" y2="100" stroke="yellow" stroke-width="3" /> <line x1="0" y1="200" x2="100" y2="100" stroke="purple" stroke-width="3" /> <line x1="100" y1="200" x2="100" y2="100" stroke="orange" stroke-width="3" /> <line x1="200" y1="200" x2="100" y2="100" stroke="pink" stroke-width="3" /> <line x1="200" y1="100" x2="100" y2="100" stroke="white" stroke-width="3" /> </svg> <svg id="circle" height="100" width="100"> <circle cx="50" cy="50" r="20" stroke="purple" stroke-width="1" fill="purple"/> </svg> <script type="text/javascript"> d3.csv("Spokane_drug_sentences.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>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js