D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
jbolton9
Full window
Github gist
Cell Phone Usage Data
<!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> <svg width="500" height="200"> <rect width="500" height="200" fill="charcoal" /> <text x="200" y="35" fill="white" font-size="42" font-weight="bold" font-family="Helvetica">0</text> <text x="275" y="35" fill="white" font-size="42" font-weight="bold" font-family="Helvetica">1</text> <line x1="235" y1="85" x2="235" y2="80" stroke="white" stroke-width="5"></line> <line x1="250" y1="25" x2="250" y2="160" stroke="white" stroke-width="2"></line> <line x1="75" y1="15" x2="75" y2="35" stroke="white" stroke-width="5" /> <line x1="425" y1="190" x2="425" y2="160" stroke="white" stroke-width="5" /> <text x="150" y="190" fill="white" font-size="42" font-weight="bold" font-family="Helvetica">Pong-like</text> </svg> <p>Hey, that wasn't so bad for my first coding.</p> <script type="text/javascript"> //Load in contents of CSV file d3.csv("cellphoneusage.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