D3将文本附加到SVG矩形
我正在将html附加到D3中的矩形上,以提供多行工具提示。底部是如何添加矩形,这可能是问题的一部分。最重要的是应该在我的世界中工作的代码。 newRect.().html(" <textArea font-family=Verdana font-size=20 fill=blue > Test " + "</br>" + "Test2 </textArea>"); 确实会将文本字段插入SVG,但不会显示: HTML: <rect id="rectLabel" x="490" y="674" width="130" height="160" fill="red"> <textarea fill="blue" font-size="20" font-family="Verdana"> Test </br>Test2 </textarea> </rect> 我有一个鼠标悬停在运行以下功能: newRect = svg.append("rect") .attr("x", xCor) .attr("y", yCor) .attr("width", 130) .attr("height", 160) .attr("fill", "red") .attr("id", "rectLabel"); 我认为我应该这样做,但是不起作用。它只是删除了我要附加的g.node。 newRect = …