D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
Contrastat
Full window
Github gist
Graphic of the sorted number of non contributive pension at the local level in Catalunya
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Showing the non contributive pensions</title> <style type="text/css"> </style> <script tpye="text/javascript" src="https://d3js.org/d3.v3.js"></script> </head> <body> <script type="text/javascript"> var svg = d3.select("body") .append("svg") .attr("width",1400) .attr("height", 800); d3.csv("noncontrib.csv", function(dataset) { //console.log(data); //dataset.sort(function(a,b) {return d3.descending(a.Njubilacio, b.Njubilacio);}); dataset.sort(function(a,b) {return b.Njubilacio - a.Njubilacio;}); var rects = svg.selectAll("rect") .data(dataset) .enter() .append("rect"); rects.attr("x",0) .attr("y", function(d,i) { return i*10; }) .attr("width", function(d) { return d.Njubilacio/10; }) .attr("height",8) .append("title") .text(function(d) { return d.Comarca + "'s number of non contrib pensionist per hab is " + d.Njubilacio; }); }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js