D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
sjbliss
Full window
Github gist
Module 2: Test SVG and Home Ownership
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Loading CSV Data with D3</title> <script type="text/javascript" src="https://d3js.org/d3.v3.js"></script> </head> <body> <p>Not much to see here; try looking in the console!</p> <p>And here's my SVG image for the exercise....</p> <script type="text/javascript"> d3.csv("home_ownership_MSA.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> <svg width="500" height="500"> <line x1="0" y1="0" x2="50" y2="50" stroke="orange" stroke-width="1" /> <line x1="50" y1="50" x2="0" y2="120" stroke="orange" stroke-width="3" /> <line x1="0" y1="120" x2="210" y2="210" stroke="orange" stroke-width="6" /> <line x1="208" y1="208" x2="40" y2="420" stroke="orange" stroke-width="12" /> <circle cx="55" cy="50" r="5" fill="black" /> <circle cx="40" cy="110" r="20" fill="red" /> <circle cx="262" cy="210" r="40" fill="green" /> <circle cx="150" cy="420" r="75" fill="purple" /> </svg> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js