Simulation
# d3.forceSimulation([nodes]) <>
Creates a new simulation with the specified array of nodes and no forces. If nodes is not specified, it defaults to the empty array. The simulator starts automatically; use simulation.on to listen for tick events as the simulation runs. If you wish to run the simulation manually instead, call simulation.stop, and then call simulation.tick as desired.
創(chuàng)建一個力的模擬器请梢,如果nodes不傳谐宙,則默認(rèn)為空數(shù)組皂股。 模擬器是自動開始模擬的,不需要你手動開始凿跳,但是如果你想手動開始模擬,則可以調(diào)用simulation.stop()和similation.tick()
Restarts the simulation’s internal timer and returns the simulation. In conjunction with simulation.alphaTarget or simulation.alpha, this method can be used to “reheat” the simulation during interaction, such as when dragging a node, or to resume the simulation after temporarily pausing it with simulation.stop.
restart 重新調(diào)用模擬器內(nèi)部的定時器重新模擬
# simulation.nodes([nodes])
冷卻系數(shù)桐腌,當(dāng)冷卻系數(shù)小于設(shè)置的最小冷卻系數(shù)的時候拄显,simulation停止布局完成
simulation.velocityDecay([decay])
If decay is specified, sets the velocity decay factor to the specified number in the range [0,1] and returns this simulation. If decay is not specified, returns the current velocity decay factor, which defaults to 0.4. The decay factor is akin to atmospheric friction; after the application of any forces during a tick, each node’s velocity is multiplied by 1 - decay. As with lowering the alpha decay rate, less velocity decay may converge on a better solution, but risks numerical instabilities and oscillation.
設(shè)置節(jié)點(diǎn)的速度衰減的快慢,如果設(shè)置過大的時候案站,節(jié)點(diǎn)就會很快進(jìn)入到穩(wěn)定狀態(tài)躬审,但是這樣可能節(jié)點(diǎn)不會處于最恰當(dāng)?shù)奈恢茫@點(diǎn)和冷卻系數(shù)有點(diǎn)一樣蟆盐。
manyBody.theta([theta]) <>
用來指定計算精度的