mirror of
https://github.com/kalmarek/SmallHyperbolic
synced 2024-11-23 15:35:27 +01:00
add vertical/radial force
This commit is contained in:
parent
007a8bcece
commit
c42a98459a
7
docs/morphisms/js/d3_visualisation.js
vendored
7
docs/morphisms/js/d3_visualisation.js
vendored
@ -81,11 +81,14 @@ async function create_svg(
|
|||||||
.text(n=>n.id)
|
.text(n=>n.id)
|
||||||
|
|
||||||
const simulation = d3.forceSimulation(nodes)
|
const simulation = d3.forceSimulation(nodes)
|
||||||
|
// .alphaTarget(0.35)
|
||||||
|
// .alphaDecay(0.5)
|
||||||
.force("link", d3.forceLink(links).id(d => d.id))
|
.force("link", d3.forceLink(links).id(d => d.id))
|
||||||
.force("charge", d3.forceManyBody().strength(-400))
|
.force("charge", d3.forceManyBody().strength(-500))
|
||||||
.force("center", d3.forceCenter(width/2, height/2))
|
.force("center", d3.forceCenter(width/2, height/2))
|
||||||
.force("x", d3.forceX())
|
.force("x", d3.forceX())
|
||||||
.force("y", d3.forceY());
|
.force("y", d3.forceY().y(d => 100 * (2 * d.level + 1)))
|
||||||
|
.force("radial", d3.forceRadial(d => 20 * (2*d.level), width/2, 0))
|
||||||
|
|
||||||
const svg = d3.create("svg")
|
const svg = d3.create("svg")
|
||||||
.attr("preserveAspectRatio", "xMinYMin meet")
|
.attr("preserveAspectRatio", "xMinYMin meet")
|
||||||
|
Loading…
Reference in New Issue
Block a user