我正在使用D3尝试按下按钮后绘制路径,但我无法使其工作。我正在尝试使用此处找到的技术:How to draw a path smoothly from start point to end point in D3.js但我似乎无法使其发挥作用。这就是我所拥有的:
//This is the part that I am having trouble with
var expectedPathLength = expectedGraph.node().getTotalLength();
expectedGraph.attr("stroke-dasharray", expectedPathLength + " " + expectedPathLength)
.attr("stroke-offset", expectedPathLength);
以下是我整个计划的链接:http://codepen.io/nickpalmer789/pen/xOZQaQ?editors=0010。非常感谢任何帮助!