D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
SassOnTheRoad
Full window
Github gist
London Borough Profiles Small
<!DOCTYPE html> <meta charset="utf-8"> <style> .chart div { font: 10px sans-serif; background-color: steelblue; text-align: right; padding: 3px; margin: 1px; color: white; } </style> <div class="chart"></div> <script src="https://d3js.org/d3.v3.min.js"></script> <script> d3.csv("London-Borough-Profiles.csv", function(d) { barChartIt(d); return { area: d.area, pop: d.pop, hec: d.hec }; }); function barChartIt(d){ pop_data = d.map(function(ds){return ds.pop}) max_pop = d3.max(pop_data); var x = d3.scale.linear() .domain([0, max_pop]) .range([0, 420]); d3.select(".chart") .selectAll("div") .data(pop_data) .enter().append("div") .style("width", function(pop_data) { return x(pop_data)/100 + "px"; }) .text(function(pop_data) { return pop_data; }); }; </script>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js