The following snippet add d3.geo.circle() object as path element in an svg element. The code is:
var g = svg.append("g");
var circles = g.selectAll("path.circle");
var circle = d3.geo.circle();
circles = circles.data(d3.values(data));
circles
.enter()
.append("path");
.datum(function(d) {
return circle
.origin([d.lon, d.lat])
.angle(0.2)();
})
.attr("class", "circle")
.attr("d", path);
Now, I want to add say, a mouseOver event on these circles, which will log(prints) latitude-longitude information, I cannot access like:
g.selectAll('path.circle')
.on("mouseover", function(d,i) {
console.log(d.lat + "-" + d.lon);
});
I understand that the 'd' represents the d3.geo.circle object, but I could not figure out how to reach the data[i]?