Skip to content

Instantly share code, notes, and snippets.

@huyng
Last active August 29, 2015 13:56
Show Gist options
  • Save huyng/9340198 to your computer and use it in GitHub Desktop.
Save huyng/9340198 to your computer and use it in GitHub Desktop.
world map and events
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: white;
stroke-width: 0.25px;
fill: grey;
}
svg {
margin:40px auto;
width: 960px;
height:600px;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960,
height = 600;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var text = svg.append("text")
.attr("x", 480)
.attr("y", 300)
.attr("font-size", 100)
.attr("font-family", "sans-serif")
.attr("fill", "red");
var event_queue = ["A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P" , "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z"];
var epoch = 0;
function draw() {
epoch = (epoch + 1) % event_queue.length;
text.text(event_queue[epoch]);
console.log(epoch);
}
// call draw every 1 second
setInterval(draw, 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment