D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
denisemauldin
Full window
Github gist
d3 create table
<!doctype html> <html> <head> <meta charset="utf-8"/> <script src="https://unpkg.com/d3@4.10.0/build/d3.min.js"></script> </head> <body> <table class="objecttable"> <thead> <tr><th>name</th><th>age</th><th>gender</th></tr> </thead> <tbody></tbody> </table> <style> .objecttable td { padding: 8px; } </style> <script> var matrix = [ {name: "Lee Gai Fun", age: 42, sex: "M"}, {name: "Laia Hamidullah", age: 27, sex: "F" }, {name: "Abraham Mdulla", age: 33, sex: "M" } ]; var tr = d3.select(".objecttable tbody") .selectAll("tr") .data(matrix) .enter().append("tr"); var td = tr.selectAll("td") .data(function(d, i) { return Object.values(d); }) .enter().append("td") .text(function(d) { return d; }); </script> </body> </html>
https://unpkg.com/d3@4.10.0/build/d3.min.js