-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: moved graph weighting and coloring to backend
- Loading branch information
Showing
6 changed files
with
51 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SpriteText from "//unpkg.com/three-spritetext/dist/three-spritetext.mjs"; | ||
|
||
fetch("http://localhost:11975/graph") | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
const Graph = ForceGraph3D()(document.getElementById("3d-graph")) | ||
.graphData(data) | ||
.nodeAutoColorBy("group") | ||
.nodeThreeObject((node) => { | ||
const sprite = new SpriteText(node.name); | ||
sprite.material.depthWrite = false; | ||
sprite.color = node.color; | ||
sprite.textHeight = 8; | ||
return sprite; | ||
}) | ||
.linkOpacity(0.8) // NOTE: baseline opacity can be adjusted, but keep high | ||
.linkColor((link) => link.color); | ||
// Spread nodes a little wider | ||
Graph.d3Force("charge").strength(-120); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters