linkDistance and linkStrength called with no arguments return function, not value #895

ezyang opened this Issue Nov 14, 2012 · 3 comments


None yet

3 participants

ezyang commented Nov 14, 2012

As seen in this transcript:

> force.linkDistance
function (x) {
      if (!arguments.length) return linkDistance;
      linkDistance = d3_functor(x);
      return force;
> force.linkDistance()
function () {
      return v;
> force.linkDistance()()

This is not consistent with the other methods.


This is expected because linkDistance and linkStrength can take functions as well as constants. If you specify a constant, it is converted to a function internally.


This is a valid bug, though; the code shouldn't expose the fact that it's converting constants to a function internally. I was just lazy.


Ha! :)

@mbostock mbostock closed this in d287b63 Feb 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment