Created
February 17, 2014 03:13
-
-
Save aaizemberg/9044072 to your computer and use it in GitHub Desktop.
vector --> "html table" using d3.js
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> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>tablas desde d3.js</title> | |
<style> | |
table, td, th { | |
border:1px solid green; | |
} | |
th { | |
background-color:green; | |
color:white; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
var vector = [44,33,22,11]; | |
var table = d3.select("body").append("table"); | |
table.append("tr").append("th").text("título"); | |
table.selectAll("tr") | |
// .data(vector) | |
.data(vector, function(d) {return d;} ) | |
.enter() | |
.append("tr") | |
.append("td") | |
.text(function(d) { return d; }); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment