Update 'README.md'

This commit is contained in:
brian
2018-03-16 11:00:40 +07:00
parent dccb1280e0
commit eed06cfa42

View File

@@ -63,7 +63,7 @@ The implementation is based on [d3.forceLink()](https://github.com/d3/d3-force#f
<a name="forceLinkFullyConnected" href="#forceLinkFullyConnected">#</a> d3.**forceLinkFullyConnected**() [<>](src/link.js "Source") <a name="forceLinkFullyConnected" href="#forceLinkFullyConnected">#</a> d3.**forceLinkFullyConnected**() [<>](src/link.js "Source")
Creates a new link force with default parameters. Creates a new tweaked link force with default parameters.
<a name="springLink_distance" href="#springLink_distance">#</a> *springLink*.**distance**([<i>distance</i>]) <a name="springLink_distance" href="#springLink_distance">#</a> *springLink*.**distance**([<i>distance</i>])
@@ -89,15 +89,15 @@ If *iterations* is specified, sets the number of iterations per application to t
<a name="springLink_latestAccel" href="#springLink_latestAccel">#</a> *springLink*.**latestAccel**() <a name="springLink_latestAccel" href="#springLink_latestAccel">#</a> *springLink*.**latestAccel**()
Returns the average velocity changes of the latest iteration. Returns the average velocity changes of the latest iteration. The value is only calculated if [threshold checking](#springLink_stableVelocity) is enabled.
<a name="springLink_stableVelocity" href="#springLink_stableVelocity">#</a> *springLink*.**stableVelocity**([*threshold*]) <a name="springLink_stableVelocity" href="#springLink_stableVelocity">#</a> *springLink*.**stableVelocity**([*threshold*])
If *threshold* is specified, sets a threshold and returns this force. When the average velocity changes of the system goes below the threshold, the function [onStableVelo's handler](#springLink_onStableVelo) will be called. Set it to 0 or less or remove the [handler](#neighbourSampling_latestForce) to disable the threshold checking. If *threshold* is not specified, returns the current value, which defaults to 0. If *threshold* is specified, sets a threshold and returns this force. When the average velocity changes of the system goes below the threshold, the function [onStableVelo's handler](#springLink_onStableVelo) will be called. Set it to 0 or less or remove the [handler](#springLink_onStableVelo) to disable the threshold checking. If *threshold* is not specified, returns the current value, which defaults to 0.
<a name="springLink_onStableVelo" href="#springLink_onStableVelo">#</a> *springLink*.**onStableVelo**([*handler*]) <a name="springLink_onStableVelo" href="#springLink_onStableVelo">#</a> *springLink*.**onStableVelo**([*handler*])
If *handler* is specified, sets a handler function which will be called at the end of each iteration if the average velocity changes of the system goes below the [threshold](#neighbourSampling_stableVelocity), and returns this force. To remove the handler, change it to null. If *threshold* is not specified, returns the current value, which defaults to null. If *handler* is specified, sets a handler function which will be called at the end of each iteration if the average velocity changes of the system goes below the [threshold](#springLink_stableVelocity), and returns this force. To remove the handler, change it to null. If *threshold* is not specified, returns the current value, which defaults to null.
### Neighbour and Sampling ### Neighbour and Sampling
@@ -133,7 +133,7 @@ If *sampleSize* is specified, sets the sample set size to the specified number a
<a name="neighbourSampling_latestAccel" href="#neighbourSampling_latestAccel">#</a> *neighbourSampling*.**latestAccel**() <a name="neighbourSampling_latestAccel" href="#neighbourSampling_latestAccel">#</a> *neighbourSampling*.**latestAccel**()
Returns the average velocity changes of the latest iteration. Returns the average velocity changes of the latest iteration. The value is only calculated if [threshold checking](#neighbourSampling_stableVelocity) is enabled.
<a name="neighbourSampling_stableVelocity" href="#neighbourSampling_stableVelocity">#</a> *neighbourSampling*.**stableVelocity**([*threshold*]) <a name="neighbourSampling_stableVelocity" href="#neighbourSampling_stableVelocity">#</a> *neighbourSampling*.**stableVelocity**([*threshold*])
@@ -149,11 +149,11 @@ The hybrid layout algorithm reduces the computation power usage even further by
<a name="hybrid" href="#hybrid">#</a> d3.**hybridSimulation**(*simulation*, *forceSample*, [*forceFull*]) [<>](src/hybridSimulation.js "Source") <a name="hybrid" href="#hybrid">#</a> d3.**hybridSimulation**(*simulation*, *forceSample*, [*forceFull*]) [<>](src/hybridSimulation.js "Source")
Creates a new hybrid layout simulation default parameters. The simulation will takeover control of [d3.forceSimulation](https://github.com/d3/d3-force#forceSimulation) provided (*simulation* parameter). *forceSample* and *forceFull* are pre-configured [d3.forceNeighbourSampling](#forceNeighbourSampling) forces to be run over the $\sqrt{n}$ samples and full dataset respectively. While unsupported, other D3 forces such as [d3.forceLinkFullyConnected](forceLinkFullyConnected) may also work. Creates a new hybrid layout simulation default parameters. The simulation will take control of the provided [d3.forceSimulation](https://github.com/d3/d3-force#forceSimulation) (the *simulation* parameter). *forceSample* and *forceFull* are pre-configured [d3.forceNeighbourSampling](#forceNeighbourSampling) forces to be run over the $\sqrt{n}$ samples and full dataset respectively. While unsupported, other D3 forces such as [d3.forceLinkFullyConnected](forceLinkFullyConnected) may also work.
*forceSample* and *forceFull* may have [stableVelocity](neighbourSampling_stableVelocity) configured to end the simulation and begin the interpolation phase early, but any [handler](neighbourSampling_onStableVelo) functions will be replaced be hybridSimulation's own internal function. *forceSample* and *forceFull* may have [stableVelocity](neighbourSampling_stableVelocity) configured to end the relevant phase early, but any [handler](neighbourSampling_onStableVelo) functions will be replaced be hybridSimulation's own internal function.
*forceFull* may also be absent, null, or undefined to skip the final refinement. *forceFull* may also be absent, null, or undefined to skip the final phase.
*simulation* should have already been loaded with nodes. If there are any changes in the list of nodes, the simulation have to be re-set using the [.simulation](#hybrid_simulation) method. *simulation* should have already been loaded with nodes. If there are any changes in the list of nodes, the simulation have to be re-set using the [.simulation](#hybrid_simulation) method.
@@ -163,11 +163,11 @@ If *simulation* is specified, sets the [d3.forceSimulation](https://github.com/d
<a name="hybrid_subSet" href="#hybrid_subSet">#</a> *hybrid*.**subSet**() <a name="hybrid_subSet" href="#hybrid_subSet">#</a> *hybrid*.**subSet**()
Returns the list of nodes in the $\sqrt{n}$ sample set. This is randomly selected on initialization or the nodes list have been refreshed by [.simulation](#hybrid_simulation) method. These nodes will be placed on 2D space from the beginning. Returns the list of nodes in the $\sqrt{n}$ sample set. This is randomly selected on initialization or after the nodes list have been refreshed by [.simulation](#hybrid_simulation) method. These nodes will be placed on 2D space from the beginning.
<a name="hybrid_nonSubSet" href="#hybrid_nonSubSet">#</a> *hybrid*.**nonSubSet**() <a name="hybrid_nonSubSet" href="#hybrid_nonSubSet">#</a> *hybrid*.**nonSubSet**()
Returns the list of nodes outside of the $\sqrt{n}$ sample set. This is randomly selected on initialization or the nodes list have been refreshed by [.simulation](#hybrid_simulation) method. These nodes will be interpolated onto 2D space later on. Returns the list of nodes outside of the $\sqrt{n}$ sample set. This is randomly selected on initialization or after the nodes list have been refreshed by [.simulation](#hybrid_simulation) method. These nodes will be interpolated onto 2D space later on.
<a name="hybrid_forceSample" href="#hybrid_forceSample">#</a> *hybrid*.**forceSample**([*force*]) <a name="hybrid_forceSample" href="#hybrid_forceSample">#</a> *hybrid*.**forceSample**([*force*])
@@ -179,11 +179,11 @@ If *force* is specified, sets the neighbour and sampling force to run on the who
<a name="hybrid_sampleIterations" href="#hybrid_sampleIterations">#</a> *hybrid*.**sampleIterations**([*iterations*]) <a name="hybrid_sampleIterations" href="#hybrid_sampleIterations">#</a> *hybrid*.**sampleIterations**([*iterations*])
If *iterations* is specified, sets the number of iterations to run neighbour and sampling on the $\sqrt{n}$ samples before interpolation and returns this layout simulation. If *iterations* is not specified, returns the current value, which defaults to 300. If *iterations* is specified, sets the number of iterations to run neighbour and sampling on the $\sqrt{n}$ samples before interpolation and returns this layout simulation. If *iterations* is not specified, returns the current value, which defaults to 300. If [stableVelocity](neighbourSampling_stableVelocity) is set on [forceSample](#hybrid_forceSample), the phase may end before the number of iteration reaches the specied value.
<a name="hybrid_fullIterations" href="#hybrid_fullIterations">#</a> *hybrid*.**fullIterations**([*iterations*]) <a name="hybrid_fullIterations" href="#hybrid_fullIterations">#</a> *hybrid*.**fullIterations**([*iterations*])
If *iterations* is specified, sets the number of iterations to run neighbour and sampling on the whole dataset after interpolation and returns this layout simulation. If set to a number less than 1, the process will be skipped. If *iterations* is not specified, returns the current value, which defaults to 20. If *iterations* is specified, sets the number of iterations to run neighbour and sampling on the whole dataset after interpolation and returns this layout simulation. If set to a number less than 1, the process will be skipped. If *iterations* is not specified, returns the current value, which defaults to 20. If [stableVelocity](neighbourSampling_stableVelocity) is set on [forceFull](#hybrid_forceFull), the phase may end before the number of iteration reaches the specied value.
<a name="hybrid_numPivots" href="#hybrid_numPivots">#</a> *hybrid*.**numPivots**([*number*]) <a name="hybrid_numPivots" href="#hybrid_numPivots">#</a> *hybrid*.**numPivots**([*number*])