I'm creating a force directed visualization with D3 and want my nodes to be circular images. I have successfully created an image for each node with the below code, but I'm stumped on how to make these images circular rather than rectangular.
var nodeEnter = node.enter().append('g')
.attr('class', 'node')
.on('click', click)
.call(force.drag);
nodeEnter.append('image')
.attr('xlink:href', function(d) {return d.avatarUrl;})
.attr('height', 50)
.attr('width', 50);
nodeEnter.append('a').attr('xlink:href', function(d) {return '/customer/' + d.id;})
.append('text')
.text(function(d) {return d.email;})
.attr('dx', 25)
.attr('dy', '4.5em')
.style('font-size', '14px')
.attr('text-anchor', 'middle');
Here is the current 50 x 50 image. My goal is a circle with a radius of 25px instead.