D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
yppmark
Full window
Github gist
D3 Exercise 2
<!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> <STYLE TYPE="text/css"> body{ background-color: white; } p { font-family: Helvetica, font-size: 14px; line-height: 18px; } svg { background-color: Grey; } </Style> </head> <body> <p>I AM THE DATA ROBOT! FEED ME DATA!! NOM NOM NOM</p> <svg width="415" height="200"> <line x1="150" y1="150" x2="250" y2="150" stroke="black" stroke-width="25" /> <line x1="160" y1="150" x2="240" y2="150" stroke="yellow" stroke-width="5" /> <circle cx="300" cy="50" r="50" fill="black" /> <circle cx="100" cy="50" r="50" fill="black" /> <circle cx="300" cy="50" r="10" fill="yellow" /> <circle cx="100" cy="50" r="10" fill="yellow" /> </svg> <script type="text/javascript"> //Load in contents of CSV file d3.csv("SleepInMammals.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