Created
February 23, 2018 10:46
-
-
Save bloodyburger/107687079fd18278d6b8a54292094df6 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/rejuzil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
.chart div { | |
font: 10px sans-serif; | |
background-color: steelblue; | |
text-align: right; | |
padding: 3px; | |
margin: 1px; | |
color: white; | |
} | |
.chart rect { | |
fill: steelblue; | |
} | |
.chart text { | |
fill: white; | |
font: 10px sans-serif; | |
text-anchor: end; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="chart"></div> | |
<script> | |
var b = d3.select("body"); | |
var c = b.select(".chart").selectAll("div").data([10,30,35,40,50]).enter().append("div"); | |
d = c.style("width",function(d){ | |
return (d * 1.5) + "px";} | |
) | |
.text(function(d){ return d;}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment