flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
43
VISUALIZACION/node_modules/3d-force-graph/example/dynamic/index.html
generated
vendored
Executable file
43
VISUALIZACION/node_modules/3d-force-graph/example/dynamic/index.html
generated
vendored
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
<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>
|
||||
const initData = {
|
||||
nodes: [ {id: 0 } ],
|
||||
links: []
|
||||
};
|
||||
|
||||
const elem = document.getElementById("3d-graph");
|
||||
|
||||
const Graph = ForceGraph3D()(elem)
|
||||
.enableNodeDrag(false)
|
||||
.onNodeClick(removeNode)
|
||||
.graphData(initData);
|
||||
|
||||
setInterval(() => {
|
||||
const { nodes, links } = Graph.graphData();
|
||||
const id = nodes.length;
|
||||
Graph.graphData({
|
||||
nodes: [...nodes, { id }],
|
||||
links: [...links, { source: id, target: Math.round(Math.random() * (id-1)) }]
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
//
|
||||
|
||||
function removeNode(node) {
|
||||
let { nodes, links } = Graph.graphData();
|
||||
links = links.filter(l => l.source !== node && l.target !== node); // Remove links attached to node
|
||||
nodes.splice(node.id, 1); // Remove node
|
||||
nodes.forEach((n, idx) => { n.id = idx; }); // Reset node ids to array index
|
||||
Graph.graphData({ nodes, links });
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue