D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
michquig
Full window
Github gist
Exercise 1: Free lunch in PBC public schools
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Free lunch in PBC schools</title> <style> body { background-color: lightcyan; } p { color: black; font-family: Helvetica, sans-serif; font-size: 18px; padding-left: 10px;; } </style> <script type="text/javascript" src="https://d3js.org/d3.v3.min.js"></script> </head> <body> <svg width="500" height="200"> <circle cx="100" cy="140" r="50" fill="lightgreen" /> <ellipse cx="100" cy="140" rx="20" ry="40" fill="gray" /> <circle cx="200" cy="140" r="50" fill="dodgerblue" /> <ellipse cx="200" cy="140" rx="40" ry="20" fill="gray" /> <circle cx="300" cy="140" r="50" fill="darkturquoise" /> <ellipse cx="300" cy="140" rx="20" ry="40" fill="gray" /> <circle cx="400" cy="140" r="50" fill="turquoise" /> <ellipse cx="400" cy="140" rx="40" ry="20" fill="gray" /> <text x="190" y="50" fill="gray" font-size="42" font-weight="bold" font-family="Helvetica">MY SVG</text> </svg> <p>The percentage of students who qualify for free lunch in Palm Beach County public schools has risen steadily for the past two decades. I want to find out why.</p> <p>Please look in the console to see the data.</p> <script> //Load in contents of CSV file d3.csv("FRlunchdata.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.min.js
to a secure url
https://d3js.org/d3.v3.min.js