{"action":"created","issue":{"url":"https://api.github.com/repos/mbostock/d3/issues/2158","labels_url":"https://api.github.com/repos/mbostock/d3/issues/2158/labels{/name}","comments_url":"https://api.github.com/repos/mbostock/d3/issues/2158/comments","events_url":"https://api.github.com/repos/mbostock/d3/issues/2158/events","html_url":"https://github.com/mbostock/d3/issues/2158","id":52031868,"number":2158,"title":"allow `d3.layout.force().chargeDistance` to take a function","user":{"login":"mhelvens","id":4012816,"avatar_url":"https://avatars.githubusercontent.com/u/4012816?v=3","gravatar_id":"","url":"https://api.github.com/users/mhelvens","html_url":"https://github.com/mhelvens","followers_url":"https://api.github.com/users/mhelvens/followers","following_url":"https://api.github.com/users/mhelvens/following{/other_user}","gists_url":"https://api.github.com/users/mhelvens/gists{/gist_id}","starred_url":"https://api.github.com/users/mhelvens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhelvens/subscriptions","organizations_url":"https://api.github.com/users/mhelvens/orgs","repos_url":"https://api.github.com/users/mhelvens/repos","events_url":"https://api.github.com/users/mhelvens/events{/privacy}","received_events_url":"https://api.github.com/users/mhelvens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-12-15T20:04:13Z","updated_at":"2015-02-11T13:55:27Z","closed_at":null,"body":"A number of settings on the `d3.layout.force()` object are dynamic, like `linkStrength`, `linkDistance` and `charge`. They take a function, so the value can be different for each node or link.\r\n\r\nThis seems to not be the case for `chargeDistance`. Is there a reason for this? It would come in handy for me at the moment. I have a number of isolated groups of nodes with their own gravity and enforced bounds, but still with occasional inter-group links. Having the `chargeDistance` be limited to the group size of each particular node would help both performance and visible behavior."},"comment":{"url":"https://api.github.com/repos/mbostock/d3/issues/comments/73883980","html_url":"https://github.com/mbostock/d3/issues/2158#issuecomment-73883980","issue_url":"https://api.github.com/repos/mbostock/d3/issues/2158","id":73883980,"user":{"login":"mikeazo","id":6683518,"avatar_url":"https://avatars.githubusercontent.com/u/6683518?v=3","gravatar_id":"","url":"https://api.github.com/users/mikeazo","html_url":"https://github.com/mikeazo","followers_url":"https://api.github.com/users/mikeazo/followers","following_url":"https://api.github.com/users/mikeazo/following{/other_user}","gists_url":"https://api.github.com/users/mikeazo/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeazo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeazo/subscriptions","organizations_url":"https://api.github.com/users/mikeazo/orgs","repos_url":"https://api.github.com/users/mikeazo/repos","events_url":"https://api.github.com/users/mikeazo/events{/privacy}","received_events_url":"https://api.github.com/users/mikeazo/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T13:55:27Z","updated_at":"2015-02-11T13:55:27Z","body":"@IPWright83 what you are suggesting is what I ended up doing. It worked well in my case, not sure if it would work in all cases. I made the linkStrength a function that would be dynamically calculated. In my case, I did it based on some properties of the end points as that is what I needed. Theoretically you could compute the length of the link and change the linkStrength accordingly.\r\n\r\nThat said, I still think that having chargeDistance could be useful in certain scenarios."}}