D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
carlosandrade
Full window
Github gist
Week 2 Module D3 Viz.
<!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>A not too fancy image with data behind the console!</p> <svg width="500" height="400"> <line x1="10" y1="10" x2="190" y2="190" stroke="green" stroke-width="3" /> <line x1="190" y1="190" x2="400" y2="0" stroke="black" stroke-width="3" /> <rect x="200" y="140" width="100" height="100" fill="blue" /> <rect x="300" y="140" width="100" height="100" fill="blue" /> <circle cx="300" cy="140" r="50" fill="blue" /> <circle cx="300" cy="240" r="50" fill="blue" /> <text x="208" y="100" fill="charcoal" font-size="42" font-weight="bold" font-family="Times">Vi's Production</text> </svg> <script type="text/javascript"> //Load in contents of CSV file d3.csv("scbh1.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.js
to a secure url
https://d3js.org/d3.v3.js