Sunday 15 March 2015

javascript - Why isnt `d` defined in d3.behavior.drag() -


I am trying to make a circleable.

  drag drag = d3.behavior (); Drag.on ("drag", function (d, i) {console.log (d); dx + = d3.event.dx; dy + = d3.event.dy; // This center will replace the coordinates Delta D 3. Sealat (this) .attr ("x", dx) .attr ("y", dy); // It should replace the upper left x and y values ​​from Delta D3. (It) .attr (" Conversion ", function (D, I) {return" translation ("+ [x, y] +") "})})   

here

Throws errors for every move on the right red circle, but how is it saying that d is undefined in 3, 4 and 5 rows?

D, I arguments usually refers to the bound data, but you are not binding any data in your case with only the event Enough to work.

  drag.on ("drag", function () {d3.select (this) .attr ("cx", + d3. ("C"), d 3.select (it ) .attr ("cy", + d3.select (this) .attr ("cy") + d3.event Select (this) .attr ("cx") .ad);}) l    

No comments:

Post a Comment