Skip to content

Instantly share code, notes, and snippets.

@ndarville ndarville/README.md
Last active Aug 29, 2015

Embed
What would you like to do?
Løkke vs. Vestager
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
}
</style>
<script src="http://d3js.org/d3.v3.min.js"></script>
<div class="chart"></div>
<script>
var data = [2000, 160000];
var format = d3.formatPrefix(d3.max(data));
var x = d3.scale.linear()
.domain([0, d3.max(data)])
.range([0, 800]);
d3.select(".chart")
.selectAll("div")
.data(data).enter()
.append("div")
.style("width", function(d) { return x(d) + "px"; })
.text(function(d) {
return format.scale(d) + format.symbol;
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.