D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
majomo
Full window
Github gist
Average Annual Incomes by Regional District in BC.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Average Annual Incomes by Regional District in BC</title> <script type="text/javascript" src="https://d3js.org/d3.v3.js"></script> <style type="text/css"> svg{background-color: #818785;} rect:hover { fill: #2BCC14; } </style> </head> <body> <script type="text/javascript"> var svg = d3.select("body") .append("svg") .attr("width", 900) .attr("height", 3200); d3.csv("Core_Housing_Need_data.csv", function(data) { data.sort(function(a, b) { return d3.descending(+a.Total_all_Average_Household_Income, +b.Total_all_Average_Household_Income); }); var rects = svg.selectAll("rect") .data(data) .enter() .append("rect") rects.attr("x", 0) .attr("y", function(d, i) { return i * 25; }) .attr("width", function(d) { return d.Total_all_Average_Household_Income / 100; }) .attr("height", 20) .attr("fill", "#9DFEFF") .append("title") .text(function(d) { return d.Geography + "'s average household income in " + d.Year + " was $" + d.Total_all_Average_Household_Income; }) }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js