У меня есть 2 связанных вопроса: я хочу добавить таблицу данных из CSV-файла под картой. Оба функционируют правильно. Карта отображается в содержании, но таблица появляется под нижним колонтитулом страницы Drupal. Кто-нибудь может подсказать, как мне отрегулировать его положение? Также в таблице указана вся ширина экрана. Я могу настроить относительную ширину столбцов в таблице, но не всю ширину экрана. Что контролирует это?
function process_table (canada) {
// get the data from the csv file
data=d3.csv(dataCases, function(data) {
data.forEach(function(d) {
d.code=d.Geo_Code,
d.prov=d.Prov_Name,
d.cumulative=d.Cumulative,
d.population=d.Population,
d.percapita=d.Percapita
});
// The table generation function
function tabulate(data, columns) {
var table = d3.select("body")
.append("table")
.attr("style", "margin-left: 60px"),
thead = table.append("thead"),
tbody = table.append("tbody");
// append the header row
thead.append("tr")
.selectAll("th")
.data(columns)
.enter()
.append("th")
.text(function(column) {
return column;
});
// create a row for each object in the data
var rows=tbody.selectAll("tr")
.data(data)
.enter()
.append("tr");
// create a cell in each row for each column
var cells=rows.selectAll("td")
.data(function(row) {
return columns.map(function(column) {
return {column: column, value: row[column]};
});
})
.enter()
.append("td")
.attr("style", "font-size: 12px") // sets the font style
.html(function(d) { return d.value; });
return table;
}
var covidTable = tabulate(data,["prov","cumulative","population","percapita"]);
});
} // end process_table