select second column of table using d3.js
function tabulate(data, columns) {
var table = d3.select("body").append("table")
.attr("style", "margin-left: 250px"),
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-family: Courier")
.html(function(d) { return d.value; });
return table;
}
// render the table
var peopleTable = tabulate(data, ["date", "close"]);
Also in JavaScript:
- remove required attribute jquery
- create element javascript with id
- sequelize path
- title javascript
- node js colors
- javascript extend array
- Who invented Yhe Javascript Programmming Language
- expressjs cheat sheet
- manifest.json basic structure
- scrollview not working react-native
- how to remove a value from an array and return the new array in javascript
- javascript define a global variable
- how to generate a fibonacci sequence in javascript
- date().toisostring().slice(0 10) giving wrong result
- js make radio checked
- end code nodejs
- delete kvp object
- toast in react native
- javascript reverse array without modifying
- pure javascript scratchcard
- javascript scroll to top of page
- jquery add attribute
- javascript filter array of objects
- check array empty or not in javascript