Last active
September 11, 2019 22:33
-
-
Save biovisualize/b3b7b1d618670a5500c64bad2ced25fd to your computer and use it in GitHub Desktop.
Network viz
This file contains hidden or 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
<html> | |
<head> | |
<script src="//unpkg.com/3d-force-graph"></script> | |
<style> | |
body { margin: 0; } | |
</style> | |
</head> | |
<body> | |
<div id="3d-graph"></div> | |
<script> | |
function drawGraph(_data) { | |
const elem = document.getElementById('3d-graph') | |
const distance = 800 | |
let highlightNodes = []; | |
const Graph = ForceGraph3D()(elem) | |
.graphData(_data) | |
.nodeLabel(node => node.id) | |
.enableNavigationControls(false) | |
.cameraPosition({ z: distance }) | |
.backgroundColor("#121212") | |
window.addEventListener("resize", () => Graph.width(window.innerWidth)); | |
} | |
fetch("https://gist.githubusercontent.com/biovisualize/4f4a0fc62e3bc81076e001eb7a6443bc/raw/a0248a0e85c7d803373e3c733a1b3f490a67237b/top20_airports.json") | |
.then(response => response.text()) | |
.then((data) => { | |
drawGraph(JSON.parse(data)) | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment