The .icon( ) method specifies a specific key in the data that points to an image URL. These icons are used in Legends and Tooltips.
Additionally, in this example, advanced parameters of the icon can be set, including the "style", which defines whether or not to fill the background square with the object's color.
Featured on D3plus.org