Skip to content

Commit 71490ce

Browse files
committed
Add missing force.linkStrength property.
Also update examples to use force.linkDistance instead of force.distance.
1 parent 6a40609 commit 71490ce

5 files changed

Lines changed: 15 additions & 3 deletions

File tree

d3.layout.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ d3.layout.force = function() {
345345
// For backwards-compatibility.
346346
force.distance = force.linkDistance;
347347

348+
force.linkStrength = function(x) {
349+
if (!arguments.length) return linkStrength;
350+
linkStrength = d3.functor(x);
351+
return force;
352+
};
353+
348354
force.friction = function(x) {
349355
if (!arguments.length) return friction;
350356
friction = x;

d3.layout.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/force/force-cluster.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
.nodes(net.nodes)
193193
.links(net.links)
194194
.size([w, h])
195-
.distance(50)
195+
.linkDistance(50)
196196
.start();
197197

198198
hullg.selectAll("path.hull").remove();

examples/force/force.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var vis = d3.select("#chart")
1010
d3.json("miserables.json", function(json) {
1111
var force = d3.layout.force()
1212
.charge(-120)
13-
.distance(30)
13+
.linkDistance(30)
1414
.nodes(json.nodes)
1515
.links(json.links)
1616
.size([w, h])

src/layout/force.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ d3.layout.force = function() {
139139
// For backwards-compatibility.
140140
force.distance = force.linkDistance;
141141

142+
force.linkStrength = function(x) {
143+
if (!arguments.length) return linkStrength;
144+
linkStrength = d3.functor(x);
145+
return force;
146+
};
147+
142148
force.friction = function(x) {
143149
if (!arguments.length) return friction;
144150
friction = x;

0 commit comments

Comments
 (0)