mySelection.style( name, func, [ priority ] ) in D3.js

Set a CSS style property for elements in the selection based on data.

Arguments

nametypedescription
name String
func Function The function is evaluated for each selected element (in order), being passed the current datum d and the current index i, with the this context as the current DOM element. The function’s return value is then used to set each element’s style property. A null value will remove the style property
priority String [optional] Either null or the string "important".
Return Type
Selection

Description

For more details see https://github.com/mbostock/d3/wiki/Selections#wiki-style.

See Also