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

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -