flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
41
VISUALIZACION/node_modules/3d-force-graph/example/text-links/index.html
generated
vendored
Executable file
41
VISUALIZACION/node_modules/3d-force-graph/example/text-links/index.html
generated
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
<head>
|
||||
<style> body { margin: 0; } </style>
|
||||
|
||||
<script src="//unpkg.com/3d-force-graph"></script>
|
||||
<!--<script src="../../dist/3d-force-graph.js"></script>-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="3d-graph"></div>
|
||||
|
||||
<script type="importmap">{ "imports": { "three": "//unpkg.com/three/build/three.module.js" }}</script>
|
||||
<script type="module">
|
||||
import SpriteText from "//unpkg.com/three-spritetext/dist/three-spritetext.mjs";
|
||||
|
||||
const Graph = ForceGraph3D()
|
||||
(document.getElementById('3d-graph'))
|
||||
.jsonUrl('../datasets/miserables.json')
|
||||
.nodeLabel('id')
|
||||
.nodeAutoColorBy('group')
|
||||
.linkThreeObjectExtend(true)
|
||||
.linkThreeObject(link => {
|
||||
// extend link with text sprite
|
||||
const sprite = new SpriteText(`${link.source} > ${link.target}`);
|
||||
sprite.color = 'lightgrey';
|
||||
sprite.textHeight = 1.5;
|
||||
return sprite;
|
||||
})
|
||||
.linkPositionUpdate((sprite, { start, end }) => {
|
||||
const middlePos = Object.assign(...['x', 'y', 'z'].map(c => ({
|
||||
[c]: start[c] + (end[c] - start[c]) / 2 // calc middle point
|
||||
})));
|
||||
|
||||
// Position sprite
|
||||
Object.assign(sprite.position, middlePos);
|
||||
});
|
||||
|
||||
// Spread nodes a little wider
|
||||
Graph.d3Force('charge').strength(-120);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue