D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
carlkra
Full window
Github gist
Table Example
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } svg { width:29%; height: 100% } </style> </head> <body> <script> var columns = ["State","Time","Class","Rank"]; d3.csv("tabledata.csv", function(error, data) { var table = d3.select("#container") .append("table") .classed("table", true), thead = table.append("thead"), tbody = table.append("tbody"); thead.append("tr") .selectAll("th") .data(columns) .enter() .append("th") .text(function(column) { return column; }); var rows = tbody.selectAll("tr") .data(data) .enter() .append("tr"); var cells = rows.selectAll("td") .data(function(row) { return columns.map(function(column) { return {column: column, value: row[column]}; }); }) .enter() .append("td") .text(function(d) { return d.value; }); }); </script> <div id="container"></div> </body>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js