我有以下代码用于确定元素是否与另一个节点在同一个x轴上结束...
function dragended(d, i) {
var selection = svg.selectAll("g")
console.log("Drag Ended "+selection.size())
selection.each(function(s){
if(d != s && (d.x > (s.x-15) && d.x < (s.x+15))){
// In here I need to figure out the text
}
});
}
渲染的svg看起来像这样......
<g>
<circle r="30" stroke="black" fill="blue" cx="312.95009190616844" cy="255.4427197617464"></circle>
<text text-anchor="middle" fill="white" font-family="sans-serif" font-size="10px" dx="312.95009190616844" dy="255.4427197617464">FAA</text>
</g>
所以基本上我想要FAA,我如何获得这些信息?