Skip to content

Instantly share code, notes, and snippets.

@postmalloc
Created January 4, 2020 05:47
Show Gist options
  • Save postmalloc/c816dcdcea93bfc78332ef45663db571 to your computer and use it in GitHub Desktop.
Save postmalloc/c816dcdcea93bfc78332ef45663db571 to your computer and use it in GitHub Desktop.
fresh block
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
.chart div {
font: 10px sans-serif;
background-color: steelblue;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
}
</style>
</head>
<body>
<div class='chart'></div>
<script>
// Feel free to change or delete any of the code you see in this editor!
data = [29, 62, 160, 273, 310]
d3.select('.chart')
.selectAll('div')
.data(data)
.enter()
.append('div')
.style('width', d => d + 'px')
.text(d => d + 'px')
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment