D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
biovisualize
Full window
Github gist
top 10 airports network viz
<head> <script src="//unpkg.com/force-graph"></script> <style> body { margin: 0; padding: 0; background: #1e1e1e; } </style> </head> <body> <div id="graph"></div> <script> const elem = document.getElementById('graph') const graph = ForceGraph()(elem) function enableInteraction (bool) { graph .enablePointerInteraction(bool) .enableNodeDrag(bool) if (bool) graph.resumeAnimation() else graph.pauseAnimation() } function drawGraph(_data) { graph .graphData(_data) .nodeLabel(node => node.id) .backgroundColor("#1e1e1e") .enableZoomPanInteraction(false) .zoom(1.5) .warmupTicks(5) // .cooldownTime(2000) window.addEventListener("resize", () => graph.width(window.innerWidth)) elem.addEventListener("mouseover", () => enableInteraction(true)) elem.addEventListener("mouseout", () => enableInteraction(false)) } fetch("https://gist.githubusercontent.com/biovisualize/13c002b7873522b6272a463b1c948273/raw/76205b861ebbdf5f7d62460977ae498f70c04bb3/top10_airports.json") .then(response => response.text()) .then((data) => { drawGraph(JSON.parse(data)) }) </script> </body>
https://unpkg.com/force-graph