Last active
July 6, 2017 03:27
-
-
Save aaizemberg/ee244dc1196b3491837ca4478cbf45ea to your computer and use it in GitHub Desktop.
Time Scale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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