Skip to content

Instantly share code, notes, and snippets.

@getsetbro
Created October 5, 2017 14:27
Show Gist options
  • Save getsetbro/8e205c6aaa812bba242903371c0cff36 to your computer and use it in GitHub Desktop.
Save getsetbro/8e205c6aaa812bba242903371c0cff36 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; }
svg{background-color:pink}
</style>
</head>
<body>
<script>
let arr = [9,8,7,6,5,4,3,2,1];
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("viewBox","0 -30 199 269")
.attr("preserveAspectRatio","xMidYMid")
.attr("width", "960px")
.attr("height", "299px")
.append('g');
svg.selectAll("text").data(arr).enter().append("text")
.text(function(d){return d})
.attr("x", function(d){return (d -1) * 55})
.attr("y", function(d){return (d -1) * 8})
.attr("font-size", 36)
.attr("font-family", "monospace")
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment