Skip to content

Instantly share code, notes, and snippets.

@iant
Last active August 31, 2017 14:06
Show Gist options
  • Save iant/cbba8092c6111451c1785082edb41a75 to your computer and use it in GitHub Desktop.
Save iant/cbba8092c6111451c1785082edb41a75 to your computer and use it in GitHub Desktop.
LTV 1
<!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="//d3js.org/d3.v3.min.js"></script>
<script>
var data = [5000, 10000, 15000, 20000, 25000, 30000];
var x = d3.scale.linear()
.domain([0, d3.max(data)])
.range([0, 420])
.orient("bottom");
d3.select(".chart")
.selectAll("div")
.data(data)
.enter().append("div")
.style("width", function(d) { return x(d) + "px"; })
.text(function(d) { return d; });
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment