在这里,您可以找到带有可编辑标签的图表(使用SVG foreinobject).
nodes.append("foreignObject") .attr({width: 100, height: 100}) .append("xhtml:body") .append("xhtml:span") .attr("contenteditable", true) .html(function(d) { return d.name }) .on("keyup", function(d, i) { console.log(d3.select(this).text()); });
http://jsfiddle.net/J9HZ2/
如果我移除拖拽力,Chrome和FF就可以了.
问题是它在Chrome上运行不正常.好吧,在Firefox上.一个主意 ?
谢谢
雅尼克