https://github.com/thepeoplesbourgeois/d3-vector
A D3 force plug-in for programmatically determining a set of vectors' angles and magnitudes
https://github.com/thepeoplesbourgeois/d3-vector
Last synced: 9 months ago
JSON representation
A D3 force plug-in for programmatically determining a set of vectors' angles and magnitudes
- Host: GitHub
- URL: https://github.com/thepeoplesbourgeois/d3-vector
- Owner: thepeoplesbourgeois
- License: mit
- Created: 2016-12-23T03:04:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-15T16:46:09.000Z (almost 7 years ago)
- Last Synced: 2024-01-25T08:14:26.849Z (over 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-network-analysis - d3-vector: Define connections between nodes as directional vectors
- awesome-network-analysis - d3-vector: Define connections between nodes as directional vectors
README
## d3-vector
A module for [forceSimulations](https://github.com/d3/d3-force) to define connections between nodes as directional vectors, consisting of angles within a cone of dispersion, and magnitudes defined either by a constant or by a function of the individual `vector`s. Reverse-engineered from the [`Link`](https://github.com/d3/d3-force/blob/master/src/link.js) force by Mike Bostock.
#### Usage
Public methods on `vector` are all defined on the `force` object at the bottom of `vector.js`.
- `force.initialize`: begins running the simulation
- `force.nodes`: the data used for each node
- `force.vectors`: the connections between nodes, defined as an array of `source` and `target` objects
- `force.id`: a function to allow the simulation to internally identify each `node` for updates
- `force.iterations`: (ADVANCED) I'm not really sure... it's just kind of a thing that Mike made work and it affects how strongly your force is applied during the simulation
- `force.orientation`: the basis degree for orienting the angles of `force.cone`
- `force.direction`: 'reverse' will invert the cone of dispersion
- `force.strength`: a relative multiplier that affects the potency of each vector while the simulation is running
- `force.magnitude`: either a constant number indicating the length in pixels of each vector, or a function applied to each `vector` to determine its relative length
- `force.cone`: an interpolative scale that is applied to a raw `degree` value to coerce the vector to go in a specific angle relative to its source