0
을 사용하여 d3 서클에서 HTML을 사용하고 있습니다.d3 - 이물질 - 올바른 범위 얻기
내가 원하는 것은 : D3 내부
- 사용 HTML은
- 는 HTML 코드
외부의 정상 범위에 도달 오브젝트 지금은 기능을 사용하기위한 권리 범위를 얻을 수있는 문제가있다. 내가
내가 D3의 "g"의 요소의 취득 "이"를.html 중에서 내부 (".....")를 사용하는 경우. 내 정상 범위에 도달 할 수있는 방법이 있습니까?
아니면이 문제를 해결할 더 우아한 방법이 있습니까?var foreign = that._foreignObject = d3.select(this).append("foreignObject") .attr("width", 30) .attr("height", 30) .append("xhtml:div") .style("font", "15px 'Arial'") .html("<button name=Klickmich type=button value=play onclick=>");
편집 : 2013년 12월 16일 :
var nodeEnter = node.enter().append("svg:g") .attr("class", "node") .attr("transform", function (d) { return "translate(" + source.y0 + "," + source.x0 + ")"; }) //click once .on("click", function (d) { if (that._foreignObject) { that._foreignObject.remove(); } that.toggle(d); that.update(d); that.onNodeClick(d); var circle = d3.select(this).select("circle") .transition() .duration(750) .attr("r", 17) .attr("width", 40) .attr("heigth", 40) .style("stroke-dasharray", ("5,2")) .style("stroke-width", 2) .style("stroke", "black"); var button = "<button name=Klickmich type=button value=play onclick=>"; var foreign = that._foreignObject = d3.select(this).append("foreignObject") .attr("width", 30) .attr("height", 30) .append("xhtml:div") .style("font", "15px 'Arial'") .html(button) .on("click", function (d) { console.log("heyho"); }); d3.select(this).select("text").transition() .duration(750) .style("font-size", 15) .style("font-weight", "bold") .attr("x", function (d) { return d.children || d._children ? -20 : -20; }); })
정상적인 범위 란 무엇입니까? '이게'무엇 이길 바라 니? –
Object {srcNodeRef : null, _connects : Array [0], _supportingWidgets : Array [0], 매개 변수 : Object, d3 : Object ...} – freeFoodFred
아 스스로 가져 왔습니다. xhtml을 클릭하기 만하면됩니다. div – freeFoodFred