How can I assign a width to the graph shown here - e.g. as a nested, padded element? As shown, the graph takes up the entire page width; I'd like to specify a size, e.g. 800px x 600px.
Is a CSS solution possible, e.g. containing <div id="3d-graph"></div> within another DIV element?
Code source: https://github.com/vasturiano/3d-force-graph ("Images as nodes")
<head>
<script src="//unpkg.com/3d-force-graph"></script>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut fringilla enim. </p>
<div id="3d-graph"></div>
<p>Suspendisse efficitur pulvinar elementum. Vestibulum a est eu erat rutrum scelerisque non et diam.</p>
<script type="module">
import SpriteText from "https://esm.sh/three-spritetext";
const Graph = new ForceGraph3D(document.getElementById('3d-graph'))
.jsonUrl('https://raw.githubusercontent.com/vasturiano/3d-force-graph/c8019651c7a851ebcd7ef595123b631fe6eca3eb/example/datasets/miserables.json')
.nodeAutoColorBy('group')
.nodeThreeObject(node => {
const sprite = new SpriteText(node.id);
sprite.material.depthWrite = false;
sprite.color = node.color;
sprite.textHeight = 6;
return sprite;
});
</script>
</body>
Graph.width(1200)andGraph.height(800); I'd prefer a more flexible CSS solution; (2) why theWARNING: Multiple instances of Three.js being imported.error?