D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
kelpenhagen
Full window
Github gist
Threatened Species Test
<!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: #66CC99; } svg { background-color: #387A99; } </style> </head> <body> <svg width="500" height="250"> <line x1="10" y1="10" x2="90" y2="90" stroke="#FDFFE3" stroke-width="3" /> <line x1="400" y1="20" x2="390" y2="60" stroke="#FDFFE3" stroke-width="3" /> <line x1="180" y1="180" x2="150" y2="189" stroke="#FDFFE3" stroke-width="3" /> <line x1="400" y1="125" x2="400" y2="220" stroke="#2E2F2D" stroke-width="2" /> <circle cx="450" cy="240" r="25" fill="#FDFFE3" /> <circle cx="400" cy="10" r="5" fill="#FDFFE3" /> <circle cx="350" cy="140" r="15" fill="#FDFFE3" /> <circle cx="200" cy="40" r="30" fill="#FDFFE3" /> <circle cx="10" cy="140" r="25" fill="#FDFFE3" /> <circle cx="90" cy="140" r="30" fill="#2E2F2D" /> <circle cx="220" cy="200" r="30" fill="#2E2F2D" /> <circle cx="300" cy="90" r="30" fill="#2E2F2D" /> <text x="50" y="125" fill=" #FDFFE3" font-size="42" font-weight="regular" font-family="Futura">This is a test ...</text> </svg> <script type="text/javascript"> //Load in contents of CSV file d3.csv("Threatened_Species.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