D3 provides the exit()
selection that allows us to handle nodes that are on screen, but where the data that they've been bound to no longer exists.
We've adjusted our slider so it no longer controls the y position of our circles. Instead, the slider.on('input')
handler follows these rules:
d3.randomUniform()
until the're the same length.By modifying the length of the data
variable like this, calling the update()
function now has to both add and remove elements.
This code block is preceded by initialization code that defines parent
, svg
, margin
, width
, & height
.