Public
Edited
Jul 29, 2023
Insert cell
Insert cell
Insert cell
Insert cell
table2 = {
var names = _.keys(data[0]);
const table = d3.create("table");
table
.append("thead")
.join("tr")
.selectAll("th")
.data(names)
.join("th")
.text((d) => d)
.style("background-color", "#aaa") // セルの背景色
.style("color", "#fff"); // 文字の色

table
.append("tbody")
.selectAll("tr")
.data(data)
.join("tr")
.selectAll("td")
.data((row) => _.values(row))
.join("td")
.text((d) => d);

return table.node();
}
Insert cell
_.keys()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more