transition.delay()

transition.delay([value])

For each selected element, sets the transition delay to the specified value in milliseconds. The value may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum d and index i, with the this context as the current DOM element. The function’s return value is then used to set each element’s transition delay. If a delay is not specified, it defaults to zero.

If a value is not specified, returns the current value of the delay for the first (non-null) element in the transition. This is generally useful only if you know that the transition contains exactly one element.

Setting the delay to a multiple of the index i is a convenient way to stagger transitions across a set of elements. For example:

transition.delay(function(d, i) { return i * 10; });

Of course, you can also compute the delay as a function of the data, or sort the selection before computed an index-based delay.

doc_D3_Js
2016-11-24 10:29:22
Comments
Leave a Comment

Please login to continue.