D3: Circle Drag Event

Forked script below was adapted to D3.js v4 from v3

D3.js Circle Drag Event
  • .attrs({}) v4 method contains multiple element attribute tuples and requires https://d3js.org/d3-selection-multi.v1.min.js plugin, e.g. .attrs({ width: width, height: height }). Replacing v3’s .attr({}).
  • d3.scaleOrdinal(d3.schemeCategory10) v4 method requires the d3.v4.min.js library. D3.js categorical scales map integers to colors.
  • v4’s d3.drag().on('drag', onDrag) replaced v3’s d3.behavior.drag().on('drag', onDrag).

Forked v4 script above. Original v3 script below.

D3.js 3.5.17 seems to have a similar existence to Python 2.7.13. Maintained to avoid alienating v3 users.