Last active
November 16, 2017 18:46
-
-
Save limscoder/65be5dd6fb0aeac982f76505953dbd01 to your computer and use it in GitHub Desktop.
d3 current selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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