在阅读了几个教程之后,我仍然对如何在 d3 中的 DOM 和数据之间导航有一些困难。对于以下示例,我只想将圆圈添加到选定的圆圈:
http://jsfiddle.net/stefanf/6Qm2z/13/'obj = {“名称”:“Q”,“大小”:1}
// how could I add it only to the selected element?
node.children.push(obj)
refreshGraph()'
但不确定,我如何从 d3.select(".selected") 导航到它的数据......?