index.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
table {
border-collapse: collapse;
}
td, th {
text-align: right;
border-bottom: 1px solid #CCC;
padding: 3px;
}
.tableRow:hover {
background-color: #ccc;
cursor: pointer;
}
</style>
</head>
<body>
<table></table>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<script>
d3.tsv("group1.tsv", ready);
function ready(error, data) {
if (error) return console.warn(error);
var d3Table = d3.select("table");
var tableTitle = d3Table.append("tr");
tableTitle.append("th")
.text("x")
.attr("class", "tableTitle");
tableTitle.append("th")
.text("y")
.attr("class", "tableTitle");
var d3Tabler = d3Table.selectAll(".tableRow")
.data(data)
.enter()
.append("tr")
.attr("class", "tableRow")
d3Tabler.append("td")
.text( function (d) { return d.x; });
d3Tabler.append("td")
.text( function (d) { return d.y; });
};
</script>