D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
merelyanode
Full window
Github gist
DVD3 Module 3 Assignment. Bar Graph of San Diego County Auto Accident data.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>DVD3mod3_XL</title> <script type="text/javascript" src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> <title>DVD3mod3_XL</title> <style type="text/css"> body { background-color: grey; } svg { background-color: cyan; } </style> </head> <body> <script type="text/javascript"> var svg = d3.select("body") .append("svg") .attr("width", 300) .attr("height", 400); d3.csv("SDcountyAccidents.csv", function(data) { data.sort(function(a, b) { return d3.descending(+a.TOTAL, +b.TOTAL); }); var rects = svg.selectAll("rect") .data(data) .enter() .append("rect"); rects.attr("x", 0) .attr("y", function(d, i) { return i * 10; }) .attr("width", function(d) { return d.TOTAL * .35; }) .attr("height", 3); }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js