D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
wmerrow
Full window
Github gist
Will's module 3 exercise
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Will's module 3 exercise</title> <script type="text/javascript" src="https://d3js.org/d3.v3.js"></script> <style type="text/css"> h1 { color: brown; font-family: sans-serif } body { background-color: whitesmoke } svg { background-color: lightgray } </style> </head> <h1>Number of PACs by Election Year</h1> <body> <script type= "text/javascript"> var svg = d3.select("body") .append("svg") .attr("width", 500) .attr("height", 500) d3.csv("PACdata.csv", function(dataset) { svg.selectAll("rect") .data(dataset) .enter() .append("rect") .attr("x", 0) .attr("y", function(d, i) {return i * 25;} ) .attr("width", function(d) {return d.TotalPACs / 10;}) .attr("height", 15); }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js