D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
phtseng
Full window
Github gist
Module 2
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Loading CSV Prisons Data with D3</title> <script type="text/javascript" src="https://d3js.org/d3.v3.js"></script> <style type="text/css"> body { background-color: #ddddff; } svg { background-color: white; } </style> </head> <body> <svg width="800" height="500"> <line x1="50" y1="10" x2="50" y2="50" stroke="black" stroke-width="3" /> <line x1="50" y1="110" x2="50" y2="100" stroke="blue" stroke-width="3" /> <line x1="50" y1="210" x2="50" y2="150" stroke="black" stroke-width="3" /> <circle cx="150" cy="110" r="50" fill="violet" /> <circle cx="250" cy="110" r="50" fill="blue" /> <circle cx="350" cy="110" r="50" fill="green" /> <line x1="450" y1="10" x2="50" y2="50" stroke="black" stroke-width="3" /> <line x1="450" y1="110" x2="50" y2="100" stroke="blue" stroke-width="3" /> <line x1="450" y1="210" x2="50" y2="150" stroke="black" stroke-width="3" /> </svg> <script type="text/javascript"> //Load in contents of CSV file d3.csv("priceofprisonsperinmate.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