transition.attr(name, value)
For each selected element, assigns the attribute tween for the attribute with the specified name to the specified target value. The starting value of the tween is the attribute’s value when the transition starts. The target 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.
If the target value is null, the attribute is removed when the transition starts. Otherwise, an interpolator is chosen based on the type of the target value, using the following algorithm:
- If value is a number, use interpolateNumber.
- If value is a color or a string coercible to a color, use interpolateRgb.
- Use interpolateString.
To apply a different interpolator, use transition.attrTween.
Please login to continue.