score:1

Accepted answer

If you want the position of the circle you moused-over, I would create my .on handler on the circles instead of the g element (this way you know which element received the event):

...
var circles = circleGroup.selectAll("circle")
    .data(circleData)
    .enter()
    .append("circle")
    .on("mouseover", mouseover)
...

function mouseover() {
   var self = d3.select(this);
   alert(self.attr('cx'));
}

Updated fiddle.

EDITS FOR COMMENT

Opps, missed the transition. How about:

function mouseover()
{
    var self = d3.select(this);
    var translate = d3.transform(self.attr("transform")).translate;
    alert(+self.attr('cx') + translate[0]);
}

Updated fiddle 2.


Related Query