flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
40
BACK_BACK/node_modules/force-graph/example/beeswarm/index.html
generated
vendored
Executable file
40
BACK_BACK/node_modules/force-graph/example/beeswarm/index.html
generated
vendored
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
<head>
|
||||
<style> body { margin: 0; } </style>
|
||||
|
||||
<script src="//unpkg.com/force-graph"></script>
|
||||
<!--<script src="../../dist/force-graph.js"></script>-->
|
||||
|
||||
<script src="//unpkg.com/d3-quadtree"></script>
|
||||
<script src="//unpkg.com/d3-force"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="graph"></div>
|
||||
|
||||
<script>
|
||||
// Random tree
|
||||
const N = 300;
|
||||
const nodes = [...Array(N).keys()].map(i => ({
|
||||
id: i,
|
||||
pos: Math.random()
|
||||
}));
|
||||
|
||||
const Graph = ForceGraph()
|
||||
(document.getElementById('graph'));
|
||||
|
||||
Graph
|
||||
// Deactivate existing forces
|
||||
.d3Force('center', null)
|
||||
.d3Force('charge', null)
|
||||
|
||||
// Add collision and x/y forces
|
||||
.d3Force('collide', d3.forceCollide(Graph.nodeRelSize()))
|
||||
.d3Force('x', d3.forceX(d => (d.pos - 0.5) * window.innerWidth))
|
||||
.d3Force('y', d3.forceY(0).strength(0.2))
|
||||
|
||||
// Add nodes
|
||||
.graphData({ nodes, links: [] });
|
||||
|
||||
setTimeout(() => Graph.zoom(0.99), 1);
|
||||
</script>
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue