Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Last active July 6, 2017 03:27
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 aaizemberg/ee244dc1196b3491837ca4478cbf45ea to your computer and use it in GitHub Desktop.
Save aaizemberg/ee244dc1196b3491837ca4478cbf45ea to your computer and use it in GitHub Desktop.
Time Scale
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>scaleTime</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<script>
var datos = d3.range(5);
var st = d3.scaleTime()
.domain( d3.extent(datos) )
.range([new Date(1976, 11, 3), new Date(2016, 11, 3)]);
d3.select("body").selectAll("div")
.data( datos )
.enter()
.append("div")
.text( function(d,i) {return st(d); } )
.attr("title", function(d,i) { return (d+1)*10 + " años";} )
.append("hr");
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment