d3.js - x coordinate value after drag and drop event -


I am trying to get x-val for a shape so that the code below can be made to make a bela . By Lars Kothoff; But I get the original position in place of the new situation:

  d3.select All ('circle). Each (function () {console.log (d3.select (this) .attr ("cx"))});   

Any ideas on what I'm doing wrong?

You have not told us where you are adding code, but in this example cx is not actually set. Instead, the circle is kept using transform (see drag function). This is what you should ask (or directly data) to get the position. For example:

  d3.selectAll ("circle"). Each (function (e) {console.log (e.x);});   

Full demo

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -

ios - Does Core Data autoupdate a many to many relationship on saving -