D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
wsreedy
Full window
Github gist
USA Population, 2010-2014, d3 csv and svg
<!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.min.js"></script> </head> <body> <p>This is an example of a picture drawn with SVG and using D3.js to load data. Check the console for the data.</p> <script type="text/javascript"> //Load in contents of CSV file d3.csv("USA 2010 Population, 2011-2014 estimates by State.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="600" height="400"> <line x1="250" y1="80" x2="10" y2="390" stroke="blue" stroke-width="3" /> <line x1="250" y1="80" x2="390" y2="390" stroke="blue" stroke-width="3" /> <line x1="10" y1="390" x2="390" y2="390" stroke="blue" stroke-width="3" /> <line x1="10" y1="390" x2="120" y2="320" stroke="blue" stroke-width="2" stroke-dasharray="5,5" d="M5 20 l215 0"/> <line x1="250" y1="80" x2="120" y2="320" stroke="blue" stroke-width="2" stroke-dasharray="5,5" d="M5 20 l215 0" /> <line x1="390" y1="390" x2="470" y2="320" stroke="blue" stroke-width="3" /> <line x1="120" y1="320" x2="470" y2="320" stroke="blue" stroke-width="2" stroke-dasharray="5,5" d="M5 20 l215 0" /> <line x1="250" y1="80" x2="470" y2="320" stroke="blue" stroke-width="3" /> <text x="50" y="20" fill="charcoal" font-size="24" font-weight="bold" font-family="Helvetica">this is a pyramid</text> </svg> </body> </html>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js