Skip to content

Instantly share code, notes, and snippets.

@limscoder
Last active November 16, 2017 18:46
Show Gist options
  • Save limscoder/65be5dd6fb0aeac982f76505953dbd01 to your computer and use it in GitHub Desktop.
Save limscoder/65be5dd6fb0aeac982f76505953dbd01 to your computer and use it in GitHub Desktop.
d3 current selection
// html:
// <ul>
// <li></li>
// <li></li>
// </ul>
const users = [{
id: 1,
name: 'Nancy',
role: 'person'
}, {
id: 2,
name: 'Bart',
role: 'cartoon'
}];
const userList = d3.select('ul.app-user-list');
const updateUsers = userList.selectAll('li.app-user')
.data(users);
console.log(updateUsers.size()); // 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment