d3-force project
Calling simulation.stop no longer resets the alpha, so a subsequent call to simulation.start now resumes the simulation, and you can call simulation.tick to run the simulation manually. This commit also removes the start event. There’s not much of a point to the start event since it’s impossible to listen for it in the normal case: the event is dispatched during the construction of the simulation before any listeners can be registered. Even in other cases, the simulation is always restarted manually, so you could always notify a listener manually at the same time. Furthermore, supporting a start event would require us to track whether the timer is running, so it’s simpler to just leave it out. (And lastly, eliminating the start event avoids some confusion about the relationship between simulation.stop and the end event, which are unrelated!) Lastly, simplify the recalculation of the current iteration when changing the alpha decay rate constant. |
||
|---|---|---|
| src | ||
| .eslintrc | ||
| .gitignore | ||
| .npmignore | ||
| d3-force.sublime-project | ||
| index.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
d3-force
…
Installing
If you use NPM, npm install d3-force. Otherwise, download the latest release. You can also load directly from d3js.org, either as a standalone library or as part of D3 4.0 alpha. AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3_force global is exported:
<script src="https://d3js.org/d3-collection.v0.1.min.js"></script>
<script src="https://d3js.org/d3-dispatch.v0.4.min.js"></script>
<script src="https://d3js.org/d3-quadtree.v0.7.min.js"></script>
<script src="https://d3js.org/d3-timer.v0.4.min.js"></script>
<script src="https://d3js.org/d3-force.v0.1.min.js"></script>
<script>
var simulation = d3_force.forceSimulation(nodes);
</script>
API Reference
…