D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
fdaudens
Full window
Github gist
D3-barchart
<html> <head> <title>Graphique en barres</title> <script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> </head> <body> <script type="text/javascript"> var svg = d3.select("body") .append("svg") .attr("width", 635) .attr("height", 3100) d3.csv("2011_participation.csv", function(data) { data.sort(function(a, b) { return d3.descending(a.tauxParticipation, b.tauxParticipation); }); 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.tauxParticipation * 5; }) .attr("height", 8) .append("title") .text(function(d) { return "Taux de participation dans " + d.circonscription + " : " + d.tauxParticipation + " %" }); }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js