Skip to content

Instantly share code, notes, and snippets.

@jwilber
Created September 14, 2019 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwilber/3997db6158324532f27c7b02ba89400a to your computer and use it in GitHub Desktop.
Save jwilber/3997db6158324532f27c7b02ba89400a to your computer and use it in GitHub Desktop.
roughCharts.js logo
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css?family=Gaegu');
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", 960)
.attr("height", 500)
svg.append("text")
.attr("y", 100)
.attr("x", 120)
.attr("font-size", 50)
.attr("font-family", "Gaegu")
.text('roughCharts.js')
.style('opacity', .8)
var data = ["r-o-u-g-h-C-h-a-r-t-s-.-j-s"];
var text = svg.selectAll(null)
.data(data)
.enter()
.append("text")
.attr("y", 200)
.attr("x", 120)
.attr("font-size", 50)
.attr("font-family", "Gaegu")
.text(function(d) {
return d.split("-")[0]
})
.append("tspan")
.style("fill", "coral")
.text(function(d) {
return d.split("-")[1]
}).append("tspan")
.style("fill", "skyblue")
.text(function(d) {
return d.split("-")[2]
}).append("tspan")
.style("fill", "pink")
.text(function(d) {
return d.split("-")[3]
}).append("tspan")
.style("fill", "teal")
.text(function(d) {
return d.split("-")[4]
}).append("tspan")
.style("fill", "teal")
.text(function(d) {
return d.split("-")[5]
}).append("tspan")
.style("fill", "pink")
.text(function(d) {
return d.split("-")[6]
}).append("tspan")
.style("fill", "skyblue")
.text(function(d) {
return d.split("-")[7]
}).append("tspan")
.style("fill", "orange")
.text(function(d) {
return d.split("-")[8]
}).append("tspan")
.style("fill", "blue")
.text(function(d) {
return d.split("-")[9]
}).append("tspan")
.style("fill", "gold")
.text(function(d) {
return d.split("-")[10]
}).append("tspan")
.style("fill", "black")
.text(function(d) {
return d.split("-")[11]
}).append("tspan")
.style("fill", "tan")
.text(function(d) {
return d.split("-")[12]
}).append("tspan")
.style("fill", "tan")
.text(function(d) {
return d.split("-")[13]
})
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment