lab started

This commit is contained in:
=
2026-03-20 12:01:34 +10:00
parent 757d60e2d3
commit 19e22c4235
6 changed files with 575 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
// создание таблицы
const showTable = (idTable, data) => {
const table = d3.select("#" + idTable);
// создание строк таблицы (столько, сколько элементов в массиве)
const rows = table
.selectAll("tr")
.data(data)
.enter()
.append('tr')
.style("display", "");
// создание ячеек каждой строки на основе каждого элемента массива
const cells = rows
.selectAll("td")
.data(d => Object.values(d))
.enter()
.append("td")
.text(d => d);
// создание шапки таблицы
const head = table
.insert("tr", "tr")
.selectAll("th")
.data(d => Object.keys(data[0]))
.enter()
.append("th")
.text(d => d);
}