Last active
January 4, 2019 11:48
-
-
Save LironHazan/7a5f0de0097f79d412260bf05c3dd5c3 to your computer and use it in GitHub Desktop.
for medium post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const forceSimulation = (d3, {width, height}) => d3.forceSimulation() | |
.force("charge", d3.forceManyBody()) | |
.force("center", d3.forceCenter(width / 2, height / 2)); | |
// use: | |
const simulation = forceSimulation(d3, {width,height}); | |
simulation.force("link", | |
d3.forceLink() | |
.id(function (d) {return d.id;}) | |
.distance(200) | |
.strength(2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment