这是D3的新手,也是JS的新手.我试图在点击上创建一个圆圈,一旦创建该圆圈需要反复脉动.现在,它正在被正确创建并且它会进行一次转换,但之后由于错误而死亡.这是我的代码:
var shapesAtt = shapes
// omitted: assigning fill, position, etc; working as intended
.on("click", circleMouseClick);
function circleMouseClick(d, i)
{
createPulse(this);
}
function createPulse(focusElement)
{
// takes in "focal circle" element
// some things here are hard coded for ease of reading
// (i.e. these variables aren't all useless)
var focus = d3.select(focusElement);
var origR = focus.attr("r");
var origX = focus.attr("cx");
var origY = focus.attr("cy");
var origFill = focus.style("fill");
var strokeColor = "black";
var newG = svgContainer.append("g");
var pulser = …Run Code Online (Sandbox Code Playgroud)